/* ==========================================================================
   TradePilot Docs — stylesheet
   Plain CSS, no build step. Light + dark themes via [data-theme] on <html>.
   Font: Inter everywhere.
   ========================================================================== */

:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8f0fe;
  --primary-text: #1d4ed8;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;

  --success: #059669;
  --success-soft: #e7f7f0;
  --success-border: #b7e6d2;
  --warn: #b45309;
  --warn-soft: #fff6e5;
  --warn-border: #f6d9a6;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  --danger-border: #f6c4c4;
  --info: #2563eb;
  --info-soft: #eef4ff;
  --info-border: #c8d9fb;

  --seg-1: #2563eb;
  --seg-2: #7c3aed;
  --seg-3: #0891b2;
  --seg-free: #e2e8f0;

  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --sidebar-w: 280px;
  --toc-w: 210px;
  --radius: 14px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0e16;
  --surface: #111827;
  --surface-2: #172033;
  --text: #e7edf7;
  --text-2: #c3cddd;
  --muted: #8d9ab0;
  --border: #222c3d;
  --border-strong: #303c53;

  --primary: #4d86ff;
  --primary-hover: #6b9bff;
  --primary-soft: rgba(77, 134, 255, .14);
  --primary-text: #8cb2ff;
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .10);
  --success-border: rgba(52, 211, 153, .32);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .09);
  --warn-border: rgba(251, 191, 36, .30);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .10);
  --danger-border: rgba(248, 113, 113, .32);
  --info: #6b9bff;
  --info-soft: rgba(77, 134, 255, .10);
  --info-border: rgba(77, 134, 255, .32);

  --seg-1: #4d86ff;
  --seg-2: #a78bfa;
  --seg-3: #22d3ee;
  --seg-free: #263247;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font: 15.5px/1.65 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--primary-soft); }
button { font-family: var(--font); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40;
  transition: transform .25s ease;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: var(--text); }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 0 0 1px var(--border); }
.sidebar__brand strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--text); line-height: 1.15; }
.sidebar__brand span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.search { position: relative; margin: 0 16px 8px; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search svg { position: absolute; left: 11px; top: 12px; width: 16px; height: 16px; color: var(--muted); }
.search kbd { position: absolute; right: 9px; top: 9px; }
.search-results {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 60vh; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--primary-soft); text-decoration: none; }
.search-results b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; }
.search-results small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.search-results mark { background: transparent; color: var(--primary-text); font-weight: 700; }
.search-results .empty { padding: 14px; font-size: 14px; color: var(--muted); }

.nav { position: relative; flex: 1; overflow-y: auto; padding: 4px 12px 24px; }
.nav__group { margin-top: 18px; }
.nav__label { padding: 0 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 9px; margin: 1px 0;
  font-size: 14px; font-weight: 500; color: var(--text-2); line-height: 1.35;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a .ico { width: 22px; height: 22px; flex: none; display: grid; place-items: center; font-size: 13px; border-radius: 6px; background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.nav a.active .ico { background: var(--primary); }
.nav a .tag {
  margin-left: auto; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: var(--primary); color: #fff;
}

.sidebar__foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: 600 13px var(--font); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle svg { width: 15px; height: 15px; }
.app-link { margin-left: auto; font-size: 13px; font-weight: 600; }

.topbar {
  display: none; position: sticky; top: 0; z-index: 30;
  height: 58px; padding: 0 16px; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar img { width: 30px; height: 30px; border-radius: 8px; }
.topbar strong { font-size: 16px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.menu-btn {
  margin-left: auto; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-btn svg { width: 20px; height: 20px; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.page {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 48px;
  max-width: 1240px; margin: 0 auto; padding: 48px 44px 96px;
}
.content { min-width: 0; max-width: 900px; }

/* ---------- On-this-page TOC ---------- */
.toc { position: sticky; top: 40px; align-self: start; max-height: calc(100vh - 80px); overflow-y: auto; font-size: 13px; }
.toc__label { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--border); color: var(--muted); line-height: 1.4; font-weight: 500; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--primary-text); border-left-color: var(--primary); font-weight: 700; }

/* ---------- Typography ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-text);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
h1, h2, h3, h4 { color: var(--text); font-family: var(--font); }
h1 { font-size: clamp(30px, 4.4vw, 42px); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; margin: 16px 0 12px; }
h2 { font-size: 25px; font-weight: 800; line-height: 1.2; letter-spacing: -.025em; margin: 64px 0 8px; display: flex; align-items: center; gap: 12px; }
h2 .sec {
  font-size: 12px; font-weight: 700; color: var(--primary-text); background: var(--primary-soft);
  border-radius: 8px; padding: 3px 8px; flex: none; letter-spacing: 0;
}
h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 32px 0 8px; }
h4 { font-size: 15px; font-weight: 700; margin: 22px 0 6px; }
.lead { font-size: 17.5px; line-height: 1.6; color: var(--muted); margin: 0 0 24px; max-width: 720px; }
.sub { color: var(--muted); margin: 0 0 18px; }
p { margin: 0 0 14px; }
strong { color: var(--text); font-weight: 650; }
ul, ol { padding-left: 20px; margin: 0 0 16px; }
li { margin: 5px 0; }
li::marker { color: var(--muted); }
code {
  font: 600 .86em var(--font); background: var(--surface-2); color: var(--text);
  padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border);
}
kbd { font: 700 11px var(--font); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.ui {
  display: inline-block; font-size: .88em; font-weight: 650; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 0 7px; line-height: 1.65; white-space: nowrap;
}
.path { font-size: .9em; font-weight: 600; color: var(--primary-text); }
.muted { color: var(--muted); }

/* ---------- Facts / stat tiles ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; margin: 6px 0 28px; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); }
.fact small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.fact b { display: block; font-size: 15px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; letter-spacing: -.01em; }
.stat-big b { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(175px, 100%), 1fr)); gap: 12px; margin: 16px 0 24px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); color: var(--text-2); transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-2px); }
.card__icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-text); margin-bottom: 12px; font-size: 18px;
}
.card h3, .card h4 { margin: 0 0 4px; font-size: 15.5px; }
.card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.card ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.card .more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; }
.card--accent { border-top: 3px solid var(--primary); }
.card--violet { border-top: 3px solid var(--violet); }
.card--green { border-top: 3px solid var(--success); }
.card--amber { border-top: 3px solid var(--warn); }
.card .price { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }

/* ---------- Callouts ---------- */
.callout {
  display: flex; gap: 12px; padding: 13px 16px; margin: 18px 0;
  border-radius: 12px; border: 1px solid var(--info-border); background: var(--info-soft);
  font-size: 14.5px; line-height: 1.6;
}
.callout > .ico {
  flex: none; width: 20px; height: 20px; border-radius: 50%; margin-top: 2px;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--info);
}
.callout > div > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 6px; }
.callout.tip { border-color: var(--success-border); background: var(--success-soft); }
.callout.tip > .ico { background: var(--success); }
.callout.warn { border-color: var(--warn-border); background: var(--warn-soft); }
.callout.warn > .ico { background: var(--warn); }
.callout.danger { border-color: var(--danger-border); background: var(--danger-soft); }
.callout.danger > .ico { background: var(--danger); }
:root[data-theme="dark"] .callout > .ico { color: #0a0e16; }

/* ---------- Numbered steps (vertical) ---------- */
.steps { list-style: none; padding: 0; margin: 18px 0 24px; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 20px 46px; margin: 0; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--primary);
}
.steps > li::after { content: ""; position: absolute; left: 14.5px; top: 32px; bottom: 2px; width: 1.5px; background: var(--border); }
.steps > li:last-child { padding-bottom: 2px; }
.steps > li:last-child::after { display: none; }
.steps > li > strong:first-child { display: block; color: var(--text); font-size: 15px; margin-bottom: 1px; }
.steps > li p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- Flow (horizontal steps with arrows) ---------- */
.flow { display: flex; align-items: stretch; gap: 0; margin: 20px 0 26px; }
.flow__step {
  flex: 1 1 0; min-width: 0; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 14px 14px; box-shadow: var(--shadow); text-align: center;
}
.flow__arrow { flex: 0 0 28px; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.flow__num {
  width: 30px; height: 30px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff; background: var(--primary);
}
.flow__emoji { font-size: 24px; line-height: 1; margin-bottom: 8px; }
.flow__step b { display: block; font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.flow__step span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.flow__step.is-hl { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 70%); }
.flow__step.is-green .flow__num { background: var(--success); }
.flow__step.is-amber .flow__num { background: var(--warn); }
.flow__step.is-red .flow__num { background: var(--danger); }
.flow__step.is-violet .flow__num { background: var(--violet); }

/* ---------- Diagram: master -> engine -> followers ---------- */
.diagram { display: grid; grid-template-columns: 1fr auto 1.15fr auto 1fr; align-items: center; gap: 10px; margin: 22px 0 28px; padding: 22px; border-radius: 18px; border: 1px solid var(--border); background: radial-gradient(120% 120% at 50% 0%, var(--primary-soft), transparent 60%), var(--surface); box-shadow: var(--shadow); }
.node { border-radius: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.node .emoji { font-size: 26px; }
.node b { display: block; color: var(--text); font-size: 14px; font-weight: 700; margin-top: 4px; }
.node span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.node.engine { border: 1.5px solid var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.node.engine ul { list-style: none; padding: 0; margin: 8px 0 0; text-align: left; font-size: 12px; color: var(--text-2); }
.node.engine li { margin: 3px 0; padding-left: 16px; position: relative; }
.node.engine li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 800; }
.connector { color: var(--primary); font-size: 20px; font-weight: 800; text-align: center; }
.connector small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.followers { display: grid; gap: 8px; }
.followers .node { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; }
.followers .node .emoji { font-size: 20px; }
.followers .node b { margin: 0; font-size: 13px; }
.followers .node em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; color: var(--primary-text); background: var(--primary-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ---------- Allocation budget bar ---------- */
.budget { margin: 18px 0 26px; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.budget__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.budget__head b { color: var(--text); font-size: 14.5px; }
.budget__head span { font-size: 13px; color: var(--muted); font-weight: 600; }
.bar { display: flex; height: 38px; border-radius: 10px; overflow: hidden; background: var(--seg-free); }
.bar > div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; transition: flex-basis .25s; }
.bar .s1 { background: var(--seg-1); }
.bar .s2 { background: var(--seg-2); }
.bar .s3 { background: var(--seg-3); }
.bar .free { color: var(--muted); background: repeating-linear-gradient(135deg, var(--seg-free), var(--seg-free) 8px, transparent 8px, transparent 14px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Timeline (phases) ---------- */
.timeline { display: grid; grid-template-columns: 2.4fr 1fr 1.2fr; margin: 20px 0 26px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.timeline > div { padding: 14px 16px; background: var(--surface); border-right: 1px solid var(--border); position: relative; }
.timeline > div:last-child { border-right: 0; }
.timeline > div::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.timeline .t-green::before { background: var(--success); }
.timeline .t-amber::before { background: var(--warn); }
.timeline .t-red::before { background: var(--danger); }
.timeline b { display: block; color: var(--text); font-size: 14px; }
.timeline span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.timeline em { display: inline-block; margin-top: 8px; font-style: normal; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.timeline .t-green em { color: var(--success); background: var(--success-soft); }
.timeline .t-amber em { color: var(--warn); background: var(--warn-soft); }
.timeline .t-red em { color: var(--danger); background: var(--danger-soft); }

/* ---------- Interactive calculator ---------- */
.calc { margin: 18px 0 26px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.calc__head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.calc__head b { color: var(--text); font-size: 14.5px; }
.calc__head span { font-size: 12px; font-weight: 700; color: var(--primary-text); background: var(--primary-soft); padding: 2px 8px; border-radius: 999px; }
.calc__body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.calc__inputs { padding: 16px 18px; display: grid; gap: 14px; border-right: 1px solid var(--border); }
.calc label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.calc label output { float: right; color: var(--primary-text); }
.calc input[type=number] { width: 100%; height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: 600 14px var(--font); }
.calc input[type=range] { width: 100%; accent-color: var(--primary); }
.calc__out { padding: 16px 18px; display: grid; gap: 8px; align-content: start; background: var(--surface-2); }
.calc__row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--muted); }
.calc__row b { color: var(--text); }
.calc__result { margin-top: 6px; padding: 14px; border-radius: 12px; background: var(--primary); color: #fff; text-align: center; }
.calc__result small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.calc__result b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: #fff; line-height: 1.15; }

/* ---------- Status pills row ---------- */
.states { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; margin: 16px 0 24px; }
.state { border-radius: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.state .badge { margin-bottom: 8px; }
.state p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Screenshots ---------- */
.shot { margin: 20px 0 26px; }
.shot__frame {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong);
  background: #0b0f17; box-shadow: var(--shadow-lg); cursor: zoom-in; position: relative;
}
.shot__bar { height: 28px; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: #151b27; border-bottom: 1px solid #222a39; }
.shot__bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a4356; }
.shot__bar i:nth-child(1) { background: #ff5f57; } .shot__bar i:nth-child(2) { background: #febc2e; } .shot__bar i:nth-child(3) { background: #28c840; }
.shot__bar span {
  flex: 1; margin: 0 40px 0 14px; height: 17px; border-radius: 5px; background: #0d121c;
  font: 500 10.5px/17px var(--font); color: #7d8aa3; text-align: center;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.shot__frame img { width: 100%; height: auto; }
.shot__frame::after {
  content: "Click to enlarge"; position: absolute; right: 12px; bottom: 12px;
  font: 600 11.5px var(--font); color: #fff; background: rgba(0,0,0,.6);
  padding: 4px 9px; border-radius: 999px; opacity: 0; transition: opacity .15s;
}
.shot__frame:hover::after { opacity: 1; }
.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.shot--narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.shot--modal .shot__bar { display: none; }
.shot-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin: 20px 0 26px; align-items: start; }
.shot-pair .shot { margin: 0; }

/* Split: text left, screenshot right */
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; margin: 8px 0 18px; }
.split > .shot { margin: 0; }
.split .steps { margin-top: 4px; }

.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 8, 14, .88); display: none; align-items: center; justify-content: center; padding: 28px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1600px, 100%); max-height: 100%; border-radius: 10px; box-shadow: var(--shadow-lg); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
.yes { color: var(--success); font-weight: 800; }
.no { color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.badge.green { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
.badge.amber { color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft); }
.badge.red { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.badge.blue { color: var(--primary-text); border-color: var(--info-border); background: var(--info-soft); }

/* ---------- Formula ---------- */
.formula {
  margin: 14px 0 20px; padding: 16px 18px; border-radius: 12px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  font-size: 14.5px; font-weight: 600; line-height: 1.9; color: var(--text); overflow-x: auto;
  font-variant-numeric: tabular-nums;
}
.formula .c { color: var(--muted); font-weight: 500; }
.formula .op { color: var(--primary-text); font-weight: 800; padding: 0 4px; }

/* ---------- Tabs ---------- */
.tabs { margin: 18px 0 26px; }
.tabs__list { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }
.tabs__list button {
  flex: 1 0 auto; white-space: nowrap; border: 0; background: transparent; color: var(--muted);
  font: 650 13.5px var(--font); padding: 8px 14px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tabs__list button:hover { color: var(--text); }
.tabs__list button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs__panel { padding-top: 16px; }
.tabs__panel[hidden] { display: none; }
.tabs__panel > :first-child { margin-top: 0; }

/* ---------- Accordion (FAQ) ---------- */
details.qa { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 8px 0; box-shadow: var(--shadow); }
details.qa summary { cursor: pointer; list-style: none; padding: 13px 16px; font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after { content: "+"; margin-left: auto; font-size: 18px; font-weight: 600; color: var(--muted); transition: transform .15s; }
details.qa[open] summary::after { transform: rotate(45deg); }
details.qa > div { padding: 0 16px 14px; font-size: 14.5px; color: var(--text-2); }
details.qa > div > :last-child { margin-bottom: 0; }

/* ---------- Pager / footer ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.pager a:hover { border-color: var(--primary); text-decoration: none; }
.pager small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 1px; }
.pager b { font-weight: 700; }
.pager .next { text-align: right; grid-column: 2; }
.footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: 28px 30px; border-radius: 20px; margin-bottom: 24px; border: 1px solid var(--border);
  background: radial-gradient(120% 140% at 100% 0%, var(--primary-soft) 0%, transparent 55%), var(--surface); box-shadow: var(--shadow); }
.hero h1 { margin-top: 14px; }
.hero .lead { margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .page { grid-template-columns: minmax(0, 1fr); padding: 44px 36px 80px; }
  .toc { display: none; }
  .content { width: 100%; justify-self: center; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 8, 14, .5); }
  .topbar { display: flex; }
  .main { margin-left: 0; }
  .page { padding: 26px 16px 64px; }
  h2 { font-size: 22px; margin-top: 52px; }
  .lead { font-size: 16px; }
  .hero { padding: 22px 18px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .shot__bar span { margin-right: 0; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .flow { flex-direction: column; }
  .flow__arrow { flex-basis: 26px; transform: rotate(90deg); }
  .diagram { grid-template-columns: 1fr; }
  .connector { transform: rotate(90deg); }
  .connector small { transform: rotate(-90deg); }
  .timeline { grid-template-columns: 1fr; }
  .timeline > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .calc__body { grid-template-columns: 1fr; }
  .calc__inputs { border-right: 0; border-bottom: 1px solid var(--border); }
  .shot-pair { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .sidebar, .topbar, .toc, .pager, .search { display: none !important; }
  .main { margin: 0; }
  .tabs__panel[hidden] { display: block !important; }
}

a.flow__step { color: inherit; transition: border-color .15s, transform .15s; }
a.flow__step:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); }
.card--red { border-top: 3px solid var(--danger); }

/* "How it works" explanation block */
.how { margin: 16px 0 22px; padding: 16px 18px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow); }
.how > b:first-child { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--primary-text); margin-bottom: 6px; }
.how p { margin: 0 0 10px; font-size: 15px; line-height: 1.65; color: var(--text-2); }
.how ul { margin: 0 0 10px; font-size: 15px; }
.how > :last-child { margin-bottom: 0; }
.desc { font-size: 15.5px; line-height: 1.7; color: var(--text-2); max-width: 760px; }
