/* 매매일지 스타일 — TradeZella 느낌: 어두운 보라 사이드바 + 밝은 카드 */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --border: #e8e8f1;
  --grid: #eeeef5;
  --zero: #cfcfdc;
  --text: #1c1c35;
  --text-2: #5d5d78;
  --muted: #9494ab;
  --primary: #6c4cf5;
  --primary-600: #5a3be0;
  --primary-soft: #efebff;
  --primary-hover: #5a3be0;
  --profit: #0e9f6e;
  --profit-text: #067a53;
  --profit-soft: #e5f6ee;
  --loss: #f04438;
  --loss-text: #cf2b1f;
  --loss-soft: #fdecea;
  --be: #b4b4c6;
  --sidebar: #17152e;
  --sidebar-2: #24204a;
  --sidebar-text: #b6b3d1;
  --topbar-bg: rgba(244, 245, 250, .92);
  --hover-border: #d4d4e2;
  --accent-border: #dcd3ff;
  --win-border: #b9e6d2;
  --loss-border: #f8c6c1;
  --mistake-bg: #fff1e6;
  --mistake-fg: #b54708;
  --code-bg: #ecebf5;
  --star: #f5a524;
  --spot-bg: #e6f0ff;
  --spot-fg: #1d5fc4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 50, .04), 0 2px 10px rgba(20, 20, 50, .04);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: light;
}
/* 다크 모드: 휴대폰·PC가 어두운 테마면 자동으로 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e1a;
    --surface: #191728;
    --surface-2: #211f33;
    --border: #2d2a44;
    --grid: #28263c;
    --zero: #4a4766;
    --text: #ecebf5;
    --text-2: #b3b0c9;
    --muted: #7f7c99;
    --primary: #7c5cff;
    --primary-600: #a48cff;
    --primary-soft: #2a2350;
    --primary-hover: #6847f0;
  --primary-hover: #6847f0;
    --profit: #22a876;
    --profit-text: #45d39b;
    --profit-soft: #10291f;
    --loss: #ef5146;
    --loss-text: #ff7d72;
    --loss-soft: #34171a;
    --be: #5d5a75;
    --sidebar: #0b0a14;
    --sidebar-2: #1f1b3a;
    --sidebar-text: #a9a6c4;
    --topbar-bg: rgba(15, 14, 26, .9);
    --hover-border: #3d3a58;
    --accent-border: #4b3f8f;
    --win-border: #1d5c43;
    --loss-border: #6b2a2a;
    --mistake-bg: #3a2414;
    --mistake-fg: #ffb27a;
    --code-bg: #2a2840;
    --star: #f5b041;
    --spot-bg: #14233d;
    --spot-fg: #82b3ff;
  --spot-bg: #14233d;
  --spot-fg: #82b3ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0e1a;
  --surface: #191728;
  --surface-2: #211f33;
  --border: #2d2a44;
  --grid: #28263c;
  --zero: #4a4766;
  --text: #ecebf5;
  --text-2: #b3b0c9;
  --muted: #7f7c99;
  --primary: #7c5cff;
  --primary-600: #a48cff;
  --primary-soft: #2a2350;
  --primary-hover: #6847f0;
  --profit: #22a876;
  --profit-text: #45d39b;
  --profit-soft: #10291f;
  --loss: #ef5146;
  --loss-text: #ff7d72;
  --loss-soft: #34171a;
  --be: #5d5a75;
  --sidebar: #0b0a14;
  --sidebar-2: #1f1b3a;
  --sidebar-text: #a9a6c4;
  --topbar-bg: rgba(15, 14, 26, .9);
  --hover-border: #3d3a58;
  --accent-border: #4b3f8f;
  --win-border: #1d5c43;
  --loss-border: #6b2a2a;
  --mistake-bg: #3a2414;
  --mistake-fg: #ffb27a;
  --code-bg: #2a2840;
  --star: #f5b041;
  --spot-bg: #14233d;
  --spot-fg: #82b3ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.pos, .pnl.pos { color: var(--profit-text); }
.neg, .pnl.neg { color: var(--loss-text); }
.pnl { font-weight: 600; white-space: nowrap; }

/* ---------- 버튼·입력 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--hover-border); background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--loss-text); }
.btn.danger-fill { background: var(--loss); border-color: var(--loss); color: #fff; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
input:not([type=checkbox]):not([type=radio]), select, textarea { height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 0 10px; outline: none; min-width: 0; }
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: span 2; }
.form-error, .modal-error { color: var(--loss-text); font-size: 13px; }

/* ---------- 로그인 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--sidebar), #2d2463); }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card .brand { color: var(--text); }
.login-card p { margin: 0; }

/* ---------- 틀 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; padding: 0 6px 18px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #8b6cff, var(--primary)); color: #fff; display: grid; place-items: center; font-size: 13px; letter-spacing: .02em; }
.add-trade { margin-bottom: 16px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; }
#nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
#nav a.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 3px 0 0 #8b6cff; }
.sidebar-foot { margin-top: auto; font-size: 12px; display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.sync-info.neg { color: #ff8a80; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--topbar-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topbar h1 { font-size: 20px; margin-right: auto; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.custom-range { display: inline-flex; gap: 6px; align-items: center; }
.sync-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.menu-btn { display: none; }
.nav-backdrop { display: none; }
.view { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 16px; max-width: 1480px; width: 100%; }

/* ---------- 카드 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.cols-side { grid-template-columns: 340px minmax(0, 1fr); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* 숫자 카드 */
.stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 104px; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; white-space: nowrap; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-visual { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--grid); color: var(--muted); font-size: 10px; cursor: help; }
.wl-legend { display: flex; gap: 8px; font-size: 11px; font-weight: 600; }
.wl-legend .be { color: var(--muted); }
.ratio-bar { display: flex; gap: 2px; width: 104px; height: 8px; margin-top: 10px; }
.ratio-bar span { border-radius: 4px; display: block; }
.ratio-bar .w { background: var(--profit); }
.ratio-bar .l { background: var(--loss); }
.stat.stack { flex-direction: column; align-items: stretch; justify-content: center; gap: 0; }
.stat.stack .stat-visual { align-items: stretch; }
.stat.stack .ratio-bar, .stat.stack .ratio-labels { width: 100%; }
.ratio-labels { display: flex; justify-content: space-between; gap: 6px; width: 104px; font-size: 11px; font-weight: 600; margin-top: 4px; }

/* 점수 */
.score-wrap { display: flex; flex-direction: column; align-items: center; }
.score-total { width: 100%; display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.score-total .label { font-size: 12px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.score-total strong { font-size: 22px; }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--primary-soft); overflow: hidden; display: flex; }
.meter span { background: linear-gradient(90deg, #a48cff, var(--primary)); border-radius: 4px; }

/* ---------- 차트 ---------- */
.chart-box { width: 100%; min-height: 60px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--zero); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis.label { fill: var(--text-2); font-weight: 600; }
.chart .axis.value { fill: var(--text); font-weight: 600; }
.chart .area-pos { fill: var(--profit); fill-opacity: .12; }
.chart .area-neg { fill: var(--loss); fill-opacity: .12; }
.chart .line-pos, .chart .line-neg { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-pos { stroke: var(--profit); }
.chart .line-neg { stroke: var(--loss); }
.chart .bar.pos { fill: var(--profit); }
.chart .bar.neg { fill: var(--loss); }
.chart .bar.hover { opacity: .75; }
.chart .hit { fill: transparent; }
.chart .hit.clickable { cursor: pointer; }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; fill: var(--text-2); }
.chart .dot.pos { fill: var(--profit); }
.chart .dot.neg { fill: var(--loss); }
.chart .dot.primary { fill: var(--primary); }
.chart .grid-poly { fill: none; stroke: var(--grid); }
.chart .radar-area { fill: var(--primary); fill-opacity: .14; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.chart .arc { fill: none; stroke-width: 9; }
.chart .arc.pos, .chart .ring.pos { stroke: var(--profit); }
.chart .arc.neg, .chart .ring.neg { stroke: var(--loss); }
.chart .arc.be { stroke: var(--be); }
.chart .arc.track, .chart .ring.track { stroke: var(--grid); }
.chart .ring { fill: none; stroke-width: 8; }
.chart-empty { color: var(--muted); display: grid; place-items: center; min-height: 140px; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 20, 50, .12); padding: 8px 10px; font-size: 12px; max-width: 260px; }
.tip-title { color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row strong { font-size: 13px; }
.tip-label { color: var(--muted); }
.tip-key { width: 10px; height: 2px; border-radius: 1px; background: var(--text-2); flex-shrink: 0; }
.tip-key.pos { background: var(--profit); }
.tip-key.neg { background: var(--loss); }
.tip-key.primary { background: var(--primary); }

/* ---------- 달력 ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; }
.cal-head h2 { min-width: 120px; text-align: center; }
.cal-month-sum { margin-left: auto; font-size: 13px; color: var(--text-2); }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.05fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-day, .cal-week { min-height: 78px; border-radius: 10px; border: 1px solid var(--border); padding: 6px 8px; display: flex; flex-direction: column; gap: 1px; font-size: 12px; background: var(--surface); }
.cal-day .d { color: var(--muted); font-weight: 600; font-size: 11px; }
.cal-day.out { opacity: .35; }
.cal-day.today .d { color: var(--primary); }
.cal-day.has { cursor: pointer; }
.cal-day.win { background: var(--profit-soft); border-color: var(--win-border); }
.cal-day.loss { background: var(--loss-soft); border-color: var(--loss-border); }
.cal-day.has:hover { box-shadow: 0 0 0 2px var(--primary-soft); border-color: var(--primary); }
.cal-day .v { font-weight: 700; font-size: 13px; margin-top: auto; }
.cal-day .v .short { display: none; }
.cal-day .c { color: var(--text-2); font-size: 11px; }
.cal-week { background: var(--surface-2); }
.cal-week .d { color: var(--text-2); font-weight: 700; font-size: 11px; }
.cal-week .v { font-weight: 700; margin-top: auto; }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sorted { color: var(--primary); }
.table th.sorted.desc::after { content: " ▼"; font-size: 9px; }
.table th.sorted.asc::after { content: " ▲"; font-size: 9px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.long { background: var(--profit-soft); color: var(--profit-text); }
.badge.short { background: var(--loss-soft); color: var(--loss-text); }
.badge.spot { background: var(--spot-bg); color: var(--spot-fg); }
.badge.neutral, .badge.pending { background: var(--grid); color: var(--text-2); }
.badge.correct { background: var(--profit-soft); color: var(--profit-text); }
.badge.wrong { background: var(--loss-soft); color: var(--loss-text); }
.badge.src { background: var(--primary-soft); color: var(--primary-600); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; margin: 1px 4px 1px 0; border-radius: 999px; background: var(--primary-soft); color: var(--primary-600); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.mistake { background: var(--mistake-bg); color: var(--mistake-fg); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: 10px; opacity: .7; }
.stars { color: var(--star); letter-spacing: 1px; }
.stars .off { color: var(--grid); }
.pager { display: flex; justify-content: center; gap: 8px; align-items: center; margin-top: 12px; color: var(--text-2); }

/* ---------- 요약 줄 ---------- */
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.summary-strip div { display: flex; flex-direction: column; }
.summary-strip span { color: var(--muted); font-size: 12px; font-weight: 600; }
.summary-strip strong { font-size: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type=search] { flex: 1; min-width: 160px; }

/* ---------- 일별 일지 ---------- */
.day-card { padding: 0; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; flex-wrap: wrap; }
.day-head h2 { font-size: 15px; }
.day-head .net { font-weight: 700; font-size: 15px; }
.day-head .caret { color: var(--muted); transition: transform .15s; }
.day-card.closed .caret { transform: rotate(-90deg); }
.day-card.closed .day-body { display: none; }
.day-head .spacer { flex: 1; }
.day-body { border-top: 1px solid var(--border); padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.day-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; }
.kv-grid div { display: flex; flex-direction: column; }
.kv-grid span { color: var(--muted); font-size: 12px; font-weight: 600; }
.kv-grid strong { font-size: 15px; }
.note-box { display: flex; flex-direction: column; gap: 8px; }
.note-box .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- 거래 상세 ---------- */
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-head h2 { font-size: 20px; }
.detail-head .spacer { flex: 1; }
.big-pnl { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.info-list { display: flex; flex-direction: column; margin-top: 8px; }
.info-list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--text-2); }
.info-list strong { text-align: right; font-variant-numeric: tabular-nums; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.tag-input { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid var(--border); border-radius: 9px; padding: 4px 6px; min-height: 36px; background: var(--surface); }
.tag-input input { border: 0 !important; box-shadow: none !important; height: 26px !important; flex: 1; min-width: 100px; padding: 0 4px !important; }
.rating-input { display: flex; gap: 2px; }
.rating-input button { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--grid); padding: 0 1px; line-height: 1; }
.rating-input button.on { color: var(--star); }
.notes-area { min-height: 320px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-soft); color: var(--primary-600); }

/* ---------- 노트 ---------- */
.notebook { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.note-list { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.note-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.note-item:hover { background: var(--surface-2); }
.note-item.active { background: var(--primary-soft); border-color: var(--accent-border); }
.note-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item .m { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 2px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- 리포트 ---------- */
.overview-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.overview-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.overview-list span { color: var(--text-2); }
.overview-list strong { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- 플레이북 ---------- */
.pb-card { cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.pb-card:hover { border-color: var(--accent-border); }
.pb-card p { margin: 0; color: var(--text-2); }
.pb-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pb-stats div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.pb-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rules li { display: flex; gap: 8px; align-items: flex-start; }
.rules li::before { content: "✓"; color: var(--primary); font-weight: 800; }

/* ---------- 설정 ---------- */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.settings-list > div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--grid); }
/* 홈: 나의 다짐 · 나의 원칙 */
.home { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.home textarea { width: 100%; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.pledge { margin: 0; font-size: 18px; line-height: 1.7; font-weight: 600; white-space: pre-wrap; word-break: keep-all; }
.principles { margin: 0; padding-left: 0; list-style: none; counter-reset: p; display: flex; flex-direction: column; gap: 8px; }
.principles li { counter-increment: p; display: flex; gap: 12px; align-items: baseline; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-weight: 600; line-height: 1.5; word-break: keep-all; }
.principles li::before { content: counter(p); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-600); display: inline-grid; place-items: center; font-size: 13px; }
.home-empty { margin: 0; }
.home-updated { margin: 0; font-size: 12px; }
.home-guide { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.home-guide:hover { border-color: var(--primary); }

/* 지침서 */
.guide { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.guide-edit textarea { width: 100%; padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.6; resize: vertical; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-toc a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; text-decoration: none; }
.guide-toc a:hover { border-color: var(--primary); color: var(--primary); }
.md { padding: 24px 28px; line-height: 1.75; word-break: keep-all; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 22px; margin: 0 0 4px; }
.md h2 { font-size: 18px; margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3, .md h4 { font-size: 15px; margin: 20px 0 6px; }
.md h1, .md h2, .md h3, .md h4 { scroll-margin-top: 80px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md strong { font-weight: 700; }
.md a { color: var(--primary); }
.md code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.md .table-wrap { margin: 10px 0; }
.md-table td { vertical-align: top; line-height: 1.55; }
.md li.task { list-style: none; margin-left: -20px; display: flex; gap: 8px; align-items: baseline; }
.md .check { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 4px; transform: translateY(2px); }
.md .check.done { background: var(--primary); border-color: var(--primary); }
@media (max-width: 760px) { .md { padding: 18px 16px; } }
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text-2); font-size: 13px; }
.callout code, pre { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
pre { padding: 10px 12px; overflow-x: auto; margin: 8px 0 0; }

/* ---------- 팝업·알림 ---------- */
dialog { border: 0; background: var(--surface); color: var(--text); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(20, 20, 50, .25); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(23, 21, 46, .45); }
.modal-form { display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 8px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 8px 20px 12px; display: flex; flex-direction: column; gap: 12px; }
.modal-error { padding: 0 20px 8px; }
.confirm-body p { margin: 10px 0 0; font-size: 15px; line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--grid); }
.toast-box { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--sidebar); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 360px; font-weight: 500; }
.toast.err { background: #7a1f1a; }

/* ---------- 고래 추적 ---------- */
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.whale-tabs { margin-bottom: 0; }
.whale-status { font-size: 13px; color: var(--text-2); }
.whale-status.warn { color: var(--loss-text); font-weight: 600; }
.whale-table td { vertical-align: middle; }
.whale-pos-cell { min-width: 220px; }
.whale-pos { display: inline-flex; align-items: center; gap: 4px; margin: 1px 10px 1px 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.whale-scroll { max-height: 520px; overflow: auto; }
.whale-links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.whale-links a { color: var(--primary); text-decoration: none; font-weight: 600; }
.whale-addr { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.whale-addr code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; background: var(--code-bg); padding: 3px 6px; border-radius: 6px; word-break: break-all; user-select: all; }
.whale-kv { margin-top: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

.coin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.coin-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.coin-chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.coin-chip.on { background: var(--primary-soft); border-color: var(--accent-border); color: var(--primary-600); }

/* 가격 사다리: 매도 대기 | 가격 | 매수 대기 | 표시 */
.ladder { margin-top: 12px; font-variant-numeric: tabular-nums; }
.lad-head, .lad-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem minmax(0, 1fr) 5.5rem; align-items: center; gap: 8px; }
.lad-head { padding: 0 0 6px; border-bottom: 1px solid var(--border); }
.lad-head div:nth-child(1) { text-align: right; }
.lad-row { min-height: 22px; border-bottom: 1px solid var(--grid); cursor: default; }
.lad-row:hover { background: var(--surface-2); }
.lad-row.mid { background: var(--primary-soft); }
.lad-row.gap { min-height: 18px; border-bottom-style: dashed; }
.lad-row.mid .lad-px b { color: var(--primary-600); font-weight: 700; }
.lad-px { text-align: center; font-size: 12px; white-space: nowrap; }
.lad-bar { display: flex; align-items: center; gap: 6px; height: 16px; min-width: 0; }
.lad-bar.sell { justify-content: flex-end; }
.lad-bar i { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.lad-bar.sell i { background: var(--loss); opacity: .75; }
.lad-bar.buy i { background: var(--profit); opacity: .75; }
.lad-bar .amt { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.lad-marks { font-size: 12px; white-space: nowrap; }
.lad-marks small { font-size: 10px; color: var(--muted); margin-right: 3px; }
.lad-note { margin-top: 8px; }
.ladder-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 12px; }
.ladder-legend .lg { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: -6px; }
.ladder-legend .lg.bid { background: var(--profit); }
.ladder-legend .lg.ask { background: var(--loss); }
.mk { font-size: 11px; margin-right: 1px; }
.mk.long, .mk.tp { color: var(--profit); }
.mk.short, .mk.sl { color: var(--loss); }
.mk.liq { color: var(--mistake-fg); font-weight: 700; }

/* 주문 종류 표시 */
.ord { font-size: 12px; font-weight: 700; white-space: nowrap; }
.ord.bid, .ord.tp { color: var(--profit-text); }
.ord.ask, .ord.sl { color: var(--loss-text); }
.ord.exit { color: var(--text-2); }
.ord-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.ord-coin { margin-bottom: 4px; }
.ord-sep td { color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface-2); }
.table.compact th, .table.compact td { padding-top: 5px; padding-bottom: 5px; }

/* 변화 기록 */
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.ev:last-child { border-bottom: 0; }
.ev-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.ev-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ev-body > a { color: var(--text); text-decoration: none; }
.ev-text { flex-basis: 100%; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ev-bell { font-size: 12px; }
@media (max-width: 860px) {
  .whale-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lad-head, .lad-row { grid-template-columns: minmax(0, 1fr) 7.5rem minmax(0, 1fr) 3.5rem; gap: 4px; }
  .lad-bar .amt { display: none; }
  .lad-px b { display: block; font-size: 11px; }
  .ev { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* 종합 방향 */
.dir-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; align-items: center; }
.dir-score { display: flex; align-items: center; gap: 18px; }
.dir-num { font-size: 64px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dir-word { font-size: 20px; font-weight: 700; }
.dir-ratio { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dir-ratio-bar { height: 12px; border-radius: 6px; background: var(--loss); opacity: .9; overflow: hidden; }
.dir-ratio-bar i { display: block; height: 100%; background: var(--profit); border-right: 2px solid var(--surface); }
.dir-ratio-lab { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; }
.dir-counts { margin-top: 6px; }
.dbar { position: relative; display: inline-block; width: 64px; height: 8px; border-radius: 4px; background: var(--grid); vertical-align: middle; overflow: hidden; }
.dbar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--zero); }
.dbar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.dbar i.l { background: var(--profit); }
.dbar i.s { background: var(--loss); }
.dir-how summary { cursor: pointer; list-style: none; }
.dir-how summary::-webkit-details-marker { display: none; }
.dir-how ol { margin: 12px 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.55; font-size: 14px; color: var(--text-2); }
.dir-how b { color: var(--text); }
@media (max-width: 860px) {
  .dir-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dir-num { font-size: 52px; }
}

/* BTC 호가 지도: 막대를 확정 신규 / 청산 지정가 / 익절·손절(빗금)로 쌓음 */
.ladder.book .lad-row { min-height: 18px; }
.ladder.book .lad-bar { gap: 0; }
.ladder.book .lad-bar .amt { margin: 0 6px; }
.ladder.book .lad-bar i { border-radius: 0; }
.ladder.book .lad-bar.sell i:last-of-type { border-radius: 0 3px 3px 0; }
.ladder.book .lad-bar.sell i:first-of-type { border-radius: 3px 0 0 3px; }
.ladder.book .lad-bar.buy i:first-of-type { border-radius: 3px 0 0 3px; }
.ladder.book .lad-bar.buy i:last-of-type { border-radius: 0 3px 3px 0; }
.ladder.book .lad-bar.sell i.new { background: var(--loss); opacity: .85; }
.ladder.book .lad-bar.sell i.close { background: var(--loss); opacity: .45; }
.ladder.book .lad-bar.sell i.cond { background: repeating-linear-gradient(135deg, var(--loss) 0 2px, transparent 2px 5px); opacity: .7; }
.ladder.book .lad-bar.buy i.new { background: var(--profit); opacity: .85; }
.ladder.book .lad-bar.buy i.close { background: var(--profit); opacity: .45; }
.ladder.book .lad-bar.buy i.cond { background: repeating-linear-gradient(45deg, var(--profit) 0 2px, transparent 2px 5px); opacity: .7; }
.ladder-legend .lg.light { opacity: .45; }
.ladder-legend .lg.ask.hatch { background: repeating-linear-gradient(135deg, var(--loss) 0 2px, transparent 2px 4px); }
.ladder-legend .lg.bid.hatch { background: repeating-linear-gradient(45deg, var(--profit) 0 2px, transparent 2px 4px); }

/* ---------- 화면 크기별 ---------- */
@media (max-width: 1280px) {
  .cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 > .span-all-md { grid-column: 1 / -1; }
}
@media (max-width: 1024px) {
  .cols-1-2, .cols-side, .cols-2, .notebook, .day-top { grid-template-columns: minmax(0, 1fr); }
  .note-list { max-height: 320px; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .filters { order: 3; width: 100%; }
  .filters select { flex: 1; }
  .filters .seg { width: 100%; }
  .filters .seg button { flex: 1; }
  .view { padding: 16px 16px 40px; }
  .cols-5, .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-5 > :first-child { grid-column: 1 / -1; }
  .cols-3 > * { grid-column: 1 / -1; }
  .card { padding: 14px 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .overview-list { grid-template-columns: minmax(0, 1fr); }
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .cols-5 { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 21px; }
  .calendar { gap: 3px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-week, .cal-dow.week { display: none; }
  .cal-day { min-height: 54px; padding: 4px; }
  .cal-day .c { display: none; }
  .cal-day .v { font-size: 10px; }
  .cal-day .v .full { display: none; }
  .cal-day .v .short { display: inline; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span2 { grid-column: auto; }
  .sync-btn span { display: none; }
}
