/* ==========================================================================
   Affitaskdesk — Affiliate & Performance Platform
   Design system v2. Light, dense, operations-grade. No external dependencies:
   the strict Content-Security-Policy blocks remote stylesheets and fonts, so
   every asset (fonts, icons) is self-hosted under /assets/.
   ========================================================================== */

@font-face{
  font-family:Inter; font-style:normal; font-weight:100 900; font-display:swap;
  src:url(/assets/fonts/InterVariable.woff2) format('woff2-variations'), url(/assets/fonts/InterVariable.woff2) format('woff2');
}
@font-face{
  font-family:Inter; font-style:italic; font-weight:100 900; font-display:swap;
  src:url(/assets/fonts/InterVariable-Italic.woff2) format('woff2-variations'), url(/assets/fonts/InterVariable-Italic.woff2) format('woff2');
}
@font-face{
  font-family:'JetBrains Mono'; font-style:normal; font-weight:100 800; font-display:swap;
  src:url(/assets/fonts/JetBrainsMono-Variable.ttf) format('truetype-variations'), url(/assets/fonts/JetBrainsMono-Variable.ttf) format('truetype');
}

:root {
  /* ---------------------------------------------------------- neutrals -- */
  --n-0:   #ffffff; --n-25:  #fcfdfe; --n-50:  #f7f9fb; --n-100: #eff2f6;
  --n-150: #e5e9ef; --n-200: #d8dee7; --n-300: #c0c9d6; --n-400: #97a3b6;
  --n-500: #6d7a8f; --n-600: #52607a; --n-700: #3b4859; --n-800: #26303d;
  --n-900: #161c26; --n-950: #0d1219;

  /* ------------------------------------------------------------ brand --- */
  --b-25:  #f4f7ff; --b-50:  #e9efff; --b-100: #d5e0fe; --b-200: #b0c5fc;
  --b-300: #7f9ef7; --b-400: #4e74ee; --b-500: #2b51de; --b-600: #2142b8;
  --b-700: #1b3592; --b-800: #182c73;

  /* --------------------------------------------------------- semantic --- */
  --success-50:#e9f7ef; --success-100:#cfeedd; --success-200:#a6dfc1; --success-500:#12854e; --success-600:#0e6b3f; --success-700:#0b5432;
  --warning-50:#fef6e7; --warning-100:#fbe9c4; --warning-200:#f5d592; --warning-500:#a9660a; --warning-600:#8a5208; --warning-700:#6e4106;
  --danger-50: #fdecee; --danger-100:#fad5d9; --danger-200:#f3aeb6; --danger-500:#c0263a; --danger-600:#9e1e2f; --danger-700:#7e1826;
  --info-50:   #e8f5fa; --info-100:  #cce9f3; --info-200:  #9ad3e7; --info-500:  #0c6e8f; --info-600:  #095670; --info-700:  #074457;

  /* Chart series — fixed assignment order, never cycle/reorder */
  --c-1:#2b51de; --c-2:#be7208; --c-3:#8b3fd1; --c-4:#0f8a52; --c-5:#0e93b8; --c-6:#c42a63;
  /* Financial semantic mapping (overrides slot order for this fixed trio) */
  --c-revenue: var(--c-1);
  --c-payout:  var(--c-2);
  --c-profit:  var(--c-4);
  --c-ftd:     var(--c-3);

  /* ------------------------------------------------------- role tokens -- */
  --surface-page:     var(--n-100);
  --surface-raised:   var(--n-0);
  --surface-sunken:   var(--n-50);
  --surface-hover:    var(--n-50);
  --surface-active:   var(--n-100);
  --surface-selected: var(--b-50);
  --surface-overlay:  var(--n-0);
  --surface-scrim:    rgba(13,18,25,.44);

  --border-subtle:  var(--n-150);
  --border-default: var(--n-200);
  --border-strong:  var(--n-300);
  --border-focus:   var(--b-500);

  --text-primary:   var(--n-900);
  --text-secondary: var(--n-600);
  --text-tertiary:  var(--n-500);
  --text-disabled:  var(--n-400);
  --text-inverse:   var(--n-0);
  --text-link:      var(--b-600);
  --text-brand:     var(--b-600);

  /* Back-compat aliases so every existing view keeps working unmodified */
  --bg: var(--surface-page); --panel: var(--surface-raised); --panel-soft: var(--surface-sunken);
  --panel-sunken: var(--surface-sunken); --line: var(--border-default); --line-soft: var(--border-subtle);
  --text: var(--text-primary); --text-soft: var(--text-secondary); --muted: var(--text-tertiary); --faint: var(--text-disabled);
  --brand: var(--b-500); --brand-hover: var(--b-600); --brand-soft: var(--surface-selected); --brand-line: var(--b-200);
  --good: var(--success-600); --good-soft: var(--success-50); --good-line: var(--success-200);
  --warn: var(--warning-600); --warn-soft: var(--warning-50); --warn-line: var(--warning-200);
  --bad: var(--danger-600); --bad-soft: var(--danger-50); --bad-line: var(--danger-200);
  --info: var(--info-600); --info-soft: var(--info-50);

  /* --------------------------------------------------------- typography -- */
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ------------------------------------------------------------ spacing -- */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px;
  --sp-8:32px; --sp-10:40px; --sp-12:48px; --sp-16:64px; --sp-20:80px; --sp-24:96px;

  /* -------------------------------------------------------------- shape -- */
  --r-xs:4px; --r-sm:6px; --r-md:10px; --r-lg:14px; --r-full:999px;
  --radius: var(--r-md); --radius-sm: var(--r-sm); /* back-compat */

  /* --------------------------------------------------------- elevation -- */
  --e-1: 0 1px 2px rgba(16,24,40,.05);
  --e-2: 0 4px 8px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.05);
  --e-3: 0 12px 24px -6px rgba(16,24,40,.12), 0 4px 8px -4px rgba(16,24,40,.06);
  --e-4: 0 24px 48px -12px rgba(16,24,40,.18);
  --shadow-sm: none; --shadow: var(--e-1); --shadow-lg: var(--e-4); /* back-compat: resting cards use border, not shadow */

  /* ----------------------------------------------------------- motion --- */
  --dur-1:120ms; --dur-2:180ms; --dur-3:240ms;
  --ease-out: cubic-bezier(.2,0,0,1);

  --rail-w: 260px; --sidebar-w: var(--rail-w); /* back-compat */
  --topbar-h: 56px;
  --content-max: 1440px;
}

* { box-sizing: border-box; }
html { background: var(--surface-page); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font: 400 14px/20px var(--font-sans);
  font-feature-settings: "cv05" 1, "cv08" 1, "ss03" 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Focus — :focus-visible only, never :focus, never outline:none with no replacement */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--r-sm);
}
.btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--surface-raised), 0 0 0 4px var(--b-500);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--b-500); box-shadow: 0 0 0 3px rgba(43,81,222,.14);
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------- icons ---- */
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; color: currentColor; }
.icon-sm { width: 16px; height: 16px; vertical-align: -3px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- shell -- */

.app { min-height: 100vh; display: grid; grid-template-columns: var(--rail-w) 1fr; background: var(--surface-page); }

.sidebar {
  background: var(--surface-raised);
  border-right: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0; /* the actual fix: without this a flex child with content
                    taller than its box refuses to shrink, so its own
                    overflow-y never gets a chance to engage and the rail
                    appears to run out mid-page on long views */
}

.brand {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-default);
}
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  border-radius: var(--r-sm);
  background: var(--b-500);
  color: #fff; font-size: 14px; font-weight: 700;
}
.brand-copy { line-height: 1.15; min-width: 0; }
.brand-copy strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; color: var(--text-primary); }
.brand-copy small {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary);
}

.nav { padding: var(--sp-2); flex: 1 1 auto; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.nav-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-tertiary); margin: var(--sp-5) var(--sp-3) var(--sp-1);
}
.nav a {
  display: flex; gap: var(--sp-2); align-items: center;
  padding: 0 var(--sp-3); height: 34px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  position: relative;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.nav a:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav a.active {
  background: var(--surface-selected); color: var(--b-700); font-weight: 600;
}
.nav a.active::before {
  content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
  background: var(--b-500); border-radius: 0 2px 2px 0;
}
.nav-icon { width: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-tertiary); }
.nav a:hover .nav-icon { color: var(--text-secondary); }
.nav a.active .nav-icon { color: var(--b-600); }
.nav-count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--danger-50); color: var(--danger-600);
  border-radius: var(--r-full); padding: 1px 6px; min-width: 18px; text-align: center; line-height: 16px;
}

/* Collapsible nav group */
.nav-group > summary {
  display: flex; gap: var(--sp-2); align-items: center;
  padding: 0 var(--sp-3); height: 34px; margin: 1px 0; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; list-style: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-group[open] > summary { color: var(--text-primary); font-weight: 600; }
.nav-group .chev { margin-left: auto; color: var(--text-tertiary); transition: transform var(--dur-2) var(--ease-out); display: inline-flex; }
.nav-group[open] .chev { transform: rotate(90deg); }
.nav-group .nav-sub { padding-left: 20px; }
.nav-group .nav-sub a { padding-left: var(--sp-2); font-size: 13px; }

.sidebar-user {
  flex: none;
  margin: var(--sp-2); padding: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: var(--sp-2);
}
.sidebar-user .avatar {
  width: 30px; height: 30px; flex: none; border-radius: var(--r-full);
  background: var(--b-100); color: var(--b-700); font-weight: 600; font-size: 12px;
  display: grid; place-items: center;
}
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user strong { color: var(--text-primary); display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; display: block; }
.sidebar-user .role-tag {
  display: inline-block; margin-top: 3px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--b-700);
  background: var(--b-50); border: 1px solid var(--b-100); border-radius: var(--r-xs);
  padding: 1px 6px;
}
.powered { font-size: 10px; color: var(--text-disabled); margin-top: var(--sp-2); letter-spacing: .02em; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  border-bottom: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 0 var(--sp-6); background: var(--surface-raised);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.nav-toggle {
  display: none; flex: none; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--text-secondary); border: 1px solid var(--border-default);
  background: var(--surface-raised); cursor: pointer;
}

.pill {
  border: 1px solid var(--border-default); background: var(--surface-raised);
  border-radius: var(--r-full); padding: 4px 10px;
  color: var(--text-tertiary); font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill.brand { border-color: var(--b-200); background: var(--b-50); color: var(--b-700); }
.pill.warn { border-color: var(--warning-200); background: var(--warning-50); color: var(--warning-700); }
.pill.bad { border-color: var(--danger-200); background: var(--danger-50); color: var(--danger-700); }

.content { padding: var(--sp-6); max-width: var(--content-max); width: 100%; margin: 0 auto; flex: 1; min-height: calc(100vh - var(--topbar-h)); }

/* ------------------------------------------------------------- headings -- */

.page-heading { margin-bottom: var(--sp-4); display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.page-heading h2 { font-size: 20px; letter-spacing: -.016em; font-weight: 600; }
.page-heading p { color: var(--text-tertiary); margin-top: 3px; font-size: 13px; max-width: 78ch; }

.section-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: var(--sp-3); }
.section-title h2, .section-title h3 { font-size: 15px; font-weight: 600; }
.section-title .muted { font-size: 12px; }

/* ---------------------------------------------------------------- cards -- */

.card {
  background: var(--surface-raised); border: 1px solid var(--border-default);
  border-radius: var(--r-md); box-shadow: none; padding: var(--sp-5);
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .section-title { padding: 14px 16px 0; }
.card.soft { background: var(--surface-sunken); }
.card h2, .card h3 { margin-bottom: var(--sp-3); }
.card-pad { padding: var(--sp-5); }

.grid { display: grid; gap: var(--sp-4); align-items: start; }
.grid.two-col { grid-template-columns: minmax(0, 1.75fr) minmax(300px, .85fr); }
.grid.half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four-col { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: var(--sp-3); }

/* ----------------------------------------------------------------- KPIs -- */

.kpis { display: grid; gap: var(--sp-3); grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--sp-4); }
.kpis.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi {
  background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--r-md);
  padding: var(--sp-4); box-shadow: none; min-height: 92px; display: flex; flex-direction: column;
}
.kpi .label {
  color: var(--text-tertiary); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi .value { font-size: 22px; font-weight: 600; margin-top: var(--sp-2); letter-spacing: -.018em; line-height: 1.2; font-variant-numeric: tabular-nums slashed-zero; }
.kpi .value.sm { font-size: 18px; }
.kpi .sub { color: var(--text-tertiary); font-size: 11.5px; margin-top: 3px; }
.kpi.accent-good .value { color: var(--success-600); }
.kpi.accent-bad .value { color: var(--danger-600); }
.kpi.accent-brand .value { color: var(--b-600); }
.kpi.accent-warn .value { color: var(--warning-600); }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border-default); border-radius: var(--r-md);
  background: var(--surface-raised); overflow: hidden; margin-bottom: var(--sp-4);
}
.stat-strip > div { padding: var(--sp-4); text-align: left; border-right: 1px solid var(--border-subtle); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip strong { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.018em; font-variant-numeric: tabular-nums slashed-zero; }
.stat-strip small { display: block; color: var(--text-tertiary); text-transform: uppercase; font-size: 11px; font-weight: 600; letter-spacing: .05em; margin-top: var(--sp-1); }

/* --------------------------------------------------------------- tables -- */

.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-default); border-radius: var(--r-md); background: var(--surface-raised);
  background-image:
    linear-gradient(90deg, var(--surface-raised), rgba(255,255,255,0)),
    linear-gradient(270deg, var(--surface-raised), rgba(255,255,255,0)),
    radial-gradient(farthest-side at 0 50%, rgba(22,28,38,.14), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(22,28,38,.14), transparent);
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-attachment: local, local, scroll, scroll;
}
.card.flush .table-wrap { border: 0; border-radius: 0; }

.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { padding: var(--sp-2) var(--sp-3); text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; height: 44px; }
.table th {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-secondary); background: var(--surface-sunken); position: sticky; top: 0; z-index: 1;
  height: 40px; border-bottom: 1px solid var(--border-default);
}
.table th.group { text-align: center; border-bottom: 1px solid var(--border-default); border-inline: 1px solid var(--border-default); background: var(--n-100); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tr.total-row td { background: var(--surface-sunken); font-weight: 600; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table td.wrap { white-space: normal; min-width: 200px; }
.table .num, .table .money { text-align: right; font-variant-numeric: tabular-nums slashed-zero; }
.table th.num, .table th.money { text-align: right; }
.money { font-weight: 500; color: var(--text-primary); }
.money.pos { color: var(--success-600); }
.money.neg { color: var(--danger-600); }
.money.zero, .table .num.zero { color: var(--text-tertiary); font-weight: 400; }
.table td.tight { padding: 6px 12px; height: 36px; }

/* Sticky last (actions) column so row actions can never be clipped by
   horizontal scroll on a wide table. */
.table th:last-child, .table td:last-child {
  position: sticky; right: 0; background: var(--surface-raised);
  box-shadow: -1px 0 0 var(--border-subtle);
}
.table th:last-child { background: var(--surface-sunken); }
.table tbody tr:hover td:last-child { background: var(--surface-hover); }

.muted { color: var(--text-tertiary); }
.faint { color: var(--text-disabled); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }

/* -------------------------------------------------------------- badges --- */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  background: var(--n-100); color: var(--n-700); border: 1px solid var(--n-200);
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; flex: none; }
.status.approved, .status.active, .status.paid, .status.sent, .status.created, .status.delivered {
  background: var(--success-50); color: var(--success-700); border-color: var(--success-100);
}
.status.pending, .status.hold, .status.requested, .status.queued, .status.invited, .status.duplicate {
  background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-100);
}
.status.rejected, .status.chargeback, .status.cancelled, .status.inactive,
.status.suspended, .status.failed, .status.error {
  background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-100);
}
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 500;
  background: var(--n-100); color: var(--n-700); border: 0;
}
.tag.brand { background: var(--b-50); color: var(--b-700); }

/* --------------------------------------------------------------- forms --- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--n-700); font-size: 13px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-tertiary); }
.field .req { color: var(--danger-500); margin-left: 2px; }

.input, .select, textarea.input {
  width: 100%; padding: 8px 10px; height: 36px;
  background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--r-sm);
  color: var(--text-primary); outline: none; font-size: 14px;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
textarea.input { height: auto; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%236d7a8f' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:disabled, .select:disabled { background: var(--n-100); color: var(--n-500); border-color: var(--n-150); cursor: not-allowed; }
.input[readonly] { background: var(--surface-sunken); color: var(--text-primary); }
.input::placeholder { color: var(--text-disabled); }
textarea.input { min-height: 84px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--b-500); width: 16px; height: 16px; margin-top: 2px; flex: none; }
.checkline { display: flex; align-items: flex-start; gap: var(--sp-2); color: var(--text-secondary); font-size: 13px; }

.btn {
  border: 1px solid transparent; border-radius: var(--r-sm);
  height: 34px; padding: 0 var(--sp-3); background: var(--b-500); color: #fff;
  font-weight: 500; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
  white-space: nowrap;
}
.btn:hover { background: var(--b-600); }
.btn:active { background: var(--b-700); }
.btn:disabled { background: var(--n-200); color: var(--n-400); cursor: not-allowed; }
.btn.secondary { background: var(--surface-raised); color: var(--n-700); border-color: var(--border-default); box-shadow: var(--e-1); }
.btn.secondary:hover { background: var(--n-50); border-color: var(--border-strong); }
.btn.outline { background: var(--surface-raised); color: var(--b-600); border-color: var(--b-200); box-shadow: none; }
.btn.outline:hover { background: var(--b-50); }
.btn.tertiary { background: transparent; color: var(--n-600); border-color: transparent; box-shadow: none; }
.btn.tertiary:hover { background: var(--n-100); color: var(--n-800); }
.btn.good { background: var(--success-500); }
.btn.good:hover { background: var(--success-600); }
.btn.warn { background: var(--warning-500); }
.btn.warn:hover { background: var(--warning-600); }
.btn.bad { background: var(--danger-500); }
.btn.bad:hover { background: var(--danger-600); }
.btn.bad.secondary, .btn.destructive-secondary {
  background: var(--surface-raised); color: var(--danger-600); border-color: var(--border-default); box-shadow: var(--e-1);
}
.btn.bad.secondary:hover, .btn.destructive-secondary:hover { background: var(--danger-50); border-color: var(--danger-200); }
.btn.small { height: 28px; padding: 0 var(--sp-2); font-size: 12px; }
.btn.block { width: 100%; }
.btn[aria-busy="true"] { color: transparent; position: relative; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .6s linear infinite;
}
.btn.secondary[aria-busy="true"]::after, .btn.outline[aria-busy="true"]::after, .btn.tertiary[aria-busy="true"]::after {
  border-color: rgba(43,81,222,.25); border-top-color: var(--b-500);
}
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }

/* -------------------------------------------------------------- filters -- */

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.filter-bar {
  background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--r-md);
  padding: var(--sp-4); margin-bottom: var(--sp-4); box-shadow: none;
}
.filter-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.filter-row .field { flex: 1 1 150px; max-width: 230px; }
.filter-row .field.wide { flex: 2 1 260px; max-width: 420px; }
.filter-actions {
  display: flex; gap: var(--sp-2); margin-left: auto; align-items: flex-end;
  padding-top: var(--sp-3); border-top: 1px solid var(--border-subtle); width: 100%; justify-content: flex-end;
}

.preset-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: var(--sp-3);
  background: var(--n-100); border-radius: var(--r-sm); padding: 2px; width: fit-content; }
.preset-tabs a {
  padding: 6px 12px; border-radius: var(--r-xs); font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); border: 1px solid transparent;
}
.preset-tabs a:hover { color: var(--text-primary); }
.preset-tabs a.active { background: var(--surface-raised); color: var(--text-primary); font-weight: 600; box-shadow: var(--e-1); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-default); margin-bottom: var(--sp-4); overflow-x: auto; }
.tabs a {
  padding: 9px 14px; color: var(--text-tertiary); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text-primary); background: var(--n-50); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs a.active { color: var(--b-600); border-bottom-color: var(--b-500); font-weight: 600; }
.tabs .count { font-size: 11px; color: var(--text-tertiary); margin-left: 4px; }

/* --------------------------------------------------------------- charts -- */

.chart { width: 100%; height: 260px; display: block; }
.chart-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-2); font-size: 12px; color: var(--text-secondary); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-empty {
  height: 260px; border: 1px solid var(--border-default); border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--text-tertiary); background: var(--surface-sunken); text-align: center; padding: var(--sp-5);
}

.bar-track { height: 6px; background: var(--n-100); border-radius: var(--r-full); overflow: hidden; margin-top: var(--sp-2); }
.bar-track > span { display: block; height: 100%; background: var(--b-500); border-radius: var(--r-full); }

/* ----------------------------------------------------------- list rows --- */

.metric-list { display: grid; }
.metric-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle);
}
.metric-row:last-child { border-bottom: 0; }
.metric-row .label { min-width: 0; }
.metric-row strong { font-size: 13px; font-weight: 500; }
.metric-row .muted { font-size: 12px; }

.rank-index {
  width: 20px; height: 20px; flex: none; border-radius: var(--r-xs);
  background: var(--n-100); color: var(--text-tertiary);
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}

/* --------------------------------------------------------------- alerts -- */

.flash {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); margin-bottom: var(--sp-3);
  border: 1px solid var(--border-default); border-left: 3px solid var(--border-strong); background: var(--surface-raised); font-size: 13px;
  display: flex; gap: var(--sp-2); align-items: flex-start;
}
.flash.success { background: var(--success-50); color: var(--success-700); border-color: var(--success-100); border-left-color: var(--success-500); }
.flash.error { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-100); border-left-color: var(--danger-500); }
.flash.warning { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-100); border-left-color: var(--warning-500); }
.flash.info { background: var(--info-50); color: var(--info-700); border-color: var(--info-100); border-left-color: var(--info-500); }

.notice { border: 1px solid var(--info-100); background: var(--info-50); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); font-size: 13px; color: var(--info-700); }
.notice strong { display: block; margin-bottom: 3px; color: inherit; }
.notice.bad { border-color: var(--danger-100); background: var(--danger-50); color: var(--danger-700); }
.notice.warn { border-color: var(--warning-100); background: var(--warning-50); color: var(--warning-700); }
.notice.plain { border-color: var(--border-default); background: var(--surface-sunken); color: var(--text-secondary); }

.empty { padding: var(--sp-16) var(--sp-5); text-align: center; color: var(--text-tertiary); min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.empty .icon, .empty .icon-xl { color: var(--n-300); margin-bottom: var(--sp-3); }
.empty .empty-icon { font-size: 26px; opacity: .35; display: block; margin-bottom: var(--sp-2); } /* back-compat for any stray glyph markup */
.empty strong { display: block; color: var(--text-primary); margin-bottom: var(--sp-1); font-size: 15px; font-weight: 600; }
.empty p { font-size: 13px; max-width: 46ch; margin: 0 auto var(--sp-3); color: var(--text-secondary); }

/* ------------------------------------------------------------ hierarchy -- */

.tree { border: 1px solid var(--border-default); border-radius: var(--r-md); background: var(--surface-raised); overflow: hidden; }
.tree-head, .tree-row {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(84px, .7fr)) minmax(110px, .8fr);
  gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-4);
}
.tree-head { background: var(--surface-sunken); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.tree-head .num { text-align: right; }
.tree-row { border-top: 1px solid var(--border-subtle); }
.tree-row:hover { background: var(--surface-hover); }
.tree-name { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.tree-name .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-name strong { font-weight: 600; }
.indent { flex: none; display: inline-block; }
.branch { color: var(--text-disabled); font-size: 11px; flex: none; }
.tree-row .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ copy box --- */

.copybox { display: flex; }
.copybox .input { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-sunken); }
.copybox .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; flex: none; }
.copybox .btn.is-copied { background: var(--success-500); border-color: var(--success-500); }

.secret {
  background: var(--warning-50); border: 1px dashed var(--warning-200); border-radius: var(--r-sm);
  padding: var(--sp-3); word-break: break-all; font-family: var(--font-mono); font-size: 12.5px;
}
.code-block {
  background: var(--n-950); color: #dbe6f2; border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4); overflow-x: auto; font-family: var(--font-mono);
  font-size: 12px; line-height: 1.6;
}
code { background: var(--n-100); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 12.5px; }

/* ------------------------------------------------------------- brands ---- */

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-3); }
.brand-card { background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--r-md); box-shadow: none; overflow: hidden; display: flex; flex-direction: column; }
.brand-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); }
.brand-logo {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--n-800); color: #fff; font-weight: 600; font-size: 14px;
}
.brand-head .title { min-width: 0; flex: 1; }
.brand-head .title strong { display: block; font-size: 14.5px; font-weight: 600; }
.brand-body { border-top: 1px solid var(--border-subtle); padding: var(--sp-3) var(--sp-4); background: var(--surface-sunken); flex: 1; }
.brand-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: var(--sp-3); }
.brand-metrics small { display: block; color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.brand-metrics strong { font-size: 14px; font-weight: 600; }
.geo-list { display: flex; gap: 4px; flex-wrap: wrap; margin-top: var(--sp-2); }

/* -------------------------------------------------------------- quick ---- */

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.quick-card {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border-default); border-radius: var(--r-md);
  background: var(--surface-raised); box-shadow: none; transition: border-color var(--dur-1), background var(--dur-1);
}
.quick-card:hover { border-color: var(--b-200); background: var(--b-25); }
.quick-card .qi { color: var(--text-tertiary); }
.quick-card strong { display: block; font-size: 13px; font-weight: 600; }
.quick-card span { font-size: 11.5px; color: var(--text-tertiary); }
.quick-card .badge { margin-left: auto; font-weight: 600; font-size: 15px; color: var(--b-600); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- pagination --- */

.pagination { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; border-top: 1px solid var(--border-subtle); }
.pagination .pages { display: flex; gap: 3px; margin-left: auto; flex-wrap: wrap; }
.pagination .pages a, .pagination .pages span {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--r-sm);
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-secondary);
}
.pagination .pages a:hover { background: var(--n-50); }
.pagination .pages .current { background: var(--b-50); color: var(--b-700); border-color: var(--b-200); font-weight: 600; }
.pagination .pages .gap { border: 0; background: none; color: var(--text-disabled); }
/* Page-size control: a segmented set of real links, no <select onchange> —
   the CSP (script-src 'self', no unsafe-inline) blocks inline handlers. */
.page-size { display: flex; gap: 2px; background: var(--n-100); border-radius: var(--r-sm); padding: 2px; }
.page-size a, .page-size span {
  padding: 4px 10px; border-radius: var(--r-xs); font-size: 12px; font-weight: 500; color: var(--text-secondary);
}
.page-size a:hover { color: var(--text-primary); }
.page-size .current { background: var(--surface-raised); color: var(--text-primary); font-weight: 600; box-shadow: var(--e-1); }

/* ---------------------------------------------------------------- auth --- */

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 44fr 56fr; background: var(--surface-page); }
.auth-brand-panel {
  background: var(--n-950); color: var(--n-0); display: flex; align-items: center; justify-content: center;
  padding: var(--sp-16) var(--sp-10); position: relative; overflow: hidden;
}
.auth-brand-panel::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 400px at 15% 15%, rgba(43,81,222,.28), transparent 60%);
  pointer-events: none;
}
.auth-brand-panel-inner { max-width: 380px; position: relative; }
.brand-mark-lg {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md);
  background: var(--b-500); color: #fff; font-size: 20px; font-weight: 700; margin-bottom: var(--sp-6);
}
.auth-brand-panel-inner h2 { font: var(--t-title-2); margin: 0 0 var(--sp-4); color: var(--n-0); }
.auth-brand-tagline { font: var(--t-body-lg); color: var(--n-300); margin: 0 0 var(--sp-6); }
.auth-brand-proof { font: var(--t-body-sm); color: var(--n-400); border-top: 1px solid var(--n-800); padding-top: var(--sp-4); }
.auth-form-panel { display: grid; place-items: center; padding: var(--sp-5); }
.auth-form-panel-inner { width: min(420px, 100%); }
.auth-brand-compact { display: none; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.auth-card {
  width: 100%; background: var(--surface-raised); border: 1px solid var(--border-default);
  border-radius: var(--r-lg); padding: var(--sp-8); box-shadow: var(--e-2);
}
.auth-card h1 { text-align: left; margin-bottom: var(--sp-1); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.auth-card .sub { text-align: left; color: var(--text-secondary); font-size: 13px; margin-bottom: var(--sp-6); }
.auth-card form { display: grid; gap: var(--sp-4); }
.auth-links { display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-3); margin-top: 4px; font-size: 12.5px; }
.auth-links a { color: var(--b-600); font-weight: 500; }
.auth-remember { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; color: var(--text-secondary); }
.auth-footer { text-align: center; color: var(--text-disabled); font-size: 11.5px; padding: var(--sp-5); }
.otp-input { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 600; font-family: var(--font-mono); }

@media (max-width: 899px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-brand-compact { display: flex; }
  .auth-form-panel { padding: var(--sp-8) var(--sp-4); align-items: start; }
}

/* -------------------------------------------------------------- misc ----- */

.split-panel { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(0, 1.4fr); gap: var(--sp-3); align-items: start; }
.detail-list { display: grid; gap: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt, .detail-list .k { color: var(--text-tertiary); }
.detail-list dd, .detail-list .v { margin: 0; font-weight: 500; text-align: right; word-break: break-word; }

.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.health-dot.ok { background: var(--success-500); }
.health-dot.warn { background: var(--warning-500); }
.health-dot.bad { background: var(--danger-500); }

.scroll-y { max-height: 340px; overflow-y: auto; }
.divider { height: 1px; background: var(--border-subtle); margin: var(--sp-4) 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 20px; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

details.disclose > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: var(--sp-2) 0; list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary .icon { color: var(--text-tertiary); transition: transform var(--dur-2) var(--ease-out); }
details.disclose[open] > summary .icon { transform: rotate(90deg); }

/* --------------------------------------------------------------- dialog -- */

dialog { padding: 0; border: 0; border-radius: var(--r-lg); box-shadow: var(--e-4); background: var(--surface-overlay); color: var(--text-primary); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
dialog::backdrop { background: var(--surface-scrim); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
.dialog__header { height: 56px; padding: 0 var(--sp-5); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-subtle); }
.dialog__header h2 { font-size: 16px; font-weight: 600; }
.dialog__body { padding: var(--sp-5); overflow-y: auto; }
.dialog__footer { padding: var(--sp-4) var(--sp-5); background: var(--n-25); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--sp-2); }
@media (max-width: 640px) {
  dialog { width: 100vw; max-width: 100vw; max-height: 90vh; margin: auto auto 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* --------------------------------------------------------- responsive --- */

@media (max-width: 1400px) {
  .kpis, .kpis.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.four-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1150px) {
  .grid.two-col, .split-panel { grid-template-columns: 1fr; }
  .kpis, .kpis.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform var(--dur-3) var(--ease-out); box-shadow: var(--e-4);
  }
  html.nav-open .sidebar { transform: translateX(0); }
  html.nav-open { overflow: hidden; }
  .nav-scrim {
    display: none; position: fixed; inset: 0; background: var(--surface-scrim); z-index: 55;
  }
  html.nav-open .nav-scrim { display: block; }
  .topbar { padding: 0 var(--sp-4); }
  .content { padding: var(--sp-4); }
  .filter-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 620px) {
  .kpis, .kpis.compact, .grid.half, .grid.three-col, .grid.four-col, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .page-heading h2 { font-size: 18px; }
  .topbar h1 { font-size: 13.5px; }
  .topbar .crumb { display: none; }
  .top-actions select.select { max-width: 120px; min-width: 100px !important; }
  .card { padding: var(--sp-4); }
  .tree-head, .tree-row { grid-template-columns: 1fr auto; }
  .tree-head > *:nth-child(n+2), .tree-row > *:nth-child(n+2):not(:last-child) { display: none; }
  .filter-row .field { max-width: none; }

  /* Tables become stacked cards below 620px. Views emit data-label on <td>. */
  .table-wrap { background-image: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; min-width: 0; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table tr { border: 1px solid var(--border-default); border-radius: var(--r-md); margin: var(--sp-2); padding: var(--sp-2) var(--sp-3); width: calc(100% - #{var(--sp-4)}); }
  .table td {
    display: flex; justify-content: space-between; gap: var(--sp-4);
    border: 0; padding: var(--sp-2) 0; text-align: right; height: auto; position: static; box-shadow: none; background: transparent !important;
  }
  .table td::before { content: attr(data-label); font-size: 12px; color: var(--text-tertiary); text-align: left; flex: none; font-weight: 500; }
  .table td:empty::before { content: none; }
  .table td[data-primary] { display: block; text-align: left; font-size: 14px; font-weight: 600; }
  .table td[data-primary]::before { content: none; }
}

@media print {
  .sidebar, .topbar, .filter-bar, .actions, .pagination, .btn, .nav-toggle { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ====================================================================
   Public marketing site — shares tokens/components above (buttons, cards,
   pills, tables) so the public site and the app read as one product.
   ==================================================================== */

body.mkt { background: var(--surface-raised); }

.mkt-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface-raised);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.mkt-header.is-scrolled { border-bottom-color: var(--border-default); box-shadow: var(--e-2); }
.mkt-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.mkt-nav { display: flex; gap: 22px; flex: 1; }
.mkt-nav a { color: var(--text-secondary); font-size: 13.5px; font-weight: 500; }
.mkt-nav a:hover { color: var(--text-primary); }
.mkt-header-actions { display: flex; gap: 8px; align-items: center; }

.mkt-eyebrow {
  display: inline-flex; align-items: center; height: 24px; padding: 0 var(--sp-3);
  border-radius: var(--r-full); background: var(--b-50); color: var(--b-700);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}

.mkt-hero {
  background:
    radial-gradient(720px 320px at 85% -10%, var(--b-50), transparent),
    var(--surface-raised);
  border-bottom: 1px solid var(--border-default);
}
.mkt-hero-inner { max-width: 780px; margin: 0 auto; padding: var(--sp-24) 24px var(--sp-16); text-align: center; }
.mkt-hero h1 { font-size: 52px; line-height: 56px; letter-spacing: -.032em; margin: 18px 0 18px; font-weight: 700; }
.mkt-lede { color: var(--text-secondary); font-size: 18px; line-height: 28px; max-width: 620px; margin: 0 auto; }
.mkt-hero-actions { display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-6); flex-wrap: wrap; }
.mkt-hero .btn, .mkt-hero-actions .btn { height: 40px; padding: 0 var(--sp-5); font-size: 14px; }
.mkt-trust { margin-top: var(--sp-5); font-size: 12.5px; color: var(--text-tertiary); }

.mkt-section { padding: var(--sp-24) 24px; border-bottom: 1px solid var(--border-default); }
.mkt-section.alt { background: var(--surface-page); }
.mkt-section-inner { max-width: 1180px; margin: 0 auto; }
.mkt-section .section-title { justify-content: center; margin-bottom: var(--sp-8); }
.mkt-section .section-title h2 { font-size: 32px; letter-spacing: -.024em; font-weight: 600; }

.mkt-list { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.mkt-list li::marker { color: var(--b-500); }

.mkt-cta { padding: var(--sp-16) 24px; text-align: center; background: var(--surface-raised); }
.mkt-cta-inner { max-width: 620px; margin: 0 auto; }
.mkt-cta h2 { font-size: 32px; letter-spacing: -.024em; margin-bottom: var(--sp-2); font-weight: 600; }

.mkt-footer { background: var(--surface-sunken); border-top: 1px solid var(--border-default); }
.mkt-footer-inner {
  max-width: 1180px; margin: 0 auto; padding: var(--sp-10) 24px var(--sp-6);
  display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap;
}
.mkt-footer-brand { max-width: 260px; display: flex; gap: var(--sp-2); align-items: flex-start; }
.mkt-footer-cols { display: flex; gap: var(--sp-10); flex-wrap: wrap; }
.mkt-footer-cols h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); margin-bottom: var(--sp-2); }
.mkt-footer-cols a { display: block; color: var(--text-secondary); font-size: 13px; padding: 3px 0; }
.mkt-footer-cols a:hover { color: var(--b-600); }
.mkt-footer-bottom { text-align: center; padding: var(--sp-4); font-size: 11.5px; color: var(--text-tertiary); border-top: 1px solid var(--border-default); }
.mkt-footer-bottom a { color: var(--text-tertiary); margin: 0 6px; }
.mkt-footer-bottom a:hover { color: var(--b-600); }

@media (max-width: 780px) {
  .mkt-nav { display: none; }
  .mkt-hero h1 { font-size: 36px; line-height: 40px; }
  .mkt-lede { font-size: 16px; }
  .mkt-section { padding: var(--sp-14, 56px) 20px; }
}
@media (max-width: 480px) {
  .mkt-header-cta { display: none; }
  .mkt-header-inner { padding: 0 16px; }
  .mkt-hero-actions .btn.outline { display: none; }
}

.mkt-split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: var(--sp-10); align-items: center; }
.mkt-split.reverse .mkt-split-media { order: 2; }
.mkt-split.reverse .mkt-split-text { order: 1; }
.mkt-split-text h2 { font-size: 30px; letter-spacing: -.022em; font-weight: 600; margin-bottom: var(--sp-3); text-align: left; }
.mkt-shot-frame {
  border: 1px solid var(--border-default); border-radius: var(--r-lg); box-shadow: var(--e-3);
  overflow: hidden; background: var(--surface-raised); line-height: 0;
}
.mkt-shot-frame img { width: 100%; height: auto; display: block; }
@media (max-width: 900px) {
  .mkt-split, .mkt-split.reverse { grid-template-columns: 1fr; }
  .mkt-split.reverse .mkt-split-media, .mkt-split.reverse .mkt-split-text { order: unset; }
}

.mkt-cascade-section { padding: var(--sp-24) 24px; border-bottom: 1px solid var(--border-default); background: var(--surface-page); }
.mkt-cascade-inner { max-width: 900px; margin: 0 auto; text-align: center; }
.mkt-cascade-steps { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin: var(--sp-8) 0; }
.mkt-cascade-step {
  flex: 1 1 180px; max-width: 210px; border: 1px solid var(--border-default); border-radius: var(--r-md);
  padding: var(--sp-4); background: var(--surface-raised); text-align: left;
}
.mkt-cascade-step .who { font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
.mkt-cascade-step .amt { font-size: 22px; font-weight: 600; margin-top: var(--sp-1); font-variant-numeric: tabular-nums; }
.mkt-cascade-step .keeps { font-size: 12.5px; color: var(--success-600); margin-top: 2px; font-weight: 500; }
.mkt-cascade-arrow { display: flex; align-items: center; color: var(--text-disabled); font-size: 20px; }
@media (max-width: 900px) { .mkt-cascade-arrow { display: none; } }

/* Onboarding checklist (integrations/sites) */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2, 8px); }
.checklist li { position: relative; padding-left: 28px; color: var(--text-secondary, #52607A); font-size: var(--t-body-sm, 13px); }
.checklist li::before {
  content: ''; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 999px;
  border: 1.5px solid var(--n-300, #C0C9D6); background: var(--n-0, #fff);
}
.checklist li.done { color: var(--text-primary, #161C26); font-weight: 500; }
.checklist li.done::before {
  border-color: var(--success-500); background: var(--success-500);
  background-image: url(data:image/svg+xml,%3Csvg xmlns=http://www.w3.org/2000/svg viewBox=0 0 24 24 fill=none stroke=white stroke-width=3 stroke-linecap=round stroke-linejoin=round%3E%3Cpolyline points=20 6 9 17 4 12/%3E%3C/svg%3E);
  background-size: 12px; background-repeat: no-repeat; background-position: center;
}
