/* Component layer over the Venture tokens (styles.css). Theme roles are set here for light and dark; every value
   comes from a token. Text pairings are chosen to clear WCAG AA in both themes. */
:root, [data-theme="light"] {
  --bg: var(--white);
  --bg-alt: var(--surface-section-light);
  --surface: var(--white);
  --text: var(--slate-900);
  --text-2: var(--slate-700);
  --muted: var(--slate-700);
  --line: var(--slate-200);
  --line-strong: var(--slate-400);
  --link: var(--blue-bright);
  --btn-bg: var(--blue-800);
  --btn-bg-hover: var(--blue-900);
  --btn-text: var(--white);
  --btn2-bg: var(--white);
  --btn2-text: var(--blue-800);
  --chip-bg: var(--blue-100);
  --chip-text: var(--blue-800);
  --new-bg: var(--lavender-50);
  --new-text: var(--violet-600);
  --nav-bg: var(--white);
  --ground: var(--blue-900);
  --ground-text: var(--white);
  --ground-muted: var(--text-on-dark-muted);
  --bar-track: var(--slate-200);
  --bar-fill: var(--blue-500);
  --danger: var(--purple-600);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: var(--slate-900);
  --bg-alt: var(--blue-900);
  --surface: var(--blue-900);
  --text: var(--white);
  --text-2: var(--slate-200);
  --muted: var(--slate-200);
  --line: var(--slate-700);
  --line-strong: var(--slate-500);
  --link: var(--blue-300);
  --btn-bg: var(--blue-500);
  --btn-bg-hover: var(--blue-600);
  --btn-text: var(--white);
  --btn2-bg: var(--slate-900);
  --btn2-text: var(--white);
  --chip-bg: var(--blue-800);
  --chip-text: var(--white);
  --new-bg: var(--violet-600);
  --new-text: var(--white);
  --nav-bg: var(--slate-900);
  --ground: var(--blue-800);
  --ground-text: var(--white);
  --ground-muted: var(--text-on-dark-muted);
  --bar-track: var(--slate-700);
  --bar-fill: var(--blue-300);
  --danger: var(--lavender-100);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--text-body-md); line-height: var(--line-height-normal); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); line-height: var(--line-height-snug); margin: 0 0 var(--space-3); letter-spacing: var(--letter-spacing-tight); }
h1 { font-size: var(--text-display-3); }
h2 { font-size: var(--text-body-lg); }
h3 { font-size: var(--text-body-md); }
p { margin: 0 0 var(--space-4); color: var(--text-2); }
a { color: var(--link); }
a:hover { text-decoration-thickness: 0.15em; }
img, svg { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--space-2); top: calc(-1 * var(--space-16)); background: var(--btn-bg); color: var(--btn-text); padding: var(--space-2) var(--space-4); z-index: 100; }
.skip:focus { top: var(--space-2); }
.icon { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.wrap { width: 100%; max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-4); }
.money, .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: var(--space-2) var(--space-5); border-radius: var(--radius-pill); border: thin solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-text); font: inherit; font-size: var(--text-body-sm); font-weight: var(--font-weight-semibold); text-decoration: none; cursor: pointer; transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.btn:hover { background: var(--btn-bg-hover); }
.btn:active { transform: var(--press-scale); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.7; cursor: not-allowed; }
.btn--ghost { background: var(--btn2-bg); color: var(--btn2-text); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--bg-alt); }
.btn--small { min-height: 44px; padding: var(--space-1) var(--space-3); }
.btn--light { background: var(--white); color: var(--blue-900); border-color: var(--white); }
.btn--light:hover { background: var(--blue-100); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-pill); border: thin solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg-alt); }

/* Cards, chips, notices */
.card { background: var(--surface); border: thin solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-card); min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--chip-bg); color: var(--chip-text); font-size: var(--text-caption); font-weight: var(--font-weight-semibold); white-space: nowrap; }
.chip--new { background: var(--new-bg); color: var(--new-text); }
.chip--plain { background: transparent; color: var(--text); border: thin solid var(--line-strong); }
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border: thin solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-alt); color: var(--text); }
.notice p { margin: 0; color: var(--text); }

/* Forms */
.field { display: grid; gap: var(--space-1); }
.field label { font-weight: var(--font-weight-semibold); font-size: var(--text-body-sm); color: var(--text); }
.field .hint { font-size: var(--text-caption); color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3); border: thin solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: var(--text-body-sm); }
textarea.input { min-height: 7rem; resize: vertical; }
.input[aria-invalid="true"] { border-color: var(--danger); border-width: medium; }
.field-error { color: var(--text); font-size: var(--text-caption); font-weight: var(--font-weight-semibold); }
.field-error::before { content: "Fix: "; color: var(--muted); font-weight: var(--font-weight-regular); }
.error-summary { border: medium solid var(--danger); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); background: var(--surface); }
.error-summary h2 { font-size: var(--text-body-sm); margin: 0 0 var(--space-2); }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* Tables */
.table-wrap { overflow-x: auto; border: thin solid var(--line); border-radius: var(--radius-md); background: var(--surface); max-height: 70vh; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-body-sm); }
table.data th, table.data td { text-align: left; padding: var(--space-3); border-bottom: thin solid var(--line); vertical-align: top; }
table.data th { position: sticky; top: 0; background: var(--surface); color: var(--text); font-weight: var(--font-weight-semibold); z-index: 1; white-space: nowrap; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: var(--space-1); align-items: center; min-height: 44px; }
table.data th button:focus-visible { box-shadow: var(--focus-ring); }
table.data td.r, table.data th.r { text-align: right; }
table.data tbody tr:hover { background: var(--bg-alt); }
.table-tools { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; margin-top: var(--space-3); }

/* Progress */
.bar { height: var(--space-2); background: var(--bar-track); border-radius: var(--radius-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--bar-fill); border-radius: var(--radius-pill); }

/* States */
.skeleton { display: grid; gap: var(--space-2); }
.skeleton span { display: block; height: var(--space-6); border-radius: var(--radius-sm); background: var(--bar-track); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } * { transition: none !important; } }
.empty { text-align: center; padding: var(--space-8) var(--space-4); border: thin dashed var(--line-strong); border-radius: var(--radius-md); }
.empty p { color: var(--text-2); }

/* Toast */
.toasts { position: fixed; bottom: var(--space-4); right: var(--space-4); left: var(--space-4); display: grid; gap: var(--space-2); justify-items: end; z-index: 200; pointer-events: none; }
.toast { pointer-events: auto; max-width: 28rem; background: var(--slate-900); color: var(--white); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-card-hover); display: flex; gap: var(--space-3); align-items: flex-start; }
[data-theme="dark"] .toast { background: var(--white); color: var(--slate-900); }
.toast button { all: unset; cursor: pointer; text-decoration: underline; min-height: 24px; }

/* Dialog */
dialog.dlg { border: thin solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: var(--space-6); width: min(36rem, calc(100vw - var(--space-8))); max-height: 90vh; overflow: auto; }
dialog.dlg::backdrop { background: rgba(16, 24, 40, 0.55); }

/* ── Public site ─────────────────────────────────────────────────────────────── */
.topnav { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); border-bottom: thin solid var(--line); }
.topnav .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text); font-family: var(--font-display); font-weight: var(--font-weight-bold); font-size: var(--text-body-lg); min-height: 44px; }
.brand img { width: 36px; height: 36px; }
.brand small { display: block; font-family: var(--font-body); font-size: var(--text-caption); font-weight: var(--font-weight-medium); color: var(--muted); }
.navlinks { display: flex; align-items: center; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
.navlinks a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--text); text-decoration: none; font-size: var(--text-body-sm); font-weight: var(--font-weight-medium); border-radius: var(--radius-pill); }
.navlinks a:hover, .navlinks a[aria-current="page"] { background: var(--bg-alt); }
.nav-toggle { display: none; }
@media (max-width: 52em) {
  .nav-toggle { display: inline-flex; }
  .navlinks { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--nav-bg); border-bottom: thin solid var(--line); padding: var(--space-2) var(--space-4) var(--space-4); }
  .navlinks.open { display: flex; }
  .navlinks a { width: 100%; }
}
.hero { background: var(--ground); color: var(--ground-text); padding: var(--space-20) 0 var(--space-16); }
.hero h1 { color: var(--ground-text); font-size: clamp(3rem, 7vw, var(--text-display-1)); line-height: var(--line-height-tight); font-weight: var(--font-weight-extrabold); max-width: 18ch; hyphens: auto; overflow-wrap: break-word; }
.hero p { color: var(--ground-muted); font-size: var(--text-body-lg); max-width: 40rem; }
.hero .row { margin-top: var(--space-6); }
.hero .eyebrow { color: var(--ground-text); }
.hero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--space-4); margin-top: var(--space-12); }
.hero-facts div { border-top: thin solid var(--ground-muted); padding-top: var(--space-3); }
.hero-facts strong { display: block; font-family: var(--font-display); font-size: var(--text-display-3); color: var(--ground-text); }
.hero-facts span { color: var(--ground-muted); font-size: var(--text-body-sm); }
.section { padding: var(--space-16) 0; }
.section--alt { background: var(--bg-alt); }
.section-head { max-width: 44rem; margin-bottom: var(--space-8); }
.section-head h2 { font-size: clamp(var(--text-display-3), 4vw, var(--text-display-2)); line-height: var(--line-height-tight); }
.eyebrow { display: inline-block; font-size: var(--text-caption); font-weight: var(--font-weight-bold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--link); margin-bottom: var(--space-2); }
.price-card { display: grid; grid-template-rows: auto auto 1fr auto; gap: var(--space-3); height: 100%; }
.price-card .price { font-family: var(--font-display); font-size: var(--text-display-3); font-weight: var(--font-weight-bold); color: var(--text); line-height: var(--line-height-tight); }
.price-card .unit { font-size: var(--text-body-sm); color: var(--muted); }
.steps { counter-reset: step; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; font-family: var(--font-display); font-weight: var(--font-weight-bold); font-size: var(--text-display-3); color: var(--link); }
.site-footer { background: var(--ground); color: var(--ground-text); padding: var(--space-12) 0 var(--space-8); }
.site-footer p, .site-footer li { color: var(--ground-muted); font-size: var(--text-body-sm); }
.site-footer a { color: var(--ground-text); }
.site-footer h3 { color: var(--ground-text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.trust { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.trust span { border: thin solid var(--ground-muted); color: var(--ground-text); border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); font-size: var(--text-caption); }
.page { padding: var(--space-10) 0 var(--space-16); }
.narrow { max-width: 46rem; }

/* ── Admin console ───────────────────────────────────────────────────────────── */
.console { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ground); color: var(--ground-text); padding: var(--space-4); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: var(--ground-text); }
.sidebar .brand small { color: var(--ground-muted); }
.sidenav { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: grid; gap: var(--space-1); }
.sidenav a { display: flex; gap: var(--space-3); align-items: center; min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--ground-text); text-decoration: none; font-size: var(--text-body-sm); }
.sidenav a:hover { background: var(--blue-700); }
.sidenav a[aria-current="page"] { background: var(--blue-700); font-weight: var(--font-weight-semibold); }
.sidenav .group { color: var(--ground-muted); font-size: var(--text-caption); text-transform: uppercase; letter-spacing: 0.08em; margin: var(--space-4) var(--space-3) var(--space-1); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-6); border-bottom: thin solid var(--line); background: var(--nav-bg); position: sticky; top: 0; z-index: 20; }
.topbar .who { font-size: var(--text-body-sm); color: var(--muted); overflow-wrap: anywhere; }
.main { padding: var(--space-6); min-width: 0; }
.kpis { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.kpi strong { display: block; font-family: var(--font-display); font-size: var(--text-display-3); line-height: var(--line-height-tight); color: var(--text); }
.kpi span { font-size: var(--text-body-sm); color: var(--muted); }
.chart svg { width: 100%; height: auto; }
.chart .bar-rect { fill: var(--bar-fill); }
.chart text { fill: var(--text); font-size: var(--text-caption); }
.board { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); align-items: start; }
.task { display: grid; gap: var(--space-2); padding: var(--space-3) 0; border-top: thin solid var(--line); }
.task:first-of-type { border-top: 0; }
.tabs { display: flex; gap: var(--space-1); border-bottom: thin solid var(--line); margin-bottom: var(--space-4); overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: var(--space-3) var(--space-4); min-height: 20px; border-bottom: medium solid transparent; color: var(--text); font-weight: var(--font-weight-medium); white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--link); font-weight: var(--font-weight-bold); }
.tabs button:focus-visible { box-shadow: var(--focus-ring); }
.list-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.mobile-bar { display: none; }
@media (max-width: 56em) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); z-index: 60; }
  .sidebar.open { display: block; }
  .mobile-bar { display: inline-flex; }
  .main { padding: var(--space-4); }
  .topbar { padding: var(--space-2) var(--space-4); }
}
.signin { max-width: 28rem; margin: var(--space-16) auto; padding: 0 var(--space-4); }
