/* ATLAS Trade 화면. 국내 관례: 상승 빨강, 하락 파랑. 색만으로 구분하지 않고 부호도 함께 쓴다. */
:root {
  --font: "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --gap: 16px;
  --side: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg: #060a13;
  --bg-glow-1: rgba(45, 212, 191, .13);
  --bg-glow-2: rgba(129, 140, 248, .16);
  --bg-glow-3: rgba(244, 114, 182, .07);
  --panel: rgba(16, 24, 39, .72);
  --panel-2: rgba(22, 32, 52, .75);
  --panel-solid: #0f1726;
  --line: rgba(148, 163, 184, .13);
  --line-2: rgba(148, 163, 184, .22);
  --text: #e8eef8;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #2dd4bf;
  --accent-2: #818cf8;
  --accent-soft: rgba(45, 212, 191, .14);
  --up: #ff5d6c;
  --up-soft: rgba(255, 93, 108, .14);
  --down: #4f8cff;
  --down-soft: rgba(79, 140, 255, .15);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --shadow: 0 20px 60px -24px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .03) inset;
  --grid: rgba(148, 163, 184, .08);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef2f8;
  --bg-glow-1: rgba(20, 184, 166, .14);
  --bg-glow-2: rgba(99, 102, 241, .12);
  --bg-glow-3: rgba(236, 72, 153, .06);
  --panel: rgba(255, 255, 255, .82);
  --panel-2: rgba(248, 250, 253, .9);
  --panel-solid: #ffffff;
  --line: rgba(15, 23, 42, .08);
  --line-2: rgba(15, 23, 42, .14);
  --text: #0f172a;
  --muted: #526077;
  --faint: #7b879b;
  --accent: #0d9488;
  --accent-2: #6366f1;
  --accent-soft: rgba(13, 148, 136, .1);
  --up: #d92d3a;
  --up-soft: rgba(217, 45, 58, .09);
  --down: #1f5fd1;
  --down-soft: rgba(31, 95, 209, .09);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, .1);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, .1);
  --shadow: 0 18px 50px -28px rgba(15, 23, 42, .35);
  --grid: rgba(15, 23, 42, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 8% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(800px 520px at 96% -4%, var(--bg-glow-2), transparent 62%),
    radial-gradient(700px 600px at 60% 110%, var(--bg-glow-3), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
}
.num { font-family: var(--mono); letter-spacing: -.02em; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 부팅 */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 46px; height: 46px; border-radius: 14px;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
  animation: spin 1.1s linear infinite;
  mask: radial-gradient(circle, transparent 42%, #000 44%);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 뼈대 */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), transparent);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  box-shadow: 0 10px 30px -10px var(--accent);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: background .2s, color .2s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on {
  color: var(--text);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.side-foot { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.side-foot .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 3px 0; }
.side-foot .row b { color: var(--text); font-weight: 500; }

.main { min-width: 0; padding: 22px 28px 60px; }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.top h1 { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.02em; margin-right: auto; }
.top h1 small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--line-2); background: var(--panel); white-space: nowrap;
}
.pill.env { border-color: transparent; background: linear-gradient(135deg, var(--accent-soft), rgba(129, 140, 248, .16)); }
.pill.live { color: var(--up); background: var(--up-soft); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
.dot.off { background: var(--up); }
.dot.wait { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  font-weight: 600; cursor: pointer; transition: transform .15s var(--ease), background .2s, border-color .2s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { border: 0; color: #04121a; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px -12px var(--accent-2); }
.btn.danger { border-color: transparent; color: #fff; background: linear-gradient(135deg, #ff5d6c, #e11d48); box-shadow: 0 10px 30px -14px #e11d48; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 카드 */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.c-12 { grid-column: span 12; } .c-8 { grid-column: span 8; } .c-7 { grid-column: span 7; }
.c-6 { grid-column: span 6; } .c-5 { grid-column: span 5; } .c-4 { grid-column: span 4; } .c-3 { grid-column: span 3; }
.card {
  position: relative; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel); backdrop-filter: blur(16px);
  box-shadow: var(--shadow); padding: 20px;
  animation: rise .5s var(--ease) both;
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 18px 20px 0; }
.card-h.mt { margin-top: 18px; }
.no-anim .card, .no-anim .item { animation: none; }
.card-h { display: flex; align-items: center; gap: 6px 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h2 { white-space: nowrap; }
.card-h h2 { font-size: 14px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.card-h .sub { font-size: 12px; color: var(--muted); }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 히어로 */
.hero {
  overflow: hidden;
  background:
    radial-gradient(500px 220px at 85% -20%, rgba(129, 140, 248, .28), transparent 70%),
    radial-gradient(420px 240px at 0% 120%, rgba(45, 212, 191, .22), transparent 70%),
    var(--panel);
}
.hero .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.hero .big { font-size: clamp(30px, 4.2vw, 46px); font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin: 6px 0 12px; }
.hero .big .unit { font-size: .45em; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.hero-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.delta { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 5px 10px; border-radius: 10px; font-family: var(--mono); font-size: 13px; }
.delta.up { background: var(--up-soft); }
.delta.down { background: var(--down-soft); }
.delta.flat { background: var(--panel-2); color: var(--muted); }
.hero-spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 92px; opacity: .9; pointer-events: none; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.kpi { padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.kpi .k { font-size: 11.5px; color: var(--muted); }
.kpi .v { font-size: 16px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 안전장치 */
.safety { display: flex; flex-direction: column; gap: 14px; }
.gauge-wrap { display: flex; align-items: center; gap: 16px; }
.gauge { width: 120px; height: 72px; flex: none; }
.gauge .val { font-family: var(--mono); font-weight: 700; font-size: 17px; fill: var(--text); }
.gauge .cap { font-size: 10px; fill: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.check .t { flex: 1; min-width: 0; }
.s { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; white-space: nowrap; line-height: 1.4; }
.s.ok { color: var(--ok); background: var(--ok-soft); }
.s.warn { color: var(--warn); background: var(--warn-soft); }
.s.bad { color: var(--up); background: var(--up-soft); }
.s.info { color: var(--accent-2); background: rgba(129, 140, 248, .14); }
.s.idle { color: var(--muted); background: var(--panel); border: 1px solid var(--line); }

/* 차트 */
.chart { position: relative; width: 100%; height: 260px; }
.chart.sm { height: 180px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { font-size: 10.5px; fill: var(--faint); font-family: var(--mono); }
.chart .gridline { stroke: var(--grid); }
.chart .cross { stroke: var(--line-2); stroke-dasharray: 3 4; }
.tip {
  position: absolute; pointer-events: none; z-index: 5;
  padding: 8px 10px; border-radius: 10px; font-size: 12px;
  background: var(--panel-solid); border: 1px solid var(--line-2);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .6);
  white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .12s;
}
.tip.show { opacity: 1; }
.tip .d { color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--panel-solid); color: var(--text); box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .3); }

/* 도넛 */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut .c1 { font-size: 11px; fill: var(--muted); }
.donut .c2 { font-family: var(--mono); font-size: 18px; font-weight: 700; fill: var(--text); }
.alloc { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; }
.alloc-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.alloc-row .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.alloc-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 표 */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
.table-wrap.tall thead th { position: sticky; top: 0; background: var(--panel-solid); z-index: 1; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--panel-2); }
.sym { display: flex; flex-direction: column; }
.sym b { font-weight: 700; }
.sym span { font-size: 11.5px; color: var(--muted); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; background: var(--accent-soft); color: var(--accent); }
.bar { position: relative; height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; min-width: 60px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .8s var(--ease); }
.bar.up > i { background: var(--up); }
.bar.down > i { background: var(--down); }

/* 타임라인 */
.timeline { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 52px 18px 1fr; gap: 10px; padding: 9px 0; font-size: 13px; }
.ev .tm { font-family: var(--mono); font-size: 11.5px; color: var(--faint); padding-top: 2px; }
.ev .mk { position: relative; display: flex; justify-content: center; }
.ev .mk::before { content: ""; position: absolute; top: 18px; bottom: -14px; width: 1px; background: var(--line); }
.ev:last-child .mk::before { display: none; }
.ev .mk i { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--faint); box-shadow: 0 0 0 4px var(--panel); position: relative; }
.ev .mk i.k-fill, .ev .mk i.k-acknowledged { background: var(--accent); }
.ev .mk i.k-unknown, .ev .mk i.k-needs_review, .ev .mk i.k-pause, .ev .mk i.k-external_order { background: var(--warn); }
.ev .mk i.k-broker_rejected, .ev .mk i.k-risk_rejected, .ev .mk i.k-submit_failed, .ev .mk i.k-engine_stop { background: var(--up); }
.ev .mk i.k-engine_ready, .ev .mk i.k-resume, .ev .mk i.k-signals { background: var(--ok); }
.ev .msg { min-width: 0; overflow-wrap: anywhere; }

/* 목록 카드 (주문·신호) */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip { border: 1px solid var(--line-2); background: var(--panel); padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.on { color: var(--text); border-color: transparent; background: linear-gradient(135deg, var(--accent-soft), rgba(129, 140, 248, .18)); }
.chip .n { font-family: var(--mono); margin-left: 6px; color: var(--faint); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel);
  padding: 14px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  cursor: pointer; transition: border-color .2s, transform .2s var(--ease);
  animation: rise .4s var(--ease) both;
}
.item:hover { border-color: var(--line-2); }
.item.openx { border-color: var(--accent); }
.side-badge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.side-badge.buy { background: var(--up-soft); color: var(--up); }
.side-badge.sell { background: var(--down-soft); color: var(--down); }
.side-badge.sig { background: var(--accent-soft); color: var(--accent); }
.side-badge.stop { background: var(--warn-soft); color: var(--warn); }
.item .ttl { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .meta { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.item .rt { text-align: right; }
.item .rt .num { font-weight: 700; }
.detail { grid-column: 1 / -1; border-top: 1px dashed var(--line-2); padding-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; font-size: 12.5px; }
.detail[hidden] { display: none; }
.detail .k { color: var(--muted); font-size: 11.5px; }
.detail .wide { grid-column: 1 / -1; }
.prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.prog .bar { flex: 1; max-width: 220px; }
.day-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 18px 4px 4px; letter-spacing: .04em; }

/* 지표 타일 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { padding: 14px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); }
.metric .k { font-size: 11.5px; color: var(--muted); }
.metric .v { font-size: 20px; font-weight: 700; margin-top: 4px; }
.metric .h { font-size: 11px; color: var(--faint); margin-top: 2px; }
.runs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.run { flex: none; width: 220px; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; }
.run.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.run .a { font-size: 11.5px; color: var(--muted); }
.run .b { font-weight: 700; margin: 3px 0; }

/* 알림 상자 */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel-2); font-size: 13px; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice.warn { border-color: transparent; background: var(--warn-soft); }
.notice.warn svg { color: var(--warn); }
.notice.bad { border-color: transparent; background: var(--up-soft); }
.notice.bad svg { color: var(--up); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .ico svg { width: 26px; height: 26px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty code { display: inline-block; margin-top: 10px; }

/* 설정 */
.big-state { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); flex-wrap: wrap; }
.big-state .ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.big-state .ring svg { width: 26px; height: 26px; }
.big-state .ring.ok { background: var(--ok-soft); color: var(--ok); }
.big-state .ring.bad { background: var(--up-soft); color: var(--up); }
.big-state .txt { flex: 1; min-width: 180px; }
.big-state .txt b { font-size: 17px; display: block; }
.kv { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); column-gap: 16px; }
.kv > div { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv > div:nth-child(odd) { color: var(--muted); white-space: nowrap; }
.kv > div:nth-child(even) { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.kv > div.kv-h { color: var(--text); font-weight: 700; padding-top: 16px; }
.kv > div.kv-h + div { padding-top: 16px; font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-family: var(--mono); font-size: 12px; padding: 4px 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }

/* 모달 */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 14, .6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: min(420px, 100%); background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); animation: rise .25s var(--ease); }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input { height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 15px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; transition: all .3s var(--ease); pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); padding: 32px 28px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line-2); backdrop-filter: blur(20px); box-shadow: var(--shadow); animation: rise .5s var(--ease); }
.login-card .brand { padding: 0 0 22px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.err { color: var(--up); font-size: 13px; min-height: 20px; margin: -6px 0 10px; }

/* 하단 탭 (휴대폰) */
.tabbar { display: none; }

@media (max-width: 1180px) {
  .c-8, .c-7, .c-6, .c-5, .c-4 { grid-column: span 12; }
  .c-3 { grid-column: span 6; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .top { margin-bottom: 14px; }
  .top h1 { font-size: 19px; width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; border-radius: 18px; }
  .c-3 { grid-column: span 12; }
  .hero-spark { display: none; }
  .card-h .sub { flex-basis: 100%; order: 3; }
  .card-h .right { margin-left: auto; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    padding: 6px; border-radius: 20px;
    background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 6px; border-radius: 14px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-decoration: none; min-height: 50px; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--text); background: var(--accent-soft); }
  .item { grid-template-columns: auto 1fr; }
  .item .rt { grid-column: 2; text-align: left; }
  .gauge-wrap { flex-wrap: wrap; }
  .sec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sec { padding: 8px 9px; }
  .sec .faint { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 업종 시소 */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.sec { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 10px 11px; text-align: left; cursor: pointer; min-height: 62px; transition: border-color .2s, transform .15s var(--ease); }
.sec:hover { border-color: var(--line-2); }
.sec.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sec b { display: block; font-size: 13px; }
.sec .num { font-size: 12px; font-weight: 700; }
.sec .faint { font-size: 11px; }
.rel { display: grid; grid-template-columns: 92px minmax(0, 1fr) 56px; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; }
.rel b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel .bar { height: 9px; }
.rel .bar.inv > i { background: linear-gradient(90deg, var(--down), var(--accent-2)); }
.rel .bar.same > i { background: linear-gradient(90deg, var(--up), #fb923c); }
.cond { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.heat { width: auto; border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.heat th { font-size: 10.5px; padding: 4px 6px; color: var(--muted); font-weight: 600; white-space: nowrap; border: 0; text-align: right; }
.heat th.v { writing-mode: vertical-rl; height: 78px; vertical-align: bottom; letter-spacing: .02em; }
.heat td { width: 30px; height: 26px; padding: 0; text-align: center; border: 0; border-radius: 5px; font-family: var(--mono); font-size: 10px; color: var(--text); }
.heat td.self { background: var(--panel-2); }
.members { font-size: 12px; color: var(--muted); }

/* --- 전략 구분 (돌파: 청록, 역추세: 남보라) --- */
.st-breakout { --st: var(--accent); }
.st-reversion { --st: var(--accent-2); }
.tag.st-breakout, .tag.st-reversion { color: var(--st); background: color-mix(in srgb, var(--st) 15%, transparent); }

.perf { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pf { position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--st, var(--accent)) 12%, transparent), transparent 60%), var(--panel-2); }
.pf::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--st, var(--accent)); }
.pf-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pf-h b { font-size: 15px; }
.pf-h .faint { font-size: 12px; }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--accent)); box-shadow: 0 0 12px var(--st, var(--accent)); align-self: center; }
.pf-k { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pf-k > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-k span { font-size: 11.5px; color: var(--muted); }
.pf-k b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-k small { font-size: 11px; font-weight: 500; }

/* 보유 종목: 넓은 화면은 표, 좁은 화면은 카드 */
.hcards { display: none; }
.hcard { padding: 14px 18px; border-top: 1px solid var(--line); }
.hc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hc-top .r { text-align: right; }
.hc-top .r .num:first-child { font-weight: 700; }
.hc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.hc-grid div { display: flex; flex-direction: column; gap: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; }
.hc-grid span { font-size: 11px; color: var(--muted); }
.hc-grid b { font-size: 13px; }

/* 설정: 대상 종목 접기 */
.uni { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.uni summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.uni summary::-webkit-details-marker { display: none; }
.uni summary .faint { font-size: 12.5px; }
.uni summary svg { margin-left: auto; color: var(--muted); transition: transform .2s var(--ease); }
.uni[open] summary svg { transform: rotate(180deg); }
.uni-list { padding: 4px 14px 12px; }
.uni-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.uni-row span { color: var(--muted); }

@media (max-width: 860px) {
  .hcards { display: block; }
  .hcards + .table-wrap { display: none; }
  .pf-k { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
}
