[hidden] { display: none !important; }
/* Dashboard: the harbour's white page and single ink, laid out as cards with 1px rules. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 12px; }
.error { color: var(--alarm); }
code { font: inherit; background: var(--wash); padding: 0 3px; }
input, select { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 0; padding: 7px 8px; }
input[type="range"] { padding: 0; border: 0; accent-color: var(--ink); width: 100%; }
input[type="radio"] { accent-color: var(--ink); }
iframe { border: 0; display: block; width: 100%; height: 100%; pointer-events: none; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px); align-items: center; gap: 24px; padding: 24px max(16px, 4vw); }
.login[hidden] { display: none; }
.login-pic { aspect-ratio: 360 / 300; width: 100%; }
.login-card { display: grid; gap: 12px; }
.login-card h1 { font-size: 16px; }
.login-card .back { justify-self: start; margin: -10px -10px 0; }
.button.wide { width: 100%; padding: 12px; font-weight: 600; }
.hint { font-size: 12px; margin-top: -6px; }
.watch { display: grid; gap: 8px; margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--faint); }
.watch input { flex: 1; min-width: 0; }
@media (max-width: 760px) { .login { grid-template-columns: 1fr; } .login-pic { max-width: 420px; justify-self: center; } }

/* ---------- dashboard ---------- */
#dash[hidden] { display: none; }
.top { display: flex; align-items: center; gap: 12px; padding: 6px max(16px, 2vw); border-bottom: 1px solid var(--ink); position: sticky; top: 0; background: var(--paper); z-index: 4; flex-wrap: wrap; }
.brand { font-weight: 600; text-decoration: none; padding: 4px 0; }
.spacer { flex: 1; }
.chip { border: 1px solid var(--ink); padding: 1px 6px; font-size: 12px; }
.chip.live::before { content: "● "; color: var(--good); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; padding: 16px max(16px, 2vw) 48px; max-width: 1360px; margin: 0 auto; }
.card { border: 1px solid var(--ink); padding: 16px; background: var(--paper); min-width: 0; display: grid; gap: 12px; align-content: start; }
.card h2 { font-size: 13px; }
.card h3 { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.hero { grid-column: span 8; grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr); align-items: center; }
.budget { grid-column: span 4; }
.approvals { grid-column: span 4; }
.split { grid-column: span 8; }
.forecast { grid-column: span 8; }
.history { grid-column: span 4; grid-row: span 2; align-content: start; }
.compare { grid-column: span 8; }
@media (max-width: 1100px) {
  .hero, .split, .forecast, .compare { grid-column: span 12; }
  .budget, .approvals, .history { grid-column: span 6; }
  .history { grid-row: auto; }
}
@media (max-width: 700px) {
  .grid > .card { grid-column: span 12; }
  .hero { grid-template-columns: 1fr; }
}

.pic { aspect-ratio: 360 / 280; width: 100%; }
.hero-side { display: grid; gap: 16px; align-content: center; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 0; }
.stats div { min-width: 0; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats dd small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.stats .alarm dd { color: var(--alarm); }
.clock { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.clock .scrub { grid-column: 1 / -1; }
.scrub { display: grid; gap: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.budget-row { display: flex; align-items: baseline; gap: 6px; }
.budget-row .dollar { font-size: 28px; font-weight: 600; }
.budget-row input { width: 6.5ch; font-size: 28px; font-weight: 600; border: 0; border-bottom: 1px solid var(--ink); padding: 0 2px; font-variant-numeric: tabular-nums; }
.plan-line { line-height: 1.55; }
.plan-line b { font-variant-numeric: tabular-nums; }
.plan-line .gap { color: var(--alarm); }
.mode { border: 1px solid var(--faint); margin: 0; padding: 8px 12px 10px; display: grid; gap: 4px; }
.mode legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.mode label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.rails summary { cursor: pointer; }
.rails label { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-top: 10px; font-size: 12px; }
.rails label input { grid-column: 1 / -1; }
.rails output { font-variant-numeric: tabular-nums; }

.proposal { border: 1px solid var(--ink); padding: 12px; display: grid; gap: 8px; background: var(--wash); }
.proposal .what { font-weight: 600; }
.proposal .why { color: var(--muted); font-size: 12px; }
.proposal .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.proposal pre { margin: 0; font: inherit; font-size: 11px; white-space: pre-wrap; word-break: break-all; background: var(--paper); border: 1px solid var(--faint); padding: 8px; }
.empty { color: var(--muted); }

.split-bar { display: flex; height: 36px; gap: 2px; position: relative; }
.split-bar .seg { height: 100%; min-width: 0; position: relative; }
.split-bar .seg.ai { background: var(--ai); }
.split-bar .seg.flight { background: repeating-linear-gradient(135deg, var(--flight) 0 3px, #fff 3px 6px); }
.split-bar .seg.yield { background: var(--yield); }
.split-bar .seg.liquid { background: var(--faint); }
.split-bar .target { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); }
.split-bar .target::after { content: attr(data-label); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; white-space: nowrap; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend .sw { width: 10px; height: 10px; display: inline-block; }
.legend .sw.line { height: 2px; width: 14px; }
.legend .sw.dash { height: 0; width: 14px; border-top: 2px dashed currentColor; background: none !important; }
.legend.inline { font-size: 11px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 10px ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; fill: var(--muted); }
.chart .grid-line { stroke: var(--faint); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--ink); stroke-width: 1; shape-rendering: crispEdges; }
.chart .playhead { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 2; shape-rendering: crispEdges; }
.chart .hover-line { stroke: var(--ink); stroke-width: 1; shape-rendering: crispEdges; }
.chart .label-ink { fill: var(--ink); }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--paper); border: 1px solid var(--ink); padding: 6px 8px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tip b { font-weight: 600; }
.tip .sw { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }

.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 760px; overflow: auto; }
.history-list li { display: grid; grid-template-columns: 7ch 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--faint); font-size: 12px; }
.history-list .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-list .kind { font-weight: 600; }
.history-list .kind::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--ink); }
.history-list .kind.to-ai::before { background: var(--ai); }
.history-list .kind.to-yield::before { background: var(--yield); }
.history-list .kind.flight::before { background: var(--flight); }
.history-list .kind.owner::before { background: var(--paper); border: 1px solid var(--ink); }
.history-list .detail { grid-column: 2; color: var(--muted); }

.cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--ink); }
.cmp td { padding: 6px 0; border-bottom: 1px solid var(--faint); }
.cmp td:not(:first-child), .cmp th:not(:first-child) { text-align: right; }
.cmp tr.ours td { font-weight: 600; }
.cmp .bad { color: var(--alarm); }

/* ---------- wallet ---------- */
#wallets { width: min(360px, calc(100vw - 32px)); }
.wallet-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.wallet-list button { width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); padding: 10px 12px; cursor: pointer; text-align: left; }
.wallet-list button:hover, .wallet-list button:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.wallet-list img { width: 20px; height: 20px; }
.wallet-list .muted { margin-left: auto; font-size: 12px; }
.wallet-list button:hover .muted { color: var(--faint); }
.rails-save { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.owner { border-top: 1px solid var(--faint); padding-top: 12px; display: grid; gap: 8px; }
.owner h3 { color: var(--ink); font-weight: 600; margin: 0; }
.owner-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.owner-row input { width: 8ch; }
.button.confirm { background: var(--alarm); border-color: var(--alarm); color: #fff; }
.busy-note { color: var(--muted); font-size: 12px; }
#who b { color: var(--ink); font-weight: 600; }
