/* ==========================================================================
   Pitchlight design system
   Tokens → base → layout → components → pages.
   Strict CSP: there are no inline styles anywhere, so every visual state
   is expressed as a class. Bars and rings are SVG with attribute geometry.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.2bf3d951bf9d.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --ink: #0c1322;
  --ink-2: #273244;
  --muted: #5a6578;
  --faint: #8a93a5;
  --line: #e2e6ec;
  --line-2: #d0d6df;

  --brand: #f5a524;
  --brand-strong: #db8a00;
  --brand-soft: #fff3d6;
  --brand-ink: #1f1500;

  --accent: #2f5bea;
  --accent-strong: #1f46c8;
  --accent-soft: #eaf0ff;

  --good: #0b8f63;
  --good-soft: #e3f5ec;
  --warn: #b86e00;
  --warn-soft: #fff4dc;
  --bad: #d23a2f;
  --bad-soft: #fdebe9;
  --info: #2f6feb;
  --info-soft: #e9f1fe;

  --night: #0a0f1d;
  --night-2: #111a2d;
  --night-3: #1b2640;
  --night-ink: #e8ecf4;
  --night-muted: #93a0b8;

  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgb(12 19 34 / 6%);
  --shadow: 0 1px 2px rgb(12 19 34 / 6%), 0 10px 30px -14px rgb(12 19 34 / 22%);
  --shadow-lg: 0 24px 60px -24px rgb(12 19 34 / 35%);
  --focus: 0 0 0 3px rgb(47 91 234 / 35%);

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --tabbar-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #111a2c;
    --surface-2: #16213a;
    --surface-3: #1e2a45;
    --ink: #e9edf5;
    --ink-2: #c9d1e0;
    --muted: #97a3ba;
    --faint: #6f7b93;
    --line: #223050;
    --line-2: #2c3b60;
    --brand-soft: #3a2a07;
    --brand-ink: #1f1500;
    --accent: #6d8dff;
    --accent-strong: #8aa4ff;
    --accent-soft: #1b2748;
    --good: #34c98f;
    --good-soft: #0e2f25;
    --warn: #f1b44c;
    --warn-soft: #33260b;
    --bad: #ff6b5f;
    --bad-soft: #3a1512;
    --info: #74a3ff;
    --info-soft: #14254a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px -14px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); font-weight: 750; }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.55rem); font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 650; }
h4 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 1em; }
small, .small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .86em; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 650; }
.skip-link:focus { left: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
[hidden] { display: none !important; }

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: 20px; }
.container-narrow { max-width: 760px; }
.container-mid { max-width: 960px; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.stack-sm { --gap: .5rem; }
.stack-lg { --gap: 1.75rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, .6rem); }
.cluster-between { justify-content: space-between; }
.cluster-end { justify-content: flex-end; }
.cluster-center { justify-content: center; }
.row { display: flex; align-items: center; gap: .75rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--gap, 1rem); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: .55rem 1rem;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { text-decoration: none; border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: var(--brand); box-shadow: 0 1px 0 rgb(0 0 0 / 8%), inset 0 1px 0 rgb(255 255 255 / 35%); }
.btn-primary:hover { --btn-bg: #ffb53d; --btn-bd: #ffb53d; }
.btn-dark { --btn-bg: var(--ink); --btn-fg: var(--surface); --btn-bd: var(--ink); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: var(--accent); }
.btn-accent:hover { --btn-bg: var(--accent-strong); --btn-bd: var(--accent-strong); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-danger { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); --btn-bd: transparent; }
.btn-sm { min-height: 32px; padding: .35rem .7rem; font-size: .84rem; }
.btn-lg { min-height: 50px; padding: .8rem 1.4rem; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--ink-2); }
.field { margin-bottom: 1.1rem; }
.field .help, .helptext { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.field .errorlist, .errorlist { list-style: none; padding: 0; margin: .35rem 0 0; color: var(--bad); font-size: .84rem; font-weight: 550; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="tel"],
input[type="number"], input[type="search"], input[type="date"], input:not([type]), select, textarea, .input {
  width: 100%; min-height: 42px; padding: .55rem .75rem;
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type="color"] { width: 64px; height: 42px; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.field-inline { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.field-inline label { margin: 0; font-weight: 500; }
.input-group { display: flex; gap: .5rem; }
.input-group > input, .input-group > select { flex: 1 1 auto; }
fieldset { border: 0; padding: 0; margin: 0 0 1.2rem; }
legend { font-weight: 650; margin-bottom: .6rem; }

/* choice cards (radio/checkbox) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .55rem; }
.choices-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; gap: .6rem; min-height: 48px;
  padding: .65rem .85rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 550; font-size: .92rem; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice span::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 4px;
  border: 1.5px solid var(--line-2); background: var(--surface);
}
.choice input[type="radio"] + span::before { border-radius: 50%; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:checked + span::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 620px) { .choices { grid-template-columns: 1fr 1fr; } }

/* ---------- Cards & surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.25rem; }
.card-pad-lg { padding: 1.75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.25rem; }
.card-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-link { display: block; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-link:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow); }
.panel { background: var(--surface-2); border-radius: var(--radius); padding: 1rem 1.1rem; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }

/* ---------- Badges, chips, pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem;
  font-size: .76rem; font-weight: 650; line-height: 1.35; letter-spacing: .01em;
  border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); color: #8a5a00; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-dark { background: var(--ink); color: var(--surface); }
.badge-outline { background: transparent; border: 1px solid var(--line-2); }
@media (prefers-color-scheme: dark) { .badge-brand { color: var(--brand); } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; padding: .3rem .75rem;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  font-size: .84rem; font-weight: 550; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.chip:hover { text-decoration: none; border-color: var(--faint); }
.chip.is-active, .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------- Scores ---------- */
.score { position: relative; width: 64px; height: 64px; flex: none; }
.score-lg { width: 108px; height: 108px; }
.score-sm { width: 46px; height: 46px; }
.score svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score .ring-track { fill: none; stroke: var(--surface-3); stroke-width: 3.2; }
.score .ring-value { fill: none; stroke: var(--faint); stroke-width: 3.2; stroke-linecap: round; }
.score.is-hot .ring-value { stroke: var(--brand-strong); }
.score.is-warm .ring-value { stroke: var(--brand); }
.score.is-mild .ring-value { stroke: var(--info); }
.score.is-good .ring-value { stroke: var(--good); }
.score.is-bad .ring-value { stroke: var(--bad); }
.score-value { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.score-lg .score-value { font-size: 2rem; }
.score-sm .score-value { font-size: .9rem; }
.score-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }

.bar { width: 100%; height: 8px; }
.bar .bar-track { fill: var(--surface-3); }
.bar .bar-fill { fill: var(--accent); }
.bar.is-hot .bar-fill { fill: var(--brand-strong); }
.bar.is-good .bar-fill { fill: var(--good); }
.bar.is-bad .bar-fill { fill: var(--bad); }
.bar.is-warn .bar-fill { fill: var(--brand); }
meter { width: 100%; height: 8px; }

.confidence { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); font-weight: 550; }
.confidence .pips { display: inline-flex; gap: 2px; }
.confidence .pip { width: 5px; height: 12px; border-radius: 2px; background: var(--surface-3); }
.confidence .pip.on { background: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; }
.table-compact td { padding: .45rem .7rem; }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .45rem 1rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Alerts / messages ---------- */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: .92rem; }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--ink); }
.alert-good, .alert-success { background: var(--good-soft); border-color: transparent; }
.alert-warn, .alert-warning { background: var(--warn-soft); border-color: transparent; }
.alert-bad, .alert-error { background: var(--bad-soft); border-color: transparent; }
.alert .icon { margin-top: 2px; }
.messages { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: .5rem; max-width: min(420px, calc(100vw - 32px)); }
.toast { box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 860px) { .messages { bottom: calc(var(--tabbar-h) + 12px); } }

/* ---------- Empty states & misc ---------- */
.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; margin: 0 auto .75rem; color: var(--faint); }
.empty h3 { color: var(--ink); }
.eyebrow { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-strong); margin-bottom: .6rem; }
.kbd { font-family: var(--mono); font-size: .78rem; padding: .1rem .4rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); }
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 550; }
.stat-delta { font-size: .8rem; font-weight: 650; }
.stat-delta.up { color: var(--good); } .stat-delta.down { color: var(--bad); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.htmx-request .htmx-hide-on-request { display: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }

.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress svg { width: 100%; height: 6px; }
.progress .bar-fill { fill: var(--brand); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .7rem .9rem; font-weight: 600; font-size: .9rem; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; font-family: inherit; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .is-active, .tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand-strong); }

details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; font-weight: 600; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "›"; margin-left: auto; transform: rotate(90deg); transition: transform .15s; color: var(--muted); font-size: 1.2rem; }
details.disclosure[open] > summary::after { transform: rotate(-90deg); }

dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); }
dialog.modal::backdrop { background: rgb(10 15 29 / 55%); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; }
.menu-list a, .menu-list button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 7px; color: var(--ink); font: inherit; font-size: .9rem; background: none; border: 0; text-align: left; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-sep { height: 1px; background: var(--line); margin: .3rem 0; }

/* ---------- Brand ---------- */
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 780; font-size: 1.12rem; letter-spacing: -0.03em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; }
.logo-inverse { color: #fff; }

/* ==========================================================================
   Marketing site
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 30; background: rgb(245 246 248 / 85%); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
@media (prefers-color-scheme: dark) { .site-header { background: rgb(11 16 32 / 85%); } }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .container { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.site-nav { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.site-nav a:not(.btn) { color: var(--ink-2); font-weight: 550; font-size: .92rem; }
@media (max-width: 760px) { .site-nav .hide-sm { display: none; } }

.hero { padding: clamp(3rem, 2rem + 5vw, 6rem) 0 3rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem); line-height: 1.04; letter-spacing: -0.035em; font-weight: 800; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--brand-soft) 62%); }
.hero .lede { font-size: clamp(1.02rem, .95rem + .4vw, 1.2rem); color: var(--ink-2); max-width: 36rem; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 1.5rem; color: var(--muted); font-size: .88rem; }
.hero-proof span { display: inline-flex; gap: .4rem; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.demo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.demo-card-head { display: flex; gap: 1rem; align-items: center; padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--line); }
.demo-card-body { padding: 1rem 1.3rem 1.3rem; }
.signal { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.signal:last-child { border-bottom: 0; }
.signal .icon { margin-top: 3px; }
.signal-bad .icon { color: var(--bad); }
.signal-warn .icon { color: var(--warn); }
.signal-good .icon { color: var(--good); }

.section { padding: clamp(3rem, 2rem + 3vw, 5rem) 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-dark { background: var(--night); color: var(--night-ink); }
.section-dark h2, .section-dark h3 { color: #fff; }
.section-dark .muted { color: var(--night-muted); }
.section-head { max-width: 680px; margin-bottom: 2.25rem; }
.section-head p { color: var(--muted); font-size: 1.05rem; }
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; counter-reset: flow; }
.flow-step { position: relative; padding: 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.flow-step::before { counter-increment: flow; content: counter(flow, decimal-leading-zero); font-family: var(--mono); font-size: .75rem; color: var(--brand-strong); font-weight: 700; }
.flow-step h3 { margin: .35rem 0 .3rem; }
.flow-step p { margin: 0; font-size: .88rem; color: var(--muted); }
@media (max-width: 900px) { .flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } }
.feature { padding: 1.3rem; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.feature .icon { width: 22px; height: 22px; color: var(--brand-strong); margin-bottom: .7rem; }
.feature h3 { margin-bottom: .35rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }
.truth-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.truth { padding: 1.2rem; border-radius: var(--radius-lg); background: var(--night-2); border: 1px solid var(--night-3); }
.truth .tag { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
@media (max-width: 800px) { .truth-grid { grid-template-columns: 1fr; } }

.price-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.price-card { display: flex; flex-direction: column; padding: 1.4rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.price-card.is-featured { border-color: var(--brand-strong); box-shadow: 0 0 0 1px var(--brand-strong), var(--shadow); }
.price-card h3 { margin-bottom: .2rem; }
.price { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; margin: .6rem 0 .1rem; font-variant-numeric: tabular-nums; }
.price small { font-size: .9rem; color: var(--muted); font-weight: 550; letter-spacing: 0; }
.price-card ul { list-style: none; padding: 0; margin: 1rem 0 1.25rem; display: grid; gap: .5rem; font-size: .9rem; }
.price-card li { display: flex; gap: .5rem; align-items: flex-start; }
.price-card li .icon { color: var(--good); margin-top: 3px; }
.price-card .btn { margin-top: auto; }
@media (max-width: 1000px) { .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .price-grid { grid-template-columns: 1fr; } }

.faq details { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.faq summary { font-weight: 650; cursor: pointer; }
.faq p { margin: .6rem 0 0; color: var(--ink-2); }

.site-footer { padding: 3rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer .container { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.site-footer h4 { color: var(--ink); font-size: .85rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer a { color: var(--muted); }
@media (max-width: 760px) { .site-footer .container { grid-template-columns: 1fr 1fr; } }
.prose { max-width: 720px; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: .3rem; }

/* ==========================================================================
   Application shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; padding: 1rem .75rem; background: var(--night); color: var(--night-ink); overflow-y: auto; }
.sidebar .logo { color: #fff; padding: .35rem .5rem .5rem; }
.nav-group { display: grid; gap: 2px; }
.nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--night-muted); font-weight: 700; padding: .6rem .6rem .3rem; }
.nav-link { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px; color: #c8d0e0; font-weight: 550; font-size: .9rem; }
.nav-link:hover { background: var(--night-2); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--night-3); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav-link .badge { margin-left: auto; background: var(--brand); color: var(--brand-ink); }
.sidebar-foot { margin-top: auto; padding: .8rem; border-radius: var(--radius); background: var(--night-2); border: 1px solid var(--night-3); font-size: .82rem; }
.sidebar-foot .bar .bar-track { fill: var(--night-3); }
.sidebar-foot .bar .bar-fill { fill: var(--brand); }
.sidebar-foot a { color: var(--brand); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; min-height: var(--topbar-h); padding: 0 1.5rem; background: rgb(245 246 248 / 88%); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .topbar { background: rgb(11 16 32 / 88%); } }
.topbar-title { font-weight: 700; font-size: 1rem; }
.topbar .spacer { flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 750; font-size: .85rem; }
.content { padding: 1.5rem; width: 100%; max-width: 1280px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.breadcrumbs { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.breadcrumbs a { color: var(--muted); }
.tabbar { display: none; }
.mobile-only { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgb(10 15 29 / 45%); z-index: 45; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1rem 1rem calc(var(--tabbar-h) + 1.25rem); }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .7rem; font-weight: 600; color: var(--muted); background: none; border: 0; font-family: inherit; }
  .tabbar a.is-active { color: var(--ink); }
  .tabbar a.is-active .icon { color: var(--brand-strong); }
  .tabbar a:hover { text-decoration: none; }
}

/* ---------- Onboarding ---------- */
.onboard { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.onboard-top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }
.onboard-main { display: grid; place-items: start center; padding: 1rem 1rem 4rem; }
.onboard-card { width: min(720px, 100%); }
.stepper { display: flex; gap: .4rem; margin-bottom: 1.25rem; }
.stepper li { flex: 1; list-style: none; }
.stepper { padding: 0; }
.stepper .step-bar { height: 4px; border-radius: 99px; background: var(--surface-3); }
.stepper .is-done .step-bar, .stepper .is-current .step-bar { background: var(--brand-strong); }
.stepper .step-name { font-size: .72rem; color: var(--muted); margin-top: .35rem; font-weight: 600; }
.stepper .is-current .step-name { color: var(--ink); }
@media (max-width: 520px) { .stepper .step-name { display: none; } }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--night); color: var(--night-ink); padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { color: #fff; font-size: 1.8rem; letter-spacing: -0.02em; }
.auth-side .muted { color: var(--night-muted); }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: min(420px, 100%); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ==========================================================================
   Product components
   ========================================================================== */
.opp-list { display: grid; gap: .75rem; }
.opp { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: inherit; }
.opp:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow); }
.opp-title { font-weight: 700; font-size: 1rem; color: var(--ink); }
.opp-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; font-size: .84rem; color: var(--muted); margin-top: .15rem; }
.opp-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.opp-signals { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.opp-side { text-align: right; display: grid; gap: .35rem; justify-items: end; }
@media (max-width: 620px) {
  .opp { grid-template-columns: auto minmax(0, 1fr); }
  .opp-side { grid-column: 1 / -1; justify-items: start; text-align: left; display: flex; gap: .5rem; flex-wrap: wrap; }
}
.filters { display: grid; gap: 1rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filter-bar select, .filter-bar input { width: auto; min-width: 150px; }
@media (max-width: 620px) { .filter-bar select, .filter-bar input { flex: 1 1 45%; min-width: 0; } }

.finding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .85rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.sev-critical .finding-icon, .sev-5 .finding-icon, .sev-4 .finding-icon { background: var(--bad-soft); color: var(--bad); }
.sev-3 .finding-icon { background: var(--warn-soft); color: var(--warn); }
.sev-2 .finding-icon, .sev-1 .finding-icon { background: var(--info-soft); color: var(--info); }
.sev-0 .finding-icon { background: var(--good-soft); color: var(--good); }
.finding h4 { margin: 0 0 .25rem; font-size: .98rem; }
.finding p { margin: 0 0 .4rem; color: var(--ink-2); font-size: .92rem; }
.finding .why { color: var(--muted); }
.finding-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .4rem; }
.evidence { margin-top: .5rem; padding: .6rem .75rem; border-radius: 8px; background: var(--surface-2); font-family: var(--mono); font-size: .78rem; color: var(--ink-2); overflow-wrap: anywhere; }
.evidence a { color: var(--accent); }
.layer-tag { font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; padding: .12rem .45rem; border-radius: 5px; }
.layer-observed { background: var(--info-soft); color: var(--info); }
.layer-inferred { background: var(--warn-soft); color: var(--warn); }
.layer-estimated { background: var(--brand-soft); color: #8a5a00; }

.subscores { display: grid; gap: .6rem; }
.subscore { display: grid; grid-template-columns: 140px minmax(0, 1fr) 36px; gap: .6rem; align-items: center; font-size: .86rem; }
.subscore .num { text-align: right; font-weight: 650; }

.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.pipeline-col { background: var(--surface-2); border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.pipeline-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; margin: .2rem .3rem .6rem; }
.deal { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .7rem .75rem; margin-bottom: .5rem; color: inherit; font-size: .88rem; }
.deal:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-sm); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--line); margin-left: .35rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-strong); }
.timeline li:last-child { border-left-color: transparent; }

.email-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .95rem; }
.email-preview .headers { padding: .75rem 1rem; border-bottom: 1px solid var(--line); font-size: .86rem; color: var(--muted); display: grid; gap: .2rem; }
.email-preview .body { padding: 1rem; white-space: pre-wrap; line-height: 1.6; }
.var { background: var(--brand-soft); border-radius: 4px; padding: 0 .15rem; }
.missing-var { background: var(--bad-soft); color: var(--bad); border-radius: 4px; padding: 0 .2rem; }

.compare { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .75rem; align-items: center; }
.delta-up { color: var(--good); font-weight: 700; }
.delta-down { color: var(--bad); font-weight: 700; }

.map { width: 100%; height: min(70vh, 640px); border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; }
.checklist .icon { color: var(--good); margin-top: 3px; }

.usage-line { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .3rem; }

/* ---------- Public report ---------- */
.report { background: var(--bg); }
.report-hero { background: var(--night); color: var(--night-ink); padding: 2.5rem 0 5rem; }
.report-hero h1 { color: #fff; }
.report-hero .muted { color: var(--night-muted); }
.report-body { margin-top: -3.5rem; padding-bottom: 3rem; }
.report-brand { display: flex; align-items: center; gap: .75rem; }
.report-brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; }

/* ---------- Print (proposals, reports) ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .no-print, .messages, .site-header, .site-footer { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .report-hero { background: #fff; color: #000; padding: 0 0 1rem; }
  .report-hero h1 { color: #000; }
  .report-body { margin-top: 0; }
}
