/* exzinvest — trading desk console */
:root {
  color-scheme: dark;
  --bg: #0E1828;
  --surface: #15233A;
  --surface-2: #1B2C47;
  --surface-3: #22365A;
  --line: #263A5E;
  --line-soft: #1F3150;
  --text: #E8EEF7;
  --text-2: #AEBBD0;
  --muted: #8191AB;
  --brass: #E0B25C;
  --brass-soft: rgba(224, 178, 92, .14);
  --profit: #2FB894;
  --loss: #E86A73;
  --profit-soft: rgba(47, 184, 148, .14);
  --loss-soft: rgba(232, 106, 115, .14);
  --s-sydney: #6E7FF0;
  --s-tokyo: #C25C9E;
  --s-london: #1FA0B4;
  --s-newyork: #B98A2E;
  --impact-high: #E86A73;
  --impact-med: #E0B25C;
  --impact-low: #6D7F9C;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --font: "Manrope", "IBM Plex Sans Thai", "Segoe UI", system-ui, sans-serif;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--profit); }
.neg { color: var(--loss); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #111D31 0%, var(--bg) 100%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand span { font-size: 21px; letter-spacing: -.02em; }
.brand b { font-weight: 800; }
.brand i { font-style: normal; font-weight: 400; color: var(--text-2); }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14.5px;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brass); }
.side-foot { margin-top: auto; padding: 12px; font-size: 13px; color: var(--muted); }
.side-foot button { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; padding: 22px 32px 60px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.clock { display: flex; align-items: center; gap: 14px; color: var(--text-2); font-size: 14px; }
.clock strong { color: var(--text); font-size: 18px; font-weight: 700; }
.mkt-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 13px; }
.mkt-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mkt-pill.open::before { background: var(--profit); box-shadow: 0 0 0 4px var(--profit-soft); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px 22px; min-width: 0; }
.panel h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 18px; margin-top: 18px; }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.link { color: var(--brass); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- session rail (signature element) ---------- */
.rail { position: relative; padding: 18px 22px 16px; background: radial-gradient(120% 140% at 0% 0%, #1A2B48 0%, var(--surface) 55%); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.rail-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.rail-status { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.rail-status small { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-2); letter-spacing: 0; margin-top: 2px; }
.rail-next { text-align: right; font-size: 13.5px; color: var(--text-2); }
.rail-next strong { display: block; font-size: 17px; color: var(--text); }
.rail-body { position: relative; }
.rail-row { position: relative; display: grid; grid-template-columns: 92px 1fr; align-items: center; height: 34px; }
.rail-row .name { font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.rail-row .name::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.rail-row.live .name { color: var(--text); }
.rail-track { position: relative; height: 100%; }
.rail-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-soft); }
.rail-bar { position: absolute; top: 7px; bottom: 7px; border-radius: 6px; background: color-mix(in oklab, var(--c) 34%, transparent); border: 1px solid color-mix(in oklab, var(--c) 70%, transparent); }
.rail-row.live .rail-bar { background: var(--c); border-color: var(--c); }
.rail-bar span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; max-width: calc(100% - 12px); }
.rail-axis { display: grid; grid-template-columns: 92px 1fr; margin-top: 6px; }
.rail-ticks { position: relative; height: 18px; font-size: 11.5px; color: var(--muted); }
.rail-ticks span { position: absolute; transform: translateX(-50%); }
.rail-overlap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(224,178,92,.10) 0 6px, transparent 6px 12px); border-left: 1px dashed rgba(224,178,92,.35); border-right: 1px dashed rgba(224,178,92,.35); pointer-events: none; }
.rail-now { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 2px; pointer-events: none; }
.rail-now::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 4px rgba(232,238,247,.15); }
.rail-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.rail-legend i { display: inline-block; width: 18px; height: 10px; vertical-align: -1px; margin-right: 6px; border-radius: 3px; background: repeating-linear-gradient(135deg, rgba(224,178,92,.35) 0 3px, transparent 3px 6px); border: 1px dashed rgba(224,178,92,.5); }

/* ---------- stat strip ---------- */
.strip { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); margin-top: 18px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); }
.stat { padding: 16px 20px; border-left: 1px solid var(--line-soft); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat:first-child .v { font-size: 32px; }
.stat .d { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .zero-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .eq-line { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; }
.chart .eq-area { fill: url(#eqFill); }
.chart .cross { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--brass); stroke: var(--surface); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.35); white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.tip b { display: block; font-size: 14px; }
.bars rect.bar-pos { fill: var(--profit); }
.bars rect.bar-neg { fill: var(--loss); }
.bars rect.hit { fill: transparent; cursor: default; }
.bars rect.hit:hover + rect, .bars g:hover rect.bar-pos, .bars g:hover rect.bar-neg { opacity: .8; }

.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13.5px; }
.hbar + .hbar { border-top: 1px solid var(--line-soft); }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hbar .lbl small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.hbar .track { position: relative; height: 10px; }
.hbar .track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.hbar .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.hbar .val { text-align: right; font-weight: 700; min-width: 84px; }

/* ---------- news ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { display: grid; grid-template-columns: 64px 46px 1fr; gap: 10px; align-items: center; padding: 9px 0; font-size: 13.5px; }
.news-item + .news-item { border-top: 1px solid var(--line-soft); }
.news-item .t { color: var(--text-2); font-weight: 600; }
.news-item .title { min-width: 0; }
.news-item .title small { display: block; color: var(--muted); font-size: 12px; }
.cur { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 12.5px; }
.imp { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.imp.High { background: var(--impact-high); }
.imp.Medium { background: var(--impact-med); }
.imp.Low, .imp.Holiday { background: var(--impact-low); }
.countdown { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); font-size: 12px; font-weight: 700; }

.day-block { margin-top: 22px; }
.day-block h3 { font-size: 14px; font-weight: 800; margin: 0 0 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.day-block h3 span { color: var(--muted); font-weight: 600; }
.news-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.news-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.news-table td.time { width: 76px; color: var(--text-2); font-weight: 600; }
.news-table td.c { width: 76px; }
.news-table td.fv { width: 120px; text-align: right; color: var(--text-2); font-size: 13px; }
.news-table tr.past td { opacity: .45; }
.news-table tr.next td { background: var(--brass-soft); }
.news-table tr.next td:first-child { box-shadow: inset 3px 0 0 var(--brass); }

/* ---------- controls ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--surface-3); color: var(--text); border-color: var(--surface-3); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1A1406; }
.btn.primary:hover { background: #EBC173; }
.btn.danger { background: transparent; color: var(--loss); border-color: rgba(232,106,115,.4); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14.5px; color: var(--text); font-weight: 500;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 16px; border-radius: 7px; font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.seg input:checked + span { background: var(--surface-3); color: var(--text); }
.seg input:checked + span.buy { background: var(--profit-soft); color: var(--profit); }
.seg input:checked + span.sell { background: var(--loss-soft); color: var(--loss); }
.seg input:focus-visible + span { outline: 2px solid var(--brass); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table th.r, .table td.r { text-align: right; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.side-tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.side-tag.buy { background: var(--profit-soft); color: var(--profit); }
.side-tag.sell { background: var(--loss-soft); color: var(--loss); }
.tagline { color: var(--muted); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- EA cards ---------- */
.ea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.ea { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 18px 20px; display: grid; gap: 14px; cursor: pointer; text-align: left; }
.ea:hover { border-color: var(--line); }
.ea-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ea h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.ea .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.live { color: var(--profit); background: var(--profit-soft); }
.status.live::before { background: var(--profit); }
.status.testing { color: var(--brass); background: var(--brass-soft); }
.status.testing::before { background: var(--brass); }
.status.paused::before { background: var(--text-2); }
.ea-nums { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 10px; }
.ea-nums div { font-size: 12px; color: var(--muted); font-weight: 600; }
.ea-nums b { display: block; font-size: 16px; color: var(--text); font-weight: 800; }
.spark { height: 46px; }
.spark svg { width: 100%; height: 46px; display: block; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; font-size: 14px; }

/* ---------- modal ---------- */
dialog.modal { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
dialog.modal::backdrop { background: rgba(5, 10, 20, .65); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal form { display: grid; gap: 14px; padding: 22px; }
.modal h2 { margin: 0; font-size: 19px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; }
.modal-actions .left { margin-right: auto; }
.form-error { color: var(--loss); font-size: 13.5px; font-weight: 600; min-height: 1em; }
.net-preview { font-size: 13.5px; color: var(--text-2); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ---------- live ---------- */
.acc { margin-top: 18px; }
.acc:first-child { margin-top: 0; }
.acc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.acc-head h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.acc-head .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.live-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); padding: 5px 12px; border-radius: 999px; background: var(--surface-2); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.on { color: var(--profit); background: var(--profit-soft); }
.live-dot.on::before { background: var(--profit); box-shadow: 0 0 0 4px var(--profit-soft); animation: pulse 2s ease-in-out infinite; }
.live-dot.off { color: var(--loss); background: var(--loss-soft); }
.live-dot.off::before { background: var(--loss); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(47,184,148,0); } }
.acc-stats { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr); gap: 0; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.acc-stats > div { padding: 12px 16px; border-left: 1px solid var(--line-soft); min-width: 0; }
.acc-stats > div:first-child { border-left: 0; }
.acc-stats span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.acc-stats b { font-size: 17px; font-weight: 800; }
.acc-stats b.big { font-size: 24px; letter-spacing: -.02em; }
.alert-bar { display: block; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--loss-soft); border: 1px solid rgba(232,106,115,.35); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; }
.alert-bar.big { margin-bottom: 18px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.status.bad { color: var(--loss); background: var(--loss-soft); }
.status.bad::before { background: var(--loss); }
.table.static tbody tr { cursor: default; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; font-size: 14px; color: var(--text-2); max-width: 80ch; }
.steps li::marker { color: var(--brass); font-weight: 800; }
.steps li.done::marker { color: var(--profit); }
.steps b { color: var(--text); }
.steps.small { font-size: 13.5px; gap: 8px; margin-top: 10px; }
.howto { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.howto summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--brass); }

.strip.strip-4 { grid-template-columns: repeat(4, 1fr); }
.alert-item { grid-template-columns: 110px 1fr auto; }

.tg-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); display: grid; gap: 14px; }
.tg-form h3 { margin: 0; font-size: 14.5px; }
.settings-grid form.key-form, .key-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.key-list { list-style: none; margin: 14px 0 0; padding: 0; }
.key-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.key-list small { display: block; color: var(--muted); font-size: 12.5px; }
.key-list .btn { padding: 6px 12px; font-size: 13px; }
.key-show { display: flex; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--brass); border-radius: 10px; padding: 10px 12px; }
.key-show code { flex: 1; font-size: 14px; word-break: break-all; color: var(--brass); }

/* ---------- controls (phase 2) ---------- */
.ctrl { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: rgba(14, 24, 40, .45); }
.ctrl-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctrl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.why { color: var(--text-2); font-size: 13px; }
.note { margin: 10px 0 0; font-size: 13px; color: var(--brass); }
.ctrl-table { margin-top: 10px; }
.ctrl-table td { white-space: normal; vertical-align: middle; }
.ctrl-table td.actions { white-space: nowrap; }
.ctrl-table td.actions .btn + .btn { margin-left: 6px; }
.cmd-list { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line-soft); font-size: 13px; display: grid; gap: 4px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brass); }
fieldset.rules { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px 14px; margin: 0; display: grid; gap: 14px; }
fieldset.rules legend { padding: 0 6px; font-weight: 800; font-size: 14px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chip-check input:checked + span { background: var(--surface-3); color: var(--text); border-color: var(--brass); }
.chip-check input:focus-visible + span { outline: 2px solid var(--brass); }
.btn:disabled { opacity: .45; }

/* ---------- analytics (phase 3) ---------- */
.chart .pt.win { fill: var(--profit); fill-opacity: .75; stroke: var(--surface); stroke-width: 1; }
.chart .pt.loss { fill: var(--loss); fill-opacity: .75; stroke: var(--surface); stroke-width: 1; }
.chart .pt:hover { fill-opacity: 1; stroke: var(--text); }
.chart .guide { stroke: var(--brass); stroke-dasharray: 4 4; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.lg-dot, .lg-sq, .lg-band { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.lg-dot { border-radius: 50%; } .lg-dot.win { background: var(--profit); } .lg-sq.loss { background: var(--loss); }
.lg-band { width: 18px; background: rgba(224,178,92,.4); border-radius: 3px; } .lg-band.light { background: rgba(224,178,92,.15); }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; font-size: 14px; color: var(--text-2); }
.insights b { display: block; font-size: 20px; color: var(--text); font-weight: 800; }
.mc-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.mc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
.mc-stats span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mc-stats b { font-size: 19px; font-weight: 800; }
.table.mini td { padding: 7px 4px; font-size: 13.5px; }
.small-note { font-size: 12.5px; margin: 10px 0 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--profit); } .dot.watch { background: var(--brass); } .dot.bad { background: var(--loss); } .dot.few { background: var(--muted); }
.bt-table td { white-space: nowrap; }
.corr { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.corr th { font-weight: 600; color: var(--text-2); text-align: left; padding: 4px 8px; white-space: nowrap; font-size: 12.5px; }
.corr thead th { text-align: center; }
.corr td { text-align: center; padding: 8px 6px; border-radius: 6px; min-width: 52px; color: var(--text); font-weight: 700; }
.corr td.corr-self { background: var(--surface-2); color: var(--muted); }

.hbar.wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; }
.hbar.wide .lbl { white-space: normal; }
.hbar.wide .lbl small { white-space: normal; }

/* ---------- settings ---------- */
.settings-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid form { display: grid; gap: 14px; }
code.k { background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; overflow-x: auto; color: var(--text-2); margin: 0; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: radial-gradient(90% 80% at 20% 10%, #1D3156 0%, var(--bg) 70%); border-right: 1px solid var(--line-soft); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .brand { padding: 0; }
.login-art svg.bg { position: absolute; inset: auto -10% 8% -10%; width: 120%; opacity: .9; }
.login-art p { position: relative; max-width: 30ch; font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: 0; }
.login-art p span { display: block; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text-2); margin-top: 12px; line-height: 1.5; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-box form { width: min(360px, 100%); display: grid; gap: 16px; }
.login-box h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login-box .hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .acc-stats { grid-template-columns: repeat(3, 1fr); }
  .acc-stats > div:nth-child(4) { border-left: 0; }
  .acc-stats > div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .strip { grid-template-columns: repeat(3, 1fr); }
  .strip .stat:first-child { grid-column: span 3; border-bottom: 1px solid var(--line-soft); }
  .strip .stat:nth-child(2) { border-left: 0; }
  .strip .stat:nth-child(n+5) { border-top: 1px solid var(--line-soft); }
  .strip .stat:nth-child(5) { border-left: 0; }
  .g-2-1, .g-1-1, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: #101C30; }
  .side .brand, .side-foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--brass); }
  .nav a.nav-settings, .nav a.nav-sessions { display: none; }
  .main { padding: 16px 16px 96px; }
  .top h1 { font-size: 22px; }
  .rail { padding: 16px 14px; }
  .rail-row, .rail-axis { grid-template-columns: 64px 1fr; }
  .rail-row .name { font-size: 11.5px; }
  .rail-bar span { display: none; }
  .rail-ticks span.minor { display: none; }
  .hbar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .hbar .lbl { grid-column: 1 / -1; }
  .hbar .lbl small { display: inline; margin-left: 6px; }
  .ea-grid { grid-template-columns: 1fr; }
  .rail-next { text-align: left; }
  .strip { grid-template-columns: 1fr 1fr; }
  .strip .stat:first-child { grid-column: span 2; }
  .strip .stat:nth-child(n) { border-left: 0; border-top: 1px solid var(--line-soft); }
  .strip .stat:first-child { border-top: 0; }
  .strip .stat:nth-child(odd):not(:first-child) { border-left: 1px solid var(--line-soft); }
  .panel { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .news-table td.fv { display: none; }
  .acc-stats { grid-template-columns: 1fr 1fr; }
  .mc-grid { grid-template-columns: 1fr; }
  .strip.strip-4 { grid-template-columns: 1fr 1fr; }
  .strip.strip-4 .stat:first-child { grid-column: auto; }
  .strip.strip-4 .stat .v, .strip.strip-4 .stat:first-child .v { font-size: 21px; }
  .strip.strip-4 .stat:nth-child(2) { border-top: 0; border-left: 1px solid var(--line-soft); }
  .alert-item { grid-template-columns: 1fr auto; row-gap: 2px; }
  .alert-item .t { grid-column: 1 / -1; font-size: 12px; }
  .acc-stats > div { border-left: 0; border-top: 1px solid var(--line-soft); }
  .acc-stats > div:first-child { grid-column: span 2; border-top: 0; }
  .acc-stats > div:nth-child(odd):not(:first-child) { border-left: 1px solid var(--line-soft); }
  .nav a { font-size: 10.5px; padding: 6px 2px; }
  .ctrl { padding: 12px; }
  .ctrl-table thead { display: none; }
  .ctrl-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .ctrl-table td { border: 0; padding: 0; }
  .ctrl-table td:nth-child(2), .ctrl-table td.actions { grid-column: 1 / -1; text-align: left; }
  .ctrl-table td:nth-child(3) { grid-row: 1; grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
