/* Spark dashboard. Builds on the tokens and components in styles.css. */
:root {
  --side: 232px;
  --warn: #8a5a14;
  --warn-bg: #f4ead3;
}

/* ---------- preview bar ---------- */
.preview-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px; min-height: 32px; padding: 6px var(--gutter);
  background: var(--ink); color: #dfe6df; font-size: 12px; line-height: 1.35;
}
.preview-bar p { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preview-bar p:first-child { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; white-space: nowrap; }
.preview-bar b { font-weight: 500; color: #fff; }
.preview-bar span { opacity: .5; }
.preview-bar-long { color: #b7c3ba; }
.preview-bar-more {
  margin-left: auto; background: none; border: 0; padding: 2px 0; cursor: pointer;
  color: #fff; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.preview-bar :focus-visible { outline-color: var(--leaf); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - 32px); }
.side {
  position: sticky; top: 32px; align-self: start; height: calc(100vh - 32px);
  display: flex; flex-direction: column; border-right: 1px solid var(--rule); padding: 20px 16px 20px 20px;
}
.side-top { padding: 4px 0 24px; }
.side-top .brand-cube { width: 28px; height: 28px; }
.side-top .brand-word { font-size: 18px; }
.side-wallet { display: none; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: block; padding: 8px 10px; border-radius: var(--r); border-left: 2px solid transparent;
  font-size: 14px; color: var(--ink-2); text-decoration: none;
}
.side-nav a:hover { background: var(--paper); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--paper); color: var(--ink); font-weight: 500; border-left-color: var(--green); border-radius: 0 var(--r) var(--r) 0; }
.side-foot { margin-top: auto; display: grid; gap: 14px; }
.netstat { border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 12px; background: var(--paper); }
.netstat-name { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.netstat-block { margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.netstat.is-down .dot { background: var(--muted); }
.netstat.is-live .dot { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.side-note { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.side-back { font-size: 12.5px; color: var(--ink-2); text-underline-offset: 3px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding: 10px clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--rule);
}
.crumbs { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.crumbs b { color: var(--ink); font-weight: 500; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
#view { flex: 1; padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 40px) 48px; outline: none; }
.app-foot {
  display: grid; gap: 6px; padding: 20px clamp(16px, 3vw, 40px) 28px; border-top: 1px solid var(--rule);
  font-size: 11.5px; color: var(--muted); max-width: 110ch;
}
.app-foot a { color: var(--ink-2); }

/* ---------- wallet button ---------- */
.wbtn { gap: 8px; }
.wbtn .dot { width: 7px; height: 7px; }
.wbtn .addr { font-family: var(--mono); font-size: 12.5px; }
.wbtn.is-wrong { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.wbtn.is-wrong .dot { background: var(--warn); }
.net-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: var(--r); font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
}

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 2.4vw, 32px); font-weight: 600; letter-spacing: -.025em; line-height: 1.1; outline: none; }
.page-head .sub { margin-top: 8px; font-size: 14px; color: var(--ink-2); max-width: 64ch; }
.asof { font-family: var(--mono); font-size: 11px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 2px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--rule); color: var(--muted); background: var(--paper); vertical-align: middle; white-space: nowrap;
}
.tag.is-live { border-color: rgba(31,77,54,.35); color: var(--green); }

.statusline {
  display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 10px 0; margin-bottom: 24px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-2);
}
.statusline b { font-weight: 500; color: var(--ink); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); }
.kpis > div { padding: 18px 20px 20px; min-width: 0; }
.kpis > div + div { border-left: 1px solid var(--rule); }
.kpis dt { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.kpis dd { margin-top: 10px; font-size: clamp(22px, 2vw, 28px); font-weight: 600; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpis .kpi-note { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- panels ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); padding: 20px; min-width: 0; }
.panel + .panel { margin-top: 0; }
.stack > * + * { margin-top: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.panel-head p { font-size: 12.5px; color: var(--muted); }
.panel-foot { margin-top: 14px; font-size: 11.5px; color: var(--muted); }
.section-title { font-size: 18px; font-weight: 600; letter-spacing: -.015em; margin: 36px 0 14px; }

/* ---------- charts ---------- */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box svg:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.cgrid line { stroke: var(--rule-2); stroke-width: 1; }
.cgrid line.base { stroke: var(--rule); }
.caxis text { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
.cline { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.carea { fill: var(--green); opacity: .07; }
.cbar { fill: var(--green); opacity: .85; }
.cbar.is-low { fill: var(--muted); opacity: .6; }
.cbar.is-on { opacity: 1; }
.cref { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.creflabel { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); }
.ccross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .5; }
.cdot { fill: var(--paper); stroke: var(--green); stroke-width: 2; }
.tip {
  position: absolute; top: 0; left: 0; pointer-events: none; z-index: 5;
  padding: 6px 9px; border-radius: var(--r); background: var(--ink); color: #f2efe7;
  font-size: 12px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}
.tip b { font-family: var(--mono); font-weight: 500; }
.tip span { display: block; color: #b7c3ba; font-size: 11px; }

/* hairline bar list */
.hbars { display: grid; gap: 12px; }
.hbars a { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-decoration: none; font-size: 12.5px; }
.hbars a:hover .hb-id { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.hb-id { font-family: var(--mono); font-size: 12px; }
.hb-track { height: 8px; background: var(--rule-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.hb-fill.is-low { background: var(--muted); }
.hb-val { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }

/* ---------- activity ledger ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger th { text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); padding: 0 12px 10px 0; border-bottom: 1px solid var(--rule); }
.ledger td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger .muted-cell { color: var(--muted); }
.ledger a { color: var(--ink); text-underline-offset: 3px; }
.evt { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.evt::before { content: ""; width: 7px; height: 7px; border: 1.5px solid var(--green); border-radius: 50%; }
.evt[data-type="Maintenance"]::before { border-color: var(--warn); }
.evt[data-type="Distribution"]::before, .evt[data-type="Revenue report"]::before { background: var(--green); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); padding: 2px; }
.seg button {
  border: 0; background: none; padding: 0 12px; min-height: 32px; border-radius: 2px; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sand); }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.field select, .field input {
  font: inherit; font-size: 13px; color: var(--ink); min-height: 36px; padding: 0 10px;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper);
}
.field input { width: 200px; max-width: 100%; }
.field select:focus-visible, .field input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.toolbar .spacer { margin-left: auto; }
.count { font-size: 12.5px; color: var(--muted); }

/* ---------- machine table ---------- */
.mtable { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); }
.mtable th { text-align: left; padding: 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.mtable th > span, .mtable th button {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 12px 14px; border: 0; background: none;
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); text-align: left; cursor: pointer;
}
.mtable th > span { cursor: default; }
.mtable th.num button { justify-content: flex-end; }
.mtable th button:hover { color: var(--ink); }
.mtable th button::after { content: ""; width: 8px; height: 8px; opacity: .25; background: currentColor; clip-path: polygon(50% 0, 100% 40%, 0 40%, 0 60%, 100% 60%, 50% 100%); }
.mtable th[aria-sort="ascending"] button::after { opacity: 1; clip-path: polygon(50% 10%, 100% 70%, 0 70%); }
.mtable th[aria-sort="descending"] button::after { opacity: 1; clip-path: polygon(0 30%, 100% 30%, 50% 90%); }
.mtable td { padding: 12px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
.mtable tbody tr:last-child td { border-bottom: 0; }
.mtable tbody tr { cursor: pointer; }
.mtable tbody tr:hover { background: var(--card); }
.mtable .num { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.m-id { display: flex; align-items: center; gap: 12px; }
.m-id a { font-weight: 600; text-decoration: none; }
.m-id a:hover { text-decoration: underline; text-underline-offset: 3px; }
.m-id small { display: block; font-size: 12px; color: var(--ink-2); }
.thumb { width: 52px; height: 36px; flex: none; border: 1px solid var(--rule-2); border-radius: 2px; background: var(--card); }
.thumb svg { width: 100%; height: 100%; }
.site small { display: block; font-size: 12px; color: var(--muted); }
.util { display: inline-flex; align-items: center; gap: 8px; }
.util i { display: block; width: 44px; height: 4px; background: var(--rule-2); border-radius: 2px; overflow: hidden; }
.util i b { display: block; height: 100%; background: var(--green); }
.status { padding-top: 0; }
.empty-row td { text-align: center; color: var(--muted); padding: 32px; cursor: default; }

/* machine grid */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mgrid .card { scroll-snap-align: none; }
.mgrid .card .site-line { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* ---------- machine detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); text-decoration: none; margin-bottom: 14px; }
.back svg { transform: scaleX(-1); }
.back:hover { color: var(--ink); }
.asset-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
.plate { border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.plate .shot { margin: 0; padding: 20px; aspect-ratio: auto; border-right: 1px solid var(--rule); }
.plate-meta { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.plate-meta h1 { font-size: clamp(28px, 2.6vw, 36px); font-weight: 600; letter-spacing: -.03em; line-height: 1; outline: none; }
.plate-meta .kind { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.kv { display: grid; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.kv dd.mono, .mono { font-family: var(--mono); font-size: 12px; }
.invest { display: flex; flex-direction: column; }
.invest .price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.invest .price b { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.invest .price span { font-size: 13px; color: var(--muted); }
.invest .btn { margin-top: 16px; width: 100%; }
.invest .fine { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.meter { margin: 6px 0 2px; height: 6px; background: var(--rule-2); border-radius: 3px; overflow: hidden; }
.meter b { display: block; height: 100%; width: 0; background: var(--green); }

.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--r); margin-top: 20px; background: var(--paper); }
.mini-kpis > div { padding: 14px 18px; }
.mini-kpis > div + div { border-left: 1px solid var(--rule); }
.mini-kpis dt { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.mini-kpis dd { margin-top: 6px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.verify { display: grid; gap: 0; }
.verify > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.verify > div:first-child { padding-top: 0; }
.verify > div:last-child { border-bottom: 0; padding-bottom: 0; }
.verify dt { color: var(--muted); }
.verify dd { min-width: 0; }
.hash { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--ink); }
.verify small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }

.docs-list { display: grid; }
.docs-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.docs-list li:last-child { border-bottom: 0; }
.docs-list svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.2; }
.docs-list span:not(.tag) { flex: 1; min-width: 0; }
.risk-list { display: grid; gap: 10px; }
.risk-list li { position: relative; padding-left: 16px; font-size: 13.5px; color: var(--ink-2); }
.risk-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 1px; background: var(--ink-2); }

.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 20px;
  border: 1px solid rgba(138,90,20,.35); border-left: 3px solid var(--warn); border-radius: var(--r); background: var(--warn-bg);
  font-size: 13.5px; color: #4d3610;
}
.alert b { font-weight: 600; }

/* ---------- portfolio ---------- */
.connect-card { max-width: 620px; padding: 32px; }
.connect-card h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.connect-card p { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.connect-card .btn { margin-top: 22px; }
.connect-card ul { margin-top: 20px; display: grid; gap: 8px; font-size: 13px; color: var(--ink-2); }
.connect-card ul li { display: flex; gap: 10px; }
.connect-card ul li::before { content: ""; flex: none; width: 5px; height: 5px; margin-top: .55em; border-radius: 50%; background: var(--green); }
.acct { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.acct .addr-full { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.icon-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--green); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-link svg { width: 13px; height: 13px; }
.bal { font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bal small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 6px; }
.empty {
  display: grid; justify-items: start; gap: 8px; padding: 28px; border: 1px dashed var(--rule); border-radius: var(--r);
}
.empty h3 { font-size: 15px; font-weight: 600; }
.empty p { font-size: 13.5px; color: var(--ink-2); max-width: 52ch; }
.empty .link { margin-top: 6px; }

/* ---------- docs ---------- */
.doc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 108px; display: grid; gap: 2px; }
.toc a { font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 5px 0 5px 12px; border-left: 1px solid var(--rule); }
.toc a:hover { color: var(--ink); border-left-color: var(--ink); }
.prose { max-width: 72ch; }
.prose section { padding: 28px 0; border-top: 1px solid var(--rule); scroll-margin-top: 100px; }
.prose section:first-child { border-top: 0; padding-top: 0; }
.prose h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.prose p { margin-top: 12px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.prose p b { color: var(--ink); font-weight: 500; }
.flowchart { margin-top: 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); }
.flowchart li { padding: 14px 14px 16px; font-size: 13px; color: var(--ink-2); }
.flowchart li + li { border-left: 1px solid var(--rule); }
.flowchart b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.flowchart li span { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.wf { margin-top: 20px; width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wf td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.wf td small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.wf .bar { width: 34%; }
.wf .bar i { display: block; height: 8px; margin-top: 6px; background: var(--rule); border-radius: 0 4px 4px 0; }
.wf tr.is-holders .bar i { background: var(--green); }
.wf tr.is-holders td:first-child { font-weight: 600; }
.wf .num { text-align: right; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.params { margin-top: 16px; }
.faq { margin-top: 12px; }
.faq details { border-bottom: 1px solid var(--rule-2); }
.faq summary {
  display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; }
.legal { margin-top: 12px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); font-size: 13px; color: var(--ink-2); }
.legal p { font-size: 13px; margin-top: 8px; }
.legal p:first-child { margin-top: 0; }

.foot-notes { margin-top: 28px; display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); max-width: 100ch; }
.foot-notes li { display: flex; gap: 8px; }
.foot-notes li span:first-child { font-family: var(--mono); }

/* ---------- dialogs ---------- */
.dlg {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 28px; overflow: auto;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--sand); color: var(--ink);
}
.dlg::backdrop { background: rgba(22, 36, 28, .42); }
.dlg[open] { animation: dlg-in .18s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px); } }
.dlg h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; padding-right: 32px; }
.dlg > p, .dlg-body p { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.dlg-x { position: absolute; top: 14px; right: 14px; }
.dlg-x button { width: 32px; height: 32px; border: 1px solid transparent; border-radius: var(--r); background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.dlg-x button:hover { border-color: var(--rule); color: var(--ink); }
.dlg-kicker { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dlg-list { margin-top: 16px; display: grid; }
.dlg-list div { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.dlg-list dt { font-family: var(--mono); font-size: 11px; color: var(--ink-2); padding-top: 2px; }
.dlg-list dd { color: var(--ink-2); }
.wallets { margin-top: 18px; display: grid; gap: 8px; }
.wallets button, .wallets a {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); cursor: pointer; text-align: left;
  font-size: 14px; font-weight: 500; text-decoration: none;
}
.wallets button:hover, .wallets a:hover { border-color: var(--ink); }
.wallets img { width: 24px; height: 24px; border-radius: 4px; }
.wallets .ph { width: 24px; height: 24px; border-radius: 4px; background: var(--rule-2); flex: none; }
.wallets small { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.dlg-err { margin-top: 14px; font-size: 13px; color: var(--warn); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis > div:nth-child(4) { border-left: 0; }
  .kpis > div:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .grid-2, .asset-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 40; height: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--rule);
    background: rgba(242, 239, 231, .96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .side-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
  .side-wallet { display: flex; gap: 8px; }
  .side-nav { display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { white-space: nowrap; padding: 10px 10px 11px; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; font-size: 13.5px; }
  .side-nav a:hover { background: none; }
  .side-nav a[aria-current="page"] { background: none; border-bottom-color: var(--green); border-radius: 0; }
  .side-foot { display: none; }
  .topbar { min-height: 0; padding-top: 12px; padding-bottom: 12px; }
  .topbar-actions { display: none; }
  .preview-bar { position: static; }
  .doc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .preview-bar { flex-wrap: wrap; gap: 2px 12px; padding: 7px 16px; }
  .preview-bar-long { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div { padding: 14px; }
  .kpis > div:nth-child(n) { border-left: 0; border-top: 1px solid var(--rule); }
  .kpis > div:nth-child(-n+2) { border-top: 0; }
  .kpis > div:nth-child(even) { border-left: 1px solid var(--rule); }
  .kpis > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .panel { padding: 16px; }
  .grid-2.even { grid-template-columns: minmax(0, 1fr); }
  .plate { grid-template-columns: minmax(0, 1fr); }
  .plate .shot { border-right: 0; border-bottom: 1px solid var(--rule); max-height: 240px; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-kpis > div:nth-child(3) { border-left: 0; }
  .mini-kpis > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .verify > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .toolbar .spacer { margin-left: 0; }
  .field input { width: 100%; }
  .field.search { flex: 1 1 100%; }
  .field.search input { flex: 1; }

  /* tables become cards */
  .mtable, .mtable tbody, .mtable tr, .mtable td { display: block; }
  .mtable { border: 0; background: none; }
  .mtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mtable tbody { display: grid; gap: 12px; }
  .mtable tbody tr { border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); padding: 6px 14px; }
  .mtable td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-2); text-align: right; }
  .mtable td::before { content: attr(data-label); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .mtable td.m-cell { padding: 10px 0 12px; text-align: left; }
  .mtable td.m-cell::before { display: none; }
  .mtable tbody tr td:last-child { border-bottom: 0; }
  .mtable tbody tr.empty-row td { justify-content: center; }
  .mtable tbody tr.empty-row td::before { display: none; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger tr { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule-2); }
  .ledger tr:last-child { border-bottom: 0; }
  .ledger td { padding: 0; border: 0; }
  .ledger td.c-desc { grid-column: 1 / -1; }
  .ledger td.c-ref { grid-column: 1 / -1; color: var(--muted); }
  .flowchart { grid-template-columns: minmax(0, 1fr); }
  .flowchart li + li { border-left: 0; border-top: 1px solid var(--rule); }
  .wf .bar { display: none; }
  .connect-card { padding: 20px; }
  .dlg { padding: 22px 18px; }
}
@media (max-width: 420px) {
  .side-top .brand-word small { display: none; }
  .side-wallet .btn { padding: 0 12px; font-size: 13px; min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .netstat.is-live .dot { animation: none; }
}
.thumb.shot { margin: 0; aspect-ratio: auto; display: block; }
.app-foot { max-width: none; }
.app-foot p { max-width: 110ch; }
.side { border-right: 0; }
.main { border-left: 1px solid var(--rule); }
@media (max-width: 900px) { .main { border-left: 0; } }
