/* Mentor — analysis desk. World: professional night terminal (see DESIGN.md). */

:root {
  --bg0: #0B0E13; --bg1: #10141B; --bg2: #161B24; --bg3: #1C2330;
  --line: #1F2734;
  --t1: #E7EBF3; --t2: #9AA4B8; --t3: #7B87A0;
  --accent: #E8A33D; --accent-h: #F2B45A; --accent-dim: rgba(232, 163, 61, .12);
  --long: #2EBD85; --short: #F6465D; --warn: #F0B45A;
  --long-dim: rgba(46, 189, 133, .14); --short-dim: rgba(246, 70, 93, .14);
  --mono: "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.22, .8, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg0); color: var(--t1);
  font: 400 13px/1.45 var(--sans);
  overflow: hidden;
  display: grid;
  grid-template-rows: 46px 1fr 30px;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 1px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
::selection { background: var(--accent-dim); }
input, select {
  background: var(--bg2); color: var(--t1); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; font: inherit;
}
input::placeholder { color: var(--t3); }
input:hover, select:hover { border-color: #2A3342; }
input:focus, select:focus { border-color: var(--accent); outline: none; }
* { scrollbar-width: thin; scrollbar-color: #2A3342 transparent; }

.label, .rail-sec h2, .mentor-sec-head h3 {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--t3);
}
.empty { color: var(--t3); font-size: 12px; padding: 14px 12px; line-height: 1.5; }
.empty b { color: var(--t2); font-weight: 600; }
.count { font-size: 11px; color: var(--t3); }

/* ————— top bar ————— */
#topbar {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  background: var(--bg1); border-bottom: 1px solid var(--line);
  padding: 0 12px;
}
.brand { display: flex; align-items: baseline; gap: 7px; padding-right: 4px; user-select: none; }
.brand svg { align-self: center; }
.brand span { font-weight: 700; letter-spacing: .12em; font-size: 13px; }
.brand em { font-style: normal; font-size: 11px; color: var(--t3); letter-spacing: .02em; }

.symbench { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sym-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.sym-btn:hover { border-color: var(--accent); background: var(--bg3); }
.sym-btn svg { color: var(--t3); }
.price { font-size: 15px; font-weight: 600; min-width: 90px; }
.price.up { color: var(--long); } .price.down { color: var(--short); }
.chg { font-size: 12px; color: var(--t2); }
.chg.up { color: var(--long); } .chg.down { color: var(--short); }

#tfs { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
#tfs button { padding: 3px 10px; border-radius: 4px; font-size: 12px; color: var(--t2); transition: all .15s var(--ease); }
#tfs button:hover { color: var(--t1); }
#tfs button.on { background: var(--bg3); color: var(--accent); font-weight: 600; }

.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.scan-chip { font-size: 11px; color: var(--t3); padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; }
.scan-chip.busy { color: var(--accent); border-color: rgba(232, 163, 61, .4); }
.conn { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--t3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--t3); }
.conn.live .dot { background: var(--long); }
.conn.live #connLabel { color: var(--t2); }
.dot.warn { background: var(--warn); }
.icon-btn { color: var(--t2); padding: 6px; border-radius: 6px; display: grid; place-items: center; transition: all .15s var(--ease); }
.icon-btn:hover { color: var(--t1); background: var(--bg2); }

.sym-picker {
  position: absolute; top: 44px; left: 150px; width: 300px; z-index: 60;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 8px;
}
.sym-picker input { width: 100%; margin-bottom: 6px; }
#symList { max-height: 320px; overflow-y: auto; }
#symList .sym-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 6px 8px; border-radius: 6px; font-size: 12.5px;
}
#symList .sym-row:hover, #symList .sym-row.hl { background: var(--bg3); }
#symList .sym-row b { font-weight: 600; }
#symList .sym-row .mono { color: var(--t2); font-size: 11.5px; }

/* ————— layout ————— */
#grid {
  display: grid; grid-template-columns: 288px 1fr 340px; min-height: 0;
}
#grid > * { min-width: 0; }
#rail, #side { background: var(--bg1); min-height: 0; display: flex; flex-direction: column; }
#rail { border-right: 1px solid var(--line); overflow-y: auto; }
#side { border-left: 1px solid var(--line); }
#center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ————— rail ————— */
.rail-sec { border-bottom: 1px solid var(--line); }
.rail-sec > header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 6px;
}
.mini-btn {
  font-size: 11px; font-weight: 600; color: var(--accent);
  padding: 3px 8px; border: 1px solid rgba(232, 163, 61, .35); border-radius: 6px;
  transition: all .15s var(--ease);
}
.mini-btn:hover { background: var(--accent-dim); }
.mini-btn:disabled { color: var(--t3); border-color: var(--line); cursor: default; }
.rail-list { padding: 2px 8px 10px; }

.opp {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  padding: 8px 9px; border-radius: 8px; border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.opp:hover { background: var(--bg2); }
.opp.sel { background: var(--bg2); border-color: rgba(232, 163, 61, .45); }
.opp .r1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.opp .sym { font-weight: 700; font-size: 13px; }
.opp .score { text-align: right; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); }
.opp .r2 { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--t3); font-size: 11px; }
.opp .meter { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--bg3); overflow: hidden; margin-top: 3px; }
.opp .meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  padding: 1.5px 6px; border-radius: 5px;
}
.chip.long { background: var(--long-dim); color: var(--long); }
.chip.short { background: var(--short-dim); color: var(--short); }
.chip.ready, .chip.in_zone { background: var(--accent-dim); color: var(--accent); }
.chip.forming { background: var(--bg3); color: var(--t3); }
.chip.invalidated, .chip.faded { background: var(--short-dim); color: var(--short); }
.chip.ran_without_us { background: var(--bg3); color: var(--t3); }
.chip.pending { background: var(--accent-dim); color: var(--accent); }

.wrow, .trow {
  display: grid; gap: 2px 8px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: 8px; border: 1px solid transparent;
  transition: background .15s var(--ease);
}
.wrow { grid-template-columns: 1fr auto auto; align-items: center; }
.wrow:hover, .trow:hover { background: var(--bg2); }
.wrow.sel, .trow.sel { background: var(--bg2); border-color: rgba(232, 163, 61, .45); }
.wrow .sym, .trow .sym { font-weight: 700; }
.wrow .px { color: var(--t2); font-size: 12px; }
.wrow .x, .trow .x { color: var(--t3); font-size: 12px; padding: 2px 5px; border-radius: 4px; }
.wrow .x:hover, .trow .x:hover { color: var(--short); background: var(--short-dim); }
.wrow .sub { grid-column: 1 / -1; color: var(--t3); font-size: 11px; display: flex; gap: 6px; align-items: center; }

.trow { grid-template-columns: 1fr auto auto; align-items: center; }
.trow .pnl { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.pnl.up { color: var(--long); } .pnl.down { color: var(--short); }
.trow .sub { grid-column: 1 / -1; color: var(--t3); font-size: 11px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trow .act { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 3px; }
.tag-btn {
  font-size: 10.5px; font-weight: 600; color: var(--t2);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px;
  transition: all .15s var(--ease);
}
.tag-btn:hover { color: var(--t1); border-color: #2A3342; background: var(--bg3); }
.tag-btn.warn:hover { color: var(--short); border-color: rgba(246, 70, 93, .4); background: var(--short-dim); }

/* ————— view switcher ————— */
#views { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
#views button { padding: 3px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--t2); transition: all .15s var(--ease); }
#views button:hover { color: var(--t1); }
#views button.on { background: var(--bg3); color: var(--accent); }

/* ————— performance view ————— */
#deskView { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#perfView { flex: 1; min-height: 0; overflow: hidden; }
.perf-scroll { height: 100%; overflow-y: auto; padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 16px; max-width: 1080px; }
.perf-sec h3, .ap-card h3 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--t3); }
.perf-sec > h3 { margin-bottom: 8px; }

.ap-card { background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-title { display: flex; align-items: center; gap: 10px; }
.ap-title span:not(.ap-dot) { font-size: 11.5px; color: var(--t3); }
.ap-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t3); flex: none; }
.ap-dot.on { background: var(--long); }
.ap-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.ap-stats .lvl { display: flex; flex-direction: column; gap: 2px; }
.ap-stats .lvl span { font-size: 10.5px; color: var(--t3); letter-spacing: .05em; text-transform: uppercase; }
.ap-stats .lvl b { font-size: 16px; font-weight: 700; }
.ap-stats .lvl b.up { color: var(--long); } .ap-stats .lvl b.down { color: var(--short); }
.ap-cfg { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.ap-cfg label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: var(--t3); letter-spacing: .04em; text-transform: uppercase; }
.ap-cfg input { width: 86px; font-family: var(--mono); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.kpi { background: var(--bg1); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 10.5px; color: var(--t3); letter-spacing: .05em; text-transform: uppercase; }
.kpi b { font-family: var(--mono); font-size: 16px; font-weight: 700; }
.kpi b.up { color: var(--long); } .kpi b.down { color: var(--short); } .kpi b.accent { color: var(--accent); }
.kpi i { font-style: normal; font-size: 10.5px; color: var(--t3); }

#eqChart { height: 220px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg1); }

.oc-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); }
.oc-bar i { display: block; height: 100%; }
.oc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--t2); }
.oc-legend .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

#histWrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg1); }
.htable { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 760px; }
.htable th {
  text-align: left; padding: 8px 10px; font-size: 10.5px; color: var(--t3);
  letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg1);
}
.htable td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--t2); }
.htable tr.hrow { cursor: pointer; transition: background .12s var(--ease); }
.htable tr.hrow:hover td { background: var(--bg2); }
.htable .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.htable .r.up { color: var(--long); font-weight: 600; } .htable .r.down { color: var(--short); font-weight: 600; }
.hdetail td { background: var(--bg2); padding: 12px 14px; }
.hd-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 18px; font-size: 12px; }
.hd-grid h4 { font-size: 10.5px; color: var(--t3); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.hd-grid ul { list-style: none; }
.hd-grid li { padding: 2px 0; color: var(--t2); }
.hd-grid .pts { color: var(--accent); font-family: var(--mono); font-size: 11px; margin-right: 6px; }
.hd-events { max-height: 180px; overflow-y: auto; }
.hd-events li { display: flex; gap: 8px; }
.hd-events .ts { color: var(--t3); font-family: var(--mono); font-size: 10.5px; flex: none; padding-top: 1px; }
.chip.ai { background: var(--accent-dim); color: var(--accent); }
@media (max-width: 900px) { .hd-grid { grid-template-columns: 1fr; } }

/* ————— center / chart ————— */
#chartHead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--bg1);
}
.ohlc { font-size: 11.5px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ohlc b { color: var(--t1); font-weight: 600; }
.countdown { font-size: 11px; color: var(--t3); white-space: nowrap; margin-left: auto; }
.disclaimer #utcClock { color: var(--t2); }
.ovl-toggles { display: flex; gap: 2px; }
.ovl-toggles button {
  font-size: 11px; color: var(--t3); padding: 3px 9px; border-radius: 5px;
  transition: all .15s var(--ease);
}
.ovl-toggles button:hover { color: var(--t2); background: var(--bg2); }
.ovl-toggles button.on { color: var(--t1); background: var(--bg2); box-shadow: inset 0 -2px 0 var(--accent); }
#chart { flex: 1; min-height: 0; position: relative; }
#chart.loading::after {
  content: "loading market data…"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--t3); font-size: 12px; background: var(--bg0); z-index: 5;
}

/* setup bar under the chart */
.setup-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--line); background: var(--bg1);
  padding: 8px 12px;
  animation: rise .22s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.setup-bar .lvl { display: flex; flex-direction: column; gap: 1px; }
.setup-bar .lvl span { font-size: 10.5px; color: var(--t3); letter-spacing: .05em; text-transform: uppercase; }
.setup-bar .lvl b { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.setup-bar .lvl b.entry { color: var(--accent); }
.setup-bar .lvl b.sl { color: var(--short); }
.setup-bar .lvl b.tp { color: var(--long); }
.setup-bar .score-b { display: flex; align-items: center; gap: 8px; }
.setup-bar .actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  padding: 6px 13px; border-radius: 6px; font-weight: 600; font-size: 12.5px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--t1);
  transition: all .15s var(--ease);
}
.btn:hover { background: var(--bg3); border-color: #2A3342; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #14100A; }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-long { background: var(--long); border-color: var(--long); color: #06120D; }
.btn-long:hover { filter: brightness(1.1); }
.btn-short { background: var(--short); border-color: var(--short); color: #1A0609; }
.btn-short:hover { filter: brightness(1.08); }
.btn-sm { padding: 4px 10px; font-size: 11.5px; }

/* ————— side panel ————— */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; padding: 9px 0; font-size: 12px; font-weight: 600; color: var(--t3);
  border-bottom: 2px solid transparent; transition: color .15s var(--ease);
  position: relative;
}
.tabs button:hover { color: var(--t2); }
.tabs button.on { color: var(--t1); border-bottom-color: var(--accent); }
.ndot { position: absolute; top: 8px; margin-left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.tab-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }

/* analysis tab */
.an-sec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.an-sec h3 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--t3); margin-bottom: 8px; }
.trend-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tchip { display: flex; flex-direction: column; gap: 1px; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; min-width: 72px; }
.tchip span { font-size: 10px; color: var(--t3); letter-spacing: .05em; text-transform: uppercase; }
.tchip b { font-size: 12.5px; font-weight: 600; }
.tchip b.up { color: var(--long); } .tchip b.down { color: var(--short); } .tchip b.range { color: var(--t2); }

.setup-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.setup-card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.setup-card .head .mono { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--accent); }
.meter { height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 9px 0 4px; font-size: 12px; }
.kv span { color: var(--t3); }
.kv b { font-family: var(--mono); font-weight: 600; text-align: right; }
.reasons { list-style: none; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.reasons li { display: flex; gap: 8px; align-items: baseline; padding: 2.5px 0; font-size: 12px; color: var(--t2); }
.reasons .pts { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 26px; font-weight: 600; }
.reasons .f { color: var(--t1); font-weight: 600; margin-right: 2px; }

.wave-box { font-size: 12.5px; color: var(--t2); line-height: 1.55; }
.wave-box .pos { color: var(--t1); font-weight: 600; }
.wave-box .alt { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; color: var(--t3); }
.confrow { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.confrow .meter { flex: 1; }
.confrow .mono { font-size: 11px; color: var(--t2); }

.evt-list, .lvl-list { list-style: none; font-size: 12px; }
.evt-list li { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--t2); }
.evt-list .mono { margin-left: auto; color: var(--t2); }
.evt-list .et { font-weight: 700; font-size: 10.5px; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; }
.et.up { background: var(--long-dim); color: var(--long); }
.et.down { background: var(--short-dim); color: var(--short); }
.lvl-list li { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--t2); }
.lvl-list .mono { margin-left: auto; }

/* mentor tab */
.ai-gate { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ai-gate p { font-size: 12.5px; color: var(--t2); line-height: 1.55; }
.linklike { color: var(--accent); font-weight: 600; padding: 0; }
.linklike:hover { text-decoration: underline; }
.mentor-sec { border-bottom: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; min-height: 0; }
.mentor-sec.grow { flex: 1; border-bottom: 0; }
.mentor-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.prose { font-size: 12.5px; color: var(--t2); line-height: 1.6; overflow-wrap: break-word; }
.prose h1, .prose h2, .prose h3 { font-size: 12px; color: var(--t1); margin: 10px 0 4px; }
.prose p { margin: 6px 0; }
.prose strong { color: var(--t1); }
.prose ul, .prose ol { margin: 4px 0 6px 16px; }
.prose li { margin: 2px 0; }
.prose code { font-family: var(--mono); font-size: 11.5px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.prose.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
#explainBox { max-height: 320px; overflow-y: auto; }

.coach-feed { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.coach-msg {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; animation: rise .2s var(--ease);
}
.coach-msg .m-head { display: flex; gap: 7px; align-items: baseline; margin-bottom: 3px; font-size: 11px; color: var(--t3); }
.coach-msg .m-head b { color: var(--t1); font-size: 11.5px; }
.coach-msg .m-head .src { color: var(--accent); font-weight: 600; letter-spacing: .04em; }
.coach-msg .m-body { font-size: 12.5px; color: var(--t2); line-height: 1.55; }

.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; padding-bottom: 8px; }
.chat-msg { max-width: 92%; border-radius: 9px; padding: 7px 11px; font-size: 12.5px; line-height: 1.55; }
.chat-msg.user { align-self: flex-end; background: var(--bg3); color: var(--t1); }
.chat-msg.ai { align-self: flex-start; background: var(--bg2); border: 1px solid var(--line); color: var(--t2); }
#chatForm { display: flex; gap: 7px; padding-top: 4px; }
#chatForm input { flex: 1; min-width: 0; }

/* ————— footer / alerts ————— */
#footer {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg1); border-top: 1px solid var(--line); padding: 0 12px;
  font-size: 11.5px; color: var(--t3);
}
.alerts-btn { display: flex; align-items: center; gap: 8px; color: var(--t2); min-width: 0; padding: 3px 6px; border-radius: 5px; }
.alerts-btn:hover { background: var(--bg2); }
.last-alert { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.disclaimer { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alerts-panel {
  position: fixed; right: 12px; bottom: 38px; width: 380px; max-height: 50vh; z-index: 70;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column;
}
.alerts-panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; }
.alerts-panel h3 { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--t3); }
#alertsList { overflow-y: auto; padding: 0 8px 10px; }
.alert-row { display: grid; gap: 1px; padding: 7px 8px; border-radius: 7px; }
.alert-row:hover { background: var(--bg3); }
.alert-row .a-top { display: flex; gap: 8px; align-items: baseline; font-size: 11px; color: var(--t3); }
.alert-row .a-top b { color: var(--t1); font-size: 12px; }
.alert-row .a-text { font-size: 12px; color: var(--t2); line-height: 1.45; }
.alert-row.warn .a-text { color: var(--warn); }
.alert-row.action .a-text { color: var(--t1); }

/* ————— settings dialog ————— */
dialog {
  background: var(--bg1); color: var(--t1); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 0; width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(4, 6, 10, .65); }
#settingsForm { padding: 18px 20px; display: flex; flex-direction: column; gap: 13px; }
#settingsForm h2 { font-size: 15px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--t2); }
.field small { font-size: 11px; color: var(--t3); line-height: 1.45; }
.field-row { display: flex; gap: 10px; }
.keyrow { display: flex; gap: 6px; }
.keyrow input { flex: 1; }
.dlg-note { font-size: 11.5px; color: var(--t3); border-top: 1px solid var(--line); padding-top: 11px; line-height: 1.5; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ————— login ————— */
.login-wrap { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg0); }
.login-card {
  width: min(340px, 90vw); background: var(--bg1); border: 1px solid var(--line); border-radius: 12px;
  padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-sub { font-size: 12.5px; color: var(--t2); line-height: 1.5; }
.login-card input { text-align: center; font-family: var(--mono); }
.login-err { font-size: 12px; color: var(--short); line-height: 1.45; }

/* ————— responsive ————— */
@media (max-width: 1180px) {
  #grid { grid-template-columns: 250px 1fr 300px; }
}
.side-toggle {
  display: none; position: fixed; right: 12px; bottom: 40px; z-index: 45;
  background: var(--accent); color: #14100A; font-weight: 700; font-size: 12px;
  padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow-pop);
}
.side-toggle:hover { background: var(--accent-h); }

@media (max-width: 980px) {
  #grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
  .rail-sec { min-width: 260px; border-bottom: 0; border-right: 1px solid var(--line); }
  #side { position: fixed; right: 0; top: 46px; bottom: 30px; width: min(360px, 92vw); z-index: 40; transform: translateX(100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); border-left: 1px solid var(--line); }
  #side.open { transform: none; }
  .side-toggle { display: block; }
  .symbench .chg { display: none; }
  .brand em { display: none; }
  .scan-chip { display: none; }
  #topbar { gap: 10px; }
}
