/* B2 Console. Graphite, three close surface steps, steel selection, amber only where a person is needed. */
@font-face { font-family: "Geist"; src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", monospace;
  --rail-w: 204px; --insp-w: 436px; --top-h: 44px; --strip-h: 26px; --row-h: 30px;
  --r-1: 3px; --r-2: 5px; --r-3: 8px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151617; --surface: #1a1b1d; --raised: #212224; --hover: #26272a;
  --line: #2a2b2e; --line-2: #3a3b3f;
  --text: #e4e5e7; --text-2: #a5a8ae; --text-3: #74777d;
  --sel: #7ea3cd; --sel-bg: #232e3b; --sel-line: #3f5876; --sel-ink: #0f1620; --sel-solid: #6f96c2;
  --amber: #dba743; --amber-bg: #33290f; --amber-line: #5c4a1c;
  --green: #6bb489; --green-bg: #18291f;
  --red: #dd7068; --red-bg: #351b19; --red-solid: #c2544c;
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line-2);
  --scrim: rgba(8, 9, 10, 0.62);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #e9ebed; --surface: #f3f4f5; --raised: #fcfcfd; --hover: #e6e8eb;
  --line: #d6d9dd; --line-2: #bfc3c9;
  --text: #1b1d20; --text-2: #4d5259; --text-3: #767b83;
  --sel: #2c5d92; --sel-bg: #dae5f1; --sel-line: #9fbbd9; --sel-ink: #ffffff; --sel-solid: #2f6199;
  --amber: #8f6200; --amber-bg: #f6e9c8; --amber-line: #d9bd77;
  --green: #2a774d; --green-bg: #d9eee1;
  --red: #b23e36; --red-bg: #f6dedb; --red-solid: #b23e36;
  --shadow: 0 18px 50px -14px rgba(20, 24, 30, 0.32), 0 0 0 1px var(--line-2);
  --scrim: rgba(30, 34, 40, 0.38);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; border-radius: var(--r-1); }
.skip { position: fixed; left: 8px; top: -60px; background: var(--raised); padding: 8px 12px; border-radius: var(--r-2); z-index: 99; }
.skip:focus { top: 8px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }
.num { font-family: var(--mono); font-size: 12px; text-align: right; white-space: nowrap; letter-spacing: -0.01em; }
.dim { color: var(--text-2); } .faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 500 10.5px/1 var(--mono); color: var(--text-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 2px 4px; min-width: 17px; display: inline-block; text-align: center; background: var(--surface); }

/* ---------- shell ---------- */
.app { display: grid; height: 100dvh; grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--insp-w); grid-template-rows: var(--top-h) minmax(0, 1fr) var(--strip-h); grid-template-areas: "rail top insp" "rail main insp" "strip strip strip"; }
.app[data-insp="none"] { grid-template-columns: var(--rail-w) minmax(0, 1fr) 0; }
.app[data-insp="none"] .insp { display: none; }
.rail { grid-area: rail; background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow-y: auto; }
.top { grid-area: top; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; min-width: 0; }
.main { grid-area: main; background: var(--surface); overflow: auto; min-width: 0; outline: none; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.insp { grid-area: insp; background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; min-width: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.strip { grid-area: strip; background: var(--bg); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 0; padding: 0 6px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.tabs { display: none; }

/* rail */
.ws { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: var(--r-2); width: 100%; margin-bottom: 6px; }
.ws:hover, .ws[aria-expanded="true"] { background: var(--hover); }
.ws .mark { width: 22px; height: 22px; border-radius: 5px; background: var(--text); color: var(--bg); display: grid; place-items: center; flex: none; }
.ws .mark svg { width: 14px; height: 14px; fill: currentColor; }
.ws b { font-weight: 600; font-size: 13px; display: block; line-height: 1.2; }
.ws small { font-size: 11px; color: var(--text-3); display: block; line-height: 1.2; }
.ws .i { margin-left: auto; color: var(--text-3); width: 12px; height: 12px; }
.rail a.nav { display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 7px; border-radius: var(--r-2); color: var(--text-2); font-weight: 450; position: relative; }
.rail a.nav:hover { background: var(--hover); color: var(--text); }
.rail a.nav[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.rail a.nav .count { margin-left: auto; font: 500 11px var(--mono); color: var(--text-3); }
.rail a.nav .count.need { color: var(--amber); }
.rail a.nav kbd { margin-left: auto; border: 0; background: none; opacity: 0; padding: 0; }
.rail a.nav:hover kbd, .rail a.nav:focus-visible kbd { opacity: 1; }
.rail a.nav:hover .count + kbd { display: none; }
.rail .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.rail .foot { margin-top: auto; padding-top: 8px; display: grid; gap: 2px; }
.rail .me { display: flex; gap: 8px; align-items: center; padding: 6px 7px; color: var(--text-2); font-size: 12px; }

.av { width: 20px; height: 20px; border-radius: 50%; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2); display: inline-grid; place-items: center; font: 600 9px var(--sans); color: var(--text-2); flex: none; letter-spacing: 0.02em; }
.av.lg { width: 28px; height: 28px; font-size: 11px; }
.av.signed { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.av.auto { border-radius: 5px; }

/* top bar */
.top h1 { font-size: 13px; font-weight: 600; white-space: nowrap; }
.top .crumb { color: var(--text-3); font-weight: 400; }
.top .tools { display: flex; align-items: center; gap: 6px; margin-left: 8px; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.search { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-2); color: var(--text-3); background: var(--bg); min-width: 0; white-space: nowrap; }
.search:hover { border-color: var(--line-2); color: var(--text-2); }
.search span { flex: 1; }
.icon-btn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-2); color: var(--text-2); }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.chip { height: 24px; padding: 0 9px; border-radius: 12px; border: 1px solid var(--line); color: var(--text-2); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--sel-bg); border-color: var(--sel-line); color: var(--text); }
.chip .n { font: 500 11px var(--mono); color: var(--text-3); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-2); padding: 1px; background: var(--bg); flex: none; }
.seg a, .seg button { height: 22px; padding: 0 9px; border-radius: 3px; color: var(--text-2); font-size: 12px; display: inline-flex; align-items: center; white-space: nowrap; }
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* buttons */
.btn { height: 28px; padding: 0 11px; border-radius: var(--r-2); border: 1px solid var(--line-2); background: var(--raised); font-weight: 500; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: transform 90ms var(--ease), background 90ms; }
.btn:hover { background: var(--hover); }
.btn[data-pressed] { transform: scale(0.975); }
.btn.pri { background: var(--sel-solid); border-color: var(--sel-solid); color: var(--sel-ink); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn kbd { background: none; border-color: currentColor; opacity: 0.55; color: inherit; }
.btn.wide { width: 100%; height: 32px; }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }

/* ---------- tables ---------- */
.tbl { font-size: 12.5px; }
.tbl thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); height: 28px; font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: left; padding: 0 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th.num { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0; }
.tbl thead th button { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.tbl thead th button:hover { color: var(--text); }
.tbl thead th[aria-sort] button { color: var(--text); }
.tbl thead th .arrow { font-size: 9px; opacity: 0.8; }
.tbl td { height: var(--row-h); padding: 0 10px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl tbody tr { cursor: default; }
.tbl tbody tr[data-row] { cursor: pointer; }
.tbl tbody tr[data-row]:hover { background: var(--hover); }
.tbl tbody tr[aria-selected="true"] { background: var(--sel-bg); box-shadow: inset 2px 0 0 var(--sel); }
.tbl tbody tr[aria-selected="true"]:hover { background: var(--sel-bg); }
.tbl td.pri { font-weight: 500; color: var(--text); }
.tbl td .sub { color: var(--text-3); margin-left: 8px; font-weight: 400; }
.tbl tr.group td { height: 26px; background: var(--bg); color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.tbl tfoot td { height: 30px; font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-2); background: var(--surface); position: sticky; bottom: 0; }
.tbl td.zero { color: var(--text-3); }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 18px; padding: 0 6px; border-radius: 3px; font-size: 11px; font-weight: 500; background: var(--raised); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; vertical-align: middle; }
.tag.need { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber-line); }
.tag.ok { background: var(--green-bg); color: var(--green); box-shadow: none; }
.tag.bad { background: var(--red-bg); color: var(--red); box-shadow: none; }
.tag.sel { background: var(--sel-bg); color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-line); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.net { color: var(--text-2); }

/* quorum meter: one cell per unit of signer weight */
.q { display: inline-flex; gap: 2px; vertical-align: middle; }
.q i { width: 10px; height: 6px; border-radius: 1px; background: var(--line-2); transition: background 320ms var(--ease), transform 320ms var(--ease); }
.q i.on { background: var(--text); }
.q i.new { animation: qfill 520ms var(--ease) both; }
.q.done i.on { background: var(--green); }
.q.lg i { width: 100%; height: 8px; flex: 1; border-radius: 2px; }
.q.lg { display: flex; gap: 3px; }
@keyframes qfill { 0% { background: var(--line-2); transform: scaleY(1); } 40% { background: var(--sel); transform: scaleY(1.9); } 100% { transform: scaleY(1); } }

/* ---------- inspector ---------- */
.ih { position: sticky; top: 0; z-index: 3; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: flex-start; gap: 10px; min-height: var(--top-h); }
.ih h2 { font-size: 14px; font-weight: 600; line-height: 1.3; }
.ih .id { font: 500 11px var(--mono); color: var(--text-3); }
.ih .right { margin-left: auto; display: flex; gap: 4px; align-items: center; flex: none; }
.ih .close { display: none; }
.sec { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec > h3 { font-size: 11.5px; font-weight: 500; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sec > h3 .right { margin-left: auto; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 5px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-3); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv.raw { grid-template-columns: 132px minmax(0, 1fr); font-family: var(--mono); font-size: 11.5px; gap: 4px 10px; }
.kv.raw dt { color: var(--text-3); } .kv.raw dd { color: var(--text-2); word-break: break-all; }
.note { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.callout { border: 1px solid var(--line); border-radius: var(--r-2); padding: 9px 10px; font-size: 12px; color: var(--text-2); display: flex; gap: 9px; align-items: flex-start; background: var(--surface); }
.callout.need { border-color: var(--amber-line); background: var(--amber-bg); color: var(--text); }
.callout.need .i { color: var(--amber); }
.callout.ok { background: var(--green-bg); border-color: transparent; color: var(--text); }
.callout.ok .i { color: var(--green); }
.callout.bad { background: var(--red-bg); border-color: transparent; color: var(--text); }
.callout.bad .i { color: var(--red); }
.actions { display: flex; gap: 8px; padding: 12px 16px; position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); z-index: 3; }
.actions .btn { flex: 1; height: 32px; }
.actions .btn.narrow { flex: 0 0 auto; }

/* what you see is what you sign */
.sign { border: 1px solid var(--line-2); border-radius: var(--r-3); background: var(--surface); overflow: hidden; }
.sign .hd { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }
.sign .hd .seg { margin-left: auto; }
.sign .amt { padding: 12px 12px 4px; }
.sign .amt .v { font: 500 24px/1.1 var(--mono); letter-spacing: -0.03em; }
.sign .amt .v small { font-size: 13px; color: var(--text-2); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.sign .to { padding: 6px 12px 12px; display: grid; gap: 3px; }
.sign .to .name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sign .to .addr { font: 400 11.5px var(--mono); color: var(--text-2); word-spacing: 3px; overflow-wrap: anywhere; }
.sign .rows { border-top: 1px solid var(--line); padding: 9px 12px; }
.diff { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px 10px; align-items: baseline; font-size: 12.5px; }
.diff .num.before { color: var(--text-3); }
.diff .arrow { color: var(--text-3); font-size: 11px; }
.diff .delta { grid-column: 1 / -1; font: 400 11.5px var(--mono); color: var(--red); text-align: right; }
.rule { font-size: 13px; line-height: 1.6; color: var(--text-2); }
.rule mark { white-space: nowrap; background: var(--sel-bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--sel-line); border-radius: 3px; padding: 1px 4px; font-weight: 500; }
.rule mark.need { background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-line); }

.tl { display: grid; gap: 0; }
.tl li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 9px; align-items: center; min-height: 30px; position: relative; font-size: 12.5px; }
.tl li + li::before { content: ""; position: absolute; left: 9.5px; top: -7px; height: 12px; width: 1px; background: var(--line-2); }
.tl .w { font: 500 11px var(--mono); color: var(--text-3); }
.tl .w.on { color: var(--green); }
.tl .when { color: var(--text-3); font-size: 11.5px; margin-left: 6px; }
.tl li.sum { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; color: var(--text-2); }
.tl li.sum::before { display: none; }

/* ---------- page blocks (overview, policy, automation) ---------- */
.page { padding: 0; }
.band { display: grid; border-bottom: 1px solid var(--line); }
.band.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.band.k5 { grid-template-columns: 1.25fr 1.1fr 0.9fr 1fr 0.8fr; }
.kpi { padding: 12px 16px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .l { font-size: 11.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.kpi .v { font: 500 19px/1.25 var(--mono); letter-spacing: -0.03em; margin-top: 3px; white-space: nowrap; }
.kpi .v small { font-size: 12px; color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.kpi .s { font-size: 11.5px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s.need { color: var(--amber); }
.block { border-bottom: 1px solid var(--line); }
.block > header { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.block > header h2 { font-size: 12.5px; font-weight: 600; }
.block > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 11.5px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split > * + * { border-left: 1px solid var(--line); }
.pad { padding: 12px 16px; }
.chart { display: block; width: 100%; height: 150px; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--text-2); border-radius: 3px; transition: width 600ms var(--ease); }
.bar.need > i { background: var(--amber); }
.bar.stop > i { background: var(--text-3); }

/* forms */
.form { display: grid; gap: 12px; max-width: 560px; padding: 16px; }
.field { display: grid; gap: 4px; }
.field label, .field .lab { font-size: 11.5px; color: var(--text-3); }
.in, select.in, textarea.in { height: 30px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg); padding: 0 9px; width: 100%; min-width: 0; }
textarea.in { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.45; }
.in:hover { border-color: var(--text-3); }
.in:focus { outline: 2px solid var(--sel); outline-offset: -1px; border-color: transparent; }
.in.mono { font-family: var(--mono); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 11.5px; color: var(--text-3); }

/* policy sentences */
.rules { display: grid; }
.rcard { padding: 14px 16px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
.rcard .who { font-size: 12px; color: var(--text-3); }
.rcard .who b { display: block; color: var(--text); font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.rcard p { font-size: 16px; line-height: 2; color: var(--text); letter-spacing: -0.005em; max-width: 64ch; }
.pill { display: inline-flex; align-items: center; height: 26px; border-radius: 5px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2); vertical-align: baseline; position: relative; font-family: var(--mono); font-size: 13px; }
.pill:hover { box-shadow: inset 0 0 0 1px var(--text-3); }
.pill:focus-within { box-shadow: inset 0 0 0 2px var(--sel); }
.pill.changed { background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-line); }
.pill input, .pill select { border: 0; background: none; height: 26px; padding: 0 7px; outline: none; font: inherit; color: var(--text); }
.pill input { text-align: right; field-sizing: content; min-width: 5ch; max-width: 12ch; }
.pill select { font-family: var(--sans); font-size: 14px; padding-right: 4px; cursor: pointer; }
.pill .unit { padding-right: 7px; color: var(--text-2); font-size: 12px; margin-left: -3px; }
.pill.linked { background: none; box-shadow: none; border-bottom: 1px dashed var(--line-2); border-radius: 0; height: auto; padding: 0 1px; }
.cases td { white-space: normal; height: auto; padding-top: 7px; padding-bottom: 7px; max-width: none; vertical-align: top; }
.cases td.flash { animation: flash 900ms var(--ease); }
@keyframes flash { 0% { background: var(--sel-bg); } 100% { background: transparent; } }

/* virtual table */
.vwrap { position: relative; }
.vhead, .vrow { display: grid; grid-template-columns: 64px minmax(140px, 1.4fr) 92px minmax(180px, 2fr) 110px minmax(120px, 1.6fr); align-items: center; padding: 0 16px; gap: 0 12px; }
.vhead { position: sticky; top: 0; z-index: 2; height: 28px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.vrow { position: absolute; left: 0; right: 0; height: 28px; border-bottom: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
.vrow > * { overflow: hidden; text-overflow: ellipsis; }
.vrow.issue { background: var(--amber-bg); }
.vrow.dropped { color: var(--text-3); text-decoration: line-through; }
.vrow.fixed .st { color: var(--green); }
.vrow.hit { animation: flash 1400ms var(--ease); }
.drop { margin: 16px; border: 1px dashed var(--line-2); border-radius: var(--r-3); padding: 40px 24px; display: grid; gap: 10px; justify-items: center; text-align: center; color: var(--text-2); background: var(--bg); }
.drop h2 { font-size: 15px; color: var(--text); font-weight: 600; }
.drop.over { border-color: var(--sel); background: var(--sel-bg); }
.progress { width: min(360px, 100%); }

/* sweep */
tr.sweeping { background: linear-gradient(90deg, var(--sel-bg) var(--p, 0%), transparent var(--p, 0%)); box-shadow: inset 2px 0 0 var(--sel); }
.tbl tbody tr.sweeping:hover { background: linear-gradient(90deg, var(--sel-bg) var(--p, 0%), transparent var(--p, 0%)); }
tr.justswept td { animation: flash 1200ms var(--ease); }

/* automatic stop */
.stop { display: grid; gap: 10px; }
.holdbtn { position: relative; height: 44px; width: 100%; border-radius: var(--r-3); border: 1px solid var(--red-solid); color: var(--red); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; background: var(--red-bg); }
.holdbtn::before { content: ""; position: absolute; inset: 0; background: var(--red-solid); transform-origin: left; transform: scaleX(var(--hp, 0)); }
.holdbtn > * { position: relative; }
.holdbtn[data-holding] { color: #fff; }
.holdbtn.go { border-color: var(--sel-solid); background: var(--sel-bg); color: var(--text); }
.holdbtn.go::before { background: var(--sel-solid); }
.holdbtn.go[data-holding] { color: var(--sel-ink); }
.signers { display: grid; gap: 0; }
.signers li { display: flex; align-items: center; gap: 9px; height: 30px; font-size: 12.5px; }
.signers li .state { margin-left: auto; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: grid; place-items: start center; padding-top: 12vh; animation: fade 120ms ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
.pal { width: min(620px, calc(100vw - 24px)); background: var(--raised); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; animation: rise 160ms var(--ease); }
.pal .q-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.pal input { flex: 1; height: 46px; border: 0; background: none; outline: none; font-size: 15px; color: var(--text); }
.pal ul { max-height: 380px; overflow-y: auto; padding: 6px; }
.pal li { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 9px; border-radius: var(--r-2); cursor: pointer; }
.pal li[aria-selected="true"] { background: var(--sel-bg); }
.pal li .t { color: var(--text-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.pal li.h { height: 24px; font-size: 11.5px; color: var(--text-3); cursor: default; }
.pal .ft { display: flex; gap: 14px; padding: 7px 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11.5px; }
.pal .empty { padding: 22px 14px; color: var(--text-2); }
.modal { width: min(560px, calc(100vw - 24px)); background: var(--raised); border-radius: 10px; box-shadow: var(--shadow); animation: rise 160ms var(--ease); max-height: 80vh; overflow: auto; }
.modal header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal header h2 { font-size: 14px; font-weight: 600; }
.modal header .icon-btn { margin-left: auto; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; padding: 12px 16px 16px; }
.keys div { display: flex; align-items: center; justify-content: space-between; height: 28px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.keys div span:last-child { display: flex; gap: 4px; align-items: center; }
.menu { position: fixed; z-index: 60; background: var(--raised); box-shadow: var(--shadow); border-radius: var(--r-3); padding: 5px; min-width: 240px; animation: rise 120ms var(--ease); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 9px; height: 34px; padding: 0 8px; border-radius: var(--r-2); }
.menu a:hover, .menu button:hover { background: var(--hover); }
.menu small { color: var(--text-3); margin-left: auto; font-size: 11.5px; }
.menu .mark { width: 20px; height: 20px; border-radius: 5px; background: var(--text); color: var(--bg); display: grid; place-items: center; font: 600 9px var(--sans); }

/* phone prompt */
.phone-wrap { place-items: center; padding: 16px; background: rgba(8, 9, 10, 0.82); }
.phone-stage { display: grid; gap: 12px; justify-items: center; animation: rise 220ms var(--ease); }
.phone-stage > p { color: #d9dbdf; font-size: 12.5px; max-width: 340px; text-align: center; }
[data-theme="light"] .phone-stage > p { color: #fff; }
.phone { width: 316px; background: #0f1011; color: #ecedef; border-radius: 38px; padding: 12px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px #3a3b3f, inset 0 0 0 2px #1d1e20; }
.phone .scr { background: #18191b; border-radius: 28px; overflow: hidden; display: grid; }
.phone .isl { height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font: 600 11px var(--sans); color: #a5a8ae; }
.phone .isl i { width: 70px; height: 18px; background: #0b0b0c; border-radius: 10px; }
.phone .hd { padding: 6px 16px 8px; font-size: 11.5px; color: #8b8e94; display: flex; gap: 7px; align-items: center; }
.phone .hd svg { width: 12px; height: 12px; fill: currentColor; }
.phone .amt { padding: 2px 16px 0; font: 500 26px/1.15 var(--mono); letter-spacing: -0.03em; }
.phone .amt small { font-size: 13px; color: #a5a8ae; font-weight: 400; margin-left: 4px; letter-spacing: 0; }
.phone .ttl { padding: 0 16px; font-size: 12.5px; color: #a5a8ae; }
.phone dl { margin: 10px 12px 0; border: 1px solid #2c2d30; border-radius: 12px; font-size: 12px; }
.phone dl > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; padding: 8px 10px; border-bottom: 1px solid #2c2d30; }
.phone dl > div:last-child { border-bottom: 0; }
.phone dt { color: #8b8e94; }
.phone dd { min-width: 0; overflow-wrap: anywhere; }
.phone dd .addr { font: 400 10.5px/1.5 var(--mono); color: #a5a8ae; word-spacing: 2px; display: block; }
.phone dd .tag { background: #26272a; color: #c9ccd1; box-shadow: inset 0 0 0 1px #3a3b3f; }
.phone dd .tag.ok { background: #18291f; color: #6bb489; box-shadow: none; }
.phone dd .tag.need { background: #33290f; color: #dba743; box-shadow: inset 0 0 0 1px #5c4a1c; }
.phone dd .tag.bad { background: #351b19; color: #dd7068; box-shadow: none; }
.phone .num { color: #ecedef; }
.phone .foot { padding: 12px; display: grid; gap: 8px; }
.phone .hold { position: relative; height: 50px; border-radius: 14px; background: #ecedef; color: #111; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 9px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; width: 100%; transition: transform 120ms var(--ease); }
.phone .hold::before { content: ""; position: absolute; inset: 0; background: #7ea3cd; transform-origin: left; transform: scaleX(var(--hp, 0)); }
.phone .hold > * { position: relative; }
.phone .hold[data-holding] { transform: scale(0.98); }
.phone .hold.done { background: #6bb489; }
.phone .hold.done::before { display: none; }
.phone .alt { height: 34px; color: #a5a8ae; font-size: 12.5px; text-align: center; width: 100%; border-radius: 10px; }
.phone .alt:hover { color: #ecedef; background: #222325; }
.phone .face { width: 18px; height: 18px; }

/* toasts */
.toasts { position: fixed; left: calc(var(--rail-w) + 14px); bottom: calc(var(--strip-h) + 12px); z-index: 70; display: grid; gap: 8px; justify-items: start; pointer-events: none; }
.toast { background: var(--raised); box-shadow: var(--shadow); border-radius: var(--r-3); padding: 9px 12px; font-size: 12.5px; display: flex; gap: 9px; align-items: center; max-width: 380px; animation: rise 200ms var(--ease); pointer-events: auto; }
.toast .i { color: var(--green); }
.toast.need .i { color: var(--amber); }
.toast.out { opacity: 0; transition: opacity 240ms; }

/* status strip */
.strip .cell { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 100%; border-right: 1px solid var(--line); }
.strip a.cell:hover { background: var(--hover); color: var(--text); }
.strip .cell b { font: 500 11.5px var(--mono); color: var(--text); letter-spacing: -0.01em; }
.strip .cell .dot.ok { color: var(--green); }
.strip .cell .dot.need { color: var(--amber); }
.strip .cell .dot.bad { color: var(--red); }
.strip .cell.tick b { animation: tick 900ms var(--ease); }
@keyframes tick { 0% { color: var(--sel); } 100% { color: var(--text); } }
.strip .right { margin-left: auto; display: flex; height: 100%; }
.strip .right .cell { border-right: 0; border-left: 1px solid var(--line); }
.strip .mini { width: 54px; }

/* empty */
.empty-state { padding: 28px 16px; color: var(--text-2); display: grid; gap: 8px; justify-items: start; }
.empty-state h2 { font-size: 14px; color: var(--text); }

@media (min-width: 761px) {
  .tbl.fix { table-layout: fixed; }
  .tbl.fix .w-amt { width: 134px; } .tbl.fix .w-flag { width: 142px; } .tbl.fix .w-sig { width: 174px; } .tbl.fix .w-st { width: 118px; }
  .tbl.fix td .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 18px; }
  .tbl.fix td { max-width: none; }
  .tbl.fix .w-name { width: 172px; } .tbl.fix .w-bal { width: 140px; }
}
@media (max-width: 1560px) { .search span { display: none; } }

/* ---------- narrower desktop ---------- */
@media (max-width: 1240px) { :root { --insp-w: 380px; --rail-w: 52px; }
  .c-flag { display: none; }
  .rail a.nav span, .rail a.nav .count, .rail a.nav kbd, .ws b, .ws small, .ws .i:last-child, .rail .me span { display: none; }
  .rail a.nav { justify-content: center; padding: 0; } .ws { justify-content: center; padding: 6px 0; } .rail .me { justify-content: center; padding: 6px 0; }
  .search { min-width: 0; } .search span { display: none; }
  .band.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .band.k5 .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --row-h: 44px; --strip-h: 0px; }
  body { font-size: 14px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr) calc(54px + env(safe-area-inset-bottom)); grid-template-areas: "top" "main" "tabs"; }
  .app[data-insp="none"] { grid-template-columns: minmax(0, 1fr); }
  .rail, .strip { display: none; }
  .top { padding: env(safe-area-inset-top) 8px 0 14px; gap: 6px; }
  .top h1 { font-size: 15px; }
  .top .crumb, .top .tools { display: none; }
  .search { border: 0; background: none; padding: 0; width: 34px; height: 34px; justify-content: center; }
  .search kbd { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .subtools { display: flex; gap: 6px; padding: 8px 14px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; position: sticky; top: 0; background: var(--surface); z-index: 4; }
  .tabs { grid-area: tabs; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabs a, .tabs button { display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 10.5px; color: var(--text-3); position: relative; }
  .tabs [aria-current="page"] { color: var(--text); }
  .tabs .i { width: 20px; height: 20px; }
  .tabs .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 15px; height: 15px; border-radius: 8px; background: var(--amber); color: #1a1405; font: 600 10px/15px var(--mono); text-align: center; padding: 0 3px; }
  /* inspector: stacked under the list on pages, a full-height sheet for a selected row */
  .main { display: block; }
  .insp { display: none; }
  .app[data-insp="stack"] .insp { display: block; grid-area: auto; border-left: 0; border-top: 1px solid var(--line); }
  .app[data-insp="stack"] { grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr) calc(54px + env(safe-area-inset-bottom)); }
  .app[data-insp="stack"] .main { overflow: visible; }
  .app[data-insp="stack"] .scroller { grid-area: main; overflow-y: auto; }
  .app[data-insp="sheet"] .insp { display: block; position: fixed; inset: 0; z-index: 40; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); animation: sheet 260ms var(--ease); transform: translateY(var(--drag, 0px)); transition: transform 220ms var(--ease); }
  @keyframes sheet { from { transform: translateY(40%); opacity: 0; } }
  .ih { padding: 10px 14px; align-items: center; }
  .ih .close { display: grid; }
  .ih .right .hide-m { display: none; }
  .sec { padding: 14px; }
  .actions { padding: 10px 14px; }
  .actions .btn { height: 44px; font-size: 14px; }
  .btn { height: 34px; } .btn.sm { height: 30px; } .btn.wide { height: 44px; }
  .btn kbd { display: none; }
  .block > header .right { display: none; }
  .block > header .right.legend { display: flex; }
  .in, select.in { height: 40px; font-size: 16px; }
  .tbl { font-size: 13.5px; }
  .tbl .hm, .tbl thead { display: none; }
  .tbl td { max-width: 46vw; padding: 0 6px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 14px; } .tbl td:last-child { padding-right: 14px; }
  .tbl tbody tr[aria-selected="true"] { background: none; box-shadow: none; }
  .tbl td.hm:first-child + td, .tbl th.hm:first-child + th { padding-left: 14px; }
  .band.k4, .band.k5 { grid-template-columns: 1fr 1fr; }
  .band .kpi { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .band .kpi:nth-child(2n) { border-right: 0; }
  .band .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; border-bottom: 0; }
  .kpi .v { font-size: 17px; }
  .split { grid-template-columns: 1fr; } .split > * + * { border-left: 0; border-top: 1px solid var(--line); }
  .block > header { padding: 0 14px; } .pad { padding: 12px 14px; }
  .rcard { grid-template-columns: 1fr; gap: 6px; padding: 14px; }
  .rcard p { font-size: 15px; }
  .form { padding: 14px; } .row2 { grid-template-columns: 1fr; }
  .vhead, .vrow { grid-template-columns: 48px minmax(0, 1.3fr) 92px minmax(0, 1fr); padding: 0 14px; }
  .vhead > :nth-child(3), .vrow > :nth-child(3), .vhead > :nth-child(4), .vrow > :nth-child(4) { display: none; }
  .vhead, .vrow { grid-template-columns: 48px minmax(0, 1.2fr) 88px minmax(0, 1fr); }
  .toasts { left: 10px; right: 10px; bottom: calc(64px + env(safe-area-inset-bottom)); justify-items: stretch; }
  .scrim { padding-top: 8vh; }
  .phone-wrap { padding: 0; place-items: center; }
  .phone-stage > p { display: none; }
  .keys { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .more-list a { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
  .more-list a .count { margin-left: auto; font: 500 12px var(--mono); color: var(--text-3); }
}
@media (min-width: 761px) { .subtools, .only-m { display: none; } }
.stacked { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); }
.stacked .ih, .stacked .actions { position: static; }
.grab { height: 5px; width: 40px; border-radius: 3px; background: var(--line-2); margin: 6px auto 0; padding: 0; touch-action: none; }
@media (max-width: 760px) { .only-d { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
