/* site.css — 메인·구역 페이지 공용. 모바일 우선. 토큰은 :root, 다크는 prefers-color-scheme */
:root {
  color-scheme: light dark;
  --bg: #f6f7f6; --surface: #ffffff; --surface-2: #eef0ee;
  --ink: #17191c; --ink-2: #4b5058; --ink-3: #7c828c;
  --line: #e2e5e1; --line-2: #c9cec9;
  --accent: #1c4f9c; --accent-soft: #e3ebf7;
  --g-a: #2a78d6; --g-b: #1baf7a; --g-c: #eda100; --g-d: #8b8f98;
  --bar-price: #256abf; --bar-levy: #86b6ef; --bar-plus: #1baf7a; --bar-minus: #e34948;
  --ok-bg: #e2f5ec; --ok-ink: #0d5e3c; --bad-bg: #fbe4e4; --bad-ink: #8a1f1f; --warn-bg: #fff4dc; --warn-ink: #6b4300;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618; --surface: #1c1f23; --surface-2: #24282d;
    --ink: #eceef0; --ink-2: #b3b8c0; --ink-3: #858b95;
    --line: #2b3036; --line-2: #3a4048;
    --accent: #6ea3ee; --accent-soft: #1e2c40;
    --g-a: #3987e5; --g-b: #199e70; --g-c: #c98500; --g-d: #a1a5ad;
    --bar-price: #3987e5; --bar-levy: #86b6ef; --bar-plus: #199e70; --bar-minus: #e66767;
    --ok-bg: #12352a; --ok-ink: #7fd8b0; --bad-bg: #3d1c1c; --bad-ink: #f0a0a0; --warn-bg: #3a2e10; --warn-ink: #f2c96b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55; word-break: keep-all; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap.narrow { max-width: 720px; }

.eyebrow { font-size: 11px; letter-spacing: .05em; color: var(--ink-3); }
.eyebrow a { color: var(--accent); }
h1 { font-size: 22px; font-weight: 700; line-height: 1.25; margin: 2px 0 12px; text-wrap: balance; }
.sec { font-size: 11px; letter-spacing: .05em; color: var(--ink-3); font-weight: 500; margin: 22px 0 8px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; }
.sec em { font-style: normal; letter-spacing: 0; font-weight: 400; min-width: 0; }

/* 공용 부품 */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 9px; border-radius: 5px; background: var(--accent-soft); border: 1px solid transparent; line-height: 1.3; min-height: 28px; }
.chip.est { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-2); }
.chip.out { background: var(--surface-2); color: var(--ink-2); }
.chip small { color: var(--ink-3); font-size: 10px; }
.stg { display: inline-block; font-size: 11px; background: var(--accent-soft); padding: 2px 8px; border-radius: 4px; }
.stg.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 10.5px; color: var(--ink-2); background: var(--surface); }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.grade { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 3px; font-size: 10px; font-weight: 700; color: #fff; font-style: normal; vertical-align: 1px; }
.grade.a { background: var(--g-a); }
.grade.b { background: var(--g-b); }
.grade.c { background: var(--g-c); color: #1a1200; }
.grade.d { background: transparent; color: var(--g-d); border: 1px solid var(--g-d); }
.num { min-width: 0; }
.num span { display: block; font-size: 10px; color: var(--ink-3); line-height: 1.3; }
.num b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.num b.plus { color: var(--ok-ink); }
.num b.minus { color: var(--bad-ink); }
.num b.c { color: var(--ink-2); }
.num b .grade { margin-left: 3px; vertical-align: 3px; }
.num span small { font-size: 9.5px; color: var(--ink-3); }
.num.rng b { font-size: 13.5px; }
.num.na b { color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
.lead { font-size: 12.5px; color: var(--ink-3); margin: -6px 0 6px; }
footer { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 14px; }
footer a { color: var(--accent); }

/* 메인 */
.vmap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vrow { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); align-items: start; }
.vrow:last-child { border-bottom: 0; }
.vrow .st { font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.vrow .st small { display: block; font-weight: 400; color: var(--ink-3); font-size: 10.5px; }
.vrow .ch { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.vrow.empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 7px); }
.vrow.empty .st { color: var(--ink-3); font-weight: 500; }
.vrow.warn { background: var(--warn-bg); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; color: var(--ink-2); max-width: 100%; }
.pill summary { list-style: none; cursor: pointer; padding: 5px 12px; min-height: 30px; display: flex; align-items: center; }
.pill summary::-webkit-details-marker { display: none; }
.pill b { color: var(--ink); font-weight: 700; margin-left: 4px; }
.pill[open] { border-radius: 10px; flex-basis: 100%; }
.pill p { margin: 0; padding: 0 12px 10px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.grp { margin-top: 18px; }
.grp-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin: 0 0 6px; }
.grp-h b { font-size: 13px; }
.grp-h span { font-size: 11px; color: var(--ink-3); }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card:active { background: var(--surface-2); }
.card.est { border-style: dashed; box-shadow: none; }
.card.out { background: var(--surface-2); box-shadow: none; }
.card .nm { font-size: 17px; font-weight: 700; line-height: 1.25; }
.card .sub { font-size: 11.5px; color: var(--ink-3); margin-top: -4px; }
.nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }

/* 구역 페이지 */
.facts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12.5px; color: var(--ink-2); margin: -6px 0 8px; }
.facts b { color: var(--ink); font-weight: 500; }
.facts a.map { color: var(--accent); }
.vs { list-style: none; margin: 6px 0 0; padding: 0; }
.vs li { position: relative; padding: 0 0 10px 24px; font-size: 13.5px; color: var(--ink-3); line-height: 1.4; min-height: 24px; }
.vs li::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: -4px; width: 2px; background: var(--line-2); }
.vs li:last-child::before { display: none; }
.vs li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); box-sizing: border-box; }
.vs li.done { color: var(--ink-2); }
.vs li.done::after { background: var(--accent); border-color: var(--accent); }
.vs li.done::before { background: var(--accent); }
.vs li.now { color: var(--ink); font-weight: 700; }
.vs li.now::after { border-color: var(--accent); border-width: 3px; box-shadow: 0 0 0 4px var(--accent-soft); }
.vs li small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.pm { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.pm.est { border-style: dashed; }
.pm.out { background: var(--surface-2); }
/* 결과 타일 — 초기 현금 · 최종투자 · 안전마진. 계산 내역보다 먼저 읽히는 결론 */
.kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.kpi > div { min-width: 0; padding: 0 10px; border-left: 1px solid var(--line); }
.kpi > div:first-child { padding-left: 0; border-left: 0; }
.kpi > div:last-child { padding-right: 0; }
.kpi span { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b { display: block; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; letter-spacing: -.01em; }
.kpi b.rg { font-size: 15px; line-height: 1.85; }
.kpi b.plus { color: var(--ok-ink); }
.kpi b.minus { color: var(--bad-ink); }
.kpi b.na { font-size: 21px; color: var(--ink-3); }
.kpi em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-3); line-height: 1.35; }

.rows { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 3px; column-gap: 12px; font-size: 13.5px; color: var(--ink-2); align-items: baseline; margin-top: 10px; }
.rows b { font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; font-size: 15px; white-space: nowrap; }
.rows .gl { grid-column: 1 / -1; font-size: 10.5px; letter-spacing: .05em; color: var(--ink-3); margin-top: 9px; padding-top: 7px; border-top: 1px solid var(--line); }
.rows .gl:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.rows b.plus { color: var(--ok-ink); }
.rows b.minus { color: var(--bad-ink); }
.rows b.c { color: var(--ink); }
.rows b.na { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.rows b.sum { font-weight: 700; font-size: 16px; }
.rows span small { display: block; font-size: 10.5px; color: var(--ink-3); line-height: 1.3; }
.rows span .grade { vertical-align: 1px; }
.rows .ref { color: var(--ink-3); }
.rows .ref + b { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.cav { font-size: 12px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.bar { position: relative; height: 18px; margin: 12px 0 8px; display: flex; gap: 2px; background: var(--surface-2); border-radius: 4px; }
.bar .seg { height: 100%; }
.bar .seg.p { background: var(--bar-price); border-radius: 4px 0 0 4px; }
.bar .seg.l { background: var(--bar-levy); }
.bar .seg.m { background: var(--bar-plus); border-radius: 0 4px 4px 0; }
.bar .seg.neg { background: var(--bar-minus); border-radius: 0 4px 4px 0; position: absolute; top: 0; height: 100%; }
.bar .mark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); margin-left: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.scen .row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 62px; gap: 8px; align-items: center; margin: 6px 0; font-size: 12.5px; }
.scen .bar { margin: 0; height: 12px; }
.scen .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.scen .v.minus { color: var(--bad-ink); }
.jbox { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; }
.jr { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.jr:last-child { border-bottom: 0; }
.jr .k { color: var(--ink-3); font-size: 11.5px; }
.jr .k small { display: block; font-size: 10px; }
.jr b { font-weight: 700; }
.jr .ql span { display: block; padding: 2px 0; }
.jr .ql b { margin-right: 4px; color: var(--ink-3); font-weight: 600; }
.jr .ql .etc { color: var(--ink-3); font-size: 12px; }
.jr details.more > div { color: var(--ink-2); }
.sec em a { color: var(--accent); }
.ls { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ls li { display: grid; grid-template-columns: 20px minmax(0, 1fr) 64px; gap: 6px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.ls li:last-child { border-bottom: 0; }
.ls .rk { font-size: 12px; color: var(--ink-3); font-weight: 700; text-align: center; }
.ls .nm { font-size: 14px; font-weight: 700; line-height: 1.3; min-width: 0; }
.ls .nm small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.ls .sc { text-align: right; }
.ls .gg { display: block; width: 64px; height: 38px; margin-left: auto; }
.ls .gg path { fill: none; stroke-width: 9; }
.ls .gg .tr { stroke: var(--line); }
.ls .gg .vl { stroke: var(--accent); }
.ls .gg text { fill: var(--accent); font-size: 15px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; }
.ls .lk { grid-column: 2 / 4; display: flex; gap: 6px; flex-wrap: wrap; }
.ls .lk a { font-size: 11.5px; color: var(--accent); border: 1px solid var(--line-2); border-radius: 99px; padding: 2px 10px; min-height: 26px; display: inline-flex; align-items: center; }
.ck { display: grid; gap: 5px; }
.ck div { display: flex; gap: 8px; align-items: center; font-size: 13px; min-height: 24px; }
.ck .box { width: 16px; height: 16px; border-radius: 3px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 10px; }
.ck .box.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ck .box.half { background: var(--warn-bg); border-color: var(--g-c); color: var(--warn-ink); }
.ck span { color: var(--ink-3); font-size: 11.5px; margin-left: auto; text-align: right; }
.fold { border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; background: var(--surface); }
.fold summary { list-style: none; cursor: pointer; padding: 9px 12px; font-size: 13px; display: flex; justify-content: flex-start; gap: 6px; min-height: 40px; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸"; color: var(--ink-3); flex: none; }
.fold[open] summary::before { content: "▾"; }
.fold summary span { color: var(--ink-3); font-size: 11px; white-space: nowrap; margin-left: auto; }
.fold .content { padding: 0 12px 12px; font-size: 13px; }
.fold .content > :first-child { margin-top: 0; }
.fold .content .cav { margin-top: 8px; }
.fold .content h1, .fold .content h2, .fold .content h3 { font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 18px 0 8px; }
.fold .content ul { padding-left: 18px; }
.fold .content li { margin: 4px 0; }
.fold .content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 12.5px; }
.fold .content th, .fold .content td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.fold .content th { background: var(--surface-2); }
.fold .content code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; font-size: .9em; }
.fold .content blockquote { border-left: 3px solid var(--accent); margin: 0; padding: 2px 12px; color: var(--ink-2); }
.fold .content a { color: var(--accent); text-decoration: underline; }
.qlist { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.qlist li { padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.qlist li:first-child { border-top: 0; }
.qlist li b { color: var(--ink); margin-right: 6px; }
.qlist li small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }

/* 접힘 안 — 표·키값. 긴 서술은 "더 보기" 안에서만 */
table.kv { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.kv th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 6px 8px 6px 0; vertical-align: top; width: 88px; border-top: 1px solid var(--line); }
table.kv th small { display: block; font-weight: 400; color: var(--ink-3); font-size: 10.5px; }
table.kv td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); line-height: 1.5; }
table.kv td.g { width: 22px; text-align: right; }
table.kv tr:first-child th, table.kv tr:first-child td { border-top: 0; }
details.more { margin-top: 3px; }
details.more summary { list-style: none; cursor: pointer; font-size: 11.5px; color: var(--accent); display: inline-block; padding: 2px 0; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "− "; }
details.more > div { margin-top: 4px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; font-size: 12.5px; }
details.more > div ul { padding-left: 16px; margin: 4px 0; }
details.more > div li { margin: 2px 0; }
details.more > div p { margin: 4px 0; }
details.more > div a { color: var(--accent); text-decoration: underline; }
details.more > div table { border-collapse: collapse; font-size: 12px; display: block; overflow-x: auto; }
details.more > div th, details.more > div td { border: 1px solid var(--line); padding: 3px 6px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12px; }
table.tbl th, table.tbl td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; white-space: nowrap; }
table.tbl th { background: var(--surface-2); font-weight: 600; }
table.tbl td:last-child a { color: var(--accent); margin-right: 6px; }
.wide { overflow-x: auto; }
ul.chain { margin: 8px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--ink-2); }
ul.chain li { margin: 3px 0; }
.pn { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 13px; }
.pn a { color: var(--accent); padding: 8px 0; min-height: 40px; display: inline-flex; align-items: center; }

@media (min-width: 720px) {
  .wrap { padding: 32px 24px 80px; }
  h1 { font-size: 26px; }
  .vrow { grid-template-columns: 200px minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .vs li { padding: 22px 4px 0; text-align: center; font-size: 12px; }
  .vs li::before { left: 50%; right: -50%; top: 9px; bottom: auto; width: auto; height: 2px; }
  .vs li::after { left: 50%; transform: translateX(-50%); }
  .vs li small { font-size: 11px; }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: background .12s; }
}
