:root {
  --bg: #0b1724;
  --bg-dots: #16283c;
  --bar: #0d1b2a;
  --surface: #11233a;
  --surface-2: #152a44;
  --line: #22394f;
  --text: #e6eaef;
  --muted: #8b9bb0;
  --accent: #3fd0c9;
  --on-accent: #05201f;
  --warn: #f2b84b;
  --bad: #ef6b6b;
  --good: #3fd0c9;
  --r: 6px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: radial-gradient(var(--bg-dots) 1px, transparent 1.4px) 0 0 / 16px 16px, var(--bg);
  color: var(--text); font: 15px/1.45 Onest, system-ui, sans-serif; min-height: 100vh;
  padding-bottom: calc(68px + var(--safe-b));
}
.mono { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* шапка */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(13, 27, 42, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand b { font-size: 17px; letter-spacing: -.01em; }
.brand .tag { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid rgba(63, 208, 201, .4); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.brand .tag:empty { display: none; }
.mark { width: 20px; height: 20px; flex: none; background:
  linear-gradient(var(--accent), var(--accent)) 0 0 / 4px 100% no-repeat,
  linear-gradient(var(--accent), var(--accent)) 0 0 / 80% 4px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 0 8px / 60% 4px no-repeat; }
.gold { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); flex: none; }
.gold span { color: var(--muted); font-size: 11px; }
.gold b { font-weight: 600; font-variant-numeric: tabular-nums; }
.gold b.up { color: var(--good); } .gold b.down { color: var(--bad); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--good); box-shadow: 0 0 0 3px rgba(63, 208, 201, .18); }
.dot.stale { background: var(--warn); }

main { max-width: 560px; margin: 0 auto; padding: 14px 16px 24px; }
.tab { display: none; }
.tab.on { display: block; }

/* нижняя панель */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(13, 27, 42, .97); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); }
.bar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted);
  font-size: 11px; padding: 4px 0; cursor: pointer; }
.bar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar button.on { color: var(--accent); }

/* общие блоки */
.h { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin: 18px 0 8px; }
.h:first-child { margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; line-height: 1.5; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--good); } .neg { color: var(--bad); } .warn { color: var(--warn); }
.big { font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.mid { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; }
.empty { color: var(--muted); padding: 22px 14px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); font-size: 14px; }

/* кнопки и поля */
.btn { border-radius: var(--r); padding: 12px 16px; font-weight: 600; cursor: pointer; font-size: 15px; border: 1px solid var(--line);
  background: var(--surface-2); text-align: center; }
.btn.main { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.ghost { background: none; }
.btn.danger { background: none; border-color: rgba(239, 107, 107, .6); color: var(--bad); }
.btn.wide { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btns.one { grid-template-columns: 1fr; }
.f { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }
.f:first-child { margin-top: 0; }
.in { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; font-family: var(--mono); font-size: 15px; }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 208, 201, .18); }
.in.bad { border-color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > .f { margin-top: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 4px; }
.seg button { flex: 1; background: none; border: 0; padding: 9px 6px; color: var(--muted); cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button.on.long { box-shadow: inset 0 -2px 0 var(--good); color: var(--good); }
.seg button.on.short { box-shadow: inset 0 -2px 0 var(--bad); color: var(--bad); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px;
  cursor: pointer; white-space: nowrap; color: var(--muted); }
.chip.on { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.chip b { font-weight: 600; color: var(--text); }
.badge { font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.badge.ok { color: var(--good); border-color: rgba(63, 208, 201, .5); }
.badge.bad { color: var(--bad); border-color: rgba(239, 107, 107, .5); }
.badge.warn { color: var(--warn); border-color: rgba(242, 184, 75, .5); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle i { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(18px); background: var(--on-accent); }

/* шаги чек-ина */
.steps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 10px; }
.steps button { height: 30px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; color: var(--muted);
  font-family: var(--mono); font-size: 12px; cursor: pointer; padding: 0; }
.steps button.done { background: rgba(63, 208, 201, .14); border-color: rgba(63, 208, 201, .45); color: var(--accent); }
.steps button.cur { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.kicker { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: .14em; }
.card h2 { font-size: 23px; margin: 6px 0 4px; letter-spacing: -.01em; line-height: 1.15; }
.lede { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.box { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-top: 10px; background: rgba(11, 23, 36, .45); }
.box .h { margin: 0 0 8px; }
.legs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.leg { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; background: var(--bg); min-width: 0; }
.leg .who { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.leg .lots { font-family: var(--mono); font-size: 26px; font-weight: 600; margin: 2px 0; }
.leg .sub { font-size: 12px; color: var(--muted); }
.lv { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 14px; margin-top: 4px; }
.lv span:first-child { color: var(--muted); }
.flow { font-family: var(--mono); font-size: 13px; padding: 8px 10px; background: var(--bg); border-radius: 4px; margin-top: 6px; }
.note { font-size: 12.5px; color: var(--warn); margin-top: 8px; line-height: 1.45; }
.note.ok { color: var(--good); }
.check { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(63, 208, 201, .07);
  font-size: 13px; font-weight: 600; }
.mirror { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 14px; }
.mirror th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 500; padding: 4px 0; }
.mirror td { padding: 6px 0; border-top: 1px solid var(--line); }
.copy { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 11px; padding: 2px 7px;
  margin-left: 6px; cursor: pointer; font-family: var(--mono); }
.clock { text-align: center; padding: 18px 8px; }
.clock .big { font-size: 40px; }
.stepnav { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 12px; }

/* учёт */
.acc { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; margin-bottom: 8px; cursor: pointer; }
.acc.off { opacity: .6; }
.acc .t { font-weight: 600; }
.track { position: relative; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); margin: 10px 0 6px; overflow: hidden; }
.track i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); border-radius: 4px; }
.track i.under { background: var(--bad); }
.track b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--muted); }
.tot .row { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.tot .row:first-of-type { border-top: 0; }
.list .it { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list .it:first-child { border-top: 0; }
.list .it .l { min-width: 0; }
.list .it .l div:last-child { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }

/* новости */
.next { text-align: center; }
.next .big { font-size: 34px; margin: 4px 0; }
.ev { display: grid; grid-template-columns: 46px 44px 1fr auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ev:first-child { border-top: 0; }
.ev .cc { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; text-align: center; padding: 2px 0; }
.ev .cc.usd { color: var(--warn); border-color: rgba(242, 184, 75, .5); }
.ev .cd { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ev.soon .cd { color: var(--warn); }
.ev.past { opacity: .45; }
.dayh { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; padding: 12px 0 4px; }

/* карточки-справка */
details.ref { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
details.ref summary { padding: 12px 14px; cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; font-weight: 600; }
details.ref summary::-webkit-details-marker { display: none; }
details.ref summary span { font-family: var(--mono); color: var(--accent); font-size: 12px; }
details.ref .body { padding: 0 14px 14px; font-size: 14px; }
details.ref .body p { margin: 8px 0; }
details.ref .body .sec { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: 12px; }

/* лист */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 90vh; overflow-y: auto; background: var(--bar);
  border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; }

.toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%) translateY(10px); opacity: 0;
  pointer-events: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px;
  transition: .2s; max-width: calc(100% - 32px); z-index: 30; font-size: 14px; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: var(--bad); color: var(--bad); }

.gate { text-align: center; padding: 60px 20px; }
.gate h1 { font-size: 24px; margin: 18px 0 8px; }
.gate p { color: var(--muted); }
.gate .mark { width: 44px; height: 44px; margin: 0 auto; background:
  linear-gradient(var(--accent), var(--accent)) 0 0 / 9px 100% no-repeat,
  linear-gradient(var(--accent), var(--accent)) 0 0 / 80% 9px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 0 18px / 60% 9px no-repeat; }
