/* 은퇴 시뮬레이터 — 데이터 색은 --series-N, 글자는 텍스트 토큰만. 라이트/다크 모두 검증된 팔레트. */
:root {
  color-scheme: light;
  --surface-1: #fcfcfb; --page: #f9f9f7; --text-primary: #0b0b0b; --text-secondary: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --seq-700: #0d366b; --div-neg: #e34948; --div-mid: #f0efec;
  --good: #0ca30c; --critical: #d03b3b; --good-text: #006300;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1: #1a1a19; --page: #0d0d0d; --text-primary: #ffffff; --text-secondary: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --seq-700: #6da7ec; --div-neg: #e66767; --div-mid: #383835; --good-text: #0ca30c; --accent: #3987e5;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--text-primary); font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); position: sticky; top: 0; z-index: 5; }
header h1 { font-size: 17px; margin: 0; font-weight: 600; }
header .spacer { flex: 1; }
header .muted { color: var(--muted); font-size: 13px; }
nav#tabs { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.tab { border: 0; background: transparent; padding: 8px 14px; font-size: 15px; color: var(--text-secondary); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1240px; margin: 0 auto; padding: 12px; }
main > section[hidden] { display: none; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--text-primary); }
.card .card { margin: 8px 0; }
.note { color: var(--text-secondary); font-size: 13px; margin: 8px 0 4px; }
.note.err, .err { color: var(--critical); }
.muted { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
/* 컨트롤 */
.ctl-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 6px 0; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.ctl.chk { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 6px; color: var(--text-primary); }
.chk.small { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.ctl-label { font-size: 12px; }
.ctl-more { width: 100%; }
.ctl-more summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; padding: 4px 0; }
.ymsel { display: inline-flex; gap: 4px; }
.sel, .inp { font: inherit; padding: 6px 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface-1); color: var(--text-primary); }
.inp.short { width: 96px; } .inp.mid { width: 160px; } .inp.wide { flex: 1; min-width: 200px; }
.inline { display: inline-flex; gap: 4px; align-items: center; }
.btn { font: inherit; padding: 7px 12px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface-1); color: var(--text-primary); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn.danger { color: var(--critical); }
.btn:hover { filter: brightness(0.96); }
/* 타일 · 히어로 */
.hero { padding: 6px 0 10px; }
.hero-num { font-size: 44px; font-weight: 600; line-height: 1.1; }
.hero-cap { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }
.badge { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); }
.badge.good { color: var(--good-text); } .badge.critical { color: var(--critical); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 8px 0; }
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.tile-label { font-size: 12px; color: var(--text-secondary); }
.tile-value { font-size: 20px; font-weight: 600; margin: 2px 0; }
.tile-sub { font-size: 12px; color: var(--muted); }
.market { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.up { color: var(--good-text); } .down { color: var(--critical); }
/* 표 */
.tbl-wrap { overflow-x: auto; margin: 6px 0; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.tbl.compact { font-size: 12.5px; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.tbl th { color: var(--text-secondary); font-weight: 600; white-space: nowrap; background: var(--surface-1); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.deficit td { color: var(--critical); }
.tbl tr.trough td { font-weight: 600; }
.tbl tr.warn td { background: color-mix(in oklab, var(--series-4) 10%, transparent); }
.tbl tr.good td { color: var(--good-text); }
.tbl tr.grp td { font-weight: 600; background: color-mix(in oklab, var(--grid) 40%, transparent); }
.tbl tr.muted td { color: var(--muted); text-decoration: line-through; }
.tbl input, .tbl select { font-size: 12.5px; padding: 4px 6px; }
/* 차트 */
figure.chart { margin: 8px 0; position: relative; }
.chart-head { display: flex; align-items: center; gap: 8px; }
.chart-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); flex: 1; }
.chart-sub { font-size: 12px; color: var(--text-secondary); }
.chart-table-btn { font: inherit; font-size: 12px; padding: 2px 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface-1); color: var(--text-secondary); cursor: pointer; }
.chart-body svg { display: block; overflow: visible; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .cross { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
svg .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg .dlabel { font-size: 11px; fill: var(--text-secondary); pointer-events: none; }
svg .cell-label { font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; }
svg .band { fill: var(--div-neg); opacity: 0.08; }
svg .bar:hover, svg .cell:hover { filter: brightness(1.12); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-secondary); margin: 4px 0 0; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-rect { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.legend-line { width: 16px; height: 2px; display: inline-block; }
.tip { display: none; position: absolute; z-index: 10; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); pointer-events: none; min-width: 150px; }
.tip-title { color: var(--text-secondary); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-key { width: 12px; height: 2px; display: inline-block; }
.tip-val { font-variant-numeric: tabular-nums; }
.tip-name { color: var(--text-secondary); }
/* 로그인 · 토스트 · 로딩 */
#login { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: var(--page); }
#login form { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 10px; }
#login h1 { font-size: 18px; margin: 0 0 6px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text-primary); color: var(--surface-1); padding: 8px 14px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#toast.show { opacity: 1; } #toast.err { background: var(--critical); color: #fff; }
.loading { opacity: 0.55; transition: opacity .15s; }
@media (max-width: 640px) { .hero-num { font-size: 34px; } main { padding: 8px; } .card { padding: 12px; } }
