/* 셈셈 — 디자인 토큰 */
:root {
  --bg: #f2f4f6; --surface: #ffffff; --surface-2: #f9fafb;
  --text: #191f28; --text-2: #4e5968; --muted: #8b95a1; --line: #e5e8eb;
  --accent: #0a8f6a; --accent-strong: #067255; --accent-soft: #e8f6f1; --on-accent: #ffffff;
  --minus: #4e5968; --warn: #d4570b; --warn-soft: #fff4ec;
  --radius: 20px; --radius-sm: 12px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214; --surface: #1b1e22; --surface-2: #23272c;
    --text: #f2f4f6; --text-2: #c1c7cf; --muted: #8b95a1; --line: #2e333a;
    --accent: #34c796; --accent-strong: #5fd8ad; --accent-soft: #15302a; --on-accent: #06140f;
    --minus: #c1c7cf; --warn: #ff9a57; --warn-soft: #33221a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6; letter-spacing: -0.01em;
  word-break: keep-all; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.025em; }
p, li { text-wrap: pretty; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 헤더 */
.top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 8px; height: 58px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--text); letter-spacing: -0.03em; margin-right: 12px; }
.logo:hover { text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: .9rem; font-weight: 800; }
.gnb { display: none; gap: 4px; }
.gnb a { padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .95rem; }
.gnb a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.gnb a[aria-current] { color: var(--accent-strong); }
.top-actions { margin-left: auto; display: flex; gap: 2px; }
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
@media (min-width: 760px) { .gnb { display: flex; } }
main { padding: 4px 0 56px; }
html.locked { overflow: hidden; }

/* 메뉴·검색 레이어 */
.layer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .15s; }
.layer.on { opacity: 1; }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 88vw); background: var(--surface); overflow-y: auto; padding: 0 20px 32px; transform: translateX(24px); transition: transform .2s; }
.layer.on .sheet { transform: none; }
.sheet-head { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 62px; margin: 0 -4px 0 0; }
.sheet-head strong { font-size: 1.1rem; }
.menu-cat { padding: 14px 0; border-top: 1px solid var(--line); }
.menu-cat-title { display: block; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.menu-cat ul { list-style: none; margin: 0; padding: 0; }
.menu-cat li a { display: block; padding: 8px 0; color: var(--text-2); }
.menu-links { display: flex; flex-direction: column; gap: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.menu-links a { color: var(--muted); font-size: .9rem; padding: 6px 0; }
.sheet-search { left: 0; right: 0; width: auto; bottom: auto; max-height: 85vh; max-width: 640px; margin: 0 auto; border-radius: 0 0 20px 20px; transform: translateY(-16px); padding-bottom: 12px; }
.sheet-search .sheet-head { height: 74px; }
.sheet-search .search { flex: 1; }

/* 페이지 폭: 계산기·홈 외에는 읽기 좋은 폭 */
main:not(.home) > .card, main:not(.home) > .page-head, main:not(.home) > .crumbs { max-width: 760px; }

/* 계산기: PC에서 2단 (결과 오른쪽 고정) */
@media (min-width: 960px) {
  .calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 20px; row-gap: 0; align-items: start; }
  .calc-grid > * { grid-column: 1; margin: 0 0 12px !important; }
  .calc-grid > .result { grid-column: 2; grid-row: 1 / span 99; position: sticky; top: 74px; }
  .page-head h1 { font-size: 2rem; }
}

/* 페이지 머리 */
.crumbs { font-size: .85rem; color: var(--muted); margin: 8px 2px 0; }
.crumbs a { color: var(--muted); }
.page-head { margin: 6px 2px 18px; }
.page-head h1 { font-size: 1.65rem; line-height: 1.3; margin: 0 0 6px; font-weight: 800; }
.page-head p { margin: 0; color: var(--text-2); font-size: 1rem; }

/* 카드 */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px 20px; }
.card + .card { margin-top: 12px; }

/* 폼 */
.fields { display: grid; gap: 22px; }
.row2 { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
@media (max-width: 340px) { .row2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field[hidden], .fields[hidden], .toggle[hidden], .chips[hidden] { display: none; }
.label, label.label { font-size: .9rem; font-weight: 600; color: var(--text-2); }
.hint { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.hint:empty { display: none; }
input, select, textarea { font: inherit; color: var(--text); }
.input {
  width: 100%; height: 56px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface); font-size: 1.15rem; font-weight: 600;
  letter-spacing: -0.02em; transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
.unit { position: relative; display: block; }
.unit .input { padding-right: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.unit[data-unit="kWh"] .input { padding-right: 62px; }
.unit::after { content: attr(data-unit); position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; font-weight: 500; pointer-events: none; }
.money-read { font-size: .85rem; color: var(--accent-strong); font-weight: 600; text-align: right; margin-top: -2px; }
.money-read:empty { display: none; }
input[type=date].input { text-align: left; font-size: 1rem; padding: 0 10px; min-width: 0; }
textarea.input { height: auto; min-height: 200px; padding: 14px 16px; font-size: 1rem; font-weight: 400; line-height: 1.65; letter-spacing: 0; resize: vertical; display: block; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 25px, calc(100% - 16px) 25px; background-size: 6px 6px; background-repeat: no-repeat; }

/* 빠른 입력 칩: 한 줄 가로 스크롤 */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text-2); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.chip:hover { color: var(--accent-strong); }
.chip:active { transform: scale(.97); }
.chips.pick { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 스테퍼 (− 1명 +) */
.stepper { display: flex; align-items: center; height: 56px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); overflow: hidden; }
.stepper button { flex: none; width: 52px; height: 100%; border: 0; background: transparent; color: var(--text-2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.stepper button:disabled { color: var(--line); cursor: default; }
.stepper button:not(:disabled):active { background: var(--surface-2); }
.stepper output { flex: 1; text-align: center; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 세그먼트 */
.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); }
.seg label { flex: 1; position: relative; text-align: center; padding: 10px 6px; border-radius: 9px; cursor: pointer; font-size: .92rem; font-weight: 600; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 토글 */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle span { font-size: .95rem; color: var(--text); font-weight: 500; }
.toggle input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }

/* 결과 */
.result { margin-top: 12px; padding: 0; overflow: hidden; }
.result-hero { padding: 22px 20px 20px; background: var(--accent-soft); }
.result-label { font-size: .92rem; font-weight: 600; color: var(--accent-strong); }
.big { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--text); }
.sub { font-size: .9rem; color: var(--text-2); margin-top: 4px; }
.sub.warn { color: var(--warn); font-weight: 600; }
.hint.warn { color: var(--warn); }
.lines { list-style: none; margin: 0; padding: 8px 20px 12px; }
.lines li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; font-size: .97rem; }
.lines li + li { border-top: 1px solid var(--line); }
.lines .k { color: var(--text-2); }
.lines .k small { color: var(--muted); font-size: .82rem; margin-left: 4px; }
.lines .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .v.minus { color: var(--minus); font-weight: 500; }
.lines li.total { padding-top: 14px; }
.lines li.total .k, .lines li.total .v { color: var(--text); font-weight: 700; }
.result h3 { font-size: 1rem; margin: 8px 20px 4px; }
.result .scroll { padding: 0 20px 16px; }
.basis { font-size: .8rem; color: var(--muted); padding: 12px 20px 16px; border-top: 1px solid var(--line); margin: 0; }
.btn { font: inherit; font-size: .92rem; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text-2); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }

/* 하단 고정 결과 바 (결과 카드가 화면 밖일 때) */
.peek { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; transform: translateY(120%); transition: transform .25s ease; }
.peek.show { transform: none; }
.peek a { pointer-events: auto; max-width: 616px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 16px; background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.peek a:hover { text-decoration: none; }
.peek .pk { font-size: .88rem; opacity: .75; }
.peek .pv { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* 표 */
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 8px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: .8rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
tbody tr + tr td { border-top: 1px solid var(--line); }
tr.hl td { font-weight: 700; color: var(--accent-strong); }
td.wrap-ok { white-space: normal; text-align: left; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 본문 */
.doc { margin-top: 12px; }
.doc h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 12px; }
.doc h3 { font-size: 1rem; font-weight: 700; margin: 22px 0 6px; }
.doc p { margin: 0 0 12px; color: var(--text-2); line-height: 1.75; }
.doc p:last-child { margin-bottom: 0; }
.doc ul { margin: 0 0 12px; padding-left: 0; list-style: none; }
.doc li { position: relative; padding-left: 14px; color: var(--text-2); line-height: 1.7; margin: 6px 0; }
.doc li::before { content: ""; position: absolute; left: 2px; top: .72em; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.doc b, .doc strong { color: var(--text); font-weight: 600; }
.doc .scroll { margin: 4px 0 12px; }
.doc .note { font-size: .85rem; color: var(--muted); }
.formula { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 12px; font-weight: 600; color: var(--text); line-height: 1.6; box-shadow: inset 0 0 0 1px var(--line); }
.formula small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* FAQ */
.faq details { border-top: 1px solid var(--line); }
.faq details:first-of-type { border-top: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 15px 28px 15px 0; font-weight: 600; position: relative; line-height: 1.5; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details > div { padding: 0 0 16px; color: var(--text-2); line-height: 1.7; }

/* 출처 */
.sources ul { list-style: none; margin: 0; padding: 0; }
.sources li { font-size: .88rem; padding: 4px 0; }
.sources li::before { display: none; }
.sources li a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* 목록형 링크 (홈·관련 계산기) */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 0; color: var(--text); }
.item:hover { text-decoration: none; }
.item:hover strong { color: var(--accent-strong); }
.ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: .95rem; letter-spacing: -0.04em; }
.item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-text strong { font-size: 1rem; font-weight: 600; }
.item-text span { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item::after { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid var(--line); border-top: 2px solid var(--line); transform: rotate(45deg); margin-right: 4px; }
.card > h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }
.card > h2 + .list .item:first-child { padding-top: 10px; }

/* 홈 */
.hero { padding: 28px 2px 22px; }
.hero h1 { font-size: 1.9rem; line-height: 1.28; margin: 0 0 10px; font-weight: 800; }
.hero p { margin: 0 0 18px; color: var(--text-2); max-width: 520px; }
.search { width: 100%; height: 54px; border: 0; border-radius: 16px; background: var(--surface); padding: 0 16px; font: inherit; font-size: 1rem; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.search:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.search-btn { display: flex; align-items: center; gap: 10px; max-width: 560px; color: var(--muted); cursor: pointer; text-align: left; }
.search-btn:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.sec-title { font-size: 1.15rem; font-weight: 700; margin: 26px 2px 12px; }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pop { display: flex; flex-direction: column; gap: 2px; padding: 18px; border-radius: var(--radius); background: var(--surface); color: var(--text); min-height: 132px; }
.pop:hover { text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.pop .ico { margin-bottom: 10px; }
.pop strong { font-size: 1.05rem; font-weight: 700; }
.pop span:last-child { font-size: .85rem; color: var(--muted); line-height: 1.45; }
.cat { margin-top: 12px; }
.cat:first-of-type { margin-top: 0; }
.cat-head { display: flex; justify-content: space-between; align-items: baseline; }
.cat-head h3 { margin: 0; font-size: 1.05rem; }
.cat-head h3 a { color: var(--text); }
.more { font-size: .85rem; color: var(--muted); }
.changes { list-style: none; margin: 0; padding: 0; }
.changes li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; }
.changes li + li { border-top: 1px solid var(--line); }
.ch-what { display: flex; flex-direction: column; font-size: .95rem; font-weight: 600; }
.ch-what small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.ch-val { white-space: nowrap; font-size: .92rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ch-val s { color: var(--muted); }
.ch-val b { color: var(--accent-strong); }
.card .note, .doc .note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.trust { display: grid; gap: 16px; }
.trust div { display: flex; flex-direction: column; gap: 2px; }
.trust strong { font-size: .98rem; }
.trust span { font-size: .88rem; color: var(--text-2); line-height: 1.55; }
@media (min-width: 760px) {
  .hero { padding: 48px 2px 30px; }
  .hero h1 { font-size: 2.5rem; }
  .pop-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 960px) {
  .home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
}
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chips .chip { text-decoration: none; }

/* 업데이트 타임라인 */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { padding: 16px 0; }
.timeline > li + li { border-top: 1px solid var(--line); }
.timeline > li:first-child { padding-top: 0; }
.tl-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .85rem; color: var(--muted); }
.timeline ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: .93rem; }
.tag { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag-rule { background: var(--accent-soft); color: var(--accent-strong); }
.tag-new { background: #eef3ff; color: #3563e9; }
@media (prefers-color-scheme: dark) { .tag-new { background: #1d2740; color: #8fb0ff; } }

/* 푸터 */
.foot { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; line-height: 1.6; padding: 32px 0 calc(40px + env(safe-area-inset-bottom)); }
.foot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 16px; margin-bottom: 24px; }
@media (min-width: 760px) { .foot-grid { grid-template-columns: repeat(5, 1fr); } }
.foot-title { display: block; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li a { display: block; padding: 3px 0; color: var(--text-2); }
.foot-note { margin: 0 0 8px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 760px; }
.foot-copy { margin: 0; }

/* 본문 안의 항목 리스트 */
.doc .lines { padding: 0; margin: 0 0 12px; }
.doc .lines li { padding: 10px 0; margin: 0; color: var(--text-2); }
.doc .lines li::before { display: none; }
.doc .lines .v { color: var(--text); }
.result > h3 { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 숫자 입력 화살표 숨김 */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=date].input { font-size: .95rem; }
input[type=date]::-webkit-calendar-picker-indicator { margin: 0; padding: 0; }
@media (min-width: 760px) { .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }
.card > .list:first-child > li:first-child .item { padding-top: 0; }
.card .list > li:last-child .item { padding-bottom: 0; }

/* 광고 자리 (site.config adsenseClient·adSlots 있을 때만 출력). 높이를 미리 잡아 화면 밀림 방지 */
.ad { margin: 12px 0 0; min-height: 300px; overflow: hidden; }
.ad + .card { margin-top: 12px; }
.ad-label { display: block; font-size: .72rem; color: var(--muted); margin: 0 4px 4px; }
.ad ins.adsbygoogle { min-height: 280px; }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }

/* 홈 분야 바로가기 */
.home-jump { margin: 0 0 4px; }
.cat[id] { scroll-margin-top: 74px; }
