/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.94); backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--line); }
.top-in { width: min(1320px, 100% - 2 * var(--gutter)); margin-inline: auto; min-height: 66px; display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand-name { font: 700 1.3rem/1 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { position: relative; padding: 8px 12px; color: var(--ink-2); font-size: 0.96rem; white-space: nowrap; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); font-weight: 600; }
.nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--pine); border-radius: 2px; }
.top-you { display: none; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-2); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; white-space: nowrap; }
.top-you.on { display: inline-flex; }
.top-you b { color: var(--pine); }
@media (max-width: 1020px) {
  .top-in { flex-wrap: wrap; gap: 8px 16px; padding-block: 10px; }
  .nav { order: 3; width: 100%; margin: 0 -8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .top-in > .btn { margin-left: auto; }
  .top-you { display: none !important; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 18px; min-height: 46px;
  border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font: 600 0.97rem/1.2 var(--sans); white-space: nowrap; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.btn:hover { text-decoration: none; border-color: var(--pine-2); box-shadow: var(--sh); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-deep); border-color: var(--pine-deep); }
.btn-brass { background: var(--brass-soft); border-color: #e3cf9d; color: var(--brass-ink); }
.btn-brass:hover { border-color: var(--brass); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ink:hover { background: #0c1b29; border-color: #0c1b29; }
.btn-sm { padding: 8px 13px; min-height: 36px; font-size: 0.88rem; border-radius: 5px; }
.btn[disabled] { opacity: 0.55; cursor: default; box-shadow: none; }
.more { font-weight: 600; white-space: nowrap; }
.more::after { content: " \2192"; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pine); font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- the one line (learned from lefttosolve: one line starts everything) ---------- */
.cmd { display: flex; align-items: stretch; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; overflow: hidden; max-width: 100%; }
.cmd-text { flex: 1 1 auto; min-width: 0; padding: 13px 16px; font: 500 0.93rem/1.5 var(--mono); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.cmd .copy { flex: none; border: 0; border-left: 1.5px solid var(--ink); border-radius: 0; background: var(--ink); color: #fff; padding: 0 18px; font: 600 0.9rem/1 var(--sans); }
.cmd .copy:hover { background: #0c1b29; }
.cmd.block { flex-direction: column; }
.cmd.block .copy { border-left: 0; border-top: 1.5px solid var(--ink); padding: 12px 18px; }
.cmd.quiet { border: 1px solid var(--line-strong); }
.cmd.quiet .copy { background: var(--wash); color: var(--ink); border-color: var(--line-strong); }
.cmd-label { font: 600 0.8rem/1.3 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--sub); margin-bottom: 8px; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r); padding: clamp(18px, 2.2vw, 26px); }
a.card { display: block; color: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
a.card:hover { text-decoration: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
a.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.panel { border: 1px solid var(--line); border-radius: var(--r); padding: clamp(18px, 2.2vw, 26px); background: var(--card); }
.panel.wash { background: var(--pine-wash); border-color: #cfe1d7; }
.panel.brass { background: #fdf9ef; border-color: #ecdcb4; }
.note { border-left: 3px solid var(--pine); padding: 4px 0 4px 16px; color: var(--ink-2); }
.note.brass { border-left-color: var(--brass); }
.rule { height: 1px; border: 0; background: var(--line); margin: 0; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2); font: 600 0.7rem/1.5 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.ok { color: var(--pine); background: var(--pine-soft); border-color: #cfe5d8; }
.chip.wait { color: var(--brass-ink); background: var(--brass-soft); border-color: #ecdcb4; }
.chip.stop { color: var(--stop); background: var(--stop-soft); border-color: #eccfcb; }
.chip.live::before { animation: beat 2s ease-in-out infinite; }
@keyframes beat { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 107, 80, 0.45); } 60% { box-shadow: 0 0 0 6px rgba(18, 107, 80, 0); } }

/* ---------- numbers with definitions ---------- */
.facts { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line-strong); }
.fact { padding: 22px 22px 22px 0; }
.fact + .fact { padding-left: 22px; border-left: 1px solid var(--line); }
.fact-v { font: 600 clamp(1.9rem, 3.2vw, 2.7rem)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.fact-l { margin-top: 9px; font-weight: 600; font-size: 0.93rem; color: var(--ink); line-height: 1.3; }
.fact-d { margin-top: 4px; font-size: 0.8rem; line-height: 1.45; color: var(--sub); }
@media (max-width: 860px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact, .fact + .fact { padding: 18px 14px 18px 0; border-left: 0; border-bottom: 1px solid var(--line-2); }
  .fact:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
}

/* ---------- progress ---------- */
.meter { display: grid; gap: 7px; }
.meter-top { display: flex; justify-content: space-between; gap: 12px; font-size: 0.86rem; color: var(--ink-2); }
.meter-top b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--p, 0%); min-width: 3px; background: var(--pine); border-radius: inherit; transition: width 0.8s var(--ease); }
.bar.brass > i { background: var(--brass); }

/* ---------- evidence scale: the six rungs, drawn like a graduated instrument ---------- */
.scale { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.rung { display: grid; gap: 7px; }
.rung i { display: block; height: 9px; background: var(--line); border-radius: 2px; }
.rung b { font: 700 0.82rem/1 var(--sans); color: var(--sub); font-variant-numeric: tabular-nums; }
.rung span { font-size: 0.72rem; line-height: 1.25; color: var(--sub); }
.rung.done i { background: var(--pine); }
.rung.done b { color: var(--pine); }
.rung.done span { color: var(--ink-2); }
.rung.aim i { background: repeating-linear-gradient(90deg, var(--pine-2) 0 5px, transparent 5px 9px); }
.rung.aim b, .rung.aim span { color: var(--ink-2); }
@media (max-width: 520px) { .rung span { display: none; } }
.rail { display: grid; }
.rail-step { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 16px; padding-bottom: 20px; position: relative; }
.rail-step::before { content: ""; position: absolute; left: 22px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.rail-step:last-child::before { display: none; }
.rail-step:last-child { padding-bottom: 0; }
.rail-code { width: 46px; height: 32px; border-radius: 7px; display: grid; place-items: center; font: 700 0.86rem/1 var(--sans); background: #fff; border: 1.5px solid var(--line-strong); color: var(--sub); position: relative; z-index: 1; }
.rail-step.done .rail-code { background: var(--pine); border-color: var(--pine); color: #fff; }
.rail-step.done::before { background: var(--pine); }
.rail-step h4 { font-family: var(--sans); font-weight: 600; font-size: 1rem; margin-top: 3px; }
.rail-step p { font-size: 0.9rem; color: var(--sub); margin-top: 3px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; font: 600 0.74rem/1.3 var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); padding: 11px 16px 10px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.table td { padding: 13px 16px 13px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(18, 107, 80, 0.045); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .rank { font: 600 0.95rem/1.5 var(--sans); font-variant-numeric: tabular-nums; color: var(--sub); width: 1%; white-space: nowrap; padding-right: 18px; }
.table .name { font-weight: 600; color: var(--ink); }
.table .name a { color: inherit; }
.table .meta { display: block; font-weight: 400; font-size: 0.83rem; color: var(--sub); margin-top: 2px; }
.table .big { font: 600 1.1rem/1.2 var(--serif); color: var(--ink); }
.caption { font-size: 0.86rem; line-height: 1.5; color: var(--sub); margin-top: 12px; max-width: 78ch; }
.caption b { color: var(--ink); font-weight: 600; }

/* ---------- figure ---------- */
.figure { margin: 0; }
.figure-box { background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 18px 18px 12px; overflow-x: auto; }
.figure svg { display: block; width: 100%; min-width: 470px; height: auto; }
.figure-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); min-width: 470px; }
.figure-head h3 { font-size: 1.12rem; }
.figure-head span { font-size: 0.84rem; color: var(--sub); }
.figure-foot { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 0.86rem; color: var(--ink-2); min-width: 470px; }
.figure-foot b { color: var(--stop); font-variant-numeric: tabular-nums; }
.fp-axis { stroke: var(--ink); stroke-width: 1; }
.fp-grid { stroke: var(--line-2); stroke-width: 1; }
.fp-zero { stroke: var(--ink); stroke-width: 1.25; }
.fp-gate { stroke: var(--pine); stroke-width: 1.5; stroke-dasharray: 5 4; }
.fp-ci { stroke: var(--ink); stroke-width: 1.75; }
.fp-pt { fill: var(--pine); }
.fp-row:hover .fp-pt { fill: var(--pine-deep); }
.fp-band { fill: var(--pine-wash); }
.fp-t { font: 600 13px var(--sans); fill: var(--ink); }
.fp-t.sub { fill: var(--sub); font-weight: 400; font-size: 11.5px; }
.fp-t.num { font: 500 11.5px var(--mono); fill: var(--ink-2); }
.fp-t.tick { font: 400 11.5px var(--sans); fill: var(--sub); }
.fp-t.gate { fill: var(--pine); font-weight: 600; }
.fp-t.head { font: 600 10.5px var(--sans); letter-spacing: 0.07em; fill: var(--sub); text-transform: uppercase; }
.fp-empty { font: 500 13px var(--sans); fill: var(--sub); }

/* ---------- checklist ---------- */
.checks { display: grid; gap: 10px; }
.check-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 0.95rem; color: var(--ink-2); }
.check-row i { width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font: 700 0.7rem/1 var(--sans); font-style: normal; background: var(--pine-soft); color: var(--pine); }
.check-row.fail i { background: var(--stop-soft); color: var(--stop); }
.check-row.fail { color: var(--stop); }
.check-row.idle i { background: var(--line-2); color: var(--sub); }
.check-row .mono { color: var(--sub); }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; }
.field label, .label { font: 600 0.92rem/1.35 var(--sans); color: var(--ink); }
.hint { font-size: 0.84rem; line-height: 1.45; color: var(--sub); }
.field input[type="text"], .field input[type="number"], .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font: 400 1rem/1.45 var(--sans); transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--pine-2); box-shadow: 0 0 0 3px var(--pine-soft); }
.agree { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 0.92rem; line-height: 1.5; color: var(--ink-2); cursor: pointer; }
.agree input { width: 19px; height: 19px; margin-top: 3px; accent-color: var(--pine); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { padding: 10px 16px; min-height: 44px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2); font: 600 0.95rem/1.2 var(--sans); }
.choice:hover { border-color: var(--pine-2); }
.choice.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.msg { padding: 12px 14px; border-radius: 6px; font-size: 0.93rem; line-height: 1.45; }
.msg.err { background: var(--stop-soft); color: var(--stop); border: 1px solid #eccfcb; }
.msg.wait { background: var(--brass-soft); color: var(--brass-ink); border: 1px solid #ecdcb4; }
.msg.ok { background: var(--pine-soft); color: var(--pine-deep); border: 1px solid #cfe5d8; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; background: none; border: 0; padding: 12px 16px; color: var(--sub); font: 600 0.97rem/1.2 var(--sans); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--pine); }
.tab small { font-weight: 500; color: var(--faint); margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---------- empty state ---------- */
.empty { padding: 30px clamp(18px, 3vw, 34px); border: 1px dashed var(--line-strong); border-radius: var(--r); background: #fff; }
.empty h4 { font-family: var(--serif); font-size: 1.2rem; }
.empty p { color: var(--sub); margin-top: 6px; max-width: 58ch; }
.empty .row { margin-top: 16px; }
.skel { height: 180px; border-radius: var(--r); background: var(--line-2); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 60; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 0.93rem; box-shadow: var(--sh-2); transition: opacity 0.2s, transform 0.25s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.foot { background: var(--wash); border-top: 1px solid var(--line); padding-block: 44px 52px; font-size: 0.92rem; color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot h4 { font: 600 0.78rem/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--sub); margin-bottom: 12px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot a { color: var(--ink-2); }
.foot-legal { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--sub); font-size: 0.84rem; display: grid; gap: 6px; }
@media (max-width: 820px) { .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
