/* IDYL app — page styles. Tokens come from idyl.css; nothing here redefines them. */

/* ---------- Base ---------- */
body.app { font-size: 14px; line-height: 1.5; min-height: 100vh; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 12.5px; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.link { color: var(--gold-2); text-decoration: underline; text-decoration-color: rgba(255,216,154,.35); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--gold-2); }
.inline-code { font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--ink-850); border: 1px solid var(--line); color: var(--bone-2); white-space: nowrap; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.skip {
  position: fixed; left: 12px; top: 12px; z-index: 100; transform: translateY(-160%);
  background: var(--bone); color: var(--ink-950); border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 500; cursor: pointer;
}
.skip:focus-visible { transform: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 14px 18px; border-right: 1px solid var(--line); background: var(--ink-950);
}
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 2px 10px 0; color: var(--bone); }
.brand .mark { width: 26px; height: 26px; }
.brand .wordmark { font-size: 27px; margin-top: -3px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 30px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px;
  border-radius: 9px; color: var(--bone-2); font-size: 14px; transition: background .2s, color .2s;
}
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--mute); transition: color .2s; }
.nav a:hover { background: var(--ink-900); color: var(--bone); }
.nav a:hover svg { color: var(--bone-2); }
.nav a[aria-current="page"] { background: var(--ink-850); color: var(--bone); box-shadow: inset 0 0 0 1px var(--line); }
.nav a[aria-current="page"] svg { color: var(--bone); }
/* The active item carries the mark's sun: idle, but alive. */
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(242,184,91,.14);
}
.nav a[aria-current="page"] .nav-tag { display: none; }
.nav-tag { margin-left: auto; font: 500 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 10px; }

.side-status {
  margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-900);
}
.side-status-row { display: flex; align-items: center; gap: 10px; }
.side-status-title { font-weight: 500; font-size: 13.5px; }
.side-dl { margin: 12px 0 0; display: grid; gap: 6px; }
.side-dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.side-dl dt { color: var(--mute); }
.side-dl dd { margin: 0; color: var(--bone-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.side-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--mute); line-height: 1.45; }

.main-col { min-width: 0; display: flex; flex-direction: column; }

/* Top chrome (sticky: top bar + banners always visible) */
.chrome { position: sticky; top: 0; z-index: 30; background: rgba(7,9,13,.88); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 32px; }
.brand-m { display: none; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.mode-badge {
  display: inline-flex; align-items: center; gap: 9px; height: 28px; padding: 0 11px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px; white-space: nowrap;
  font: 500 11px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--bone-2);
}
[data-mode="live"] .mode-badge { color: var(--meadow); border-color: rgba(127,227,160,.32); }
[data-mode="demo"] .mode-badge { color: var(--gold-2); border-color: rgba(242,184,91,.32); }
[data-mode="stale"] .mode-badge { color: var(--ember); border-color: rgba(255,122,92,.32); }
.dot.err { background: var(--ember); box-shadow: 0 0 0 3px rgba(255,122,92,.15); }
.dot { flex: none; }
[data-mode="live"] .mode-badge .dot { animation: breathe 2.8s var(--ease) infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 5px rgba(127,227,160,.05); } }

.gw-host { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.wallet-wrap { position: relative; }
.wallet-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wallet-btn.is-connected { background: var(--ink-850); color: var(--bone); border-color: var(--line-strong); }
.wallet-btn.is-connected:hover { border-color: var(--bone-2); background: var(--ink-800); }
.wallet-btn.is-connected svg { color: var(--gold); }
.wallet-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 248px; padding: 6px; z-index: 40;
  background: var(--ink-850); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lift);
}
.wallet-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; gap: 4px; font-size: 12px; }
.wallet-menu-head .mono { font-size: 11px; color: var(--bone-2); word-break: break-all; line-height: 1.4; }
.wallet-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; cursor: pointer; font-size: 13.5px; color: var(--bone-2); text-align: left;
}
.wallet-menu button:hover, .wallet-menu button:focus-visible { background: var(--ink-800); color: var(--bone); outline-offset: -2px; }
.wallet-menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.tabs-m { display: none; }

/* First paint: until the app knows whether it is live or in Demo (a few hundred ms at most), the page body is laid out
   but not shown, so the Demo banner and the first data never push visible content around. app.js lifts this when the
   mode is known or after 450 ms; the animation lifts it anyway if scripts fail. */
@keyframes idyl-boot { to { visibility: visible; } }
.is-booting #main, .is-booting .gw-host { visibility: hidden; animation: idyl-boot 0s linear 1.6s forwards; }
.demo-banner, .stale-banner {
  display: flex; align-items: center; gap: 12px; padding: 9px 32px; font-size: 13px; line-height: 1.4;
  border-top: 1px solid rgba(242,184,91,.22); background: linear-gradient(90deg, rgba(242,184,91,.10), rgba(242,184,91,.04));
  color: var(--gold-2);
}
.demo-banner strong, .stale-banner strong { font-weight: 600; }
.demo-banner-sub { color: var(--bone-2); }
.demo-banner-link { margin-left: auto; white-space: nowrap; color: var(--gold-2); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(255,216,154,.4); text-underline-offset: 3px; }
.stale-banner { border-top-color: rgba(255,122,92,.25); background: rgba(255,122,92,.07); color: #FFB3A1; }
.stale-banner span { color: var(--bone-2); }

/* ---------- Main ---------- */
main { width: 100%; max-width: 1280px; padding: 36px 40px 40px; outline: none; flex: 1; }
.view { animation: view-in .35s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

.view-head { margin-bottom: 28px; }
.view-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 26px; flex-wrap: wrap; }
.view-head .eyebrow { gap: 12px; }
.view-head .eyebrow .tag { letter-spacing: .08em; }
.title { font-family: var(--font-display); font-weight: 400; font-size: 52px; line-height: 1; letter-spacing: -0.02em; margin-top: 14px; outline: none; }
.lede { margin-top: 12px; font-size: 15.5px; line-height: 1.55; color: var(--bone-2); max-width: 64ch; }
.updated { font-size: 11.5px; color: var(--mute); letter-spacing: .02em; }
.head-actions { display: flex; align-items: center; gap: 14px; }

/* The overview headline is a live sentence. */
.readout {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 4.1vw, 58px); line-height: 1.04; letter-spacing: -0.02em;
  color: var(--bone-2); margin-top: 16px; max-width: 22ch; min-height: 2.08em; outline: none; text-wrap: balance;
}
.readout b { font-weight: 400; color: var(--bone); font-variant-numeric: tabular-nums; }
.readout .sk-line { display: block; height: .82em; margin: .14em 0 .12em; border-radius: 8px; }
.readout-cta { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* Skeletons */
.sk {
  display: inline-block; vertical-align: middle; width: 7ch; height: .9em; border-radius: 5px;
  background: linear-gradient(90deg, var(--ink-850) 0%, var(--ink-800) 50%, var(--ink-850) 100%); background-size: 220% 100%;
  animation: sk 1.5s linear infinite;
}
@keyframes sk { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* KPI strip: one instrument, divided by hairlines */
.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--ink-900); overflow: hidden; margin-bottom: 20px;
}
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 18px 20px 16px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-l { font-size: 12.5px; color: var(--bone-2); }
.kpi-v { margin-top: 10px; font-size: 26px; line-height: 32px; height: 32px; letter-spacing: -0.02em; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-v .u { font-size: 13px; color: var(--mute); margin-left: 4px; letter-spacing: 0; }
.kpi-v .sk { width: 6ch; height: 22px; }
.kpi-s { margin-top: 4px; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Panels */
.panel { background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel + .panel { margin-top: 20px; }
.stack > .panel + .panel { margin-top: 0; }
.panel-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.panel-t { font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; color: var(--bone); display: flex; align-items: center; gap: 8px; }
.panel-d { margin-top: 3px; font-size: 12.5px; color: var(--mute); }
.panel-b { padding: 20px; }
.panel-f { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.panel-f-r { display: flex; gap: 8px; margin-left: auto; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mute); }
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.stack-sm { display: grid; gap: 14px; }

/* Overview grid */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 20px; margin-bottom: 20px; }
.ov-grid .panel + .panel { margin-top: 0; }

.legend { flex: none; list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; font-size: 12.5px; color: var(--bone-2); flex-wrap: wrap; justify-content: flex-end; }
.legend li { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend-v { color: var(--bone); font-size: 12px; margin-left: 2px; }
.key { display: inline-block; width: 14px; flex: none; }
.key-area { height: 8px; border-radius: 2px; background: rgba(242,184,91,.28); border-top: 2px solid var(--gold); }
.key-line { height: 2px; border-radius: 2px; background: var(--dusk); }

/* Charts */
.chart { position: relative; height: 248px; padding: 8px 8px 4px 4px; }
.chart-panel { display: flex; flex-direction: column; }
.chart-panel .chart { flex: 1 1 auto; min-height: 248px; height: auto; padding: 14px 12px 8px 6px; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.chart-svg text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--mute); font-variant-numeric: tabular-nums; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-svg .s-area { fill: url(#g-served); }
.chart-svg .s-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .c-line { fill: none; stroke: var(--dusk); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .end-dot { fill: var(--gold); stroke: var(--ink-900); stroke-width: 2; }
.chart-svg .end-dot.c { fill: var(--dusk); }
.chart-svg .xhair { stroke: var(--bone-2); stroke-width: 1; opacity: .5; shape-rendering: crispEdges; }
.chart-svg .hover-dot { stroke: var(--ink-900); stroke-width: 2; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--mute); font-size: 13px; }
.chart-empty p { max-width: 36ch; }
.chart-tip {
  position: absolute; top: 8px; pointer-events: none; min-width: 150px; padding: 10px 12px; z-index: 2;
  background: var(--ink-850); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-lift); font-size: 12px;
}
.chart-tip .tt { color: var(--mute); font-family: var(--font-mono); font-size: 11px; margin-bottom: 6px; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.chart-tip .tr b { font-family: var(--font-mono); font-weight: 500; color: var(--bone); margin-right: auto; font-variant-numeric: tabular-nums; }
.chart-tip .tr span:last-child { color: var(--mute); }
.chart-tip .lk { width: 10px; height: 2px; border-radius: 2px; }

/* Treasury */
.treasury { display: flex; flex-direction: column; }
.treasury-dl { margin: 0; padding: 6px 20px; }
.treasury-dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.treasury-dl div:last-child { border-bottom: 0; }
.treasury-dl dt { color: var(--bone-2); font-size: 13px; }
.treasury-dl dd { margin: 0; font-size: 16px; color: var(--bone); white-space: nowrap; font-variant-numeric: tabular-nums; }
.treasury-dl dd .u { font-size: 12px; color: var(--mute); margin-left: 4px; }
.split { margin-top: auto; padding: 16px 20px 18px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.split-bar { display: flex; gap: 2px; height: 8px; }
.seg { border-radius: 999px; min-width: 4px; }
.seg-node { background: var(--bone-2); }
.seg-proto { background: var(--gold); }
.seg-burn { background: var(--gold); }
.seg-treas { background: var(--dusk); }
.split-keys { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: 12px; color: var(--bone-2); flex-wrap: wrap; }
.split-keys span { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.sw-node { background: var(--bone-2); } .sw-proto, .sw-burn { background: var(--gold); } .sw-treas { background: var(--dusk); }
.split-note { font-size: 12.5px; color: var(--mute); line-height: 1.55; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--mute); padding: 10px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--ink-900); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--bone-2); white-space: nowrap; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:not(.sk-row):not(.empty-row):hover td { background: rgba(255,255,255,.015); }
.table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table th.num { font-family: var(--font-ui); }
.table .strong { color: var(--bone); }
.m-name { color: var(--bone); font-weight: 500; }
.m-id { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.empty-row td { padding: 0; }

.board { min-width: 960px; }
.board th button {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; border-radius: 4px;
}
.board th button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .45; }
.board th[aria-sort="ascending"] button, .board th[aria-sort="descending"] button { color: var(--bone); }
.board th[aria-sort="ascending"] button svg, .board th[aria-sort="descending"] button svg { opacity: 1; color: var(--gold); }
.board th.num button { flex-direction: row-reverse; }
.board .col-node { position: sticky; left: 0; z-index: 1; background: var(--ink-900); }
.board td.col-node { background: var(--ink-900); }
.node-cell { display: flex; align-items: center; gap: 12px; }
.node-cell .dot { margin-left: 2px; }
.node-name { color: var(--bone); font-weight: 500; }
.node-sub { display: flex; gap: 10px; font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.node-sub .mono { font-size: 11px; }
.st-online { color: var(--meadow); } .st-busy { color: var(--gold); } .st-offline { color: var(--mute); }
.model-chips { display: flex; gap: 6px; }
.mchip { font: 500 11px/1 var(--font-mono); padding: 5px 7px; border-radius: 5px; background: var(--ink-850); border: 1px solid var(--line); color: var(--bone-2); }
.mchip.more { color: var(--mute); }

.empty { padding: 44px 24px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty-t { font-family: var(--font-display); font-size: 26px; color: var(--bone); line-height: 1.1; }
.empty-d { color: var(--mute); font-size: 13.5px; max-width: 46ch; }
.empty .btn, .empty .btn-ghost { margin-top: 8px; }
.empty-sun { width: 34px; height: 34px; color: var(--faint); margin-bottom: 4px; }
.error-box { padding: 28px 24px; display: flex; gap: 14px; align-items: flex-start; color: var(--bone-2); }
.error-box .ico { color: var(--ember); margin-top: 2px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font-size: 12.5px; color: var(--bone-2); display: flex; align-items: center; gap: 8px; padding: 0; }
.field > legend { margin-bottom: 7px; }
.opt { color: var(--faint); font-size: 11.5px; }
.out { margin-left: auto; color: var(--bone); font-size: 12px; }
.hint { font-size: 12px; color: var(--mute); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: end; }
.input {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--ink-950); color: var(--bone); font: 400 14px/1.4 var(--font-ui); transition: border-color .2s, box-shadow .2s;
}
.input.mono { font-family: var(--font-mono); font-size: 13px; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; min-height: 64px; }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #36404F; }
.input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(242,184,91,.14); }
.input:disabled { opacity: .5; cursor: not-allowed; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237D8696' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="number"].input { appearance: textfield; -moz-appearance: textfield; }
input[type="number"].input::-webkit-inner-spin-button { opacity: .4; }
input[type="search"].input::-webkit-search-cancel-button { filter: invert(.6); }

/* Range */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold) var(--p, 0%), var(--line-strong) var(--p, 0%)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--bone); border: 0; box-shadow: 0 0 0 4px rgba(242,184,91,.0), 0 1px 3px rgba(0,0,0,.5); transition: box-shadow .2s; }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--bone); border: 0; }
.range:focus { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(242,184,91,.35); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(242,184,91,.35); }
.range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(242,184,91,.16), 0 1px 3px rgba(0,0,0,.5); }
.range-lg { height: 28px; margin-top: 18px; }
.range-lg::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; }

/* Switch */
.switch { display: inline-flex; align-items: flex-start; gap: 12px; cursor: pointer; position: relative; }
.switch input { position: absolute; left: 0; top: 0; z-index: 1; opacity: 0; width: 36px; height: 22px; margin: 0; cursor: pointer; }
.switch-track { flex: none; width: 36px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; }
.switch-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--bone-2); transition: transform .25s var(--ease), background .2s; }
.switch input:checked + .switch-track { background: var(--gold-deep); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: var(--bone); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 3px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-l { font-size: 13.5px; color: var(--bone); line-height: 22px; }
.switch-d { display: block; font-size: 12.5px; color: var(--mute); line-height: 1.45; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: transparent; color: var(--bone-2); font: 500 12px/1 var(--font-mono); transition: border-color .2s, background .2s, color .2s;
}
.chip:hover { border-color: var(--bone-2); color: var(--bone); }
.chip[aria-pressed="true"] { background: rgba(242,184,91,.1); border-color: rgba(242,184,91,.55); color: var(--gold-2); }
.chip[aria-pressed="true"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn:disabled, .btn-gold:disabled, .btn-ghost:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.btn .ico, .btn-ghost .ico, .btn-gold .ico { width: 15px; height: 15px; }
.btn-ghost.btn-sm, .btn.btn-sm, .btn-gold.btn-sm { gap: 8px; }
/* The app writes ghost buttons as "btn btn-ghost". Without this, the shared .btn:hover fill (white) reaches them
   and the bone label disappears on hover. */
.btn.btn-ghost:hover { background: rgba(243,238,228,.06); border-color: var(--bone-2); }
.btn.btn-ghost:disabled:hover { background: transparent; border-color: var(--line-strong); }

.notice { display: flex; gap: 14px; padding: 14px 16px; margin-bottom: 20px; border-radius: var(--r-md); border: 1px solid rgba(242,184,91,.28); background: rgba(242,184,91,.06); color: var(--bone-2); font-size: 13.5px; }
.notice .ico { color: var(--gold); margin-top: 2px; }
.notice p + p { margin-top: 4px; }
.notice strong { color: var(--bone); font-weight: 600; }

/* ---------- Playground ---------- */
.pg-grid { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.pg-grid .panel + .panel { margin-top: 0; }
.pg-form .stack { gap: 18px; }
.pg-key { font-size: 12.5px; color: var(--mute); padding: 12px 14px; border-radius: var(--r-md); background: var(--ink-950); border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pg-key .mono { color: var(--bone-2); font-size: 12px; }
.pg-out { display: flex; flex-direction: column; min-height: 520px; }
.pg-output {
  flex: 1; padding: 20px; font-size: 14.5px; line-height: 1.7; color: var(--bone); white-space: pre-wrap; word-wrap: break-word;
  min-height: 260px; max-height: 560px; overflow-y: auto;
}
.pg-placeholder { color: var(--faint); white-space: normal; }
.pg-output.is-streaming::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--gold); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.pg-error { margin: 0 20px 16px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid rgba(255,122,92,.3); background: rgba(255,122,92,.07); color: var(--bone); font-size: 13.5px; display: flex; gap: 12px; align-items: flex-start; }
.pg-error .ico { color: var(--ember); margin-top: 2px; }
.pg-error p + p { margin-top: 4px; color: var(--bone-2); }
.pg-error .btn-sm { margin-top: 10px; }
.pg-meta { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.pg-meta div { padding: 12px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.pg-meta div:nth-child(3n) { border-right: 0; }
.pg-meta div:nth-last-child(-n+3) { border-bottom: 0; }
.pg-meta dt { font-size: 11.5px; color: var(--mute); }
.pg-meta dd { margin: 3px 0 0; font-size: 13px; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-meta dd .est { color: var(--mute); font-size: 11px; margin-left: 4px; }
.tag.demo { color: var(--gold-2); border-color: rgba(242,184,91,.35); }

/* ---------- Keys ---------- */
.keys-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.keys-grid .panel + .panel { margin-top: 0; }
.steps-h { list-style: none; margin: 0; padding: 0; display: grid; }
.steps-h li { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.steps-h li:first-child { padding-top: 0; }
.steps-h li:last-child { border-bottom: 0; }
.step-n {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--bone-2); font-size: 12px; background: var(--ink-950);
}
.step-c { min-width: 0; flex: 1; }
.stepper, .step { min-width: 0; }
.step-t { font-size: 14px; font-weight: 500; color: var(--bone); }
.step-d { font-size: 13px; color: var(--mute); margin-top: 2px; }
.steps-h li.is-done .step-n { border-color: rgba(127,227,160,.45); color: var(--meadow); }
.steps-h li.is-active .step-n { border-color: var(--gold); color: var(--gold-2); box-shadow: 0 0 0 4px rgba(242,184,91,.1); }
.steps-h li.is-done .step-n svg, .stepper .step-n svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.sign-msg { margin: 16px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.key-reveal { margin-top: 18px; padding: 16px; border-radius: var(--r-md); border: 1px solid rgba(242,184,91,.4); background: rgba(242,184,91,.06); display: grid; gap: 12px; }
.key-reveal-t { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--gold-2); font-weight: 500; }
.key-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: var(--ink-950); border: 1px solid var(--line-strong); border-radius: 9px; }
.key-box code { flex: 1; min-width: 0; font-size: 13px; color: var(--bone); overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form .input { flex: 1; }
.stored { display: grid; gap: 14px; }
.stored-key { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stored-key .mono { font-size: 13px; color: var(--bone); }
.stored-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 12.5px; margin: 0; }
.stored-meta dt { color: var(--mute); }
.stored-meta dd { margin: 0; color: var(--bone-2); font-family: var(--font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.usage-l { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--mute); }
.usage-l .mono { color: var(--bone); font-size: 12px; }
.usage-s { font-size: 12px; color: var(--mute); }
.meter { height: 8px; border-radius: 999px; background: rgba(242,184,91,.12); overflow: hidden; }
.meter span { display: block; height: 100%; min-width: 0; border-radius: 999px; background: var(--gold); transition: width .4s var(--ease); }
.meter.hot { background: rgba(255,122,92,.14); }
.meter.hot span { background: var(--ember); }
.code-panel .code-block { margin: 0; border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.code-panel .code-block pre { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); background: var(--ink-950); }

/* Code blocks */
.code-block { position: relative; margin-top: 12px; }
.code-block pre { margin: 0; padding: 14px 52px 14px 16px; font-size: 12.5px; color: var(--bone); background: var(--ink-950); white-space: pre; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.code-gold pre { border-color: rgba(242,184,91,.3); }
.copy-btn {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
  border-radius: 7px; border: 1px solid var(--line-strong); background: var(--ink-900); color: var(--bone-2); transition: color .2s, border-color .2s;
}
.copy-btn:hover { color: var(--bone); border-color: var(--bone-2); }
.copy-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn.is-copied { color: var(--meadow); border-color: rgba(127,227,160,.4); }

/* ---------- Node ---------- */
.node-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.stepper { list-style: none; margin: 0; padding: 0; position: relative; }
.step { position: relative; display: flex; gap: 20px; padding-bottom: 32px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 14px; top: 34px; bottom: 6px; width: 1px; background: var(--line-strong); }
.step:last-child::before { display: none; }
.stepper .step-n { width: 29px; height: 29px; background: var(--ink-900); }
.stepper .step-t { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.stepper .step-d { font-size: 13.5px; color: var(--bone-2); margin-top: 6px; max-width: 64ch; }
.stepper .step-d.small { font-size: 12.5px; color: var(--mute); margin-top: 10px; }
.stepper .btn-ghost { margin-top: 14px; }
.builder { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-900); }
.field-wide { grid-column: 1 / -1; }
.idle-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.maxload { transition: opacity .2s; }
.maxload.is-off { opacity: .4; }
.node-aside { position: sticky; top: 120px; }
.find-results { padding: 0 20px 20px; display: grid; gap: 10px; }
.find-results:empty { display: none; }
.find-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--ink-950); display: grid; gap: 10px; }
.find-head { display: flex; align-items: center; gap: 10px; }
.find-head .node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find-dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12px; }
.find-dl dt { color: var(--mute); }
.find-dl dd { margin: 1px 0 0; color: var(--bone); font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.find-msg { font-size: 13px; color: var(--mute); }
.privacy .panel-t { margin-bottom: 10px; }
.privacy .panel-t .ico { color: var(--gold); }
.privacy p { font-size: 13.5px; color: var(--bone-2); line-height: 1.6; }
.privacy p + p { margin-top: 10px; font-size: 12.5px; }

/* ---------- Ledger ---------- */
.buyback-empty { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 22px 20px; }
.buyback-empty .empty-sun { margin: 0; }
.buyback-empty .empty-t { font-size: 24px; }
.buyback-empty .empty-d { margin-top: 4px; }

/* ---------- Bond ---------- */
.bond-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.bond-grid .panel + .panel { margin-top: 0; }
.calc-top { display: grid; grid-template-columns: 1fr minmax(160px, 220px); gap: 20px; align-items: end; }
.calc-l { font-size: 12.5px; color: var(--bone-2); display: block; }
.calc-v { font-size: 64px; line-height: 1; letter-spacing: -0.04em; color: var(--bone); margin-top: 10px; font-variant-numeric: tabular-nums; }
.calc-input { height: 48px; font-size: 18px; margin-top: 10px; text-align: right; }
.presets { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.bond-chart { height: 220px; margin-top: 18px; padding: 0; }
.bond-chart .chart-svg { cursor: crosshair; touch-action: pan-y; }
.chart-svg .curve { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.chart-svg .curve-area { fill: rgba(242,184,91,.07); }
.chart-svg .ref { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart-svg .ref-l { fill: var(--bone-2); }
.chart-svg .marker { fill: var(--gold); stroke: var(--ink-900); stroke-width: 2; }
.chart-svg .marker-line { stroke: var(--gold); stroke-width: 1; opacity: .45; shape-rendering: crispEdges; }
.bond-note { margin-top: 14px; font-size: 13px; color: var(--bone-2); min-height: 20px; }
.bond-note .warn { color: var(--gold-2); }
.formula { margin-top: 18px; padding: 14px 16px; border-radius: var(--r-md); background: var(--ink-950); border: 1px solid var(--line); display: grid; gap: 6px; }
.formula-l { font-size: 11.5px; color: var(--mute); }
.formula code, .formula-inline { font-size: 12.5px; color: var(--bone); line-height: 1.6; overflow-wrap: anywhere; }
.formula-inline { display: block; padding: 12px 14px; border-radius: var(--r-md); background: var(--ink-950); border: 1px solid var(--line); }
.slash-table td, .slash-table th { padding-left: 20px; padding-right: 20px; }
.slash-table td:last-child { color: var(--bone); }
.score-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.score-v { font-size: 22px; color: var(--bone); }
.stake-fs { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.stake-fs[disabled] { opacity: .55; }
.stake-btn { width: 100%; }
.seg-ctl { display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; border: 1px solid var(--line-strong); width: max-content; }
.seg-ctl button { height: 30px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--mute); font-size: 13px; }
.seg-ctl button.on { background: var(--ink-800); color: var(--bone); }
.facts { margin: 0; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--mute); }
.facts dd { margin: 0; color: var(--bone); font-size: 12.5px; text-align: right; }
form.stack-sm > .facts { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }

/* ---------- Exchange ---------- */
.ex-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.ex-grid .panel + .panel { margin-top: 0; }
.book-wrap { position: relative; overflow: hidden; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.book { padding: 8px 0 12px; filter: saturate(.75); opacity: .62; user-select: none; }
.book-row { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 0 20px; height: 30px; align-items: center; font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.book-row > .c { position: relative; z-index: 1; text-align: right; color: var(--bone-2); }
.book-row > .c1 { text-align: left; }
.book-row .depth { position: absolute; right: 0; top: 3px; bottom: 3px; z-index: 0; border-radius: 4px 0 0 4px; }
.book-row.ask .depth { background: rgba(242,184,91,.10); }
.book-row.bid .depth { background: rgba(142,156,255,.11); }
.book-row.ask > .c1 { color: var(--gold-2); }
.book-row.bid > .c1 { color: #B8C1FF; }
.book-head { height: 34px; font-family: var(--font-ui); font-size: 11.5px; }
.book-head > .c { color: var(--mute) !important; }
.book-spread { display: flex; justify-content: space-between; gap: 12px; padding: 10px 20px; margin: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--mute); }
.book-spread b { font-family: var(--font-mono); font-weight: 500; color: var(--bone); }
.book-veil {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 24px;
  background: radial-gradient(ellipse at center, rgba(7,9,13,.82) 0%, rgba(7,9,13,.55) 55%, rgba(7,9,13,.2) 100%);
}
.veil-t { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--bone); letter-spacing: -0.01em; }
.veil-d { font-size: 13.5px; color: var(--bone-2); max-width: 36ch; }
.how { list-style: none; margin: 0; padding: 6px 20px 8px; }
.how li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.how li:last-child { border-bottom: 0; }
.how p { font-size: 13.5px; color: var(--bone-2); line-height: 1.55; }
.how strong { color: var(--bone); font-weight: 600; }

/* ---------- Settings ---------- */
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cfg-grid .panel + .panel { margin-top: 0; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.cfg-row-t { font-size: 13.5px; color: var(--bone); }
.cfg-row .mono { margin-top: 2px; overflow-wrap: anywhere; }
.test-out { font-size: 12.5px; min-height: 18px; color: var(--mute); }
.test-out.ok { color: var(--meadow); }
.test-out.bad { color: var(--ember); }

/* ---------- Footer ---------- */
.app-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; font-size: 12px; color: var(--mute); }
.app-foot p:first-child { max-width: 72ch; }
.app-foot-links { display: flex; gap: 18px; }
.app-foot-links a:hover { color: var(--bone); }

/* ---------- Dialog & toast ---------- */
.dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--ink-900); color: var(--bone); width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lift); }
.dialog::backdrop { background: rgba(4,5,8,.7); backdrop-filter: blur(4px); }
.dialog-in { padding: 28px; display: grid; gap: 14px; position: relative; }
.dialog-t { font-family: var(--font-display); font-size: 32px; line-height: 1.05; font-weight: 400; padding-right: 32px; }
.dialog-in > p { color: var(--bone-2); font-size: 14px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.dialog-x { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; color: var(--bone-2); }
.dialog-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px;
  background: var(--bone); color: var(--ink-950); font-size: 13.5px; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6);
  animation: toast-in .25s var(--ease);
}
.toast.bad { background: var(--ember); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis .kpi:nth-child(4) { border-left: 0; }
  .kpis .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-4 .kpi:nth-child(4) { border-left: 1px solid var(--line); }
  .kpis-4 .kpi:nth-child(n+4) { border-top: 0; }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .treasury { display: grid; grid-template-columns: 1fr 1fr; }
  .treasury .panel-h { grid-column: 1 / -1; }
  .treasury .split { border-top: 0; border-left: 1px solid var(--line); margin-top: 0; }
}
@media (max-width: 1100px) {
  .node-grid, .bond-grid, .ex-grid, .keys-grid, .pg-grid { grid-template-columns: minmax(0, 1fr); }
  .node-aside { position: static; }
  .pg-out { min-height: 0; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { height: 56px; padding: 0 16px; gap: 12px; }
  .brand-m { display: inline-flex; padding: 0; }
  .brand-m .wordmark { font-size: 24px; }
  .brand-m .mark { width: 24px; height: 24px; }
  .topbar-left { gap: 10px; }
  .tabs-m {
    display: flex; gap: 2px; overflow-x: auto; padding: 0 10px; height: 44px; align-items: stretch;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--line);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent 100%);
  }
  .tabs-m::-webkit-scrollbar { display: none; }
  .tabs-m a { position: relative; display: inline-flex; align-items: center; padding: 0 12px; font-size: 13.5px; color: var(--mute); white-space: nowrap; }
  .tabs-m a[aria-current="page"] { color: var(--bone); }
  .tabs-m a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--gold); }
  .tabs-m a:focus-visible { outline-offset: -4px; }
  .demo-banner, .stale-banner { padding: 8px 16px; }
  main { padding: 28px 20px 32px; }
  .cfg-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .gw-host { display: none; }
  .title { font-size: 40px; margin-top: 12px; }
  .lede { font-size: 14.5px; }
  .readout { font-size: 36px; max-width: none; min-height: 3.12em; }
  .models-panel td:first-child { white-space: normal; }
  .models-panel .table th, .models-panel .table td { padding-left: 12px; padding-right: 12px; }
  .models-panel .table th:first-child, .models-panel .table td:first-child { padding-left: 16px; }
  .models-panel .table th:last-child, .models-panel .table td:last-child { padding-right: 16px; }
  .kpis, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi, .kpis-4 .kpi { border-left: 1px solid var(--line); border-top: 1px solid var(--line); padding: 14px 16px; }
  .kpis .kpi:nth-child(odd) { border-left: 0; }
  .kpis .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi-v { font-size: 22px; line-height: 28px; height: 28px; }
  .treasury { display: flex; }
  .treasury .split { border-left: 0; border-top: 1px solid var(--line); }
  .panel-h { padding: 16px; flex-wrap: wrap; }
  .panel-b { padding: 16px; }
  .panel-f { padding: 12px 16px; }
  .legend { justify-content: flex-start; }
  .chart { height: 208px; }
  .table th, .table td { padding-left: 16px; padding-right: 16px; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .builder { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .idle-row { grid-template-columns: 1fr; gap: 14px; }
  .pg-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-meta div { padding: 10px 16px; }
  .pg-meta div:nth-child(3n) { border-right: 1px solid var(--line); }
  .pg-meta div:nth-child(2n) { border-right: 0; }
  .pg-meta div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .pg-meta div:nth-last-child(-n+2) { border-bottom: 0; }
  .pg-output { padding: 16px; }
  .pg-error { margin: 0 16px 16px; }
  .step { gap: 14px; }
  .calc-top { grid-template-columns: 1fr; gap: 14px; }
  .calc-v { font-size: 52px; }
  .calc-input { text-align: left; }
  .veil-t { font-size: 32px; }
  .book-row { padding: 0 16px; }
  .demo-banner-sub { display: none; }
  .inline-form { flex-wrap: wrap; }
  .inline-form .input { flex-basis: 100%; }
  .inline-form .btn-ghost, .inline-form .btn { width: 100%; }
  .wallet-btn { padding: 0 12px; }
  .buyback-empty { grid-template-columns: 1fr; justify-items: start; }
  .app-foot { margin-top: 40px; }
}
@media (max-width: 420px) {
  .wallet-btn [data-bind="wallet-label"] { font-size: 12.5px; }
  .mode-badge { padding: 0 9px; letter-spacing: .06em; font-size: 10.5px; gap: 7px; }
  .brand-m .wordmark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; background: var(--ink-850); }
  .view, .toast { animation: none; }
  [data-mode="live"] .mode-badge .dot { animation: none; }
  .pg-output.is-streaming::after { animation: none; }
}
@media (forced-colors: active) {
  .seg, .sw, .key, .dot { forced-color-adjust: none; }
}

/* =====================================================================
   v2 additions: tiers, The Floor, Earn (IDYL Desktop + CLI flags), node details
   ===================================================================== */

/* KPI strip, two rows of four */
.kpis.kpis-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.kpis-8 .kpi { border-left: 1px solid var(--line); border-top: 0; }
.kpis.kpis-8 .kpi:nth-child(4n + 1) { border-left: 0; }
.kpis.kpis-8 .kpi:nth-child(n + 5) { border-top: 1px solid var(--line); }

/* Tier badges (Open / Unbound / Floor). Unbound = the hollow sun. */
.tier {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line-strong);
  font: 500 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); white-space: nowrap; vertical-align: middle;
}
.tier svg { width: 9px; height: 9px; fill: none; stroke: var(--gold); stroke-width: 3; }
.tier-ub { color: var(--gold-2); border-color: rgba(242,184,91,.34); }
.tier-floor { color: var(--dusk); border-color: rgba(142,156,255,.34); }
.node-sub .tier, .find-head .tier { height: 18px; padding: 0 5px; font-size: 9.5px; }
.mchip.ub { border-color: rgba(242,184,91,.3); color: var(--gold-2); }

/* Overview: The Floor as an instrument strip */
.models-panel .table td:nth-child(2) { width: 1%; }
.floor-panel { margin-bottom: 20px; }
.floor-panel .panel-t .ico { color: var(--gold); }
.floor-status { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; min-width: 0; max-width: 46ch; font-size: 12.5px; color: var(--bone-2); line-height: 1.45; }
.floor-status.is-down { color: #FFB3A1; }
.floor-grid { margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.floor-grid > div { min-width: 0; padding: 14px 20px 15px; border-left: 1px solid var(--line); }
.floor-grid > div:first-child { border-left: 0; }
.floor-grid > div:nth-child(3) { border-left-color: var(--line-strong); }
.floor-grid dt { font-size: 12.5px; color: var(--bone-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.floor-grid dd { margin: 8px 0 0; font-size: 22px; line-height: 28px; height: 28px; color: var(--bone); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.floor-grid dd .u { font-size: 12px; color: var(--mute); margin-left: 6px; letter-spacing: 0; }
.floor-grid dd .sk { width: 5ch; height: 20px; }
.floor-s { margin-top: 3px; font-size: 11.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Earn: IDYL Desktop, the recommended path */
.earn-main { min-width: 0; }
.desk {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: center; overflow: hidden;
  padding: 30px 30px 28px; border-radius: var(--r-xl); border: 1px solid rgba(242,184,91,.26); background: var(--ink-900);
}
.desk-k { font-size: 12.5px; color: var(--gold-2); }
.desk-t { margin-top: 8px; font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -0.02em; color: var(--bone); }
.desk-d { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--bone-2); max-width: 46ch; }
.desk-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.desk-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--bone-2); }
.desk-list .ico { color: var(--meadow); width: 15px; height: 15px; margin-top: 2px; }
.desk-actions { margin-top: 22px; }
.desk-note { margin-top: 12px; font-size: 12.5px; color: var(--mute); }
.desk-orb { display: grid; justify-items: center; gap: 16px; color: var(--bone-2); }
.desk-orb svg { width: 168px; height: 168px; overflow: visible; color: #3A4556; }
.desk-orb .sun { fill: var(--gold); transform-box: fill-box; transform-origin: center; animation: orb-breathe 3.6s var(--ease) infinite; filter: drop-shadow(0 0 6px rgba(242,184,91,.55)); }
@keyframes orb-breathe { 50% { opacity: .55; transform: scale(.86); } }
.desk-orb-l { font-size: 11.5px; color: var(--mute); }
.cli-head { margin: 44px 0 22px; padding-top: 26px; border-top: 1px solid var(--line); }
.cli-t { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.05; letter-spacing: -0.01em; color: var(--bone); }
.cli-d { margin-top: 8px; font-size: 14px; color: var(--bone-2); max-width: 60ch; }

/* Builder: Unbound opt-in, Floor, payout */
.b-ub { display: grid; gap: 12px; }
.ack { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid rgba(242,184,91,.28); background: rgba(242,184,91,.05); font-size: 13px; line-height: 1.5; color: var(--bone-2); }
.ack .ico { color: var(--gold); margin-top: 2px; }
.b-ub-models { transition: opacity .2s; }
.b-ub-models.is-off { opacity: .4; }
.b-ub-models[disabled] .chip { cursor: not-allowed; }
.hint.bad { color: var(--ember); }
.input[aria-invalid="true"] { border-color: rgba(255,122,92,.6); }

/* Node details (GET /api/nodes/:id) */
.find-more { display: flex; }
.find-more .find-msg { padding: 2px 0; }
.nd-tiers { display: flex; gap: 6px; flex-wrap: wrap; }
.nd-tiers:empty { display: none; }
.nd-today { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.nd-today > div { padding: 10px 12px; border-left: 1px solid var(--line); min-width: 0; }
.nd-today > div:first-child { border-left: 0; }
.nd-l { font-size: 11.5px; color: var(--mute); }
.nd-v { margin-top: 3px; font-size: 16px; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-hw { font-size: 12.5px; color: var(--bone-2); line-height: 1.5; }
.nd-hw .muted { margin-right: 6px; }
.nd-models { flex-wrap: wrap; }
.nd-foot { font-size: 12px; color: var(--mute); line-height: 1.5; }

@media (max-width: 1240px) {
  .kpis.kpis-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis.kpis-8 .kpi:nth-child(4) { border-left: 1px solid var(--line); }
  .kpis.kpis-8 .kpi:nth-child(4n + 1) { border-left: 0; }
  .kpis.kpis-8 .kpi:nth-child(-n + 4) { border-top: 0; }
}
@media (max-width: 1240px) {
  .floor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .floor-grid > div:nth-child(4) { border-left: 0; }
  .floor-grid > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .floor-grid > div:nth-child(3) { border-left-color: var(--line); }
}
@media (max-width: 1100px) {
  .desk { grid-template-columns: minmax(0, 1fr) 160px; }
  .desk-orb svg { width: 128px; height: 128px; }
}
@media (max-width: 720px) {
  .kpis.kpis-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.kpis-8 .kpi { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .kpis.kpis-8 .kpi:nth-child(odd) { border-left: 0; }
  .kpis.kpis-8 .kpi:nth-child(-n + 2) { border-top: 0; }
  .desk { grid-template-columns: minmax(0, 1fr); padding: 22px 20px; border-radius: var(--r-lg); }
  .desk-orb { display: none; }
  .desk-t { font-size: 38px; }
  .desk-actions .btn { width: 100%; }
  .cli-head { margin-top: 32px; }
  .cli-t { font-size: 26px; }
  .floor-status { max-width: none; flex-basis: 100%; align-items: flex-start; }
  .floor-status .dot { margin-top: 5px; }
  .floor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .floor-grid > div { padding: 12px 16px; border-top: 1px solid var(--line); }
  .floor-grid > div:nth-child(odd) { border-left: 0; }
  .floor-grid > div:nth-child(-n + 2) { border-top: 0; }
  .floor-grid > div:nth-child(3) { border-left-color: transparent; }
  .floor-grid dd { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .desk-orb .sun { animation: none; }
}
