:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ee;
  --ink: #17201b;
  --ink-2: #4a5650;
  --ink-3: #7b8780;
  --line: #e2e6e1;
  --accent: #0f7a55;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3ec;
  --warn: #b5541c;
  --warn-soft: #fbeee5;
  --minus: #c2410c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .04), 0 6px 24px rgba(20, 30, 25, .06);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412;
    --surface: #171c19;
    --surface-2: #1e2420;
    --ink: #e8ece9;
    --ink-2: #b3bdb7;
    --ink-3: #85918a;
    --line: #2a322d;
    --accent: #3ccf96;
    --accent-ink: #06231a;
    --accent-soft: #15302456;
    --warn: #f0a070;
    --warn-soft: #3a261a;
    --minus: #f59e6b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }

/* ── 머리말 ── */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; flex: none; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; font-weight: 900; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; font-weight: 600; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 420px) {
  .site-head .wrap { gap: 8px; }
  .logo { font-size: 0; gap: 0; }
  .nav { margin-left: 0; }
  .nav a { padding: 6px 6px; font-size: 13.5px; }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ── 제목 영역 ── */
.page-head { padding: 36px 0 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
h1 { font-size: clamp(26px, 4.4vw, 36px); line-height: 1.25; letter-spacing: -.03em; margin: 12px 0 8px; }
.lede { color: var(--ink-2); margin: 0; max-width: 640px; }

/* ── 계산기 배치 ── */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .tool { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.result { position: sticky; top: 76px; }
@media (max-width: 820px) { .result { position: static; } }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 14.5px; margin-bottom: 7px; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

.input-wrap { position: relative; display: flex; align-items: center; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input-wrap input { padding-right: 38px; text-align: right; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.input-wrap .unit { position: absolute; right: 13px; color: var(--ink-3); font-weight: 600; pointer-events: none; }
.amount-ko { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 6px; min-height: 1.2em; text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { flex: 1; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 6px; border-radius: 8px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 20px; cursor: pointer; flex: none; }
.stepper button:hover { color: var(--accent); }
.stepper output { flex: 1; text-align: center; font-weight: 700; font-size: 17px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

details.more { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 6px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 14.5px; color: var(--ink-2); list-style: none; }
details.more summary::before { content: '＋ '; color: var(--accent); }
details.more[open] summary::before { content: '－ '; }
details.more[open] summary { margin-bottom: 14px; }

/* ── 결과 ── */
.result-label { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.big { font-size: clamp(32px, 6vw, 42px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.big small { font-size: .5em; font-weight: 700; margin-left: 2px; }
.sub { color: var(--ink-2); font-size: 14.5px; }
.sub b { color: var(--ink); }

.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 18px 0 6px; }
.bar i { display: block; height: 100%; transition: width .3s; }
.bar-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.bar-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--c); }

.lines { margin: 16px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.lines li span:first-child { color: var(--ink-2); }
.lines li .num { font-weight: 600; }
.lines li.total { font-weight: 800; border-bottom: 0; }
.lines li.total span:first-child { color: var(--ink); }
.lines .minus { color: var(--minus); }
.lines .note { font-size: 12.5px; color: var(--ink-3); margin-left: 4px; }

.notice { margin-top: 14px; font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.btn { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); color: var(--accent-ink); }

/* ── 본문 ── */
.content { margin: 48px auto 0; max-width: 760px; }
.content h2 { font-size: 22px; letter-spacing: -.02em; margin: 40px 0 12px; }
.content h3 { font-size: 17px; margin: 24px 0 8px; }
.content p, .content li { color: var(--ink-2); }
.content strong { color: var(--ink); }
.content ul, .content ol { padding-left: 20px; }
.formula { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14.5px; color: var(--ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); font-size: 13px; color: var(--ink-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.pick { cursor: pointer; }
tbody tr.pick:hover td { background: var(--accent-soft); }
td.strong { font-weight: 700; color: var(--ink); }
.table-scroll { max-height: 520px; overflow-y: auto; }

.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '＋'; color: var(--accent); flex: none; }
.faq details[open] summary::after { content: '－'; }
.faq p { margin: 10px 0 0; }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 19px; margin-bottom: 10px; }
.tile b { display: block; font-size: 16.5px; }
.tile span { display: block; color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }

.site-foot { margin-top: 72px; border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13px; color: var(--ink-3); }
.site-foot p { margin: 4px 0; }
.site-foot a { color: var(--ink-2); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
