/* ================================================================
   Homiva Analytics — design tokens + component CSS (light default)
   shadcn-flavored neutrals, single warm amber accent
   ================================================================ */

:root {
  /* shadcn-style HSL tokens — light theme */
  --background: 0 0% 100%;
  --card: 0 0% 100%;
  --popover: 0 0% 100%;
  --panel-muted: 60 9% 98%;          /* warm paper */
  --foreground: 240 10% 3.9%;        /* zinc-950 */
  --muted-foreground: 240 4% 46%;    /* zinc-500 */
  --muted-foreground-2: 240 5% 65%;  /* zinc-400 */
  --border: 240 6% 90%;              /* zinc-200 */
  --border-strong: 240 6% 84%;       /* zinc-300 */
  --ring: 240 5% 64%;
  --primary: 240 6% 10%;
  --primary-foreground: 0 0% 98%;

  --accent-warm: 28 80% 52%;
  --accent-warm-soft: 28 90% 95%;
  --accent-warm-border: 28 70% 85%;

  --success: 142 41% 40%;
  --success-soft: 142 50% 95%;
  --danger: 0 60% 52%;
  --danger-soft: 0 70% 96%;
  --warning: 38 92% 50%;
  --warning-soft: 38 95% 95%;

  /* radii / shadows */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 18, 23, 0.04);
  --shadow-md: 0 6px 18px rgba(15, 18, 23, 0.08);
  --shadow-sheet: -16px 0 48px rgba(15, 18, 23, 0.12);

  /* type */
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --background: 240 10% 4%;
  --card: 240 8% 7%;
  --popover: 240 8% 7%;
  --panel-muted: 240 8% 9%;
  --foreground: 0 0% 96%;
  --muted-foreground: 240 5% 65%;
  --muted-foreground-2: 240 5% 50%;
  --border: 240 6% 16%;
  --border-strong: 240 6% 22%;
  --ring: 240 5% 50%;
  --primary: 0 0% 96%;
  --primary-foreground: 240 6% 10%;
  --accent-warm-soft: 28 50% 14%;
  --accent-warm-border: 28 40% 28%;
  --success-soft: 142 30% 12%;
  --danger-soft: 0 40% 14%;
  --warning-soft: 38 50% 14%;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-sheet: -16px 0 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: hsl(var(--panel-muted));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
body { min-width: 1280px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 24px; letter-spacing: -0.025em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
input, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "cv11"; }
.tnum { font-variant-numeric: tabular-nums; }
.uppercase-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}
.shell.sidebar-collapsed {
  grid-template-columns: 56px 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.shell.sidebar-collapsed .sidebar {
  padding: 14px 6px 16px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid hsl(var(--border));
}
.shell.sidebar-collapsed .brand-name,
.shell.sidebar-collapsed .brand-sub,
.shell.sidebar-collapsed .nav-group-label,
.shell.sidebar-collapsed .nav-item .nav-label,
.shell.sidebar-collapsed .nav-item .num,
.shell.sidebar-collapsed .sidebar-footer {
  display: none;
}
.shell.sidebar-collapsed .brand {
  padding: 6px 0 14px;
  justify-content: center;
}
.shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 8px 0;
}
.sidebar-toggle {
  position: absolute;
  top: 13px;
  right: -12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 50%;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  z-index: 5;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.18s ease;
}
.sidebar-toggle:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border-strong));
}
.shell.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: -0.05em;
}
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub  { color: hsl(var(--muted-foreground)); font-size: 11.5px; margin-left: auto; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group + .nav-group { margin-top: 2px; }
.nav-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: hsl(var(--muted-foreground-2));
  padding: 8px 10px 4px;
  font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: hsl(var(--foreground));
  font-size: 13px;
  font-weight: 450;
  text-align: left;
}
.nav-item:hover { background: hsl(var(--panel-muted)); }
.nav-item.active {
  background: hsl(var(--foreground) / 0.06);
  color: hsl(var(--foreground));
  font-weight: 550;
}
[data-theme="dark"] .nav-item.active { background: hsl(var(--foreground) / 0.08); }
.nav-item .num {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.nav-item svg { width: 14px; height: 14px; flex-shrink: 0; color: hsl(var(--muted-foreground)); }
.nav-item.active svg { color: hsl(var(--foreground)); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px 4px;
  border-top: 1px solid hsl(var(--border));
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  display: flex; flex-direction: column; gap: 4px;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 28px;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
}

/* ---------- page wrapper (every route renders inside this) ---------- */
.page {
  padding: 24px 28px 56px;
  max-width: 1640px;
  margin: 0 auto;
  width: 100%;
}
@media (min-width: 1700px) {
  .page { padding: 28px 40px 64px; }
}
.crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}
.crumb .here { color: hsl(var(--foreground)); font-weight: 500; }
.crumb .sep  { color: hsl(var(--muted-foreground-2)); }
.topbar .grow { flex: 1; }
.freshness {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  padding: 0 8px;
}
.freshness .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: hsl(var(--success));
}
.freshness.stale .dot { background: hsl(var(--warning)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--background));
  font-size: 12.5px;
  font-weight: 500;
  color: hsl(var(--foreground));
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: hsl(var(--panel-muted)); border-color: hsl(var(--border-strong)); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: hsl(var(--panel-muted)); }
.btn-icon {
  width: 30px; padding: 0;
  display: inline-grid; place-items: center;
}
.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.btn-primary:hover { background: hsl(var(--primary) / 0.92); }
.btn svg { width: 13px; height: 13px; }

.kbd {
  display: inline-flex; align-items: center;
  height: 18px; padding: 0 5px;
  border-radius: 4px;
  border: 1px solid hsl(var(--border-strong));
  background: hsl(var(--panel-muted));
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  line-height: 1;
}

/* ---------- card / panel ---------- */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-clickable { cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
.card-clickable:hover { border-color: hsl(var(--border-strong)); box-shadow: var(--shadow-md); }
.card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid hsl(var(--border));
}
.card-title { font-size: 13px; font-weight: 550; }
.card-body { padding: 14px; }
.card-body-tight { padding: 10px 12px; }

.divider { height: 1px; background: hsl(var(--border)); border: 0; margin: 0; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: hsl(var(--panel-muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  white-space: nowrap;
}
.badge-outline { background: transparent; }
.badge-warm {
  background: hsl(var(--accent-warm-soft));
  color: hsl(var(--accent-warm));
  border-color: hsl(var(--accent-warm-border));
}
.badge-success {
  background: hsl(var(--success-soft));
  color: hsl(var(--success));
  border-color: hsl(var(--success) / 0.25);
}
.badge-danger {
  background: hsl(var(--danger-soft));
  color: hsl(var(--danger));
  border-color: hsl(var(--danger) / 0.25);
}
.badge-warning {
  background: hsl(var(--warning-soft));
  color: hsl(28 80% 38%);
  border-color: hsl(var(--warning) / 0.3);
}
.badge-solid {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
}
.badge .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 500;
  height: 20px; padding: 0 6px; border-radius: 4px;
}
.delta-pos { background: hsl(var(--success-soft)); color: hsl(var(--success)); }
.delta-neg { background: hsl(var(--danger-soft));  color: hsl(var(--danger));  }
.delta-flat { background: hsl(var(--panel-muted)); color: hsl(var(--muted-foreground)); }
.delta svg { width: 10px; height: 10px; }

/* ---------- main content area ---------- */
.main {
  padding: 24px 28px 64px;
  max-width: 1480px;
}
.page-head {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 24px;
}
.page-meta {
  display: flex; gap: 14px; align-items: center;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}
.page-meta .mono { color: hsl(var(--foreground)); }
.commentary {
  font-size: 13.5px;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
  max-width: 780px;
}
.commentary strong { color: hsl(var(--foreground)); font-weight: 600; }

/* ---------- KPI hero ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.kpi:hover { border-color: hsl(var(--border-strong)); box-shadow: var(--shadow-md); }
.kpi-label {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10.5px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
  line-height: 1.05;
}
.kpi-value.hero { font-size: 40px; }
.kpi-row2 {
  display: flex; align-items: center; gap: 8px;
  margin-top: 2px;
}
.kpi-prev {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  margin-left: auto;
}
.kpi-spark { height: 30px; margin-top: 4px; }

/* ---------- metric row list ---------- */
.metric-list {
  display: flex; flex-direction: column;
}
.metric-row {
  display: grid;
  grid-template-columns: 1fr 60px 80px 70px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid hsl(var(--border));
  cursor: pointer;
  transition: background 0.1s;
}
.metric-row:first-child { border-top: 0; }
.metric-row:hover { background: hsl(var(--panel-muted)); }
.metric-row .label {
  font-size: 13px;
  color: hsl(var(--foreground));
}
.metric-row .label-sub {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-top: 1px;
}
.metric-row .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  color: hsl(var(--foreground));
}
.metric-row .spark { height: 20px; }
.metric-row .delta-cell { text-align: right; }

/* ---------- breakdown table ---------- */
.bk-table { width: 100%; }
.bk-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid hsl(var(--border));
  position: relative;
}
.bk-row:first-child { border-top: 0; }
.bk-row .rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.bk-row .key {
  font-size: 13px;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bk-row .v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: hsl(var(--foreground));
}
.bk-row .bar {
  position: absolute;
  left: 0; bottom: 0; height: 2px;
  background: hsl(var(--foreground) / 0.15);
  transition: background 0.1s;
}
.bk-row:first-child .bar {
  background: hsl(var(--accent-warm));
  height: 2px;
}
.bk-row:hover { background: hsl(var(--panel-muted)); }

/* ---------- bar chart top-N ---------- */
.bar-list { display: flex; flex-direction: column; gap: 7px; }
.bar-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.bar-key   { font-size: 12.5px; color: hsl(var(--foreground)); }
.bar-track {
  grid-column: 1 / -1;
  height: 8px; border-radius: 3px;
  background: hsl(var(--panel-muted));
  overflow: hidden;
  border: 1px solid hsl(var(--border));
}
.bar-fill {
  height: 100%;
  background: hsl(var(--foreground) / 0.18);
  border-radius: 2px 0 0 2px;
}
.bar-item.top .bar-fill { background: hsl(var(--accent-warm)); }
.bar-meta { font-family: var(--font-mono); font-size: 11.5px; color: hsl(var(--muted-foreground)); }

/* ---------- funnel ---------- */
.funnel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: hsl(var(--border));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}
.funnel-step {
  background: hsl(var(--card));
  padding: 14px 14px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  transition: background 0.1s;
}
.funnel-step:hover { background: hsl(var(--panel-muted)); }
.funnel-step .step-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  display: flex; align-items: center; gap: 6px;
}
.funnel-step .step-num {
  font-family: var(--font-mono);
  background: hsl(var(--panel-muted));
  border: 1px solid hsl(var(--border));
  width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  border-radius: 3px;
  font-size: 10px;
}
.funnel-step .step-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}
.funnel-step .step-conv {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  display: flex; align-items: center; gap: 5px;
}
.funnel-step .conv-bar {
  flex: 1; height: 3px; border-radius: 2px;
  background: hsl(var(--panel-muted));
  overflow: hidden;
}
.funnel-step .conv-bar > span {
  display: block; height: 100%;
  background: hsl(var(--foreground) / 0.5);
}
.funnel-step.warm .conv-bar > span { background: hsl(var(--accent-warm)); }

/* ---------- sheet (right drawer) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 18, 23, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 540px;
  background: hsl(var(--background));
  border-left: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-sheet);
  z-index: 51;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(.32,.72,.36,1);
}
.sheet.open { transform: translateX(0); }
.sheet-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; flex-direction: column; gap: 8px;
}
.sheet-head .top {
  display: flex; align-items: center; gap: 10px;
}
.sheet-head .top .id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.sheet-head h2 { font-size: 17px; }
.sheet-head .meta-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.sheet-section-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 8px;
}

/* ---------- SQL pane ---------- */
.sql-tabs {
  display: flex; gap: 0; border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 0;
}
.sql-tab {
  padding: 7px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.sql-tab.active { color: hsl(var(--foreground)); border-color: hsl(var(--foreground)); }
.sql-tab:hover { color: hsl(var(--foreground)); }
.sql {
  position: relative;
  background: hsl(var(--panel-muted));
  border: 1px solid hsl(var(--border));
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: hsl(var(--foreground));
  overflow-x: auto;
}
.sql .kw   { color: hsl(28 80% 40%); font-weight: 500; }
.sql .str  { color: hsl(142 41% 36%); }
.sql .num  { color: hsl(220 60% 45%); }
.sql .cmt  { color: hsl(var(--muted-foreground-2)); font-style: italic; }
[data-theme="dark"] .sql .kw  { color: hsl(28 80% 65%); }
[data-theme="dark"] .sql .str { color: hsl(142 50% 65%); }
[data-theme="dark"] .sql .num { color: hsl(220 70% 70%); }
.sql-copy {
  position: absolute; top: 8px; right: 8px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
}
.sql-copy:hover { color: hsl(var(--foreground)); }

/* ---------- tables ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table th, .table td {
  text-align: left;
  padding: 9px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--panel-muted));
  border-top: 1px solid hsl(var(--border));
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child  { border-top-right-radius: var(--radius); }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: hsl(var(--panel-muted) / 0.6); }
.table tbody tr.clickable { cursor: pointer; }
.table .num-cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- avatar ---------- */
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: hsl(var(--panel-muted));
  border: 1px solid hsl(var(--border));
  display: inline-grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; border-radius: 12px; }

/* ---------- skeleton ---------- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skel {
  background: linear-gradient(
    90deg,
    hsl(var(--panel-muted)) 25%,
    hsl(var(--border)) 50%,
    hsl(var(--panel-muted)) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 5px;
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: hsl(var(--panel-muted)); }
}

/* ---------- tabs (shadcn style) ---------- */
.tabs-list {
  display: inline-flex;
  border-bottom: 1px solid hsl(var(--border));
  gap: 0;
  width: 100%;
}
.tab-trigger {
  padding: 9px 14px;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 450;
  display: flex; align-items: center; gap: 7px;
}
.tab-trigger.active {
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
  font-weight: 550;
}
.tab-trigger:hover { color: hsl(var(--foreground)); }
.tab-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: hsl(var(--panel-muted));
  border: 1px solid hsl(var(--border));
  border-radius: 3px;
  padding: 1px 5px;
  color: hsl(var(--muted-foreground));
}
.tab-trigger.active .tab-count { color: hsl(var(--foreground)); }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 10px 14px 10px 0;
  border-left: 1px solid hsl(var(--border));
  margin-left: 14px;
  position: relative;
}
.tl-item::before {
  content: ""; position: absolute; left: -4px; top: 14px;
  width: 7px; height: 7px;
  background: hsl(var(--background));
  border: 1.5px solid hsl(var(--border-strong));
  border-radius: 50%;
}
.tl-item.warm::before { border-color: hsl(var(--accent-warm)); background: hsl(var(--accent-warm-soft)); }
.tl-item.success::before { border-color: hsl(var(--success)); background: hsl(var(--success-soft)); }
.tl-item.danger::before  { border-color: hsl(var(--danger)); background: hsl(var(--danger-soft));   }
.tl-item .ico {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  color: hsl(var(--muted-foreground));
  margin-left: 14px;
}
.tl-event {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: hsl(var(--foreground));
}
.tl-meta {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  margin-top: 1px;
  font-family: var(--font-mono);
}
.tl-time {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---------- generation card ---------- */
.gen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.gen-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  overflow: hidden;
}
.gen-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: hsl(var(--border));
  position: relative;
}
.gen-img {
  aspect-ratio: 4/3;
  background: hsl(var(--panel-muted));
  background-size: cover;
  background-position: center;
  position: relative;
}
.gen-img-label {
  position: absolute; top: 8px; left: 8px;
  background: hsl(var(--background) / 0.92);
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  backdrop-filter: blur(4px);
}
.gen-noimg {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground-2));
  gap: 6px;
  font-size: 11.5px;
  background: hsl(var(--panel-muted));
}
.gen-body { padding: 12px 14px; }
.gen-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.gen-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 11.5px;
}
.gen-meta-k { color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; font-weight: 500; }
.gen-meta-v { font-family: var(--font-mono); font-size: 11.5px; color: hsl(var(--foreground)); }
.gen-prompt {
  margin-top: 10px;
  padding: 9px 11px;
  background: hsl(var(--panel-muted));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}
.gen-error {
  margin-top: 8px;
  padding: 8px 11px;
  background: hsl(var(--danger-soft));
  border: 1px solid hsl(var(--danger) / 0.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: hsl(var(--danger));
}
.gen-error .code { font-family: var(--font-mono); font-weight: 600; }

/* ---------- compare slider ---------- */
.compare {
  position: relative;
  aspect-ratio: 4/3;
  background: hsl(var(--panel-muted));
  cursor: ew-resize;
  user-select: none;
  overflow: hidden;
}
.compare img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.compare .clip {
  position: absolute; inset: 0;
  clip-path: inset(0 50% 0 0);
}
.compare .handle {
  position: absolute; top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: hsl(var(--background));
  pointer-events: none;
}
.compare .knob {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border-strong));
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.compare .knob svg { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }

/* ---------- user detail head ---------- */
.user-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
.user-head .id-block { display: flex; flex-direction: column; gap: 4px; }
.user-head .uid { font-family: var(--font-mono); font-size: 14px; font-weight: 550; color: hsl(var(--foreground)); }
.user-head .uid-full { font-family: var(--font-mono); font-size: 11px; color: hsl(var(--muted-foreground)); }
.user-head .meta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: hsl(var(--muted-foreground)); }
.user-head .meta-row .v { color: hsl(var(--foreground)); }
.user-head .stat-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 22px; align-items: end; }
.user-head .stat-k { font-size: 10.5px; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.06em; }
.user-head .stat-v { font-family: var(--font-mono); font-size: 18px; font-weight: 550; color: hsl(var(--foreground)); }

.pref-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.pref-cell {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex; flex-direction: column; gap: 2px;
  background: hsl(var(--card));
}
.pref-cell .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); }
.pref-cell .v { font-size: 13px; font-weight: 500; color: hsl(var(--foreground)); }
.pref-cell .v.empty { color: hsl(var(--muted-foreground-2)); font-weight: 400; }

/* ---------- user detail layout ---------- */
.user-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  margin-top: 18px;
}
.stats-card { display: flex; flex-direction: column; gap: 0; }
.stats-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-top: 1px solid hsl(var(--border));
}
.stats-row:first-child { border-top: 0; }
.stats-row .k { font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.stats-row .v { font-family: var(--font-mono); font-size: 13px; font-weight: 550; color: hsl(var(--foreground)); }
.stats-sub { font-family: var(--font-mono); font-size: 10.5px; color: hsl(var(--muted-foreground-2)); }

/* ---------- funnel ribbon (user detail) ---------- */
.funnel-ribbon {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: hsl(var(--card));
  margin-bottom: 14px;
}
.fr-step {
  padding: 10px 12px;
  border-left: 1px solid hsl(var(--border));
  display: flex; flex-direction: column; gap: 2px;
}
.fr-step:first-child { border-left: 0; }
.fr-step .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); }
.fr-step .st  { font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.fr-step.done   .st { color: hsl(var(--success)); }
.fr-step.miss   .st { color: hsl(var(--muted-foreground-2)); }
.fr-step .ts { font-size: 10.5px; color: hsl(var(--muted-foreground)); font-family: var(--font-mono); margin-top: 1px; }

/* ---------- command palette ---------- */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 18, 23, 0.32);
  display: grid; place-items: start center;
  padding-top: 14vh;
}
.cmd {
  width: 580px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15,18,23,0.24);
  overflow: hidden;
}
.cmd-input {
  width: 100%;
  border: 0; outline: 0;
  padding: 14px 18px;
  font-size: 14px;
  background: transparent;
  border-bottom: 1px solid hsl(var(--border));
  font-family: var(--font-sans);
}
.cmd-input::placeholder { color: hsl(var(--muted-foreground-2)); }
.cmd-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmd-group-label {
  padding: 7px 10px 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: hsl(var(--muted-foreground));
}
.cmd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.cmd-item .cmd-meta { margin-left: auto; font-size: 11px; color: hsl(var(--muted-foreground)); font-family: var(--font-mono); }
.cmd-item.selected { background: hsl(var(--panel-muted)); }
.cmd-item svg { color: hsl(var(--muted-foreground)); }
.cmd-empty { padding: 28px 14px; text-align: center; color: hsl(var(--muted-foreground)); font-size: 13px; }
.cmd-foot {
  padding: 8px 12px;
  border-top: 1px solid hsl(var(--border));
  display: flex; gap: 14px;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}

/* ---------- tooltip ---------- */
.tt-host { position: relative; display: inline-flex; }
.tt {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 80;
  font-family: var(--font-mono);
}
.tt-host:hover .tt { opacity: 1; }

/* ---------- dropdown ---------- */
.dd-host { position: relative; }
.dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 5px;
  min-width: 200px;
  z-index: 40;
}
.dd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 12.5px;
  width: 100%;
  text-align: left;
}
.dd-item:hover { background: hsl(var(--panel-muted)); }
.dd-item.active { color: hsl(var(--accent-warm)); font-weight: 550; }
.dd-item .check { margin-left: auto; }

/* ---------- filter chip strip ---------- */
.filter-strip {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 14px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: 6px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border-strong));
  font-size: 12.5px;
  color: hsl(var(--foreground));
}
.chip:hover { background: hsl(var(--panel-muted)); }
.chip.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
}
.chip .x {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  color: hsl(var(--muted-foreground-2));
}
.chip.active .x { color: hsl(var(--background) / 0.7); }

/* ---------- 2-col layout ---------- */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col-2-wide { display: grid; grid-template-columns: 7fr 5fr; gap: 14px; }
.col-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.section-block { margin-bottom: 28px; }

/* ---------- charts ---------- */
.spark-line { stroke: hsl(var(--foreground)); stroke-width: 1.4; fill: none; }
.spark-area { fill: hsl(var(--foreground) / 0.06); }
.spark-dot  { fill: hsl(var(--accent-warm)); }
.spark-prev { stroke: hsl(var(--muted-foreground-2)); stroke-width: 1; stroke-dasharray: 2 2; fill: none; }

.line-grid { stroke: hsl(var(--border)); stroke-width: 1; }
.line-axis-text { fill: hsl(var(--muted-foreground)); font-size: 10px; font-family: var(--font-mono); }

/* ---------- environment / status badges ---------- */
.env-debug      { background: hsl(var(--warning-soft)); color: hsl(28 80% 38%); border-color: hsl(var(--warning) / 0.3); }
.env-simulator  { background: hsl(220 90% 96%); color: hsl(220 70% 40%); border-color: hsl(220 60% 88%); }
.env-testflight { background: hsl(260 70% 96%); color: hsl(260 50% 40%); border-color: hsl(260 50% 88%); }
.env-appstore   { background: hsl(var(--success-soft)); color: hsl(var(--success)); border-color: hsl(var(--success) / 0.25); }
.env-unknown    { background: hsl(var(--panel-muted)); color: hsl(var(--muted-foreground)); }

[data-theme="dark"] .env-simulator  { background: hsl(220 30% 18%); color: hsl(220 70% 75%); }
[data-theme="dark"] .env-testflight { background: hsl(260 30% 18%); color: hsl(260 60% 78%); }

/* ---------- misc ---------- */
.flex { display: flex; }
.row  { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-muted-2 { color: hsl(var(--muted-foreground-2)); }
.text-warm { color: hsl(var(--accent-warm)); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.no-wrap { white-space: nowrap; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 14px 0; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: hsl(var(--border-strong));
  border-radius: 5px;
  border: 2px solid hsl(var(--background));
}
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground-2)); }

/* ==================== Login page ==================== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: hsl(var(--panel-muted));
  padding: 48px 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 36px 36px 28px;
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.04), 0 8px 32px hsl(0 0% 0% / 0.04);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: hsl(var(--foreground));
}
.login-sub {
  margin: 0 0 22px;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  line-height: 1.5;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.login-field input {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-field input:focus {
  outline: none;
  border-color: hsl(var(--accent-warm));
  box-shadow: 0 0 0 3px hsl(var(--accent-warm) / 0.18);
}
.login-field input:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  background: hsl(var(--danger-soft));
  color: hsl(var(--danger));
  border: 1px solid hsl(var(--danger) / 0.3);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.btn-primary {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
  padding: 11px 14px;
  font-weight: 550;
  border-radius: 8px;
  font-size: 13.5px;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.btn-primary:hover { background: hsl(var(--foreground)); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.login-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--border));
  font-size: 11px;
  color: hsl(var(--muted-foreground-2));
  text-align: center;
}

/* Boot loader (full-page) */
.boot-loader {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}
.boot-loader-error {
  max-width: 460px;
  padding: 16px 18px;
  border: 1px solid hsl(var(--danger) / 0.3);
  background: hsl(var(--danger-soft));
  color: hsl(var(--danger));
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

/* ========================================================================
   Experiment variant cards — Paywall Round 1 dashboard
   ======================================================================== */

.exp-variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.exp-card {
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.exp-card:hover {
  border-color: hsl(var(--border-strong, var(--border)));
}
.exp-card.is-winner {
  border: 2px solid hsl(142 50% 38%);
  box-shadow: 0 0 0 4px hsla(142, 50%, 38%, 0.10);
}
.exp-card .winner-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: hsl(142 50% 38%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: 0.4px;
  z-index: 5;
  box-shadow: 0 2px 8px hsla(142, 50%, 38%, 0.32);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Phone preview */
.exp-thumb {
  width: 100%;
  height: 280px;
  background: linear-gradient(180deg, #faf0e6 0%, #f5e6d8 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
  border-bottom: 1px solid hsl(var(--border));
}
.exp-thumb-phone {
  width: 140px;
  aspect-ratio: 9 / 19.5;
  background: #1a1a1a;
  border-radius: 18px;
  padding: 4px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.exp-thumb-screen {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Variant card body */
.exp-card-body { padding: 14px; }
.exp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}
.exp-card-name {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 4px;
  line-height: 1.3;
}
.exp-card-key {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}
.exp-card-alloc {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  white-space: nowrap;
}
.exp-card-alloc strong { color: hsl(var(--foreground)); }

.exp-mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.exp-mini-kpi {
  background: hsl(var(--muted) / 0.4);
  border-radius: 6px;
  padding: 7px;
  text-align: center;
}
.exp-mini-kpi-label {
  font-size: 9.5px;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.exp-mini-kpi-val {
  font-size: 14px;
  font-weight: 700;
  color: hsl(var(--foreground));
  letter-spacing: -0.3px;
}

.exp-conv {
  background: linear-gradient(180deg, hsl(40 90% 96%) 0%, hsl(38 80% 92%) 100%);
  border: 1px solid hsl(38 50% 80%);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.exp-conv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.exp-conv-label {
  font-size: 10.5px;
  font-weight: 600;
  color: hsl(28 50% 30%);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.exp-conv-val {
  font-size: 19px;
  font-weight: 700;
  color: hsl(28 50% 30%);
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}
.exp-delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.exp-delta.pos { color: hsl(142 50% 38%); }
.exp-delta.neg { color: hsl(0 65% 50%); }
.exp-delta.zero { color: hsl(var(--muted-foreground)); }

.exp-mix {
  margin-bottom: 8px;
}
.exp-mix-label {
  font-size: 10px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.exp-mix-bar {
  height: 18px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: hsl(var(--muted));
}
.exp-mix-yearly {
  background: linear-gradient(90deg, #d4a861 0%, #c89a55 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exp-mix-weekly {
  background: linear-gradient(90deg, #c8553d 0%, #a8482e 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exp-rev {
  display: flex;
  justify-content: space-between;
  padding: 6px 0 0;
  border-top: 1px dashed hsl(var(--border));
}
.exp-rev-label {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.exp-rev-val {
  font-size: 13px;
  font-weight: 700;
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
}

/* Phone thumbnail miniatures (variant-specific renders) */
.thumb-ctrl-hero {
  height: 60%;
  background-image: url('https://images.unsplash.com/photo-1586023492125-27b2c045efd7?auto=format&fit=crop&w=400&q=70');
  background-size: cover;
  background-position: center;
  position: relative;
}
.thumb-ctrl-hero::after {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  background: white;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.thumb-ctrl-bottom {
  flex: 1;
  background: #fcf7f1;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.thumb-ctrl-title { font-size: 6px; font-weight: 700; color: #2c1810; text-align: center; }
.thumb-ctrl-seg {
  background: rgba(44,24,16,0.06);
  border-radius: 4px;
  height: 14px;
  display: flex;
  margin: 2px 0;
}
.thumb-ctrl-seg div { flex: 1; }
.thumb-ctrl-seg .act { background: #fff; border-radius: 3px; margin: 1px; box-shadow: 0 0 2px rgba(0,0,0,0.05); }
.thumb-cta {
  background: #c8553d;
  color: white;
  font-size: 5.5px;
  font-weight: 700;
  padding: 3px 0;
  text-align: center;
  border-radius: 99px;
}

.thumb-rem-hero {
  height: 56%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
}
.thumb-rem-half-l { background-image: url('https://images.unsplash.com/photo-1505873242700-f289a29e1e0f?auto=format&fit=crop&w=400&q=70'); background-size: cover; }
.thumb-rem-half-r { background-image: url('https://images.unsplash.com/photo-1540518614846-7eded433c457?auto=format&fit=crop&w=400&q=70'); background-size: cover; }
.thumb-rem-divider {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1.5px;
  background: white;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.thumb-rem-bottom {
  flex: 1;
  background: #fcf7f1;
  padding: 4px 6px;
}
.thumb-rem-title { font-size: 6.5px; font-weight: 700; color: #2c1810; text-align: center; line-height: 1.1; margin-bottom: 2px; }
.thumb-rem-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-bottom: 3px; }
.thumb-rem-pill { background: #f5e6d8; border-radius: 99px; height: 7px; }
.thumb-rem-plan {
  border: 1px solid rgba(44,24,16,0.12);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 5px;
  color: #2c1810;
  height: 9px;
  margin-bottom: 1.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.thumb-rem-plan.act { border: 1.5px solid #c8553d; background: #f5e6d8; }

.thumb-fa-hero {
  flex: 1;
  background-image: url('https://images.unsplash.com/photo-1631679706909-1844bbd07221?auto=format&fit=crop&w=400&q=70');
  background-size: cover;
  background-position: center;
}
.thumb-fa-bottom {
  height: 32%;
  background: #fcf7f1;
  border-radius: 8px 8px 0 0;
  margin-top: -4px;
  padding: 4px 6px;
  position: relative;
  z-index: 2;
}
.thumb-fa-title { font-size: 6.5px; font-weight: 700; color: #2c1810; text-align: center; margin-bottom: 2px; }
.thumb-fa-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 2px; }
.thumb-fa-plan {
  border: 1px solid rgba(44,24,16,0.10);
  border-radius: 4px;
  padding: 3px;
  font-size: 5px;
  text-align: center;
  color: #2c1810;
  height: 14px;
}
.thumb-fa-plan.act { border: 1.5px solid #c8553d; background: #f5e6d8; }

/* Experiment header KPI strip */
.exp-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.exp-kpi-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  padding: 14px;
}
.exp-kpi-card-label {
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.exp-kpi-card-val {
  font-size: 22px;
  font-weight: 700;
  color: hsl(var(--foreground));
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}
.exp-kpi-card-sub {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
}
.exp-kpi-card-sub.pos { color: hsl(142 50% 38%); font-weight: 600; }
.exp-kpi-card-sub.neg { color: hsl(0 65% 50%); font-weight: 600; }

/* Funnel mini-table */
.exp-funnel {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.exp-funnel th, .exp-funnel td {
  padding: 7px 8px;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.exp-funnel thead th {
  font-size: 9.5px;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-align: center;
  border-bottom: 2px solid hsl(var(--foreground));
}
.exp-funnel thead th:first-child { text-align: left; }
.exp-funnel tbody td {
  text-align: center;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
}
.exp-funnel tbody td:first-child {
  text-align: left;
  font-family: inherit;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.exp-funnel td.high { color: hsl(142 50% 38%); }
.exp-funnel td.low { color: hsl(0 65% 50%); }
