:root { color-scheme: light; --bg:#f4f5f7; --surface:#fff; --line:#dfe3e8; --text:#191919; --muted:#5f6670; --accent:#1b64be; --accent-ink:#fff;
  --series:#257de0; --area:rgba(37,125,224,.12); --up:#008a17; --down:#ec4647; --up-ink:#0a6e19; --down-ink:#bf2a2b; --up-bg:#e6f4e8; --down-bg:#fdebeb;
  --warn-bg:#fff6dc; --warn-line:#e2b93b; --hover:#eef1f5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; --bg:#111213; --surface:#191919; --line:#30343a; --text:#efefef; --muted:#a3a8b0;
  --accent:#6aabf1; --accent-ink:#0b1622; --series:#338ced; --area:rgba(51,140,237,.16); --up:#0aac23; --down:#eb6263; --up-ink:#4fd165; --down-ink:#f38c8c;
  --up-bg:#12301a; --down-bg:#3a1c1c; --warn-bg:#33290c; --warn-line:#8a6d14; --hover:#23262b; } }
:root[data-theme="dark"] { color-scheme: dark; --bg:#111213; --surface:#191919; --line:#30343a; --text:#efefef; --muted:#a3a8b0;
  --accent:#6aabf1; --accent-ink:#0b1622; --series:#338ced; --area:rgba(51,140,237,.16); --up:#0aac23; --down:#eb6263; --up-ink:#4fd165; --down-ink:#f38c8c;
  --up-bg:#12301a; --down-bg:#3a1c1c; --warn-bg:#33290c; --warn-line:#8a6d14; --hover:#23262b; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 14px; } h2 { font-size: 1.05rem; margin: 0 0 8px; }
.sr { position: absolute; left: -9999px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .grow { flex: 1; }
.up { color: var(--up-ink); white-space: nowrap; } .down { color: var(--down-ink); white-space: nowrap; }
code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-size: .88em; word-break: break-word; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; width: 36px; height: 36px; font-size: 1.05rem; cursor: pointer; }
.shell { display: flex; align-items: flex-start; }
.side { width: 232px; flex: none; padding: 10px 8px; position: sticky; top: 53px; max-height: calc(100vh - 53px); overflow: auto; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.side a:hover { background: var(--hover); } .side a.on { background: var(--hover); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.navgroup { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; }
.navnote { font-size: .8rem; color: var(--muted); padding: 14px 10px; margin: 0; }
.shell.mini .side { width: 56px; } .shell.mini .side span, .shell.mini .navgroup, .shell.mini .navnote { display: none; } .shell.mini .side a { justify-content: center; }
.main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.foot { color: var(--muted); font-size: .82rem; margin-top: 28px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; }
.card.narrow { max-width: 560px; } .card.row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.card.row p { margin: 0; } details.card summary { cursor: pointer; } details.card[open] summary { margin-bottom: 10px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; } .two .card { margin: 0 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tlabel { color: var(--muted); font-size: .85rem; } .tvalue { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; } .thint { color: var(--muted); font-size: .8rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; } .r { text-align: right; } tbody tr:hover { background: var(--hover); }
.pager, .calnav { display: flex; gap: 14px; align-items: center; }

label { display: block; font-size: .86rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; max-width: 100%; }
input[type=checkbox] { width: auto; } .pick select { width: auto; } textarea { resize: vertical; }
.grid, .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; align-items: end; } .grid .end, .filters .end { padding-bottom: 1px; }
.btn { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: 7px 14px; }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--line); } .btn.danger { background: transparent; color: var(--down-ink); border-color: var(--down-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); margin: 0 0 12px; }
.flash.ok { background: var(--up-bg); border-color: var(--up); } .flash.bad { background: var(--down-bg); border-color: var(--down); } .flash.note, .warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.warn { padding: 10px 14px; border-radius: 8px; }
.pill { font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.pill.bullish { background: var(--up-bg); color: var(--up-ink); border-color: transparent; } .pill.bearish { background: var(--down-bg); color: var(--down-ink); border-color: transparent; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.chart { height: 280px; width: 100%; } .chart.short { height: 200px; }
.chart svg { display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; display: block; } .chart .zero { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; } .chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--area); } .chart .cross { stroke: var(--muted); stroke-width: 1; } .chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .bar.up { fill: var(--up); } .chart .bar.down { fill: var(--down); } .chart .bar.hot { opacity: .7; }
.tip { position: absolute; z-index: 20; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: .84rem; line-height: 1.4; max-width: 260px; }

table.cal { table-layout: fixed; min-width: 640px; } table.cal th { text-align: center; }
table.cal td { height: 92px; vertical-align: top; border: 1px solid var(--line); background: var(--surface); white-space: normal; }
table.cal td.off { background: transparent; border: 0; } table.cal td.win { background: var(--up-bg); } table.cal td.loss { background: var(--down-bg); }
table.cal td.today .dnum { font-weight: 700; text-decoration: underline; }
.dnum { color: var(--muted); font-size: .82rem; } .dval { font-weight: 650; } .dn { font-size: .78rem; color: var(--muted); }

.loginbox { max-width: 380px; margin: 9vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.loginbox .btn { width: 100%; margin-top: 16px; padding: 10px; }

@media (max-width: 820px) {
  .shell { display: block; } .main { padding: 16px; }
  .side { position: static; width: auto; max-height: none; display: flex; gap: 4px; overflow-x: auto; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .side a { white-space: nowrap; } .navgroup, .navnote { display: none; } .side a.on { box-shadow: inset 0 -3px 0 var(--accent); }
  .shell.mini .side { width: auto; } .shell.mini .side span { display: none; }
  .pick select { max-width: 46vw; } .tvalue { font-size: 1.25rem; }
}

/* second set of features */
td.wrap { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
.downloads { margin: 0 0 8px; }
.candles { height: 380px; width: 100%; } .candles svg { display: block; touch-action: pan-y; }
.candles .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; } .candles .axis { fill: var(--muted); font-size: 11px; }
.candles .c-up { fill: var(--up); stroke: var(--up); } .candles .c-down { fill: var(--down); stroke: var(--down); }
.candles .lvl { stroke-width: 1.5; stroke-dasharray: 6 4; } .candles .lvl.stop { stroke: var(--down-ink); } .candles .lvl.target { stroke: var(--up-ink); }
.candles .mark { stroke: var(--surface); stroke-width: 2; } .candles .mark.entry { fill: var(--series); } .candles .mark.exit { fill: var(--text); }
.candles .marklabel { fill: var(--text); font-size: 11px; font-weight: 600; } .candles .join { stroke: var(--series); stroke-width: 1.5; stroke-dasharray: 3 3; }
.candles .cross { stroke: var(--muted); stroke-width: 1; }
.replay { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; } label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; } label.inline select { width: auto; }
.legend { color: var(--muted); font-size: .84rem; } .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-left: 10px; }
.k-up { background: var(--up); } .k-down { background: var(--down); } .k-entry { background: var(--series); border-radius: 50%; } .k-exit { background: var(--text); border-radius: 50%; }
.k-stop { background: none; border-top: 2px dashed var(--down-ink); height: 0; } .k-target { background: none; border-top: 2px dashed var(--up-ink); height: 0; }
fieldset.rules { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; padding: 8px 12px; } fieldset.rules legend { color: var(--muted); font-size: .86rem; padding: 0 6px; }
.rule { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); } .rule:last-child { border: 0; }
.rule span { flex: 1 1 240px; } .rule label { margin: 0; color: var(--text); white-space: nowrap; } .rule input { width: auto; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; } .shots figure { margin: 0; }
.shots img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 6px; }
@media (max-width: 820px) { .candles { height: 300px; } }

/* market clock */
.chip { font-size: .82rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.chip.peak { background: var(--warn-bg); border-color: var(--warn-line); }
tr.peakrow td { background: var(--warn-bg); }
.dayline { position: relative; padding-top: 4px; } .hours { display: flex; margin-left: 130px; color: var(--muted); font-size: .72rem; } .hours span { flex: 1; }
.lane { display: flex; align-items: center; height: 26px; } .lname { width: 130px; flex: none; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { position: relative; flex: 1; height: 14px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; border-radius: 4px; } .seg.fx, .k-fx { background: var(--series); } .seg.peak, .k-peak { background: #f2a600; } .seg.india, .k-india { background: #00a888; }
.nowwrap { position: absolute; left: 130px; right: 0; top: 18px; bottom: 0; pointer-events: none; } .nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.k-now { background: var(--text); width: 2px; }
@media (max-width: 820px) { .chip { max-width: 100%; order: 9; flex-basis: 100%; } .lname { width: 64px; } .hours, .nowwrap { margin-left: 0; } .hours { margin-left: 64px; } .nowwrap { left: 64px; } }

h2.gap { margin-top: 18px; }
.findings li { margin-bottom: 8px; }
.big { font-size: 1.6rem; font-weight: 650; }
p.up, p.down { white-space: normal; }

/* live price and depth */
table.ladder { max-width: 520px; } table.ladder td { font-variant-numeric: tabular-nums; } table.ladder tr.mid td { border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
td.bar { background-repeat: no-repeat; } td.bar.sell { background-image: linear-gradient(var(--down-bg), var(--down-bg)); background-position: left; }
td.bar.buy { background-image: linear-gradient(var(--up-bg), var(--up-bg)); background-position: right; }

.books { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; } .books .scroll { max-height: 70vh; overflow-y: auto; }
table.book { font-size: .86rem; } table.book caption { text-align: left; color: var(--muted); font-size: .8rem; padding: 4px 6px; }
table.book th { position: sticky; top: 0; background: var(--surface); } table.book td, table.book th { padding: 3px 6px; }
tr.depth { background-repeat: no-repeat; } tr.depth.bid { background-image: linear-gradient(var(--up-bg), var(--up-bg)); background-position: right; }
tr.depth.ask { background-image: linear-gradient(var(--down-bg), var(--down-bg)); background-position: left; }
.balance { height: 12px; border-radius: 6px; background: var(--down); overflow: hidden; margin: 10px 0 4px; } .balance span { display: block; height: 100%; background: var(--up); border-right: 2px solid var(--surface); }
@media (max-width: 820px) { .books { gap: 6px; } table.book { font-size: .74rem; } table.book td, table.book th { padding: 3px 3px; }
  table.book th:first-child, table.book td:first-child { display: none; } #bkAsks th:first-child, #bkAsks td:first-child { display: table-cell; } #bkAsks th:last-child, #bkAsks td:last-child { display: none; } }

/* customisable overview */
.card > .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; } .card > .row h2 { margin: 0; }
select.auto { width: auto; } table.custom { max-width: 520px; } table.custom td { white-space: normal; } input.pos { width: 80px; } label.plain { display: inline; margin: 0; color: var(--text); font-size: 1rem; }

/* score, activity, balance, drawdown */
:root { --series2: #f47230; } :root[data-theme="dark"] { --series2: #e76624; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series2: #e76624; } }
.chart .line.s2 { stroke: var(--series2); } .chart .dot.s2 { fill: var(--series2); } .key.s1 { background: var(--series); } .key.s2 { background: var(--series2); }
.chart svg.tone-down .line { stroke: var(--down); } .chart svg.tone-down .area { fill: var(--down-bg); } .chart svg.tone-down .dot { fill: var(--down); }
.meter { height: 10px; border-radius: 5px; background: var(--hover); overflow: hidden; min-width: 90px; } .meter span { display: block; height: 100%; background: var(--series); border-radius: 5px; }
.meter.wide { margin: 6px 0 12px; height: 12px; } .big.inline { margin-left: 10px; } td.barcell { width: 34%; min-width: 110px; } table.parts td { white-space: normal; }
.two.inner { gap: 24px; } label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: .95rem; margin: 8px 0; } label.check input { margin-top: 4px; }
table.heat { width: auto; border-collapse: separate; border-spacing: 3px; } table.heat th { font-size: .7rem; font-weight: 400; padding: 0 6px 0 0; border: 0; }
table.heat td { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 3px; background: var(--hover); } table.heat td a { display: block; width: 16px; height: 16px; } table.heat tbody tr:hover { background: none; }
table.heat td.fut { background: transparent; } .h1 { background: #b6d5f8 !important; } .h2 { background: #6aabf1 !important; } .h3 { background: #257de0 !important; } .h4 { background: #0f4a96 !important; }
:root[data-theme="dark"] .h1 { background: #1757ac !important; } :root[data-theme="dark"] .h2 { background: #2370cd !important; } :root[data-theme="dark"] .h3 { background: #519ced !important; } :root[data-theme="dark"] .h4 { background: #9dc8f7 !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .h1 { background: #1757ac !important; } :root:not([data-theme="light"]) .h2 { background: #2370cd !important; } :root:not([data-theme="light"]) .h3 { background: #519ced !important; } :root:not([data-theme="light"]) .h4 { background: #9dc8f7 !important; } }
table.cal.small td { height: 62px; } table.cal.small { min-width: 520px; }

/* round 8: global controls, gauges, radar, notebook */
.pick input[type=date] { width: auto; } details.pop { position: relative; } details.pop > summary { list-style: none; cursor: pointer; } details.pop > summary::-webkit-details-marker { display: none; }
.popbody { position: absolute; z-index: 30; top: 44px; left: 0; width: min(320px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.popbody .pair { display: flex; gap: 8px; } .top .btn { padding: 6px 10px; font-size: .9rem; white-space: nowrap; }
.chart .web { fill: none; stroke: var(--line); stroke-width: 1; } .chart .web.edge { stroke: var(--muted); } .chart .radfill { fill: var(--area); stroke: var(--series); stroke-width: 2; stroke-linejoin: round; }
.chart .radlab { font-size: 11.5px; fill: var(--text); } .chart.radar { height: 300px; }
.gauge { width: 92px; height: 54px; flex: none; } .gauge.ring { height: 64px; width: 64px; } .gauge path, .gauge circle { fill: none; stroke-width: 9; stroke-linecap: butt; }
.gauge .g-bg { stroke: var(--hover); } .gauge .g-win { stroke: var(--up); } .gauge .g-even { stroke: var(--muted); } .gauge .g-loss { stroke: var(--down); }
.tile.kpi { display: flex; justify-content: space-between; gap: 10px; align-items: center; } .gcount { display: flex; gap: 8px; justify-content: center; font-size: .74rem; font-variant-numeric: tabular-nums; }
.gcount .w { color: var(--up-ink); } .gcount .l { color: var(--down-ink); } .gcount .e { color: var(--muted); }
.wlbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 6px 0 2px; gap: 2px; } .wlbar span:first-child { background: var(--up); } .wlbar span:last-child { background: var(--down); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; } .tabs button { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 6px 10px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.note-body h3 { font-size: 1.05rem; margin: 12px 0 4px; } .note-body ul { margin: 4px 0 8px 20px; padding: 0; } .note-body p { margin: 0 0 8px; overflow-wrap: anywhere; } .note-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; } .toolbar button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
th a.sort { color: inherit; text-decoration: none; } th a.sort:hover { text-decoration: underline; } td.pickcol, th.pickcol { width: 28px; padding-right: 0; } td.pickcol input { width: auto; }
dl.formulas dt { font-weight: 650; margin-top: 12px; } dl.formulas dd { margin: 2px 0 0 0; color: var(--text); } dl.formulas code { white-space: normal; }
@media (max-width: 820px) { .popbody { position: fixed; left: 4vw; top: 110px; } .gauge { width: 72px; height: 44px; } }

.topacts { margin: 0 0 14px; } .topacts form { margin: 0; } .meter.scale { background: linear-gradient(90deg, var(--down-bg), var(--warn-bg), var(--up-bg)); } .meter.scale span { background: var(--text); opacity: .75; }
.grid .wide { grid-column: 1 / -1; } form.inlineform { display: inline; margin-left: 8px; } form.inlineform .btn { padding: 1px 8px; font-size: .8rem; }

.tiles.kpis { grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); } .tile.kpi > div:first-child { min-width: 0; }
.side { top: var(--top, 53px); max-height: calc(100vh - var(--top, 53px)); }
@media (max-width: 820px) { .tiles.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .tile.kpi { flex-wrap: wrap; } }
