@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ══════════════════════════════════════════════════════════
   LIGHT THEME  (default)  —  professional neutral surface
   ══════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;

  /* Surfaces — neutral, with a faint cool tint (not lavender pastel) */
  --bg:          #F7F8FA;   /* page canvas */
  --bg2:         #EEF0F4;   /* sunken (table head, code) */
  --s1:          #FFFFFF;   /* card base */
  --s2:          #F4F5F8;   /* card hover */
  --s3:          #E7EAF0;   /* active / selected */

  /* Borders — 4-step neutral */
  --border:        rgba(17,24,39,0.08);
  --border-hi:     rgba(17,24,39,0.14);
  --border-strong: rgba(17,24,39,0.22);
  --border-focus:  #4F8CFF;

  /* Text — WCAG AA verified on --bg */
  --text:        #1F2430;   /* primary, 14.6:1 */
  --text-strong: #0B0F1A;
  --muted:       #5C6371;   /* tertiary, 5.4:1 — body-safe (was 3.3:1) */
  --muted2:      #3F4654;   /* secondary, 9.3:1 */
  --text-disabled:#A2A8B5;

  /* Brand & Interactive (split: brand vs CTA) */
  --accent:      #00A88A;        /* brand teal */
  --accent-dim:  rgba(0,168,138,0.10);
  --accent-glow: rgba(0,168,138,0.20);
  --interactive:     #4F8CFF;    /* primary CTA, links, focus */
  --interactive-hi:  #3A75E6;
  --interactive-dim: rgba(79,140,255,0.10);

  /* Categorical / data viz (color-blind safe) */
  --blue:        #3A75E6;  --blue-dim:   rgba(58,117,230,0.10);
  --purple:      #7C3AED;  --purple-dim: rgba(124,58,237,0.10);
  --orange:      #C7700C;  --orange-dim: rgba(199,112,12,0.10);
  --cyan:        #0E91B5;  --cyan-dim:   rgba(14,145,181,0.10);

  /* Semantic */
  --danger:      #D11A2A;  --danger-dim: rgba(209,26,42,0.10);
  --success:     #117D49;  --success-dim:rgba(17,125,73,0.10);
  --warning:     #B26B00;  --warning-dim:rgba(178,107,0,0.10);
  --info:        #4F8CFF;  --info-dim:   rgba(79,140,255,0.10);

  /* Radius (tightened from 10/16/22) */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;

  /* Spacing scale (4px base) */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px;
  --sp-5:20px; --sp-6:24px; --sp-8:32px; --sp-10:40px;
  --sp-12:48px; --sp-16:64px;

  /* Type scale */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --fs-12:12px; --lh-12:16px;
  --fs-13:13px; --lh-13:18px;
  --fs-14:14px; --lh-14:20px;
  --fs-16:16px; --lh-16:22px;
  --fs-18:18px; --lh-18:24px;
  --fs-22:22px; --lh-22:28px;
  --fs-28:28px; --lh-28:34px;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:120ms; --dur-base:180ms; --dur-slow:240ms;

  /* Layout */
  --sidebar-w: 240px;
  --content-max: 1440px;

  /* Component tokens */
  --nav-bg:       rgba(255,255,255,0.92);
  --nav-border:   rgba(17,24,39,0.08);
  --shadow-sm:    0 1px 2px rgba(17,24,39,0.05);
  --shadow-md:    0 4px 8px -2px rgba(17,24,39,0.08), 0 0 0 1px rgba(17,24,39,0.04);
  --shadow-lg:    0 12px 24px -8px rgba(17,24,39,0.12), 0 0 0 1px rgba(17,24,39,0.04);
  --shadow-xl:    0 24px 48px -12px rgba(17,24,39,0.16);
  --shadow-card:  0 1px 2px rgba(17,24,39,0.04);
}

/* ══════════════════════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces */
  --bg:          #0A0D12;
  --bg2:         #070A0F;
  --s1:          #11151C;
  --s2:          #171C25;
  --s3:          #1D2330;

  /* Borders */
  --border:        rgba(255,255,255,0.06);
  --border-hi:     rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);
  --border-focus:  #4F8CFF;

  /* Text — WCAG AA verified on --bg */
  --text:        #ECEEF2;
  --text-strong: #FFFFFF;
  --muted:       #6B7488;   /* 4.6:1 (was 3.4:1) */
  --muted2:      #A8B0BF;   /* 7.8:1 */
  --text-disabled:#5A6478;

  /* Brand & Interactive */
  --accent:      #00C896;
  --accent-dim:  rgba(0,200,150,0.12);
  --accent-glow: rgba(0,200,150,0.28);
  --interactive:     #4F8CFF;
  --interactive-hi:  #6BA0FF;
  --interactive-dim: rgba(79,140,255,0.14);

  /* Categorical */
  --blue:        #4F8CFF;  --blue-dim:   rgba(79,140,255,0.12);
  --purple:      #A78BFA;  --purple-dim: rgba(167,139,250,0.12);
  --orange:      #E0A23B;  --orange-dim: rgba(224,162,59,0.12);
  --cyan:        #5EC8E6;  --cyan-dim:   rgba(94,200,230,0.12);

  /* Semantic */
  --danger:      #F26C70;  --danger-dim: rgba(242,108,112,0.14);
  --success:     #3DD598;  --success-dim:rgba(61,213,152,0.14);
  --warning:     #E8B658;  --warning-dim:rgba(232,182,88,0.14);
  --info:        #4F8CFF;  --info-dim:   rgba(79,140,255,0.14);

  --nav-bg:     rgba(10,13,18,0.92);
  --nav-border: rgba(255,255,255,0.06);
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.30);
  --shadow-md:  0 4px 8px -2px rgba(0,0,0,0.36), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-lg:  0 12px 24px -8px rgba(0,0,0,0.50), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-xl:  0 24px 48px -12px rgba(0,0,0,0.60);
  --shadow-card:0 1px 2px rgba(0,0,0,0.20);
}

/* ══════════════════════════════════════════════════════════
   BASE RESET & TRANSITIONS
   ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }

/* Smooth theme transitions — only AFTER first paint, never during initial mount or theme-toggle swap */
html.theme-ready body,
html.theme-ready .side-nav,
html.theme-ready .card,
html.theme-ready .stat-card,
html.theme-ready .modal,
html.theme-ready input,
html.theme-ready select,
html.theme-ready textarea,
html.theme-ready .user-dropdown,
html.theme-ready .search-dropdown,
html.theme-ready .btn,
html.theme-ready .side-nav-link,
html.theme-ready .tab-btn,
html.theme-ready table,
html.theme-ready thead th,
html.theme-ready tbody td,
html.theme-ready .skeleton,
html.theme-ready .toast,
html.theme-ready .notif-banner {
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}
html.theme-swapping *,
html.theme-swapping *::before,
html.theme-swapping *::after { transition: none !important; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-14);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  padding-top: 0;
  padding-left: var(--sidebar-w);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  background-image: none;
}

/* Tabular numerals — apply to every metric, table cell, currency, duration */
.tabular, .stat-value, td.num, .num, .metric { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Typography — caps the marketing-flavored 36px h1 */
h1,h2,h3,h4 { font-weight:600; color:var(--text-strong); letter-spacing:-0.011em; }
h1 { font-size: var(--fs-22); line-height: var(--lh-22); }
h2 { font-size: var(--fs-18); line-height: var(--lh-18); }
h3 { font-size: var(--fs-14); line-height: var(--lh-14); }
h4 { font-size: var(--fs-13); line-height: var(--lh-13); }

/* Focus — accessible, visible */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip-to-content (a11y) */
.skip-link {
  position: absolute; top: -40px; left: 8px; z-index: 1000;
  padding: 8px 12px; background: var(--interactive); color: #fff;
  border-radius: var(--r-sm); font-weight: 600; font-size: var(--fs-13);
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 8px; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR NAVIGATION
   ══════════════════════════════════════════════════════════ */
.side-nav {
  position: fixed; top:0; left:0; bottom:0; z-index:200;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--s1);
  border-right: 1px solid var(--border);
  box-shadow: none;
  overflow: visible;
}

/* Header */
.side-nav-header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.side-nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.side-nav-logo-icon {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent) 0%, #00C896 100%);
  border: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
  box-shadow: 0 1px 2px rgba(0,168,138,0.30);
}
.side-nav-logo-icon svg { width:14px; height:14px; }

.side-nav-logo-text { display:flex; flex-direction:column; gap:1px; min-width:0; }
.side-nav-brand { font-size: var(--fs-13); font-weight:600; color:var(--text-strong); letter-spacing:-0.01em; white-space:nowrap; }
.side-nav-tagline { font-size: 11px; color:var(--muted); line-height:1.3; }

/* Search */
.side-nav-search {
  position: relative;
  padding: 10px 12px;
  border-bottom: 1px solid var(--nav-border);
}
.side-nav-search input {
  width: 100%; padding: 7px 10px 7px 30px;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 12px;
  box-shadow: none;
}
.side-nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}
.side-nav-search input::placeholder { color: var(--muted); }
.side-nav-search-icon {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
  display: flex; align-items: center;
}
.side-nav-search-icon svg { width: 13px; height: 13px; }

.side-nav-search .search-dropdown {
  position: absolute; top: calc(100% + 2px); left: 12px; right: 12px; min-width: auto;
}

/* Body / scrollable nav area */
.side-nav-body {
  flex: 1; overflow-y: auto; padding: 8px 8px 0;
}
.side-nav-body::-webkit-scrollbar { width: 3px; }
.side-nav-body::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 4px; }

.side-nav-section { margin-bottom: 2px; }
.side-nav-section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  padding: 14px 12px 6px;
}

.side-nav-links { list-style: none; display: flex; flex-direction: column; gap: 1px; }

.side-nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--r-sm);
  text-decoration: none; font-size: var(--fs-13); font-weight: 500;
  color: var(--muted2);
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.side-nav-link:hover { background: var(--s2); color: var(--text-strong); }
.side-nav-link.active {
  background: var(--accent-dim);
  color: var(--text-strong);
  font-weight: 600;
}
.side-nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.side-nav-link.active .side-nav-link-icon { color: var(--accent); }
.side-nav-link-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.side-nav-link:hover .side-nav-link-icon { color: var(--text-strong); }
.side-nav-link-icon svg { width: 16px; height: 16px; }

/* Trailing badge slot (for counts / "Beta" tags on nav items) */
.side-nav-link-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--s3); color: var(--muted2);
  font-variant-numeric: tabular-nums;
}
.side-nav-link.active .side-nav-link-badge { background: var(--interactive); color: #fff; }

/* Footer */
.side-nav-footer {
  padding: 12px;
  border-top: 1px solid var(--nav-border);
  display: flex; align-items: center; gap: 8px;
}

.nav-badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 9px; border-radius:999px;
  background:var(--accent-dim); color:var(--accent);
  font-size:11px; font-weight:700;
  border:1px solid var(--accent-dim);
}

/* Theme toggle button */
.theme-toggle {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--s2);
  color: var(--muted2); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto;
}
.theme-toggle:hover { background: var(--s3); color: var(--text); border-color: var(--border-hi); }
.theme-toggle svg { width: 14px; height: 14px; }

/* User section in footer */
.side-nav-user {
  position: relative; display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; cursor: pointer;
}
.side-nav-user-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.side-nav-user-name { font-size: 12px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav-user-email { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-nav-user .user-dropdown {
  position: absolute;
  top: auto !important;
  right: auto !important;
  bottom: calc(100% + 8px) !important;
  left: 0 !important;
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px; min-width: 210px;
  box-shadow: var(--shadow-lg); z-index: 1200;
}

@keyframes logo-pulse {
  0%,100% { box-shadow:0 0 8px var(--accent-glow); }
  50%      { box-shadow:0 0 18px var(--accent-glow); }
}

/* ══════════════════════════════════════════════════════════
   PAGE SHELL
   ══════════════════════════════════════════════════════════ */
.page { max-width:1400px; margin:0 auto; padding:28px 24px 60px; }
.page-header { margin-bottom:28px; }
.page-title { display:flex; align-items:center; gap:12px; margin-bottom:6px; }
.page-sub { color:var(--muted2); font-size:14px; }

/* ══════════════════════════════════════════════════════════
   CARDS & PANELS
   ══════════════════════════════════════════════════════════ */
.card {
  background:var(--s1); border:1px solid var(--border);
  border-radius:var(--r-lg); padding:20px;
  box-shadow: none;
}
.card-head {
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:16px;
}
.card-head h2 { font-size: var(--fs-14); font-weight:600; letter-spacing:-0.01em; }
.card-sub { font-size: var(--fs-12); color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════ */
.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.stat-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: none;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.stat-card:hover { border-color: var(--border-hi); }
.stat-label {
  font-size: var(--fs-12); font-weight: 500;
  text-transform: none; letter-spacing: 0;
  color: var(--muted); margin-bottom: 2px;
}
.stat-value {
  font-size: var(--fs-28); line-height: var(--lh-28);
  font-weight: 600; color: var(--text-strong);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: var(--fs-12); color: var(--muted); margin-top: 0; }

/* Delta chip — green/red/neutral pill next to or below value */
.stat-delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600; line-height: 16px;
  font-variant-numeric: tabular-nums;
}
.stat-delta.up   { background: var(--success-dim); color: var(--success); }
.stat-delta.down { background: var(--danger-dim);  color: var(--danger);  }
.stat-delta.flat { background: var(--s3);          color: var(--muted2);  }
.stat-delta-label { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* Sparkline slot — 56px tall, full-width */
.stat-spark { height: 40px; margin-top: 8px; }
.stat-spark canvas, .stat-spark svg { width: 100%; height: 100%; display: block; }

/* Tinted variants — kept for backward compat but desaturated */
.stat-card.accent  { background: var(--s1); border-color: var(--border); }
.stat-card.accent  .stat-value { color: var(--accent); }
.stat-card.blue    { background: var(--s1); border-color: var(--border); }
.stat-card.blue    .stat-value { color: var(--blue); }
.stat-card.purple  { background: var(--s1); border-color: var(--border); }
.stat-card.purple  .stat-value { color: var(--purple); }
.stat-card.orange  { background: var(--s1); border-color: var(--border); }
.stat-card.orange  .stat-value { color: var(--orange); }

/* ══════════════════════════════════════════════════════════
   GRID LAYOUTS
   ══════════════════════════════════════════════════════════ */
.grid-2 { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.col-span-2 { grid-column:span 2; }

/* ══════════════════════════════════════════════════════════
   BUTTONS  (Google AI Studio inspired pill style)
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-hi);
  background: var(--s1);
  color: var(--text); font-size: var(--fs-13); font-weight: 500;
  cursor: pointer; font-family: inherit;
  text-decoration: none; box-shadow: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--s2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { background: var(--s3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Primary (interactive blue — high-emphasis CTA, one per region) */
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: #009579; border-color: #009579; }
.btn-primary:active:not(:disabled) { background: #008368; border-color: #008368; }
[data-theme="dark"] .btn-primary { color: #04110D; }
[data-theme="dark"] .btn-primary:hover { background: #00DDA8; border-color: #00DDA8; }

/* Accent — alias for primary, kept for backward compat */
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600; box-shadow: none;
}
.btn-accent:hover { background: #009579; border-color: #009579; box-shadow: none; }
[data-theme="dark"] .btn-accent { color: #04110D; }

.btn-danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
  font-weight: 600;
}
.btn-danger:hover { filter: brightness(0.94); }

.btn-ghost {
  background: transparent; border-color: transparent; color: var(--muted2);
}
.btn-ghost:hover { background: var(--s2); color: var(--text-strong); border-color: transparent; }

.btn-outline {
  background: transparent; border-color: var(--border-hi); color: var(--text);
}
.btn-outline:hover { background: var(--s2); border-color: var(--border-strong); }

.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-12); }
.btn-lg { height: 40px; padding: 0 16px; font-size: var(--fs-14); }
.btn-icon { padding: 0; width: 32px; }
.btn-icon.btn-sm { width: 28px; }

/* Loading state — spinner replaces content */
.btn[data-loading="true"] { color: transparent !important; pointer-events: none; position: relative; }
.btn[data-loading="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--text); animation: btn-spin 0.6s linear infinite;
}
.btn-primary[data-loading="true"]::after,
.btn-accent[data-loading="true"]::after,
.btn-danger[data-loading="true"]::after { color: #fff; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--s1); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 0 14px;
  height: 36px;
  text-align: left; vertical-align: middle;
  font-size: var(--fs-12); font-weight: 600;
  text-transform: none; letter-spacing: 0;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky; top: 0; z-index: 1;
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text-strong); background: var(--s2); }
thead th.sortable[aria-sort]:not([aria-sort="none"]) { color: var(--text-strong); }
thead th.num { text-align: right; }
tbody td {
  padding: 0 14px; height: 44px; vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-13); line-height: var(--lh-13);
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
tbody tr:hover { background: var(--s2); }
tbody tr.selected { background: var(--interactive-dim); }
tbody tr.selected:hover { background: var(--interactive-dim); }

/* ══════════════════════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════════════════════ */
/* Status pill — shape: small dot + label, neutral by default, semantic variants */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600;
  text-transform: none; letter-spacing: 0;
  line-height: 16px;
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge.no-dot::before { display: none; }

.status-scheduled { background: var(--s3);          color: var(--muted2);    }
.status-active,
.status-live      { background: var(--success-dim); color: var(--success);   }
.status-completed { background: var(--s3);          color: var(--muted2);    }
.status-processing{ background: var(--warning-dim); color: var(--warning);   }
.status-failed    { background: var(--danger-dim);  color: var(--danger);    }
.status-paid      { background: var(--success-dim); color: var(--success);   }
.status-pending   { background: var(--warning-dim); color: var(--warning);   }

/* Live status: animated pulsing dot (the only place pulses are kept) */
.status-live::before {
  animation: status-live-pulse 1.6s var(--ease-in-out) infinite;
  box-shadow: 0 0 0 0 currentColor;
}
@keyframes status-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%       { box-shadow: 0 0 0 3px rgba(0,168,138,0.20); }
}

/* ══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════════════════ */
input, textarea, select {
  width: 100%; padding: 0 12px; height: 32px;
  border: 1px solid var(--border-hi); border-radius: var(--r-sm);
  background: var(--s1); color: var(--text-strong);
  font-size: var(--fs-13); font-family: inherit; outline: none;
  box-shadow: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
textarea { padding: 8px 12px; height: auto; min-height: 80px; line-height: 1.5; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
  border-color: var(--interactive);
  box-shadow: 0 0 0 3px var(--interactive-dim);
}
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--danger);
}
input[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus, select[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-dim);
}
input:disabled, textarea:disabled, select:disabled {
  background: var(--bg2); color: var(--text-disabled); cursor: not-allowed;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
select option { background: var(--s1); color: var(--text-strong); }

label {
  display: block; font-size: var(--fs-12); font-weight: 500;
  text-transform: none; letter-spacing: 0;
  color: var(--text); margin-bottom: 6px;
}
label .required { color: var(--danger); margin-left: 2px; }
.form-help    { font-size: var(--fs-12); color: var(--muted);  margin-top: 4px; }
.form-error   { font-size: var(--fs-12); color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.form-group   { margin-bottom: 16px; }
.form-row     { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11,15,26,0.40);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: backdrop-in var(--dur-base) var(--ease-out) both;
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.60); }
.modal {
  background: var(--s1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 0;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--dur-slow) var(--ease-out) both;
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(4px); }
  to   { opacity: 1; transform: none; }
}
@keyframes backdrop-in {
  from { opacity: 0; } to { opacity: 1; }
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px; gap: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: var(--fs-16); font-weight: 600; }
.modal-head .modal-sub { font-size: var(--fs-12); color: var(--muted); margin-top: 2px; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  width: 24px; height: 24px; border-radius: var(--r-sm);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--s2); color: var(--text-strong); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
/* Backward compat: forms placed directly in .modal (no .modal-body) get padding */
.modal > .form-group:first-of-type { margin-top: 16px; }
.modal > .form-group,
.modal > .form-row { padding: 0 20px; }
.modal > .form-group:last-of-type:not(:has(+ .modal-footer)) { padding-bottom: 16px; }
.modal > .modal-footer { margin-top: 8px; }

/* ══════════════════════════════════════════════════════════
   FILTER BAR (page-level toolbar above tables)
   ══════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar .filter-bar-spacer { margin-left: auto; }
.filter-bar .search-input {
  position: relative; flex: 0 0 260px;
}
.filter-bar .search-input input { padding-left: 32px; }
.filter-bar .search-input::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%);
  background: currentColor; color: var(--muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'><path fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/></svg>") no-repeat center;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'><path fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/></svg>") no-repeat center;
  pointer-events: none;
}
.filter-bar select { width: auto; min-width: 140px; padding-right: 28px; }

/* Active filter chips (under filter bar) */
.filter-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 6px 0 10px;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--fs-12); color: var(--text);
}
.filter-chip strong { color: var(--muted); font-weight: 500; margin-right: 2px; }
.filter-chip button {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; font-size: 14px; line-height: 1;
}
.filter-chip button:hover { background: var(--s3); color: var(--text-strong); }
.filter-chips .clear-all {
  background: transparent; border: none; color: var(--interactive);
  font-size: var(--fs-12); cursor: pointer; padding: 0 6px;
}
.filter-chips .clear-all:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   BULK ACTION BAR (slides over table when rows selected)
   ══════════════════════════════════════════════════════════ */
.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  background: var(--text-strong); color: var(--bg);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  animation: bulk-in var(--dur-base) var(--ease-out) both;
}
[data-theme="dark"] .bulk-bar { background: var(--s3); color: var(--text-strong); border: 1px solid var(--border-hi); }
.bulk-bar .bulk-count { font-weight: 600; font-size: var(--fs-13); }
.bulk-bar .bulk-actions { margin-left: auto; display: flex; gap: 4px; }
.bulk-bar .btn { background: transparent; border-color: rgba(255,255,255,0.2); color: var(--bg); height: 28px; }
[data-theme="dark"] .bulk-bar .btn { color: var(--text-strong); border-color: var(--border-hi); }
.bulk-bar .btn:hover { background: rgba(255,255,255,0.1); }
@keyframes bulk-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 16px; padding: 0 4px;
}
.pagination-info { font-size: var(--fs-12); color: var(--muted); }
.pagination-info strong { color: var(--text-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.pagination-controls { display: flex; gap: 4px; align-items: center; }
.pagination-controls .btn { width: 32px; padding: 0; }
.pagination-controls .pagination-page {
  font-size: var(--fs-13); color: var(--text); padding: 0 10px;
  font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════
   ROW-CHECKBOX & EXPANDABLE ROW
   ══════════════════════════════════════════════════════════ */
table th.col-check, table td.col-check { width: 36px; padding: 0 0 0 14px; }
table th.col-actions, table td.col-actions { width: 40px; text-align: right; padding-right: 12px; }
input[type="checkbox"] {
  width: 14px; height: 14px; padding: 0;
  accent-color: var(--accent);
  cursor: pointer; vertical-align: middle;
}
.row-menu-btn {
  background: transparent; border: none; cursor: pointer; padding: 0;
  width: 24px; height: 24px; border-radius: var(--r-sm);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast), background-color var(--dur-fast), color var(--dur-fast);
}
tbody tr:hover .row-menu-btn { opacity: 1; }
.row-menu-btn:hover { background: var(--s3); color: var(--text-strong); }
.row-menu-btn:focus-visible { opacity: 1; }

/* Expandable row (uses existing .expand-row markup) */
tr.expand-trigger > td:first-child { position: relative; padding-left: 28px; }
tr.expand-trigger .expand-caret {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted);
  transition: transform var(--dur-base) var(--ease-out);
  cursor: pointer;
}
tr.expand-trigger.expanded .expand-caret { transform: translateY(-50%) rotate(90deg); }

/* ══════════════════════════════════════════════════════════
   STICKY SAVE BAR (settings — appears on dirty state)
   ══════════════════════════════════════════════════════════ */
.save-bar {
  position: fixed; bottom: 16px; left: calc(var(--sidebar-w) + 24px); right: 24px;
  display: flex; align-items: center; gap: 12px;
  background: var(--text-strong); color: var(--bg);
  padding: 10px 14px; border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  animation: bulk-in var(--dur-base) var(--ease-out) both;
}
[data-theme="dark"] .save-bar { background: var(--s2); color: var(--text-strong); border: 1px solid var(--border-hi); }
.save-bar-msg { font-size: var(--fs-13); flex: 1; font-weight: 500; }
.save-bar .btn { background: transparent; border-color: rgba(255,255,255,0.20); color: var(--bg); }
.save-bar .btn:hover { background: rgba(255,255,255,0.10); }
.save-bar .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .save-bar .btn { color: var(--text-strong); border-color: var(--border-hi); }
@media (max-width: 900px) { .save-bar { left: 16px; right: 16px; } }

/* ══════════════════════════════════════════════════════════
   INPUT WITH TRAILING ACTIONS (reveal, copy, rotate — for API keys)
   ══════════════════════════════════════════════════════════ */
.input-actions {
  position: relative; display: flex; align-items: stretch;
}
.input-actions input { padding-right: 76px; font-family: var(--font-mono); font-size: var(--fs-13); }
.input-actions-trailing {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px;
}
.input-actions-trailing button {
  background: transparent; border: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: var(--r-xs);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.input-actions-trailing button:hover { background: var(--s2); color: var(--text-strong); }
.input-actions-trailing svg { width: 14px; height: 14px; }

/* ══════════════════════════════════════════════════════════
   DANGER ZONE (settings)
   ══════════════════════════════════════════════════════════ */
.danger-zone {
  border: 1px solid var(--danger-dim);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  background: var(--s1);
  margin-top: 24px;
}
.danger-zone h2 { color: var(--danger); font-size: var(--fs-14); margin-bottom: 4px; }
.danger-zone p { font-size: var(--fs-13); color: var(--muted); margin-bottom: 12px; }

/* ══════════════════════════════════════════════════════════
   KEYBOARD-VISIBLE FOCUS HELPERS
   ══════════════════════════════════════════════════════════ */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--s2); border: 1px solid var(--border-hi);
  border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--muted2);
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; text-align: center; color: var(--muted);
  gap: 4px;
}
.empty-state-icon {
  width: 48px; height: 48px;
  margin-bottom: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-lg);
  background: var(--s2); color: var(--muted);
  font-size: 24px;
  opacity: 1;
}
.empty-state-icon svg { width: 24px; height: 24px; }
.empty-state h3   { color: var(--text-strong); margin-bottom: 4px; font-size: var(--fs-14); font-weight: 600; }
.empty-state p    { font-size: var(--fs-13); color: var(--muted); max-width: 360px; line-height: var(--lh-13); }
.empty-state-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 380px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--s1);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--muted);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: var(--fs-13); line-height: var(--lh-13);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--dur-base) var(--ease-out) both;
}
.toast-icon { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; color: var(--text-strong); }
.toast-desc  { color: var(--muted2); margin-top: 2px; font-size: var(--fs-12); }
.toast-close {
  flex-shrink: 0; background: transparent; border: none;
  color: var(--muted); cursor: pointer; padding: 0;
  width: 16px; height: 16px; line-height: 1;
}
.toast-close:hover { color: var(--text-strong); }

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger);  }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info);    }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger);  }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info);    }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--s3); border-radius:4px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width:900px) {
  body { padding-left: 0; padding-top: 56px; }
  .side-nav {
    top: 0; left: 0; right: 0; bottom: auto;
    width: 100%; height: 56px; flex-direction: row;
    overflow: visible;
  }
  .side-nav-header { padding: 0 16px; border-bottom: none; border-right: 1px solid var(--nav-border); display: flex; align-items: center; }
  .side-nav-tagline { display: none; }
  .side-nav-search, .side-nav-body, .side-nav-footer { display: none; }
  .stat-grid { grid-template-columns:repeat(2,1fr); }
  .grid-2, .grid-3 { grid-template-columns:1fr; }
  .col-span-2 { grid-column:span 1; }
  .form-row { grid-template-columns:1fr; }
}

@media (max-width:600px) {
  .stat-grid { grid-template-columns:1fr; }
}

/* ══════════════════════════════════════════════════════════
   MISC COMPONENTS
   ══════════════════════════════════════════════════════════ */
.role-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:2px 8px; border-radius:999px; font-size:11px; font-weight:600;
  background:var(--s3); color:var(--muted2);
}

.live-dot {
  display:inline-block; width:7px; height:7px; border-radius:50%;
  background:var(--accent); box-shadow:0 0 6px var(--accent-glow);
  animation: logo-pulse 1.5s ease-in-out infinite; vertical-align:middle;
}

/* ══════════════════════════════════════════════════════════
   LIVE / AI ACTIVITY INDICATORS
   ══════════════════════════════════════════════════════════ */
@keyframes live-pulse-ring {
  0%   { box-shadow:0 0 0 0 rgba(0,200,83,0.55); }
  70%  { box-shadow:0 0 0 7px rgba(0,200,83,0); }
  100% { box-shadow:0 0 0 0 rgba(0,200,83,0); }
}
@keyframes live-glow {
  0%,100% { box-shadow:0 0 6px rgba(0,200,83,0.6), 0 0 0 0 rgba(0,200,83,0.5); }
  50%     { box-shadow:0 0 12px rgba(0,200,83,0.95), 0 0 0 4px rgba(0,200,83,0); }
}
.live-pulse-dot {
  display:inline-block; width:8px; height:8px; border-radius:50%;
  background:#00c853; box-shadow:0 0 8px #00c853;
  animation: live-glow 1.5s ease-in-out infinite;
  vertical-align:middle; flex-shrink:0;
}
.live-cell {
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px 4px 9px; border-radius:999px;
  background:rgba(0,200,83,0.12); color:#00a040;
  border:1px solid rgba(0,200,83,0.35);
  font-size:11px; font-weight:700; letter-spacing:0.06em; text-transform:uppercase;
  text-decoration:none;
  animation: live-pulse-ring 1.6s ease-out infinite;
}
[data-theme="dark"] .live-cell { color:#34d399; background:rgba(0,200,83,0.15); }

/* Active session AI status enrichment */
.ai-status-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:2px 8px; border-radius:999px;
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.08em;
  background:var(--s3); color:var(--muted2); border:1px solid var(--border);
}
.ai-status-pill.speaking  { background:rgba(0,200,83,0.12); color:#00a040; border-color:rgba(0,200,83,0.3); }
[data-theme="dark"] .ai-status-pill.speaking { color:#34d399; }
.ai-status-pill.thinking  { background:var(--purple-dim); color:var(--purple); border-color:rgba(124,58,237,0.3); }
.ai-status-pill.listening { background:var(--blue-dim); color:var(--blue); border-color:rgba(59,126,248,0.3); }
.ai-status-pill .wave {
  display:inline-flex; gap:2px; align-items:flex-end; height:9px;
}
.ai-status-pill .wave i {
  display:inline-block; width:2px; background:currentColor; border-radius:1px;
  animation: ai-wave 0.9s ease-in-out infinite;
}
.ai-status-pill .wave i:nth-child(1) { height:40%; animation-delay:0s; }
.ai-status-pill .wave i:nth-child(2) { height:80%; animation-delay:0.15s; }
.ai-status-pill .wave i:nth-child(3) { height:55%; animation-delay:0.3s; }
@keyframes ai-wave {
  0%,100% { transform:scaleY(0.5); }
  50%     { transform:scaleY(1.3); }
}
.ai-status-pill .think-dots i {
  display:inline-block; width:3px; height:3px; border-radius:50%;
  background:currentColor; margin:0 1px;
  animation: think-bounce 1.2s ease-in-out infinite;
}
.ai-status-pill .think-dots i:nth-child(2) { animation-delay:0.2s; }
.ai-status-pill .think-dots i:nth-child(3) { animation-delay:0.4s; }
@keyframes think-bounce {
  0%,80%,100% { opacity:0.3; transform:translateY(0); }
  40%         { opacity:1;   transform:translateY(-2px); }
}

.live-session-card .meta-row {
  display:flex; align-items:center; gap:6px; font-size:11px;
  color:var(--muted2); margin-top:4px; flex-wrap:wrap;
}
.live-session-card .activity-line {
  font-size:11px; color:var(--muted2); margin-top:3px;
  display:flex; align-items:center; gap:5px;
}
.live-session-card .activity-line .arrow { color:var(--accent); font-weight:700; }

/* Floating global AI status pill (top-right, non-intrusive) */
.ai-global-status {
  position:fixed; top:14px; right:18px; z-index:250;
  display:none; align-items:center; gap:8px;
  padding:6px 12px 6px 10px; border-radius:999px;
  background:var(--s1); border:1px solid var(--border-hi);
  box-shadow:var(--shadow-md);
  font-size:12px; color:var(--text-strong);
  backdrop-filter:blur(10px);
  max-width:340px;
}
.ai-global-status.visible { display:inline-flex; animation:slide-up 0.25s ease-out both; }
.ai-global-status .label { font-weight:600; color:var(--text-strong); }
.ai-global-status .activity {
  color:var(--muted2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  max-width:220px;
}
.ai-global-status .sep { color:var(--muted); }
@media (max-width:900px) {
  .ai-global-status { top:64px; right:10px; font-size:11px; padding:4px 10px 4px 8px; }
  .ai-global-status .activity { max-width:140px; }
}

/* ══════════════════════════════════════════════════════════
   SKELETON LOADER
   ══════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--s2) 0%,
    var(--s3) 50%,
    var(--s2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-xs);
  display: block;
}
.skeleton-text   { height: 12px; margin-bottom: 8px; width: 100%; }
.skeleton-text:last-child { width: 60%; margin-bottom: 0; }
.skeleton-title  { height: 20px; width: 40%; margin-bottom: 12px; border-radius: var(--r-sm); }
.skeleton-stat   { height: 80px; border-radius: var(--r-lg); margin-bottom: 0; }
.skeleton-row    { height: 44px; margin-bottom: 1px; border-radius: 0; }
.skeleton-circle { border-radius: 50%; }
.skeleton-block  { height: 200px; border-radius: var(--r-lg); }

/* ══════════════════════════════════════════════════════════
   NAV SEARCH
   ══════════════════════════════════════════════════════════ */
.nav-search { position:relative; margin:0 4px; }
.nav-search input {
  width:180px; padding:5px 10px 5px 28px;
  background:var(--s2); border:1px solid var(--border);
  border-radius:var(--r-sm); color:var(--text); font-size:12px;
  box-shadow:none;
}
.nav-search input:focus {
  width:240px; border-color:var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline:none;
}
.nav-search input::placeholder { color:var(--muted); }
.nav-search-icon {
  position:absolute; left:8px; top:50%; transform:translateY(-50%);
  color:var(--muted); font-size:12px; pointer-events:none;
}
.search-dropdown {
  position:absolute; top:calc(100% + 6px); left:0; min-width:340px;
  background:var(--s1); border:1px solid var(--border-hi);
  border-radius:var(--r-md); box-shadow:var(--shadow-lg);
  z-index:400; overflow:hidden;
}
.search-result {
  display:flex; align-items:flex-start; gap:10px;
  padding:10px 14px; cursor:pointer; border-bottom:1px solid var(--border);
  text-decoration:none;
}
.search-result:last-child { border-bottom:none; }
.search-result:hover { background:var(--s2); }
.search-result-type {
  font-size:10px; font-weight:700; text-transform:uppercase;
  letter-spacing:0.08em; color:var(--muted); flex-shrink:0; width:58px; padding-top:2px;
}
.search-result-text { font-size:12px; color:var(--text); line-height:1.4; }
.search-result-sub  { font-size:11px; color:var(--muted2); margin-top:2px; }

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 0 14px; height: 36px;
  border: none; background: transparent;
  color: var(--muted2);
  font-size: var(--fs-13); font-weight: 500;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.tab-btn:hover { color: var(--text-strong); }
.tab-btn.active {
  color: var(--text-strong);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════
   NOTIFICATION BANNER
   ══════════════════════════════════════════════════════════ */
.notif-banner {
  position:fixed; top:20px; left:calc(50% + 120px); transform:translateX(-50%);
  background:var(--s1); border:1px solid var(--border-hi);
  border-radius:var(--r-md); padding:10px 18px;
  font-size:13px; color:var(--text); z-index:300;
  box-shadow:var(--shadow-md);
  animation:slide-up 0.2s ease-out both;
  display:flex; align-items:center; gap:10px; white-space:nowrap;
}
.notif-banner .notif-icon  { font-size:16px; }
.notif-banner .notif-close { cursor:pointer; color:var(--muted2); margin-left:6px; }
.notif-banner.success { border-color:var(--accent); color:var(--accent); background:var(--accent-dim); }
.notif-banner.error   { border-color:var(--danger); color:var(--danger); background:var(--danger-dim); }

/* ══════════════════════════════════════════════════════════
   EXPANDABLE ROW
   ══════════════════════════════════════════════════════════ */
.expand-row td { padding:0 !important; border-bottom:1px solid var(--border); }
.expand-content { padding:16px 20px; background:var(--bg2); }
mark { background:var(--accent-dim); color:var(--accent); border-radius:2px; padding:0 2px; }

/* ══════════════════════════════════════════════════════════
   NAV USER MENU
   ══════════════════════════════════════════════════════════ */
.nav-user { position:relative; }
.nav-avatar {
  width:30px; height:30px; border-radius:50%;
  background:var(--accent-dim); border:1px solid var(--accent);
  color:var(--accent); font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; user-select:none;
}
.nav-avatar:hover { background:var(--s3); }

.user-dropdown {
  position:absolute; top:calc(100% + 8px); right:0;
  background:var(--s1); border:1px solid var(--border);
  border-radius:var(--r-md); padding:8px; min-width:210px;
  box-shadow:var(--shadow-lg); z-index:300;
}
.user-dropdown-info { padding:8px 10px; margin-bottom:4px; }
.user-role-badge {
  display:inline-block; margin-top:4px;
  padding:2px 8px; border-radius:20px; font-size:10px; font-weight:700;
  background:var(--accent-dim); color:var(--accent); text-transform:uppercase; letter-spacing:0.08em;
}
.user-dropdown-item {
  display:block; width:100%; text-align:left;
  padding:8px 10px; border-radius:var(--r-sm);
  font-size:13px; color:var(--muted2); text-decoration:none;
  background:none; border:none; cursor:pointer;
}
.user-dropdown-item:hover { background:var(--s2); color:var(--text); }
.user-logout { color:var(--danger) !important; }
.user-logout:hover { background:var(--danger-dim) !important; }
