/* ──────────────────────────────────────────────────────────────
   GymLife Admin — design tokens
   Linear/Vercel-inspired: tipografia forte, off-white caldo, slate neutrals,
   accenti piattaforma armonizzati in oklch (stessa C/L, hue diversa).
   ────────────────────────────────────────────────────────────── */

:root {
  /* Surface */
  --bg:        #FAFAF7;        /* off-white caldissimo */
  --bg-2:      #F4F3EE;        /* card alt */
  --surface:   #FFFFFF;
  --line:      rgba(20, 20, 18, 0.08);
  --line-2:    rgba(20, 20, 18, 0.05);
  --line-strong: rgba(20, 20, 18, 0.14);

  /* Ink */
  --ink:       #15140F;        /* near black, warm */
  --ink-2:     #3A382F;
  --muted:     #74716A;
  --muted-2:   #A09C92;
  --faint:     #C9C5BB;

  /* Accents — armonizzati: chroma 0.14, lightness 0.62 */
  --c-ios:      oklch(0.62 0.06 250);   /* slate-blue, sobrio */
  --c-android:  oklch(0.68 0.16 150);   /* verde */
  --c-gympass:  oklch(0.68 0.16 45);    /* arancio */
  --c-7card:    oklch(0.62 0.18 25);    /* rosso */

  --c-ios-bg:      oklch(0.62 0.06 250 / 0.10);
  --c-android-bg:  oklch(0.68 0.16 150 / 0.10);
  --c-gympass-bg:  oklch(0.68 0.16 45 / 0.10);
  --c-7card-bg:    oklch(0.62 0.18 25 / 0.10);

  /* Status */
  --st-active:   oklch(0.60 0.14 150);
  --st-trial:    oklch(0.70 0.14 75);
  --st-expired:  oklch(0.60 0.16 25);
  --st-active-bg:  oklch(0.60 0.14 150 / 0.10);
  --st-trial-bg:   oklch(0.70 0.14 75 / 0.12);
  --st-expired-bg: oklch(0.60 0.16 25 / 0.10);

  /* Type */
  --f-display: 'Inter Tight', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --f-body:    'Inter', ui-sans-serif, system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radius / shadow */
  --r-sm: 6px;
  --r:    8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow-sm: 0 1px 0 rgba(20,20,18,.04);
  --shadow:    0 1px 2px rgba(20,20,18,.04), 0 4px 16px rgba(20,20,18,.04);

  /* Density (overridden via Tweaks) */
  --d-row:  36px;
  --d-pad:  14px;
  --d-gap:  14px;
}

[data-density="compact"] {
  --d-row:  30px;
  --d-pad:  10px;
  --d-gap:  10px;
}
[data-density="comfy"] {
  --d-row:  44px;
  --d-pad:  18px;
  --d-gap:  20px;
}

/* ──────────────── Dark theme ──────────────── */
html[data-theme="dark"] {
  --bg:        #0E0E0C;
  --bg-2:      #1A1916;
  --surface:   #141311;
  --line:      rgba(255, 255, 248, 0.08);
  --line-2:    rgba(255, 255, 248, 0.05);
  --line-strong: rgba(255, 255, 248, 0.16);

  --ink:       #F5F4EE;
  --ink-2:     #C9C5BB;
  --muted:     #8A877E;
  --muted-2:   #65625B;
  --faint:     #3A382F;

  /* Accents — leggermente più luminosi su dark per mantenere contrasto */
  --c-ios:      oklch(0.72 0.06 250);
  --c-android:  oklch(0.74 0.16 150);
  --c-gympass:  oklch(0.76 0.16 60);
  --c-7card:    oklch(0.70 0.18 25);

  --c-ios-bg:      oklch(0.72 0.06 250 / 0.16);
  --c-android-bg:  oklch(0.74 0.16 150 / 0.16);
  --c-gympass-bg:  oklch(0.76 0.16 60 / 0.16);
  --c-7card-bg:    oklch(0.70 0.18 25 / 0.16);

  --st-active:   oklch(0.74 0.14 150);
  --st-trial:    oklch(0.78 0.14 75);
  --st-expired:  oklch(0.70 0.16 25);
  --st-active-bg:  oklch(0.74 0.14 150 / 0.16);
  --st-trial-bg:   oklch(0.78 0.14 75 / 0.18);
  --st-expired-bg: oklch(0.70 0.16 25 / 0.16);

  --shadow-sm: 0 1px 0 rgba(0,0,0,.3);
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}
[data-theme="dark"] .topbar {
  background: rgba(14, 14, 12, 0.78);
}
[data-theme="dark"] .avatar {
  background: linear-gradient(135deg, #3a3830, #25241f);
  color: var(--ink-2);
}
[data-theme="dark"] .chip.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
[data-theme="dark"] .pager button.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Palette tweak: monochrome */
[data-palette="mono"] {
  --c-ios:     #15140F;
  --c-android: #5B5A53;
  --c-gympass: #8C8980;
  --c-7card:   #B8B4AA;
  --c-ios-bg:     rgba(21,20,15,.06);
  --c-android-bg: rgba(91,90,83,.10);
  --c-gympass-bg: rgba(140,137,128,.14);
  --c-7card-bg:   rgba(184,180,170,.18);
}

/* Palette tweak: saturated (close to original) */
[data-palette="saturated"] {
  --c-ios:     #2C2C2E;
  --c-android: #34C759;
  --c-gympass: #FF9F0A;
  --c-7card:   #FF453A;
  --c-ios-bg:     rgba(44,44,46,.08);
  --c-android-bg: rgba(52,199,89,.12);
  --c-gympass-bg: rgba(255,159,10,.12);
  --c-7card-bg:   rgba(255,69,58,.10);
}

/* ──────────────── Reset / base ──────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: inherit; text-decoration: none; }
.link { color: var(--c-ios); text-decoration: none; }
.link:hover { text-decoration: underline; }
button { font: inherit; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.mono { font-family: var(--f-mono); }

/* ──────────────── App shell ──────────────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.86);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 0.5px solid var(--line);
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 0.5px var(--line-strong), 0 1px 3px rgba(20,20,18,.10);
}
.topbar-inner { height: 60px; }
.nav {
  display: flex;
  gap: 2px;
  margin-left: 12px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-item {
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { color: var(--ink); background: var(--line-2); }
.nav-item.active { color: var(--ink); background: var(--line-2); }

.topbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.live-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--st-active);
  box-shadow: 0 0 0 3px var(--st-active-bg);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4d2c8, #a8a59b);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
}
.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0.5px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.theme-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ──────────────── Main ──────────────── */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex: 1;
}

@media (max-width: 768px) {
  .main { padding: 16px; }
  .topbar-inner { padding: 0 16px; }
}

/* ──────────────── Section header ──────────────── */
.section-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid var(--line);
}
.section-h h1 {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-h .meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ──────────────── KPI hero ──────────────── */
.kpi-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 0;
  margin-bottom: 28px;
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.kpi {
  padding: 20px 22px;
  border-right: 0.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-value {
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi-hero .kpi:first-child .kpi-value {
  font-size: 40px;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.delta.up   { color: var(--st-active);  background: var(--st-active-bg); }
.delta.down { color: var(--st-expired); background: var(--st-expired-bg); }
.delta.flat { color: var(--muted);      background: var(--line-2); }

.spark {
  position: absolute;
  right: 18px;
  top: 18px;
  opacity: 0.85;
}

/* KPI variant: stacked (decide for me default) */
[data-kpi-layout="stacked"] .kpi-hero {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}
[data-kpi-layout="stacked"] .kpi-hero .kpi:first-child .kpi-value {
  font-size: 30px;
}
[data-kpi-layout="hero"] .kpi-hero {
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
}

@media (max-width: 900px) {
  .kpi-hero { grid-template-columns: 1fr 1fr !important; }
  .kpi { border-bottom: 0.5px solid var(--line); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(3), .kpi:nth-child(4) { border-bottom: 0; }
  .kpi-hero .kpi:first-child .kpi-value { font-size: 30px !important; }
}
@media (max-width: 540px) {
  .kpi-hero { grid-template-columns: 1fr !important; }
  .kpi { border-right: 0 !important; }
  .kpi:last-child { border-bottom: 0; }
}

/* ──────────────── Platform cards ──────────────── */
.platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--d-gap);
  margin-bottom: 28px;
}
@media (max-width: 1100px) { .platforms { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .platforms { grid-template-columns: 1fr; } }

.pcard {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--d-pad) calc(var(--d-pad) + 2px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.pcard::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent, var(--ink));
}
.pcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pcard-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.pcard-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, var(--ink));
}
.pcard-time {
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  font-family: var(--f-mono);
}
.pcard-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.pcard-hero .v {
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pcard-hero .l {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.pcard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 0.5px solid var(--line);
  margin-top: 2px;
}
.pmetric {
  background: var(--surface);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pmetric .l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.pmetric .v {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.pmetric .v small {
  color: var(--muted);
  font-weight: 400;
  font-size: 10.5px;
  margin-left: 4px;
}

/* ──────────────── Quick actions ──────────────── */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--d-gap);
}
@media (max-width: 900px) { .qa-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .qa-grid { grid-template-columns: 1fr; } }
.qa {
  background: var(--surface);
  border: 0.5px solid var(--line);  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s, transform 0.12s;
}
.qa:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.qa-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  color: var(--ink-2);
  flex-shrink: 0;
}
.qa-text { display: flex; flex-direction: column; min-width: 0; }
.qa-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.qa-sub {
  font-size: 11px;
  color: var(--muted);
}
.qa-platforms {
  margin-left: auto;
  display: flex;
  gap: 3px;
}
.variant-card {
  flex: 1;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.variant-card:hover { border-color: var(--line-strong); }
.variant-card.active {
  border-color: var(--c-ios);
  background: color-mix(in oklab, var(--c-ios) 6%, var(--surface));
}
.variant-id {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.variant-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.variant-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

/* ──────────────── A/B Test cards (v2) ──────────────── */
.ab-card2 {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ab-card2.open {
  border-color: var(--line-strong);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Header row */
.ab-card2-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2.2fr) auto;
  gap: 24px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.ab-card2-head:hover { background: color-mix(in oklab, var(--bg-2) 30%, var(--surface)); }

/* Identity column */
.ab-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ab-id-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ab-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.ab-status-dot.running { background: var(--st-active); box-shadow: 0 0 0 3px color-mix(in oklab, var(--st-active) 20%, transparent); }
.ab-status-dot.completed { background: var(--muted-2); }
.ab-name {
  font: 600 15px var(--f-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.ab-cat {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-2);
  padding: 2px 7px;
  border-radius: 4px;
}
.ab-id-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ab-id-meta .dot-sep { color: var(--muted-2); }

/* KPI inline strip */
.ab-kpis2 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-left: 24px;
  border-left: 0.5px solid var(--line);
}
.ab-kpi2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ab-kpi2-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.ab-kpi2-main { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ab-kpi2-value {
  font: 600 16px var(--f-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ab-kpi2-sub {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Verdict */
.ab-verdict {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ab-verdict-pill {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 12px;
  border-radius: 6px;
  background: color-mix(in oklab, var(--vc) 8%, var(--surface));
  border: 0.5px solid color-mix(in oklab, var(--vc) 35%, var(--line));
  text-align: right;
  min-width: 92px;
}
.ab-verdict-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ab-verdict-value {
  font: 600 17px var(--f-display);
  letter-spacing: -0.01em;
  color: var(--vc);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ab-verdict-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--vc);
}
.ab-chevron {
  color: var(--muted);
  display: flex;
}

/* DETAIL panel */
.ab-detail2 {
  border-top: 0.5px solid var(--line);
  background: color-mix(in oklab, var(--bg) 60%, var(--surface));
  padding: 16px 18px;
}
.ab-detail2-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 0.5px solid var(--line);
  padding-bottom: 0;
}
.ab-detail2-tab {
  background: none;
  border: none;
  font: 600 12px var(--f);
  color: var(--muted);
  padding: 8px 14px;
  cursor: pointer;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  transition: color 0.12s, border-color 0.12s;
}
.ab-detail2-tab:hover { color: var(--ink-2); }
.ab-detail2-tab.active {
  color: var(--ink);
  border-bottom-color: var(--c-ios);
}

/* Comparison table */
.ab-compare {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.ab-compare-head, .ab-compare-row {
  display: grid;
  grid-template-columns: 180px 1fr 1fr 100px;
  gap: 0;
  border-bottom: 0.5px solid var(--line);
}
.ab-compare-row:last-child { border-bottom: none; }
.ab-compare-head {
  background: color-mix(in oklab, var(--bg-2) 60%, var(--surface));
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.ab-compare-row.highlight { background: color-mix(in oklab, var(--c-ios) 4%, var(--surface)); }
.ab-compare-cell {
  padding: 10px 14px;
  border-right: 0.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.ab-compare-cell:last-child { border-right: none; }
.ab-compare-cell.metric {
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  background: color-mix(in oklab, var(--bg-2) 30%, var(--surface));
}
.ab-compare-head .ab-compare-cell { padding-top: 12px; padding-bottom: 12px; }
.ab-compare-cell.variant.winner {
  background: color-mix(in oklab, var(--st-active) 5%, var(--surface));
  border-right: 0.5px solid color-mix(in oklab, var(--st-active) 30%, var(--line));
}
.ab-compare-vname {
  font: 600 12.5px var(--f-display);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  text-transform: none;
  letter-spacing: 0;
}
.ab-compare-vperiod {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.ab-compare-big {
  font: 600 16px var(--f-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ab-compare-val {
  font: 500 13px var(--f);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ab-compare-sub {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ab-compare-cell.delta {
  align-items: flex-end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: color-mix(in oklab, var(--bg-2) 30%, var(--surface));
}

.ab-winner-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--st-active);
  background: color-mix(in oklab, var(--st-active) 14%, transparent);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Significance footer */
.ab-sig-foot {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 14px;
  margin-top: 14px;
}
.ab-sig-block {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ab-sig-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.ab-sig-bar {
  height: 4px;
  background: var(--line-2);
  border-radius: 100px;
  overflow: hidden;
}
.ab-sig-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.3s;
}
.ab-sig-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
}
.ab-reco {
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 6px 10px;
  border-left: 2px solid var(--muted-2);
  line-height: 1.45;
}
.ab-reco b { color: var(--ink); }

@media (max-width: 1100px) {
  .ab-card2-head {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ab-kpis2 {
    padding-left: 0;
    border-left: none;
    border-top: 0.5px solid var(--line);
    padding-top: 12px;
    grid-template-columns: repeat(4, 1fr);
  }
  .ab-verdict { justify-content: space-between; border-top: 0.5px solid var(--line); padding-top: 10px; }
}
@media (max-width: 700px) {
  .ab-kpis2 { grid-template-columns: repeat(2, 1fr); }
  .ab-compare-head, .ab-compare-row { grid-template-columns: 100px 1fr 1fr 70px; }
  .ab-sig-foot { grid-template-columns: 1fr; }
}



.qa-pdot {
  width: 5px;
  height: 5px;  border-radius: 50%;
}

/* ──────────────── Subscriptions ──────────────── */
.tabs-segmented {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: var(--r);
  padding: 3px;
  border: 0.5px solid var(--line);
}
.seg {
  padding: 5px 14px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.seg.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--line);
}
.seg-dot {
  width: 6px; height: 6px; border-radius: 50%;
}

.sub-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.sub-stat {
  border: 0.5px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--surface);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.sub-stat .v {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.sub-stat .l {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chip {
  padding: 4px 10px;
  border: 0.5px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.chip .count {
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
  font-size: 10.5px;
}
.chip.active .count { opacity: 0.7; }

.search {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
  position: relative;
}
.search input {
  width: 100%;
  height: 28px;
  border: 0.5px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 0 10px 0 28px;
  font: inherit;
  font-size: 12px;
  outline: none;
  color: var(--ink);
}
.search input:focus { border-color: var(--line-strong); }
.search svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.tbl-wrap {
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.tbl thead th {
  text-align: left;
  font-weight: 500;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--line);
  background: var(--bg-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.tbl tbody td {
  padding: 0 14px;
  height: var(--d-row);
  border-bottom: 0.5px solid var(--line-2);
  white-space: nowrap;
  color: var(--ink-2);
}
.tbl tbody tr:hover td { background: var(--bg-2); }
.tbl tbody tr.selected td { background: var(--c-ios-bg); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }

.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 16px;
  border-radius: 3px;
  background: var(--bg-2);
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  border: 0.5px solid var(--line);
  font-family: var(--f-mono);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 7px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status.active  { color: var(--st-active);  background: var(--st-active-bg); }
.status.trial   { color: var(--st-trial);   background: var(--st-trial-bg); }
.status.expired { color: var(--st-expired); background: var(--st-expired-bg); }

.pkg {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-2);
}

.checkmark {
  color: var(--st-active);
  font-weight: 600;
}

.tbl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 0.5px solid var(--line);
  background: var(--bg-2);
  font-size: 12px;
  color: var(--muted);
}
.pager { display: flex; gap: 2px; align-items: center; }
.pager button {
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border: 0.5px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.pager button:hover { border-color: var(--line-strong); }
.pager button.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ──────────────── Income / Analytics ──────────────── */
.chart-card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px 14px;
  margin-bottom: var(--d-gap);
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.chart-title {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chart-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}
.lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.lg-item.off { opacity: 0.4; }
.lg-item .d {
  width: 8px; height: 8px; border-radius: 2px;
}

.donut-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--d-gap);
  margin-bottom: var(--d-gap);
}
@media (max-width: 720px) { .donut-row { grid-template-columns: 1fr; } }

.donut-card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}
.donut-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.donut-li {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--line-2);
  font-size: 12px;
}
.donut-li:last-child { border-bottom: 0; }
.donut-li .d { width: 8px; height: 8px; border-radius: 2px; }
.donut-li .name { color: var(--ink-2); }
.donut-li .pct { font-variant-numeric: tabular-nums; font-weight: 600; }
.donut-li .v { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }

.year-row {
  display: grid;
  grid-template-columns: 60px 1fr 88px 60px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--line-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.year-row:last-child { border-bottom: 0; }
.year-row .yr { font-weight: 600; }
.year-row .bar {
  height: 6px;
  background: var(--bg-2);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}
.year-row .bar > span {
  display: block;
  height: 100%;
  background: var(--c-ios);
  border-radius: 100px;
}
.year-row .bar > span.forecast {
  background: var(--c-ios);
  opacity: 0.4;
}
.year-row .gr { text-align: right; }
.year-row .gr.up   { color: var(--st-active); }
.year-row .gr.down { color: var(--st-expired); }
.year-row .gr.flat { color: var(--muted); }

/* ──────────────── Footer ──────────────── */
.footer {
  border-top: 0.5px solid var(--line);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  max-width: 1440px;
  margin: 24px auto 0;
}

/* ──────────────── Mobile nav ──────────────── */
@media (max-width: 640px) {
  .topbar-end .live-dot { display: none; }
  .nav-item { font-size: 12.5px; padding: 6px 10px; }
  .section-h h1 { font-size: 19px; }
}


/* ──────────────── Conversations ──────────────── */

/* Status colors mapped to existing system + extras */
.cv-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cv-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.cv-status.received   { color: var(--muted-2);   background: color-mix(in oklab, var(--muted-2) 12%, transparent); }
.cv-status.review     { color: var(--st-trial);  background: var(--st-trial-bg); }
.cv-status.planned    { color: var(--c-ios);     background: var(--c-ios-bg); }
.cv-status.rejected   { color: var(--st-expired);background: var(--st-expired-bg); }
.cv-status.completed  { color: var(--st-active); background: var(--st-active-bg); }

.cv-status.dot-only {
  width: 8px; height: 8px;
  padding: 0;
  border-radius: 50%;
  background: currentColor !important;
}
.cv-status.dot-only::before { display: none; }

/* Inbox toolbar — status counter chips */
.cv-stat-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.cv-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 0.5px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
  font-variant-numeric: tabular-nums;
}
.cv-stat-chip:hover { color: var(--ink-2); border-color: var(--line-strong); }
.cv-stat-chip.active {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--surface);
}
.cv-stat-chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cv-stat-chip-count {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cv-stat-chip:not(.active) .cv-stat-chip-count { color: var(--ink-2); }

/* Conversation table */
.cv-tbl tbody tr {
  cursor: pointer;
}
.cv-tbl tbody tr:hover .cv-row-actions { opacity: 1; }
.cv-tbl .cv-cell-date {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.cv-tbl .cv-cell-date b {
  color: var(--ink-2);
  font-weight: 500;
  display: block;
}
.cv-tbl .cv-cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cv-tbl .cv-cell-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-2), var(--surface));
  border: 0.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
  font-family: var(--f-display);
}
.cv-tbl .cv-cell-user-name {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.cv-tbl .cv-cell-subj {
  color: var(--ink);
  font-weight: 500;
}
.cv-tbl .cv-cell-subj .cv-cell-subj-preview {
  color: var(--muted);
  font-weight: 400;
  font-size: 11.5px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 460px;
}
.cv-tbl tr.unread .cv-cell-subj,
.cv-tbl tr.unread .cv-cell-user-name {
  font-weight: 600;
}
.cv-tbl .cv-unread-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-ios);
  flex-shrink: 0;
}
.cv-tbl .cv-cell-meta {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.cv-tbl .cv-flag-cell { width: 26px; padding-right: 0; }
.cv-tbl .cv-flag-cell svg { display: block; color: var(--muted-2); }
.cv-tbl .cv-flag-cell.has-flag svg { color: var(--st-trial); }

.cv-row-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.cv-row-actions button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cv-row-actions button:hover { background: var(--bg-2); color: var(--ink-2); }

/* Group header rows when grouping enabled */
.cv-tbl .cv-group-row td {
  background: color-mix(in oklab, var(--bg-2) 60%, var(--surface));
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  height: 30px;
  padding: 0 14px;
  border-bottom: 0.5px solid var(--line);
}
.cv-tbl .cv-group-row td .cv-group-count {
  color: var(--ink-2);
  margin-left: 8px;
}

/* ──────────────── Conversation Detail (chat-style) ──────────────── */
.cv-detail {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cv-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--line);
}
.cv-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border: 0.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.cv-back-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.cv-detail-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cv-detail-title h2 {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cv-detail-title-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.cv-detail-title-meta .dot-sep { color: var(--muted-2); }
.cv-detail-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.cv-detail-actions select {
  height: 28px;
  border: 0.5px solid var(--line);
  border-radius: 6px;
  padding: 0 22px 0 10px;
  font: 500 12px var(--f);
  color: var(--ink);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%2374716A' stroke-width='1.5'><path d='M2 4l3 3 3-3'/></svg>") no-repeat right 7px center;
  appearance: none;
  cursor: pointer;
}
.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  border: 0.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font: 500 12px var(--f);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, color .12s, background .12s;
}
.cv-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.cv-btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.cv-btn.primary:hover { opacity: 0.9; }
.cv-btn.subtle {
  border-color: transparent;
  color: var(--muted);
}
.cv-btn.subtle:hover { color: var(--ink-2); background: var(--bg-2); border-color: var(--line); }

/* User strip — license/device/etc */
.cv-userstrip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-bottom: 0.5px solid var(--line);
  background: color-mix(in oklab, var(--bg-2) 30%, var(--surface));
}
.cv-userstrip-cell {
  padding: 10px 14px;
  border-right: 0.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cv-userstrip-cell:last-child { border-right: none; }
.cv-userstrip-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cv-userstrip-value {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-userstrip-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.cv-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink-2);
  border: 0.5px solid var(--line);
}
.cv-tag-add {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
  cursor: pointer;
}
.cv-tag-add:hover { color: var(--ink-2); }

/* Chat thread */
.cv-thread {
  padding: 24px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
  flex: 1;
  min-height: 280px;
}
.cv-msg-day {
  align-self: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--surface);
  border: 0.5px solid var(--line);
  padding: 3px 10px;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
}
.cv-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 78%;
}
.cv-msg.from-staff {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cv-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-2), var(--surface));
  border: 0.5px solid var(--line);
  font: 600 10px var(--f-display);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cv-msg.from-staff .cv-msg-avatar {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.cv-msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cv-msg-meta {
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.cv-msg.from-staff .cv-msg-meta { justify-content: flex-end; }
.cv-msg-meta b { color: var(--ink-2); font-weight: 500; }
.cv-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  border: 0.5px solid var(--line);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.cv-msg.from-user .cv-msg-bubble {
  border-bottom-left-radius: 4px;
}
.cv-msg.from-staff .cv-msg-bubble {
  background: var(--c-ios-bg);
  border-color: color-mix(in oklab, var(--c-ios) 25%, var(--line));
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
.cv-msg-read-receipt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--st-active);
}

/* Composer */
.cv-composer {
  border-top: 0.5px solid var(--line);
  background: var(--surface);
}
.cv-composer-tabs {
  display: flex;
  gap: 0;
  padding: 0 18px;
  border-bottom: 0.5px solid var(--line-2);
}
.cv-composer-tab {
  padding: 10px 14px 9px;
  font: 500 12px var(--f);
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  letter-spacing: 0.02em;
  transition: color .12s, border-color .12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cv-composer-tab:hover { color: var(--ink-2); }
.cv-composer-tab.active {
  color: var(--ink);
  border-bottom-color: var(--c-ios);
}
.cv-composer-tab-flag {
  font-size: 11px;
}
.cv-composer-templates {
  display: flex;
  gap: 6px;
  padding: 12px 18px 0;
  flex-wrap: wrap;
}
.cv-template-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 0.5px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  font: 500 11.5px var(--f);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.cv-template-btn:hover {
  color: var(--ink);
  border-color: var(--c-android);
  background: color-mix(in oklab, var(--c-android) 6%, var(--surface));
}
.cv-template-btn-icon {
  width: 12px; height: 12px;
  color: var(--c-android);
}
.cv-composer-body {
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cv-composer-textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: 400 13px var(--f);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .12s;
  font-family: var(--f);
}
.cv-composer-textarea:focus { border-color: var(--line-strong); background: var(--surface); }
.cv-composer-textarea::placeholder { color: var(--muted-2); }
.cv-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cv-composer-hints {
  font-size: 11px;
  color: var(--muted);
}
.cv-composer-hints kbd {
  font-family: var(--f-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-2);
  border: 0.5px solid var(--line);
  border-radius: 3px;
  color: var(--ink-2);
}

@media (max-width: 1100px) {
  .cv-userstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cv-userstrip-cell:nth-child(3) { border-right: none; }
}
@media (max-width: 700px) {
  .cv-userstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv-msg { max-width: 92%; }
}

/* ──────────────── Host adapters (additions for the .NET shell) ──────────────── */

/* Make the topbar brand a clickable anchor without underline */
.topbar a.brand,
.topbar a.brand:hover { text-decoration: none; color: inherit; }
.nav a.nav-item,
.nav a.nav-item:hover { text-decoration: none; }

/* Mobile nav: hamburger button collapses the 3 links */
.nav-toggle {
  display: none;
  width: 32px; height: 32px;
  border: 0.5px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.nav-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 0.5px solid var(--line);
    flex-direction: column;
    padding: 6px 16px 12px;
    gap: 0;
    display: none;
    overflow-x: visible;
  }
  .nav.open { display: flex; }
  .nav-item { padding: 10px 8px; border-radius: 6px; }
  .topbar { position: relative; }
}

/* Back-to-dashboard strip — sits between topbar and main */
.back-strip {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 24px 0;
  width: 100%;
}
@media (max-width: 768px) {
  .back-strip { padding: 12px 16px 0; }
}

/* Avatar account menu (replaces Bootstrap navbar-right dropdown) */
.user-menu {
  position: relative;
  list-style: none;
}
.user-menu summary {
  list-style: none;
  cursor: pointer;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::marker { display: none; }
.user-menu .avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}
.user-menu-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
}
.user-menu-name {
  padding: 6px 8px 8px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 0.5px solid var(--line-2);
  margin-bottom: 4px;
}
.user-menu-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.user-menu-link:hover { background: var(--bg-2); color: var(--ink); }

/* Sortable column headers (set via data-sort) */
.tbl thead th[data-sort] { cursor: pointer; user-select: none; }
.tbl thead th[data-sort]:hover { color: var(--ink-2); }
.tbl thead th[data-sort].sort-asc::after  { content: ' ▲'; font-size: 9px; color: var(--ink-2); }
.tbl thead th[data-sort].sort-desc::after { content: ' ▼'; font-size: 9px; color: var(--ink-2); }

/* Section sub-heading (re-used by Dashboard quick-actions) */
.section-eyebrow {
  font: 600 12px var(--f-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 28px 0 12px;
}
.section-eyebrow:first-child { margin-top: 8px; }

/* Quick-action: anchor variant */
.qa { color: inherit; text-decoration: none; }
.qa:hover { text-decoration: none; }

/* Cosmetic: focus visible on all interactive */
:focus-visible { outline: 2px solid var(--c-ios); outline-offset: 2px; border-radius: 4px; }

/* OS badge */
.os-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
  flex-shrink: 0;
}
.os-badge.os-ios     { background: var(--c-ios); }
.os-badge.os-android { background: var(--c-android); }
.os-badge.os-gympass { background: var(--c-gympass); }
.os-badge.os-7card   { background: var(--c-7card); }

/* Pagination — anchor variant matching .pager */
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border: 0.5px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pager-btn:hover { border-color: var(--line-strong); text-decoration: none; }
.pager-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.pager-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pager-ellipsis {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

/* Interactive line chart — overlay, cursor, tooltip */
.chart-host { position: relative; }
.chart-host path[data-series].off { display: none; }
.chart-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.chart-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed var(--ink);
  opacity: 0;
  transition: opacity .12s;
}
.chart-cursor.on { opacity: 0.4; }
.chart-point {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--surface);
  box-sizing: border-box;
  border: 1.5px solid var(--ink);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.chart-tooltip {
  position: absolute;
  background: var(--surface);
  border: 0.5px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 8px 10px 6px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  min-width: 150px;
  max-width: 240px;
  z-index: 5;
  pointer-events: none;
}
.chart-tooltip[hidden] { display: none !important; }
.chart-tooltip-date {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.chart-tooltip-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 1px 0;
  line-height: 1.5;
}
.chart-tooltip-row .d {
  width: 7px; height: 7px;
  border-radius: 2px;
}
.chart-tooltip-row .n {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-tooltip-row .v {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

/* Bar chart interactivity */
.ybar { transition: fill-opacity .12s, opacity .12s; cursor: pointer; }
.ybar-effective:hover { fill-opacity: 0.85; }
.ybar-forecast:hover { fill-opacity: 0.55; }

/* Drag-to-zoom on line charts */
.chart-host[data-can-zoom] svg { cursor: crosshair; user-select: none; }
.chart-zoom-rect {
  position: absolute;
  top: 0; bottom: 0;
  background: color-mix(in oklab, var(--c-ios) 14%, transparent);
  border-left: 1px dashed var(--c-ios);
  border-right: 1px dashed var(--c-ios);
  pointer-events: none;
}
.chart-zoom-rect[hidden] { display: none; }
.chart-reset-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 0.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font: 500 11.5px var(--f-body);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .12s, color .12s;
  box-shadow: var(--shadow-sm);
  z-index: 6;
}
.chart-reset-btn:hover { color: var(--ink); border-color: var(--ink); }
.chart-reset-btn[hidden] { display: none; }

/* A/B Test card — <details> integration */
details.ab-card2 > summary { list-style: none; cursor: pointer; }
details.ab-card2 > summary::-webkit-details-marker { display: none; }
details.ab-card2[open] { border-color: var(--line-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
details.ab-card2[open] .ab-chevron svg { transform: rotate(180deg); transition: transform 0.12s; }
.ab-chevron svg { transition: transform 0.12s; }

/* A/B summary metrics grid */
.ab-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px 0;
}
.ab-summary-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 0.5px solid var(--line-2);
  flex-wrap: wrap;
}
.ab-summary-row:nth-last-child(-n+2) { border-bottom: 0; }
.ab-summary-row:nth-child(odd) { border-right: 0.5px solid var(--line-2); }
.ab-summary-lbl {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 100px;
}
.ab-summary-val {
  font: 600 16px var(--f-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ab-summary-base {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
@media (max-width: 700px) {
  .ab-summary-grid { grid-template-columns: 1fr; }
  .ab-summary-row { border-right: 0 !important; }
}

/* Inline detail expander on summary cards */
details.ab-details-inline { border-top: 0.5px solid var(--line); }
details.ab-details-inline > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 500 12px var(--f-body);
  color: var(--ink-2);
  background: color-mix(in oklab, var(--bg-2) 30%, var(--surface));
  transition: background .12s, color .12s;
}
details.ab-details-inline > summary:hover { color: var(--ink); background: var(--bg-2); }
details.ab-details-inline > summary::-webkit-details-marker { display: none; }
details.ab-details-inline[open] > summary .ab-chevron { transform: rotate(180deg); }
details.ab-details-inline .ab-chevron { transition: transform .12s; }
@media (max-width: 700px) {
  details.ab-details-inline > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}
