/* HStockGuard Trader — signal desk
   Korean market convention: 상승·매수 = red, 하락·매도 = blue. Colour is never the only cue:
   every state also carries a word or a glyph. */
:root {
  --bg: #edf0f2;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --line: #d9dfe4;
  --line-2: #e8ecef;
  --ink: #17212b;
  --ink-2: #4a5866;
  --ink-3: #5c6874;
  --rise: #c41a30;
  --rise-soft: #fbe7ea;
  --fall: #1c5bd0;
  --fall-soft: #e4ecfb;
  --warn: #8f5200;
  --warn-soft: #fff1d6;
  --ok: #14704a;
  --ok-soft: #e1f4ea;
  --hold: #8a95a1;
  --nav: #17212b;
  --nav-ink: #c9d2db;
  --nav-active: #ffffff;
  --radius: 6px;
  --radius-lg: 10px;
  --font: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --shadow-pop: 0 8px 28px rgba(15, 25, 35, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151b; --surface: #151d25; --surface-2: #1b2530; --line: #2a3744; --line-2: #22303c;
    --ink: #e8edf2; --ink-2: #b3bfcb; --ink-3: #93a0ad;
    --rise: #ff5c6c; --rise-soft: #3a1a20; --fall: #5c9dff; --fall-soft: #16263f;
    --warn: #f2b02e; --warn-soft: #3a2c10; --ok: #3cc48a; --ok-soft: #12302a; --hold: #7f8b97;
    --nav: #0b1015; --nav-ink: #9aa8b5; --nav-active: #ffffff; --shadow-pop: 0 8px 28px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151b; --surface: #151d25; --surface-2: #1b2530; --line: #2a3744; --line-2: #22303c;
  --ink: #e8edf2; --ink-2: #b3bfcb; --ink-3: #93a0ad;
  --rise: #ff5c6c; --rise-soft: #3a1a20; --fall: #5c9dff; --fall-soft: #16263f;
  --warn: #f2b02e; --warn-soft: #3a2c10; --ok: #3cc48a; --ok-soft: #12302a; --hold: #7f8b97;
  --nav: #0b1015; --nav-ink: #9aa8b5; --nav-active: #ffffff; --shadow-pop: 0 8px 28px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { font-size: 15px; }
html[data-font="large"] { font-size: 17px; }
html[data-font="xlarge"] { font-size: 19px; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fall); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rise { color: var(--rise); }
.fall { color: var(--fall); }
.muted { color: var(--ink-3); }
.small { font-size: 0.8571rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.rail {
  background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: var(--nav-active); text-decoration: none; }
.brand svg { flex: none; }
.brand b { display: block; font-size: 1.0714rem; letter-spacing: -.01em; }
.brand span { display: block; font-size: 0.8571rem; color: var(--nav-ink); }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius);
  text-decoration: none; font-weight: 500;
}
.rail nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.rail nav a:hover { background: rgba(255,255,255,.06); color: var(--nav-active); }
.rail nav a[aria-current="page"] { background: rgba(255,255,255,.1); color: var(--nav-active); }
.rail nav a[aria-current="page"] svg { opacity: 1; }
.rail .badge-dot { margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px; background: var(--warn);
  color: #1b1200; font-size: 0.8571rem; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.rail-foot { margin-top: auto; font-size: 0.8571rem; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.rail-foot button { background: none; border: 1px solid rgba(255,255,255,.15); color: var(--nav-ink); border-radius: var(--radius);
  padding: 6px 8px; cursor: pointer; text-align: left; }
.rail-foot button:hover { color: var(--nav-active); border-color: rgba(255,255,255,.3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 10px 24px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 20; min-height: 52px; flex-wrap: wrap;
}
.mkt { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mkt b { font-weight: 600; }
.mkt .state { font-size: 0.8571rem; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.mkt .state.up { color: var(--rise); border-color: color-mix(in srgb, var(--rise) 35%, transparent); }
.mkt .state.down { color: var(--fall); border-color: color-mix(in srgb, var(--fall) 35%, transparent); }
.topbar .spacer { flex: 1; }
.feed-state { display: flex; align-items: center; gap: 8px; font-size: 0.8571rem; color: var(--ink-2); white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pulse.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.pulse.dead { background: var(--rise); box-shadow: 0 0 0 3px var(--rise-soft); }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; }

.banner { padding: 8px 24px; font-size: 0.9286rem; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.banner.demo { background: repeating-linear-gradient(-45deg, var(--warn-soft), var(--warn-soft) 10px, var(--surface) 10px, var(--surface) 20px);
  color: var(--ink); font-weight: 500; }
.banner.down { background: var(--rise-soft); color: var(--rise); font-weight: 600; }
.banner a { font-weight: 600; white-space: nowrap; }

#page:focus { outline: none; }
.page { padding: 20px 24px 48px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5714rem; line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin: 2px 0 0; color: var(--ink-2); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel > header h2 { font-size: 1.0714rem; margin: 0; font-weight: 600; }
.panel > header .hint { color: var(--ink-3); font-size: 0.8571rem; }
.panel > header .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.panel .body { padding: 16px; }
.grid-dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.grid-dash.board-first { grid-template-columns: 1fr; }
@media (min-width: 1600px) { .grid-dash.board-first { grid-template-columns: minmax(0, 1fr) 360px; } }
.grid-dash.board-first .feed { max-height: 420px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* summary strip: one line of figures, not a wall of cards */
.strip { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 16px; overflow-x: auto; }
.strip > div { padding: 12px 18px; border-right: 1px solid var(--line-2); min-width: 150px; flex: 1; }
.strip > div:last-child { border-right: 0; }
.strip dt { font-size: 0.8571rem; color: var(--ink-3); margin: 0; }
.strip dd { margin: 2px 0 0; font-size: 1.2857rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip dd small { font-size: 0.8571rem; font-weight: 500; margin-left: 4px; white-space: normal; }
@media (max-width: 1600px) { .strip dd small { display: block; margin-left: 0; } }
.target-track { height: 4px; background: var(--line-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.target-track i { display: block; height: 100%; background: var(--rise); }

.alert-band { display: flex; gap: 12px; align-items: center; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-left: 4px solid var(--warn); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 16px; }
.alert-band b { color: var(--warn); white-space: nowrap; }
.alert-band { flex-wrap: wrap; }
.alert-band .items { display: flex; gap: 14px; flex-wrap: wrap; }

/* ------------------------------------------------------------ table */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { font-size: 0.8571rem; font-weight: 500; color: var(--ink-3); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t th.num, .t td.num { text-align: right; }
.t .name b { font-weight: 600; white-space: nowrap; }
.t .name { min-width: 120px; }
.t td.px b { display: block; font-size: 1.0714rem; }
.t td.px span { display: block; font-size: 0.8571rem; }
.t td.px span.live { color: var(--ok); font-size: 0.8571rem; }
.t a { text-decoration: none; }
.t a:hover, .feed a:hover { text-decoration: underline; }
.feed a { text-decoration: none; }
.sigmeta { display: flex; gap: 8px; align-items: center; margin-top: 4px; padding-left: 84px; }
.panel > header .tools select { width: auto; }
.t .name span { display: block; font-size: 0.8571rem; color: var(--ink-3); }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 1.0714rem; margin-bottom: 4px; }

/* ------------------------------------------------- signal gauge (signature) */
.gauge { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; min-width: 200px; }
.gauge .lbl { font-weight: 700; font-size: 0.9286rem; white-space: nowrap; }
.gauge .lbl small { display: block; font-weight: 500; font-size: 0.8571rem; color: var(--ink-3); letter-spacing: .04em; }
.gauge .track { position: relative; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--fall) 0 20%, color-mix(in srgb, var(--fall) 45%, var(--line-2)) 20% 40%,
    var(--line) 40% 60%, color-mix(in srgb, var(--rise) 45%, var(--line-2)) 60% 80%, var(--rise) 80% 100%);
  opacity: .9; }
.gauge .pin { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface); }
.gauge.sig-STRONG_BUY .lbl, .gauge.sig-BUY .lbl { color: var(--rise); }
.gauge.sig-SELL .lbl, .gauge.sig-WEAK_SELL .lbl { color: var(--fall); }
.gauge.sig-HOLD .lbl { color: var(--ink-2); }
.gauge.sig-WARMUP .track { opacity: .25; }
.gauge.big { grid-template-columns: 1fr; gap: 8px; }
.gauge.big .lbl { font-size: 1.8571rem; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 10px; }
.gauge.big .lbl small { display: inline; font-size: 0.9286rem; }
.gauge.big .track { height: 14px; border-radius: 7px; }
.gauge.big .pin { height: 24px; top: -5px; }
.gauge .scale { display: flex; justify-content: space-between; font-size: 0.8571rem; color: var(--ink-3); grid-column: 1 / -1; }

.tfstrip { display: flex; gap: 2px; }
.tfstrip span { width: 26px; height: 22px; border-radius: 3px; font-size: 0.8571rem; display: grid; place-items: center; font-weight: 600;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line-2); }
.tfstrip span.c-STRONG_BUY { background: var(--rise); color: #fff; border-color: var(--rise); }
.tfstrip span.c-BUY { background: var(--rise-soft); color: var(--rise); border-color: color-mix(in srgb, var(--rise) 30%, transparent); }
.tfstrip span.c-SELL { background: var(--fall); color: #fff; border-color: var(--fall); }
.tfstrip span.c-WEAK_SELL { background: var(--fall-soft); color: var(--fall); border-color: color-mix(in srgb, var(--fall) 30%, transparent); }
.tfstrip span.primary { outline: 1.5px solid var(--ink); outline-offset: 1px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 0.8571rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.chip.rise { background: var(--rise-soft); color: var(--rise); border-color: transparent; }
.chip.fall { background: var(--fall-soft); color: var(--fall); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--rise-soft); color: var(--rise); border-color: transparent; }
.t .name .chip.q { margin-top: 4px; font-weight: 600; display: inline-flex; }
.ok-text { color: var(--ok); }
.chip.solid-rise { background: var(--rise); color: #fff; border-color: var(--rise); }
.chip.solid-fall { background: var(--fall); color: #fff; border-color: var(--fall); }
.stars { color: var(--ink); letter-spacing: 1px; font-size: 0.8571rem; }
.stars span { color: var(--line); }
.sig-text-STRONG_BUY, .sig-text-BUY { color: var(--rise); font-weight: 700; }
.sig-text-SELL, .sig-text-WEAK_SELL { color: var(--fall); font-weight: 700; }
.sig-text-STOP_LOSS { color: var(--warn); font-weight: 700; }
.sig-text-TAKE_PROFIT { color: var(--ok); font-weight: 700; }

/* ------------------------------------------------------------ feed */
.feed { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed time { font-size: 0.8571rem; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 1px; }
.feed .what { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.feed .why { font-size: 0.8571rem; color: var(--ink-2); margin-top: 2px; }
.feed li.risk { background: var(--warn-soft); }
.feed li.fresh { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--warn) 25%, transparent); } to { background: transparent; } }

/* ------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.buy { background: var(--rise); color: #fff; border-color: var(--rise); }
.btn.sell { background: var(--fall); color: #fff; border-color: var(--fall); }
.btn.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.btn.danger { color: var(--rise); border-color: color-mix(in srgb, var(--rise) 40%, transparent); }
.btn.sm { padding: 4px 10px; font-size: 0.9286rem; }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { white-space: nowrap; border: 0; background: none; padding: 5px 11px; cursor: pointer; font-size: 0.9286rem; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 0.8571rem; color: var(--ink-2); font-weight: 500; }
.field small { color: var(--ink-3); font-size: 0.8571rem; }
input[type="text"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 7px 10px; min-width: 0; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--fall); outline: none; box-shadow: 0 0 0 3px var(--fall-soft); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 10px; cursor: pointer; transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--fall); outline-offset: 2px; }
.presets { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.presets button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 1px 9px; font-size: 0.8571rem; cursor: pointer; }
.presets button:hover { border-color: var(--ink-3); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.note { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; color: var(--ink-2); font-size: 0.9286rem; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.note b { color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 0.9286rem; }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ analysis */
.analysis-head { display: grid; grid-template-columns: minmax(220px, auto) minmax(260px, 420px) 1fr; gap: 24px; align-items: center; margin-bottom: 16px; }
.quote-big b { font-size: 2.1429rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.quote-big .chg { font-size: 1.0714rem; font-weight: 600; margin-left: 8px; }
.quote-big h1 { font-size: 1.2857rem; margin: 0; }
.quote-big h1 span { font-size: 0.9286rem; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.chart-box { position: relative; }
.chart-box .pane { width: 100%; }
.chart-box .pane + .pane { border-top: 1px solid var(--line-2); }
.pane-label { position: absolute; left: 10px; z-index: 3; font-size: 0.8571rem; color: var(--ink-3); pointer-events: none; background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 0 4px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.8571rem; color: var(--ink-2); padding: 8px 16px; border-bottom: 1px solid var(--line-2); }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 4px; }
.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); align-items: start; }
.rules li:last-child { border-bottom: 0; }
.rules .mark { font-weight: 700; }
.rules li.ok .mark { color: var(--ok); }
.rules li.no { color: var(--ink-3); }
.rules .w { font-size: 0.8571rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rules .d { display: block; font-size: 0.8571rem; color: var(--ink-3); }
.rules .req { font-size: 0.8571rem; color: var(--warn); margin-left: 4px; }

/* ------------------------------------------------------------ mock */
.steps { display: flex; gap: 0; padding: 0; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow-x: auto; }
.steps li { list-style: none; flex: 1; padding: 10px 14px; border-right: 1px solid var(--line-2); min-width: 150px; font-size: 0.9286rem; color: var(--ink-3); }
.steps li:last-child { border-right: 0; }
.steps li b { display: block; color: var(--ink-2); font-size: 0.9286rem; }
.steps li.done b { color: var(--ok); }
.steps li.now { background: var(--surface-2); }
.steps li.now b { color: var(--ink); }

/* ------------------------------------------------------------ toast / modal */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink-3); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; animation: in .2s ease-out; }
.toast.rise { border-left-color: var(--rise); }
.toast.fall { border-left-color: var(--fall); }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: var(--rise); }
.toast.ok { border-left-color: var(--ok); }
.toast b { font-size: 1rem; }
.toast p { margin: 0; font-size: 0.9286rem; color: var(--ink-2); grid-column: 1; }
.toast button { grid-row: 1 / 3; grid-column: 2; background: none; border: 0; cursor: pointer; color: var(--ink-3); font-size: 1.2857rem; line-height: 1; align-self: start; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(540px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 22, .45); }
dialog header { padding: 14px 18px; border-bottom: 1px solid var(--line-2); font-weight: 600; font-size: 1.0714rem; }
dialog .body { padding: 16px 18px; }
dialog footer { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); }

/* ------------------------------------------------------------ mobile */
.tabbar { display: none; }
@media (max-width: 1180px) {
  .grid-dash { grid-template-columns: 1fr; }
  .analysis-head { grid-template-columns: 1fr 1fr; }
  .analysis-head > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 8px 16px; gap: 10px; }
  .topbar .mkt:nth-of-type(2) { display: none; }
  .page { padding: 16px 16px 96px; }
  .banner { padding: 8px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .analysis-head { grid-template-columns: 1fr; gap: 12px; }
  .strip { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .strip > div { min-width: 0; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .strip > div:nth-child(odd) { border-right: 1px solid var(--line-2); }
  .strip dd { font-size: 1.1429rem; white-space: normal; }
  .panel > header .tools { margin-left: 0; width: 100%; flex-wrap: wrap; overflow: visible; }
  .panel > header .tools .seg { max-width: 100%; overflow-x: auto; }
  .panel > header .tools select { flex: 1 1 40%; min-width: 110px; width: auto; }
  .filters .seg, .page-head .actions .seg { max-width: 100%; overflow-x: auto; }
  .page-head .actions { margin-left: 0; max-width: 100%; flex-wrap: wrap; }
  /* settings: keep 저장 reachable on long tabs, above the bottom tab bar */
  [data-page="settings"] .page-head .actions:has(.btn:not(.hidden)) { position: fixed; left: 12px; right: 12px; z-index: 25;
    bottom: calc(64px + env(safe-area-inset-bottom)); justify-content: flex-end; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 8px; box-shadow: var(--shadow-pop); }
  [data-page="settings"] { padding-bottom: 150px; }
  .tabbar a { font-size: min(0.8571rem, 12px); }
  /* tables that become cards on phones (관심·보유) */
  .t.cards thead { display: none; }
  .t.cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .t.cards td { padding: 0; border: 0; }
  .t.cards td[data-label]::before { content: attr(data-label); display: block; font-size: 0.7857rem; color: var(--ink-3); }
  .t.cards td.name, .t.cards td[data-wide] { grid-column: 1 / -1; }
  .t.cards td.num { text-align: left; }
  .t.cards td[data-actions] { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
  .board tr:hover td { background: none; }
  .t td { white-space: normal; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 0.8571rem; text-decoration: none; color: var(--ink-3); }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  /* watch board becomes two-line rows */
  .board thead { display: none; }
  .board tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .board td { padding: 0; border: 0; }
  .board td[data-m="hide"] { display: none; }
  .board td[data-m="gauge"] { grid-column: 1 / -1; }
  .board td[data-m="tfs"] { display: none; }  /* phone: one verdict per stock; per-timeframe detail lives in 분석 */
  .sigmeta { padding-left: 0; }
  .gauge { min-width: 0; }
  .toasts { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v1.3 — self-check list and first-run checklist */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 4px 10px; align-items: start; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.checks li:first-child { border-top: 0; }
.checks .st { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8571rem; font-weight: 700; margin-top: 1px; }
.checks .st.ok { background: var(--ok-soft); color: var(--ok); }
.checks .st.warn { background: var(--warn-soft); color: var(--warn); }
.checks .st.bad { background: var(--rise); color: #fff; }
.checks .st.info { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.checks .t1 { font-weight: 600; }
.checks .t1 small { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.checks .t2 { color: var(--ink-2); font-size: 0.9286rem; overflow-wrap: anywhere; }
.checks .fix { grid-column: 2 / 4; font-size: 0.9286rem; background: var(--warn-soft); color: var(--ink); border-radius: var(--radius); padding: 8px 10px; overflow-wrap: anywhere; }
.checks .fix code { font-size: 0.8571rem; background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 3px; }
.checks li.is-bad .fix { background: var(--rise-soft); }
.checks li.is-info .fix, .checks li.is-ok .fix { background: var(--surface-2); color: var(--ink-2); }
.diag-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setup-card { margin-bottom: 16px; }
.setup-card .body { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.setup-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: inherit; }
.setup-step:hover { border-color: var(--line); background: var(--surface-2); }
.setup-step.done { opacity: .72; }
.setup-step .st { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8571rem; font-weight: 700; border: 1.5px solid var(--line); color: var(--ink-3); }
.setup-step.done .st { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-step b { display: block; font-weight: 600; }
.setup-step span.why { display: block; color: var(--ink-3); font-size: 0.8571rem; margin-top: 2px; }
.progress-line { flex: 1; min-width: 120px; max-width: 260px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--ok); }
@media (max-width: 760px) { .checks li { padding: 10px 12px; } .checks .fix { grid-column: 1 / 4; } }

/* v1.5 — view-only accounts: the server refuses changes; the screen does not offer them. */
body.viewer #addForm, body.viewer #addGroupBtn, body.viewer [data-hold], body.viewer [data-del], body.viewer [data-rename],
body.viewer [data-edit], body.viewer [data-close], body.viewer [data-gdel], body.viewer #backfillBtn,
body.viewer [data-page="backtest"] #f, body.viewer [data-page="mock"] .btn:not([role="tab"]),
body.viewer [data-admin] { display: none !important; }
.viewer-note { background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; color: var(--ink-2); font-size: .9286rem; }

.t td.nw, .t tr.nwrow td { white-space: nowrap; }

/* stock picker (v1.6) */
.picker { position: relative; min-width: 0; }
.picker > input { width: 100%; }
.picker-list { position: absolute; z-index: 40; left: 0; min-width: max(100%, 300px); top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); max-height: 300px; overflow-y: auto; }
.picker-list li[role=option] { display: flex; align-items: baseline; gap: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.picker-list li b { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.picker-list li[role=option][aria-selected=true] { background: var(--fall-soft); }
.picker-list li .code { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.picker-list li .mk { color: var(--ink-3); font-size: 0.8571rem; margin-left: auto; }
.picker-list li .chip { font-size: 0.7857rem; padding: 0 6px; }
.picker-note { padding: 7px 12px; color: var(--ink-3); font-size: 0.8571rem; border-top: 1px solid var(--line-2); }
.picker-note:first-child { border-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.form-row.add-row { grid-template-columns: 1fr 160px auto; }
@media (max-width: 640px) { .form-row.add-row { grid-template-columns: 1fr auto; } .form-row.add-row > .field:first-child { grid-column: 1 / -1; } }

/* 가상 운용 day chart (v1.7) */
.daychart { width: 100%; height: auto; display: block; }
.daychart .grid { stroke: var(--line-2); stroke-width: 1; }
.daychart .base { stroke: var(--line); stroke-width: 1; }
.daychart .goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 5 4; }
.daychart .ax { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.daychart rect[fill="transparent"]:hover { fill: color-mix(in srgb, var(--ink) 6%, transparent); }

/* v1.9: horizontally scrolling rows show that there is more */
.tabs[role="tablist"], .filters { scrollbar-width: thin; }
@media (max-width: 860px) {
  .tabs[role="tablist"] { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.nw { white-space: nowrap; }
form.picker-open > small.muted, form.picker-open .form-row ~ small { visibility: hidden; }
.picker-list { min-width: max(100%, 340px); }
