/* TradingView-like dark theme */
:root {
  --bg: #0f172a;
  --panel: #182134;
  --panel-2: #222d42;
  --hover: #243049;
  --line: #263248;
  --line-2: #334155;
  --text: #cbd5e1;
  --text-hi: #f8fafc;
  --muted: #94a3b8;
  --up: #2ebd85;
  --down: #f6465d;
  --accent: #3b82f6;
  --gold: #f5b942;
  --dip: #ff9800;
  --top-h: 46px;
  --radius: 6px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 11px; font-weight: 400; }
.fine { color: var(--muted); font-size: 11.5px; margin: 10px 0 0; line-height: 1.5; }
.msg { color: var(--dip); min-height: 1.2em; }
.num, .tbl td, .wl td { font-variant-numeric: tabular-nums; }
.up, .pos { color: var(--up); } .down, .neg { color: var(--down); }

/* ---------- top bar ---------- */
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 18px; padding: 0 12px;
  background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text-hi); white-space: nowrap; }
.tag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 7px 12px; border-radius: var(--radius); color: var(--muted); white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--text); background: var(--hover); }
.tabs button.active { color: var(--text-hi); background: var(--panel-2); }
.user { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.user img { width: 26px; height: 26px; border-radius: 50%; }
.user .name { font-size: 12px; }

/* ---------- common ---------- */
#app { height: calc(100vh - var(--top-h)); }
.view { height: 100%; }
.view.center { display: grid; place-items: center; }
.view.page { overflow-y: auto; padding: 12px; }
.login-card { width: min(440px, 92vw); text-align: center; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.login-card h1 { font-size: 20px; margin: 0 0 8px; color: var(--text-hi); }
#gsiButton { display: flex; justify-content: center; margin: 20px 0 8px; min-height: 44px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-weight: 600; color: var(--text-hi); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.btn { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 12px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; gap: 2px; }
.seg button { background: none; border: 0; padding: 4px 9px; border-radius: 4px; color: var(--muted); font-weight: 500; }
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.active { background: var(--panel-2); color: var(--text-hi); box-shadow: inset 0 -2px 0 var(--accent); }
.seg.icons button { min-width: 30px; font-size: 15px; line-height: 1; }
.seg.small button { padding: 2px 8px; font-size: 12px; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.toolbar.flat { border: 0; padding: 0 0 10px; background: none; }
.toolbar input[type=email] { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 8px; min-width: 240px; }
.sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 2px; }
.chk { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; user-select: none; font-size: 12px; }
.chk input { accent-color: var(--accent); margin: 0; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.book { background: var(--accent); } .sw.zone { background: linear-gradient(var(--up) 50%, var(--down) 50%); }
.sw.dip { background: var(--dip); } .sw.w { background: rgba(41, 98, 255, .45); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap.scroll { overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 11.5px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl.compact td, .tbl.compact th { padding: 4px 6px; font-size: 12px; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--hover); }
.tbl tr.sel td { background: rgba(41, 98, 255, .16); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; }
.badge.long { background: rgba(8, 153, 129, .18); color: var(--up); }
.badge.short { background: rgba(242, 54, 69, .18); color: var(--down); }
.badge.flat { background: var(--panel-2); color: var(--muted); }
.badge.dip { background: rgba(255, 152, 0, .16); color: var(--dip); }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); }
.pill.done { color: var(--up); } .pill.failed { color: var(--down); } .pill.running { color: var(--dip); }
.jobmsg { max-width: 560px; overflow: hidden; text-overflow: ellipsis; text-align: left !important; color: var(--muted); }

/* ---------- live view ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.tv-wrap { min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.tv { width: 100%; height: 100%; }
.side { overflow-y: auto; padding: 10px; background: var(--bg); }
.wl { width: 100%; border-collapse: collapse; }
.wl td { padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wl td:nth-child(n+2) { text-align: right; }
.wl tr:hover td { background: var(--hover); }
.wl tr.sel td { background: rgba(41, 98, 255, .16); }
.wl .sym { font-weight: 600; color: var(--text-hi); }
.wl .px { font-family: var(--mono); }
.flash-up { animation: fu .6s; } .flash-down { animation: fd .6s; }
@keyframes fu { from { color: #fff; background: rgba(8, 153, 129, .35); } }
@keyframes fd { from { color: #fff; background: rgba(242, 54, 69, .35); } }
.sig-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sig-head .title { font-size: 16px; font-weight: 700; color: var(--text-hi); }
.sig-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: baseline; }
.sig-grid .k { color: var(--muted); font-size: 12px; }
.sig-grid .v { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--text-hi); }
.sig-grid .d { text-align: right; font-size: 11.5px; min-width: 58px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.meta b { color: var(--text); font-weight: 500; }
.conf { margin-top: 10px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.conf .tbl { margin: 4px 0; }
#dipNote { margin-top: 6px; }
.bar-rr { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin: 10px 0 2px; }
.bar-rr .sl { background: var(--down); } .bar-rr .tp { background: var(--up); }

/* ---------- history view ---------- */
.history { display: flex; flex-direction: column; }
.chart-area { position: relative; flex: 1; min-height: 200px; }
.chart { position: absolute; inset: 0; }
.legend-box { position: absolute; top: 6px; left: 10px; z-index: 3; pointer-events: none; font-size: 12px; line-height: 1.6;
  text-shadow: 0 0 3px var(--bg); }
.legend-box .l1 { color: var(--text-hi); font-weight: 600; }
.legend-box .ohlc { font-family: var(--mono); color: var(--muted); }
.legend-box .ohlc b { font-weight: 500; }
.loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--panel); padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); z-index: 4; }
.resizer { height: 5px; cursor: row-resize; background: var(--line); }
.resizer:hover { background: var(--accent); }
.bottom { height: 290px; display: flex; flex-direction: column; background: var(--panel); min-height: 80px; }
.bottom-h { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bottom .table-wrap { flex: 1; min-height: 0; }
.ostats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-left: auto; }
.ostats b { color: var(--text-hi); font-weight: 600; }
.orders td:nth-child(2), .orders th:nth-child(2), .orders td:nth-child(3), .orders th:nth-child(3) { text-align: left; }

/* ---------- performance ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpis .kpi-note { grid-column: 1 / -1; margin: 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.kpi .k { color: var(--muted); font-size: 11.5px; }
.kpi .v { font-size: 20px; font-weight: 700; margin-top: 2px; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 11px; }
.panel.big { position: relative; }
.chart.eq, .chart.fw { position: relative; inset: auto; height: 380px; }
.chart.fw { height: 260px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line-2);
  padding: 9px 16px; border-radius: var(--radius); z-index: 50; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }

@media (max-width: 1000px) {
  .live { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62vh auto; height: auto; overflow-y: auto; }
  .tv-wrap { border-right: 0; border-bottom: 1px solid var(--line); }
  #view-live { height: auto; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  :root { --top-h: 84px; }
  .topbar { gap: 8px; flex-wrap: wrap; height: var(--top-h); padding: 6px 10px; align-content: space-between; }
  .tabs { order: 3; flex-basis: 100%; }
  .toolbar { gap: 6px; padding: 5px 6px; }
  .seg button { padding: 3px 7px; }
  .sep { display: none; }
  .user .name { display: none; }
  .brand .tag { display: none; }
  .bottom { height: 240px; }
  .ostats { margin-left: 0; }
}

/* trade plan card */
.plan { border-color: var(--accent); }
.plan .act { font-size: 15px; font-weight: 700; padding: 6px 10px; border-radius: var(--radius); margin-bottom: 8px; }
.plan .act.long { background: rgba(8, 153, 129, .16); color: var(--up); }
.plan .act.short { background: rgba(242, 54, 69, .16); color: var(--down); }
.plan .act.flat { background: var(--panel-2); color: var(--muted); }
.plan .subact { margin-top: 8px; padding: 6px 8px; border-left: 3px solid var(--dip); background: var(--bg); font-size: 12.5px; }
.plan .timeline { margin-top: 10px; font-size: 12px; line-height: 1.7; border-top: 1px solid var(--line); padding-top: 6px; }

/* trade-plan pipeline switch (D2 deployed / T3 comparison) */
.pipe-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 8px; }
.pipe-switch { display: inline-flex; gap: 4px; }
.pipe-switch .chip { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border, #2a2e39);
  background: transparent; color: var(--muted, #9aa0aa); cursor: pointer; }
.pipe-switch .chip.on { background: var(--accent, #2962ff); border-color: var(--accent, #2962ff); color: #fff; }

/* ---------- live page v2: pipeline bar + action board + chart/detail ---------- */
.live2 { display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow-y: auto; }
.live2 .panel { margin-bottom: 0; }
.pipebar { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.pipebtn { flex: 1 1 170px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  color: var(--text); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pipebtn:hover { border-color: var(--line-2); background: var(--hover); }
.pipebtn.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: rgba(41, 98, 255, .10); }
.pipebtn .nm { font-weight: 700; color: var(--text-hi); font-size: 14px; display: flex; gap: 6px; align-items: center; }
.pipebtn .ds { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipebtn .pn { font-family: var(--mono); font-size: 12px; }
.star { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: rgba(8, 153, 129, .18); color: var(--up); }
.board { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.board th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board th:first-child, .board td:first-child, .board th:nth-child(4), .board td:nth-child(4) { text-align: left; }
.board td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; cursor: pointer;
  font-variant-numeric: tabular-nums; }
.board td.px, .board td.m { font-family: var(--mono); }
.board tr:hover td { background: var(--hover); }
.board tr.sel td { background: rgba(41, 98, 255, .14); }
.board .sym { font-weight: 700; color: var(--text-hi); font-size: 14px; }
.act-badge { display: inline-block; font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 5px; letter-spacing: .2px; }
.act-badge.long { background: rgba(8, 153, 129, .18); color: var(--up); }
.act-badge.short { background: rgba(242, 54, 69, .16); color: var(--down); }
.act-badge.wait-long { background: transparent; color: var(--up); border: 1px dashed var(--up); }
.act-badge.wait-short { background: transparent; color: var(--down); border: 1px dashed var(--down); }
.act-badge.flat { background: var(--panel-2); color: var(--muted); }
.board .note { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }
.live-main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 10px; height: 64vh; min-height: 520px; }
.live-main .tv-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.live-main .side { padding: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--text-hi); list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: "▸ "; color: var(--muted); }
details.adv[open] summary::before { content: "▾ "; }
details.adv[open] summary { margin-bottom: 8px; }
.panel-h.sub { margin-top: 12px; }
@media (max-width: 1000px) {
  .live-main { grid-template-columns: minmax(0, 1fr); height: auto; }
  .live-main .tv-wrap { height: 58vh; }
}
@media (max-width: 700px) {
  .live2 { padding: 8px; }
  .board th:nth-child(3), .board td:nth-child(3), .board th:nth-child(9), .board td:nth-child(9) { display: none; }
  .board td { padding: 8px 5px; font-size: 12.5px; }
  .pipebtn { flex: 1 1 45%; }
}

ol.steps { margin: 8px 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; line-height: 1.5; }
ol.steps li::marker { color: var(--accent); font-weight: 700; }
.warn { color: var(--dip); font-weight: 600; }
.eq-in { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; }
.eq-in input { width: 90px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 6px; color: var(--text-hi); }

/* ---------- to-do tab ---------- */
.todo { display: flex; flex-direction: column; gap: 10px; }
.todo .panel { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.card .card-coin { font-size: 16px; font-weight: 700; color: var(--text-hi); }
.card .px { font-family: var(--mono); color: var(--text-hi); }
.card { scroll-margin-top: 60px; }
.wl td .act-badge { font-size: 11px; padding: 2px 7px; }

/* ---------- round 3: pipeline status, market intervals, history legend ---------- */
.pipe-status { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.pipe-status b { color: var(--text-hi); font-weight: 600; }
.pipe-status .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--up); margin-right: 6px; }
.pipe-status .dot.bad { background: var(--down); }
.live .tv-wrap { display: flex; flex-direction: column; }
.tv-iv { padding: 6px 8px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.live .tv-wrap .tv { flex: 1 1 auto; min-height: 0; }
.hist-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 12px; font-size: 11.5px; color: var(--text);
  border-bottom: 1px solid var(--line); }
.hist-legend i.lg { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.hist-legend i.lg.tp { background: rgba(8,153,129,.45); } .hist-legend i.lg.sl { background: rgba(242,54,69,.45); }
.plan-line { font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 4px 0 6px; }
.plan-line .k { color: var(--muted); font-weight: 500; font-size: 12px; }
.plan-line .v { font-family: var(--mono); }

/* market side: Entry / TP / SL block */
.plan-box { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--panel-2); }
.plan-box.long { border-left: 3px solid var(--up); } .plan-box.short { border-left: 3px solid var(--down); }
.pb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.pb-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); }
.pb-row .k { color: var(--muted); font-size: 12px; }
.pb-row .v { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text-hi); }
.pb-row .d { font-size: 12px; color: var(--muted); text-align: right; }
.pb-row.tp .v, .pb-row.tp .d { color: var(--up); }
.pb-row.sl .v, .pb-row.sl .d { color: var(--down); }

/* ---------- round 5: pipeline cards ---------- */
.todo { gap: 12px; }
.todo-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.todo-top .eq-in { font-size: 12.5px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; }
.card-h .card-coin { font-size: 18px; font-weight: 700; color: var(--text-hi); }
.card-px { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.card-px .px { font-family: var(--mono); font-size: 15px; color: var(--text-hi); }
details.steps-d summary { cursor: pointer; color: var(--accent); font-size: 12.5px; list-style: none; }
details.steps-d summary::-webkit-details-marker { display: none; }
details.steps-d summary::before { content: "▸ "; }
details.steps-d[open] summary::before { content: "▾ "; }
details.steps-d .act { display: none; }
details.steps-d ol.steps { font-size: 12.5px; }
.pipebtn .pn { font-size: 12.5px; }
@media (max-width: 700px) { .cards { grid-template-columns: 1fr; } .todo-top { flex-direction: column; align-items: flex-start; } }

/* ---------- round 6 ---------- */
.card .card-px { font-family: var(--mono); font-weight: 500; color: var(--text); margin-left: 6px; font-size: 12.5px; }
.card .panel-h { flex-wrap: wrap; row-gap: 2px; }
details.adv { overflow: hidden; }
details.adv summary .sub-line { display: block; margin: 2px 0 0 14px; font-weight: 400; }
.tbl-scroll { overflow-x: auto; max-width: 100%; }
.tbl-scroll .tbl.compact td, .tbl-scroll .tbl.compact th { white-space: nowrap; }
.live .side { overflow-x: hidden; }

.cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card .card-price { white-space: nowrap; }
.card .card-px { font-size: 14px; margin-left: 0; color: var(--text-hi); }

.lot-warn { font-size: 12px; color: var(--dip); background: rgba(255,152,0,.08); border: 1px solid rgba(255,152,0,.35); border-radius: 6px; padding: 6px 8px; }

/* pipeline evidence table (Pipeline tab) */
.evid-panel { margin-top: 10px; }
.evid-panel .evid td, .evid-panel .evid th { text-align: center; white-space: nowrap; }
.evid-panel .evid td:first-child, .evid-panel .evid th:first-child { text-align: left; }
.evid-panel .evid tr[data-pipe] { cursor: pointer; }
.evid-panel .evid tr.on td { background: rgba(41, 98, 255, .10); }
.evid-panel .evid .star { color: #f5c542; }
.evid-note { padding: 6px 12px 10px; line-height: 1.5; }

/* pipeline selector = training-results table */
.evid-panel { margin-top: 12px; }
.evid-panel .evid { width: 100%; table-layout: fixed; }
.evid-panel .evid th:first-child { width: 30%; }
.evid-panel .evid th:last-child { width: 13%; }
.evid-panel .evid th { font-weight: 600; color: var(--muted); font-size: 12px; }
.evid-panel .evid td { padding-top: 5px; padding-bottom: 5px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.evid-panel .evid tr[data-pipe]:hover td { background: var(--hover); }
.evid-panel .evid .pcell { display: flex; align-items: center; gap: 10px; }
.evid-panel .evid th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.evid-panel .evid .radio { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); flex: 0 0 auto; }
.evid-panel .evid tr.on .radio { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 2px rgba(41, 98, 255, .25); }
.evid-panel .evid .pn-name { color: var(--text-hi); font-size: 14px; }
.evid-panel .evid .pn-desc { color: var(--muted); font-size: 11px; margin-top: 1px; white-space: normal; line-height: 1.3; }
.evid-panel .evid .star { color: #f5c542; font-size: 11px; font-weight: 600; margin-left: 4px; }
.evid-panel .evid tr.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.evid-panel .panel-h { gap: 12px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .evid-panel .evid { table-layout: auto; min-width: 560px; }
  .evid-panel .evid th:first-child, .evid-panel .evid th:last-child { width: auto; }
  .evid-panel .evid .pcell { gap: 6px; }
  .evid-panel .evid .pn-desc, .evid-panel .evid .star { display: none; }
  .evid-panel .evid td, .evid-panel .evid th { padding-left: 6px; padding-right: 6px; font-size: 12px; }
  .evid-panel .evid td:first-child, .evid-panel .evid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
  .evid-panel .evid tr.on td:first-child { background: #1b2540; }
}
.board-panel .panel-h { flex-wrap: wrap; row-gap: 2px; }
.board-panel .panel-h > span:first-child { white-space: nowrap; }
@media (max-width: 720px) { .board-panel .panel-h #boardMeta { order: 3; flex-basis: 100%; font-weight: 400; } }
/* dip ladder of the bar in progress (plan cards) */
.dip-d { margin-top: 8px; }
.dip-d summary { cursor: pointer; font-weight: 600; font-size: 12.5px; }
.dip-tbl td, .dip-tbl th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dip-tbl .note { display: block; font-size: 10.5px; color: var(--muted); }
.dip-tbl tr.dip-filled td { background: rgba(38, 217, 176, .08); }

/* ---- responsive layout for every screen size (2026-09-30) ----
   laptop (1280-1600): full width as before; large desktop / 2K / 4K: the page content is capped and centred so tables and cards keep
   readable proportions; the plan cards always share the row evenly (auto-fit), so the five coins never leave a lopsided gap. */
.view.page > * { width: 100%; max-width: 1680px; margin-left: auto; margin-right: auto; }
.cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
@media (min-width: 1700px) {
  .cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .live-main { grid-template-columns: minmax(0, 1fr) 460px; height: 70vh; }
}
@media (min-width: 2200px) {
  html { font-size: 15px; }
  .view.page > * { max-width: 1920px; }
  .live-main { grid-template-columns: minmax(0, 1fr) 520px; }
}
@media (max-width: 1100px) and (min-width: 701px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dip-tbl .note { white-space: normal; line-height: 1.25; }
.dip-tbl td, .dip-tbl th { padding-left: 4px; padding-right: 4px; }
/* plan cards: rows always filled (the last row's cards stretch), so five coins never leave a lone card or an empty slot */
.cards { display: flex; flex-wrap: wrap; gap: 12px; }
.cards > .card { flex: 1 1 calc(33.333% - 12px); min-width: 0; margin: 0; }
@media (min-width: 1600px) { .cards > .card { flex-basis: calc(20% - 12px); } }
@media (max-width: 1099px) { .cards > .card { flex-basis: calc(50% - 12px); } }
@media (max-width: 700px) { .cards > .card { flex-basis: 100%; } }
/* use the full width (user 2026-10-01: no side margins on 1920 px screens); only ultra-wide screens keep a cap */
.view.page > * { max-width: none; }
@media (min-width: 2200px) { .view.page > * { max-width: none; } }
@media (min-width: 2600px) { .view.page > * { max-width: 2400px; } }
.evid tr.locked { cursor: default; background: rgba(255, 193, 7, .04); }
.evid tr.locked .radio { visibility: hidden; }
.pipe-access { color: #d6b85b; font-size: 12px; margin-top: 6px; }
.pipe-access a { color: #90b8ff; text-decoration: underline; }
.evid-panel .evid th { white-space: normal; line-height: 1.35; min-width: 85px; }
.evid-panel .evid th:first-child { min-width: 220px; }
.pipeline-actions { flex-wrap: wrap; }
#pipelineSettingsTbl th:nth-child(2), #pipelineSettingsTbl td:nth-child(2) { text-align: left; }
#pipelineSettingsTbl .note { display: block; white-space: normal; color: var(--muted); font-size: 11px; margin-top: 4px; }
.btn:disabled { opacity: .4; cursor: default; }

/* Clear account access and keyboard-friendly pipeline selection. */
button, a, input, select { touch-action: manipulation; }
:is(button, a, input, select, [tabindex]):focus-visible { outline: 2px solid #90b8ff; outline-offset: 3px; }
html { scroll-padding-top: calc(var(--top-h) + 16px); }
.login-card { width: min(520px, 92vw); padding: 32px; }
.login-eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; margin-bottom: 10px; }
.login-card h1 { font-size: 27px; line-height: 1.25; }
.login-card > .muted { font-size: 14px; line-height: 1.6; }
.login-benefits { display: grid; gap: 12px; text-align: left; margin-top: 24px; padding: 18px; background: var(--bg); border-radius: 8px; }
.login-benefits b, .login-benefits span { display: block; }
.login-benefits b { color: var(--text-hi); font-size: 14px; }
.login-benefits span { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.5; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.account-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; text-decoration: none; }
.pipeline-choice { display: inline-flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--text-hi); padding: 5px 0; font-size: 14px; font-weight: 600; }
.pipeline-choice span { color: #b3ccff; font-size: 11px; font-weight: 400; }
.evid-panel .evid { table-layout: auto; min-width: 1380px; }
.evid-panel .evid th:first-child { min-width: 280px; width: 24%; }
.evid-panel .evid .pn-desc { font-size: 12px; }
#pipeSelectedNote { color: var(--text); }
.grant-choice { display: inline-flex; align-items: center; gap: 4px; margin: 4px 10px 4px 0; white-space: nowrap; }
.grant-choice input { accent-color: var(--accent); }
.fine { font-size: 12px; }
@media (max-width: 720px) {
  .login-card { padding: 24px 20px; }
  .login-card h1 { font-size: 24px; }
  .evid-panel .evid th:first-child { min-width: 170px; }
  .pipeline-choice { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ---- product split (MANUAL / BOT), goal progress, manual checklist (2026-10-03) */
.product-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.product-seg button { padding: 6px 14px; font-size: 13px; font-weight: 600; }
.goal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.goal-name { min-width: 200px; font-size: 12.5px; }
.goal-chip { display: inline-flex; gap: 5px; align-items: baseline; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel-2); white-space: nowrap; }
.goal-chip.ok { border-color: color-mix(in srgb, var(--up) 60%, transparent); }
.goal-chip.ok b { color: var(--up); }
.goal-chip.no { border-color: color-mix(in srgb, var(--down) 60%, transparent); }
.goal-chip.no b { color: var(--down); }
.goal-paper { margin: 8px 0 4px; font-size: 12.5px; }
details.archive { margin-top: 8px; }
details.archive > summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 4px 0; }
.bot-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
.btn.small { padding: 2px 8px; font-size: 11.5px; }
.checklist-panel .note.warn, .note.warn { color: var(--down); }
@media (max-width: 640px) { .goal-name { min-width: 100%; } .product-seg { width: 100%; } .product-seg button { flex: 1; } }

/* ---------- plan cards (Manual / Bot tabs): customer-facing summary, details folded below ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plans-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 14px 0 8px; }
.plans-head h2 { margin: 0; font-size: 17px; color: var(--text-hi); font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.plan-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 14px; display: flex; flex-direction: column;
  gap: 8px; cursor: pointer; transition: border-color .15s, transform .15s; }
.plan-card:hover { border-color: #4a5060; }
.plan-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card.locked { cursor: default; }
.pc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-name { font-size: 15px; font-weight: 700; color: var(--text-hi); }
.pc-badge { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px; background: rgba(41, 98, 255, .18); color: #8fb0ff; }
.pc-badge.lock { background: var(--panel-2); color: var(--muted); }
.pc-badge + .pc-badge { margin-left: 0; }
.pc-tag { color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 32px; }
.pc-key { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 0; }
.pc-key div { background: var(--panel-2); border-radius: 6px; padding: 6px 4px; text-align: center; min-width: 0; }
.pc-key dt { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.pc-key dd { margin: 1px 0 0; font-size: 19px; font-weight: 700; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.pc-key dd.up { color: var(--up); } .pc-key dd.down { color: var(--down); }
.pc-key span { color: var(--muted); font-size: 10px; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
.pc-stats div { min-width: 0; }
.pc-stats dt { color: var(--muted); font-size: 10.5px; }
.pc-stats dd { margin: 0; text-align: left; color: var(--text-hi); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-cta { margin-top: auto; justify-content: center; text-align: center; text-decoration: none; display: flex; align-items: center; }
.pc-cta.unlock { color: var(--muted); }
.plan-basis { margin: 8px 2px 4px; line-height: 1.45; }
details.more { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
details.more > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; color: var(--text-hi); list-style-position: inside; }
details.more[open] > summary { border-bottom: 1px solid var(--line); }
details.more > .cards { padding: 10px; }
details.more .goal-panel { padding: 8px 12px; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .plan-grid { grid-template-columns: 1fr 1fr; } .pc-key dd { font-size: 17px; } }
@media (max-width: 440px) { .plan-grid { grid-template-columns: 1fr; } }

/* ================= layout v2 (ui-ux-pro-max: dark financial dashboard, Swiss grid, 8px spacing; full width per user 2026-10-01) ================= */
.view.page { padding: 16px 20px 32px; }
.todo { gap: 24px; }
.ic { vertical-align: -2px; flex: 0 0 auto; }
.page-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.page-bar .pipe-status { font-size: 13px; gap: 20px; }
.page-bar .eq-in { font-size: 13px; }
.page-bar .eq-in input { width: 110px; padding: 6px 8px; font-size: 14px; }
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-hi); }
.sec-head p { margin: 0; font-size: 13px; }
.live-dot { margin-left: auto; font-size: 12px; color: var(--muted); }
.plan-basis { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; max-width: 1100px; }
.fine { font-size: 12px; }

/* pipeline cards: as many equal columns as cards (5 MANUAL, 3 BOT), equal heights, CTA pinned to the bottom */
/* rows always filled: k cards per row, the last row's cards stretch (5 cards never leave a lone card next to an empty slot) */
.plan-grid, .coin-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.plan-grid { --k: var(--n, 5); } .coin-grid { --k: 5; }
.plan-grid > *, .coin-grid > * { flex: 1 1 calc((100% - (var(--k) - 1) * 16px) / var(--k)); min-width: 0; }
.plan-card { padding: 16px; gap: 12px; border-radius: 12px; border-color: var(--line-2); transition: border-color .2s, box-shadow .2s; }
.plan-card:focus-within { border-color: var(--accent); }
.pc-top { flex-wrap: nowrap; gap: 8px; min-height: 22px; }
.pc-name { font-size: 18px; }
.pc-badges { margin-left: auto; display: flex; gap: 4px; flex-wrap: nowrap; }
.pc-badge { margin-left: 0; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-size: 11px; padding: 2px 8px; }
.pc-badge.rec { background: rgba(245, 185, 66, .14); color: var(--gold); }
.pc-tag { margin: 0; font-size: 13px; line-height: 1.45; min-height: calc(2 * 1.45em); display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.pc-key { gap: 8px; }
.pc-key div { padding: 8px 4px; border-radius: 8px; }
.pc-key dt { font-size: 11px; }
.pc-key dd { font-size: 20px; }
.pc-key span { font-size: 11px; }
.pc-stats dt { font-size: 11px; }
.pc-stats dd { font-size: 13px; }
.pc-cta { min-height: 40px; gap: 6px; font-weight: 600; }
.pc-cta.unlock { color: var(--text); }

/* coin cards: one per coin, the orders to place + the open position */
.coin-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; display: flex; flex-direction: column; min-width: 0;
  scroll-margin-top: 60px; }
.coin-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.coin-name { font-size: 16px; font-weight: 700; color: var(--text-hi); }
.coin-px { font-family: var(--mono); font-size: 13px; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.coin-badge { margin-left: auto; }
.coin-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.coin-idle { margin: 0; color: var(--muted); font-size: 13px; }
.badge.dip { background: rgba(255, 152, 0, .16); color: var(--dip); }
.ord-h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ord, .pos { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: rgba(15, 23, 42, .45); }
.pos.long { border-left: 3px solid var(--up); } .pos.short { border-left: 3px solid var(--down); }
.pos-h { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); }
.ord-top { display: flex; align-items: center; gap: 6px; }
.ord-kind { font-weight: 600; color: var(--text-hi); font-size: 13px; }
.ord-top .copy-btn { margin-left: auto; min-height: 28px; }
dl.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
dl.kv dt { font-size: 11px; color: var(--muted); }
dl.kv dd { margin: 0; text-align: left; font-family: var(--mono); font-size: 13px; color: var(--text-hi); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
dl.kv dd.up { color: var(--up); } dl.kv dd.down { color: var(--down); }
.ord-foot { font-size: 11.5px; color: var(--muted); }
.ord-foot.warn { color: var(--dip); }
.coin-card .steps-d { border-top: 1px solid var(--line); padding: 8px 14px; margin: auto 0 0; }
.coin-card .steps-d summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.note-bar { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 14px; border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 8px; background: var(--panel); font-size: 13px; color: var(--muted); }
.note-bar b { color: var(--text-hi); width: 100%; }
details.more { border-radius: 10px; }
details.more > summary { padding: 12px 16px; }
.btn { transition: border-color .2s, background-color .2s; }
.btn:focus-visible, .plan-card:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 1200px) { .plan-grid, .coin-grid { --k: 3; } }
@media (max-width: 900px) { .plan-grid, .coin-grid { --k: 2; } }
@media (max-width: 600px) {
  .view.page { padding: 12px 16px 24px; }
  .plan-grid, .coin-grid { --k: 1; }
  .page-bar { flex-direction: column; align-items: flex-start; }
  .live-dot { margin-left: 0; }
}

/* multi-phase plans (R2·4P): the sub-book ("khung +Nh") of each position / order / dip rung */
.tag.phase-tag { margin: 0 4px; color: var(--accent); background: rgba(59, 130, 246, .14); white-space: nowrap; }
.ph-line + .ph-line { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.phase-h { margin: 10px 0 2px; }
.coin-grid > .note-bar { flex-basis: 100%; }

/* plan freshness banner (ops_festale 2026-10-06): stale plan / unreachable API warning */
.fresh-banner { width: 100%; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text); }
.fresh-banner.warn { border-color: rgba(245, 185, 66, .55); background: rgba(245, 185, 66, .10); color: #f5c542; }
.fresh-banner.crit, .fresh-banner.offline { border-color: rgba(246, 70, 93, .65); background: rgba(246, 70, 93, .12); color: #ff8090; }
.fresh-banner small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
