/* NIE P2P Panel — light theme, olive accent */
:root {
  --bg: #f4f6f1;
  --side: #fbfcf9;
  --panel: #ffffff;
  --panel2: #f4f6ef;
  --raise: #eaeee2;
  --line: #e2e6da;
  --line2: #cfd5c5;
  --text: #1d2318;
  --muted: #5f6857;
  --faint: #8b9383;
  --accent: #5e7f1e;
  --accent-ink: #ffffff;
  --accent-soft: #edf3df;
  --accent-line: #c6d6a2;
  --accent-deep: #44601a;
  --buy: #2f6fd0;
  --sell: #c4511f;
  --good: #2f8f5b;
  --good-soft: #e3f3ea;
  --bad: #c8423f;
  --bad-soft: #fbe9e8;
  --warn: #b7791f;
  --warn-soft: #fbf1df;
  --info-soft: #e7effb;
  --shadow: 0 1px 2px rgba(29,35,24,.06), 0 4px 14px rgba(29,35,24,.06);
  --r: 10px;
  --r-sm: 7px;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; }
code { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; }
.mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 12px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12px; font-weight: 400; }
.r { text-align: right; } .nowrap { white-space: nowrap; }
.pos { color: var(--good); } .neg { color: var(--bad); } .warnc { color: var(--warn); }
.side-buy { color: var(--buy); } .side-sell { color: var(--sell); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ============ layout ============ */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sb { background: var(--side); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sb-brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 12px; letter-spacing: -.02em; flex: none; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 11.5px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-g { color: var(--faint); font-size: 11.5px; font-weight: 600; padding: 14px 10px 4px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 11px; background: none; border: 0; color: #3f4838; padding: 7px 10px; border-radius: 8px; text-align: left; font-size: 13.5px; white-space: nowrap; position: relative; }
.nav button svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav button:hover { background: var(--panel2); color: var(--text); }
.nav button.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.nav button.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav button.active svg { opacity: 1; }
.nav .pill { margin-left: auto; }
.sb-foot { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-chip { border: 1px solid var(--line2); border-radius: 20px; padding: 2px 9px; font-size: 11.5px; color: var(--text); background: none; }
.plan-chip.trial { border-color: var(--warn); color: var(--warn); }
.plan-chip.bad { border-color: var(--bad); color: var(--bad); }

.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--muted); white-space: nowrap; }
.crumb b { color: var(--text); font-weight: 600; }
.ticker { flex: 1; display: flex; justify-content: center; min-width: 0; }
.tape { display: flex; align-items: center; gap: 18px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; overflow: hidden; cursor: pointer; }
.tape .pair { font-weight: 700; letter-spacing: .01em; }
.tape .lbl { display: inline; color: var(--muted); font-size: 12px; margin-right: 5px; }
.tape .px { font-weight: 700; }
.tape .asset { display: inline-flex; align-items: baseline; gap: 10px; flex: none; }
.tape .asset + .asset { padding-left: 16px; border-left: 1px solid var(--line); }
.tape .coin { font-weight: 700; color: var(--accent-deep); }
.tape .spr { color: var(--muted); font-size: 11.5px; }
.tape .px.b { color: var(--buy); } .tape .px.s { color: var(--sell); }
.tape .live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.tape .live.stale { background: var(--faint); box-shadow: none; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; color: #4a5342; position: relative; }
.icon-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dotb { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.acc-sel { width: auto; min-width: 140px; padding: 6px 10px; background: var(--panel); }
.bot-pill { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.bot-pill .d { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.bot-pill.on .d { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.bot-pill.err .d { background: var(--bad); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--raise); border: 1px solid var(--line2); display: grid; place-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.hamb { display: none; }

.main { padding: 22px 26px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.banner { margin: 14px 26px 0; padding: 10px 14px; border-radius: var(--r); background: var(--bad-soft); border: 1px solid #efc2c0; color: #8f2724; }
.banner.info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }

/* toolbar (filters) */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar select, .toolbar input { width: auto; padding: 6px 9px; font-size: 13px; }
.toolbar .search { position: relative; }
.toolbar .search input { padding-left: 30px; width: 100%; }
.toolbar .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.segc { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.segc button { background: none; border: 0; color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.segc button:hover { color: var(--text); }
.segc button.on { background: var(--raise); color: var(--text); box-shadow: 0 1px 2px rgba(29,35,24,.08); }
.tdiv { width: 1px; align-self: stretch; background: var(--line); }
.daterange { display: flex; gap: 6px; align-items: center; }
.daterange input { width: 140px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: 7px 14px; font-weight: 650; font-size: 13.5px; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { background: var(--panel2); filter: none; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.ok { background: var(--good); border-color: var(--good); color: #fff; }
.btn.warn, .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.warnb { background: transparent; border-color: #e3a4a2; color: var(--bad); }
.link { background: none; border: 0; color: var(--accent); padding: 0; font-size: inherit; }
.link:hover { text-decoration: underline; }
.copy { background: none; border: 0; color: var(--faint); padding: 0 4px; }
.copy:hover { color: var(--accent); }
a:hover { color: var(--accent-deep); }

/* KPI band — one surface, divided cells */
.kpis, .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.kpis > .kpi, .cards > .kpi { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; min-width: 0; }
.kpi .k { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.kpi .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards .kpi .v { font-size: 17px; }
.kpi .v small { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* today strip */
.today { display: flex; align-items: stretch; gap: 0; background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border: 1px solid var(--accent-line); border-radius: var(--r); margin-bottom: 16px; overflow-x: auto; }
.today .t-h { padding: 14px 18px; border-right: 1px solid var(--accent-line); min-width: 150px; }
.today .t-h b { display: block; font-size: 16px; }
.today .t-h span { color: var(--muted); font-size: 12px; }
.today .t-c { padding: 12px 18px; border-right: 1px solid var(--line); min-width: 150px; }
.today .t-c:last-child { border-right: 0; }
.today .t-c .k { color: var(--muted); font-size: 12px; }
.today .t-c .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.panel-h { font-weight: 650; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; font-size: 14.5px; }
.panel-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* tables */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; max-height: calc(100vh - 300px); }
.table-wrap.flat { border: 0; max-height: none; background: none; border-radius: 0; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: var(--panel2); position: sticky; top: 0; z-index: 1; user-select: none; }
.table-wrap.flat th { background: transparent; }
th.r, td.r { text-align: right; }
th[data-sort] { cursor: pointer; }
th.sorted::after { content: " ↓"; color: var(--accent); } th.sorted.asc::after { content: " ↑"; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #f7f9f3; }
tr.click { cursor: pointer; }
tr.hot td { background: #fdf8ec; }
tr.hot td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.off td { opacity: .5; }
tfoot td { font-weight: 700; background: var(--panel2); border-bottom: 0; }
td.wrap, .wrap { white-space: normal; max-width: 380px; }
.mini { width: 100%; }
.mini td { padding: 8px 4px; font-size: 13px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.pager button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; }
.pager button:disabled { opacity: .4; }
.bulk { display: flex; gap: 8px; align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; }
.bulk span { margin-right: 6px; }
.acc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* badges */
.st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--info-soft); color: #2457a6; letter-spacing: .01em; }
.st.good { background: var(--good-soft); color: #1f7046; }
.st.bad { background: var(--bad-soft); color: #a8302d; }
.st.warn { background: var(--warn-soft); color: #8a5a10; }
.st.dim { background: var(--panel2); color: var(--muted); }
.pill { background: var(--raise); color: var(--text); border-radius: 20px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.pill.hot { background: var(--accent); color: var(--accent-ink); }
.tag { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line2); }
.tag.in { color: var(--buy); } .tag.out { color: var(--sell); }
.chip { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 0 8px; font-size: 12px; margin: 1px; }

/* TDS segmented */
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; vertical-align: middle; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 4px 11px; font-size: 12px; font-weight: 650; }
.seg button.on.yes { background: var(--good); color: #fff; }
.seg button.on.no { background: var(--bad); color: #fff; }
.seg.default button.on { opacity: .5; }
.deflabel { font-size: 10.5px; color: var(--faint); margin-left: 6px; }
.rate-in { width: 96px; padding: 4px 7px; text-align: right; font-size: 12.5px; }
.num-in { width: 64px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { display: none; }
.switch .knob { width: 34px; height: 19px; border-radius: 12px; background: #cfd5c5; position: relative; flex: none; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch input:checked + .knob { background: var(--good); }
.switch input:checked + .knob::after { left: 17px; background: #fff; }
.switch.disabled { opacity: .5; cursor: not-allowed; }
.switch.mini .knob { width: 28px; height: 16px; } .switch.mini .knob::after { width: 12px; height: 12px; } .switch.mini input:checked + .knob::after { left: 14px; }

/* control center */
.cc-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
.cc-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; gap: 22px; align-items: center; }
.cc-main .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.cc-main .big.on { color: var(--good); } .cc-main .big.off { color: var(--muted); }
.cc-main .switch .knob { width: 58px; height: 32px; border-radius: 18px; }
.cc-main .switch .knob::after { width: 26px; height: 26px; top: 3px; left: 3px; }
.cc-main .switch input:checked + .knob::after { left: 29px; }
.panic { background: var(--bad-soft); border: 1px solid #efc2c0; border-radius: var(--r); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.panic .btn { align-self: flex-start; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.tg { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; display: flex; gap: 14px; align-items: flex-start; }
.tg .tx { flex: 1; }
.tg .tx b { display: block; font-size: 14px; }
.tg .tx span { color: var(--muted); font-size: 12.5px; }
.tg.locked { opacity: .55; }

/* charts */
.chart { position: relative; }
.chart svg { display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis0 { stroke: var(--line2); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(94,127,30,.06); }
.chart .xline { stroke: var(--line2); stroke-dasharray: 3 3; }
.chart-empty { color: var(--muted); padding: 60px 0; text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.legend i, .tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.tip { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 12px; pointer-events: none; box-shadow: 0 8px 24px rgba(29,35,24,.14); line-height: 1.6; }
.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 10.5px; color: var(--muted); }
.heat div { height: 18px; border-radius: 3px; }
.heat .hl { height: auto; display: flex; align-items: center; }
.bars .bar { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; margin: 6px 0; font-size: 12.5px; }
.bars .track { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--buy); border-radius: 4px; }

/* statement / tds */
.stmt { width: 100%; border-collapse: collapse; }
.stmt td { padding: 8px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; white-space: normal; }
.stmt td:last-child { text-align: right; font-weight: 650; white-space: nowrap; }
.stmt tr.total td { border-bottom: 0; border-top: 1px solid var(--line2); font-size: 16px; font-weight: 800; padding-top: 10px; }
.stmt tr.sub td { color: var(--muted); font-size: 12.5px; }
.stmt tr.gap td { border: 0; padding: 4px; }
.callout { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.callout b { color: var(--text); }
.callout.neg { color: var(--bad); }
.tdsbig { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.tdsbig > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
.tdsbig .k { font-size: 12px; color: var(--muted); }
.tdsbig .v { font-size: 20px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tdsbig .s { font-size: 11.5px; color: var(--muted); }
.explain { color: var(--muted); margin: 0; padding-left: 18px; line-height: 1.65; font-size: 13px; max-width: 900px; }
.explain b { color: var(--text); }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; max-width: 900px; }
.table-wrap + .hint, .table-wrap + p.hint { margin-top: 10px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.kv div:nth-child(even) { word-break: break-all; }

/* drawer / modal */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--panel); border-left: 1px solid var(--line2); z-index: 40; display: flex; flex-direction: column; box-shadow: -18px 0 40px rgba(29,35,24,.12); animation: slidein .16s ease-out; }
.drawer.wide { width: min(1100px, 100%); }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.drawer-head h2 { font-size: 16px; margin: 0; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; width: 30px; height: 30px; border-radius: 6px; }
.x:hover { background: var(--panel2); color: var(--text); }
.drawer-body { padding: 16px 18px; overflow: auto; }
.edit-box { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 14px; display: grid; gap: 10px; }
.edit-box label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.modal { position: fixed; inset: 0; background: rgba(29,35,24,.32); display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow: auto; padding: 56px 12px; }
.modal-card { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; width: min(560px, 100%); box-shadow: 0 20px 60px rgba(29,35,24,.18); }
.mform .mbody { padding: 14px 18px; display: grid; gap: 11px; max-height: 70vh; overflow: auto; }
.mform label, .sform label, .gform label, .lbl { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
.mform label.row, .sform label.row { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-size: 13px; }
.mform .hint, .sform .hint { margin: 0; font-size: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.inline input, .inline select { width: auto; flex: 1; min-width: 140px; }

/* menus */
.menu-pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 16px 40px rgba(29,35,24,.14); min-width: 220px; padding: 6px; }
.menu-pop button.mi { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; display: flex; gap: 10px; align-items: center; }
.menu-pop button.mi:hover { background: var(--panel2); }
.menu-pop .mh { padding: 8px 10px 6px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.notif-pop { width: 380px; max-height: 70vh; overflow: auto; }
.dropdown { position: relative; }
.dropdown .menu { display: none; position: absolute; right: 0; top: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; z-index: 10; min-width: 170px; }
.dropdown:hover .menu, .dropdown:focus-within .menu { display: grid; }
.dropdown .menu button { background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 6px; }
.dropdown .menu button:hover { background: var(--panel); }

/* command palette */
.palette { position: fixed; inset: 0; z-index: 80; background: rgba(29,35,24,.3); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette-card { width: min(620px, 94vw); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(29,35,24,.2); }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 15px 18px; font-size: 15px; background: transparent; box-shadow: none !important; }
.palette .res { max-height: 50vh; overflow: auto; padding: 6px; }
.palette .ri { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 7px; cursor: pointer; }
.palette .ri.sel, .palette .ri:hover { background: var(--panel2); }
.palette .ri .k { margin-left: auto; color: var(--muted); font-size: 12px; }

/* toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; max-width: 420px; }
.toast { background: var(--panel); border: 1px solid var(--line2); border-left: 4px solid var(--muted); padding: 10px 14px; border-radius: 8px; box-shadow: 0 10px 28px rgba(29,35,24,.14); font-size: 13px; animation: slidein .16s ease-out; }
.toast.ok { border-left-color: var(--good); } .toast.error { border-left-color: var(--bad); } .toast.action { border-left-color: var(--accent); }

/* gate */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.gate-art { background: radial-gradient(1200px 500px at 0% 100%, rgba(94,127,30,.16), transparent 60%), var(--accent-soft); border-right: 1px solid var(--line); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.gate-art h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; max-width: 460px; }
.gate-art p { color: var(--muted); max-width: 440px; margin: 0; }
.gate-art ul { color: var(--muted); padding-left: 18px; line-height: 1.9; margin: 18px 0 0; }
.gate-form { display: flex; align-items: center; justify-content: center; padding: 30px; }
.gate-card { width: min(380px, 100%); }
.gate-card h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; }
.gform { display: grid; gap: 12px; margin-top: 16px; }
.gform .btn { justify-content: center; padding: 9px; }

/* live cockpit */
.cockpit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; }
.cp-status { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.actionbox { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; }
.paybig { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cp-right { display: flex; flex-direction: column; min-height: 70vh; }
.chat { flex: 1; overflow-y: auto; background: #f6f8f2; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 62vh; }
.small-chat { max-height: 320px; }
.chat > div { display: flex; flex-direction: column; }
.bubble { max-width: 80%; padding: 7px 11px; border-radius: 12px; font-size: 13px; line-height: 1.45; word-wrap: break-word; }
.bubble.in { background: #ffffff; border: 1px solid var(--line); align-self: flex-start; border-top-left-radius: 3px; }
.bubble.out { background: #e4eccf; align-self: flex-end; border-top-right-radius: 3px; }
.bubble.sys { background: transparent; color: var(--muted); align-self: center; font-size: 12px; }
.bubble .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.bubble .who span { margin-left: 6px; }
.bubble img { max-width: 220px; border-radius: 6px; display: block; }
.composer { margin-top: 8px; display: grid; gap: 6px; }
.filebtn { cursor: pointer; }

/* tabs, templates */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { background: none; border: 0; color: var(--muted); padding: 9px 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-color: var(--accent); }
.var { cursor: pointer; margin: 2px; display: inline-block; }
.var:hover { border-color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.tpl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px; display: grid; gap: 8px; align-content: start; }
.tpl.off { opacity: .55; }
.tpl-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-h b { flex: 1 1 60%; }
.preview { background: #e4eccf; border-radius: 10px; border-top-right-radius: 3px; padding: 8px 11px; font-size: 12.5px; color: var(--text); }

/* notifications */
.notif-list { display: grid; gap: 6px; }
.notif { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 8px; padding: 10px 13px; }
.notif[data-live] { cursor: pointer; }
.notif.unread { background: var(--panel2); }
.notif.action { border-left-color: var(--accent); } .notif.error { border-left-color: var(--bad); } .notif.warn { border-left-color: var(--warn); } .notif.info { border-left-color: var(--buy); }
.notif-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; align-items: start; }
.sform { display: grid; gap: 11px; margin: 0; }
.inline-row { display: inline-flex !important; flex-direction: row !important; gap: 6px; }
.acc-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; }
.acc-card .top { display: flex; align-items: center; gap: 10px; }
.acc-card .top b { font-size: 16px; }
.checks { display: grid; gap: 4px; font-size: 12.5px; }
.feat { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.feat div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.feat .on { border-color: #a9d6bc; color: #1f7046; }
.timeline { display: grid; gap: 10px; }
.tl { border-left: 2px solid var(--line2); padding: 2px 0 2px 12px; }
.tl-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.qr { background: #fff; padding: 8px; border-radius: 8px; width: 200px; }

@media (max-width: 1640px) { .tape .spr, .tape .asset .small { display: none; } .tape { gap: 14px; } .tape .asset + .asset { padding-left: 12px; } }
@media (max-width: 1400px) { .tape .lbl { display: none; } .crumb > span:first-child { display: none; } }
@media (max-width: 1280px) { .tape .asset .small { display: none; } }
@media (max-width: 1100px) { .cockpit, .cc-hero { grid-template-columns: 1fr; } .ticker { display: none; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sb { position: fixed; left: 0; top: 0; z-index: 45; width: 260px; transform: translateX(-100%); transition: transform .18s; }
  .sb.open { transform: none; box-shadow: 20px 0 50px rgba(29,35,24,.18); }
  .hamb { display: grid; }
  .main { padding: 16px; }
  .grid2, .settings-grid { grid-template-columns: 1fr; }
  .gate { grid-template-columns: 1fr; } .gate-art { display: none; }
  .acc-sel { min-width: 0; max-width: 100px; }
  .crumb { display: none; }
  .topbar { padding: 0 10px; gap: 6px; }
  .tb-right { gap: 4px; margin-left: auto; }
  #botTxt { display: none; }
  .bot-pill { padding: 8px; }
  .kpis, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 17px; }
}

.sform label.switch, .mform label.switch { flex-direction: row; align-items: center; color: var(--text); }
.link.neg { color: var(--bad); }

/* ============ v4: staff, bank, tax, fraud ============ */
.plan-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-chip.duty-on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-deep); }
.duty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.duty-dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.who-chip { display: inline-block; padding: 2px 9px; border-radius: 20px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; white-space: nowrap; }
.who-chip.me { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.handle { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel2); }
.handle .inline { margin: 0; }
.handle select { width: auto; min-width: 150px; padding: 5px 8px; }
.timeline { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; border-left: 2px solid var(--line); padding-left: 10px; }
.callout.ok-call { background: var(--good-soft); border-color: #a9d6bc; color: #1f5f3c; }
.callout.neg-call { background: var(--bad-soft); border-color: #efc2c0; color: #8f2724; margin-bottom: 12px; }
.callout.faint-call { color: var(--muted); }
.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 520px; }
.perm-tags span { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin: 4px 0 10px; }
.perm { display: flex !important; flex-direction: row !important; gap: 9px !important; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--text) !important; }
.perm:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.perm input { margin-top: 2px; }
.perm span { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.perm small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.grid-2f { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.modal-card:has(.perm-grid) { width: min(760px, 100%); }
pre.cred { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 13px; white-space: pre-wrap; user-select: all; }
.dl-list { display: flex; flex-direction: column; }
.dl-list > div { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.dl-list > div:last-child { border-bottom: 0; }
.dl-list b { grid-column: 1; } .dl-list span { grid-column: 1; color: var(--muted); font-size: 12.5px; } .dl-list a { grid-column: 2; grid-row: 1 / span 2; }
.checks { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.filebtn { cursor: pointer; }
@media (max-width: 640px) { .grid-2f { grid-template-columns: 1fr; } }
a.btn { text-decoration: none; }
.page-actions select { width: auto; min-width: 140px; }
td.narr { max-width: 340px; word-break: break-word; overflow-wrap: anywhere; }

/* ============ v5: market monitor ============ */
.kpis.kpis4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.inner { margin: 0 0 8px; }
.kpis.inner .kpi { box-shadow: none; background: var(--panel2); }
@media (max-width: 1100px) { .kpis.kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.monstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: -4px 0 12px; }
.dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 7px; box-shadow: 0 0 0 3px var(--bad-soft); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .livedot { animation: none; } }
.tier { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; text-transform: lowercase; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); }
.tier.t-whale { background: #e9e1f7; border-color: #cdbdec; color: #5b3d99; }
.tier.t-large { background: var(--info-soft); border-color: #bcd0f0; color: #2457a6; }
.tier.t-mid { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.livechip { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: var(--bad-soft); color: #a8302d; vertical-align: 1px; }
.newchip { display: inline-block; font-size: 10.5px; padding: 0 6px; border-radius: 8px; background: var(--info-soft); color: #2457a6; }
.starbtn { border: 0; background: none; cursor: pointer; color: var(--line2); font-size: 14px; padding: 0 2px; line-height: 1; }
.starbtn.on { color: #c99a06; }
.starbtn:hover { color: #c99a06; }
.starbig { color: #c99a06; margin-right: 6px; }
.mname { font-weight: 600; color: var(--text); text-decoration: none; }
.mname:hover { color: var(--accent-deep); text-decoration: underline; }
.montable td, .montable th { white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--accent-deep); }
th.sorted.desc::after { content: ' ▾'; } th.sorted.asc::after { content: ' ▴'; }
.coinchips { display: flex; flex-wrap: wrap; gap: 6px; }
.coinchip { font-size: 12.5px; padding: 4px 10px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tierbox { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel2); cursor: pointer; font: inherit; color: inherit; text-align: left; }
.tierbox b { font-size: 20px; }
.tierbox:hover { border-color: var(--accent-line); }
.monfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.monfilters input { width: 230px; }
.monfilters .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.monfilters .right { margin-left: auto; }
.monfilters select { width: auto; }
.fchip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 16px; padding: 4px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.fchip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); font-weight: 600; }
.panel.tight { padding-bottom: 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 4px; }
.mhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.mhead h2 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.daycard .dayfacts { font-size: 12.5px; color: var(--muted); }
.kvp { display: grid; grid-template-columns: 1fr auto; font-size: 13px; }
.kvp > div { display: contents; }
.kvp > div > span { color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.kvp > div > b { text-align: right; padding: 6px 0 6px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.table-wrap.tall { max-height: 520px; overflow: auto; }
tr.dim td { color: var(--faint); }
.switch-inline { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.flows { display: flex; flex-direction: column; gap: 6px; }
.flow { display: grid; grid-template-columns: 180px 1fr 180px 80px; align-items: center; gap: 10px; font-size: 13px; }
.flow .fs { text-align: right; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow .fbuy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow b { text-align: right; }
.fb { height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.fb i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.fb i.lv-mazboot { background: var(--accent-line); } .fb i.lv-shayad { background: var(--line2); }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } .flow .fs { text-align: left; } .tiers { grid-template-columns: repeat(2, 1fr); } }
.daycard .kpis.inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.daycard .kpis.inner .v { font-size: 19px; }
