/* ==========================================================================
   SynthTax · «Гроссбух» — общая дизайн-система сайта.
   Токены, база, компоненты и шапка/подвал. Цвета и шрифты — только через
   переменные ниже. Стили страниц — в assets/css/pages/*.css.
   ========================================================================== */


:root {
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --t-fast: .16s;
  --t-med: .32s;
  --t-slow: .7s;

  --container: 1240px;
  --container-wide: 1400px;
  --container-narrow: 760px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 68px;

  --fs-display: clamp(42px, 6.2vw, 88px);
  --fs-h1: clamp(34px, 4.2vw, 58px);
  --fs-h2: clamp(28px, 3.1vw, 42px);
  --fs-h3: clamp(21px, 1.8vw, 26px);
  --fs-h4: 18px;
  --fs-lead: clamp(17px, 1.35vw, 20px);
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-cap: 12.5px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
}

/* ---------- Direction 1 · «Гроссбух» — paper, ink, ledger green ---------- */
:root {
  color-scheme: light;
  --bg: #F4F1EA;
  --bg-alt: #ECE8DE;
  --surface: #FAF8F3;
  --surface-2: #F0ECE3;
  --raised: #FFFEFB;
  --ink: #1B1A17;
  --ink-2: #4E4B43;
  --ink-3: #807B6C;
  --ink-4: #A9A493;
  --line: #DCD5C5;
  --line-2: #C8C0AC;
  --line-strong: #1B1A17;
  --accent: #1D5A42;
  --accent-hover: #164633;
  --accent-ink: #F6F3EC;
  --accent-soft: #E1EAE1;
  --accent-text: #1D5A42;
  --mark: #F1E39B;
  --pos: #2B7350;
  --pos-soft: #E1EDE3;
  --neg: #B03F28;
  --neg-soft: #F3E1DA;
  --warn: #9C6511;
  --warn-soft: #F4E8CF;
  --info: #2E5E9A;
  --info-soft: #E2E9F3;
  --focus: #1D5A42;
  --overlay: rgba(27, 26, 23, .42);
  --c1: #2E5E9A; --c2: #C9692B; --c3: #1F7A57; --c4: #9A6A1A;

  --font-display: 'Literata', 'Georgia', serif;
  --font-h: 'Literata', 'Georgia', serif;
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-num: 'IBM Plex Sans', system-ui, sans-serif;
  --w-display: 340;
  --w-h: 420;
  --w-h-sm: 600;
  --w-strong: 600;
  --opsz: 72;
  --track-display: -.025em;
  --track-h: -.015em;
  --lh-display: 1.02;
  --lh-h: 1.1;

  --label-font: var(--font-mono);
  --label-size: 11.5px;
  --label-weight: 500;
  --label-track: .08em;
  --label-case: uppercase;

  --r-1: 2px;
  --r-2: 3px;
  --r-3: 4px;
  --r-btn: 2px;
  --r-pill: 2px;
  --bw: 1px;
  --btn-h: 46px;
  --btn-weight: 500;
  --shadow-card: none;
  --shadow-pop: 0 18px 50px -18px rgba(52, 40, 18, .35), 0 0 0 1px var(--line);
  --header-bg: color-mix(in srgb, var(--bg) 92%, transparent);
}

/* ==========================================================================
   Base: reset, typography, layout primitives, motion
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; interpolate-size: allow-keywords; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
  transition: background-color .4s var(--ease-out), color .4s var(--ease-out);
  min-height: 100vh;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: var(--bw) solid var(--line); margin: 0; }
::selection { background: var(--mark); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
[hidden] { display: none !important; }

/* Icons ----------------------------------------------------------------- */
.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.i-s { width: 16px; height: 16px; }
.i-xs { width: 14px; height: 14px; }
.i-l { width: 24px; height: 24px; }
.i-xl { width: 32px; height: 32px; stroke-width: 1.3; }

/* Typography -------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: var(--w-display);
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--track-display);
  font-variation-settings: "opsz" var(--opsz);
  text-wrap: balance;
}
.h1, .h2, .h3 {
  font-family: var(--font-h);
  font-weight: var(--w-h);
  line-height: var(--lh-h);
  letter-spacing: var(--track-h);
  font-variation-settings: "opsz" var(--opsz);
  text-wrap: balance;
}
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); line-height: 1.2; }
.h4 { font-family: var(--font-ui); font-size: var(--fs-h4); font-weight: var(--w-h-sm); line-height: 1.3; letter-spacing: -.01em; }
.h5 { font-family: var(--font-ui); font-size: 15px; font-weight: var(--w-h-sm); line-height: 1.35; }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.body { font-size: var(--fs-body); color: var(--ink-2); text-wrap: pretty; }
.small { font-size: var(--fs-small); line-height: 1.5; }
.caption { font-size: var(--fs-cap); line-height: 1.45; color: var(--ink-3); }
.label {
  font-family: var(--label-font);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-track);
  text-transform: var(--label-case);
  color: var(--ink-3);
  line-height: 1.3;
}
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.figure { font-family: var(--font-num); font-weight: var(--w-strong); letter-spacing: -.02em; font-variant-numeric: proportional-nums; line-height: 1; }
.serif { font-family: var(--font-h); font-variation-settings: "opsz" var(--opsz); }
.italic { font-style: italic; }
.strong, b, strong { font-weight: var(--w-strong); }
.ink { color: var(--ink); } .ink-2 { color: var(--ink-2); } .ink-3 { color: var(--ink-3); } .ink-4 { color: var(--ink-4); }
.accent { color: var(--accent-text); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; }
.measure { max-width: 62ch; }
.measure-s { max-width: 44ch; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.center { text-align: center; }
.right { text-align: right; }
.prose { color: var(--ink-2); font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-family: var(--font-h); font-weight: var(--w-h); font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2; letter-spacing: var(--track-h); color: var(--ink); margin-top: 1.8em; font-variation-settings: "opsz" var(--opsz); }
.prose h3 { font-size: 19px; font-weight: var(--w-h-sm); color: var(--ink); margin-top: 1.5em; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul { padding-left: 1.2em; list-style: none; }
.prose ul li { position: relative; }
.prose ul li + li { margin-top: .45em; }
.prose ul li::before { content: ""; position: absolute; left: -1.1em; top: .72em; width: .5em; height: 1px; background: currentColor; }
.prose ol { padding-left: 1.4em; list-style: decimal; }
.prose blockquote { margin: 1.6em 0; padding: .2em 0 .2em 1.2em; border-left: 2px solid var(--accent); color: var(--ink); font-family: var(--font-h); font-size: 1.2em; line-height: 1.45; font-variation-settings: "opsz" var(--opsz); }
mark, .mark { background: linear-gradient(transparent 12%, var(--mark) 12%, var(--mark) 88%, transparent 88%); color: inherit; padding: 0 .12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.link { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--t-fast); }
.link:hover { color: var(--ink); }
.link-quiet { border-bottom: 1px solid var(--line-2); transition: border-color var(--t-fast), color var(--t-fast); }
.link-quiet:hover { border-color: var(--ink); color: var(--ink); }

/* Layout ----------------------------------------------------------------- */
.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.container-wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }
.container-narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }
.section { padding-block: clamp(64px, 9vw, 128px); }
.section-s { padding-block: clamp(40px, 6vw, 80px); }
.section-alt { background: var(--bg-alt); }
.section:not(.section-alt) + .section:not(.section-alt):not(.section-flush) { padding-top: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--gap, 16px); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--gap, 24px); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: 1 / -1; }
.gap-0 { --gap: 0; } .gap-1 { --gap: 4px; } .gap-2 { --gap: 8px; } .gap-3 { --gap: 12px; } .gap-4 { --gap: 16px; }
.gap-5 { --gap: 24px; } .gap-6 { --gap: 32px; } .gap-7 { --gap: 48px; } .gap-8 { --gap: 64px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; } .mt-7 { margin-top: 48px; } .mt-8 { margin-top: 64px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; } .mb-6 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.sticky { position: sticky; top: calc(var(--header-h) + 24px); }
.rule { border-top: var(--bw) solid var(--line); }
.rule-strong { border-top: var(--bw) solid var(--line-strong); }
.vr { width: 1px; align-self: stretch; background: var(--line); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-1 { grid-template-columns: minmax(0, 1fr) !important; }
  .md-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md-span-12 { grid-column: 1 / -1 !important; }
  .md-hide { display: none !important; }
}
@media (max-width: 760px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-12 { grid-template-columns: minmax(0, 1fr); }
  .g-12 > * { grid-column: 1 / -1 !important; }
  .sm-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .sm-hide { display: none !important; }
  .sticky { position: static; }
  :root { --fs-body: 15.5px; }
}
@media (min-width: 761px) { .sm-only { display: none !important; } }

/* Motion ----------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s var(--ease-out) var(--d, 0ms), transform .8s var(--ease-out) var(--d, 0ms);
}
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="left"] { transform: translateX(-18px); }
.js [data-reveal="scale"] { transform: scale(.97); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes slide-in-r { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-rise { animation: rise .5s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.anim-pop { animation: pop .45s var(--ease-spring) both; }

.snap *, .snap *::before, .snap *::after { transition: none !important; animation-duration: 0s !important; animation-delay: 0s !important; }
.snap [data-reveal] { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* ==========================================================================
   Components — shared by all directions, styled only through tokens
   (plus a few explicit [data-dir] accents at the bottom of each block).
   ========================================================================== */

/* Buttons ------------------------------------------------------------------ */
.btn {
  --_bg: transparent; --_fg: var(--ink); --_bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--btn-h); padding: 0 20px;
  border-radius: var(--r-btn);
  background: var(--_bg); color: var(--_fg);
  border: var(--bw) solid var(--_bd);
  font-family: var(--font-ui); font-size: 15px; font-weight: var(--btn-weight); letter-spacing: -.005em;
  white-space: nowrap; user-select: none; position: relative; overflow: hidden;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform .12s var(--ease-out), box-shadow var(--t-fast);
}
.btn:hover { --_bd: var(--ink); }
.btn:active { transform: scale(.975); }
.btn .i { width: 18px; height: 18px; transition: transform var(--t-med) var(--ease-out); }
.btn:hover .i-go { transform: translateX(3px); }
.btn-primary { --_bg: var(--accent); --_fg: var(--accent-ink); --_bd: var(--accent); }
.btn-primary:hover { --_bg: var(--accent-hover); --_bd: var(--accent-hover); }
.btn-dark { --_bg: var(--ink); --_fg: var(--bg); --_bd: var(--ink); }
.btn-dark:hover { --_bg: var(--ink-2); --_bd: var(--ink-2); }
.btn-secondary { --_bg: transparent; }
.btn-soft { --_bg: var(--surface-2); --_bd: transparent; }
.btn-soft:hover { --_bg: var(--line); --_bd: transparent; }
.btn-ghost { --_bg: transparent; --_bd: transparent; padding-inline: 12px; }
.btn-ghost:hover { --_bg: var(--surface-2); --_bd: transparent; }
.btn-s { height: 36px; padding: 0 14px; font-size: 14px; gap: 8px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-xs .i, .btn-s .i { width: 16px; height: 16px; }
.btn-l { height: 54px; padding: 0 26px; font-size: 16px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-icon.btn-s { width: 36px; }
.btn-icon.btn-xs { width: 30px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid var(--_fg); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
.btn.is-done { --_bg: var(--pos); --_bd: var(--pos); --_fg: #fff; }
.btn-primary { box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.btn { letter-spacing: .005em; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-2);
  color: var(--ink-2); transition: background-color var(--t-fast), color var(--t-fast); position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

.arrow-link { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--btn-weight); color: var(--ink); }
.arrow-link .i { width: 18px; height: 18px; transition: transform var(--t-med) var(--ease-out); }
.arrow-link:hover .i { transform: translateX(4px); }
.arrow-link-accent { color: var(--accent-text); }

/* Form controls ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > .label { color: var(--ink-2); }
.field-hint { font-size: 13px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--raised); color: var(--ink);
  border: var(--bw) solid var(--line-2); border-radius: var(--r-1);
  font-size: 15px; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input-s { height: 36px; font-size: 14px; padding: 0 10px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .i { position: absolute; left: 13px; color: var(--ink-3); pointer-events: none; }
.input-group > .input { padding-left: 40px; }
.input-group > .suffix { position: absolute; right: 14px; color: var(--ink-3); font-size: 14px; pointer-events: none; }
.input-group > .kbd { position: absolute; right: 10px; }
.input.is-invalid { border-color: var(--neg); }
.input.is-valid { border-color: var(--pos); }

.check, .radio { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 15px; line-height: 1.4; }
.check input, .radio input { appearance: none; margin: 1px 0 0; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--ink-3); background: var(--raised); transition: all var(--t-fast); display: grid; place-items: center; cursor: pointer; }
.check input { border-radius: calc(var(--r-1) * .6 + 2px); }
.radio input { border-radius: 50%; }
.check input::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform .18s var(--ease-spring); }
.radio input::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); transform: scale(0); transition: transform .18s var(--ease-spring); }
.check input:checked, .radio input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.radio input:checked::after { transform: scale(1); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background-color .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .25s var(--ease-spring); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input, .switch input::after { border-radius: 2px; }

/* Segmented control: <div class="seg" data-seg><button data-value aria-pressed> */
.seg {
  position: relative; display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border-radius: calc(var(--r-btn) + 2px); border: var(--bw) solid var(--line);
  isolation: isolate; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg > button {
  position: relative; z-index: 1; height: 34px; padding: 0 14px; border-radius: var(--r-btn);
  font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: color .2s;
}
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed="true"] { color: var(--ink); }
.seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: var(--r-btn); background: var(--raised); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); transition: transform .35s var(--ease-out), width .35s var(--ease-out); }
.seg { background: transparent; border-color: var(--line-2); }
.seg-thumb { background: var(--ink); box-shadow: none; }
.seg > button[aria-pressed="true"] { color: var(--bg); }
.seg-l > button { height: 40px; padding: 0 18px; font-size: 15px; }
.seg-block { display: flex; width: 100%; }
.seg-block > button { flex: 1; }

/* Chips (toggleable) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border: var(--bw) solid var(--line-2); border-radius: var(--r-pill); background: var(--raised);
  font-size: 14px; color: var(--ink-2); transition: all var(--t-fast); cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .i { width: 16px; height: 16px; }
.chip-s { height: 30px; padding: 0 11px; font-size: 13px; }

/* Range slider */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; --p: 50%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line-2) var(--p)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--raised); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .15s var(--ease-out); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--raised); border: 2px solid var(--accent); }
.range:active::-webkit-slider-thumb { transform: scale(1.15); }
.range::-webkit-slider-thumb { border-radius: 2px; width: 14px; height: 22px; margin-top: -9px; background: var(--ink); border-color: var(--ink); }

/* Stepper: <div class="stepper" data-stepper data-min data-max><button data-step="-1">… */
.stepper { display: inline-flex; align-items: center; border: var(--bw) solid var(--line-2); border-radius: var(--r-btn); background: var(--raised); height: 42px; }
.stepper button { width: 40px; height: 100%; display: grid; place-items: center; color: var(--ink-2); transition: color var(--t-fast), background-color var(--t-fast); }
.stepper button:hover { color: var(--ink); background: var(--surface-2); }
.stepper output, .stepper input { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; border: 0; background: transparent; width: 52px; outline: none; }

/* Dropzone */
.dropzone {
  display: grid; place-items: center; gap: 10px; text-align: center; padding: 36px 24px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-3); background: var(--surface);
  color: var(--ink-2); cursor: pointer; transition: all var(--t-med) var(--ease-out);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone .i-xl { color: var(--ink-3); transition: transform var(--t-med) var(--ease-spring), color var(--t-fast); }
.dropzone:hover .i-xl, .dropzone.is-over .i-xl { transform: translateY(-4px); color: var(--accent-text); }

/* Tags / badges / dots ------------------------------------------------------ */
.tag {
  --_c: var(--ink-2); --_bg: var(--surface-2);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--_bg); color: var(--_c);
  font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1;
}
.tag .i { width: 13px; height: 13px; stroke-width: 2; }
.tag-accent { --_c: var(--accent-text); --_bg: var(--accent-soft); }
.tag-pos { --_c: var(--pos); --_bg: var(--pos-soft); }
.tag-neg { --_c: var(--neg); --_bg: var(--neg-soft); }
.tag-warn { --_c: var(--warn); --_bg: var(--warn-soft); }
.tag-info { --_c: var(--info); --_bg: var(--info-soft); }
.tag-outline { --_bg: transparent; border: var(--bw) solid var(--line-2); }
.tag-ink { --_c: var(--bg); --_bg: var(--ink); }
.tag-l { height: 28px; padding: 0 12px; font-size: 13.5px; }
.tag { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; height: 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--_c, var(--ink-3)); flex: none; display: inline-block; }
.dot-pos { --_c: var(--pos); } .dot-neg { --_c: var(--neg); } .dot-warn { --_c: var(--warn); } .dot-accent { --_c: var(--accent); } .dot-info { --_c: var(--info); }
.dot-live { position: relative; }
.dot-live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--_c); animation: ping 1.8s var(--ease-out) infinite; }
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.badge-neg { background: var(--neg); color: #fff; }
.badge-quiet { background: var(--surface-2); color: var(--ink-2); }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); font-family: var(--font-mono); font-size: 11.5px; line-height: 1; box-shadow: 0 1px 0 var(--line-2); }

/* Cards / panels ------------------------------------------------------------ */
.card {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-3);
  box-shadow: var(--shadow-card); position: relative; min-width: 0;
}
.card-pad { padding: clamp(18px, 2.2vw, 28px); }
.card-pad-s { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: var(--bw) solid var(--line); }
.card-head .h5 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: var(--bw) solid var(--line); }
.card-hover { transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out), border-color var(--t-fast); }
.card-hover:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.card-hover:hover { transform: none; box-shadow: none; border-color: var(--ink); }
.card-ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.card-ink .ink-2, .card-ink .ink-3, .card-ink .label, .card-ink .caption { color: color-mix(in srgb, var(--bg) 62%, transparent); }
.card-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.card-sunk { background: var(--surface-2); box-shadow: none; }
.panel { border: var(--bw) solid var(--line); border-radius: var(--r-3); background: var(--surface); }

/* Callout */
.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-2);
  background: var(--_bg, var(--surface-2)); color: var(--ink-2); font-size: 14.5px; line-height: 1.5;
}
.note > .i { color: var(--_c, var(--ink-3)); margin-top: 1px; }
.note-warn { --_bg: var(--warn-soft); --_c: var(--warn); }
.note-neg { --_bg: var(--neg-soft); --_c: var(--neg); }
.note-pos { --_bg: var(--pos-soft); --_c: var(--pos); }
.note-accent { --_bg: var(--accent-soft); --_c: var(--accent-text); }

/* Tables -------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: 14.5px; }
.table th {
  text-align: left; font-family: var(--label-font); font-size: var(--label-size); font-weight: var(--label-weight);
  letter-spacing: var(--label-track); text-transform: var(--label-case); color: var(--ink-3);
  padding: 10px 14px; border-bottom: var(--bw) solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: var(--bw) solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--t-fast); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table .num, .table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .muted { color: var(--ink-3); }
.table-compact td { padding: 9px 12px; }
.table-compact th { padding: 8px 12px; }
.table tfoot td { font-weight: var(--w-strong); border-top: var(--bw) solid var(--line-strong); border-bottom: 0; }
.table td:first-child, .table th:first-child { padding-left: 0; }
.table td:last-child, .table th:last-child { padding-right: 0; }
.card .table td:first-child, .card .table th:first-child { padding-left: 20px; }
.card .table td:last-child, .card .table th:last-child { padding-right: 20px; }
.table td.num, .table .num { font-family: var(--font-mono); font-size: 13.5px; }

/* Divided list */
.list > li, .list > .li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: var(--bw) solid var(--line); }
.list > li:last-child, .list > .li:last-child { border-bottom: 0; }
.list-pad > li, .list-pad > .li { padding-inline: 20px; }
.list-hover > li, .list-hover > .li { transition: background-color var(--t-fast); }
.list-hover > li:hover, .list-hover > .li:hover { background: var(--surface-2); }

/* Key–value rows with dotted leaders (ledger feel, works everywhere) */
.kv { display: grid; gap: 0; }
.kv > div { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; }
.kv > div + div { border-top: var(--bw) solid var(--line); }
.kv dt, .kv .k { color: var(--ink-2); }
.kv dd, .kv .v { margin: 0 0 0 auto; font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); font-weight: 500; }
.leaders > div { border-top: 0 !important; padding: 7px 0; }
.leaders .k { display: flex; flex: 1; align-items: baseline; gap: 8px; min-width: 0; }
.leaders .k::after { content: ""; flex: 1; border-bottom: 1.5px dotted var(--ink-4); transform: translateY(-4px); min-width: 24px; }

/* Tabs: <div data-tabs><div class="tabs"><button data-tab="a">…</div><div data-panel="a">… */
.tabs { position: relative; display: flex; gap: 4px; border-bottom: var(--bw) solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > button, .tabs > a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  font-size: 15px; font-weight: 500; color: var(--ink-3); white-space: nowrap; transition: color var(--t-fast);
}
.tabs > button:hover, .tabs > a:hover { color: var(--ink); }
.tabs > [aria-selected="true"] { color: var(--ink); }
.tabs-ink { position: absolute; bottom: -1px; left: 0; height: 2px; width: 0; background: var(--ink); transition: transform .4s var(--ease-out), width .4s var(--ease-out); }
[data-panel] { animation: rise .45s var(--ease-out) both; }
[data-panel][hidden] { display: none; }

/* Accordion: <details class="acc"><summary>… */
.acc { border-bottom: var(--bw) solid var(--line); }
.acc:first-of-type { border-top: var(--bw) solid var(--line); }
.acc > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 0; font-size: 17px; font-weight: 500; transition: color var(--t-fast);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { color: var(--accent-text); }
.acc > summary::after {
  content: ""; flex: none; width: 14px; height: 14px; margin-right: 4px;
  background: linear-gradient(currentColor, currentColor) center/14px 1.6px no-repeat, linear-gradient(currentColor, currentColor) center/1.6px 14px no-repeat;
  transition: transform .35s var(--ease-out);
}
.acc[open] > summary::after { transform: rotate(135deg); }
.acc::details-content { block-size: 0; overflow: clip; transition: block-size .4s var(--ease-out), content-visibility .4s allow-discrete; }
.acc[open]::details-content { block-size: auto; }
.acc .acc-body { padding: 0 48px 22px 0; color: var(--ink-2); line-height: 1.65; }

/* Progress / meter */
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; position: relative; }
.progress > i { position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); background: var(--_c, var(--accent)); border-radius: inherit; transition: width 1s var(--ease-out); }
.progress-pos { --_c: var(--pos); } .progress-warn { --_c: var(--warn); } .progress-neg { --_c: var(--neg); }
.progress { border-radius: 0; height: 5px; background: var(--line); }
.ring { --v: 0; --_c: var(--accent); width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--_c) calc(var(--v) * 1%), var(--line) 0); display: grid; place-items: center; position: relative; transition: --v 1s; }
.ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Avatar */
.avatar {
  --_s: 36px; width: var(--_s); height: var(--_s); border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--_bg, var(--surface-2)); color: var(--_fg, var(--ink-2));
  font-size: calc(var(--_s) * .38); font-weight: 600; letter-spacing: 0; overflow: hidden; user-select: none;
}
.avatar-s { --_s: 28px; } .avatar-l { --_s: 48px; } .avatar-xl { --_s: 72px; }
.avatar-accent { --_bg: var(--accent); --_fg: var(--accent-ink); }
.avatar-ink { --_bg: var(--ink); --_fg: var(--bg); }
.avatar-liya { --_bg: var(--ink); --_fg: var(--bg); }
.avatar { font-family: var(--font-h); font-weight: 500; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* Stat tile */
.stat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat .figure { font-size: clamp(26px, 2.6vw, 34px); }
.stat .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.stat .delta .i { width: 14px; height: 14px; stroke-width: 2; }

/* Steps (numbered process) */
.steps { counter-reset: step; display: grid; gap: 0; }
.steps > li { counter-increment: step; position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding-bottom: 28px; }
.steps > li::before { content: counter(step, decimal-leading-zero); font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); padding-top: 4px; }
.steps > li::after { content: ""; position: absolute; left: 22px; top: 30px; bottom: 6px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }

/* Timeline */
.timeline > li { position: relative; padding: 0 0 26px 26px; }
.timeline > li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--_c, var(--ink-3)); background: var(--surface); }
.timeline > li::after { content: ""; position: absolute; left: 4px; top: 20px; bottom: 2px; width: 1px; background: var(--line); }
.timeline > li:last-child::after { display: none; }
.timeline > li.is-done { --_c: var(--pos); }
.timeline > li.is-now { --_c: var(--accent); }
.timeline > li.is-now::before { background: var(--accent); }

/* Tooltip (JS positions .tip) */
.tip {
  position: fixed; z-index: 1000; pointer-events: none; max-width: 260px;
  padding: 8px 10px; border-radius: var(--r-2); background: var(--ink); color: var(--bg);
  font-size: 12.5px; line-height: 1.4; font-weight: 500; opacity: 0; transform: translateY(4px);
  transition: opacity .14s, transform .14s var(--ease-out); box-shadow: 0 8px 24px -8px rgba(0,0,0,.35);
}
.tip.is-on { opacity: 1; transform: none; }
.tip .tip-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .tip-row { display: flex; align-items: center; gap: 8px; }
.tip .tip-key { width: 12px; height: 2px; border-radius: 2px; background: var(--_c); flex: none; }
.tip .tip-dim { opacity: .65; font-weight: 400; }

/* Toasts */
.toasts { position: fixed; z-index: 1200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 400px;
  padding: 13px 14px 13px 16px; border-radius: var(--r-3); background: var(--ink); color: var(--bg);
  font-size: 14.5px; line-height: 1.4; box-shadow: 0 18px 40px -14px rgba(0,0,0,.45);
  animation: toast-in .45s var(--ease-spring) both;
}
.toast.is-out { animation: toast-out .3s var(--ease-in-out) both; }
.toast .i { color: var(--_c, currentColor); }
.toast-pos { --_c: #6BD39B; }
.toast .toast-act { margin-left: auto; font-weight: 600; opacity: .85; white-space: nowrap; }
.toast .toast-act:hover { opacity: 1; text-decoration: underline; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@media (max-width: 760px) { .toasts { left: 12px; right: 12px; bottom: 84px; align-items: stretch; } .toast { min-width: 0; max-width: none; } }

/* Modal & drawer: <div class="modal" id="x" hidden><div class="modal-card">… */
.modal, .drawer { position: fixed; inset: 0; z-index: 900; display: grid; }
.modal { place-items: center; padding: 20px; }
.modal::before, .drawer::before { content: ""; position: absolute; inset: 0; background: var(--overlay); animation: fade-in .25s var(--ease-out) both; }
.modal.is-closing::before, .drawer.is-closing::before { animation: fade-out .2s both; }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--raised); border-radius: var(--r-3); box-shadow: var(--shadow-pop);
  animation: modal-in .4s var(--ease-spring) both;
}
.modal.is-closing .modal-card { animation: modal-out .2s var(--ease-in-out) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: var(--bw) solid var(--line); }
.drawer { justify-items: end; }
.drawer-panel {
  position: relative; width: min(440px, 100vw); height: 100%; background: var(--raised);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: drawer-in .45s var(--ease-out) both;
}
.drawer.is-closing .drawer-panel { animation: drawer-out .25s var(--ease-in-out) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }

/* Popover (JS toggles [data-pop] → .pop) */
.pop-wrap { position: relative; display: inline-flex; }
.pop {
  position: absolute; z-index: 800; top: calc(100% + 8px); right: 0; min-width: 240px;
  background: var(--raised); border-radius: var(--r-3); box-shadow: var(--shadow-pop); padding: 6px;
  transform-origin: top right; animation: pop-in .22s var(--ease-out) both;
}
.pop.pop-left { right: auto; left: 0; transform-origin: top left; }
.pop[hidden] { display: none; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-1); font-size: 14.5px; text-align: left; color: var(--ink); transition: background-color var(--t-fast); }
.menu-item:hover { background: var(--surface-2); }
.menu-item .i { color: var(--ink-3); width: 18px; height: 18px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* Skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-1); }

/* Chat ---------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 20px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; max-width: 86%; animation: rise .4s var(--ease-out) both; }
.msg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.msg-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.bubble { padding: 11px 14px; border-radius: var(--r-3); background: var(--surface-2); color: var(--ink); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.bubble p + p, .bubble p + ul, .bubble ul + p { margin-top: 8px; }
.bubble ul { padding-left: 16px; list-style: disc; }
.bubble li + li { margin-top: 3px; }
.bubble b { font-weight: 600; }
.msg-me { align-self: flex-end; flex-direction: row-reverse; }
.msg-me .bubble { background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.msg-me .msg-meta { justify-content: flex-end; }
.msg-ai .bubble { border-bottom-left-radius: 4px; background: var(--surface); border: var(--bw) solid var(--line); }
.msg-human .bubble { border-bottom-left-radius: 4px; background: var(--accent-soft); }
.msg-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-sources .tag { cursor: default; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; border-radius: var(--r-3); background: var(--surface); border: var(--bw) solid var(--line); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat > .chat-foot { padding: 12px 14px 14px; border-top: var(--bw) solid var(--line); display: grid; gap: 10px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border: var(--bw) solid var(--line-2); border-radius: var(--r-3); background: var(--raised); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; min-height: 24px; max-height: 160px; padding: 7px 4px; font-size: 15px; line-height: 1.5; }
.composer .btn-send { width: 38px; height: 38px; border-radius: var(--r-btn); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; transition: transform .15s, opacity .15s; }
.composer .btn-send:disabled { opacity: .35; }
.composer .btn-send:not(:disabled):active { transform: scale(.92); }
.rec { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.rec i { width: 3px; border-radius: 3px; background: var(--neg); animation: rec 0.9s ease-in-out infinite; height: 8px; }
.rec i:nth-child(2n) { animation-delay: .15s; } .rec i:nth-child(3n) { animation-delay: .3s; } .rec i:nth-child(5n) { animation-delay: .45s; }
@keyframes rec { 50% { height: 22px; } }

/* File rows */
.file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: var(--bw) solid var(--line); border-radius: var(--r-2); background: var(--raised); }
.file-ico { width: 36px; height: 42px; flex: none; border-radius: 4px; background: var(--surface-2); color: var(--ink-3); display: grid; place-items: center; position: relative; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .02em; }
.file-ico::after { content: attr(data-ext); position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .i { width: 14px; height: 14px; }

/* Empty state */
.empty { display: grid; place-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--ink-3); }

/* Misc */
.divider-label { display: flex; align-items: center; gap: 14px; color: var(--ink-3); font-size: 13px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--_c); flex: none; display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend .key-line { width: 14px; height: 2px; border-radius: 2px; background: var(--_c); }
.legend .key-box { width: 10px; height: 10px; border-radius: 2px; background: var(--_c); }
.scroll-x { overflow-x: auto; scrollbar-width: thin; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.flash { animation: flash 1.2s var(--ease-out); }
@keyframes flash { 0% { background-color: var(--mark); } 100% { background-color: transparent; } }

/* Charts ------------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-label { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .axis-label { font-family: var(--font-mono); font-size: 10.5px; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { opacity: .1; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; opacity: 0; transition: opacity .12s; }
.chart:hover .crosshair { opacity: .5; }
.chart .bar { transition: opacity .15s, filter .15s; }
.chart .bar:hover, .chart .bar.is-hot { filter: brightness(1.12); }
.chart .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart-grow .bar { transform-box: fill-box; transform-origin: bottom; animation: grow-y .8s var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes grow-y { from { transform: scaleY(0); } }
.chart-draw .series-line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s var(--ease-out) forwards; }
.chart-draw .series-area { animation: fade-in 1.2s .4s both; }
.spark { width: 100%; height: 36px; }
.spark path { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================================================
   Public site shell: header, mobile menu, footer, shared section patterns
   ========================================================================== */

.site-header { position: sticky; top: 0; z-index: 500; background: var(--header-bg); transition: box-shadow .3s, background-color .3s, transform .35s var(--ease-out); }
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--line); }
.hdr-row { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.hdr-nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.hdr-nav a { position: relative; padding: 8px 12px; font-size: 15px; color: var(--ink-2); transition: color var(--t-fast), background-color var(--t-fast); border-radius: var(--r-1); white-space: nowrap; }
.hdr-nav a:hover { color: var(--ink); }
.hdr-nav a.is-active { color: var(--ink); }
.hdr-actions { display: flex; align-items: center; gap: 10px; }
.hdr-login { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-2); padding: 8px 10px; border-radius: var(--r-1); transition: color var(--t-fast); }
.hdr-login:hover { color: var(--ink); }
.hdr-burger { display: none; }

/* Logos */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.logo-seal { width: 34px; height: 34px; }
.logo-seal circle { fill: none; stroke: currentColor; stroke-width: 1.2; }
.logo-seal path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; }
.logo-word { display: flex; flex-direction: column; line-height: 1; }
.logo-word b { font-family: var(--font-h); font-weight: 500; font-size: 22px; letter-spacing: -.01em; font-variation-settings: "opsz" 36; }
.logo-word small { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.logo-app { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.logo-app svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; }
.logo-name { font-family: var(--font-ui); font-weight: 680; font-size: 20px; letter-spacing: -.04em; }
.logo-term { font-family: var(--font-mono); font-weight: 600; font-size: 17px; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 1px; }
.logo-term i { display: inline-block; width: 9px; height: 17px; background: var(--accent); margin-left: 3px; transform: translateY(1px); }
.logo:hover .logo-term i { animation: blink 1s steps(1) infinite; }

/* Ledger header */
.hdr-ledger { --header-h: 76px; }
.hdr-strip { border-bottom: var(--bw) solid var(--line); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; color: var(--ink-3); }
.hdr-strip .container { min-height: 34px; padding-block: 6px; }
.hdr-strip b { color: var(--ink); font-weight: 500; }
.hdr-strip a:hover { color: var(--ink); }
.hdr-ledger .hdr-main { border-bottom: var(--bw) solid var(--line-strong); }
.hdr-ledger .hdr-nav { margin-left: 24px; gap: 2px; }
.hdr-ledger .hdr-nav a { padding: 8px 12px; }
.hdr-ledger .hdr-nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease-out); }
.hdr-ledger .hdr-nav a:hover::after, .hdr-ledger .hdr-nav a.is-active::after { transform: scaleX(1); }
.site-header.hdr-ledger.is-scrolled { box-shadow: none; }

/* Pult header */

/* Graphite header */
.hdr-ask { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 12px; border-radius: var(--r-2); border: 1px solid var(--line-2); color: var(--ink-2); font-size: 13.5px; transition: border-color var(--t-fast), color var(--t-fast); }
.hdr-ask:hover { border-color: var(--ink-3); color: var(--ink); }

/* Ticker */
.ticker { border-top: 1px solid var(--line); height: 34px; overflow: hidden; position: relative; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; color: var(--ink-3); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-track { display: flex; width: max-content; height: 100%; align-items: center; animation: ticker 60s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px; white-space: nowrap; border-right: 1px solid var(--line); }
.ticker-item b { color: var(--ink); font-weight: 500; }
.ticker-item .up { color: var(--pos); } .ticker-item .down { color: var(--neg); }
.ticker-item .hot { color: var(--accent-text); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* Mobile menu */
.mnav { position: fixed; inset: 0; z-index: 700; background: var(--bg); display: flex; flex-direction: column; padding: 18px var(--gutter) 28px; animation: fade-in .25s both; overflow-y: auto; }
.mnav.is-closing { animation: fade-out .2s both; }
.mnav-top { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.mnav-links { display: flex; flex-direction: column; margin-top: 28px; }
.mnav-links a { font-family: var(--font-h); font-weight: var(--w-h); font-size: 34px; letter-spacing: var(--track-h); line-height: 1.15; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); font-variation-settings: "opsz" var(--opsz); }
.mnav-links a .i { color: var(--ink-3); }
.mnav-foot { margin-top: auto; padding-top: 28px; display: grid; gap: 10px; }

@media (max-width: 1080px) {
  .hdr-nav, .hdr-strip .md-hide { display: none; }
  .hdr-burger { display: inline-grid; }
  .hdr-row { gap: 12px; justify-content: space-between; }
}
@media (max-width: 760px) {
  .hdr-login span, .hdr-ask span, .hdr-ask .kbd { display: none; }
  .hdr-actions .btn-cta { display: none; }
  .hdr-strip .container > :first-child { display: none; }
  .logo-word small { display: none; }
}

/* Footer */
.site-footer { border-top: var(--bw) solid var(--line); background: var(--bg-alt); padding: clamp(56px, 7vw, 96px) 0 28px; margin-top: 0; }
.site-footer { border-top-color: var(--line-strong); background: var(--bg); }
.ftr-sign { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; align-items: end; padding-bottom: clamp(40px, 6vw, 72px); border-bottom: var(--bw) solid var(--line); }
.ftr-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; padding: 40px 0; }
.ftr-cols h4 { margin-bottom: 14px; }
.ftr-cols a { display: block; padding: 4px 0; color: var(--ink-2); font-size: 15px; transition: color var(--t-fast); }
.ftr-cols a:hover { color: var(--ink); }
.ftr-bottom { padding-top: 22px; border-top: var(--bw) solid var(--line); font-size: 13px; color: var(--ink-3); }
.ftr-bottom a:hover { color: var(--ink); }
@media (max-width: 860px) { .ftr-sign { grid-template-columns: 1fr; } .ftr-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Public page patterns ----------------------------------------------------- */
.page-hero { padding: clamp(48px, 7vw, 104px) 0 clamp(36px, 5vw, 64px); }
.page-hero .crumbs { margin-bottom: 26px; }
.page-hero .h1 { max-width: 18ch; }
.page-hero .lead { margin-top: 22px; max-width: 58ch; }
.page-hero { border-bottom: var(--bw) solid var(--line); }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 64px; align-items: end; margin-bottom: clamp(32px, 4.5vw, 56px); }
.sec-head .lead { max-width: 52ch; }
.sec-head-solo { grid-template-columns: 1fr; }
@media (max-width: 860px) { .sec-head { grid-template-columns: 1fr; } }
.sec-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: .06em; display: block; margin-bottom: 18px; }
.sec-num::before { content: "§ "; }

/* CTA band */
.cta-band { border-radius: var(--r-3); padding: clamp(32px, 5vw, 64px); display: grid; grid-template-columns: minmax(0, 1.3fr) auto; gap: 28px; align-items: center; background: var(--ink); color: var(--bg); position: relative; overflow: hidden; }
.cta-band .lead { color: color-mix(in srgb, var(--bg) 70%, transparent); margin-top: 14px; }
.cta-band .btn-primary { --_bg: var(--bg); --_fg: var(--ink); --_bd: var(--bg); }
.cta-band .btn-primary:hover { --_bg: var(--surface-2); --_bd: var(--surface-2); }
.cta-band { background: var(--accent); color: var(--accent-ink); border-radius: 0; }
.cta-band .btn-primary { --_bg: var(--accent-ink); --_fg: var(--accent); --_bd: var(--accent-ink); }
@media (max-width: 760px) { .cta-band { grid-template-columns: 1fr; } }

/* Floating contact button (public) */
.fab-contact { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px 0 14px; border-radius: 99px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 500; box-shadow: 0 14px 34px -12px rgba(0,0,0,.45); transition: transform .3s var(--ease-spring); }
.fab-contact:hover { transform: translateY(-2px); }
.fab-contact { border-radius: 2px; }
.fab-contact .dot { --_c: #4ade80; }
.fab-contact .fab-l { display: inline-block; max-width: 180px; overflow: hidden; white-space: nowrap; transition: max-width .45s var(--ease-out), opacity .3s; }
.fab-contact.is-compact { padding: 0 15px; gap: 0; }
.fab-contact.is-compact .fab-l { max-width: 0; opacity: 0; }
.fab-contact.is-compact:hover { padding: 0 18px 0 14px; gap: 10px; }
.fab-contact.is-compact:hover .fab-l { max-width: 180px; opacity: 1; }
@media (max-width: 760px) { .fab-contact .fab-l { display: none; } .fab-contact, .fab-contact.is-compact, .fab-contact.is-compact:hover { padding: 0; width: 48px; justify-content: center; gap: 0; } }
