/* cgms-labs · Switchyard — tokens, shell, components. */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- tokens ---------- */
:root, :root[data-theme='day'], [data-theme='day'] {
  color-scheme: light;
  --bg: #EBEFEB;
  --surface: #FFFFFF;
  --surface-2: #F4F7F4;
  --sunken: #E1E7E2;
  --text: #202E27;
  --text-2: #506157;
  --line: #A8B8AD;        /* dividers */
  --line-soft: #D3DDD6;   /* hairlines inside tables */
  --control: #6E8276;     /* borders of inputs and controls (3:1 on surface) */
  --signal: #245D49;
  --on-signal: #FFFFFF;
  --signal-bg: #DCEBE2;
  --caution: #8A4B0F;
  --caution-bg: #F5E6D3;
  --problem: #9E2A2B;
  --problem-bg: #F6DEDC;
  --info: #2F5470;
  --info-bg: #DFE8F0;
  --focus: #245D49;
  --rail-bg: #DDE4DE;
  --overlay: rgba(22, 32, 27, 0.42);
  --shadow: 0 1px 0 rgba(32, 46, 39, 0.06), 0 8px 24px rgba(32, 46, 39, 0.12);
  --track: #7C9285;
}
:root[data-theme='night'], [data-theme='night'] {
  color-scheme: dark;
  --bg: #121D19;
  --surface: #1B2B23;
  --surface-2: #20322A;
  --sunken: #16241E;
  --text: #E6EEE8;
  --text-2: #A9BCAE;
  --line: #3E564A;
  --line-soft: #2B3F35;
  --control: #7E9A8B;
  --signal: #91CCAE;
  --on-signal: #10201A;
  --signal-bg: #1F3D30;
  --caution: #EFBC79;
  --caution-bg: #3A2D18;
  --problem: #F2A7A2;
  --problem-bg: #432322;
  --info: #A9C8E4;
  --info-bg: #1E3142;
  --focus: #91CCAE;
  --rail-bg: #0E1814;
  --overlay: rgba(4, 9, 7, 0.66);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.45);
  --track: #6F8C7D;
}
:root {
  --font: 'IBM Plex Sans', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --r1: 2px; --r2: 4px; --r3: 6px;
  --rail: 212px;
  --cmd-h: 52px;
  --strip-h: 30px;
  --pad: 16px;
  --row: 40px;
  --t-fast: 140ms; --t-panel: 170ms; --t-step: 240ms;
}
:root[data-density='compact'] { --row: 32px; --pad: 12px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/20px var(--font); font-variant-numeric: tabular-nums; min-width: 0; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--signal); text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums lining-nums; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 26px; line-height: 32px; letter-spacing: -0.01em; }
h2 { font-size: 18px; line-height: 24px; }
h3 { font-size: 15px; line-height: 20px; }
h4 { font-size: 13px; line-height: 18px; text-transform: none; color: var(--text-2); font-weight: 600; }
p { margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r1); }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; line-height: 18px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--rail-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: 0.04em; }
.brand svg { flex: none; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail-label { font-size: 11px; line-height: 16px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); padding: 12px 10px 4px; }
.navlink { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: var(--r2); color: var(--text); text-decoration: none; border: 1px solid transparent; background: none; width: 100%; text-align: left; cursor: pointer; }
.navlink svg { flex: none; color: var(--text-2); }
.navlink:hover { background: var(--surface-2); }
.navlink[aria-current='page'] { background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--signal); font-weight: 500; }
.navlink[aria-current='page'] svg { color: var(--signal); }
.rail .spacer { flex: 1; }
.rail .catalog { font-size: 13px; }
.main { display: flex; flex-direction: column; min-width: 0; }
.cmd { position: sticky; top: 0; z-index: 4; height: var(--cmd-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.cmd .title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cmd .grow { flex: 1; min-width: 8px; }
.cmd .mobile-brand { display: none; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--control); border-radius: var(--r2); background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.search-btn kbd, kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r1); padding: 0 4px; background: var(--surface); color: var(--text-2); }
.rolebadge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; padding: 3px 8px; border-radius: var(--r2); border: 1px dashed var(--control); color: var(--text-2); white-space: nowrap; }
.rolebadge b { color: var(--text); font-weight: 600; }
.wallet-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px; border-radius: var(--r2); border: 1px solid var(--control); background: var(--surface); cursor: pointer; white-space: nowrap; }
.wallet-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--control); flex: none; }
.wallet-btn.on .dot { background: var(--signal); }
.wallet-btn.warn .dot { background: var(--caution); border-radius: 1px; }
.pref { display: flex; flex-direction: column; font-size: 11px; line-height: 13px; color: var(--text-2); }
.pref select { min-height: 30px; padding: 2px 26px 2px 8px; font-size: 13px; }
.content { flex: 1; padding: 20px 24px 28px; min-width: 0; }
.strip { position: sticky; bottom: 0; z-index: 3; min-height: var(--strip-h); display: flex; align-items: center; gap: 18px; padding: 4px 16px; background: var(--surface); border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--text-2); overflow: hidden; }
.strip .seg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.strip .seg b { color: var(--text); font-weight: 500; }
.strip .grow { flex: 1; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); display: inline-block; flex: none; }
.led.warn { background: var(--caution); border-radius: 1px; }
.led.bad { background: var(--problem); border-radius: 0; transform: rotate(45deg); width: 7px; height: 7px; }
.tabbar { display: none; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid; border-radius: var(--r2); margin-bottom: 14px; }
.banner.caution { background: var(--caution-bg); border-color: var(--caution); }
.banner.problem { background: var(--problem-bg); border-color: var(--problem); }
.banner.info { background: var(--info-bg); border-color: var(--info); }
.banner .grow { flex: 1; min-width: 0; }
.demo-tag { font-size: 11px; line-height: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--caution); border: 1px solid var(--caution); border-radius: var(--r1); padding: 1px 5px; white-space: nowrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 6px 14px; border-radius: var(--r2); border: 1px solid var(--control); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; text-decoration: none; transition: background var(--t-fast), border-color var(--t-fast); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--problem); border-color: var(--problem); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--signal); padding-inline: 8px; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn[aria-disabled='true'], .btn:disabled { cursor: not-allowed; background: var(--sunken); border-color: var(--line); color: var(--text-2); filter: none; }
.btn.wide { width: 100%; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r2); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.help-q { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--control); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; vertical-align: middle; margin-left: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-weight: 500; font-size: 13px; line-height: 18px; }
.field .hint { font-size: 12.5px; line-height: 18px; color: var(--text-2); }
.field .err { font-size: 13px; line-height: 18px; color: var(--problem); display: flex; gap: 6px; }
input[type='text'], input[type='number'], input[type='search'], select, textarea { min-height: 38px; border: 1px solid var(--control); border-radius: var(--r2); background: var(--surface); padding: 6px 10px; width: 100%; min-width: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select option:disabled { color: var(--text-2); }
input[aria-invalid='true'] { border-color: var(--problem); box-shadow: inset 0 0 0 1px var(--problem); }
input.mono-in { font-family: var(--mono); font-size: 13px; }
.amount-in { display: flex; border: 1px solid var(--control); border-radius: var(--r2); background: var(--surface); overflow: hidden; }
.amount-in:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.amount-in input { border: 0; font-size: 24px; line-height: 32px; min-height: 52px; font-weight: 500; flex: 1; outline: none; }
.amount-in input:focus-visible { outline: none; }
.amount-in select { border: 0; border-left: 1px solid var(--line); border-radius: 0; width: auto; min-width: 96px; background-color: var(--surface-2); font-weight: 500; }
.amount-in.readonly { background: var(--surface-2); }
.amount-in .out { flex: 1; font-size: 24px; line-height: 32px; font-weight: 500; padding: 10px; min-height: 52px; }
.amount-in[aria-invalid='true'] { border-color: var(--problem); box-shadow: inset 0 0 0 1px var(--problem); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--signal); }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--control); border-radius: var(--r2); padding: 10px 12px; background: var(--surface); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--signal); box-shadow: inset 3px 0 0 var(--signal); background: var(--surface-2); }
.radio-card.disabled { cursor: not-allowed; background: var(--sunken); border-style: dashed; }
.radio-card input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--signal); }
.radio-card .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.seg-ctl { display: inline-flex; border: 1px solid var(--control); border-radius: var(--r2); overflow: hidden; flex-wrap: wrap; }
.seg-ctl button { border: 0; background: var(--surface); padding: 5px 12px; min-height: 32px; cursor: pointer; border-right: 1px solid var(--line); }
.seg-ctl button:last-child { border-right: 0; }
.seg-ctl button[aria-pressed='true'] { background: var(--signal); color: var(--on-signal); font-weight: 500; }

/* ---------- status label: symbol + text + shape ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 16px; font-weight: 500; padding: 3px 8px 3px 6px; border-radius: var(--r1); border: 1px solid currentColor; white-space: nowrap; background: var(--surface); }
.st .sym { font-size: 11px; width: 12px; text-align: center; }
.st.done { color: var(--signal); background: var(--signal-bg); }
.st.wait { color: var(--info); background: var(--info-bg); }
.st.action { color: var(--caution); background: var(--caution-bg); }
.st.problem { color: var(--problem); background: var(--problem-bg); }
.st.neutral { color: var(--text-2); }
.st.lg { font-size: 14px; line-height: 20px; padding: 4px 10px 4px 8px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 16px; padding: 1px 6px; border: 1px solid var(--line); border-radius: var(--r1); color: var(--text-2); white-space: nowrap; }
.tag.chain { font-family: var(--mono); font-size: 11px; }
.tag.src-chain { border-color: var(--signal); color: var(--signal); }
.tag.src-portal { border-style: dashed; }

/* ---------- panels, key-value, tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); min-height: 44px; flex-wrap: wrap; }
.panel > header h2, .panel > header h3 { flex: 1 1 180px; min-width: 0; }
.panel .body { padding: 14px; }
.panel + .panel { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; align-items: baseline; }
.kv dt { color: var(--text-2); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv.wide dt { min-width: 180px; }
.money { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.money.big { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.01em; }
.addr { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.copy { margin-left: 4px; }
.divider { border: 0; border-top: 1px solid var(--line-soft); margin: 12px 0; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.tablewrap:focus-visible { outline-offset: 0; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; line-height: 16px; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.grid th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.grid th button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
table.grid td { padding: 0 10px; height: var(--row); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr[aria-selected='true'] { background: var(--signal-bg); box-shadow: inset 3px 0 0 var(--signal); }
table.grid td.r, table.grid th.r { text-align: right; }
table.grid tr.flash { animation: flash 600ms ease-out; }
@keyframes flash { from { background: var(--caution-bg); } to { background: transparent; } }
table.grid a.rowlink { color: inherit; text-decoration: none; font-weight: 500; }
table.grid a.rowlink:focus-visible { outline-offset: -2px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .field { min-width: 160px; }
.toolbar .grow { flex: 1; }

/* ---------- composer (sender) ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 20px; max-width: 1180px; font-size: 16px; line-height: 24px; }
.composer .field > label, .composer .field > .label { font-size: 14px; }
.purpose { color: var(--text-2); margin: 4px 0 16px; max-width: 64ch; }
.stepper { display: flex; gap: 0; margin: 0 0 18px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); overflow: hidden; }
.stepper li { flex: 1; min-width: 0; }
.stepper > li > a, .stepper > li > span { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 44px; font-size: 13px; line-height: 16px; color: var(--text-2); text-decoration: none; border-right: 1px solid var(--line-soft); height: 100%; }
.stepper li:last-child > a, .stepper li:last-child > span { border-right: 0; }
.stepper .n { font-family: var(--mono); font-size: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--control); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stepper [aria-current='step'] { color: var(--text); font-weight: 600; background: var(--surface-2); box-shadow: inset 0 -3px 0 var(--signal); }
.stepper [aria-current='step'] .n { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
.stepper .done .n { border-color: var(--signal); color: var(--signal); }
.formcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.formcard > .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.formcard > .actions .grow { flex: 1; }
.swapper { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.optional { border: 1px dashed var(--control); border-radius: var(--r2); padding: 10px 12px; }
.consequence { font-size: 13.5px; line-height: 20px; color: var(--text-2); border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }
.consequence.caution { border-left-color: var(--caution); }
.notice { border: 1px solid var(--caution); background: var(--caution-bg); border-radius: var(--r2); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.notice.problem { border-color: var(--problem); background: var(--problem-bg); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; font-size: 14px; line-height: 20px; }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { width: 18px; flex: none; font-weight: 700; text-align: center; }
.checklist .ok .mark { color: var(--signal); }
.checklist .bad .mark { color: var(--problem); }
.amt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.amt-table td { padding: 6px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.amt-table td.r { text-align: right; white-space: nowrap; padding-left: 12px; }
.amt-table tr.total td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--line); padding-top: 8px; }
.amt-table tr.sub td:first-child { padding-left: 16px; color: var(--text-2); }
.alloc { font-family: var(--mono); font-size: 11px; color: var(--text-2); }

/* ---------- railway track (route) ---------- */
.track { list-style: none; margin: 0; padding: 0; position: relative; }
.track li { position: relative; padding: 0 0 14px 26px; min-height: 30px; }
.track li::before { content: ''; position: absolute; left: 7px; top: 14px; bottom: -2px; width: 2px; background: var(--track); }
.track li:last-child::before { display: none; }
.track li::after { content: ''; position: absolute; left: 1px; top: 3px; width: 10px; height: 10px; border: 2px solid var(--track); background: var(--surface); border-radius: 50%; }
.track li.done::after { background: var(--signal); border-color: var(--signal); }
.track li.done::before { background: var(--signal); }
.track li.now::after { border-color: var(--caution); background: var(--caution); border-radius: 1px; transform: rotate(45deg); }
.track li.bad::after { border-color: var(--problem); background: var(--problem); border-radius: 0; }
.track li.skip { color: var(--text-2); }
.track li.skip::after { border-style: dashed; }
.track .t1 { font-weight: 500; font-size: 14px; line-height: 18px; }
.track .t2 { font-size: 12.5px; line-height: 17px; color: var(--text-2); }
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lane { border: 1px solid var(--line); border-radius: var(--r3); padding: 12px 12px 2px; background: var(--surface); min-width: 0; }
.lane h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.lane.aside { background: var(--surface-2); border-style: dashed; }

/* ---------- deadline strip ---------- */
.deadlines { border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); padding: 10px 14px 12px; }
.dl-bar { position: relative; height: 34px; margin: 6px 6px 4px; }
.dl-bar .rail-line { position: absolute; left: 0; right: 0; top: 16px; height: 2px; background: var(--track); }
.dl-bar .past { position: absolute; left: 0; top: 15px; height: 4px; background: var(--signal); transition: width var(--t-step) ease; }
.dl-bar .tick { position: absolute; top: 8px; width: 2px; height: 18px; background: var(--text-2); }
.dl-bar .tick.a { background: var(--signal); }
.dl-bar .tick.b { background: var(--caution); }
.dl-bar .nowmark { position: absolute; top: 2px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid var(--text); transform: translateX(-6px); transition: left var(--t-step) ease; }
.dl-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 16px; font-size: 13px; line-height: 18px; }
.dl-list .lbl { color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.dl-list .sw { width: 10px; height: 3px; display: inline-block; flex: none; }
.dl-list .sw.a { background: var(--signal); }
.dl-list .sw.b { background: var(--caution); }
.dl-list .passed { color: var(--text-2); text-decoration: line-through; }

/* ---------- action rail (signature detail) ---------- */
.actionrail { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); overflow: hidden; }
.actionrail > h3 { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.act { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); position: relative; }
.act:last-child { border-bottom: 0; }
.act::before { content: ''; position: absolute; left: 24px; top: 0; bottom: 0; width: 2px; background: var(--line-soft); }
.act .node { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--track); background: var(--surface); margin: 3px 0 0 3px; position: relative; z-index: 1; }
.act.on .node { background: var(--signal); border-color: var(--signal); }
.act.off .node { border-style: dashed; }
.act .a-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.act .conseq { font-size: 13px; line-height: 18px; color: var(--text-2); }
.act .why { font-size: 13px; line-height: 18px; color: var(--caution); display: flex; gap: 6px; }
.act .unlock { font-size: 12.5px; line-height: 17px; color: var(--text-2); }
.act details { font-size: 12px; }
.act details summary { cursor: pointer; color: var(--text-2); }

/* ---------- events ---------- */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; line-height: 19px; align-items: baseline; }
.events li:last-child { border-bottom: 0; }
.events time { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* ---------- queue/detail split ---------- */
.detailgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 16px; align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.split > .detail { position: sticky; top: calc(var(--cmd-h) + 12px); max-height: calc(100vh - var(--cmd-h) - var(--strip-h) - 28px); overflow: auto; border-radius: var(--r3); }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); padding: 0 8px; background: var(--surface); position: sticky; top: 0; z-index: 1; overflow-x: auto; }
.tabs [role='tab'] { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--text-2); border-bottom: 3px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs [role='tab'][aria-selected='true'] { color: var(--text); border-bottom-color: var(--signal); }
.facts { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.invrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); margin-bottom: 14px; }
.invrow > div { padding: 10px 14px; border-right: 1px solid var(--line-soft); min-width: 0; }
.invrow > div:last-child { border-right: 0; }
.invrow .k { font-size: 12px; color: var(--text-2); }
.invrow .v { font-size: 16px; font-weight: 600; }
.back { display: none; }
.pagehead { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead .sub { color: var(--text-2); margin-top: 4px; max-width: 72ch; }
.ux-proposal { font-size: 12px; color: var(--text-2); border: 1px dashed var(--control); padding: 2px 8px; border-radius: var(--r1); }

/* ---------- overlays ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow); max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog::backdrop { background: var(--overlay); }
dialog[open] { animation: dlg-in var(--t-panel) ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.dlg-head h2 { flex: 1; }
.dlg-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 180px); overflow: auto; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.wallet-sim { border-top: 4px solid var(--info); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; animation: drawer-in var(--t-panel) ease-out; }
@keyframes drawer-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .dlg-body { max-height: none; flex: 1; }
.palette { position: fixed; inset: 0; z-index: 30; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: pal-in 120ms ease-out; }
@keyframes pal-in { from { opacity: 0; } to { opacity: 1; } }
.palette .box { width: min(560px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); box-shadow: var(--shadow); overflow: hidden; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 48px; font-size: 16px; padding: 10px 14px; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { padding: 8px 10px; border-radius: var(--r2); cursor: pointer; display: flex; gap: 10px; justify-content: space-between; }
.palette li[aria-selected='true'] { background: var(--signal-bg); }
.palette li .grp { color: var(--text-2); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--strip-h) + 16px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r2); box-shadow: var(--shadow); z-index: 40; max-width: min(560px, calc(100vw - 24px)); font-size: 14px; }
.toast.problem { background: var(--problem); color: var(--surface); }
.driver { border: 1px dashed var(--control); border-radius: var(--r3); padding: 10px 14px; background: var(--surface-2); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.driver .grow { flex: 1; min-width: 180px; }

/* ---------- motion ---------- */
.view { animation: view-in var(--t-panel) ease-out; }
@keyframes view-in { from { opacity: 0.4; transform: translateY(3px); } to { opacity: 1; transform: none; } }
:root[data-motion='reduced'] *, :root[data-motion='reduced'] *::before, :root[data-motion='reduced'] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  :root { --rail: 64px; }
  .rail .lbl, .rail-label, .brand .word { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .navlink { justify-content: center; padding: 8px 0; }
  .brand { justify-content: center; padding-inline: 0; }
  .composer { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); }
  .lanes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lanes .lane.aside { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .detail { position: static; max-height: none; }
  .detailgrid { display: flex; flex-direction: column; gap: 14px; }
  .detailgrid > .stack { display: contents; }
  .detailgrid > .stack > * { order: 3; }
  .detailgrid > .stack:first-child > :first-child { order: 0; }
  .detailgrid > .stack > .driver { order: 1; }
  .detailgrid > .stack > .actionrail { order: 2; }
  .split.has-detail > .list { display: none; }
  .split:not(.has-detail) > .detail { display: none; }
  .back { display: inline-flex; }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rolebadge .full { display: none; }
}
@media (max-width: 767px) {
  body { font-size: 16px; line-height: 24px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .cmd { height: auto; min-height: var(--cmd-h); flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .cmd .mobile-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); text-decoration: none; }
  .cmd .title { display: none; }
  .cmd .prefs { order: 5; width: 100%; display: flex; gap: 8px; }
  .cmd .prefs .pref { flex: 1; }
  .search-btn .lbl, .search-btn kbd { display: none; }
  .content { padding: 14px 12px 88px; }
  .strip { bottom: 56px; gap: 10px; flex-wrap: wrap; font-size: 11.5px; }
  .strip .opt { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 56px; background: var(--surface); border-top: 1px solid var(--line); z-index: 6; }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; line-height: 14px; color: var(--text-2); text-decoration: none; border: 0; background: none; min-width: 0; padding: 4px 2px; cursor: pointer; }
  .tabbar a[aria-current='page'] { color: var(--signal); font-weight: 600; box-shadow: inset 0 3px 0 var(--signal); }
  .tabbar .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid2, .grid3, .pair, .lanes { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .stepper .t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stepper [aria-current='step'] .t { position: static; width: auto; height: auto; clip: auto; }
  .stepper li { flex: 0 0 auto; }
  .stepper li:has([aria-current='step']) { flex: 1; }
  .invrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invrow > div:nth-child(2) { border-right: 0; }
  .invrow > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .money.big { font-size: 24px; line-height: 30px; }
  .amount-in input, .amount-in .out { font-size: 20px; }
  .events li { grid-template-columns: 56px minmax(0, 1fr); }
  .events li .tag { grid-column: 2; justify-self: start; }
  .btn { min-height: 44px; }
  .rolebadge { display: none; }
  table.grid.cards thead { display: none; }
  table.grid.cards, table.grid.cards tbody, table.grid.cards tr, table.grid.cards td { display: block; width: 100%; }
  table.grid.cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
  table.grid.cards td { height: auto; border: 0; padding: 1px 0; }
  table.grid.cards td.r { text-align: left; }
  table.grid.cards td[data-k]::before { content: attr(data-k) ': '; color: var(--text-2); font-size: 12.5px; }
  .dlg-foot .btn { flex: 1; }
}
@media (pointer: coarse) { .btn, .navlink, .iconbtn { min-height: 44px; } .iconbtn { width: 44px; } }
@media print { .rail, .cmd, .strip, .tabbar, .driver, .actionrail { display: none !important; } }
h1[tabindex='-1']:focus { outline: none; }
.seg-ctl button[aria-pressed='true'] .muted { color: inherit; opacity: 0.85; }
