:root {
  --bg: #FAF6EE;
  --surface: #FFFDF8;
  --text: #3B2A1E;
  --text-muted: #7A6656;
  --line: #E8DFD0;
  --sage: #5E7F62;
  --sage-soft: #E6EDE3;
  --warn-bg: #FBEFD9;
  --warn-text: #7A4B0E;
  --error: #A33A2A;

  /* 차트 시리즈 (validate_palette.js 통과, surface #FFFDF8) */
  --series-maternity: #B85C38;
  --series-leave: #1F8F7A;
  --series-benefits: #D9A21E;
  /* 부부 비교: 같은 검증 팔레트를 엄마/아빠/지원금 순서로 사용 */
  --series-mom: #B85C38;
  --series-dad: #1F8F7A;

  --radius: 14px;
  --footer-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: calc(var(--footer-h) + 16px);
}

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.site-header { padding: 16px 0 4px; }
.logo { font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo span { font-weight: 500; font-size: 13px; color: var(--text-muted); margin-left: 6px; }

.intro h1 { font-size: 26px; line-height: 1.3; margin: 16px 0 8px; letter-spacing: -0.02em; }
.intro h1 small { font-size: 16px; color: var(--sage); font-weight: 700; }
.intro p { margin: 0 0 16px; color: var(--text-muted); }
.intro strong { color: var(--text); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }

/* 폼 */
.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.hint { font-size: 13px; color: var(--text-muted); font-weight: 400; margin: 4px 0 0; }
label .hint { margin-left: 4px; }

input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, .bar:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}
select:disabled { color: var(--text-muted); }

.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--sage); flex: none; }

.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.segmented input:checked + span { background: var(--sage-soft); border-color: var(--sage); color: var(--text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--sage); outline-offset: 2px; }

.sub-fields { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--sage-soft); }
.inline { display: flex; gap: 8px; align-items: center; }
.link-btn {
  flex: none; background: none; border: 0; color: var(--sage); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 8px 4px;
}
.error { color: var(--error); font-weight: 600; margin: 0; }

/* 결과 */
.hero { border-color: var(--sage); }
.hero h2 { color: var(--text-muted); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.grand {
  font-size: clamp(32px, 9vw, 44px); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}
.breakdown { list-style: none; margin: 0; padding: 0; }
.breakdown li {
  display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-top: 1px solid var(--line);
}
.b-label { font-weight: 600; }
.b-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.b-sub { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }

.warnings {
  margin: 12px 0 0; padding: 12px 12px 12px 32px; background: var(--warn-bg); color: var(--warn-text);
  border-radius: 10px; font-size: 14px;
}

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; padding: 0; font-size: 13px; color: var(--text-muted); }
.legend i, .tooltip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.chart-wrap { position: relative; }
.chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart svg { display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--text-muted); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { cursor: pointer; outline: none; }
.chart .bar:hover path, .chart .bar:focus path { filter: brightness(0.92); }

.tooltip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: 13px; line-height: 1.5;
  padding: 8px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; z-index: 2;
}
.tooltip strong { display: block; margin-bottom: 2px; }
.tooltip .tt-total { border-top: 1px solid rgba(255,255,255,.25); margin-top: 4px; padding-top: 4px; }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.timeline { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.timeline th, .timeline td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.timeline thead th { font-size: 13px; color: var(--text-muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
.timeline tbody th { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .zero { color: var(--line); }
.timeline .note { display: block; font-size: 11px; color: var(--text-muted); white-space: normal; }
.timeline .total { font-weight: 700; }
.timeline tfoot th, .timeline tfoot td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: 0; }

.upcoming { opacity: .7; background: transparent; border-style: dashed; }
.upcoming p { margin: 0 0 12px; color: var(--text-muted); }
.upcoming button {
  font: inherit; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text-muted); cursor: not-allowed;
}
.badge { font-size: 12px; font-weight: 600; background: var(--sage-soft); color: var(--sage); padding: 2px 8px; border-radius: 999px; vertical-align: 2px; }

.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin: 8px 0 0; color: var(--text-muted); font-size: 15px; }

/* 하단 고정 안내 */
.disclaimer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(59, 42, 30, .96); color: var(--bg); font-size: 13px; line-height: 1.5;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.disclaimer p { margin: 0; }
.disclaimer details { margin-top: 2px; }
.disclaimer summary { cursor: pointer; color: #CFE0CC; }
.disclaimer #rulesVerified { color: #BFAF9F; margin-left: 4px; }
.disclaimer ul { margin: 6px 0 0; padding-left: 18px; max-height: 40vh; overflow-y: auto; }
.disclaimer a { color: #CFE0CC; }

@media (min-width: 640px) {
  .card { padding: 24px; }
  #calcForm { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
  #calcForm fieldset, #calcForm .error { grid-column: 1 / -1; }
  .table-wrap { margin: 0; padding: 0; }
}

/* 문서 페이지 (약관 등) + 사이트 푸터 */
.doc h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.02em; }
.doc-meta { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.doc h2 { font-size: 17px; margin: 24px 0 8px; }
.doc h3 { font-size: 15px; margin: 16px 0 6px; color: var(--sage); }
.doc p, .doc li { font-size: 15px; }
.doc ol, .doc ul { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--sage); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 12px; table-layout: fixed; word-break: keep-all; overflow-wrap: anywhere; }
.doc-table th, .doc-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc-table thead th { background: var(--sage-soft); font-weight: 600; }
.doc-table.biz th { width: 38%; background: var(--sage-soft); font-weight: 600; }

.site-footer { padding: 24px 0 8px; color: var(--text-muted); font-size: 13px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 6px; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--sage); text-decoration: underline; }
.footer-copy { margin: 0; }
body.doc-page { padding-bottom: 24px; }

/* 가이드 글 */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); }
.cta-btn {
  display: block; text-align: center; background: var(--sage); color: #fff; font-weight: 700;
  text-decoration: none; padding: 14px 16px; border-radius: 12px; margin: 16px 0;
}
.doc a.cta-btn { color: #fff; }
.cta-btn:hover { filter: brightness(0.95); }
.guide-body .doc-table { table-layout: auto; }
.guide-body strong { font-weight: 700; }
.guide-note { font-size: 13px; color: var(--text-muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.guide-sources, .guide-more { border-top: 1px solid var(--line); margin-top: 20px; }
.guide-sources li { font-size: 14px; overflow-wrap: anywhere; }

/* index 더 알아보기 */
.more-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.more-links a {
  display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); text-decoration: none; background: #fff;
}
.more-links a:hover { border-color: var(--sage); }
.more-links strong { display: block; font-weight: 600; }
.more-links span { display: block; font-size: 13px; color: var(--text-muted); }
@media (min-width: 640px) { .more-links { grid-template-columns: 1fr 1fr; } }

/* 부부 조합 비교 (compare.html) */
body.compare-page { padding-bottom: 24px; }
.field.group { border-top: 1px solid var(--line); padding-top: 12px; }
.field.group:first-child { border-top: 0; padding-top: 0; }
.field.group > legend { font-size: 16px; color: var(--sage); font-weight: 700; margin-bottom: 8px; }
.field .label { display: block; font-weight: 600; margin-bottom: 6px; }
input:disabled { background: var(--bg); color: var(--text-muted); }

.best h2 { color: var(--sage); }
.best-label { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.best-schedule { font-size: 13px; color: var(--text-muted); margin: 4px 0 8px; }
.best .grand { margin-bottom: 0; }
.notes { margin: 12px 0 0; padding-left: 20px; font-size: 14px; color: var(--text-muted); }

.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.segmented.small span { padding: 6px 10px; font-size: 13px; }

.cmp-table { min-width: 620px; }
.cmp-table tbody tr { cursor: pointer; }
.cmp-table tbody tr:hover { background: var(--bg); }
.cmp-table tbody tr.selected { background: var(--sage-soft); }
.cmp-table tbody tr:focus-visible { outline: 2px solid var(--sage); outline-offset: -2px; }
.month-table { margin: 12px 0; }
.month-table summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.secondary-btn {
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--sage); background: #fff; color: var(--sage);
}

.locked-wrap { position: relative; }
.locked-wrap:not(.unlocked) .locked {
  filter: blur(6px); pointer-events: none; user-select: none; max-height: 640px; overflow: hidden;
}
.lock-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; background: linear-gradient(rgba(250, 246, 238, .35), rgba(250, 246, 238, .9));
}
.lock-box {
  background: var(--surface); border: 1px solid var(--sage); border-radius: var(--radius);
  padding: 20px 16px; max-width: 400px; width: 100%; text-align: center; box-shadow: 0 8px 24px rgba(59, 42, 30, .12);
}
.lock-title { font-size: 18px; margin: 0 0 4px; }
.lock-title strong { color: var(--sage); }
.lock-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; }
.notify-form { display: flex; gap: 8px; }
.notify-form input { flex: 1; min-width: 0; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.notify-form button {
  flex: none; font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 0 14px;
  background: var(--sage); color: #fff; cursor: pointer;
}
.lock-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.note-card ul { padding-left: 20px; font-size: 14px; color: var(--text-muted); }
.note-card li { margin-bottom: 4px; }

/* index 비교 카드 링크 버튼 */
.upcoming.ready { opacity: 1; border-style: solid; background: var(--surface); }
.upcoming .cta-btn { margin: 0; }

@media print {
  body { background: #fff; padding: 0; }
  .site-header, .intro, #cmpForm, .lock-overlay, .site-footer, #printBtn, .segmented, .disclaimer { display: none !important; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
  .locked-wrap .locked { filter: none !important; max-height: none !important; }
  .month-table { display: block; }
  .chart { overflow: visible; }
}
.lock-overlay[hidden], .locked-wrap.unlocked .lock-overlay { display: none; }
