/* ACT2 dashboard — OKX trade-screen style (dark, dense, orange/green/red accents, tabular numbers).
   Desktop target: 1920x1080 and 1366x768 without page scroll on the trading pages
   (main / btc / stocks); panels scroll internally. analytics / settings scroll normally. */
:root {
  --bg: #0a0b0d;
  --panel: #121418;
  --panel-2: #181b21;
  --panel-3: #1f232a;
  --line: #252a32;
  --line-2: #2f353f;
  --text: #e8ebf0;
  --muted: #8b94a3;
  --dim: #5d6573;
  --accent: #f7931a;        /* orange — brand / bitcoin */
  --accent-2: #ffb04d;
  --accent-ink: #1a1206;
  --stk: #2dd4bf;           /* teal — stocks section */
  --up: #0ecb81;
  --up-bg: rgba(14, 203, 129, .12);
  --down: #f6465d;
  --down-bg: rgba(246, 70, 93, .12);
  --warn: #f0b90b;
  --warn-bg: rgba(240, 185, 11, .12);
  --info: #5b9dff;
  --live: #b07cff;
  --radius: 6px;
  --gap: 6px;
  --header-h: 42px;
  --font: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "D2Coding", ui-monospace, monospace;
  color-scheme: dark;
}
/* LIVE = '계좌 연결 안 됨' read-only context: whole screen shifts tone (requirement 1.2-03). */
body.is-live {
  --bg: #0c0a10;
  --panel: #15121b;
  --panel-2: #1b1722;
  --accent: var(--live);
  --accent-2: #c9a4ff;
  --accent-ink: #160b26;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 12px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.num, td.num, .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .dim { color: var(--dim); }
.warn { color: var(--warn); }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ header */
.act-header {
  height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.act-brand { display: flex; align-items: center; gap: 7px; font-weight: 800; letter-spacing: .5px; font-size: 14px; }
.act-brand-mark { width: 18px; height: 18px; border-radius: 4px; background: var(--accent); display: inline-grid; place-items: center; color: var(--accent-ink); font-size: 11px; font-weight: 900; }
.act-tabs { display: flex; gap: 2px; height: 100%; }
.act-tab { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; }
.act-tab:hover { color: var(--text); }
.act-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.act-header-spacer { flex: 1; }
.act-mode-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; background: var(--bg); }
.act-mode-toggle button { background: transparent; border: 0; color: var(--muted); padding: 3px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 11px; letter-spacing: .5px; }
.act-mode-toggle button.is-active[data-mode="paper"] { background: var(--accent); color: var(--accent-ink); }
.act-mode-toggle button.is-active[data-mode="live"] { background: var(--live); color: #160b26; }
.act-engine-badges { display: flex; gap: 6px; }
.act-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.act-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.act-badge.is-ok { color: var(--text); } .act-badge.is-ok::before { background: var(--up); box-shadow: 0 0 6px var(--up); }
.act-badge.is-wait { color: var(--warn); } .act-badge.is-wait::before { background: var(--warn); }
.act-badge.is-bad { color: var(--down); } .act-badge.is-bad::before { background: var(--down); }
.act-clock { font-variant-numeric: tabular-nums; color: var(--muted); font-family: var(--mono); font-size: 12px; min-width: 150px; text-align: right; white-space: nowrap; }

/* global banners (fetch errors / notices) */
.act-banners { position: fixed; top: calc(var(--header-h) + 6px); left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; width: min(720px, 92vw); pointer-events: none; }
.act-banner { pointer-events: auto; background: var(--panel-3); border: 1px solid var(--line-2); border-left: 3px solid var(--down); border-radius: var(--radius); padding: 7px 10px; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.act-banner.is-info { border-left-color: var(--info); } .act-banner.is-ok { border-left-color: var(--up); } .act-banner.is-warn { border-left-color: var(--warn); }
.act-banner .grow { flex: 1; word-break: break-word; }
.act-banner button { background: none; border: 0; color: var(--muted); cursor: pointer; }
.live-strip { display: none; height: 22px; line-height: 16px; background: repeating-linear-gradient(45deg, rgba(176,124,255,.16) 0 10px, rgba(176,124,255,.08) 10px 20px); color: #d9c4ff; text-align: center; font-weight: 700; padding: 3px; font-size: 11px; letter-spacing: .3px; border-bottom: 1px solid rgba(176,124,255,.35); }
body.is-live .live-strip { display: block; }

/* ------------------------------------------------------------------ layout */
.act-main { padding: var(--gap); }
.page-fixed { height: calc(100vh - var(--header-h)); overflow: hidden; }
body.is-live .page-fixed { height: calc(100vh - var(--header-h) - 22px); }
.grid { display: grid; gap: var(--gap); height: 100%; min-height: 0; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 34px; flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.panel-h h2 { margin: 0; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.panel-h .sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-h .spacer { flex: 1; }
.panel-b { padding: 8px 10px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.panel-b.flush { padding: 0; }
.panel-f { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 5px 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.section-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); display: inline-block; }
.section-dot.stk { background: var(--stk); }
/* LIVE overlay on every data panel */
.live-cover { display: none; position: absolute; inset: 34px 0 0 0; background: rgba(12,10,16,.86); z-index: 6; place-items: center; text-align: center; color: #d9c4ff; padding: 12px; border-radius: 0 0 var(--radius) var(--radius); }
.live-cover b { display: block; font-size: 13px; margin-bottom: 2px; }
body.is-live .live-cover { display: grid; }

/* scrollbars */
.panel-b::-webkit-scrollbar, .scroll::-webkit-scrollbar, .sym-cards::-webkit-scrollbar { width: 8px; height: 8px; }
.panel-b::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb, .sym-cards::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.panel-b::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ atoms */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; line-height: 16px; }
.pill.long, .pill.buy, .pill.ok { color: var(--up); border-color: rgba(14,203,129,.45); background: var(--up-bg); }
.pill.short, .pill.sell, .pill.bad { color: var(--down); border-color: rgba(246,70,93,.45); background: var(--down-bg); }
.pill.wait { color: var(--warn); border-color: rgba(240,185,11,.45); background: var(--warn-bg); }
.pill.accent { color: var(--accent); border-color: var(--accent); }
.pill.manual { color: var(--info); border-color: rgba(91,157,255,.45); }
.pill .by-hand { color: var(--info); }   /* '수동' prefix inside a trade-log action pill */
.empty { color: var(--dim); text-align: center; padding: 18px 8px; font-size: 12px; word-break: keep-all; }
.empty b { display: block; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn { border: 1px solid var(--line-2); background: var(--panel-3); color: var(--text); border-radius: 4px; padding: 5px 12px; cursor: pointer; font-weight: 700; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.buy { background: var(--up); border-color: var(--up); color: #04150d; }
.btn.sell { background: var(--down); border-color: var(--down); color: #1d0307; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 2px 8px; font-size: 11px; }
.btn.block { width: 100%; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 3px 10px; border-radius: 3px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.seg button.is-active { background: var(--panel-3); color: var(--text); }
.seg button.is-active.long { background: var(--up-bg); color: var(--up); }
.seg button.is-active.short { background: var(--down-bg); color: var(--down); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.input, select.input { background: var(--bg); border: 1px solid var(--line-2); border-radius: 4px; padding: 4px 8px; color: var(--text); min-width: 0; }
.input:focus { outline: none; border-color: var(--accent); }
input[type="date"].input { color-scheme: dark; }

/* switch (automation ON/OFF) */
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; font-size: 11px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 0; white-space: nowrap; }
.switch .track { width: 30px; height: 16px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.switch.is-on { color: var(--up); }
.switch.is-on .track { background: rgba(14,203,129,.35); }
.switch.is-on .track::after { left: 16px; background: var(--up); }
.switch.is-paused { color: var(--warn); }
.switch.is-pending .track::after { background: var(--warn); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* logos: local SVG or 2-letter badge */
.logo { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; display: inline-grid; place-items: center; font-size: 8.5px; font-weight: 800; color: #fff; letter-spacing: -.3px; overflow: hidden; vertical-align: middle; }
.logo img { width: 100%; height: 100%; display: block; }
.logo.lg { width: 26px; height: 26px; font-size: 11px; }
.sym { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; font-weight: 700; white-space: nowrap; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.t th { position: sticky; top: 0; background: var(--panel); color: var(--dim); font-weight: 600; text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11px; z-index: 1; }
table.t td { padding: 3px 8px; text-align: right; border-bottom: 1px solid rgba(37,42,50,.6); white-space: nowrap; vertical-align: middle; height: 25px; }
table.t th.l, table.t td.l { text-align: left; }
table.t th.c, table.t td.c { text-align: center; }
table.t tbody tr:hover { background: var(--panel-2); }
table.t tr.is-hl { background: rgba(247,147,26,.10); }
table.t td.wrap { white-space: normal; }
table.t td.ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* pagination / date nav */
.pager { display: flex; align-items: center; gap: 3px; }
.pager button { min-width: 24px; height: 22px; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 3px; cursor: pointer; padding: 0 5px; color: var(--text); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager .cur { min-width: 54px; font-variant-numeric: tabular-nums; }
.pager input { width: 54px; height: 22px; text-align: center; }
.datenav { display: flex; align-items: center; gap: 4px; }
.datenav .input { padding: 1px 6px; height: 24px; font-size: 11px; }
.note { color: var(--muted); font-size: 11px; }
.note.hl { color: var(--accent-2); }

/* KPI tiles */
.tiles { display: grid; gap: var(--gap); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; min-width: 0; position: relative; }
.tile .lbl { color: var(--muted); font-size: 11px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tile .val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val.md { font-size: 15px; }
/* ₩ totals split (W-11): computable parts + precise reason for each missing one */
.tile .val.split { font-size: 16px; }
.tile .val .sep { color: var(--dim); font-weight: 400; }
.tile .val .miss, .tile .val.miss { color: var(--warn); font-size: 13px; font-weight: 600; }
.tile .foot { color: var(--dim); font-size: 10.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .live-cover { inset: 0; border-radius: var(--radius); font-size: 11px; }

/* charts */
.chart-box { position: relative; flex: 1 1 auto; min-height: 0; }
.chart-box > .chart { position: absolute; inset: 0; }
.chart-legend { position: absolute; left: 8px; top: 6px; z-index: 3; font-size: 11px; color: var(--muted); pointer-events: none; display: flex; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.chart-legend .k { color: var(--dim); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; }
.legend-swatch { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 4px; }

/* symbol dropdown (closed by default) */
.dd { position: relative; }
.dd-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 3px 6px; cursor: pointer; font-weight: 800; font-size: 13px; }
.dd-btn:hover { border-color: var(--line-2); background: var(--panel-2); }
.dd-btn .caret { color: var(--muted); font-size: 10px; }
.dd-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; width: 260px; max-height: 340px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.5); padding: 6px; }
.dd-menu .dd-search { width: 100%; margin-bottom: 6px; }
.dd-group { color: var(--dim); font-size: 10.5px; padding: 6px 6px 2px; font-weight: 700; }
.dd-item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 5px 6px; border-radius: 4px; cursor: pointer; text-align: left; }
.dd-item:hover, .dd-item.is-focus { background: var(--panel-3); }
.dd-item .meta { margin-left: auto; color: var(--muted); font-size: 10.5px; }

/* modal (confirm dialog) */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: center; }
.modal { width: min(420px, 92vw); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal h3 { margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
.modal .body { padding: 12px 14px; }
.modal .body .kv { gap: 6px 12px; }
.modal .body p { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }

/* command result line */
.cmd-status { font-size: 11px; color: var(--muted); min-height: 16px; word-break: break-word; }
.cmd-status.ok { color: var(--up); } .cmd-status.bad { color: var(--down); } .cmd-status.wait { color: var(--warn); }

/* slider */
.pct { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pct-row { display: flex; align-items: center; gap: 8px; }
.pct input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 0; }
.pct-ticks { display: flex; justify-content: space-between; padding: 0 2px; margin-right: 66px; }
.pct-ticks button { background: none; border: 0; color: var(--dim); font-size: 10.5px; cursor: pointer; padding: 0; font-variant-numeric: tabular-nums; }
.pct-ticks button:hover { color: var(--text); }
.pct-num { width: 58px; text-align: right; }

/* ------------------------------------------------------------------ main page */
.main-grid { grid-template-columns: 330px minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1.15fr) minmax(0, 1fr); }
.main-grid .kpis { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.main-grid .engines { grid-column: 1; grid-row: 2 / 4; }
.main-grid .eq-btc { grid-column: 2; grid-row: 2; }
.main-grid .eq-stk { grid-column: 3; grid-row: 2; }
.main-grid .fills { grid-column: 2; grid-row: 3; }
.main-grid .events { grid-column: 3; grid-row: 3; }
.engine-card { flex: 1 1 0; }
.engine-card .big { font-size: 15px; font-weight: 800; }
.engine-card .auto-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.engine-card .go { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 11px; }
.engine-card .go:hover { color: var(--accent); }
.engine-card .kv { margin-top: 8px; }
.ev { display: flex; gap: 8px; padding: 4px 10px; border-bottom: 1px solid rgba(37,42,50,.6); align-items: baseline; }
.ev .t { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11px; }
.ev .lv { width: 6px; height: 6px; border-radius: 50%; background: var(--info); flex: 0 0 auto; align-self: center; }
.ev .lv.warn { background: var(--warn); } .ev .lv.error { background: var(--down); }
.ev .kind { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.ev .msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .eng { font-size: 10px; font-weight: 800; color: var(--accent); width: 26px; flex: 0 0 auto; }
.ev .eng.stk { color: var(--stk); }

/* ------------------------------------------------------------------ btc page */
/* status row is sized by its cards (they never overflow / scroll, with or without recent fills);
   the chart row absorbs the difference and never drops below 220px */
.btc-grid { grid-template-columns: minmax(0, 1fr) 410px; grid-template-rows: auto minmax(220px, 1fr); }
.btc-grid .status { grid-column: 1; grid-row: 1; }
.btc-grid .chartp { grid-column: 1; grid-row: 2; }
.btc-grid .right { grid-column: 2; grid-row: 1 / 3; }
.right .holdings { flex: 0 1 auto; max-height: 28%; min-height: 92px; }
.right .manual { flex: 0 0 auto; }
.right .log { flex: 1 1 0; min-height: 150px; }
.sum-strip { display: flex; gap: 18px; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: baseline; flex: 0 0 auto; }
.sum-strip .it { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.sum-strip .it .k { color: var(--muted); font-size: 11px; }
.sum-strip .it .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.sym-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); padding: var(--gap); flex: 1 1 auto; min-height: 0; overflow: auto; }
.sym-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; display: flex; flex-direction: column; gap: 7px; min-width: 0; cursor: pointer; }
.sym-card.is-sel { border-color: rgba(247,147,26,.55); }
.sym-card .hd { display: flex; align-items: center; gap: 8px; }
.sym-card .hd .name { font-size: 15px; font-weight: 800; }
.sym-card .hd .inst { color: var(--dim); font-size: 10.5px; }
.sym-card .hd .grow { flex: 1; }
.sym-card .px { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sym-card .px .p { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sym-card .px .age { color: var(--dim); font-size: 10.5px; }
.sym-card .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.sym-card .sig { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; display: flex; gap: 6px 10px; align-items: center; flex-wrap: wrap; }
.sym-card .sig { flex-direction: column; align-items: stretch; gap: 5px; flex-wrap: nowrap; }
.sym-card .sig .k { color: var(--muted); font-size: 11px; }
.sym-card .sig .r1 { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }
.sym-card .sig .r1 .grow { flex: 1; }
/* S1 filter badges (W-12) */
.sym-card .s1 { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sym-card .s1-mode { font-size: 10.5px; color: var(--muted); border-bottom: 1px dotted var(--dim); cursor: help; }
.sym-card .s1-side { display: inline-flex; align-items: center; gap: 3px; }
.sym-card .s1-side .k { font-weight: 700; font-size: 10.5px; }
.sym-card .s1 .b { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 3px; border: 1px solid var(--line-2); line-height: 15px; white-space: nowrap; cursor: help; }
.sym-card .s1 .b.off, .sym-card .s1 .b.na { color: var(--dim); opacity: .7; }
.sym-card .s1 .b.na { border-style: dashed; }
.sym-card .s1 .b.on.warn { color: var(--warn); border-color: rgba(240,185,11,.45); background: var(--warn-bg); }
.sym-card .s1 .b.on.info { color: var(--info); border-color: rgba(91,157,255,.45); background: rgba(91,157,255,.12); }
/* target detail (W-12) */
.sym-card .det { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.sym-card .det .it { display: flex; flex-direction: column; min-width: 0; }
.sym-card .det .k { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.sym-card .det .v { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* this symbol's newest fills (W-12) */
.sym-card .mini-fills { display: flex; flex-direction: column; gap: 1px; font-size: 11px; min-width: 0; }
.sym-card .mini-fills .mf-h { color: var(--muted); font-size: 10.5px; }
.sym-card .mini-fills .mf-empty { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sym-card .mini-fills .mf { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; height: 19px; }
.sym-card .mini-fills .mf .pill { padding: 0 5px; line-height: 14px; }
.sym-card .mini-fills .mf .t { color: var(--muted); font-size: 10.5px; }
.sym-card .mini-fills .mf .q { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sym-card .mini-fills .mf .o { font-size: 10.5px; white-space: nowrap; }
.sym-card .mini-fills .mf-more { display: none; color: var(--muted); font-size: 10.5px; white-space: nowrap; cursor: help; border-bottom: 1px dotted var(--dim); }
.sym-card .cmd-status:empty { display: none; }
.sym-card .ft { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; gap: 8px; margin-top: auto; }
/* tall cards: spread spare height between the blocks instead of one empty band above the footer */
.sym-card { justify-content: space-between; }
.sym-card .ft { margin-top: 0; }
.sym-card .det2 { border-top-style: dashed; }
.sym-card .det2 .v { font-weight: 600; color: var(--muted); }
.sym-card .cd { font-family: var(--mono); color: var(--text); font-size: 12px; }
.sym-card .spark { height: 34px; width: 100%; display: block; }
.manual .panel-b { display: flex; flex-direction: column; gap: 7px; overflow: visible; }
.manual .row { display: flex; align-items: center; gap: 8px; }
.manual .row .k { color: var(--muted); font-size: 11px; width: 34px; flex: 0 0 auto; }
.manual .preview { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 11.5px; }
.manual .preview .k { color: var(--muted); white-space: nowrap; }
.manual .preview .v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manual .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.manual .btns .btn { padding: 7px 8px; }

/* ------------------------------------------------------------------ stocks page */
/* right column 440px: the stocks log/holdings carry $ price + ₩ amount + ticker/stage text (wider than btc);
   the chart column absorbs the difference (RightTablesLayoutProbeTests) */
.stk-grid { grid-template-columns: 280px minmax(0, 1fr) 440px; grid-template-rows: auto minmax(0, 1fr); }
.stk-grid .strats { grid-column: 1 / -1; grid-row: 1; }
.stk-grid .cands { grid-column: 1; grid-row: 2; }
.stk-grid .center { grid-column: 2; grid-row: 2; }
.stk-grid .right { grid-column: 3; grid-row: 2; }
.center .chartp { flex: 1 1 0; }
.center .events { flex: 0 0 auto; height: 28%; min-height: 110px; }
.cred-banner { display: flex; gap: 10px; align-items: center; background: var(--warn-bg); border: 1px solid rgba(240,185,11,.4); color: var(--warn); border-radius: var(--radius); padding: 4px 10px; font-weight: 700; margin-bottom: var(--gap); }
.cred-banner .note { color: #e6cf8a; font-weight: 400; }
.strat-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap); }
.strat { background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--stk); border-radius: var(--radius); padding: 6px 9px; display: flex; flex-direction: column; gap: 3px; min-width: 0; position: relative; }
.strat .hd { display: flex; align-items: center; gap: 6px; }
.strat .hd .name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.strat .msg { color: var(--dim); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 15px; }
.strat .kv { font-size: 11.5px; gap: 1px 10px; }
.strat .ft { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.strat .live-cover { inset: 0; border-radius: var(--radius); font-size: 11px; }
.slots { display: inline-flex; gap: 2px; align-items: center; }
.slots i { width: 9px; height: 9px; border-radius: 2px; background: var(--line-2); display: inline-block; }
.slots i.on { background: var(--stk); }
.hold-group td { color: var(--stk) !important; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; background: var(--panel-2); text-align: left !important; height: 20px !important; }

/* ------------------------------------------------------------------ analytics / settings (scrolling pages) */
.page-scroll { max-width: 1680px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.an-tiles { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.an-chart { height: 360px; }
.an-chart .chart-box { height: 100%; }
.cards2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.form-row label { color: var(--muted); min-width: 120px; }
.params { max-height: 320px; }
.help { color: var(--dim); font-size: 11px; margin: 4px 0 0; }
.decisions td { white-space: normal; text-align: left; vertical-align: top; }
tr.is-selected td { background: rgba(247,147,26,.08); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1500px) {
  .btc-grid { grid-template-columns: minmax(0, 1fr) 380px; }
  .stk-grid { grid-template-columns: 240px minmax(0, 1fr) 380px; }
  .main-grid { grid-template-columns: 290px minmax(0, 1fr) minmax(0, 1fr); }
  .sym-card .px .p { font-size: 19px; }
  .act-tab { padding: 0 9px; }
  .act-header { gap: 10px; }
}
@media (max-width: 1280px) {
  .act-clock { display: none; }
}
@media (max-height: 820px) {
  .sym-card { gap: 5px; padding: 7px 9px; }
  .sym-card .spark { height: 22px; }
  .tile .val { font-size: 16px; }
  .tile { padding: 6px 10px; }
}
/* narrow screens: stack and let the page scroll (no horizontal overflow) */
@media (max-width: 1100px) {
  .page-fixed, body.is-live .page-fixed { height: auto; overflow: visible; }
  .grid { height: auto; }
  .main-grid, .btc-grid, .stk-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .main-grid > *, .btc-grid > *, .stk-grid > * { grid-column: 1 !important; grid-row: auto !important; }
  .main-grid .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chartp, .main-grid .eq-btc, .main-grid .eq-stk { min-height: 340px; }
  .right .log, .stk-grid .cands, .center .events, .main-grid .fills, .main-grid .events { min-height: 300px; }
  .strat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sym-cards { grid-template-columns: minmax(0, 1fr); }
  .cards2 { grid-template-columns: minmax(0, 1fr); }
  .act-header { flex-wrap: wrap; height: auto; padding: 6px 12px; gap: 8px; position: static; }
  .act-tabs { height: 30px; overflow-x: auto; max-width: 100%; }
  .act-header-spacer { display: none; }
}

/* dense tables in the narrow right column (보유 + 매매로그, btc and stocks): every column must fit the
   400–410px panel — vertical scrollbar included — at the widest realistic values: no horizontal scroll, no
   clipped or ellipsized value (probe: RightTablesLayoutProbeTests) */
.right table.t { font-size: 11px; }
.right table.t th, .right table.t td { padding-left: 4px; padding-right: 4px; }
.right table.t th:first-child, .right table.t td:first-child { padding-left: 6px; }
.right table.t th:last-child, .right table.t td:last-child { padding-right: 6px; }
.right table.t .pill { padding: 0 5px; }
.right table.t .logo { width: 15px; height: 15px; }
.right table.t .sym { gap: 5px; }
/* KST timestamps: UI font with tabular digits — monospace '.', ':' and ' ' cost ~20px per row */
.right table.t td.ts { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -.1px; }
/* free-text engine stage (up to 32 chars): one line when it fits, else wraps after '_' (<wbr>) — never cut */
.right table.t td.stage { white-space: normal; line-height: 1.25; }
/* stocks holdings (W-14): two-line cells — 손익 ₩ over %, 보유시간 over entry time, stage under the symbol */
.right table.t .sub2 { font-size: 10px; line-height: 1.2; font-weight: 400; }
.right table.t td.pnl2, .right table.t td.pnl2 div { white-space: nowrap; line-height: 1.25; }
.cands table.t th, .cands table.t td { padding-left: 5px; padding-right: 5px; }
/* candidates: fixed columns — the symbol column absorbs the rest and truncates (no clipped headers) */
.cands table.t { table-layout: fixed; }
.cands table.t .c-rank { width: 24px; }
.cands table.t .c-score { width: 42px; }
.cands table.t .c-chg { width: 60px; }
.cands table.t .c-amt { width: 58px; }
.cands table.t td.c-sym { overflow: hidden; text-overflow: ellipsis; }
.cands table.t td.c-chg-cell { line-height: 1.2; }
.cands table.t td.c-chg-cell .chg-ref { display: block; font-size: 10px; color: var(--dim); }
.cands table.t th .sm { display: none; }
@media (max-width: 1500px) {
  .cands table.t .c-score { width: 38px; }
  .cands table.t .c-chg { width: 56px; }
  .cands table.t .c-amt { width: 48px; } /* fits 5-char fmtCompact3 values (45.7M, 123M) + padding */
  .cands table.t th .lg { display: none; }
  .cands table.t th .sm { display: inline; }
}
.dd-btn .dd-ph { color: var(--muted); font-weight: 600; }
.log table.t { font-size: 11px; }
.log table.t td { height: 24px; }
@media (max-width: 1500px) {
  .btc-grid { grid-template-columns: minmax(0, 1fr) 400px; }
  .stk-grid { grid-template-columns: 230px minmax(0, 1fr) 440px; }
}
/* symbol card: two key/value pairs per row */
.sym-card dl.cols { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px 10px; }
.sym-card dl.cols dd:nth-of-type(odd) { padding-right: 12px; border-right: 1px solid var(--line); }
/* short viewports (1366x768 etc.): compress optional rows so the right column keeps its tables */
@media (max-height: 820px) {
  .panel-h { height: 30px; }
  .strat .msg, .strat .opt { display: none; }
  .manual .panel-b { gap: 5px; padding-top: 6px; padding-bottom: 6px; }
  .manual .preview .opt, .pct-ticks { display: none; }
  .manual .btns .btn { padding: 5px 8px; }
  .right .holdings { min-height: 110px; }
  .stk-grid .right .holdings { max-height: 24%; }
  .center .events { height: 24%; min-height: 90px; }
  .sum-strip { padding: 4px 10px; }
}
@media (max-height: 820px) {
  .sym-card .spark { display: none; }
  .sym-card .px .p { font-size: 18px; }
  .sym-card dl.cols { row-gap: 2px; }
  /* 1366x768: no room for a list (the trade log has every fill) — one line: label + newest fill + '외 N건'
     (older fills in its tooltip); the replay-context row moves into the signal-detail tooltip */
  .sym-card .mini-fills { flex-direction: row; align-items: center; gap: 8px; }
  .sym-card .mini-fills .mf ~ .mf, .sym-card .det.det2 { display: none; }
  .sym-card .mini-fills .mf { flex: 1; min-width: 0; height: 17px; grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .sym-card .mini-fills .mf .o, .sym-card .mini-fills .mf .pill.manual { display: none; }
  .sym-card .mini-fills .mf-more { display: inline; }
  .sym-card .sig { padding: 4px 8px; gap: 3px; }
  .sym-card .sig .bar, .sym-card .s1-k { display: none; }
  /* signal detail: label over value, columns sized by their content (values are never cut) */
  .sym-card .det { grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 0 8px; border-top: 0; padding-top: 0; }
  .sym-card .det .k { font-size: 10px; line-height: 13px; }
  .sym-card .det .v { font-size: 11.5px; line-height: 15px; }
}
@media (max-width: 1100px) {
  .panel-h { flex-wrap: wrap; height: auto; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
  .datenav { flex-wrap: wrap; }
  .panel-h .sub { white-space: normal; }
  .sum-strip { gap: 6px 14px; }
  .sym-card dl.cols { grid-template-columns: auto minmax(0, 1fr); }
  .sym-card dl.cols dd:nth-of-type(odd) { padding-right: 0; border-right: 0; }
  .act-mode-toggle, .act-engine-badges { flex-wrap: wrap; }
  .an-tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .page-scroll .panel-b { overflow-x: auto; }
  .toolbar .seg { flex-wrap: wrap; }
}

/* ---- W-15..17 (2026-10-07): exchange chart, search boxes, sortable candidates ---------------------------- */
.seg.seg-sm button { padding: 2px 7px; font-size: 11px; }
.chart-loading { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 4; pointer-events: none;
  background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 10px; font-size: 11px;
  color: var(--muted); box-shadow: 0 4px 14px rgba(0,0,0,.35); white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.qhost { display: inline-flex; min-width: 0; }
.qbox { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.qbox .input { height: 22px; padding: 1px 20px 1px 7px; font-size: 11px; width: 150px; }
.qbox.is-on .input { border-color: var(--accent); }
.qbox input[type="search"]::-webkit-search-cancel-button { display: none; }
.qbox .qx { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0 4px; }
.qbox .qx:hover { color: var(--text); }
.qbox .qx.hidden { display: none; }
.log .panel-f .qbox .input { width: 128px; }
.cands table.t th.sortable { cursor: pointer; user-select: none; }
.cands table.t th.sortable:hover, .cands table.t th.sortable:focus-visible { color: var(--text); outline: none; }
.cands table.t th.is-sorted { color: var(--text); }
.cands table.t th .sort-arr { position: absolute; top: 50%; transform: translateY(-50%); font-size: 7px; color: var(--accent); left: 0; }
.cands table.t th.l .sort-arr { left: auto; right: 0; }
@media (max-width: 1500px) {
  .qbox .input { width: 120px; }
  .log .panel-f .qbox .input { width: 104px; }
}

/* ---- v30 document views (2026-10-07, W-18/W-19): strategy card grid, RUBBER / GOLD chart views ---------------- */
/* card: 8 values as two key/value pairs per row (실현|승률, 승/패|오늘, 포지션|수익률, 보유|슬롯당) — the six-card row is
   ~200px per card at 1366, values ellipsize (full value in the tooltip) and never wrap (StocksV30LayoutProbeTests) */
.strat .kv.kv4 { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 1px 6px; font-size: 11px; }
.strat .kv.kv4 dt { font-size: 10.5px; }
.strat .kv.kv4 .dir { font-size: 9.5px; font-weight: 800; margin-left: 3px; }
.chartp .panel-h .sub { min-width: 0; }
.chartp .panel-h .seg, .chartp .panel-h .dd, .chartp .panel-h .gold-sym { flex: 0 0 auto; }
.gold-sym { font-size: 13px; font-weight: 800; padding: 3px 6px; }
.chart-wrap { display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; }
.chart-wrap > .chart-box { flex: 1 1 auto; min-width: 0; }
.chart-side { flex: 0 0 178px; border-left: 1px solid var(--line); padding: 6px 8px; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 6px; font-size: 11px; min-height: 0; min-width: 0; }
.chart-side::-webkit-scrollbar { width: 6px; }
.chart-side::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
.chart-side .side-title { font-weight: 800; color: var(--stk); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-side .side-kv { gap: 1px 8px; }
.chart-side .side-block { border-top: 1px solid var(--line); padding-top: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chart-side .side-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-weight: 700; white-space: nowrap; min-width: 0; }
.chart-side .side-h .pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chart-side .side-detail { color: var(--text); font-size: 10.5px; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chart-side .side-time { color: var(--dim); font-size: 10px; }
.chart-side .side-note { color: var(--warn); font-size: 10.5px; }
.chart-side .side-legend { margin-top: auto; color: var(--dim); font-size: 10px; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.chart-side .side-legend .ln { display: inline-block; width: 12px; height: 0; border-top: 1px dashed; }
.chart-side .side-legend .ln.entry { border-top-style: solid; border-color: var(--info); }
.chart-side .side-legend .ln.target { border-color: var(--stk); }
.chart-side .side-legend .ln.stop { border-color: var(--down); }
@media (max-width: 1500px) {
  .chart-side { flex-basis: 152px; padding: 5px 7px; }
  .chartp .panel-h { gap: 6px; }
}
@media (max-height: 820px) {
  .strat .kv.kv4 { font-size: 10.5px; }
  .chart-side { gap: 4px; }
}
@media (max-width: 1100px) {
  .chart-wrap { flex-direction: column; }
  .chart-wrap > .chart-box { min-height: 280px; }
  .chart-side { flex-basis: auto; border-left: 0; border-top: 1px solid var(--line); }
}

/* ---- v30 research (수익분석 주식 탭, W-20) / settings 'spec' (W-21) ------------------------------------------- */
.v30-sec .panel-b { overflow-x: auto; }
.v30-sec table.t td, .v30-sec table.t th { padding-left: 6px; padding-right: 6px; }
.v30-sec table.t td.sep, .v30-sec table.t th.sep { border-left: 1px solid var(--line); }
.v30-sec table.t tr.grp td { color: var(--stk); font-weight: 800; background: var(--panel-2); text-align: left; height: 22px; }
.v30-sec .v30-note { color: var(--dim); font-size: 11px; margin: 6px 10px; }
.v30-sec .v30-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.v30-sec .v30-bar .k { color: var(--muted); font-size: 11px; }
.v30-sec .v30-bar .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.v30-sec .v30-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 8px 10px; }
.v30-sec h3 { font-size: 12px; margin: 8px 10px 4px; color: var(--muted); }
.spec-fixed { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 1100px) { .v30-sec .v30-grid { grid-template-columns: minmax(0, 1fr); } }
.strat .kv.kv4 .more { color: var(--muted); font-size: 10px; }
.chart-side .pill.dec { max-width: 100%; white-space: normal; line-height: 15px; padding: 1px 7px; }
/* 누적 데이터 리셋 (CONTRACT-NOTES RS-06): settings section, typed-confirm dialog, period selectors */
#set-reset .reset-h { font-size: 12px; margin: 10px 0 4px; display: flex; align-items: center; gap: 6px; }
#set-reset table.t td, #set-reset table.t th { white-space: nowrap; }
#set-reset .reset-act { display: inline-flex; gap: 4px; justify-content: flex-end; }
.modal.wide { width: min(520px, 94vw); }
.modal .body .typed { display: grid; gap: 4px; margin-top: 10px; font-size: 11.5px; }
.modal .body .typed .input { width: 100%; }
.modal .body .typed b.mono { color: var(--text); }
.modal .body .chk { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; font-size: 11.5px; color: var(--text); }
.modal .body .warnbox { margin-top: 10px; padding: 6px 8px; border: 1px solid rgba(240,185,11,.45); background: var(--warn-bg); color: var(--warn); border-radius: 4px; font-size: 11.5px; }
.epoch-ctl { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.epoch-ctl input[type=checkbox] { margin: 0; }
.epoch-ctl select.input { height: 22px; padding: 0 4px; font-size: 11px; max-width: 150px; }
.pill.reset-wait { color: var(--warn); border-color: rgba(240,185,11,.45); background: var(--warn-bg); }
