/* ═══════════════════════════════════════════════════════════
   Observatory — GAIO Publisher Design System
   Direction: Mercury + Changelog — "Stargazer Console"
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  /* Canvas & surfaces */
  --canvas:    #080809;
  --surface-0: #0e0f11;
  --surface-1: #131519;
  --surface-2: #181b20;
  --surface-3: #1e2128;
  --surface-4: #252a33;

  /* Accents */
  --accent-primary: #8093ff;   /* indigo — one CTA per view */
  --accent-trust:   #479ffa;   /* nav active, links, status */
  --accent-growth:  #4ebe96;   /* positive metrics, success */
  --accent-alert:   #f59e0b;   /* warnings, attention */
  --accent-danger:  #ef4444;   /* errors, critical */

  /* Text */
  --text-primary:   #f0f2f5;
  --text-secondary: #9aa3ae;
  --text-tertiary:  #606878;
  --text-disabled:  #404550;

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  /* Typography */
  --font-display: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-ui:      'Inter', system-ui, sans-serif;
  --font-mono:    'Berkeley Mono', 'JetBrains Mono', 'Commit Mono', monospace;

  /* Type scale */
  --sz-display: clamp(40px, 4.5vw, 56px);
  --sz-h1:      32px;
  --sz-h2:      24px;
  --sz-h3:      20px;
  --sz-body-lg: 17px;
  --sz-body:    15px;
  --sz-label:   13px;
  --sz-caption: 12px;

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

  /* Radius */
  --r-xs:   2px;
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);

  /* Motion */
  --ease:      150ms ease;
  --ease-slow: 260ms cubic-bezier(0.23, 1, 0.32, 1);

  /* Layout */
  --sidebar-w:         280px;
  --sidebar-collapsed: 72px;
  --topbar-h:          64px;
  --content-max:       1120px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--sz-body);
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; }
input, select, textarea { font-family: inherit; }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR
──────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface-0);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--ease-slow), min-width var(--ease-slow);
  flex-shrink: 0;
  z-index: 10;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

/* Header */
.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2) 0 var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  gap: var(--sp-1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--accent-primary) 0%, var(--accent-trust) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.logo-text {
  overflow: hidden;
  transition: opacity var(--ease-slow);
  min-width: 0;
}
.sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

.logo-name {
  font-size: var(--sz-label);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.logo-sub { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

.collapse-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.collapse-btn:hover { background: var(--surface-2); color: var(--text-primary); }

/* Nav scroll */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-2) 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* Section */
.nav-section { padding: 4px 0 2px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: var(--sp-1) var(--sp-3) 2px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--ease-slow);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

/* Items */
.nav-item {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--sp-3);
  gap: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--sz-label);
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: rgba(128,147,255,0.10); color: var(--accent-primary); }
.nav-item:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -2px; border-radius: var(--r-sm); }

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-label { transition: opacity var(--ease-slow); overflow: hidden; text-overflow: ellipsis; flex: 1; }
.sidebar.collapsed .nav-label { opacity: 0; }

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(128,147,255,0.15);
  color: var(--accent-primary);
  padding: 1px 6px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  transition: opacity var(--ease-slow);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

/* Bottom */
.sidebar-sep { height: 1px; background: var(--border-subtle); margin: 4px var(--sp-3); }

.sidebar-user {
  padding: 12px var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-info {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  transition: opacity var(--ease-slow);
}
.sidebar.collapsed .sidebar-user-info { opacity: 0; }
.user-name { font-size: var(--sz-label); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ────────────────────────────────────────────────────────────
   MAIN CONTENT
──────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.top-bar {
  height: var(--topbar-h);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-3);
  flex-shrink: 0;
}
.top-bar-left  { flex: 1; display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.top-bar-right { display: flex; align-items: center; gap: var(--sp-1); flex-shrink: 0; }

.page-title {
  font-size: var(--sz-h3);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.page-desc {
  font-size: var(--sz-label);
  color: var(--text-tertiary);
}

.page-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-6);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}
.page-scroll::-webkit-scrollbar { width: 5px; }
.page-scroll::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

.page-content { max-width: var(--content-max); margin: 0 auto; }

/* ────────────────────────────────────────────────────────────
   CARDS
──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: var(--sp-3); }
.card-lg { padding: var(--sp-6); border-radius: var(--r-xl); }

.score-panel {
  background: var(--surface-2);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  border: 1px solid var(--border-default);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  gap: var(--sp-2);
}
.card-label {
  font-size: var(--sz-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
}

/* ────────────────────────────────────────────────────────────
   METRICS
──────────────────────────────────────────────────────────── */
.metric-value {
  font-family: var(--font-mono);
  font-size: var(--sz-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.metric-value.c-trust   { color: var(--accent-trust); }
.metric-value.c-growth  { color: var(--accent-growth); }
.metric-value.c-primary { color: var(--accent-primary); }
.metric-value.c-alert   { color: var(--accent-alert); }
.metric-value.c-muted   { color: var(--text-secondary); }

.metric-label {
  font-size: var(--sz-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.metric-sub {
  font-size: var(--sz-caption);
  color: var(--text-tertiary);
  margin-top: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--sz-caption);
  font-family: var(--font-mono);
  font-weight: 500;
  margin-top: 8px;
}
.metric-delta.up   { color: var(--accent-growth); }
.metric-delta.down { color: var(--accent-danger); }
.metric-delta.flat { color: var(--text-tertiary); }

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ────────────────────────────────────────────────────────────
   LAYOUT GRIDS
──────────────────────────────────────────────────────────── */
.g2    { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.g3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.g4    { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: var(--sp-3); }
.g-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-3); }
.g-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-3); }
.g-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }

/* Section header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  gap: var(--sp-2);
}
.section-title {
  font-size: var(--sz-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.section-sub { font-size: var(--sz-body); color: var(--text-secondary); margin-top: 3px; }

/* ────────────────────────────────────────────────────────────
   BUTTONS
──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--sz-label);
  font-weight: 500;
  font-family: var(--font-ui);
  border: none;
  cursor: pointer;
  transition: background var(--ease), opacity var(--ease), color var(--ease), transform var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.btn-primary   { background: var(--accent-primary); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  background: var(--surface-3);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { background: var(--surface-4); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-trust { background: var(--accent-trust); color: #fff; }
.btn-trust:hover { opacity: 0.88; }
.btn-sm { height: 28px; font-size: 12px; padding: 0 12px; gap: 4px; }
.btn-lg { height: 44px; font-size: var(--sz-body); padding: 0 var(--sp-3); }
.btn-xl { height: 52px; font-size: var(--sz-body-lg); padding: 0 var(--sp-5); border-radius: var(--r-md); }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-icon:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* ────────────────────────────────────────────────────────────
   BADGES
──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-published { background: rgba(78,190,150,0.15); color: var(--accent-growth); }
.badge-published .badge-dot { background: var(--accent-growth); }
.badge-draft { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-optimizing { background: rgba(71,159,250,0.15); color: var(--accent-trust); }
.badge-optimizing .badge-dot { background: var(--accent-trust); }
.badge-review { background: rgba(245,158,11,0.15); color: var(--accent-alert); }
.badge-review .badge-dot { background: var(--accent-alert); box-shadow: 0 0 4px rgba(245,158,11,0.5); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--accent-danger); }
.badge-critical { background: rgba(239,68,68,0.15); color: var(--accent-danger); }
.badge-warning  { background: rgba(245,158,11,0.15); color: var(--accent-alert); }
.badge-info     { background: rgba(71,159,250,0.15); color: var(--accent-trust); }
.badge-type {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-ui);
  font-size: var(--sz-caption);
  font-weight: 500;
}

/* ────────────────────────────────────────────────────────────
   TABLES
──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--sz-body); }

.data-table thead th {
  text-align: left;
  font-size: var(--sz-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 0 var(--sp-3);
  height: 56px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.data-table th.r, .data-table td.r { text-align: right; }
.data-table th.c, .data-table td.c { text-align: center; }

.row-thumb {
  width: 44px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* ────────────────────────────────────────────────────────────
   PROGRESS
──────────────────────────────────────────────────────────── */
.progress {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
  flex-shrink: 0;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  width: 0;
}
.progress-fill.c-trust   { background: var(--accent-trust); }
.progress-fill.c-growth  { background: var(--accent-growth); }
.progress-fill.c-primary { background: var(--accent-primary); }
.progress-fill.c-alert   { background: var(--accent-alert); }
.progress-fill.c-muted   { background: var(--surface-4); }

.score-bar { display: flex; align-items: center; gap: var(--sp-1); }
.score-bar .progress { flex: 1; }
.score-bar .score-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   INPUTS / FORMS
──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--sz-label); font-weight: 500; color: var(--text-secondary); }

.input, .textarea, select.input {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: var(--sz-body);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color var(--ease);
  width: 100%;
}
.input        { height: 40px; padding: 0 var(--sp-2); }
.textarea     { padding: var(--sp-2); resize: vertical; min-height: 100px; }
select.input  { height: 40px; padding: 0 var(--sp-2); cursor: pointer; }
.input:focus, .textarea:focus { border-color: var(--accent-primary); }
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  padding: 0 var(--sp-2);
  height: 36px;
  transition: border-color var(--ease);
}
.search-wrap:focus-within { border-color: rgba(128,147,255,0.4); }
.search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--sz-body);
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-width: 0;
}
.search-wrap input::placeholder { color: var(--text-tertiary); }

/* ────────────────────────────────────────────────────────────
   TABS
──────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-4);
}
.tab {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--sz-label);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--ease), border-color var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.tab:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -1px; border-radius: var(--r-sm) var(--r-sm) 0 0; }

.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: var(--r-full);
  color: var(--text-tertiary);
}
.tab.active .tab-count { background: rgba(128,147,255,0.15); color: var(--accent-primary); }
.tab-panel[hidden] { display: none !important; }

/* ────────────────────────────────────────────────────────────
   CHIPS / FILTERS
──────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: var(--sz-label);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--ease);
  white-space: nowrap;
  user-select: none;
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip.active { background: rgba(128,147,255,0.12); border-color: var(--accent-primary); color: var(--accent-primary); }
.chip:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* ────────────────────────────────────────────────────────────
   FUNNEL
──────────────────────────────────────────────────────────── */
.funnel { display: flex; }
.funnel-step {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  position: relative;
}
.funnel-step + .funnel-step { border-left: 1px solid var(--border-subtle); }
.funnel-pct {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.funnel-bar { margin-top: var(--sp-2); }

/* ────────────────────────────────────────────────────────────
   ISSUES
──────────────────────────────────────────────────────────── */
.issue-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.issue-item:last-child { border-bottom: none; }
.issue-dot { width: 8px; height: 8px; border-radius: var(--r-full); flex-shrink: 0; margin-top: 5px; }
.issue-dot.critical { background: var(--accent-danger); box-shadow: 0 0 5px rgba(239,68,68,0.4); }
.issue-dot.warning  { background: var(--accent-alert); }
.issue-dot.info     { background: var(--accent-trust); }

/* ────────────────────────────────────────────────────────────
   AVATAR
──────────────────────────────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-trust));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

/* ────────────────────────────────────────────────────────────
   EMPTY STATE
──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  gap: var(--sp-2);
}
.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.empty-title { font-size: var(--sz-body); font-weight: 500; color: var(--text-secondary); }
.empty-desc  { font-size: var(--sz-label); color: var(--text-tertiary); max-width: 260px; line-height: 1.6; }

/* ────────────────────────────────────────────────────────────
   UPLOAD ZONE
──────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.upload-zone:hover { border-color: var(--accent-primary); background: rgba(128,147,255,0.04); }

/* ────────────────────────────────────────────────────────────
   TONE SLIDER
──────────────────────────────────────────────────────────── */
.tone-slider-wrap input[type=range] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--surface-4);
  outline: none;
  cursor: pointer;
  margin: 6px 0;
}
.tone-slider-wrap input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px rgba(128,147,255,0.3);
  cursor: pointer;
}
.tone-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ────────────────────────────────────────────────────────────
   COLOR SWATCH
──────────────────────────────────────────────────────────── */
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   DIVIDER
──────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-subtle); }

/* ────────────────────────────────────────────────────────────
   GAUGE (SVG-based arc)
──────────────────────────────────────────────────────────── */
.gauge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ────────────────────────────────────────────────────────────
   UTILITIES
──────────────────────────────────────────────────────────── */
.flex    { display: flex; }
.col     { flex-direction: column; }
.center  { align-items: center; }
.between { justify-content: space-between; }
.end     { justify-content: flex-end; }
.grow    { flex: 1; }
.shrink0 { flex-shrink: 0; }
.wrap    { flex-wrap: wrap; }
.w-full  { width: 100%; }

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }

.text-2   { color: var(--text-secondary); }
.text-3   { color: var(--text-tertiary); }
.mono     { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-xs  { font-size: var(--sz-caption); }
.text-sm  { font-size: var(--sz-label); }
.text-lg  { font-size: var(--sz-body-lg); }
.fw-500   { font-weight: 500; }
.fw-600   { font-weight: 600; }
.fw-700   { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap   { white-space: nowrap; }

/* Platform icon (AI Platform Comparison table) */
.platform-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   REDUCED MOTION
──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .progress-fill { transition: none !important; }
}

/* ────────────────────────────────────────────────────────────
   LIGHT THEME
   Apply via: document.documentElement.setAttribute('data-theme','light')
──────────────────────────────────────────────────────────── */
html[data-theme="light"] {
  /* Canvas & surfaces */
  --canvas:    #f0f2f6;
  --surface-0: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef0f5;
  --surface-4: #e3e6ed;

  /* Accents — WCAG AA on white (#ffffff) */
  --accent-primary: #4f46e5;   /* indigo-600  4.8:1 */
  --accent-trust:   #2563eb;   /* blue-600    5.3:1 */
  --accent-growth:  #059669;   /* emerald-600 4.5:1 */
  --accent-alert:   #d97706;   /* amber-600   — used for chips/bg, not pure text */
  --accent-danger:  #dc2626;   /* red-600     4.5:1 */

  /* Text */
  --text-primary:   #0f1115;
  --text-secondary: #4e5966;
  --text-tertiary:  #8892a4;
  --text-disabled:  #b8bfc9;

  /* Borders */
  --border-subtle:  rgba(0,0,0,0.07);
  --border-default: rgba(0,0,0,0.12);
  --border-strong:  rgba(0,0,0,0.22);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
}

/* ── Sidebar footer (theme toggle lives here) ── */
.sidebar-footer {
  padding: 12px var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--sz-label);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  text-align: left;
}
.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* Sun shown in light mode, moon shown in dark mode */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Collapsed: icon only */
.sidebar.collapsed .theme-toggle .toggle-label { display: none; }
.sidebar.collapsed .theme-toggle { justify-content: center; padding: 8px; }
