/* 계산해줘(사이트 이름은 site.config.siteName) 디자인 v2 (contracts 16절, docs/design.md). 모바일 우선, CSS 라이브러리 없음.
   글꼴은 layout.js 가 head 에 넣는 Pretendard 링크로 불러온다(이 파일은 외부 글꼴 파일을 직접 불러오지 않음).
   계산기 본문 상세(2열 래퍼·결과 카드·표·해설)는 챕터 21 이 이 파일 맨 아래 "3~5절" 부분에 덧붙였다. 위쪽은 기본형. */

/* ---------- 1. 기초: 변수 ---------- */
:root {
  /* 색 */
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text-1: #191f28;
  --text-2: #4e5968;
  --text-3: #8b95a1;
  --line: #e5e8eb;
  --brand: #3182f6;
  --brand-strong: #1b64da;
  --brand-weak: #e8f3ff;
  --pos: #0ca678;
  --neg: #f04452;
  --warn: #f59f00;
  --warn-weak: #fff8e6;
  /* 분류 색 (아이콘 배경만): 원색 + 12% 투명도 배경 */
  --cat-pay: #3182f6;
  --cat-leave: #8b5cf6;
  --cat-finance: #12b886;
  --cat-realestate: #ff8a3d;
  --cat-tax: #e64980;
  --cat: var(--brand);
  --cat-weak: #3182f61f;
  /* 글꼴 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  /* 크기 단계 (rem, 루트 16px 기준) */
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-15: .9375rem;
  --fs-17: 1.0625rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-28: 1.75rem;
  --fs-36: 2.25rem;
  --fs-44: 2.75rem;
  /* 굵기 */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  /* 간격 4px 단위 */
  --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-40: 40px;
  --sp-56: 56px;
  --card-pad: 20px;
  --card-gap: 12px;
  /* 모서리 */
  --radius-card: 20px;
  --radius-input: 12px;
  --radius-chip: 999px;
  /* 그림자 */
  --shadow-card: 0 1px 3px rgba(0,0,0,.04);
  --shadow-float: 0 8px 24px rgba(0,0,0,.08);
  /* 전환 */
  --ease: 150ms ease;
  /* 머리글 높이 */
  --header-h: 60px;
}

/* 분류 색 지정 */
[data-category="급여"] { --cat: #3182f6; --cat-weak: #3182f61f; }
[data-category="퇴사"] { --cat: #8b5cf6; --cat-weak: #8b5cf61f; }
[data-category="금융"] { --cat: #12b886; --cat-weak: #12b8861f; }
[data-category="부동산"] { --cat: #ff8a3d; --cat-weak: #ff8a3d1f; }
[data-category="세금"] { --cat: #e64980; --cat-weak: #e649801f; }

/* ---------- 기본 요소 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--text-2);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--text-1); letter-spacing: -0.02em; line-height: 1.35; font-weight: var(--fw-bold); }
h1 { font-size: var(--fs-24); margin: 0 0 var(--sp-8); }
h2 { font-size: var(--fs-20); margin: var(--sp-32) 0 var(--sp-12); }
h3 { font-size: var(--fs-17); margin: var(--sp-24) 0 var(--sp-8); }
p { margin: 0 0 var(--sp-12); }
a { color: var(--brand-strong); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
svg.icon { flex: none; display: block; }
table, input, select, [data-main], .result-table, .data-table { font-variant-numeric: tabular-nums; }
.search-label, .drawer-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 페이지 폭: 콘텐츠 최대 1120px 중앙 */
main { max-width: 1120px; margin: 0 auto; padding: var(--sp-16) var(--sp-16) var(--sp-56); }

/* ---------- 2. 머리글 ---------- */
.site-header { position: sticky; top: 0; z-index: 20; height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner { max-width: 1120px; height: 100%; margin: 0 auto; padding: 0 var(--sp-16); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-16); }
.site-name { display: inline-flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-17); font-weight: var(--fw-bold); letter-spacing: -0.02em; color: var(--text-1); text-decoration: none; }
.site-name:hover { color: var(--text-1); }
.logo-mark { display: block; flex: none; width: 28px; height: 28px; } /* 심볼 SVG (docs/brand.md) */
.wordmark { font-weight: 800; letter-spacing: -0.03em; }
.site-name .wordmark { color: #191f28; }
.brand-accent { color: var(--brand); }
.footer-brand .wordmark { color: #fff; }

/* 데스크톱 메가 메뉴 (≥1024px 에서만 보임) */
.nav-desktop { display: none; }
.nav-cats { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--sp-4); height: 100%; }
.nav-cat { position: relative; display: flex; align-items: center; }
.nav-cat-link { display: inline-flex; align-items: center; gap: var(--sp-4); min-height: 44px; padding: 0 var(--sp-12); border-radius: var(--radius-input); font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-2); text-decoration: none; transition: background var(--ease), color var(--ease); }
.nav-cat-link svg { width: 16px; height: 16px; color: var(--text-3); transition: transform var(--ease); }
.nav-cat:hover .nav-cat-link, .nav-cat:focus-within .nav-cat-link { background: var(--surface-2); color: var(--text-1); }
.nav-cat:hover .nav-cat-link svg, .nav-cat:focus-within .nav-cat-link svg { transform: rotate(180deg); }
.mega { position: absolute; top: 100%; left: 0; z-index: 30; width: 560px; padding: var(--sp-12); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-float); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity var(--ease), transform var(--ease), visibility var(--ease); }
.mega ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.mega a { display: flex; align-items: flex-start; gap: var(--sp-12); min-height: 44px; padding: var(--sp-12); border-radius: var(--radius-input); text-decoration: none; color: var(--text-1); }
.mega a:hover, .mega a:focus-visible { background: var(--surface-2); }
.mega-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mega-text strong { font-size: var(--fs-15); font-weight: var(--fw-semibold); }
.mega-text span { font-size: var(--fs-13); color: var(--text-3); line-height: 1.45; }
.nav-cat:hover .mega, .nav-cat:focus-within .mega { opacity: 1; visibility: visible; transform: translateY(0); }

/* 아이콘 원 (분류 색 12% 배경 + 원색 아이콘) */
.calc-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--cat-weak); color: var(--cat); }

/* 모바일 서랍 (details 기반 전체 화면) */
.drawer > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-input); color: var(--text-1); cursor: pointer; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary:hover { background: var(--surface-2); }
.drawer .icon-close, .drawer[open] .icon-menu { display: none; }
.drawer[open] .icon-close { display: block; }
.drawer-panel { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: 30; overflow-y: auto; padding: var(--sp-8) var(--sp-16) var(--sp-40); background: var(--surface); }
.drawer-panel ul { list-style: none; margin: 0; padding: 0; }
.drawer-panel .nav-group { padding: var(--sp-12) 0; border-bottom: 1px solid var(--line); }
.drawer-panel .nav-group > span { display: block; padding: var(--sp-4) 0; font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text-2); }
.drawer-panel .nav-group a { display: flex; align-items: center; gap: var(--sp-12); min-height: 52px; color: var(--text-1); font-size: var(--fs-15); font-weight: var(--fw-medium); text-decoration: none; }
.drawer-panel .calc-icon { width: 32px; height: 32px; }
.drawer-panel .calc-icon svg { width: 20px; height: 20px; }

/* ---------- 바닥글 ---------- */
.site-footer { background: #191f28; color: #8b95a1; font-size: var(--fs-13); }
.site-footer-inner { max-width: 1120px; margin: 0 auto; padding: var(--sp-40) var(--sp-16) var(--sp-56); }
.site-footer a { color: rgba(255,255,255,.8); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer p { margin: var(--sp-4) 0; }
.footer-brand { display: flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-17); font-weight: var(--fw-bold); color: #fff; }
.footer-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-24) var(--sp-16); margin: var(--sp-24) 0; }
.footer-col strong { display: block; margin-bottom: var(--sp-8); font-size: var(--fs-14); color: #fff; }
.footer-col ul, .footer-links { list-style: none; margin: 0; padding: 0; }
.footer-col li { padding: var(--sp-4) 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--sp-8) var(--sp-16); padding: var(--sp-16) 0; margin-bottom: var(--sp-8); border-top: 1px solid rgba(255,255,255,.1); }
.footer-links a { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- 페이지 머리 영역 (카드 밖, 배경 위) ---------- */
.page-head { padding: var(--sp-16) 0 var(--sp-24); }
.crumbs ol { list-style: none; margin: 0 0 var(--sp-8); padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: var(--fs-13); color: var(--text-3); }
.crumbs li + li::before { content: "›"; margin-right: var(--sp-4); }
.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--text-2); text-decoration: underline; }
.page-head h1 { font-size: var(--fs-24); margin: 0; }
.page-summary { margin: var(--sp-8) 0 0; font-size: var(--fs-15); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: var(--sp-12) 0 0; }

/* ---------- 공통 구성 요소 ---------- */
.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--card-pad); margin: 0 0 var(--card-gap); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2 { font-size: var(--fs-20); }

.chip { display: inline-flex; align-items: center; gap: var(--sp-4); min-height: 32px; padding: 0 var(--sp-12); border-radius: var(--radius-chip); background: var(--brand-weak); color: var(--brand-strong); font-size: var(--fs-13); font-weight: var(--fw-semibold); text-decoration: none; }
a.chip:hover { background: #d6e8ff; color: var(--brand-strong); }

.btn, .copy-link, .share-link { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-8); min-height: 52px; padding: 0 var(--sp-20); font-family: inherit; font-size: var(--fs-15); font-weight: var(--fw-semibold); color: #fff; background: var(--brand); border: 1px solid transparent; border-radius: var(--radius-input); cursor: pointer; text-decoration: none; transition: background var(--ease); }
.btn:hover { background: var(--brand-strong); color: #fff; }
.btn:active { background: var(--brand-strong); }
.btn-ghost, .copy-link, .share-link { color: var(--text-1); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover, .copy-link:hover, .share-link:hover { background: var(--surface-2); color: var(--text-1); }
.copy-link-fallback { width: 100%; margin-top: var(--sp-8); padding: var(--sp-8); font-size: var(--fs-15); font-family: inherit; }
.share { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: 0 0 var(--sp-16); }

.badge { display: inline-flex; align-items: center; padding: 2px var(--sp-8); border-radius: var(--radius-chip); background: var(--brand-weak); color: var(--brand-strong); font-size: var(--fs-12); font-weight: var(--fw-semibold); vertical-align: middle; }
.badge-provisional { display: inline-flex; align-items: center; margin-left: var(--sp-8); padding: 2px var(--sp-8); border-radius: var(--radius-chip); background: var(--warn-weak); color: #8a5a00; font-size: var(--fs-12); font-weight: var(--fw-semibold); vertical-align: middle; }
.notes { margin: var(--sp-16) 0 0; padding: 0; list-style: none; font-size: var(--fs-13); color: var(--text-2); }
.notes li { position: relative; padding-left: 22px; margin-bottom: var(--sp-4); }
.notes li::before { content: "i"; position: absolute; left: 0; top: .2em; width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 10px; font-weight: var(--fw-bold); line-height: 13px; text-align: center; }

/* 입력칸 기본형 (상세는 챕터 21) */
.calc-form { display: grid; gap: var(--sp-20); }
.field { display: flex; flex-direction: column; gap: var(--sp-8); }
.field > label { font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--text-2); }
.field > label.check { display: flex; align-items: center; gap: var(--sp-8); min-height: 44px; font-weight: var(--fw-medium); color: var(--text-1); }
.calc-form input, .calc-form select { width: 100%; min-height: 52px; padding: 0 var(--sp-16); font-family: inherit; font-size: var(--fs-17); font-weight: var(--fw-semibold); color: var(--text-1); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-input); transition: background var(--ease), border-color var(--ease); }
.calc-form input:focus, .calc-form select:focus { outline: none; background: var(--surface); border: 2px solid var(--brand); }
.calc-form input[type="checkbox"], .calc-form input[type="radio"] { width: 22px; min-height: 22px; height: 22px; margin: 0; padding: 0; accent-color: var(--brand); }
.field-help, .help { margin: 0; font-size: var(--fs-13); color: var(--text-3); }
.field-error { margin: 0; font-size: var(--fs-13); color: #d92d3c; }
.man-hint { margin: 0; min-height: 1.5em; font-size: var(--fs-13); color: var(--brand-strong); }

/* 결과·표·해설 기본형 (상세는 챕터 21) */
.result-card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: var(--card-pad); margin: 0 0 var(--card-gap); }
.result { margin: 0; }
.result h2 { margin-top: 0; font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--text-2); }
.result-error { color: #d92d3c; }
[data-main] { display: block; font-size: 36px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; color: var(--text-1); }
.result-table { width: 100%; }
.table-wrap, .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: var(--sp-8) var(--sp-8); border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); color: var(--text-2); font-size: var(--fs-13); font-weight: var(--fw-semibold); }
table caption { text-align: left; font-weight: var(--fw-bold); padding: var(--sp-4) 0; color: var(--text-1); }
.data-table { min-width: 100%; }
.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.is-current td, .is-current th { background: var(--brand-weak); }
.ad-row td { padding: var(--sp-8) 0; background: var(--surface); }
.provisional-items { margin-top: var(--sp-12); padding: var(--sp-12); border-radius: var(--radius-input); background: var(--warn-weak); font-size: var(--fs-14); }
.provisional-items p, .provisional-items ul { margin: var(--sp-4) 0; }
.calc-extra-area section { margin: var(--sp-24) 0; }
.calc-basis { margin: var(--sp-24) 0; padding: var(--card-pad); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); font-size: var(--fs-14); }
.calc-basis h2 { margin-top: 0; font-size: var(--fs-17); }
.lead { color: var(--text-2); }
.guide { margin: var(--sp-32) 0; }
.guide h2 { margin-top: var(--sp-32); }
.faq details { margin-bottom: var(--sp-8); border-radius: var(--radius-input); background: var(--surface); }
.faq summary { min-height: 56px; display: flex; align-items: center; padding: 0 var(--sp-16); cursor: pointer; font-weight: var(--fw-semibold); color: var(--text-1); }
.faq details > :not(summary) { padding: 0 var(--sp-16); }
.updated { font-size: var(--fs-14); color: var(--text-2); }
.data-date { color: var(--text-3); font-size: var(--fs-13); }
.update-list { padding-left: var(--sp-20); }
.update-list li { margin-bottom: var(--sp-8); }
.update-list time { color: var(--text-3); font-size: var(--fs-13); }

/* side 광고 열: 1280px 이상에서만 보인다 (아래 계산기 페이지 절). */
.calc-aside { display: none; }

/* ---------- 6. 홈 ---------- */
.hero { margin: 0 calc(var(--sp-16) * -1) var(--sp-24); padding: 48px var(--sp-16); background: var(--surface); text-align: center; }
.hero h1 { font-size: var(--fs-28); margin: 0 0 var(--sp-12); }
.hero-desc { max-width: 560px; margin: 0 auto var(--sp-24); color: var(--text-2); }
.search { position: relative; max-width: 560px; margin: 0 auto; }
.search svg { position: absolute; left: var(--sp-16); top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 56px; padding: 0 var(--sp-16) 0 52px; font-family: inherit; font-size: var(--fs-17); color: var(--text-1); background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; transition: border-color var(--ease), background var(--ease); }
.search input::placeholder { color: var(--text-3); }
.search input:focus { outline: none; background: var(--surface); border: 2px solid var(--brand); }
.search-empty { margin: var(--sp-16) 0 0; color: var(--text-2); }
.popular h2, .calc-category h2 { font-size: var(--fs-20); margin: var(--sp-32) 0 var(--sp-12); }
.popular-grid, .cat-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--card-gap); }
.calc-card a { display: flex; flex-direction: column; gap: var(--sp-4); height: 100%; min-height: 148px; padding: var(--sp-16); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); color: var(--text-1); text-decoration: none; transition: box-shadow var(--ease), transform var(--ease); }
.calc-card a:hover { box-shadow: var(--shadow-float); color: var(--text-1); }
.calc-card .calc-icon { margin-bottom: var(--sp-8); }
.calc-card h3 { margin: 0; font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-1); }
.calc-card p { margin: 0; font-size: var(--fs-13); line-height: 1.5; color: var(--text-3); }
.calc-card-lg a { min-height: 168px; padding: var(--sp-20); }
.calc-card-lg h3 { font-size: var(--fs-17); }
.calc-card-lg .calc-icon { width: 48px; height: 48px; }
.calc-card[hidden], .popular[hidden], .calc-category[hidden] { display: none; }
.trust { list-style: none; margin: var(--sp-40) 0 0; padding: var(--sp-20); display: grid; grid-template-columns: 1fr; gap: var(--sp-12); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.trust li { display: flex; align-items: center; gap: var(--sp-12); font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-1); }

/* ---------- 광고 자리: 레이아웃 이동(CLS)을 막기 위해 높이를 미리 잡는다 ---------- */
.ad-slot { margin: var(--sp-16) 0; text-align: center; overflow: hidden; }
.ad-label { display: block; font-size: .75rem; color: #6b7280; text-align: left; margin-bottom: var(--sp-4); }
.ad-top { min-height: 100px; margin-bottom: var(--sp-24); }
.ad-afterResult { min-height: 250px; }
.ad-inTable { min-height: 100px; }
.ad-middle { min-height: 280px; }
.ad-bottom { min-height: 280px; }
.ad-side { min-height: 600px; }
.ad-notice { font-size: var(--fs-13); color: var(--text-2); }
.ad-disclosure { font-size: var(--fs-12); color: var(--text-2); }

@media (min-width: 600px) {
  .trust { grid-template-columns: repeat(3, 1fr); }
}

/* 960px 이상: 큰 광고 높이 (side 광고 열은 챕터 21 부터 1280px 이상, 아래 계산기 페이지 절) */
@media (min-width: 960px) {
  .ad-afterResult { min-height: 280px; }
}

/* 1024px 이상: 데스크톱 메가 메뉴, 큰 제목·숫자, 넓은 카드 여백 */
@media (min-width: 1024px) {
  :root { --card-pad: 28px; --card-gap: 16px; }
  .nav-desktop { display: block; height: 100%; }
  .drawer { display: none; }
  .site-header-inner { justify-content: flex-start; gap: var(--sp-32); }
  h1, .page-head h1 { font-size: var(--fs-28); }
  [data-main] { font-size: 44px; }
  .hero h1 { font-size: 2.5rem; }
  .popular-grid, .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-cats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero { margin-left: 0; margin-right: 0; border-radius: var(--radius-card); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .ad-slot, .calc-aside, .drawer, .nav-desktop, .share, .search { display: none !important; }
  body { background: #fff; }
  .site-header { position: static; }
  .card, .result-card { box-shadow: none; }
}

/* =====================================================================
   챕터 21: 디자인 v2 — 계산기 페이지·결과 카드·표·해설 (docs/design.md 3·4·5절, contracts 16절)
   위 기본형에 덧붙인다. 인라인 style 은 광고 ins 의 display 와 비율 막대 구간 width 만 쓴다.
   ===================================================================== */

/* ---------- 3. 계산기 페이지: 머리 영역 → 입력|결과 2열 ---------- */
.page-head .ad-notice { margin: var(--sp-8) 0 0; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); align-items: start; margin: 0 0 var(--card-gap); }
.calc-input, .calc-output { min-width: 0; }
.calc-input > .card, .calc-output > .result-card { margin: 0; }

/* 입력 카드 */
.calc-form .field > label { font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--text-2); }
.calc-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .calc-form select { height: 52px; min-height: 52px; }
.calc-form input::placeholder { color: var(--text-3); font-weight: var(--fw-regular); }
.calc-form input:focus, .calc-form select:focus { background-color: var(--surface); border-color: var(--brand); }
/* 금액 칸: 오른쪽 정렬 17px 600 + 칸 안 오른쪽 단위 '원' (build 가 money 입력을 .money-input 으로 감싼다) */
.money-input { position: relative; display: block; }
.money-input input { text-align: right; padding-right: 44px; font-size: var(--fs-17); font-weight: var(--fw-semibold); }
.money-input::after { content: "원"; position: absolute; right: var(--sp-16); top: 50%; transform: translateY(-50%); font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--text-3); pointer-events: none; }
.man-hint { color: var(--brand-strong); }
/* select: 같은 모양 + 오른쪽 꺾쇠 SVG (선택지 마크업은 그대로) */
.calc-form select, .calc-form select:focus {
  -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-16) center; background-size: 16px 16px;
}
/* 체크박스: 22px 둥근 사각, 브랜드 색 체크 */
.calc-form input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; display: inline-grid; place-content: center;
  width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 0;
  background: var(--surface); border: 1.5px solid #c9cfd6; border-radius: 6px; cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.calc-form input[type="checkbox"]::before { content: ""; width: 10px; height: 6px; margin-top: -2px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0); transition: transform var(--ease); }
.calc-form input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
.calc-form input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
.calc-form input[type="checkbox"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.field > label.check { min-height: 44px; cursor: pointer; }
/* 오류: 칸 테두리 --neg, 문구 13px (글자는 대비 4.5:1 을 위해 --neg 보다 한 단계 진한 빨강) */
.calc-form [aria-invalid="true"], .field:has(.field-error) input, .field:has(.field-error) select { border-color: var(--neg); }
.field-error { font-size: var(--fs-13); color: #d92d3c; }

/* 결과 카드 */
.result h2 { margin: 0 0 var(--sp-4); font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--text-2); }
.result h2 .badge-provisional, .result h2 .badge { margin-left: var(--sp-8); }
.result [data-main] { margin: 0 0 var(--sp-8); }
.result > p { margin: var(--sp-8) 0 0; font-size: var(--fs-13); color: var(--text-3); }
.result > p strong { color: var(--text-2); font-weight: var(--fw-semibold); }
.result .table-scroll, .result .table-wrap { margin: var(--sp-16) 0 0; }
/* 내역 표: 행 44px, 줄 구분선 없음, 항목명 text-2 · 금액 text-1 600, 합계 행 위 1px 선 + 700 */
.result-table, .result table { width: 100%; border-collapse: collapse; }
.result-table caption, .result table caption { padding: 0 0 var(--sp-4); font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--text-3); text-align: left; }
.result-table th, .result-table td, .result table th, .result table td { height: 44px; padding: 0; border: 0; background: none; font-size: var(--fs-15); }
.result-table th, .result table th { text-align: left; font-weight: var(--fw-regular); color: var(--text-2); }
.result-table td, .result table td { text-align: right; font-weight: var(--fw-semibold); color: var(--text-1); }
.result-table thead th, .result table thead th { height: 36px; font-size: var(--fs-13); color: var(--text-3); }
.result-table tfoot th, .result-table tfoot td, .result table tfoot th, .result table tfoot td { border-top: 1px solid var(--line); font-weight: var(--fw-bold); color: var(--text-1); }
/* 챕터 33: 결과 내역 표는 카드 폭 안에서 줄바꿈한다(기본 th,td 의 nowrap 때문에 긴 항목명·기간 문구가 모바일 카드 밖으로 밀려났다).
   금액은 공백이 없어 한 줄로 남고, 칸 사이는 왼쪽 여백으로 띄운다. 열이 많아 그래도 넘치는 표는 .table-scroll 래퍼 안에서 가로 스크롤된다. */
.result-table th, .result-table td, .result table th, .result table td { white-space: normal; }
.result-table td, .result table td, .result-table thead th + th, .result table thead th + th { padding-left: var(--sp-12); }
.result-error { color: #d92d3c; }
.result-error ul { margin: 0; padding-left: var(--sp-20); }
/* 예상 배지: --warn-weak 배경 + 진한 주황 글자(--warn 은 흰 배경 대비가 낮아 글자에는 한 단계 진한 색) 12px 600 둥근 칩 */
.badge-provisional { background: var(--warn-weak); color: #8a5a00; font-size: var(--fs-12); font-weight: var(--fw-semibold); border-radius: var(--radius-chip); }
/* 안내(notes): 13px, 앞에 ⓘ 원형 아이콘 */
.result .notes { color: var(--text-3); }
.result .notes li::before { color: var(--text-3); }
.provisional-items { font-size: var(--fs-13); }

/* 연봉 계산기: 실수령 + 공제 6항목 비율 막대(높이 12px, 둥근 끝)와 범례 칩 */
.deduction-bar { display: flex; width: 100%; height: 12px; margin: var(--sp-16) 0 var(--sp-12); overflow: hidden; border-radius: var(--radius-chip); background: var(--line); }
.deduction-bar .seg { display: block; height: 100%; min-width: 0; }
.deduction-bar .seg + .seg { box-shadow: -1px 0 0 var(--surface); }
.seg-net { background: var(--brand); }
.seg-pension { background: #4e5968; }
.seg-health { background: #6b7684; }
.seg-ltc { background: #8b95a1; }
.seg-employment { background: #b0b8c1; }
.seg-incomeTax { background: #c9cfd6; }
.seg-localTax { background: #dfe3e8; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8); margin: 0 0 var(--sp-8); padding: 0; }
.legend li { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 var(--sp-8); border-radius: var(--radius-chip); background: var(--surface-2); font-size: var(--fs-12); color: var(--text-2); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* 결과 카드 아래 버튼 줄: 링크 복사(보조 버튼), 공유(모바일만, 브라우저가 지원할 때 app.js 가 hidden 을 푼다) */
.calc-output .share { display: flex; gap: var(--sp-8); margin: var(--sp-12) 0 0; }
.calc-output .share .copy-link, .calc-output .share .share-link { flex: 1 1 0; }
.copy-link[hidden], .share-link[hidden] { display: none; }
.copy-link:active, .share-link:active { background: var(--line); }

/* 추가 영역 카드 (표·연도 비교·계산 기준 상자) */
.calc-extra-area.card > .extra > :first-child { margin-top: 0; }
.calc-extra-area .calc-basis { margin: var(--sp-24) 0 0; background: var(--surface-2); box-shadow: none; border-radius: 16px; }
.calc-extra-area h2 { font-size: var(--fs-20); }
.salary-table-link a, .salary-link a { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); text-decoration: none; }
.salary-table-link a::after, .salary-link a::after { content: " →"; white-space: pre; }

/* ---------- 4. 표 ---------- */
.data-table { border-collapse: separate; border-spacing: 0; }
.data-table th, .data-table td { height: 48px; padding: 0 var(--sp-12); border-bottom: 1px solid var(--line); font-size: var(--fs-15); white-space: nowrap; }
.data-table td { text-align: right; color: var(--text-1); }
.data-table tbody th { text-align: left; font-weight: var(--fw-semibold); color: var(--text-1); }
/* 머리 행 sticky. 가로 스크롤 래퍼 안에서는 래퍼가 스크롤 상자가 되므로 래퍼 높이를 제한하고 그 안에서 top:0 에 붙인다.
   1024px 이상(표가 폭에 들어가는 넓은 화면)은 래퍼 스크롤을 풀고 페이지 머리글(60px) 아래 top:60px 에 붙인다. */
.table-wrap:has(> .data-table) { max-height: 75vh; overflow: auto; border-radius: var(--radius-input); }
.data-table thead th { position: sticky; top: 0; z-index: 2; height: 44px; background: var(--surface-2); color: var(--text-3); font-size: var(--fs-13); font-weight: var(--fw-semibold); }
.data-table thead th.sticky-col { z-index: 3; }
.data-table .sticky-col { position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--line), 4px 0 8px -4px rgba(0,0,0,.08); }
.data-table thead .sticky-col { background: var(--surface-2); }
/* 사용자 연봉과 가장 가까운 행 강조 */
.data-table .is-current td, .data-table .is-current th { background: var(--brand-weak); }
.data-table .is-current th, .data-table .is-current .sticky-col { color: var(--brand-strong); font-weight: var(--fw-bold); }
/* 표 위 조건 막대 (연봉 실수령액 표: 연도·가족 수·자녀 수·비과세) — 모바일 2줄, 넓은 화면 한 줄 */
.table-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-12); }
.table-form .field > label { font-size: var(--fs-13); }
/* 표 안 광고 행: 위아래 8px, "광고" 라벨 왼쪽 위 */
.data-table .ad-row td { height: auto; padding: var(--sp-8) 0; text-align: left; white-space: normal; background: var(--surface); }
.ad-row .ad-slot { margin: 0; }
.ad-row .ad-label { text-align: left; }

/* ---------- 5. 해설·FAQ·예시·관련·갱신 기록 ---------- */
.guide { margin: var(--card-gap) 0; padding: var(--card-pad); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); font-size: var(--fs-15); line-height: 1.75; }
.guide > div { max-width: 720px; }
.guide > div + div { margin-top: var(--sp-40); }
.guide h2 { margin: 0 0 var(--sp-12); font-size: var(--fs-20); font-weight: var(--fw-bold); }
.guide h3 { font-size: var(--fs-17); margin: var(--sp-24) 0 var(--sp-8); }
/* 핵심 답 상자 (챕터 40, R117; docs/design.md 5절 카드): 해설 맨 위 질문형 소제목 17px 600 + 답 15px */
.guide > .answer-box { padding: var(--card-pad); background: var(--brand-weak); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.answer-box .answer-q { margin: 0 0 var(--sp-8); font-size: var(--fs-17); font-weight: var(--fw-semibold); line-height: 1.5; color: var(--text-1); }
.answer-box .answer-text { margin: 0; font-size: var(--fs-15); line-height: 1.75; color: var(--text-1); }
.guide p, .guide li { font-size: var(--fs-15); line-height: 1.75; }
/* 해설 안 요율 표: 4절 표 스타일 축소판 */
.guide table { margin: var(--sp-12) 0; font-size: var(--fs-14); }
.guide th, .guide td { height: 40px; padding: 0 var(--sp-12); }
/* FAQ: 질문 행 56px, 오른쪽 + 아이콘이 열리면 − 로 회전, 답 영역 --surface-2 */
.faq details { margin: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: none; }
.faq summary { list-style: none; position: relative; min-height: 56px; padding: var(--sp-12) 40px var(--sp-12) 0; line-height: 1.5; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: var(--sp-8); top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: linear-gradient(var(--text-3), var(--text-3)) center / 14px 2px no-repeat, linear-gradient(var(--text-3), var(--text-3)) center / 2px 14px no-repeat;
  transition: transform var(--ease), background-size var(--ease);
}
.faq details[open] > summary::after { transform: rotate(180deg); background-size: 14px 2px, 2px 0; }
.faq details > .faq-answer { margin: 0 0 var(--sp-16); padding: var(--sp-16); border-radius: var(--radius-input); background: var(--surface-2); }
.faq-answer > :last-child { margin-bottom: 0; }
/* 계산 예시: 작은 카드 3개 가로(모바일 세로) */
.guide > .guide-examples { max-width: none; }
.example-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-12); }
.guide-example { display: flex; flex-direction: column; padding: var(--sp-16); border-radius: 16px; background: var(--surface-2); }
.guide-example h3 { margin: 0 0 var(--sp-8); font-size: var(--fs-15); }
.guide-example p { margin: 0 0 var(--sp-4); }
/* 예시 입력 (R108): 0·빈 값이 아닌 입력만 '항목: 값' 한 줄씩, 전체 입력은 접힌 영역 */
.example-inputs { list-style: none; margin: 0 0 var(--sp-8); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px var(--sp-12); font-size: var(--fs-13); line-height: 1.6; color: var(--text-3); }
.example-inputs li { min-width: 0; overflow-wrap: anywhere; word-break: keep-all; }
.example-all { margin: 0 0 var(--sp-8); font-size: var(--fs-13); }
.example-all > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--text-2); font-weight: var(--fw-semibold); }
.example-all > .example-inputs { margin-top: var(--sp-4); }
.example-result { color: var(--text-2); }
.example-amount { display: block; font-size: var(--fs-20); font-weight: var(--fw-bold); color: var(--text-1); }
.guide-example p:last-child { margin-top: auto; padding-top: var(--sp-8); }
.example-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); text-decoration: none; }
.example-link::after { content: " →"; white-space: pre; }
/* 관련 계산기: 아이콘 카드, 모바일 가로 스크롤 / 데스크톱 그리드 */
.related { display: block; }
.guide > .related { max-width: none; }
.related-list { list-style: none; margin: 0; padding: 0 0 var(--sp-4); display: flex; gap: var(--sp-12); overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.related-list li { flex: 0 0 72%; max-width: 260px; scroll-snap-align: start; }
.related-card { display: flex; flex-direction: column; gap: var(--sp-4); height: 100%; min-height: 44px; padding: var(--sp-16); border-radius: 16px; background: var(--surface-2); color: var(--text-1); text-decoration: none; transition: background var(--ease); }
.related-card:hover { background: var(--brand-weak); color: var(--text-1); }
.related-card .calc-icon { margin-bottom: var(--sp-4); }
.related-card strong { font-size: var(--fs-15); font-weight: var(--fw-semibold); line-height: 1.4; }
.related-card span:not(.calc-icon) { font-size: var(--fs-13); font-weight: var(--fw-regular); line-height: 1.5; color: var(--text-3); }
/* 갱신 기록: 날짜(13px text-3) + 내용 */
.updated-list { list-style: none; margin: 0; padding: 0; }
.updated-list li { padding: var(--sp-8) 0; font-size: var(--fs-15); color: var(--text-2); }
.updated-list time { display: block; font-size: var(--fs-13); color: var(--text-3); }

/* 모바일 하단 고정 광고 띠 (애드핏 전용, ads.js mobileBottom) — 960px 이상은 ads.js 의 <style> 이 숨긴다 */
.ad-mobileBottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0; height: 64px; background: var(--surface); border-top: 1px solid var(--line); text-align: center; }
.ad-mobileBottom .ad-label { position: absolute; left: var(--sp-8); top: 2px; }
.ad-close { position: absolute; right: 4px; top: 4px; min-width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; font-family: inherit; cursor: pointer; }

@media (min-width: 768px) {
  .example-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 데스크톱: 예시 입력 목록 2열 그리드 (좁은 예시 카드 안에서는 칸 최소 폭 200px 때문에 1열) */
@media (min-width: 960px) {
  .example-inputs { grid-template-columns: repeat(auto-fill, minmax(max(200px, calc(50% - var(--sp-12))), 1fr)); }
}

/* 1024px 이상: 입력(420px) | 결과(나머지) 2열, 결과 카드 sticky, 표 머리 sticky top 60px */
@media (min-width: 1024px) {
  .calc-grid { grid-template-columns: 420px 1fr; gap: 24px; margin-bottom: var(--sp-24); }
  .calc-output { position: sticky; top: 76px; }
  .calc-output .share .share-link { display: none; }
  .calc-output .share .copy-link { flex: 0 0 auto; }
  /* 연봉 실수령액 표: 조건 막대를 전체 폭 한 줄로 두고 결과 요약은 그 아래 */
  .calc-grid:has(.table-form) { grid-template-columns: minmax(0, 1fr); }
  .calc-grid:has(.table-form) .calc-output { position: static; }
  .table-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* 챕터 33: 래퍼 스크롤을 푸는 것은 계산기 추가 영역의 표(연봉 실수령액 표 등, 이 폭에서 카드 안에 들어감)만.
     예전에는 모든 .data-table 래퍼를 풀어 /changes/ 추이 표(9열)가 카드 밖으로 넘쳤다. 그 밖의 표는 래퍼 안에서 스크롤하고 머리 행은 래퍼 top:0 에 붙는다. */
  .calc-extra-area .table-wrap:has(> .data-table) { max-height: none; overflow: visible; }
  .calc-extra-area .data-table thead th { top: 60px; }
  .related-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); overflow: visible; }
  .related-list li { max-width: none; }
}

/* 1280px 이상: side 광고가 있으면 본문 오른쪽 300px 열 (1024~1279px 는 side 없음) */
@media (min-width: 1280px) {
  main:has(.calc-layout.has-side) { max-width: 1456px; }
  .calc-layout.has-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-32); align-items: start; }
  .calc-aside { display: block; position: sticky; top: 76px; width: 300px; }
  /* side 열이 있으면 본문이 좁아 긴 표는 다시 래퍼 안 스크롤 */
  .calc-layout.has-side .table-wrap:has(> .data-table) { max-height: 75vh; overflow: auto; }
  .calc-layout.has-side .calc-extra-area .data-table thead th { top: 0; }
}

@media print {
  .calc-output, .calc-aside { position: static; }
  .calc-grid { display: block; }
  .ad-mobileBottom { display: none !important; }
}

/* 팁 글 (contracts 17절, 챕터 23) — 해설 영역(.guide)·예시 카드·관련 계산기 카드 스타일을 그대로 쓰고 필요한 것만 더한다 */
.nav-tips { display: flex; align-items: center; }
.drawer-panel .nav-tips a { display: flex; align-items: center; min-height: 52px; padding: var(--sp-12) 0; color: var(--text-1); font-size: var(--fs-15); font-weight: var(--fw-semibold); text-decoration: none; }
.tip-page { max-width: 760px; margin: 0 auto; }
.tip-dates { margin: 0 0 var(--sp-12); font-size: var(--fs-13); color: var(--text-3); }
.tip-summary { margin: 0 0 var(--card-gap); padding: var(--card-pad); border-radius: var(--radius-card); background: var(--brand-weak); }
.tip-summary h2 { margin: 0 0 var(--sp-8); font-size: var(--fs-17); }
.tip-summary p { margin: 0; font-size: var(--fs-15); line-height: 1.75; color: var(--text-1); }
.tip-article > * + * { margin-top: var(--sp-40); }
.tip-section p { margin: 0 0 var(--sp-12); }
.tip-cautions { padding: var(--sp-16); border-radius: 16px; background: var(--warn-weak); }
.tip-cautions h2 { font-size: var(--fs-17); }
.tip-cautions ul { margin: 0; padding-left: 1.2em; }
.tip-sources ol { margin: 0; padding-left: 1.4em; }
.tip-sources a { word-break: break-all; }
.tips-same { margin-top: var(--sp-40); }
.tips-inline { margin-top: var(--card-gap); padding: var(--card-pad); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.tips-inline h2 { margin: 0 0 var(--sp-12); font-size: var(--fs-17); }
.tips-inline .tips-all { margin: var(--sp-12) 0 0; font-size: var(--fs-15); }
.tips-inline .tips-all a { display: inline-flex; align-items: center; min-height: 44px; }
.tips-same { padding: var(--card-pad); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.tip-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-12); }
.tip-card { display: flex; flex-direction: column; gap: var(--sp-8); padding: var(--sp-16); border-radius: 16px; background: var(--surface-2); }
.tip-card-link { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 44px; color: var(--text-1); text-decoration: none; }
.tip-card-link strong { font-size: var(--fs-15); font-weight: var(--fw-semibold); line-height: 1.4; }
.tip-card-link span { font-size: var(--fs-13); line-height: 1.6; color: var(--text-2); }
.tip-card-link:hover strong { color: var(--brand-strong); }
.tip-card .chips { margin: 0; }
.tips-group h3 { margin: var(--sp-24) 0 var(--sp-8); font-size: var(--fs-17); }
.tips-group h3 a { color: var(--text-1); text-decoration: none; }
@media (min-width: 768px) {
  .tips-inline .tip-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 챕터 29: 연말정산 계산기 — 접이식 입력 단계, 단계 합계, 연도별 도움말, 환급(--pos)·추가 납부(--neg) 색 */
.form-step { border-bottom: 1px solid var(--line); }
.form-step > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-height: 52px; font-weight: 600; color: var(--text-1); cursor: pointer; list-style: none; }
.form-step > summary::-webkit-details-marker { display: none; }
.form-step > summary::after { content: "+"; color: var(--text-3); font-weight: 400; }
.form-step[open] > summary::after { content: "−"; }
.form-step > summary .step-title { flex: 1; }
.step-sum { font-size: var(--fs-13); font-weight: 600; color: var(--brand-strong); font-variant-numeric: tabular-nums; }
.form-step[open] { padding-bottom: var(--sp-16); }
/* 연도별 도움말: 선택한 귀속연도 문구만 보인다. :has() 를 모르는 브라우저는 규칙을 무시해 모든 연도 문구가 보인다. */
.year-end-form:has(select[name="year"] option[value="2024"]:checked) .year-help:not([data-help-year="2024"]),
.year-end-form:has(select[name="year"] option[value="2025"]:checked) .year-help:not([data-help-year="2025"]),
.year-end-form:has(select[name="year"] option[value="2026"]:checked) .year-help:not([data-help-year="2026"]) { display: none; }
.year-end-main.is-refund { color: var(--pos); }
.year-end-main.is-payment { color: var(--neg); }
.year-end-choice { font-size: var(--fs-13); color: var(--text-3); }

/* 챕터 30: 종합소득세 계산기 — 선택한 계산 방식의 입력칸만 보인다(:has() 를 모르는 브라우저는 모든 칸이 보임), 환급·추가 납부 색, 세율표 적용 구간 */
.income-tax-form:has(select[name="mode"] option[value="taxBase"]:checked) [data-mode="freelancer"],
.income-tax-form:has(select[name="mode"] option[value="freelancer"]:checked) [data-mode="taxBase"] { display: none; }
.income-tax-main.is-refund { color: var(--pos); }
.income-tax-main.is-payment { color: var(--neg); }
.income-tax-rates tr.is-current th, .income-tax-rates tr.is-current td { background: var(--brand-weak); font-weight: 600; }

/* 연도별 변화 (contracts 19절, 챕터 32) — .card·.data-table·.chip·.badge 를 그대로 쓰고 목록 배치만 더한다 */
.changes-years-nav ul { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: 0 0 var(--card-gap); padding: 0; list-style: none; }
.changes-years-nav .chip.is-current { background: var(--brand-strong); color: #fff; }
.changes-note { margin: var(--sp-12) 0 0; font-size: var(--fs-14); color: var(--text-2); }
.change-items { margin: 0; padding: 0; list-style: none; }
.change-item { padding: var(--sp-20) 0; border-top: 1px solid var(--line); }
.change-item:first-child { border-top: 0; padding-top: 0; }
.change-item h3 { margin: 0 0 var(--sp-8); font-size: var(--fs-17); }
.change-item p { margin: var(--sp-8) 0 0; font-size: var(--fs-15); line-height: 1.75; }
.change-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); }
.change-date, .change-status-note { font-size: var(--fs-13); color: var(--text-2); }
.change-calcs, .change-sources { font-size: var(--fs-14); color: var(--text-2); }
.badge-planned { background: var(--brand-weak); color: var(--brand-strong); }
.badge-enforced { background: #e6f7ef; color: #0b7a4b; }
.change-meta .badge-provisional { margin-left: 0; }
.year-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-12); margin: 0; padding: 0; list-style: none; }
.year-card { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 72px; padding: var(--sp-16); border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--text-1); text-decoration: none; }
.year-card:hover, .year-card:focus-visible { border-color: var(--brand); }
.year-card > span:not(.chip-tag) { font-size: var(--fs-13); color: var(--text-2); }

/* 챕터 33 (D61): 연도별 변화 최신순 — 올해·내년 요약 카드, 올해 열 강조, 연도 칩 꼬리표, 홈 '올해 달라진 것' 띠, 모바일 숫자 표 */
.changes-highlights { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); margin: 0 0 var(--card-gap); }
.changes-highlights > .card { min-width: 0; margin: 0; }
.changes-highlight-current { background: var(--brand-weak); box-shadow: inset 0 0 0 2px var(--brand); }
.changes-highlight-next { box-shadow: inset 0 0 0 1px var(--line); }
.changes-highlight h2 { margin: 0 0 var(--sp-12); font-size: var(--fs-20); }
.highlight-list { margin: 0; padding: 0; list-style: none; }
.highlight-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--sp-12); padding: var(--sp-8) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-15); }
.highlight-label { min-width: 0; color: var(--text-2); }
.highlight-value { min-width: 0; color: var(--text-1); text-align: right; font-variant-numeric: tabular-nums; }
.highlight-diff { font-size: var(--fs-13); color: var(--text-2); }
.highlight-count { margin: var(--sp-12) 0 0; font-size: var(--fs-14); color: var(--text-2); }
.highlight-link { margin: var(--sp-4) 0 0; }
.highlight-link a { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); text-decoration: none; }
.chip-tag { display: inline-flex; align-items: center; padding: 0 6px; border-radius: var(--radius-chip); background: var(--brand); color: #fff; font-size: var(--fs-12); font-weight: var(--fw-semibold); line-height: 1.6; }
.chip-tag[data-tag="예정"] { background: var(--warn-weak); color: #8a5a00; }
.changes-years-nav .chip.is-current .chip-tag[data-tag="올해"] { background: #fff; color: var(--brand-strong); }
.year-card .chip-tag { margin-left: var(--sp-4); vertical-align: middle; }
.year-tag { font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-3); }
.changes-table col.is-current-year { background: var(--brand-weak); }
.data-table thead th.is-current-year { background: #d6e8ff; color: var(--brand-strong); }
.data-table thead th.is-current-year a { color: var(--brand-strong); font-weight: var(--fw-bold); }
/* 항목 열(첫 열 sticky)은 긴 항목명을 줄바꿈해 좁은 화면에서 값 열을 가리지 않게 폭을 제한한다 */
.changes-table tbody .sticky-col { min-width: 9rem; width: 9rem; white-space: normal; line-height: 1.45; padding-top: var(--sp-8); padding-bottom: var(--sp-8); }
.changes-strip { margin: 0 0 var(--card-gap); }
.changes-strip a { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-12); min-height: 52px; padding: var(--sp-12) var(--sp-16); background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); color: var(--text-1); text-decoration: none; }
.changes-strip a:hover { box-shadow: var(--shadow-float); color: var(--text-1); }
.changes-strip strong { color: var(--brand-strong); font-weight: var(--fw-bold); }
.changes-strip span { min-width: 0; font-size: var(--fs-14); color: var(--text-2); }
@media (min-width: 768px) {
  .changes-highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 640px 미만: 연도 페이지 숫자 표를 행마다 카드형으로 쌓는다 — 항목명 한 줄, 아래에 작년·올해·변화 3칸, 계산기 링크.
   머리 행(작년·올해·변화 이름)은 같은 3칸 격자로 맞추고 머리글(60px) 아래에 붙는다. 칸이 화면 폭에 맞으므로 래퍼 스크롤이 필요 없다. */
@media (max-width: 639.98px) {
  .changes-numbers .table-wrap:has(> .data-table) { max-height: none; overflow: visible; border-radius: 0; }
  .changes-numbers .changes-table, .changes-numbers .changes-table tbody { display: block; width: 100%; min-width: 0; }
  .changes-numbers .changes-table thead { display: block; position: sticky; top: var(--header-h); z-index: 2; }
  .changes-numbers .changes-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-8); padding: var(--sp-12) 0; border-bottom: 1px solid var(--line); }
  .changes-numbers .changes-table thead tr { padding: var(--sp-8) var(--sp-12); background: var(--surface-2); border-bottom: 0; border-radius: var(--radius-input); }
  .changes-numbers .changes-table th, .changes-numbers .changes-table td { display: block; position: static; width: auto; min-width: 0; height: auto; padding: 0; border: 0; box-shadow: none; background: none; white-space: normal; text-align: right; line-height: 1.5; }
  .changes-numbers .changes-table thead th:first-child, .changes-numbers .changes-table thead th:last-child { display: none; }
  .changes-numbers .changes-table tbody th { grid-column: 1 / -1; text-align: left; }
  .changes-numbers .changes-table tbody td:last-child { grid-column: 1 / -1; text-align: left; font-size: var(--fs-13); }
}
/* 640px 미만: 육아휴직 월별 지급액 표(6열)를 달마다 카드형으로 쌓는다 — 차수(1칸)·기간(3칸) 한 줄, 아래에 지급률·상한·지급액·사후지급분 2×2(칸 이름은 data-label).
   열이 많아 모바일 카드 폭에 들어가지 않던 금액 열이 잘리지 않게 한다. */
@media (max-width: 639.98px) {
  .result .parental-leave-table, .result .parental-leave-table tbody, .result .parental-leave-table tfoot { display: block; width: 100%; }
  .result .parental-leave-table thead { display: none; }
  .result .parental-leave-table caption { display: block; }
  .result .parental-leave-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-12); padding: var(--sp-12) 0; border-bottom: 1px solid var(--line); }
  .result .parental-leave-table th, .result .parental-leave-table td { display: block; height: auto; min-width: 0; padding: 0; border: 0; line-height: 1.5; }
  .result .parental-leave-table td { grid-column: span 2; }
  .result .parental-leave-table td[data-label="기간"] { grid-column: span 3; }
  .result .parental-leave-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-12); font-weight: var(--fw-regular); color: var(--text-3); }
  .result .parental-leave-table td[data-label=""]::before { content: none; }
  .result .parental-leave-table td[data-label="기간"]::before { content: none; }
  .result .parental-leave-table tfoot tr { border-top: 0; }
  .result .parental-leave-table tfoot th { grid-column: 1 / -1; border-top: 0; }
  .result .parental-leave-table tfoot td { border-top: 0; }
  .result .parental-leave-table td[colspan] { grid-column: 1 / -1; }
}
/* 1024px 이상: 연봉 실수령액 표(9열)는 래퍼 스크롤을 풀고 페이지 머리글 아래 머리 행을 붙이므로, 1024~1100px 폭 카드 안에도 들어가게 칸 여백을 줄인다 */
@media (min-width: 1024px) {
  .salary-table th, .salary-table td { padding: 0 var(--sp-8); }
}

/* =====================================================================
   챕터 34: 화면 점검 결과 수정 (docs/audit/ui_audit.md). 페이지별 특례 대신 공통 규칙으로 고친다.
   카드 간격 --card-gap(모바일 12px / 1024px 이상 16px), 카드 제목 20px, 본문 최대 720px (docs/design.md).
   ===================================================================== */

/* B1(전역): 계산기 본문 안 형제 카드 사이 간격 하나로 — 관련 팁(.tips-inline)·추가 영역·해설·광고가 서로 붙지 않는다.
   머리 영역 바로 다음 요소는 머리 영역 아래 여백(24px)이 있으므로 제외. 위아래 여백은 겹쳐(collapse) 큰 값 하나만 남는다. */
.calc-content > :not(.page-head) + * { margin-top: var(--card-gap); }
.tips-inline { margin-bottom: var(--card-gap); }

/* A3: '올해' 꼬리표 — 흰 글자 대비 4.5:1 이상이 되도록 진한 브랜드 색 배경 */
.chip-tag { background: var(--brand-strong); }
.year-card .chip-tag { font-size: var(--fs-12); }

/* A4: 대표 숫자는 어떤 마크업 안에서도 [data-main] 색(text-1). 문단 안 대표 숫자(청약가점 "34점 / 84점")는 같은 줄에 둔다 */
.result [data-main] { color: var(--text-1); font-weight: var(--fw-bold); }
.result > p:has(> [data-main]) { margin: 0 0 var(--sp-8); font-size: var(--fs-17); color: var(--text-2); }
.result > p > [data-main] { display: inline-block; margin: 0 var(--sp-4) 0 0; }

/* A5: 대출 '전체 보기' — 디자인 보조 버튼 모양(52px, 테두리, 오른쪽 +/−) */
.loan-schedule-all { margin: var(--sp-16) 0 0; }
.loan-schedule-all > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-height: 52px; padding: 0 var(--sp-20); border: 1px solid var(--line); border-radius: var(--radius-input); background: var(--surface); color: var(--text-1); font-size: var(--fs-15); font-weight: var(--fw-semibold); cursor: pointer; transition: background var(--ease); }
.loan-schedule-all > summary:hover { background: var(--surface-2); }
.loan-schedule-all > summary::-webkit-details-marker { display: none; }
.loan-schedule-all > summary::after { content: "+"; font-size: var(--fs-20); font-weight: var(--fw-regular); color: var(--text-3); }
.loan-schedule-all[open] > summary::after { content: "−"; }
.loan-schedule-all[open] > summary { margin-bottom: var(--sp-12); }

/* A2: 종합소득세 세율표 — 긴 과세표준 문구가 고정 첫 열을 넓혀 다른 열을 덮지 않게 줄바꿈하고 폭을 제한(/changes/ 추이 표와 같은 방식) */
.income-tax-rates .sticky-col { width: 9rem; min-width: 9rem; white-space: normal; line-height: 1.45; padding-top: var(--sp-8); padding-bottom: var(--sp-8); }

/* B2: 입력 묶음(연말정산 접이식 단계, 종합소득세 방식별 묶음) 안 입력칸도 폼과 같은 20px 간격 */
.form-step > .field + .field, .mode-group > .field + .field { margin-top: var(--sp-20); }
.form-step > summary + .field { margin-top: var(--sp-4); }

/* B3(전역): 이어지는 표 사이 간격 */
:is(.table-wrap, .table-scroll) + :is(.table-wrap, .table-scroll) { margin-top: var(--sp-24); }

/* B4(전역): 결과 표 머리 칸은 아래 숫자 칸처럼 오른쪽 정렬 (첫 칸=항목명만 왼쪽) */
.result-table thead th + th, .result table thead th + th { text-align: right; }

/* B5·C10: 결과 표 값 칸은 숫자·날짜 중간에서 끊지 않는다(body 의 overflow-wrap:break-word 를 풀어 낱말 사이에서만 줄바꿈).
   날짜 구간(YYYY-MM-DD ~ YYYY-MM-DD)·부호 붙은 금액처럼 한 덩어리로 읽어야 하는 값은 페이지 모듈이 .nowrap 으로 감싼다.
   모든 값 칸을 nowrap 으로 하면 4열 표(4대보험)가 모바일 카드 폭을 넘는다(챕터 33 R92). */
.result-table td, .result table td { overflow-wrap: normal; }
.nowrap { white-space: nowrap; }

/* B6: 팁 글 '같은 계산기의 다른 팁' 카드 — 다른 카드와 같은 간격, 제목 위 빈칸 없음 */
.tips-same { margin-top: var(--card-gap); }
.tips-same > h2 { margin-top: 0; }

/* B7: 만원 보조 표시가 비어 있으면 자리를 차지하지 않는다 */
.man-hint:empty { display: none; }

/* B8·R96: 3열 이하 짧은 표는 카드 전체 폭으로 늘이지 않고 내용 폭에 맞춘다(결과 내역 표 제외) */
:is(.calc-extra-area, .guide, .card) table:not(.result-table):not(:has(tr > :nth-child(4))) { width: auto; min-width: 0; max-width: 100%; }

/* B9: 가로로 넘치는 표 래퍼에 스크롤 표시 — 넘친 쪽 가장자리에 그림자(스크롤하면 따라 사라짐).
   표가 래퍼에 들어가면 덮개(배경색 그라데이션)가 그림자를 가린다. 덮개 색은 래퍼가 놓인 상자 배경(--wrap-bg). */
.table-wrap, .table-scroll {
  --wrap-bg: var(--surface);
  background:
    linear-gradient(to right, var(--wrap-bg) 30%, rgba(255,255,255,0)) left center / 32px 100% no-repeat local,
    linear-gradient(to left, var(--wrap-bg) 30%, rgba(255,255,255,0)) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.16), rgba(0,0,0,0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.16), rgba(0,0,0,0)) right center / 12px 100% no-repeat scroll;
}
:is(.calc-basis, .guide-example) :is(.table-wrap, .table-scroll) { --wrap-bg: var(--surface-2); }
.tip-cautions :is(.table-wrap, .table-scroll) { --wrap-bg: var(--warn-weak); }
.tip-summary :is(.table-wrap, .table-scroll) { --wrap-bg: var(--brand-weak); }

/* B10: 가로 스크롤 상자 안 표 제목은 보이는 폭 안에서 줄바꿈하고 왼쪽에 붙는다 */
:is(.table-wrap, .table-scroll) caption { position: sticky; left: 0; white-space: normal; max-width: calc(100vw - 72px); }

/* C2(전역): 추가 영역 맨 위 안내 문단은 안내 상자 모양 */
.calc-extra-area > .extra > p:first-child { margin: 0 0 var(--sp-16); padding: var(--sp-12) var(--sp-16); border-radius: var(--radius-input); background: var(--surface-2); font-size: var(--fs-14); line-height: 1.6; color: var(--text-2); }

/* C3(전역): '팁 전체 보기'·'계산 근거 자세히 보기' 이동 링크를 다른 이동 링크(굵은 글자 + →)와 같은 모양으로 */
.tips-all a, .calc-basis a[href^="/basis/"] { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); text-decoration: none; }
.tips-all a::after, .calc-basis a[href^="/basis/"]::after { content: " →"; white-space: pre; }

/* C4: 카드 제목은 20px 하나로 (카드 안 상자 제목 — 계산 기준·요약 상자·주의 — 만 17px) */
.tips-inline h2, .tips-same > h2 { font-size: var(--fs-20); }

/* C5: 본문형 페이지(소개·개인정보·면책·문의·갱신 기록·계산 근거) 글 폭 720px 이하 */
main > .card > :is(p, ul, ol, h2, h3, h4, nav), main > .card > section > :is(p, ul, ol, h2, h3, h4) { max-width: 720px; }

/* C6: 계산 근거 목차를 칩 묶음으로 */
.basis-toc ul { list-style: none; margin: 0 0 var(--sp-16); padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.basis-toc a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-12); border-radius: var(--radius-chip); background: var(--brand-weak); color: var(--brand-strong); font-size: var(--fs-13); font-weight: var(--fw-semibold); text-decoration: none; }
.basis-toc a:hover { background: #d6e8ff; }

/* C11: 연도별 추이 표 항목명 링크는 평소 밑줄 없음 */
.changes-table tbody th a { color: var(--text-1); text-decoration: none; }
.changes-table tbody th a:hover { color: var(--brand-strong); text-decoration: underline; }

@media (min-width: 768px) {
  /* C7: /tips/ 팁 카드도 계산기 쪽처럼 2열 */
  .tips-group .tip-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023.98px) {
  /* C9: 모바일 홈 히어로를 머리글 바로 아래에 붙인다(main 위 여백 16px 상쇄) */
  .hero { margin-top: calc(var(--sp-16) * -1); }
}

/* 챕터 37 (R109·R110, D73): 연말정산 가이드 허브·글 — 요약 상자·목차·핵심/주의 상자·맺음 버튼·이전/다음 글·용어사전 */
.guide-summary ul { margin: 0; padding-left: 1.2em; font-size: var(--fs-15); line-height: 1.75; color: var(--text-1); }
.guide-toc { margin: 0 0 var(--card-gap); padding: var(--card-pad); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.guide-toc h2 { margin: 0 0 var(--sp-8); font-size: var(--fs-17); }
.guide-toc p { margin: 0 0 var(--sp-8); font-size: var(--fs-14); color: var(--text-2); }
.guide-toc ol { margin: 0; padding-left: 1.4em; }
.guide-toc a { display: inline-block; min-height: 32px; padding: var(--sp-4) 0; }
.guide-article .guide-section { scroll-margin-top: calc(var(--header-h) + var(--sp-16)); }
.guide-article .guide-section + .guide-section { margin-top: var(--sp-32); }
.yr { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.callout { margin: var(--sp-16) 0; padding: var(--sp-16); border-radius: 16px; line-height: 1.75; }
.callout strong { display: block; margin-bottom: var(--sp-4); }
.callout-key { background: var(--brand-weak); }
.callout-warn { background: var(--warn-weak); }
.steps { list-style: none; margin: var(--sp-16) 0; padding: 0; display: grid; gap: var(--sp-8); }
.steps li { padding: var(--sp-12) var(--sp-16); border-radius: var(--radius-input); background: var(--surface-2); }
.guide-closing { font-weight: var(--fw-semibold); }
.guide-buttons { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.guide-pager { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); margin: var(--card-gap) 0; }
.guide-pager a { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 44px; padding: var(--sp-16); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); color: var(--text-1); text-decoration: none; }
.guide-pager span { font-size: var(--fs-13); color: var(--text-2); }
.guide-pager .pager-next { text-align: right; }
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-12); }
.guide-card { padding: var(--sp-16); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); }
.guide-card-link { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 44px; color: var(--text-1); text-decoration: none; }
.guide-card-link strong { font-size: var(--fs-17); line-height: 1.4; }
.guide-card-link:hover strong { color: var(--brand-strong); }
.guide-no { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--brand-strong); }
.guide-card-summary { margin: var(--sp-8) 0 0; padding-left: 1.2em; font-size: var(--fs-14); line-height: 1.7; color: var(--text-2); }
.glossary { margin: 0; }
.glossary dt { margin-top: var(--sp-16); font-weight: var(--fw-bold); scroll-margin-top: calc(var(--header-h) + var(--sp-16)); }
.glossary dd { margin: var(--sp-4) 0 0; }
@media (min-width: 768px) {
  .guide-pager { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 챕터 38 (R111, docs/writing-guide.md): 팁·가이드 공통 쉬운 설명 구조 — 요약 상자(.summary-box)·핵심(.key-box)·주의(.warn-box)·경우별 비교·맺음 */
.summary-box ul { margin: 0; padding-left: 1.2em; font-size: var(--fs-15); line-height: 1.75; color: var(--text-1); }
.key-box ul, .warn-box ul { margin: 0; padding-left: 1.2em; }
.tip-article .tip-section { scroll-margin-top: calc(var(--header-h) + var(--sp-16)); }
.cases-box, .tip-closing { margin-top: var(--sp-32); scroll-margin-top: calc(var(--header-h) + var(--sp-16)); }
.cases-table tbody th { white-space: normal; }
.tip-closing .guide-buttons { margin-top: var(--sp-16); }

/* 챕터 41 (R119): 연봉 퇴직금 포함 계산기 — 법적 안내 상자(.warn-box.legal-box)와 ÷13 관행 표시 */
.legal-box { margin-top: var(--sp-16); padding: var(--sp-16); border-radius: 16px; background: var(--warn-weak); }
.legal-box h2 { font-size: var(--fs-17); margin-top: 0; }
.legal-box h3 { font-size: var(--fs-15); margin: var(--sp-16) 0 var(--sp-8); }
.legal-box p, .legal-box li { font-size: var(--fs-15); line-height: 1.7; }
.legal-box ol { margin: 0; padding-left: 1.4em; }
.legal-box .legal-disclaimer { margin-bottom: 0; color: var(--text-2); }
.convention-note { font-size: var(--fs-13); color: var(--text-2); margin: var(--sp-8) 0; }

/* 챕터 43 (R121·R122): 급여명세서 한눈에 보기 — 단계 폼 안내, 연도별 한도 문구, 대략 예상 배지, 공제 비교·이유, 비과세 표, '1년으로 보면' 카드 */
.payslip-form:has(select[name="year"] option[value="2020"]:checked) .year-help:not([data-help-year="2020"]),
.payslip-form:has(select[name="year"] option[value="2021"]:checked) .year-help:not([data-help-year="2021"]),
.payslip-form:has(select[name="year"] option[value="2022"]:checked) .year-help:not([data-help-year="2022"]),
.payslip-form:has(select[name="year"] option[value="2023"]:checked) .year-help:not([data-help-year="2023"]),
.payslip-form:has(select[name="year"] option[value="2024"]:checked) .year-help:not([data-help-year="2024"]),
.payslip-form:has(select[name="year"] option[value="2025"]:checked) .year-help:not([data-help-year="2025"]),
.payslip-form:has(select[name="year"] option[value="2026"]:checked) .year-help:not([data-help-year="2026"]),
.payslip-form:has(select[name="year"] option[value="2027"]:checked) .year-help:not([data-help-year="2027"]) { display: none; }
.step-intro { margin: var(--sp-4) 0 var(--sp-16); font-size: var(--fs-13); color: var(--text-2); line-height: 1.6; }
.exempt-condition { color: var(--text-2); }
.badge-approx { margin-left: var(--sp-8); background: var(--warn-weak); color: #8a5a00; }
.result-sub { margin: var(--sp-8) 0 0; font-size: var(--fs-13); color: var(--text-2); line-height: 1.6; }
.diff-reasons { margin-top: var(--sp-16); padding: var(--sp-16); border-radius: var(--radius-card); background: var(--warn-weak); }
.diff-reasons h3 { margin: 0 0 var(--sp-8); font-size: var(--fs-15); }
.diff-reasons ul { margin: 0; padding-left: 1.2em; font-size: var(--fs-13); line-height: 1.7; }
.diff-same { margin-top: var(--sp-16); font-size: var(--fs-13); color: var(--text-2); }
.exempt-table tbody th { white-space: normal; }
.exempt-reason { display: block; font-size: var(--fs-12); font-weight: 400; color: var(--text-3); }
.payslip-exempt, .payslip-annual { margin-bottom: var(--sp-24); }
.annual-cards { display: grid; gap: var(--sp-16); margin: 0; padding: 0; list-style: none; }
.annual-card { padding: var(--sp-16); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface-2); }
.annual-card h3 { margin: 0 0 var(--sp-8); font-size: var(--fs-15); }
.annual-card .annual-amount { margin: 0; font-size: var(--fs-20); font-weight: 700; font-variant-numeric: tabular-nums; }
.annual-card .annual-range { margin: 0; font-weight: 600; }
.annual-card .bonus-warn { margin: var(--sp-8) 0 0; font-size: var(--fs-13); font-weight: 600; color: #8a5a00; }
.annual-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (min-width: 768px) {
  .annual-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 챕터 44 (contracts 23절, D91): 입력 8칸 이상 계산기 = 위 입력(전체 폭) · 아래 결과(전체 폭). 짧은 계산기의 .calc-grid 는 그대로 */
.calc-stack { --form-cols: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); align-items: start; margin: 0 0 var(--card-gap); }
.calc-stack > .calc-input > .card, .calc-stack > .calc-output > .result-card { margin: 0; }
.calc-stack .calc-output { position: static; }
/* 필드 격자: 폼과 그 안 단계(details 의 내용 상자)·방식 묶음이 같은 열 수를 쓰고, 칸이 아닌 것(단계 제목·안내 문단·details)은 전체 폭 */
.calc-stack .calc-form,
.calc-stack .calc-form .mode-group { display: grid; grid-template-columns: repeat(var(--form-cols), minmax(0, 1fr)); column-gap: var(--sp-20); row-gap: var(--sp-20); align-items: start; }
.calc-stack .calc-form .form-step[open]::details-content { display: grid; grid-template-columns: repeat(var(--form-cols), minmax(0, 1fr)); column-gap: var(--sp-20); row-gap: var(--sp-20); align-items: start; }
.calc-stack .calc-form > :not(.field),
.calc-stack .calc-form :is(.form-step, .mode-group) > :not(.field) { grid-column: 1 / -1; }
.calc-stack .calc-form :is(.form-step[open], .mode-group) > .field + .field,
.calc-stack .calc-form .form-step[open] > summary + .field { margin-top: 0; }
@media (min-width: 640px) {
  .calc-stack { --form-cols: 2; }
}
@media (min-width: 1024px) {
  .calc-stack { --form-cols: 3; margin-bottom: var(--sp-24); }
  .calc-stack .calc-output { position: static; }
}

/* 챕터 45 (contracts 23절): 칸 설명은 한 줄, 긴 조건은 '조건 보기'(.field-more)로 접고, 덜 쓰는 칸은 '더 입력하기'(.more-fields, 단계와 같은 깊이) */
.field-more { margin-top: var(--sp-4); font-size: var(--fs-13); color: var(--text-2); line-height: 1.6; }
.field-more > summary { display: inline-flex; align-items: center; min-height: 32px; color: var(--brand); font-weight: var(--fw-medium); cursor: pointer; list-style: none; }
.field-more > summary::-webkit-details-marker { display: none; }
.field-more > p { margin: var(--sp-4) 0 0; }
.more-fields { border-bottom: 1px solid var(--line); }
.more-fields > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); min-height: 52px; font-weight: 600; color: var(--text-1); cursor: pointer; list-style: none; }
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::after { content: "+"; color: var(--text-3); font-weight: 400; }
.more-fields[open] > summary::after { content: "−"; }
.more-fields > summary .step-title { flex: 1; }
.more-fields[open] { padding-bottom: var(--sp-16); }
.more-fields > .field + .field { margin-top: var(--sp-20); }
.more-fields > summary + .field { margin-top: var(--sp-4); }
.calc-stack .calc-form .more-fields[open]::details-content { display: grid; grid-template-columns: repeat(var(--form-cols), minmax(0, 1fr)); column-gap: var(--sp-20); row-gap: var(--sp-20); align-items: start; }
.calc-stack .calc-form .more-fields > :not(.field) { grid-column: 1 / -1; }
.calc-stack .calc-form .more-fields[open] > .field + .field,
.calc-stack .calc-form .more-fields[open] > summary + .field { margin-top: 0; }
.result > .payslip-annual { margin: var(--sp-16) 0; }

/* 긴 계산기 하단 고정 요약 바 (contracts 23절): 높이 56px, 기본 hidden(app.js 가 결과 카드가 화면 아래에 있을 때만 보임), JS 없으면 없음 */
.summary-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); height: 56px; margin: 0; padding: 0 var(--sp-16); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06); box-sizing: border-box; }
.summary-bar[hidden] { display: none; }
html:not(.js) .summary-bar { display: none; }
.summary-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-17); font-weight: var(--fw-bold); color: var(--text-1); font-variant-numeric: tabular-nums; }
.summary-link { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--sp-16); border-radius: 8px; background: var(--brand); color: #fff; font-size: var(--fs-15); font-weight: var(--fw-semibold); text-decoration: none; }
.summary-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* 바가 보이는 동안 본문 끝이 바에 가리지 않게, 모바일 하단 광고 띠는 숨긴다(바와 띠가 맞닿지 않게) */
html.js body:has(.summary-bar:not([hidden])) { padding-bottom: 56px; }
.ad-mobileBottom.is-covered { display: none !important; }
@media print {
  .summary-bar { display: none !important; }
}

/* 챕터 46 (contracts 24절·D93·D94, docs/ux-field-group.md): 입력 칸 묶음 .field-group = 격자 한 칸.
   라벨 줄 [라벨 … ⓘ 조건] → 입력 → 메타 줄(.field-meta: 연도별 한도 문구 · 만원 표시) → 요건 줄(.field-attached). 같은 줄 묶음은 위쪽 정렬. */
.calc-form .field-group { align-self: start; gap: var(--sp-8); min-width: 0; }
.calc-stack .calc-form,
.calc-stack .calc-form .mode-group,
.calc-stack .calc-form .form-step[open]::details-content,
.calc-stack .calc-form .more-fields[open]::details-content { align-items: start; }
.field-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: var(--sp-8); min-height: 22px; }
.field-label > label { min-width: 0; font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--text-2); }
.field-label > .field-more { margin: 0 0 0 auto; font-size: 13px; }
.field-label > .field-more > summary { min-height: 22px; font-size: 13px; white-space: nowrap; }
.field-label > .field-more[open] { flex-basis: 100%; margin-left: 0; }
.field-label > .field-more[open] > summary { display: flex; width: max-content; margin-left: auto; }
.field-meta { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-8); min-height: 20px; margin: 0; font-size: 13px; line-height: 20px; color: var(--text-3); }
.field-meta .man-hint { min-height: 0; font-size: 13px; line-height: 20px; }
.field-meta .meta-year:not(:empty) ~ .man-hint:not(:empty)::before { content: "· "; color: var(--text-3); }
.field-meta .meta-year:empty { display: none; }
.field-attached { display: grid; gap: var(--sp-4); }
.field-attached .attached-row { display: flex; align-items: center; gap: var(--sp-8); min-height: 32px; }
.field-attached label.check { display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 32px; font-size: var(--fs-14); font-weight: var(--fw-medium); color: var(--text-1); cursor: pointer; }
.field-attached .attached-num { flex: 1; }
.calc-form .field-attached input[type="number"] { flex: 0 0 80px; width: 80px; height: 40px; min-height: 40px; padding: 0 var(--sp-8); font-size: var(--fs-15); text-align: right; }
.field-group.is-toggle { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: var(--sp-8); }
.field-group.is-toggle > label.check { display: inline-flex; align-items: center; gap: var(--sp-8); min-height: 44px; font-weight: var(--fw-medium); color: var(--text-1); cursor: pointer; }
.field-group.is-toggle > .field-more { margin: 0; }
.field-group.is-toggle > .field-more[open] { flex-basis: 100%; }
/* 연도별 메타 문구: 선택 연도 것만 보임 (연말정산 상세의 .year-help 와 같은 :has 방식) */
.calc-form:has(select[name="year"] option[value="2020"]:checked) .meta-year:not([data-help-year="2020"]),
.calc-form:has(select[name="year"] option[value="2021"]:checked) .meta-year:not([data-help-year="2021"]),
.calc-form:has(select[name="year"] option[value="2022"]:checked) .meta-year:not([data-help-year="2022"]),
.calc-form:has(select[name="year"] option[value="2023"]:checked) .meta-year:not([data-help-year="2023"]),
.calc-form:has(select[name="year"] option[value="2024"]:checked) .meta-year:not([data-help-year="2024"]),
.calc-form:has(select[name="year"] option[value="2025"]:checked) .meta-year:not([data-help-year="2025"]),
.calc-form:has(select[name="year"] option[value="2026"]:checked) .meta-year:not([data-help-year="2026"]),
.calc-form:has(select[name="year"] option[value="2027"]:checked) .meta-year:not([data-help-year="2027"]) { display: none; }
/* 여러 열 격자에서는 단독 토글 묶음을 옆 묶음의 입력 줄 높이에 맞춘다(라벨 줄 22px + 간격 8px 만큼 내림 → 같은 줄 높이 차 48px 이내) */
@media (min-width: 640px) {
  .calc-stack .calc-form .field-group.is-toggle { padding-top: 30px; }
}
/* 챕터 47 (contracts 24절): 짧은 계산기(.calc-grid, 한 열)는 같은 줄 묶음이 없으므로 빈 메타 줄 자리를 두지 않는다 */
.calc-grid .calc-form .field-meta:empty { display: none; }
