/* ═══ Crystallux Admin Dashboard — shared stylesheet ═══════════════════
   Responsive shell. Loaded by every page in /admin-dashboard/pages/.
   Design tokens lifted from the marketing site (assets/site.css) for
   visual consistency without coupling the two stylesheets — admin
   pages should feel familiar to Mary but never have to ship marketing
   CSS to clients.
   =================================================================== */

:root {
  /* Brand */
  --color-brand-50:  #F8F7FF;
  --color-brand-100: #EDE9FE;
  --color-brand-200: #DDD6FE;
  --color-brand-300: #C4B5FD;
  --color-brand-400: #A78BFA;
  --color-brand-500: #7C3AED;
  --color-brand-600: #6D28D9;
  --color-brand-700: #5B21B6;

  /* Neutral ramp */
  --gray-0:   #FFFFFF;
  --gray-50:  #FAFAFA;
  --gray-100: #F4F4F5;
  --gray-200: #E4E4E7;
  --gray-300: #D4D4D8;
  --gray-400: #A1A1AA;
  --gray-500: #71717A;
  --gray-600: #52525B;
  --gray-700: #3F3F46;
  --gray-800: #27272A;
  --gray-900: #18181B;

  /* Semantic */
  --success: #10B981;
  --warning: #F59E0B;
  --error:   #EF4444;
  --info:    #3B82F6;

  /* Surface tokens */
  --bg-page:    var(--gray-50);
  --bg-card:    var(--gray-0);
  --bg-sidebar: var(--gray-0);
  --bg-hover:   var(--gray-100);
  --border:     var(--gray-200);
  --border-strong: var(--gray-300);

  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted:     var(--gray-500);
  --text-inverse:   var(--gray-0);

  /* Spacing + radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --content-max: 1400px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── App shell: topbar + sidebar + content ──────────────────────── */
.clx-topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}
.clx-topbar-left { display: flex; align-items: center; gap: 14px; }
.clx-topbar-right { display: flex; align-items: center; gap: 12px; }
.clx-logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; color: var(--text-primary);
  letter-spacing: -0.01em;
}
.clx-logo-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-700));
  color: #fff; font-weight: 800; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.clx-role-pill {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 99px;
  background: var(--color-brand-100); color: var(--color-brand-700);
}
.clx-user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.clx-user-chip strong { color: var(--text-primary); font-weight: 600; }
.clx-icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.clx-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.clx-burger { display: none; }

.clx-shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-h)); }

/* Sidebar — sticky on desktop, slide-in on mobile */
.clx-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px;
}
.clx-nav-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 14px 12px 6px;
}
.clx-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
  margin-bottom: 1px;
}
.clx-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.clx-nav-item.active {
  background: var(--color-brand-100); color: var(--color-brand-700);
  font-weight: 600;
}
.clx-nav-icon {
  width: 18px; text-align: center; font-size: 14px; flex-shrink: 0;
}

/* Backdrop for mobile drawer */
.clx-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 40;
  backdrop-filter: blur(2px);
}
.clx-backdrop.show { display: block; }

/* Main content column */
.clx-main { flex: 1 1 0; min-width: 0; width: 100%; }
.clx-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 64px;
}

/* Page header */
.clx-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.clx-page-title {
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.01em; line-height: 1.2;
}
.clx-page-sub {
  font-size: 13.5px; color: var(--text-secondary); margin-top: 4px;
}

/* Cards */
.clx-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}
.clx-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.clx-card-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.clx-card-sub { font-size: 12.5px; color: var(--text-muted); }

/* Stat card grid */
.clx-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.clx-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.clx-stat-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.clx-stat-value {
  font-size: 26px; font-weight: 700; color: var(--text-primary);
  margin-top: 4px; line-height: 1.1;
}
.clx-stat-delta {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.clx-stat-delta.up { color: var(--success); }
.clx-stat-delta.down { color: var(--error); }

/* Tables */
.clx-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.clx-table-scroll { overflow-x: auto; }
.clx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.clx-table th {
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  background: var(--gray-50); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.clx-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.clx-table tbody tr:last-child td { border-bottom: none; }
.clx-table tbody tr:hover td { background: var(--bg-hover); }

/* Badges */
.clx-badge {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.clx-badge-gray   { background: var(--gray-100);  color: var(--gray-700); }
.clx-badge-blue   { background: #DBEAFE; color: #1E40AF; }
.clx-badge-green  { background: #D1FAE5; color: #065F46; }
.clx-badge-yellow { background: #FEF3C7; color: #92400E; }
.clx-badge-red    { background: #FEE2E2; color: #991B1B; }
.clx-badge-purple { background: var(--color-brand-100); color: var(--color-brand-700); }

/* Buttons */
.clx-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  min-height: 36px;
}
.clx-btn-primary {
  background: var(--color-brand-600); color: #fff;
}
.clx-btn-primary:hover { background: var(--color-brand-700); }
.clx-btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border-color: var(--border);
}
.clx-btn-secondary:hover { background: var(--bg-hover); }
.clx-btn-ghost {
  background: transparent; color: var(--text-secondary);
}
.clx-btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.clx-btn-danger {
  background: #FEE2E2; color: #991B1B; border-color: #FCA5A5;
}
.clx-btn-danger:hover { background: #FECACA; }
.clx-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Spinner / skeleton */
.clx-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--color-brand-600);
  border-radius: 50%; animation: clx-spin .8s linear infinite;
}
@keyframes clx-spin { to { transform: rotate(360deg); } }
.clx-loading-row {
  padding: 28px; text-align: center; color: var(--text-muted);
  font-size: 13px;
}

/* Friendly states */
.clx-empty {
  padding: 32px 18px; text-align: center; color: var(--text-muted);
  font-size: 13.5px; line-height: 1.55;
}
.clx-empty .clx-empty-icon {
  font-size: 28px; margin-bottom: 10px; display: block;
}
.clx-error-banner {
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--error);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5;
  margin-bottom: 14px;
}

/* Inputs */
.clx-input, .clx-select {
  width: 100%; padding: 9px 12px;
  font: inherit; font-size: 13.5px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.clx-input:focus, .clx-select:focus {
  border-color: var(--color-brand-500);
  box-shadow: 0 0 0 3px var(--color-brand-100);
}
.clx-field { margin-bottom: 14px; }
.clx-field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 5px;
}

/* ─── Responsive ────────────────────────────────────────────────────
   Below 1024px the sidebar collapses to a fixed-position drawer
   toggled by the burger button in the topbar. min-width:0 on
   .clx-main ensures wide tables don't push the page wider than
   the viewport (the original /dashboard symptom). */
@media (max-width: 1024px) {
  .clx-burger { display: inline-flex; }
  .clx-sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; width: 280px;
    transform: translateX(-100%); transition: transform .22s ease;
    z-index: 60; padding-top: 70px;
    box-shadow: 0 0 30px rgba(0,0,0,0);
    flex-basis: auto;
  }
  .clx-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,0.25);
  }
  .clx-content { padding: 20px 18px 48px; }
}
@media (max-width: 640px) {
  .clx-topbar { padding: 0 14px; }
  .clx-content { padding: 16px 14px 40px; }
  .clx-page-title { font-size: 20px; }
  .clx-stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .clx-table th, .clx-table td { padding: 10px 12px; }
}

/* Print: collapse the chrome so audit reports can be exported */
@media print {
  .clx-topbar, .clx-sidebar, .clx-burger { display: none !important; }
  .clx-content { max-width: none; padding: 0; }
}

/* ════════════════════════════════════════════════════════════════════
   Polish layer — additive enhancements. All prior classes still work.
   Adds: shadows, hover lifts, color-coded stat-card variants,
   inline SVG icon slots, sparkline/donut/bar wrappers, progress bars,
   skeleton loaders, illustrated empty states, section heads, pulse
   badges, avatar circles, score bars, pipeline stages.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --shadow-card:        0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover:  0 8px 24px rgba(76, 29, 149, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-pop:         0 12px 32px rgba(15, 23, 42, 0.12);
  --ring-brand:         0 0 0 3px var(--color-brand-100);

  --icon-sm: 14px;
  --icon-md: 16px;
  --icon-lg: 20px;
  --icon-xl: 28px;
}

/* Cards get a subtle base shadow + smooth hover transition */
.clx-card { box-shadow: var(--shadow-card); transition: box-shadow .15s, border-color .15s; }
.clx-card.--interactive { cursor: pointer; }
.clx-card.--interactive:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-brand-300);
}

/* Stat-card hover + clickable variants */
.clx-stat-card { box-shadow: var(--shadow-card); transition: box-shadow .15s, transform .15s, border-color .15s; }
.clx-stat-card[data-href] { cursor: pointer; }
.clx-stat-card[data-href]:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
  border-color: var(--color-brand-300);
}

/* Color-coded stat-card variants — gradient backgrounds + accent value color */
.clx-stat-card.--leads {
  background: linear-gradient(160deg, var(--color-brand-50), #fff 70%);
  border-color: var(--color-brand-100);
}
.clx-stat-card.--leads .clx-stat-value { color: var(--color-brand-700); }

.clx-stat-card.--revenue {
  background: linear-gradient(160deg, #ECFDF5, #fff 70%);
  border-color: #A7F3D0;
}
.clx-stat-card.--revenue .clx-stat-value { color: #047857; }

.clx-stat-card.--activity {
  background: linear-gradient(160deg, #EFF6FF, #fff 70%);
  border-color: #BFDBFE;
}
.clx-stat-card.--activity .clx-stat-value { color: #1D4ED8; }

.clx-stat-card.--errors {
  background: linear-gradient(160deg, #FEF2F2, #fff 70%);
  border-color: #FECACA;
}
.clx-stat-card.--errors .clx-stat-value { color: #B91C1C; }

.clx-stat-card.--bookings {
  background: linear-gradient(160deg, #FFFBEB, #fff 70%);
  border-color: #FDE68A;
}
.clx-stat-card.--bookings .clx-stat-value { color: #B45309; }

.clx-stat-card.--neutral { background: var(--bg-card); border-color: var(--border); }

/* Stat-card inline icon (top-left, square tinted background) */
.clx-stat-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(124, 58, 237, 0.10); color: var(--color-brand-600);
  margin-bottom: 10px;
}
.clx-stat-card.--revenue .clx-stat-icon  { background: rgba(16, 185, 129, 0.12); color: #047857; }
.clx-stat-card.--activity .clx-stat-icon { background: rgba(59, 130, 246, 0.12); color: #1D4ED8; }
.clx-stat-card.--errors   .clx-stat-icon { background: rgba(239, 68, 68, 0.12);  color: #B91C1C; }
.clx-stat-card.--bookings .clx-stat-icon { background: rgba(245, 158, 11, 0.14); color: #B45309; }

/* Inline SVG icon wrapper — sized via CSS, color via currentColor */
.clx-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--icon-md); height: var(--icon-md);
  vertical-align: middle; flex-shrink: 0;
}
.clx-icon.--sm { width: var(--icon-sm); height: var(--icon-sm); }
.clx-icon.--lg { width: var(--icon-lg); height: var(--icon-lg); }
.clx-icon.--xl { width: var(--icon-xl); height: var(--icon-xl); }
.clx-icon svg {
  display: block; width: 100%; height: 100%;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Sidebar nav icon — replaces the old text-glyph slot */
.clx-nav-item .clx-icon { color: var(--text-muted); }
.clx-nav-item:hover .clx-icon { color: var(--text-primary); }
.clx-nav-item.active .clx-icon { color: var(--color-brand-600); }

/* Section header with brand-accent left bar */
.clx-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 6px 0 12px; padding-left: 10px;
  border-left: 3px solid var(--color-brand-500);
}
.clx-section-head .clx-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.clx-section-head .clx-section-action { font-size: 12.5px; color: var(--text-secondary); }

/* Pulse badge — leading dot with breathe animation for live/active states */
.clx-badge.--pulse::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor; margin-right: 5px;
  animation: clx-pulse 1.5s ease-in-out infinite;
  vertical-align: 0px;
}
@keyframes clx-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* Skeleton loaders */
@keyframes clx-skeleton-pulse {
  0%, 100% { background-color: var(--gray-100); }
  50% { background-color: var(--gray-200); }
}
.clx-skeleton {
  display: inline-block; height: 14px; border-radius: 4px; min-width: 30px;
  background: var(--gray-100); animation: clx-skeleton-pulse 1.4s ease-in-out infinite;
}
.clx-skeleton-line { display: block; height: 12px; margin: 8px 0; }
.clx-skeleton-card {
  padding: 18px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-card); box-shadow: var(--shadow-card);
}
.clx-skeleton-table { padding: 14px 16px; }
.clx-skeleton-table .clx-skeleton-row {
  display: flex; gap: 14px; padding: 11px 0;
  border-bottom: 1px dashed var(--gray-100);
}
.clx-skeleton-table .clx-skeleton-row:last-child { border-bottom: none; }
.clx-skeleton-table .clx-skeleton-row .clx-skeleton { flex: 1; height: 14px; }

/* Progress bar */
.clx-progress {
  display: block; width: 100%; height: 6px; background: var(--gray-100);
  border-radius: 999px; overflow: hidden;
}
.clx-progress-fill {
  display: block; height: 100%; background: var(--color-brand-500);
  border-radius: 999px; transition: width .35s ease;
}
.clx-progress.--success .clx-progress-fill { background: var(--success); }
.clx-progress.--warning .clx-progress-fill { background: var(--warning); }
.clx-progress.--error   .clx-progress-fill { background: var(--error);   }

/* Charts (inline SVG containers) */
.clx-sparkline { display: block; width: 100%; height: 48px; }
.clx-sparkline svg { width: 100%; height: 100%; overflow: visible; }
.clx-sparkline .stroke {
  stroke: var(--color-brand-500); stroke-width: 2; fill: none;
  stroke-linejoin: round; stroke-linecap: round;
}
.clx-sparkline .fill { opacity: 0.35; }
.clx-sparkline .dot  { fill: var(--color-brand-600); }

.clx-donut { display: inline-block; width: 160px; height: 160px; vertical-align: middle; }
.clx-donut svg { width: 100%; height: 100%; }
.clx-donut .center-label { font-size: 22px; font-weight: 700; fill: var(--text-primary); }
.clx-donut .center-sub {
  font-size: 9px; fill: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.clx-bar-chart { display: block; width: 100%; height: 80px; }
.clx-bar-chart svg { width: 100%; height: 100%; }
.clx-bar-chart .bar { fill: var(--color-brand-300); transition: fill .15s; }
.clx-bar-chart .bar:hover { fill: var(--color-brand-500); }

.clx-chart-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12px; color: var(--text-secondary); margin-top: 10px;
}
.clx-chart-legend > span {
  display: inline-flex; align-items: center; gap: 6px;
}
.clx-chart-legend .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
}

/* Illustrated empty state */
.clx-empty-illustrated { padding: 40px 24px; text-align: center; }
.clx-empty-illustrated .clx-empty-icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--color-brand-50); color: var(--color-brand-500);
  margin-bottom: 14px;
}
.clx-empty-illustrated .clx-empty-icon-wrap .clx-icon { width: 28px; height: 28px; }
.clx-empty-illustrated h4 {
  font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px;
}
.clx-empty-illustrated p {
  font-size: 13px; color: var(--text-muted); max-width: 320px; margin: 0 auto 16px;
}

/* Avatar circle */
.clx-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-700));
  color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0.02em;
  flex-shrink: 0;
}
.clx-avatar.--lg { width: 40px; height: 40px; font-size: 14px; }
.clx-avatar.--sm { width: 22px; height: 22px; font-size: 10px; }

/* Score bar (inline 70px progress, used in lead lists) */
.clx-score-bar {
  display: inline-block; width: 70px; height: 6px; border-radius: 999px;
  background: var(--gray-100); position: relative; overflow: hidden;
  vertical-align: middle;
}
.clx-score-bar > i {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--color-brand-500); border-radius: 999px;
}
.clx-score-bar.--low > i      { background: var(--gray-400); }
.clx-score-bar.--medium > i   { background: var(--info); }
.clx-score-bar.--high > i     { background: var(--color-brand-500); }
.clx-score-bar.--critical > i { background: var(--success); }

/* Clickable table rows — extends existing _href pattern with hover styling */
.clx-table tbody tr[data-href] { cursor: pointer; transition: background .12s, box-shadow .12s; }
.clx-table tbody tr[data-href]:hover td { background: var(--color-brand-50); }
.clx-table tbody tr[data-href]:hover td:first-child { box-shadow: inset 3px 0 0 var(--color-brand-500); }

/* Search input with leading icon */
.clx-input-wrap { position: relative; display: block; }
.clx-input-wrap .clx-icon-prefix {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.clx-input-wrap .clx-input { padding-left: 36px; }

/* Pipeline stage strip (used on /pages/onboarding) */
.clx-pipeline {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.clx-pipeline-stage {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
  border-top: 3px solid var(--color-brand-300);
  box-shadow: var(--shadow-card);
}
.clx-pipeline-stage.--active     { border-top-color: var(--success); }
.clx-pipeline-stage.--first-send { border-top-color: var(--info); }
.clx-pipeline-stage .stage-name {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.clx-pipeline-stage .stage-count {
  font-size: 22px; font-weight: 700; color: var(--text-primary); margin-top: 4px;
}

/* Activity timeline (used on activity pages) */
.clx-timeline { position: relative; padding-left: 22px; }
.clx-timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--gray-200);
}
.clx-timeline-item {
  position: relative; padding: 12px 0 14px 12px;
}
.clx-timeline-item::before {
  content: ""; position: absolute; left: -19px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-brand-500); border: 2px solid var(--bg-page);
}
.clx-timeline-item .ti-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.clx-timeline-item .ti-time { font-size: 12px; color: var(--text-muted); }
.clx-timeline-item .ti-detail { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* Responsive tweaks for new components */
@media (max-width: 900px) {
  .clx-pipeline { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .clx-donut { width: 130px; height: 130px; }
  .clx-pipeline { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════
   Crystallux Copilot — admin-only ✦ FAB + slide-out chat panel
   Ported from legacy dashboard/index.html (Phase 8). Light-theme
   adaptation using brand tokens. See OPERATIONS_HANDBOOK §22.
   ══════════════════════════════════════════════════════════════════ */

.clx-copilot-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 120;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-700));
  border: none; color: #fff; font-size: 22px;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
  display: none; align-items: center; justify-content: center;
  transition: transform .15s ease;
}
.clx-copilot-fab:hover { transform: scale(1.06); }
.clx-copilot-fab.show { display: flex; }

.clx-copilot-panel {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: 420px; max-width: 100vw; z-index: 130;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.10);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.clx-copilot-panel.open { transform: translateX(0); }

.clx-copilot-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--color-brand-50), var(--bg-card));
}
.clx-copilot-title {
  font-weight: 700; font-size: 15px; color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 8px;
}
.clx-copilot-title .star {
  display: inline-block; width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-700));
  color: #fff; font-size: 13px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.clx-copilot-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.clx-copilot-close:hover { color: var(--text-primary); }

.clx-copilot-mode {
  padding: 8px 20px; border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-page);
  display: flex; align-items: center; gap: 8px;
}
.clx-copilot-mode select {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 8px; font-size: 11px;
}

.clx-copilot-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  font-size: 13px; line-height: 1.5;
  background: var(--bg-page);
}
.clx-copilot-msg {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 10px;
  color: var(--text-primary); word-wrap: break-word;
}
.clx-copilot-msg.user {
  background: var(--color-brand-50);
  border: 1px solid var(--color-brand-200);
}
.clx-copilot-msg.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.clx-copilot-msg .role {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 4px;
}
.clx-copilot-msg pre {
  background: #1f2937; color: #e5e7eb; padding: 10px;
  border-radius: 6px; overflow-x: auto; font-size: 11.5px;
  margin-top: 8px; white-space: pre-wrap; word-wrap: break-word;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}
.clx-copilot-action {
  display: inline-block; margin-top: 8px; padding: 6px 12px;
  background: var(--color-brand-600); color: #fff; border: none;
  border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.clx-copilot-action:hover { background: var(--color-brand-700); }

.clx-copilot-input-row {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-card);
}
.clx-copilot-input {
  flex: 1; padding: 10px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-primary); font-family: inherit; font-size: 13px;
}
.clx-copilot-input:focus {
  outline: none; border-color: var(--color-brand-500);
  box-shadow: 0 0 0 3px var(--color-brand-100);
}
.clx-copilot-voice, .clx-copilot-send {
  background: var(--bg-page); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 7px;
  padding: 9px 12px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.clx-copilot-voice:hover, .clx-copilot-send:hover {
  background: var(--bg-hover);
}
.clx-copilot-voice.recording {
  background: var(--danger, #EF4444); border-color: var(--danger, #EF4444);
  color: #fff;
}
.clx-copilot-send {
  background: var(--color-brand-600); border-color: var(--color-brand-600); color: #fff;
}
.clx-copilot-send:hover { background: var(--color-brand-700); }

.clx-copilot-token-prompt {
  padding: 14px; background: #FEF3C7; border: 1px solid #FDE68A;
  border-radius: 8px; font-size: 12.5px; color: #92400E;
  margin-bottom: 12px; line-height: 1.5;
}
.clx-copilot-token-prompt input {
  width: 100%; margin-top: 8px; padding: 8px;
  border: 1px solid #FDE68A; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
}
.clx-copilot-token-prompt button {
  margin-top: 8px; padding: 6px 12px;
  background: var(--color-brand-600); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
}

@media (max-width: 640px) {
  .clx-copilot-panel { width: 100vw; }
  .clx-copilot-fab { bottom: 16px; right: 16px; }
}
