/* ═══════════════════════════════════════════════════════════════════════
   Stackz — shared components
   ─────────────────────────────────────────────────────────────────────
   Sits on top of static/design/tokens.css and corrects the places where
   the app's surfaces disagree with each other: dialogs, the context rail,
   status chips, and controls.

   Where a rule carries !important it is overriding an existing
   !important or a Tailwind utility that cannot otherwise be reached.
   Each of those is commented with what it is beating.

   LOAD AFTER tokens.css.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────
   1. DIALOGS
   Every tool opens into one of these. They were pinned to the top of the
   viewport because dashboard.css forced
       .modal-backdrop.flex { align-items: flex-start !important }
   over markup that already asked for `items-center justify-center`.
   ───────────────────────────────────────────────────────────────────── */

/* Product-wide surfaces. Legacy screens keep their layouts, while shared
   materials and controls make them feel like workspaces inside one product. */
.panel,
.rail-panel,
.stat-card,
.metric-card,
.research-card,
.detail-card,
.data-card,
.insight-card,
.glow-card,
.idea-card,
.market-kv,
.analysis-metric,
.coach-starter-card,
.process-step,
.login-card,
.auth-card,
.modal-card {
  border-color: var(--sz-rule);
  border-radius: var(--sz-r-md);
  background-color: var(--sz-surface);
  box-shadow: none;
}

.top-bar,
.community-topbar,
.app-shared-nav,
body.grid-bg > header {
  border-color: var(--sz-rule);
  background: color-mix(in srgb, var(--sz-paper) 92%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}

.app-shared-nav-inner,
.top-bar,
.community-topbar { min-height: 56px; }

.app-nav-link,
.top-link,
.tb,
.dashboard-nav-link {
  border-radius: var(--sz-r-sm);
  font-family: var(--sz-font-text);
  letter-spacing: .01em;
  text-transform: none;
}

.app-nav-link.is-active,
.top-link[aria-current="page"],
.tb.pri,
.dashboard-nav-link.is-active {
  border-color: var(--sz-rule-strong);
  background: var(--sz-surface-2);
  color: var(--sz-ink);
}

input,
select,
textarea,
button { font-family: var(--sz-font-text); }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  border-color: var(--sz-rule-strong);
  border-radius: var(--sz-r-sm);
}

table { font-variant-numeric: tabular-nums lining-nums; }

/* Shared ticker identity. The initials are a readable fallback while the
   optional company mark loads; presentation belongs in the canonical layer
   so it follows both themes and never drops below the 11px type floor. */
.sym-logo {
  display: inline-flex;
  width: var(--sz-5);
  height: var(--sz-5);
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--sz-r-sm);
  background: var(--sz-surface-2);
  box-shadow: inset 0 0 0 1px var(--sz-rule);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
  vertical-align: middle;
}

.sym-logo--loaded {
  background: var(--sz-print-paper);
  box-shadow: inset 0 0 0 1px var(--sz-rule-strong);
}

.sym-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Token-backed inline data marks used by the dashboard. Dynamic geometry and
   magnitude remain custom properties; theme colors stay in the cascade. */
.treemap-tile {
  border-color: var(--sz-rule-strong);
  background: var(--sz-surface-2);
  box-shadow: none;
  color: var(--sz-ink-2);
}

.treemap-tile[data-tone="positive"] {
  background: color-mix(in srgb, var(--sz-pos) var(--tm-strength, 8%), var(--sz-surface));
  color: var(--sz-ink);
}

.treemap-tile[data-tone="negative"] {
  background: color-mix(in srgb, var(--sz-neg) var(--tm-strength, 8%), var(--sz-surface));
  color: var(--sz-ink);
}

.treemap-tile:hover { box-shadow: var(--sz-shadow-md); }

.pnl-cell { background: var(--sz-surface-3); }
.pnl-cell.is-future { background: transparent; }
.pnl-cell[data-tone="positive"] {
  background: color-mix(in srgb, var(--sz-pos) var(--hm-strength, 8%), var(--sz-surface));
}
.pnl-cell[data-tone="negative"] {
  background: color-mix(in srgb, var(--sz-neg) var(--hm-strength, 8%), var(--sz-surface));
}

.mv-gauge__value {
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-sm);
  font-weight: 700;
}

.mv-gauge__label {
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-micro);
  font-weight: 700;
  letter-spacing: .04em;
}

th {
  color: var(--sz-ink-3);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: .04em;
}

/* Landing-page colour blocks become quiet, meaningful semantic washes. */
.mandate-card:nth-child(1),
.evidence-card:nth-child(2) { background: var(--sz-pos-wash); }
.mandate-card:nth-child(2),
.evidence-card:nth-child(1) { background: var(--sz-info-wash); }
.mandate-card:nth-child(3),
.evidence-card:nth-child(3) { background: var(--sz-caution-wash); }
.mandate-card:nth-child(4) { background: var(--sz-surface-2); }

.modal-backdrop {
  background: var(--sz-scrim);
  /* 12px of blur over a busy dashboard turned the backdrop into mush.
     A plain scrim reads calmer and costs nothing to composite. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  /* The backdrop no longer scrolls — the dialog body does. Scrolling the
     backdrop is what let tall modals run off the bottom of the screen. */
  overflow: hidden;
}

/* Centre, in both axes, on every screen. Beats the flex-start override. */
.modal-backdrop.flex,
.modal-backdrop:not(.hidden) {
  align-items: center !important;
  justify-content: center !important;
  padding: var(--sz-6) !important;
}

/* The dialog itself. `> .relative` is the shared shape of all 32 modals. */
.modal-backdrop > .relative {
  display: flex;
  flex-direction: column;
  /* Never taller than the viewport, so the header and the close button
     are always reachable. */
  max-height: min(86vh, calc(var(--sz-16) * 14));
  overflow: hidden;
  /* Flat surface. Replaces a radial green wash + two inset highlights. */
  background: var(--sz-surface) !important;
  border: 1px solid var(--sz-rule) !important;
  border-radius: var(--sz-r-lg) !important;
  box-shadow: var(--sz-shadow-lg) !important;
  /* Beats .dashboard-* backdrop-filter: blur(22px) saturate(1.9) */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Header holds its place; everything after it scrolls. */
.modal-backdrop > .relative > :first-child { flex: 0 0 auto; }
.modal-backdrop > .relative > :first-child ~ * {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Header — same geometry for all of them. */
.modal-backdrop > .relative > .flex.items-center.justify-between.border-b {
  padding: var(--sz-4) var(--sz-5) !important;
  border-color: var(--sz-rule) !important;
  /* was: linear-gradient(180deg, rgba(255,255,255,0.03), transparent) */
  background: transparent !important;
}

/* The green gradient hairline that ran under every modal header. */
.modal-backdrop > .relative > .flex.items-center.justify-between.border-b::after {
  display: none !important;
}

/* Each modal used to pick its own accent for the 4px bar beside the
   title — orange here, magenta there, red elsewhere. One neutral rule. */
.modal-backdrop > .relative > .flex.items-center.justify-between.border-b > div:first-child > .w-1 {
  background: var(--sz-rule-strong) !important;
}

/* Title: sentence case at a readable size, not 10px uppercase tracked out. */
.modal-backdrop > .relative > .flex.items-center.justify-between.border-b .font-cyber {
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h3) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--sz-ink) !important;
}

.modal-backdrop > .relative > .flex.items-center.justify-between.border-b [data-close-modal] {
  width: var(--sz-8);
  height: var(--sz-8);
  border-radius: var(--sz-r-sm);
  border: 1px solid var(--sz-rule);
  background: transparent;
  color: var(--sz-ink-3);
  transition: color var(--sz-dur-fast) var(--sz-ease),
              background var(--sz-dur-fast) var(--sz-ease);
}
.modal-backdrop > .relative > .flex.items-center.justify-between.border-b [data-close-modal]:hover {
  background: var(--sz-surface-3) !important;
  border-color: var(--sz-rule-strong) !important;
  color: var(--sz-ink) !important;
}

/* Body padding, consistent across modals that use the p-5 convention. */
.modal-backdrop > .relative > .p-5 { padding: var(--sz-5) !important; }

/* Field labels inside dialogs. They were 9px uppercase mono, which is a
   caption style, not a label style — hard to read and shouty. */
.modal-backdrop > .relative label {
  font-family: var(--sz-font-text) !important;
  font-size: var(--sz-text-meta) !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--sz-ink-2) !important;
}

/* Inputs and selects. */
.modal-backdrop > .relative :is(input, select, textarea) {
  border-radius: var(--sz-r-sm) !important;
  border: 1px solid var(--sz-rule-strong) !important;
  background: var(--sz-surface) !important;
  color: var(--sz-ink) !important;
  font-family: var(--sz-font-num) !important;
  font-size: var(--sz-text-body) !important;
  min-height: var(--sz-10);
}
.modal-backdrop > .relative textarea { height: auto; }
.modal-backdrop > .relative :is(input, select, textarea):focus {
  border-color: var(--sz-focus) !important;
  box-shadow: var(--sz-focus-ring) !important;
  outline: none;
}

/* Actions. Each modal previously coloured its own submit button after
   whichever accent that tool had claimed — magenta for Monte Carlo, red
   for Stress Test, orange for Holdings. One primary, one secondary. */
.modal-backdrop > .relative button:not([data-close-modal]) {
  border-radius: var(--sz-r-sm) !important;
  border: 1px solid var(--sz-rule-strong) !important;
  background: transparent !important;
  color: var(--sz-ink-2) !important;
  font-family: var(--sz-font-text) !important;
  font-size: var(--sz-text-sm) !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  min-height: var(--sz-10);
}
.modal-backdrop > .relative button:not([data-close-modal]):hover {
  background: var(--sz-surface-3) !important;
  color: var(--sz-ink) !important;
}
/* Width is layout, not hierarchy. Dialog actions use their explicit variant
   so a full-width Refresh/Reset remains secondary and compact run actions
   remain primary. */
.modal-backdrop > .relative .dashboard-btn-primary:not([data-close-modal]) {
  background: var(--sz-action) !important;
  border-color: var(--sz-action) !important;
  color: var(--sz-action-ink) !important;
  font-weight: 600 !important;
}
.modal-backdrop > .relative .dashboard-btn-primary:not([data-close-modal]):hover {
  background: var(--sz-action-hover) !important;
  border-color: var(--sz-action-hover) !important;
  color: var(--sz-action-ink) !important;
}

/* Centred dialogs should not slide up from the bottom. */
.modal-backdrop > .relative.animate-slide-up { animation: szDialogIn var(--sz-dur) var(--sz-ease); }
@keyframes szDialogIn {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: scale(1); }
}

/* Phones: use the full width, keep it centred. */
@media (max-width: 640px) {
  .modal-backdrop.flex,
  .modal-backdrop:not(.hidden) { padding: var(--sz-3) !important; }
  .modal-backdrop > .relative { max-height: 92vh; width: 100%; }
}

/* ─────────────────────────────────────────────────────────────────────
   2. TOOLS LIBRARY
   Was a right-hand drawer, which made it the only full-height surface in
   the product and clipped its last row of tools. Now a centred dialog
   that matches every other modal.
   ───────────────────────────────────────────────────────────────────── */

.dashboard-tools-host {
  position: static;
  width: 0;
  height: 0;
}

.dashboard-tools-drawer[hidden] { display: none !important; }
.dashboard-tools-drawer {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sz-6);
}

.dashboard-tools-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--sz-scrim);
  cursor: default;
}

.dashboard-tools-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(calc(var(--sz-16) * 13), 100%);
  height: auto;
  max-height: min(86dvh, calc(var(--sz-16) * 15));
  overflow: hidden;
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-lg);
  outline: 0;
  background: var(--sz-surface);
  box-shadow: var(--sz-shadow-lg);
  animation: szDialogIn var(--sz-dur) var(--sz-ease);
  overscroll-behavior: contain;
}

.dashboard-tools-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sz-5);
  padding: var(--sz-5) var(--sz-6) var(--sz-4);
  border-bottom: 1px solid var(--sz-rule);
}

.dashboard-tools-kicker {
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-tools-title {
  margin: var(--sz-1) 0 0;
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h2);
  font-weight: 600;
  line-height: var(--sz-leading-tight);
}

.dashboard-tools-description {
  margin: var(--sz-1) 0 0;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-meta);
  line-height: var(--sz-leading-body);
}

.dashboard-tools-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--sz-8);
  height: var(--sz-8);
  border: 1px solid var(--sz-rule-strong);
  border-radius: var(--sz-r-sm);
  background: transparent;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-h2);
  cursor: pointer;
}
.dashboard-tools-close:hover {
  border-color: var(--sz-ink-3);
  background: var(--sz-surface-3);
  color: var(--sz-ink);
}

.dashboard-tools-search-wrap { padding: var(--sz-4) var(--sz-6) var(--sz-3); }
.dashboard-tools-search-shell {
  display: flex;
  align-items: center;
  min-height: var(--sz-10);
  border: 1px solid var(--sz-ink-4) !important;
  border-radius: var(--sz-r-sm) !important;
  background: var(--sz-surface) !important;
  box-shadow: none !important;
}
.dashboard-tools-search-shell:focus-within {
  border-color: var(--sz-focus) !important;
  box-shadow: var(--sz-focus-ring) !important;
}
.dashboard-tools-search-shell > svg {
  flex: 0 0 auto;
  margin-left: var(--sz-3);
  color: var(--sz-ink-3);
}
.dashboard-tools-search {
  width: 100%;
  min-width: 0;
  padding: var(--sz-2) var(--sz-3) !important;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  color: var(--sz-ink) !important;
  font-family: var(--sz-font-text) !important;
  font-size: var(--sz-text-sm) !important;
}
.dashboard-tools-search::placeholder { color: var(--sz-ink-3); }
.dashboard-tools-search-clear {
  align-self: stretch;
  padding: 0 var(--sz-3);
  border: 0;
  border-left: 1px solid var(--sz-rule-strong);
  background: transparent;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-micro);
  cursor: pointer;
}
.dashboard-tools-search-status {
  display: block;
  margin-top: var(--sz-2);
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
}

.dashboard-tools-groups {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--sz-6) var(--sz-6);
}
.dashboard-tools-group { padding: var(--sz-5) 0; border-top: 1px solid var(--sz-rule); }
.dashboard-tools-group:first-child { border-top: 0; }
.dashboard-tools-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sz-3);
  margin-bottom: var(--sz-2);
}
.dashboard-tools-group-head h3 {
  margin: 0;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dashboard-tools-group-head span {
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
}

.dashboard-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sz-2);
}
.dashboard-tool-item {
  display: grid;
  grid-template-columns: var(--sz-10) minmax(0, 1fr);
  align-items: center;
  gap: var(--sz-3);
  min-height: var(--sz-16);
  padding: var(--sz-3);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface);
  color: inherit;
  font-family: var(--sz-font-text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--sz-dur-fast) var(--sz-ease),
              background var(--sz-dur-fast) var(--sz-ease);
}
.dashboard-tool-item:hover {
  border-color: var(--sz-rule-strong);
  background: var(--sz-surface-2);
}
.dashboard-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sz-10);
  height: var(--sz-10);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  background: var(--sz-surface-2);
  color: var(--sz-ink-2);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
  font-weight: 600;
}
.dashboard-tool-item > span:last-child { min-width: 0; }
.dashboard-tool-item strong,
.dashboard-tool-item small { display: block; }
.dashboard-tool-item strong {
  color: var(--sz-ink);
  font-size: var(--sz-text-sm);
  font-weight: 600;
}
.dashboard-tool-item small {
  margin-top: var(--sz-1);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
  line-height: var(--sz-leading-snug);
  white-space: normal;
}

.dashboard-tools-empty {
  padding: var(--sz-8);
  border: 1px dashed var(--sz-rule-strong);
  border-radius: var(--sz-r-md);
  color: var(--sz-ink-2);
  text-align: center;
}
.dashboard-tools-empty strong,
.dashboard-tools-empty span { display: block; }
.dashboard-tools-empty span {
  margin-top: var(--sz-1);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
}

body[data-dashboard-tools-open="true"] {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}
body[data-dashboard-tools-open="true"] .dashboard-stage { overflow: hidden !important; }
.dashboard-tools-dialog :where(button, a, input):focus-visible {
  outline: none;
  box-shadow: var(--sz-focus-ring) !important;
}

@media (max-width: 640px) {
  .dashboard-tools-drawer { padding: var(--sz-3); }
  .dashboard-tools-dialog { max-height: 92dvh; }
  .dashboard-tools-header,
  .dashboard-tools-search-wrap,
  .dashboard-tools-groups { padding-inline: var(--sz-4); }
  .dashboard-tools-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-tools-dialog,
  .dashboard-tool-item {
    animation: none;
    transition: none;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   3. CONTEXT RAIL
   Cards carried three different paddings (24/20/22, 15, 20) and two
   radii (8, 12), so nothing lined up down the column.
   ───────────────────────────────────────────────────────────────────── */

.dashboard-context-rail {
  gap: var(--sz-3);
  padding-right: var(--sz-1);
}

.dashboard-rail-card,
.dashboard-rail-hero,
.portfolio-tree-card,
.dashboard-quality-card,
.dashboard-sector-card {
  /* Beats Tailwind p-* utilities and rounded-xl/2xl on the same nodes. */
  padding: var(--sz-4) !important;
  border-radius: var(--sz-r-md) !important;
  background: var(--sz-surface);
  border: 1px solid var(--sz-rule);
  box-shadow: none;
}

/* Rail card headings — one treatment, replacing the coloured 3px bar
   that only some cards had. */
.dashboard-rail-card > :first-child:is(h2, h3, .dashboard-rail-title) {
  font-size: var(--sz-text-h3);
  font-weight: 600;
  color: var(--sz-ink);
  margin: 0 0 var(--sz-3);
}

/* ─────────────────────────────────────────────────────────────────────
   4. STATUS CHIPS
   The dashboard shipped TRADING / BUY RESEARCH / PLAYBOOK / PRIORITY /
   AGING·11H AGO / FRESH·JUST NOW / PRE-MKT / 26% COVERED as saturated
   pills competing with the figures. They are metadata; they now read as
   metadata. Colour is kept only where it means stale or breached.
   ───────────────────────────────────────────────────────────────────── */

.sz-chip,
.dashboard-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sz-1);
  padding: 2px var(--sz-2);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  background: transparent;
  color: var(--sz-ink-3);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-micro);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.sz-chip[data-tone="stale"],
.sz-chip[data-tone="caution"] { color: var(--sz-caution); border-color: currentColor; }
.sz-chip[data-tone="pos"]     { color: var(--sz-pos);     border-color: currentColor; }
.sz-chip[data-tone="neg"]     { color: var(--sz-neg);     border-color: currentColor; }

/* ─────────────────────────────────────────────────────────────────────
   5. FIGURES
   A money value must never be clipped. "Trim ESGU by $15,2…" is not a
   number. Where a figure cannot fit, the label wraps instead.
   ───────────────────────────────────────────────────────────────────── */

.stat-number,
.quick-metric-value,
.trader-summary-value,
.dashboard-metric-value,
[data-figure] {
  font-family: var(--sz-font-num);
  font-variant-numeric: tabular-nums lining-nums;
  /* Beats the `text-overflow: ellipsis; white-space: nowrap` set on
     .quick-metric-value and .trader-summary-value. */
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Tables of figures: right-align and lock the digit width. */
.dashboard-shell td[class*="text-right"],
.dashboard-shell th[class*="text-right"] {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Profit/loss is a product-wide semantic contract. Zero and unavailable
   values intentionally stay neutral instead of implying a gain. */
.sz-value-profit,
[data-financial-tone="profit"] {
  color: var(--sz-pos) !important;
}
.sz-value-loss,
[data-financial-tone="loss"] {
  color: var(--sz-neg) !important;
}
.sz-value-neutral,
[data-financial-tone="neutral"] {
  color: var(--sz-ink-3) !important;
}
.sz-financial-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: calc(var(--sz-16) + var(--sz-3));
  padding: var(--sz-1) var(--sz-2);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  background: transparent;
  font-family: var(--sz-font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 600;
}
.sz-financial-badge.sz-value-profit { border-color: var(--sz-pos-wash); background: var(--sz-pos-wash); }
.sz-financial-badge.sz-value-loss { border-color: var(--sz-neg-wash); background: var(--sz-neg-wash); }

/* ─────────────────────────────────────────────────────────────────────
   6. CONTROLS
   ───────────────────────────────────────────────────────────────────── */

.btn-primary,
.dashboard-btn-primary {
  padding: var(--sz-2) var(--sz-4);
  border-radius: var(--sz-r-sm);
  border: 1px solid transparent;
  background: var(--sz-action);
  color: var(--sz-action-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-sm);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background var(--sz-dur-fast) var(--sz-ease);
}
.btn-primary:hover,
.dashboard-btn-primary:hover { background: var(--sz-action-hover); transform: none; opacity: 1; }
.btn-full { width: 100%; }

.btn-ghost,
.dashboard-btn-ghost,
.dashboard-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sz-2);
  padding: var(--sz-2) var(--sz-3);
  border-radius: var(--sz-r-sm);
  border: 1px solid var(--sz-rule);
  background: transparent;
  color: var(--sz-ink-2);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
}
.btn-ghost:hover,
.dashboard-btn-ghost:hover,
.dashboard-btn-secondary:hover {
  background: var(--sz-surface-3);
  border-color: var(--sz-rule-strong);
  color: var(--sz-ink);
}

.form-input,
.dashboard-input {
  border-radius: var(--sz-r-sm);
  border: 1px solid var(--sz-ink-4);
  background: var(--sz-surface);
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-body);
  padding: var(--sz-2) var(--sz-3);
}
.form-input::placeholder,
.dashboard-input::placeholder { color: var(--sz-ink-4); }
.form-input:focus,
.dashboard-input:focus {
  border-color: var(--sz-focus);
  box-shadow: 0 0 0 3px var(--sz-brand-wash);
  outline: none;
}

/* ─────────────────────────────────────────────────────────────────────
   7. DECORATION REMOVAL
   Effects that read as decoration rather than information.
   ───────────────────────────────────────────────────────────────────── */

/* Three coloured radial glows (emerald, violet, blue) behind the whole
   dashboard. They tinted every neutral surface sitting on top. */
body.dashboard-shell {
  background-image: none !important;
}

.neon-text, .orange-glow, .glow-border { text-shadow: none; box-shadow: none; }
.scanline { display: none !important; }

/* ─────────────────────────────────────────────────────────────────────
   8. SECTOR MIX
   This section used to be a two-column ledger (accounts | sector mix).
   The accounts panel was removed, so collapse the grid rather than leave
   the remaining panel in a 1.4fr track with dead space beside it.
   Beats the two-column !important rules in wealth.css and brokerage.css.
   ───────────────────────────────────────────────────────────────────── */
.dashboard-account-ledger {
  grid-template-columns: 1fr !important;
  padding: var(--sz-5) !important;
}
.tracker-sector-summary {
  padding: 0 !important;
  padding-left: 0 !important;
  border-right: 0 !important;
  border-left: 0 !important;
}
/* The sector list reads better as columns than as one long column. */
.tracker-sector-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sz-2);
}

/* ─────────────────────────────────────────────────────────────────────
   9. CONTEXT RAIL — CONTAINMENT AND RHYTHM
   ───────────────────────────────────────────────────────────────────── */

/* The sector donut is a Chart.js canvas with maintainAspectRatio:false in a
   fixed-height wrapper. While Chart.js settles on a size — and at narrow rail
   widths — the canvas can paint taller than its wrapper. Both the wrapper and
   the card were overflow:visible, so it spilled over the card below and the
   two cards read as one broken stack.

   Clip the canvas rather than the card: putting overflow:hidden on every rail
   card cut the last row off list cards such as Portfolios. */
.dashboard-rail-card canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Clip at the chart wrapper — the one box that actually needs it. */
.dashboard-sector-card .relative[class*="h-["],
.dashboard-rail-card .relative[class*="h-["] {
  overflow: hidden;
  margin-block: var(--sz-1);
}

/* Rail rhythm: one gap value, and cards never touch. */
.dashboard-context-rail > * + * { margin-top: 0; }
.dashboard-context-rail { row-gap: var(--sz-3); }

/* ─────────────────────────────────────────────────────────────────────
   10. NO CLIPPED VALUES
   "Trim ESGU by $15,26…" and "BREACH · 5 fail / 0 wa…" are not readable
   values. These lines carry the actual instruction, so they wrap onto a
   second line rather than losing their tail to an ellipsis.
   ───────────────────────────────────────────────────────────────────── */
.quick-metric-sub,
.dashboard-metric-sub,
.tracker-summary-subline {
  white-space: normal !important;
  text-overflow: clip !important;
  overflow: visible !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;          /* two lines, then stop — no runaway cards */
  overflow: hidden;
  line-height: var(--sz-leading-snug);
}

/* ─────────────────────────────────────────────────────────────────────
   11. CONTEXT RAIL — THE CARD OVERLAP
   The rail is a column flex container holding two stacked sidebars, and
   on desktop it is height-constrained (height:100%; overflow-y:auto).

   brokerage.css set `.dashboard-sidebar { min-height:0 !important;
   overflow:visible !important }`. In a column flex container that is the
   worst pairing available: min-height:0 lets each sidebar shrink BELOW
   its content, and overflow:visible then paints the overflow outside the
   box — directly on top of the sidebar beneath it. The left sidebar was
   resolving to 614px while its cards needed ~900px, so Sector Allocation
   was drawn straight through Action Queue.

   Refusing to shrink is the fix: the sidebars keep their content height
   and the rail — which already owns overflow-y:auto — does the scrolling.
   ───────────────────────────────────────────────────────────────────── */
.dashboard-context-rail-body > .dashboard-sidebar {
  flex: 0 0 auto !important;
  min-height: min-content !important;
}

/* Consistent vertical rhythm between rail cards, and between the two
   sidebars, now that they are no longer being squeezed. */
.dashboard-context-rail-body > .dashboard-sidebar + .dashboard-sidebar {
  margin-top: var(--sz-3);
}

/* ─────────────────────────────────────────────────────────────────────
   12. BRAND LOCKUP
   Lives here rather than in brokerage.css so non-dashboard pages can use
   the same mark. The app previously showed two different logos: a "Stackz"
   wordmark on the dashboard and an "SA" tile with "STACKZAI" everywhere
   else, which is the fastest way to make one product look like three.
   ───────────────────────────────────────────────────────────────────── */
.dashboard-brand { min-width: max-content; text-decoration: none; }

.dashboard-brand-mark {
  position: relative;
  display: inline-flex;
  width: calc(var(--sz-6) + var(--sz-1));
  height: calc(var(--sz-6) + var(--sz-1));
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: var(--sz-r-sm);
  background: var(--sz-brand);
  color: var(--sz-brand-ink);
}
.dashboard-brand-mark span {
  position: absolute;
  width: var(--sz-3);
  height: var(--sz-1);
  border-radius: var(--sz-r-sm);
  background: currentColor;
  transform: skewX(-18deg);
}
.dashboard-brand-mark span:first-child { transform: translateY(calc(var(--sz-1) * -1)) skewX(-18deg); }
.dashboard-brand-mark span:last-child  { transform: translateY(var(--sz-1)) skewX(-18deg); }

.dashboard-brand-name {
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* The per-page bars (coach, community, x-ray) get the shared surface too. */
.app-shared-nav,
.top-bar,
.community-topbar {
  border-bottom: 1px solid var(--sz-rule);
  background: color-mix(in srgb, var(--sz-paper) 92%, transparent);
  -webkit-backdrop-filter: blur(var(--sz-blur));
  backdrop-filter: blur(var(--sz-blur));
}

/* ─────────────────────────────────────────────────────────────────────
   13. TOPBAR ACTIONS
   `.dashboard-action-primary` was resolving to brand-on-brand — the
   computed style was color:rgb(86,189,136) over background:rgb(86,189,136),
   a 1:1 contrast ratio, so the "Analyze" button rendered as a blank pill.
   Three stylesheets each set this button's colours; this settles it.
   ───────────────────────────────────────────────────────────────────── */
.dashboard-action-btn {
  height: 30px;
  padding: 0 var(--sz-3) !important;
  border-radius: var(--sz-r-sm) !important;
  font-family: var(--sz-font-text) !important;
  font-size: var(--sz-text-meta) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  transition: background var(--sz-dur-fast) var(--sz-ease),
              border-color var(--sz-dur-fast) var(--sz-ease);
}

/* Primary is ink, per the design: colour is reserved for gain and loss. */
.dashboard-action-primary {
  border: 1px solid var(--sz-action) !important;
  background: var(--sz-action) !important;
  color: var(--sz-action-ink) !important;
}
.dashboard-action-primary:hover {
  border-color: var(--sz-action-hover) !important;
  background: var(--sz-action-hover) !important;
  color: var(--sz-action-ink) !important;
}

.dashboard-action-secondary {
  border: 1px solid var(--sz-rule-strong) !important;
  background: transparent !important;
  color: var(--sz-ink-2) !important;
}
.dashboard-action-secondary:hover {
  background: var(--sz-surface-2) !important;
  color: var(--sz-ink) !important;
}

/* Navigation carries destinations; workspace chrome carries operations. The
   previous single-row header overflowed at ordinary laptop widths because it
   combined both concerns. */
.dashboard-primary-nav {
  gap: var(--sz-1) !important;
  padding: var(--sz-1) !important;
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface-2);
}
.dashboard-nav-link {
  min-height: var(--sz-8) !important;
  padding-inline: var(--sz-3) !important;
  border-radius: var(--sz-r-sm) !important;
  color: var(--sz-ink-3) !important;
}
.dashboard-nav-link:hover {
  background: var(--sz-surface-3) !important;
  color: var(--sz-ink) !important;
}
.dashboard-nav-link.is-active {
  border-color: var(--sz-rule) !important;
  background: var(--sz-surface) !important;
  color: var(--sz-ink) !important;
  box-shadow: var(--sz-shadow-sm) !important;
}

.dashboard-workspace-bar-inner {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important;
}
.dashboard-workspace-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center;
  gap: var(--sz-2) !important;
}
.dashboard-workspace-operations {
  display: inline-flex;
  align-items: center;
  gap: var(--sz-1);
  padding: var(--sz-1);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface-2);
}
.dashboard-operation-btn {
  display: inline-flex !important;
  min-width: var(--sz-10);
  min-height: var(--sz-10);
  align-items: center;
  justify-content: center;
  gap: var(--sz-2);
  padding: 0 var(--sz-3);
  border: 1px solid transparent;
  border-radius: var(--sz-r-sm);
  background: transparent;
  color: var(--sz-ink-2);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-meta);
  font-weight: 600;
  white-space: nowrap;
}
.dashboard-operation-btn:hover {
  border-color: var(--sz-rule);
  background: var(--sz-surface-3);
  color: var(--sz-ink);
}
.dashboard-operation-primary {
  border-color: var(--sz-action) !important;
  background: var(--sz-action) !important;
  color: var(--sz-action-ink) !important;
}
.dashboard-operation-primary:hover {
  border-color: var(--sz-action-hover) !important;
  background: var(--sz-action-hover) !important;
  color: var(--sz-action-ink) !important;
}
.dashboard-workspace-operations #pdfBtn { display: inline-flex !important; }

.per-btn {
  min-width: var(--sz-10) !important;
  min-height: var(--sz-8) !important;
  padding: 0 var(--sz-2) !important;
  border: 1px solid transparent !important;
  border-radius: var(--sz-r-sm) !important;
  background: transparent !important;
  color: var(--sz-ink-3) !important;
  font-family: var(--sz-font-num) !important;
  font-size: var(--sz-text-micro) !important;
  font-weight: 600 !important;
}
.per-btn:hover { background: var(--sz-surface-3) !important; color: var(--sz-ink) !important; }
.per-btn.active,
.per-btn[aria-pressed="true"] {
  border-color: var(--sz-rule) !important;
  background: var(--sz-surface) !important;
  color: var(--sz-ink) !important;
  box-shadow: var(--sz-shadow-sm) !important;
}

.app-nav-profile {
  display: inline-flex;
  width: var(--sz-8);
  height: var(--sz-8);
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  color: var(--sz-ink-3);
  text-decoration: none;
}
.app-nav-profile:hover,
.app-nav-profile.is-active {
  border-color: var(--sz-rule-strong);
  background: var(--sz-surface-2);
  color: var(--sz-ink);
}
.app-nav-divider { width: 1px; height: var(--sz-5); margin-inline: var(--sz-1); background: var(--sz-rule); }
.app-nav-cta { width: auto; }
[data-theme-toggle] .theme-ico-moon { display: none; }
html.theme-light [data-theme-toggle] .theme-ico-sun { display: none; }
html.theme-light [data-theme-toggle] .theme-ico-moon { display: block; }

@media (max-width: 1180px) and (min-width: 1024px) {
  .dashboard-workspace-bar-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: var(--sz-5) !important;
  }
  .dashboard-operation-secondary .dashboard-operation-label { display: none; }
  .dashboard-operation-secondary { padding-inline: var(--sz-2); }
}

@media (max-width: 1023px) {
  .dashboard-workspace-actions {
    grid-template-columns: minmax(0, 1fr) auto !important;
    margin-top: var(--sz-5) !important;
  }
  .dashboard-ticker-search { grid-column: 1 / -1 !important; }
  .dashboard-workspace-operations { grid-column: 1; min-width: 0; }
  .dashboard-tools-button {
    display: inline-flex !important;
    grid-column: 2 !important;
    grid-row: auto !important;
    min-height: var(--sz-12) !important;
  }
  .dashboard-operation-btn { flex: 1 1 auto; }
  .dashboard-operation-secondary .dashboard-operation-label { display: none; }

  .mobile-tab-bar {
    height: calc(var(--sz-16) + env(safe-area-inset-bottom, 0px)) !important;
    justify-content: center !important;
    gap: var(--sz-1);
    padding: var(--sz-2) var(--sz-3) env(safe-area-inset-bottom, 0px) !important;
    border-color: var(--sz-rule) !important;
    background: color-mix(in srgb, var(--sz-surface) 94%, transparent) !important;
  }
  .mobile-tab {
    max-width: calc(var(--sz-16) + var(--sz-10));
    min-width: 0;
    min-height: var(--sz-12);
    gap: 0 !important;
    border-radius: var(--sz-r-sm);
    color: var(--sz-ink-3) !important;
  }
  .mobile-tab.active {
    background: var(--sz-surface-3);
    color: var(--sz-ink) !important;
  }
  .mobile-tab.active svg { filter: none !important; }
  .mobile-tab span { font-size: var(--sz-text-micro) !important; letter-spacing: 0 !important; }
}

@media (max-width: 520px) {
  .dashboard-workspace-actions { gap: var(--sz-2) !important; }
  .dashboard-workspace-operations { justify-content: stretch; }
  .dashboard-operation-btn { padding-inline: var(--sz-2); }
  .dashboard-operation-primary .dashboard-operation-label { display: inline; }
  .dashboard-tools-button { padding-inline: var(--sz-3) !important; }
}

/* ─────────────────────────────────────────────────────────────────────
   14. STOCK X-RAY (/stock/<symbol>)
   The research page kept its own header, its own chart panel styling and
   a viewport-locked layout. It now uses the shared chrome.
   ───────────────────────────────────────────────────────────────────── */

.xray-topbar { position: sticky; top: 0; }

/* The header is capped at the shared 1152px column while main ran full-bleed,
   so the brand sat in the middle of the window and the charts started at the
   very edge. Same column for both. */
#mainContent {
  width: 100%;
  max-width: 1152px;
  margin-inline: auto;
}

.xray-load-status {
  color: var(--sz-ink-3);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-meta);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.xray-chart-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--sz-4);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface);
  box-shadow: none;
}
/* Chart.js needs a sized box; the canvas takes what is left under the title. */
.xray-chart-panel > canvas { flex: 1 1 auto; min-height: 0; }

.xray-panel-title {
  margin: 0 0 var(--sz-2);
  color: var(--sz-ink-2);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-meta);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Tab strip across the research sections. */
.xray-tab, .tab-btn {
  border-radius: var(--sz-r-sm);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* The page painted a grid pattern behind everything; on the shared paper
   ground it just added noise behind dense tables and figures. */
body.grid-bg { background-image: none !important; background: var(--sz-paper); }

/* The instrument name is the page's subject — it gets the page-title weight
   rather than the 18px uppercase-tracked treatment it had. */
.xray-stock-name {
  margin: 0;
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: var(--sz-leading-tight);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .xray-stock-name { white-space: normal; }
}

/* ═════════════════════════════════════════════════════════════════════
   15. PAGE SHELL
   One container width, one header alignment, one footer — so navigating
   between surfaces does not move the page's edges.
   ═════════════════════════════════════════════════════════════════════ */

.sz-container,
.app-shared-nav-inner,
.dashboard-topbar-inner,
.lp-hero-inner,
.lp-proof-inner,
#mainContent,
.container {
  width: 100%;
  max-width: var(--sz-container);
  margin-inline: auto;
  padding-inline: var(--sz-gutter);
}

/* The dashboard runs a three-column workspace and is deliberately full-bleed;
   its topbar still aligns to the shared column. */
body.dashboard-shell .dashboard-stage { max-width: none; }

@media (max-width: 640px) {
  :root { --sz-gutter: var(--sz-4); }
}

/* ── Footer ───────────────────────────────────────────────────────── */
.sz-footer {
  margin-top: auto;
  border-top: 1px solid var(--sz-rule);
  background: var(--sz-paper);
}
.sz-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sz-4);
  padding-block: var(--sz-8);
}
.sz-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sz-4);
}
.sz-footer-links a {
  color: var(--sz-ink-3);
  font-size: var(--sz-text-sm);
  text-decoration: none;
}
.sz-footer-links a:hover { color: var(--sz-ink); text-decoration: underline; }
.sz-footer-note {
  margin: 0 0 0 auto;
  color: var(--sz-ink-4);
  font-size: var(--sz-text-meta);
}
@media (max-width: 720px) {
  .sz-footer-note { margin-left: 0; }
}

/* ═════════════════════════════════════════════════════════════════════
   16. LANDING PAGE
   The search is the product's front door: it opens real research with no
   account, so it is the only thing competing for attention above the fold.
   ═════════════════════════════════════════════════════════════════════ */

.lp-hero { padding-block: var(--sz-16) var(--sz-12); }

.lp-eyebrow {
  margin: 0 0 var(--sz-4);
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-meta);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.lp-title {
  margin: 0 0 var(--sz-4);
  max-width: 18ch;
  color: var(--sz-ink);
  font-family: var(--sz-font-display);   /* the one serif moment in the product */
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lp-sub {
  margin: 0 0 var(--sz-8);
  max-width: 52ch;
  color: var(--sz-ink-2);
  font-size: 1.0625rem;
  line-height: var(--sz-leading-body);
}

/* ── Search ───────────────────────────────────────────────────────── */
.lp-search {
  display: flex;
  align-items: center;
  gap: var(--sz-2);
  width: 100%;
  max-width: 34rem;
  padding: var(--sz-2);
  border: 1px solid var(--sz-rule-strong);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface);
  transition: border-color var(--sz-dur-fast) var(--sz-ease),
              box-shadow var(--sz-dur-fast) var(--sz-ease);
}
.lp-search:focus-within {
  border-color: var(--sz-focus);
  box-shadow: 0 0 0 3px var(--sz-brand-wash);
}
.lp-search-icon { flex: 0 0 auto; margin-left: var(--sz-2); color: var(--sz-ink-3); }
.lp-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--sz-2);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sz-ink);
  font-family: var(--sz-font-num);
  font-size: 1rem;
  letter-spacing: .02em;
}
.lp-search-input::placeholder { color: var(--sz-ink-4); letter-spacing: 0; }
.lp-search-go {
  flex: 0 0 auto;
  padding: var(--sz-2) var(--sz-4);
  border: 1px solid var(--sz-action);
  border-radius: var(--sz-r-sm);
  background: var(--sz-action);
  color: var(--sz-action-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-sm);
  font-weight: 600;
  cursor: pointer;
}
.lp-search-go:hover { background: var(--sz-action-hover); border-color: var(--sz-action-hover); }

.lp-search-error {
  margin: var(--sz-2) 0 0;
  color: var(--sz-neg);
  font-size: var(--sz-text-sm);
}
.lp-hint {
  margin: var(--sz-3) 0 0;
  color: var(--sz-ink-3);
  font-size: var(--sz-text-sm);
}

.lp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sz-2);
  margin-top: var(--sz-5);
}
.lp-chip {
  padding: var(--sz-1) var(--sz-3);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  color: var(--sz-ink-2);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-sm);
  text-decoration: none;
}
.lp-chip:hover { border-color: var(--sz-rule-strong); background: var(--sz-surface-2); color: var(--sz-ink); }

/* ── Proof strip ──────────────────────────────────────────────────── */
.lp-proof { border-top: 1px solid var(--sz-rule); padding-block: var(--sz-10); }
.lp-proof-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--sz-8);
}
.lp-proof-item h2,
.lp-proof-item h3 {
  margin: 0 0 var(--sz-2);
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h3);
  font-weight: 600;
}
.lp-proof-item p {
  margin: 0;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-sm);
  line-height: var(--sz-leading-body);
}

/* ── Fair-value verdict ──────────────────────────────────────────────
   Only a corroborated verdict is coloured. "Inconclusive" and "Not enough
   data" stay neutral so the badge never implies a view the model does not
   hold — this page is public and investment-adjacent. */
.verdict-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sz-2);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-sm);
  background: transparent;
  color: var(--sz-ink-3);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.verdict-badge.verdict-pos     { color: var(--sz-pos); border-color: currentColor; background: var(--sz-pos-wash); }
.verdict-badge.verdict-neg     { color: var(--sz-neg); border-color: currentColor; background: var(--sz-neg-wash); }
.verdict-badge.verdict-neutral { color: var(--sz-ink-3); border-color: var(--sz-rule); background: transparent; }

.fair-assumption {
  position: relative;
  padding-left: var(--sz-3);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
  line-height: var(--sz-leading-snug);
}
.fair-assumption::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 4px; height: 1px;
  background: var(--sz-ink-4);
}

/* ═════════════════════════════════════════════════════════════════════
   17. DATA PRESENTATION FOUNDATION
   Tremor-inspired composition translated to semantic HTML and the Stackz
   token system. These primitives describe information anatomy, not a new
   visual namespace.
   ═════════════════════════════════════════════════════════════════════ */

.sz-skip-link {
  position: fixed;
  top: var(--sz-2);
  left: var(--sz-2);
  z-index: 100;
  padding: var(--sz-2) var(--sz-3);
  border: 1px solid var(--sz-focus);
  border-radius: var(--sz-r-sm);
  background: var(--sz-action);
  color: var(--sz-action-ink);
  font-size: var(--sz-text-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(calc(-100% - var(--sz-4)));
  transition: transform var(--sz-dur-fast) var(--sz-ease);
}
.sz-skip-link:focus { transform: translateY(0); box-shadow: var(--sz-focus-ring); outline: none; }

.sz-page {
  min-height: 100dvh;
  background: var(--sz-paper);
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
}
.sz-page-main { padding-block: var(--sz-8) var(--sz-12); }
.sz-page-main:focus { outline: none; }
.sz-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sz-6);
  margin-bottom: var(--sz-8);
}
.sz-page-heading { min-width: 0; }
.sz-page-kicker,
.sz-section-kicker {
  margin: 0 0 var(--sz-2);
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sz-page-title {
  margin: 0;
  color: var(--sz-ink);
  font-family: var(--sz-font-display);
  font-size: clamp(var(--sz-text-h1), 4vw, var(--sz-text-display));
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: var(--sz-leading-tight);
}
.sz-page-summary {
  max-width: 68ch;
  margin: var(--sz-3) 0 0;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-body);
  line-height: var(--sz-leading-body);
}
.sz-page-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: var(--sz-2); }
.sz-page-meta,
.sz-data-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sz-2) var(--sz-4);
  margin-top: var(--sz-3);
  color: var(--sz-ink-3);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-micro);
  font-variant-numeric: tabular-nums lining-nums;
}

.sz-section { margin-top: var(--sz-8); }
.sz-section-head,
.sz-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sz-4);
  margin-bottom: var(--sz-4);
}
.sz-section-title,
.sz-chart-title {
  margin: 0;
  color: var(--sz-ink);
  font-family: var(--sz-font-text);
  font-size: var(--sz-text-h3);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: var(--sz-leading-snug);
}
.sz-section-description,
.sz-chart-question {
  max-width: 72ch;
  margin: var(--sz-1) 0 0;
  color: var(--sz-ink-3);
  font-size: var(--sz-text-sm);
  line-height: var(--sz-leading-body);
}

.sz-panel,
.sz-kpi,
.sz-chart-frame,
.sz-table-frame,
.sz-callout,
.sz-data-state {
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface);
  box-shadow: none;
}
.sz-panel { padding: var(--sz-5); }
.sz-panel-inset {
  padding: var(--sz-4);
  border: 1px solid var(--sz-rule-soft);
  border-radius: var(--sz-r-sm);
  background: var(--sz-surface-2);
}

.sz-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(calc(var(--sz-16) * 3), 1fr));
  gap: var(--sz-3);
}
.sz-kpi { min-width: 0; padding: var(--sz-4); }
.sz-kpi-label {
  margin: 0;
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.sz-kpi-value {
  margin: var(--sz-2) 0 0;
  color: var(--sz-ink);
  font-family: var(--sz-font-num);
  font-size: var(--sz-text-h2);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 600;
  line-height: var(--sz-leading-tight);
  overflow-wrap: anywhere;
}
.sz-kpi-comparison {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--sz-2);
  margin-top: var(--sz-2);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-meta);
}
.sz-kpi-delta {
  font-family: var(--sz-font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 600;
}

.sz-chart-frame { min-width: 0; padding: var(--sz-4); }
.sz-chart-plot {
  position: relative;
  min-height: calc(var(--sz-16) * 3);
  overflow: hidden;
}
.sz-chart-plot[data-size="tall"] { height: calc(var(--sz-16) * 4); }
.sz-chart-plot > canvas { display: block; max-width: 100%; max-height: 100%; }
.sz-chart-summary {
  margin-top: var(--sz-4);
  padding-top: var(--sz-3);
  border-top: 1px solid var(--sz-rule-soft);
  color: var(--sz-ink-2);
  font-size: var(--sz-text-sm);
  line-height: var(--sz-leading-body);
}
.sz-chart-summary strong { color: var(--sz-ink); font-weight: 600; }
.dashboard-chart-summary { margin-top: var(--sz-2); padding-top: var(--sz-2); font-size: var(--sz-text-micro); }

.sz-filter-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--sz-3);
  padding: var(--sz-3);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface);
}
.sz-filter-field { display: grid; gap: var(--sz-1); min-width: calc(var(--sz-16) * 2); }
.sz-filter-label {
  color: var(--sz-ink-2);
  font-size: var(--sz-text-micro);
  font-weight: 600;
}
.sz-filter-summary { flex: 1 1 100%; color: var(--sz-ink-3); font-size: var(--sz-text-meta); }
.sz-filter-actions { display: flex; gap: var(--sz-2); margin-left: auto; }

.sz-segmented,
.sz-tab-list {
  display: inline-flex;
  align-items: center;
  gap: var(--sz-1);
  padding: var(--sz-1);
  border: 1px solid var(--sz-rule);
  border-radius: var(--sz-r-md);
  background: var(--sz-surface-2);
}
.sz-segmented button,
.sz-tab-list [role="tab"] {
  min-height: var(--sz-8);
  padding: var(--sz-1) var(--sz-3);
  border: 1px solid transparent;
  border-radius: var(--sz-r-sm);
  background: transparent;
  color: var(--sz-ink-3);
  font-size: var(--sz-text-sm);
  font-weight: 500;
}
.sz-segmented button:hover,
.sz-tab-list [role="tab"]:hover { background: var(--sz-surface-3); color: var(--sz-ink); }
.sz-segmented button[aria-pressed="true"],
.sz-tab-list [role="tab"][aria-selected="true"] {
  border-color: var(--sz-rule);
  background: var(--sz-surface);
  color: var(--sz-ink);
  box-shadow: var(--sz-shadow-sm);
}

.sz-table-frame { min-width: 0; overflow: hidden; }
.sz-table-scroll { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.sz-table { width: 100%; border-collapse: collapse; }
.sz-table th,
.sz-table td { padding: var(--sz-3) var(--sz-4); border-bottom: 1px solid var(--sz-rule-soft); text-align: left; vertical-align: top; }
.sz-table tbody tr:last-child > * { border-bottom: 0; }
.sz-table td[data-value],
.sz-table th[data-value] {
  text-align: right;
  font-family: var(--sz-font-num);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.sz-table tbody tr:hover { background: var(--sz-surface-2); }
.sz-sort-button { display: inline-flex; align-items: center; gap: var(--sz-1); color: inherit; font: inherit; }
.sz-sort-button[aria-sort="ascending"]::after { content: "↑"; }
.sz-sort-button[aria-sort="descending"]::after { content: "↓"; }

.sz-bar-list { display: grid; gap: var(--sz-3); }
.sz-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sz-2) var(--sz-4); align-items: baseline; }
.sz-bar-label { min-width: 0; color: var(--sz-ink-2); font-size: var(--sz-text-sm); overflow-wrap: anywhere; }
.sz-bar-value { color: var(--sz-ink); font-family: var(--sz-font-num); font-size: var(--sz-text-sm); font-variant-numeric: tabular-nums lining-nums; }
.sz-bar-track { grid-column: 1 / -1; height: var(--sz-1); border-radius: var(--sz-r-full); background: var(--sz-surface-3); overflow: hidden; }
.sz-bar-fill { width: var(--sz-bar-value, 0%); height: 100%; border-radius: inherit; background: var(--sz-ink-3); }
.sz-bar-fill[data-classification="unclassified"] { background: var(--sz-caution); }

/* Proportional composition strip. Unlike the equal-cell category marker
   below, every segment owns its exact share of the full 100% denominator. */
.sz-composition-bar {
  display: flex;
  width: 100%;
  min-height: var(--sz-3);
  overflow: hidden;
  border-radius: var(--sz-r-full);
  background: var(--sz-surface-3);
}
.sz-composition-segment {
  flex: 0 0 var(--sz-composition-share, 0%);
  min-width: 0;
  border-right: 1px solid var(--sz-surface);
  background: var(--sz-cat-1);
}
.sz-composition-segment:last-child { border-right: 0; }
.sz-composition-segment[data-category-index="1"], .sz-composition-swatch[data-category-index="1"] { background: var(--sz-cat-2); }
.sz-composition-segment[data-category-index="2"], .sz-composition-swatch[data-category-index="2"] { background: var(--sz-cat-3); }
.sz-composition-segment[data-category-index="3"], .sz-composition-swatch[data-category-index="3"] { background: var(--sz-cat-4); }
.sz-composition-segment[data-category-index="4"], .sz-composition-swatch[data-category-index="4"] { background: var(--sz-cat-5); }
.sz-composition-segment[data-category-index="5"], .sz-composition-swatch[data-category-index="5"] { background: var(--sz-cat-6); }
.sz-composition-segment[data-category-index="6"], .sz-composition-swatch[data-category-index="6"] { background: var(--sz-cat-7); }
.sz-composition-segment[data-category-index="7"], .sz-composition-swatch[data-category-index="7"] { background: var(--sz-cat-8); }
.sz-composition-segment[data-classification="unclassified"],
.sz-composition-swatch[data-classification="unclassified"] { background: var(--sz-caution); }
.sz-composition-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(calc(var(--sz-16) * 3), 1fr));
  gap: var(--sz-2) var(--sz-4);
  margin: var(--sz-4) 0 0;
  padding: 0;
  list-style: none;
}
.sz-composition-legend li {
  display: grid;
  grid-template-columns: var(--sz-3) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sz-2);
  min-width: 0;
  color: var(--sz-ink-2);
  font-size: var(--sz-text-sm);
}
.sz-composition-legend strong {
  color: var(--sz-ink);
  font-family: var(--sz-font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 500;
}
.sz-composition-swatch {
  width: var(--sz-3);
  height: var(--sz-3);
  border-radius: var(--sz-r-sm);
  background: var(--sz-cat-1);
}

.sz-table-subtext {
  display: block;
  margin-top: var(--sz-1);
  color: var(--sz-ink-3);
  font-size: var(--sz-text-micro);
  font-weight: 400;
}

.sz-category-bar { position: relative; display: grid; grid-template-columns: repeat(var(--sz-category-count, 4), 1fr); gap: var(--sz-1); }
.sz-category-segment { height: var(--sz-2); border-radius: var(--sz-r-sm); background: var(--sz-surface-3); }
.sz-category-marker { position: absolute; top: calc(var(--sz-2) + var(--sz-1)); left: var(--sz-category-position, 0%); width: var(--sz-1); height: var(--sz-2); border-radius: var(--sz-r-full); background: var(--sz-ink); transform: translateX(-50%); }

.sz-tracker { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--sz-4), 1fr)); gap: var(--sz-1); }
.sz-tracker-step { min-width: var(--sz-4); height: var(--sz-2); border-radius: var(--sz-r-sm); background: var(--sz-surface-3); }
.sz-tracker-step[data-status="ok"] { background: var(--sz-pos); }
.sz-tracker-step[data-status="warning"] { background: var(--sz-caution); }
.sz-tracker-step[data-status="error"] { background: var(--sz-neg); }

.sz-callout,
.sz-data-state { padding: var(--sz-4); }

/* Notes are typographic, not decorated.
 *
 * These carried a thick tone bar and a tinted wash, and because a note often
 * sits inside a panel that is itself a note, the result was tinted boxes
 * nested two and three deep. Tone now rides on the title and the border,
 * which reads at a glance without turning the page into stacked containers. */
.sz-callout[data-tone="caution"] .sz-callout-title,
.sz-data-state[data-state="stale"] .sz-data-state-title,
.sz-data-state[data-state="partial"] .sz-data-state-title { color: var(--sz-caution); }
.sz-callout[data-tone="caution"],
.sz-data-state[data-state="stale"],
.sz-data-state[data-state="partial"] { border-color: var(--sz-caution); }
.sz-callout[data-tone="danger"] .sz-callout-title,
.sz-data-state[data-state="error"] .sz-data-state-title { color: var(--sz-neg); }
.sz-callout[data-tone="danger"],
.sz-data-state[data-state="error"] { border-color: var(--sz-neg); }

/* A note inside a note is one note. Nesting keeps the text and drops the
   second frame entirely. */
.sz-callout .sz-callout,
.sz-callout .sz-data-state,
.sz-data-state .sz-callout,
.sz-data-state .sz-data-state,
.sz-panel-inset .sz-callout,
.sz-panel-inset .sz-data-state {
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.sz-callout-title,
.sz-data-state-title { margin: 0; color: var(--sz-ink); font-size: var(--sz-text-sm); font-weight: 600; }
.sz-callout-copy,
.sz-data-state-copy { margin: var(--sz-1) 0 0; color: var(--sz-ink-2); font-size: var(--sz-text-sm); line-height: var(--sz-leading-body); }
.sz-data-state-actions { display: flex; flex-wrap: wrap; gap: var(--sz-2); margin-top: var(--sz-3); }
.sz-data-state[data-state="loading"] { min-height: calc(var(--sz-16) * 2); }
.sz-data-state[data-state="empty"],
.sz-data-state[data-state="offline"],
.sz-data-state[data-state="gated"] { background: var(--sz-surface-2); }
.sz-tool-output[data-state="result"] { padding: 0; border: 0; background: transparent; }
.sz-tool-output[data-rendered-result="true"] { padding: 0; border: 0; background: transparent; }

.sz-skeleton { position: relative; overflow: hidden; border-radius: var(--sz-r-sm); background: var(--sz-surface-3); color: transparent !important; }
.sz-skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--sz-surface-4), transparent); transform: translateX(-100%); animation: szSkeleton var(--sz-dur) var(--sz-ease) infinite; }
@keyframes szSkeleton { to { transform: translateX(100%); } }

.sz-model-notes { display: grid; gap: var(--sz-3); margin-top: var(--sz-5); padding-top: var(--sz-4); border-top: 1px solid var(--sz-rule); color: var(--sz-ink-3); font-size: var(--sz-text-meta); line-height: var(--sz-leading-body); }
.sz-model-notes dl { display: grid; grid-template-columns: minmax(calc(var(--sz-16) * 2), auto) 1fr; gap: var(--sz-2) var(--sz-4); margin: 0; }
.sz-model-notes dt { color: var(--sz-ink-2); font-weight: 600; }
.sz-model-notes dd { margin: 0; }

/* Auth, legal, and error pages share a narrow editorial shell. */
.sz-narrow-shell { width: min(100%, calc(var(--sz-16) * 7)); margin-inline: auto; padding-inline: var(--sz-gutter); }
.sz-auth-main { display: grid; min-height: 100dvh; place-items: center; padding-block: var(--sz-12); }
.sz-auth-card { width: 100%; padding: var(--sz-6); border: 1px solid var(--sz-rule); border-radius: var(--sz-r-lg); background: var(--sz-surface); }
.sz-auth-brand { display: flex; justify-content: center; margin-bottom: var(--sz-5); }
.sz-auth-title { margin: 0; color: var(--sz-ink); font-family: var(--sz-font-display); font-size: var(--sz-text-h1); font-weight: 600; text-align: center; }
.sz-auth-copy { margin: var(--sz-2) 0 var(--sz-6); color: var(--sz-ink-2); font-size: var(--sz-text-sm); line-height: var(--sz-leading-body); text-align: center; }
.sz-form-stack { display: grid; gap: var(--sz-4); }
.sz-form-field { display: grid; gap: var(--sz-2); }
.sz-form-label { color: var(--sz-ink-2); font-size: var(--sz-text-sm); font-weight: 600; }
.sz-form-help { color: var(--sz-ink-3); font-size: var(--sz-text-meta); line-height: var(--sz-leading-body); }
.sz-form-error { color: var(--sz-neg); font-size: var(--sz-text-sm); }
.sz-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sz-3); }
.sz-password-field { position: relative; }
.sz-password-field .form-input { padding-right: var(--sz-12); }
.sz-password-toggle { position: absolute; top: 50%; right: var(--sz-2); display: inline-flex; width: var(--sz-8); height: var(--sz-8); align-items: center; justify-content: center; border-radius: var(--sz-r-sm); color: var(--sz-ink-3); transform: translateY(-50%); }
.sz-password-toggle:hover { background: var(--sz-surface-3); color: var(--sz-ink); }
.sz-auth-status { display: grid; justify-items: center; gap: var(--sz-3); text-align: center; }
.sz-status-spinner { width: var(--sz-6); height: var(--sz-6); border: var(--sz-1) solid var(--sz-rule); border-top-color: var(--sz-focus); border-radius: var(--sz-r-full); animation: szSpin var(--sz-dur) linear infinite; }
@keyframes szSpin { to { transform: rotate(360deg); } }

.sz-document { display: grid; grid-template-columns: minmax(calc(var(--sz-16) * 3), calc(var(--sz-16) * 4)) minmax(0, 1fr); gap: var(--sz-10); align-items: start; }
.sz-document-nav { position: sticky; top: calc(var(--sz-16) + var(--sz-4)); display: grid; gap: var(--sz-1); }
.sz-document-nav a { padding: var(--sz-2); border-radius: var(--sz-r-sm); color: var(--sz-ink-3); font-size: var(--sz-text-sm); text-decoration: none; }
.sz-document-nav a:hover { background: var(--sz-surface-2); color: var(--sz-ink); }
.sz-document-body { min-width: 0; max-width: 78ch; }
.sz-document-body h2 { margin: var(--sz-10) 0 var(--sz-3); scroll-margin-top: calc(var(--sz-16) + var(--sz-4)); color: var(--sz-ink); font-family: var(--sz-font-text); font-size: var(--sz-text-h2); font-weight: 600; }
.sz-document-body h2:first-child { margin-top: 0; }
.sz-document-body h3 { margin: var(--sz-6) 0 var(--sz-2); color: var(--sz-ink); font-family: var(--sz-font-text); font-size: var(--sz-text-h3); font-weight: 600; }
.sz-document-body :is(p, li) { color: var(--sz-ink-2); font-size: var(--sz-text-body); line-height: var(--sz-leading-body); }
.sz-document-body p { margin: 0 0 var(--sz-3); }
.sz-document-body a { color: var(--sz-ink); text-decoration: underline; text-underline-offset: var(--sz-1); }
.sz-document-body :is(ul, ol) { display: grid; gap: var(--sz-2); padding-left: var(--sz-6); }
.sz-document-table { width: 100%; overflow-x: auto; }
.sz-error-main { display: grid; min-height: 100dvh; place-items: center; padding: var(--sz-6); }
.sz-error-card { width: min(100%, calc(var(--sz-16) * 8)); }
.sz-error-code { margin: 0 0 var(--sz-3); color: var(--sz-ink-3); font-family: var(--sz-font-num); font-size: var(--sz-text-meta); font-weight: 600; letter-spacing: .08em; }
.sz-error-actions { display: flex; flex-wrap: wrap; gap: var(--sz-2); margin-top: var(--sz-5); }
.sz-request-path { margin: var(--sz-5) 0 0; color: var(--sz-ink-4); font-family: var(--sz-font-num); font-size: var(--sz-text-micro); overflow-wrap: anywhere; }

/* The live landing page uses only the ticker hero, research-flow proof, plan
   ledger, and account dialog. These source-level rules replace its retired
   multi-redesign stylesheet. */
.lp-nav .nav-actions { flex-wrap: wrap; justify-content: flex-end; }
.lp-nav-primary { width: auto; padding: var(--sz-2) var(--sz-4); }
.section { padding-block: var(--sz-12); }
.section-kicker { margin-bottom: var(--sz-3); color: var(--sz-ink-3); font-family: var(--sz-font-num); font-size: var(--sz-text-micro); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.offer-panel { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(calc(var(--sz-16) * 4), .65fr); border: 1px solid var(--sz-rule); border-radius: var(--sz-r-lg); background: var(--sz-surface); overflow: hidden; }
.offer-main { padding: var(--sz-8); }
.offer-main h2 { margin: 0; color: var(--sz-ink); font-family: var(--sz-font-text); font-size: var(--sz-text-h1); font-weight: 600; }
.offer-main > p { max-width: 64ch; margin: var(--sz-3) 0 0; color: var(--sz-ink-2); line-height: var(--sz-leading-body); }
.offer-action { display: flex; align-items: center; gap: var(--sz-4); margin-top: var(--sz-6); }
.reassurance { color: var(--sz-ink-3); font-size: var(--sz-text-meta); }
.plan-ledger { border-left: 1px solid var(--sz-rule); background: var(--sz-surface-2); }
.plan-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sz-4); align-items: baseline; padding: var(--sz-5); border-bottom: 1px solid var(--sz-rule); }
.plan-row:last-child { border-bottom: 0; }
.plan-row.featured { background: var(--sz-surface); }
.plan-row strong { color: var(--sz-ink); font-size: var(--sz-text-sm); }
.plan-row p { margin: var(--sz-1) 0 0; color: var(--sz-ink-3); font-size: var(--sz-text-meta); line-height: var(--sz-leading-body); }
.plan-price { color: var(--sz-ink); font-family: var(--sz-font-num); font-size: var(--sz-text-sm); font-variant-numeric: tabular-nums lining-nums; font-weight: 600; white-space: nowrap; }
.plan-price span { color: var(--sz-ink-3); font-family: var(--sz-font-text); font-size: var(--sz-text-micro); font-weight: 400; }
#authModal { display: none; position: fixed; inset: 0; z-index: 80; align-items: center; justify-content: center; padding: var(--sz-4); background: var(--sz-scrim); }
body.sz-dialog-open { overflow: hidden; }
#authModal.active { display: flex; }
#authModal .modal-card { position: relative; width: min(100%, calc(var(--sz-16) * 7)); max-height: 92dvh; padding: var(--sz-6); overflow-y: auto; border: 1px solid var(--sz-rule); border-radius: var(--sz-r-lg); background: var(--sz-surface); box-shadow: var(--sz-shadow-lg); }
#authModal .close-btn { position: absolute; top: var(--sz-3); right: var(--sz-3); display: inline-flex; width: var(--sz-8); height: var(--sz-8); align-items: center; justify-content: center; border: 1px solid var(--sz-rule); border-radius: var(--sz-r-sm); background: transparent; color: var(--sz-ink-3); }
#authModal .close-btn:hover { background: var(--sz-surface-3); color: var(--sz-ink); }
#authModal .tabs { display: flex; gap: var(--sz-1); margin: 0 var(--sz-10) var(--sz-5) 0; padding: var(--sz-1); border: 1px solid var(--sz-rule); border-radius: var(--sz-r-md); background: var(--sz-surface-2); }
#authModal .tab-btn { flex: 1 1 0; padding: var(--sz-2) var(--sz-3); border: 1px solid transparent; border-radius: var(--sz-r-sm); color: var(--sz-ink-3); font-size: var(--sz-text-sm); }
#authModal .tab-btn[aria-selected="true"],
#authModal .tab-btn.active { border-color: var(--sz-rule); background: var(--sz-surface); color: var(--sz-ink); box-shadow: var(--sz-shadow-sm); }
#authModal .modal-title { color: var(--sz-ink); font-family: var(--sz-font-display); font-size: var(--sz-text-h2); font-weight: 600; }
#authModal .modal-sub { margin: var(--sz-2) 0 var(--sz-5); color: var(--sz-ink-2); font-size: var(--sz-text-sm); line-height: var(--sz-leading-body); }
#authModal .form-group { display: grid; gap: var(--sz-2); margin-bottom: var(--sz-4); }
#authModal .form-label { color: var(--sz-ink-2); font-size: var(--sz-text-sm); font-weight: 600; }
#authModal .form-input { width: 100%; }
#authModal .password-wrap { position: relative; }
#authModal .password-wrap .form-input { padding-right: var(--sz-12); }
#authModal .password-toggle { position: absolute; top: 50%; right: var(--sz-2); display: inline-flex; width: var(--sz-8); height: var(--sz-8); align-items: center; justify-content: center; color: var(--sz-ink-3); transform: translateY(-50%); }
#authModal .btn-google { display: flex; width: 100%; align-items: center; justify-content: center; gap: var(--sz-2); padding: var(--sz-2) var(--sz-3); border: 1px solid var(--sz-rule-strong); border-radius: var(--sz-r-sm); background: transparent; color: var(--sz-ink); font-size: var(--sz-text-sm); font-weight: 600; }
#authModal .divider { display: flex; align-items: center; gap: var(--sz-3); margin: var(--sz-4) 0; color: var(--sz-ink-3); font-size: var(--sz-text-micro); }
#authModal .divider::before,
#authModal .divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--sz-rule); }
#authModal .error-box,
#authModal .success-box { display: none; margin-top: var(--sz-3); padding: var(--sz-3); border: 1px solid currentColor; border-radius: var(--sz-r-sm); font-size: var(--sz-text-sm); line-height: var(--sz-leading-body); }
#authModal .error-box.visible { display: block; color: var(--sz-neg); background: var(--sz-neg-wash); }
#authModal .success-box.visible { display: block; color: var(--sz-pos); background: var(--sz-pos-wash); }
#authModal .form-hint,
#authModal .terms-note { margin-top: var(--sz-2); color: var(--sz-ink-3); font-size: var(--sz-text-meta); line-height: var(--sz-leading-body); }
#authModal .modal-reassure { display: flex; flex-wrap: wrap; gap: var(--sz-2); margin-bottom: var(--sz-4); color: var(--sz-ink-3); font-size: var(--sz-text-micro); }
#authModal .modal-reassure span { padding: var(--sz-1) var(--sz-2); border: 1px solid var(--sz-rule); border-radius: var(--sz-r-sm); }
#authModal .back-link { color: var(--sz-ink-2); font-size: var(--sz-text-sm); text-decoration: underline; }

@media (max-width: 768px) {
  .app-shared-nav-inner--admin,
  .app-shared-nav-inner--blog {
    height: auto;
    min-height: var(--sz-nav-height);
    flex-wrap: wrap;
    gap: var(--sz-2);
    padding-block: var(--sz-2);
  }
  .app-shared-nav-inner--admin .app-nav-brand-group,
  .app-shared-nav-inner--blog .app-nav-brand-group { flex: 1 1 auto; min-width: 0; }
  .app-nav-actions--admin,
  .app-shared-nav-inner--blog .app-nav-actions--public {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: var(--sz-1) !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  .app-nav-actions--admin .btn-ghost {
    flex: 0 0 auto;
    padding-inline: var(--sz-2);
    font-size: var(--sz-text-micro);
    white-space: nowrap;
  }
  .sz-page-head,
  .sz-section-head,
  .sz-chart-head { align-items: stretch; flex-direction: column; }
  .sz-page-actions { width: 100%; }
  .sz-page-actions > * { flex: 1 1 auto; }
  .sz-filter-bar { align-items: stretch; flex-direction: column; }
  .sz-filter-field { min-width: 0; }
  .sz-filter-actions { width: 100%; margin-left: 0; }
  .sz-filter-actions > * { flex: 1 1 auto; }
  .sz-document { grid-template-columns: 1fr; gap: var(--sz-6); }
  .sz-document-nav { position: static; padding-bottom: var(--sz-4); border-bottom: 1px solid var(--sz-rule); }
  .offer-panel { grid-template-columns: 1fr; }
  .plan-ledger { border-top: 1px solid var(--sz-rule); border-left: 0; }
  .offer-main { padding: var(--sz-6); }
}

@media (max-width: 640px) {
  .app-shared-nav-inner--public,
  .app-shared-nav-inner--blog,
  .app-shared-nav-inner--admin { padding-inline: var(--sz-3) !important; }
  .app-nav-actions--public { gap: var(--sz-1) !important; }
  .app-nav-actions--public a[href="#pricing"] { display: none; }
  .app-nav-actions--public .btn-ghost,
  .app-nav-actions--public .btn-primary { padding-inline: var(--sz-3); white-space: nowrap; }
  .sz-page-main { padding-block: var(--sz-6) var(--sz-10); }
  .sz-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sz-kpi { padding: var(--sz-3); }
  .sz-kpi-value { font-size: var(--sz-text-h3); }
  .sz-table.sz-table-responsive thead { display: none; }
  .sz-table.sz-table-responsive,
  .sz-table.sz-table-responsive tbody,
  .sz-table.sz-table-responsive tr,
  .sz-table.sz-table-responsive th[scope="row"],
  .sz-table.sz-table-responsive td { display: block; width: 100%; }
  .sz-table.sz-table-responsive tr { padding: var(--sz-3); border-bottom: 1px solid var(--sz-rule); }
  .sz-table.sz-table-responsive th[scope="row"] { padding: var(--sz-2) 0; border: 0; color: var(--sz-ink); font-size: var(--sz-text-sm); text-align: left; }
  .sz-table.sz-table-responsive td { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--sz-3); padding: var(--sz-2) 0; border: 0; text-align: right; white-space: normal; }
  .sz-table.sz-table-responsive td::before { content: attr(data-label); color: var(--sz-ink-3); font-family: var(--sz-font-text); font-size: var(--sz-text-micro); font-weight: 600; text-align: left; }
  .offer-action { align-items: stretch; flex-direction: column; }
  .plan-row { grid-template-columns: 1fr; }
}

/* Narrow phones need one reading column for figures and model provenance.
   This prevents exact values, chart companions, and source notes from
   competing for width at the point where a two-column KPI grid stops helping. */
@media (max-width: 400px) {
  .sz-kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .sz-kpi-value { overflow-wrap: anywhere; }
  .sz-model-notes dl { grid-template-columns: minmax(0, 1fr); gap: var(--sz-1); }
  .sz-model-notes dt:not(:first-child) { margin-top: var(--sz-2); }
  .sz-tool-output { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .sz-tool-output :is(.sz-kpi-grid, .sz-chart-frame, .sz-table-frame, .sz-callout) { min-width: 0; max-width: 100%; }
  .sz-tool-output .sz-data-meta { align-items: flex-start; flex-direction: column; gap: var(--sz-1); }
  .sz-tool-output .sz-chart-plot[data-size="tall"] { height: calc(var(--sz-16) * 3); }
}

@media (prefers-reduced-motion: reduce) {
  .sz-skeleton::after { animation: none; display: none; }
  .sz-skip-link { transition: none; }
}

@media print {
  .app-shared-nav,
  .mobile-tab-bar,
  .sz-document-nav,
  [data-theme-toggle] { display: none !important; }
  .sz-page,
  .sz-panel,
  .sz-table-frame { background: var(--sz-print-paper) !important; color: var(--sz-print-ink) !important; box-shadow: none !important; }
  .sz-page-main { padding: 0; }
  .sz-document { display: block; }
  .sz-document-body { max-width: none; }
}
