/* ==========================================================================
   메디컬·비급여 시세 비교 파인더 — 공통 스타일
   모바일 우선(390px) → 태블릿(720px) → 데스크톱(1440px) 3단 반응형
   ========================================================================== */
:root {
  color-scheme: light;
  /* 디자인 표준화(2026-11-21): 케이메디체크 DESIGN.md v1 토큰을 채택한다.
     배경 Clinic Paper #F6F8F7 · 헤어라인 Rule #D9E1DE · 표면 radius 10px · 입력 8px. */
  --bg: #f6f8f7;
  --bg-soft: #edf1ef;
  --card: #ffffff;
  --ink: #14181c;
  --ink-2: #46505a;
  --muted: #6d7883;
  --line: #d9e1de;
  --line-2: #e7edea;
  --accent: #0f766e;
  --accent-solid: #0f766e;  /* 흰 글씨가 얹히는 채움 요소 전용 — 다크에서도 밝아지지 않는다 (밀크 검수 2026-11-24) */
  --accent-ink: #0b5d56;
  --accent-soft: #e6f4f1;
  --brand-line: #c3e2db;
  --blue: #1d4ed8;
  --blue-soft: #e8efff;
  --violet: #6d28d9;
  --violet-soft: #f1eaff;
  --amber: #b45309;
  --amber-soft: #fff4e0;
  --red: #b42318;
  --red-soft: #fee4e2;
  /* 다크모드 대응(2026-11-24): 직접 박혀 있던 틴트·라인·표면 색을 토큰으로 끌어올렸다.
     라이트 값은 기존 하드코딩과 동일하므로 라이트 화면은 바뀌지 않는다. */
  --header-bg: rgba(255, 255, 255, .92);
  --tint-green-bg: #f2fbf8;
  --tint-red-bg: #fff8f7;
  --red-line: #f6c7c2;
  --amber-line: #fadba6;
  --amber-ink-strong: #713f12;
  --blue-line: #cfdcff;
  --blue-ink-strong: #1e3a8a;
  --blue-ink-deep: #172554;
  --violet-line: #ddd6fe;
  --kosis-bg: #fdfcff;
  --managed-bg: #f4fbf9;
  --result-bg: #fcfdff;
  --teal-ink-2: #0f6b64;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 8px 24px -12px rgba(20, 24, 28, .18);
  --shadow-sm: 0 1px 2px rgba(20, 24, 28, .06);
  --maxw: 1120px;
  --font: "Pretendard Variable", "Pretendard", "Pretendard Fallback",
    -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}
/* 폰트 표준화(2026-11-21): Pretendard 로드 전 폴백의 줄 상자를 Pretendard 메트릭에 맞춰
   swap 뒤 재배치(CLS)를 줄인다. 수치는 폰트 파일 실측(hhea ascent 1950 / descent -494 / upem 2048).
   주차장 파인더와 동일 규율. */
@font-face {
  font-family: "Pretendard Fallback";
  src: local("Apple SD Gothic Neo"), local("Malgun Gothic"), local("Noto Sans KR");
  ascent-override: 95.21%;
  descent-override: 24.12%;
  line-gap-override: 0%;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.64; letter-spacing: -0.02em;
  overflow-x: hidden;                 /* 390px에서 가로 스크롤 방지 */
  word-break: keep-all;               /* '실손' 처럼 단어 중간에서 줄바꿈되지 않게 */
}
code, .cd { word-break: break-word; overflow-wrap: anywhere; }
.prose code { font-size: .86em; }
.prose a, .site-footer a, .data-status, .scope-note { overflow-wrap: anywhere; }
img { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.32; margin: 0 0 .5em; letter-spacing: -0.025em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.15em; }
li { margin: .25em 0; }
small { font-size: 12.5px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em;
  background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- 범위 고지 스트립 */
.scope-strip { background: var(--accent-soft); border-bottom: 1px solid var(--line);
  color: var(--accent-ink); font-size: 11.5px; line-height: 1.5; padding: 7px 0; }
.scope-strip .wrap { display: flex; gap: 6px; align-items: flex-start; }

/* ---------------------------------------------------------------- 프리뷰 배너 */
.preview-banner {
  background: #1f2430; color: #ffe9b8; font-size: 12.5px; line-height: 1.45;
  padding: 9px 16px; text-align: center; border-bottom: 1px solid #000;
}
.preview-banner strong { color: #fff; }
.preview-banner .pb-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #ffb020; margin-right: 6px; vertical-align: 1px; }

/* ---------------------------------------------------------------- 헤더 */
/* ---------------------------------------------------------------- 헤더
   좁은 화면에서 로고 이름 + 메뉴 6개가 한 줄에 안 들어가는 문제(밀크 검수 2026-11-24):
   400px 미만은 로고 마크만, 375~519px은 축약 이름(메디컬파인더), 520px부터 전체 이름.
   720~767px은 헤더 여백을 16px로 줄이고 메뉴 패딩을 좁혀 '가이드'까지 보이게 한다.
   그래도 넘치면(폰트 차이 등) JS가 .is-scrollable 클래스를 달아 오른쪽 페이드 단서를 보여준다. */
.site-header { background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 56px; }
.logo { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 15.5px;
  color: var(--ink); white-space: nowrap; flex: none; }
.logo .txt { display: none; }
.logo .txt-short { display: none; font-size: 12px; }
.nav a .abbr { display: inline; }
.nav a .full { display: none; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 14px; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 6px;
  border-radius: 8px; color: var(--ink-2); font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--bg-soft); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
/* 넘김 단서: 메뉴가 넘칠 때만 오른쪽(스크롤 시 왼쪽도) 페이드 */
.nav.is-scrollable { -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%); }
.nav.is-scrollable.is-scrolled { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%); }

@media (min-width: 375px) {
  .logo .txt-short { display: inline; }
}
@media (min-width: 520px) {
  .logo .txt-short { display: none; }
  .logo .txt { display: inline; font-size: 13.5px; }
  .nav a { font-size: 13px; padding: 6px 8px; }
}
@media (min-width: 720px) {
  .site-header .wrap { padding: 0 16px; }
  .logo .txt { font-size: 15.5px; }
  .nav a { font-size: 13.5px; padding: 7px 8px; }
  .nav a .abbr { display: none; }
  .nav a .full { display: inline; }
}
@media (min-width: 768px) {
  .site-header .wrap { padding: 0 24px; }
  .nav a { padding: 7px 10px; }
}

/* ---------------------------------------------------------------- 공통 조각 */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 1.5;
  background: var(--bg-soft); color: var(--ink-2); white-space: nowrap; }
/* 링크 pill(지역 바로가기 등)은 탭 타겟이라 최소 32px 높이로 키운다 (밀크 검수 2026-11-24).
   44px까지 키우면 칩 줄 레이아웃이 깨져 32px로 타협한다 (WCAG 24px 이상 충족). */
a.pill { min-height: 32px; padding: 6px 12px; }
.pill.teal { background: var(--accent-soft); color: var(--accent-ink); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.line { background: transparent; border: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }

/* ---------------------------------------------------------------- 지역 카드 (지역별 시세 허브) */
.region-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.region-card { display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow-sm); }
.region-card:hover { text-decoration: none; border-color: var(--accent); }
.region-card .rc-head { display: flex; align-items: baseline; gap: 7px; }
.region-card .rc-name { font-size: 17px; font-weight: 800; }
.region-card .rc-full { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.region-card .rc-arrow { margin-left: auto; color: var(--muted); font-size: 18px; font-weight: 700; }
.region-card .rc-meta { display: block; margin-top: 5px; font-size: 12.5px; color: var(--ink-2); }
.region-card .rc-price { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; }
@media (min-width: 560px) { .region-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .region-grid { grid-template-columns: repeat(3, 1fr); } }
.section { padding: 34px 0 6px; scroll-margin-top: 66px; }
section.calc { scroll-margin-top: 66px; }
.section > .wrap > h2 { margin-bottom: 6px; }
.section-lead { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid > * { min-width: 0; }
.grid > * > .card, .card { min-width: 0; }
.scope-note { background: var(--blue-soft); border: 1px solid var(--blue-line); color: var(--blue-ink-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.scope-note b { color: var(--blue-ink-deep); }
.notice { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber-ink-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: var(--radius); font-weight: 700; font-size: 14.5px;
  background: var(--accent-solid); color: #fff; border: 1px solid var(--accent-solid); cursor: pointer; }
.btn:hover { background: var(--accent-ink); text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--accent-ink); border-color: var(--brand-line); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- 히어로 */
.hero { background: var(--card);
  border-bottom: 1px solid var(--line); padding: 30px 0 26px; }
.hero h1 { font-size: 27px; letter-spacing: -0.035em; }
.hero h1 em { font-style: normal; color: var(--accent-ink); }
.hero .lede { color: var(--ink-2); font-size: 14.5px; margin-bottom: 16px; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; box-shadow: var(--shadow-sm); }
.kpi .k { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- 계산기 */
.calc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.calc-head { padding: 16px 18px 0; }
.calc-head h2 { font-size: 18px; margin-bottom: 4px; }
.calc-head p { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.calc-body { padding: 0 18px 18px; }
.field { margin-bottom: 14px; }
.field > label, .field > .label { display: block; font-size: 12.5px; font-weight: 700;
  color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-weight: 500; color: var(--muted); font-size: 11.5px; margin-left: 4px; }
select, input[type="number"], input[type="text"] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: var(--card);
  appearance: none; }
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23667085' stroke-width='1.8' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.amount-row { display: flex; gap: 8px; align-items: center; }
.amount-row input { flex: 1; text-align: right; font-variant-numeric: tabular-nums; }
.amount-row .unit { font-weight: 700; color: var(--muted); font-size: 13px; }
.field-error { margin: 6px 0 0; font-size: 12.5px; font-weight: 700; color: var(--red); line-height: 1.45; }
input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; min-width: 0; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-size: 13.5px;
  font-weight: 700; font-family: inherit; cursor: pointer; }
.seg button:hover { background: var(--bg-soft); }
.seg button[aria-pressed="true"] { background: var(--accent-solid); border-color: var(--accent-solid);
  color: #fff; box-shadow: 0 2px 8px -2px rgba(15, 118, 110, .5); }
.seg.two { display: grid; grid-template-columns: 1fr 1fr; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.row-note { font-size: 12px; color: var(--muted); margin: 7px 0 12px; line-height: 1.55; }
.chip-inline { font-size: 11px; font-weight: 700; color: var(--amber);
  background: var(--amber-soft); border-radius: 999px; padding: 2px 7px; margin-left: 6px; }
.managed-box { border: 1px dashed var(--brand-line); background: var(--managed-bg); border-radius: var(--radius);
  padding: 11px 12px; font-size: 12.5px; color: var(--accent-ink); margin-bottom: 14px; display: none; }
.managed-box.show { display: block; }

/* 결과 */
.result { border-top: 8px solid var(--bg-soft); padding: 16px 18px 20px; background: var(--result-bg); }
.result-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.result-head h3 { margin: 0; font-size: 16.5px; }
.result-head .sub { font-size: 12px; color: var(--muted); }
.best { display: flex; align-items: center; gap: 12px; background: var(--accent-soft);
  border: 1px solid var(--brand-line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.best .big { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--accent-ink); }
.best .lbl { font-size: 12px; color: var(--teal-ink-2); font-weight: 700; }
.best .who { font-size: 12.5px; color: var(--ink-2); }
.best .who b { color: var(--accent-ink); }
.cmp-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.cmp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.cmp th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700;
  padding: 0 8px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cmp td { padding: 11px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.cmp tr:last-child td { border-bottom: 0; }
table.cmp tr.is-excluded td { background: var(--tint-red-bg); }
table.cmp tr.is-best td { background: var(--tint-green-bg); }
.gen-cell { display: flex; flex-direction: column; gap: 1px; }
.gen-cell .g { font-weight: 800; font-size: 14px; white-space: nowrap; }
.gen-cell .p { font-size: 11px; color: var(--muted); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 지역·항목 표의 전국 대비 증감률 (build_site.py가 클래스만 찍는다) */
.pct-up { color: #b91c1c; font-weight: 700; }
.pct-dn { color: #0f766e; font-weight: 700; }
.covered-cell { font-weight: 800; font-size: 15px; color: var(--accent-ink); }
.is-excluded .covered-cell { color: var(--red); }
.copay-cell { color: var(--ink-2); }
.rate-cell { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.badge { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px;
  background: var(--bg-soft); color: var(--ink-2); white-space: nowrap; }
.badge.exclude { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); }
.badge.managed { background: var(--blue-soft); color: var(--blue); }
.badge.special { background: var(--violet-soft); color: var(--violet); }
.badge.cap { background: var(--amber-soft); color: var(--amber); }
.limits { margin: 6px 0 0; padding-left: 14px; font-size: 11.5px; color: var(--muted); }
.limits li { margin: 1px 0; }
.zero-note { font-size: 11.5px; color: var(--red); font-weight: 700; }
.warn-list { margin: 12px 0 0; padding: 12px 14px 12px 28px; background: var(--amber-soft);
  border: 1px solid var(--amber-line); border-radius: var(--radius); font-size: 12.5px; color: var(--amber-ink-strong); }
.warn-list li { margin: 3px 0; }
.calc-foot { font-size: 11.5px; color: var(--muted); margin-top: 12px; }
details.rule { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
details.rule summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

/* ---------------------------------------------------------------- 항목 카드 */
.item-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.item-card { display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px; box-shadow: var(--shadow-sm);
  color: inherit; }
.item-card:hover { border-color: var(--brand-line); text-decoration: none; box-shadow: var(--shadow); }
.item-card .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.item-card .nm { font-weight: 800; font-size: 14.5px; }
.item-card .cd { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.item-card .sm { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.item-card .tags { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 표 */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); }
table.plain th, table.plain td { border: 1px solid var(--line); padding: 9px 10px; text-align: left;
  vertical-align: top; }
table.plain th { background: var(--bg-soft); font-size: 12px; font-weight: 800; white-space: nowrap; }
table.plain td.num, table.plain th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 본문 섹션 */
.prose h2 { margin-top: 26px; }
.prose h2[id] { scroll-margin-top: 70px; }   /* 가이드 목차 앵커가 고정 헤더에 가리지 않도록 */
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 20px; }
.prose .callout { background: var(--card); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px; margin: 12px 0; box-shadow: var(--shadow-sm); font-size: 13.5px; }
.breadcrumb { font-size: 12px; color: var(--muted); padding: 12px 0 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 5px; color: #b6bdcb; }
.page-head { padding: 8px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.faq .a { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; }
.data-status { display: grid; gap: 8px; }
.data-status .row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.data-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
  margin-top: 7px; flex: none; }
.data-status .dot.on { background: var(--accent); }
.data-status .dot.off { background: #e0b4ae; }

/* ---------------------------------------------------------------- 푸터 */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--card);
  padding: 22px 0 30px; font-size: 12.5px; color: var(--muted); }
.site-footer .cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
.site-footer b { color: var(--ink-2); }
.site-footer a { color: var(--ink-2); }
.site-footer .legal { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 11.5px; line-height: 1.7; }

/* ==========================================================================
   반응형
   ========================================================================== */
@media (min-width: 560px) {
  h1 { font-size: 30px; }
  .hero h1 { font-size: 32px; }
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .item-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .grid.g2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 24px; }
  .calc-head { padding: 20px 24px 0; }
  .calc-body { padding: 0 24px 22px; }
  .result { padding: 20px 24px 24px; }
  .item-grid { grid-template-columns: repeat(3, 1fr); }
  .site-footer .cols { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
  h1 { font-size: 34px; }
  .hero { padding: 46px 0 40px; }
  .hero .wrap { max-width: 820px; }
  .hero h1 { font-size: 40px; }
  .section { padding: 46px 0 6px; }
}
@media (min-width: 1024px) {
  .grid.g2 { grid-template-columns: 1.15fr .85fr; align-items: start; }
  /* 계산기 전용 페이지: 입력 폼(좌) + 결과(우) 2단 */
  .calc-page .calc { display: grid; grid-template-columns: minmax(340px, 420px) 1fr;
    grid-template-areas: "head result" "body result"; align-items: start;
    /* 결과 표가 길어도 입력 폼이 아래로 밀리지 않게 행 높이를 고정한다 */
    grid-template-rows: auto 1fr; align-content: start; }
  .calc-page .calc-head { grid-area: head; padding-bottom: 4px; }
  .calc-page .calc-body { grid-area: body; }
  .calc-page .result { grid-area: result; border-top: 0; border-left: 8px solid var(--bg-soft);
    min-height: 100%; }
  .calc-page .calc-head { border-right: 1px solid var(--line-2); }
  .calc-page .calc-body { border-right: 1px solid var(--line-2); }
  .calc-page .calc-head h2 { font-size: 17px; }
  .calc-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: start; }
  .calc-layout .calc { position: sticky; top: 72px; }
  .hero h1 { font-size: 44px; max-width: 20em; }
  .hero .lede { font-size: 16px; max-width: 44em; }
  .calc { }
}
@media (max-width: 699px) {
  /* 다세대 비교표 → 카드형 스택 */
  table.cmp thead { display: none; }
  table.cmp, table.cmp tbody, table.cmp tr, table.cmp td { display: block; width: 100%; }
  table.cmp tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
    padding: 11px 12px; margin-bottom: 9px; box-shadow: var(--shadow-sm); }
  table.cmp tr.is-excluded { background: var(--tint-red-bg); }
  table.cmp tr.is-best { background: var(--tint-green-bg); border-color: var(--brand-line); }
  table.cmp td { border: 0; padding: 3px 0; }
  table.cmp td::before { content: attr(data-label); display: block; font-size: 10.5px;
    color: var(--muted); font-weight: 700; letter-spacing: 0; }
  table.cmp td.gen-cell { display: flex; flex-direction: row; align-items: baseline; gap: 6px;
    padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px dashed var(--line); }
  table.cmp td.gen-cell::before { content: none; }
  table.cmp td.gen-cell .g { font-size: 15.5px; }
  table.cmp td.covered-cell { font-size: 16px; }
  table.cmp td:empty { display: none; }
  .limits { font-size: 11px; }
}
/* 좁은 화면에서는 표를 카드로 세워 읽는다 */
@media (max-width: 699px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack th {
    display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
    padding: 10px 12px; margin-bottom: 9px; box-shadow: var(--shadow-sm); }
  table.stack td, table.stack th { border: 0; padding: 3px 0; white-space: normal; }
  table.stack td::before { content: attr(data-label); display: block; font-size: 10.5px;
    color: var(--muted); font-weight: 700; }
  table.stack th[scope="row"] { font-size: 15px; font-weight: 800; padding-bottom: 6px;
    margin-bottom: 4px; border-bottom: 1px dashed var(--line); background: transparent; }
  table.stack td.num { text-align: left; }
  table.stack td[data-label] { display: flex; justify-content: space-between;
    align-items: baseline; gap: 10px; }
  table.stack td[data-label]::before { flex: 0 0 auto; margin-right: auto; }
}

@media print {
  .site-header, .site-footer, .cta-row, .nav { display: none; }
  body { background: #fff; color: #14181c; }
  .card, .calc { box-shadow: none; }
}

/* ---------------------------------------------------- M-04: 실데이터 · KOSIS · 기관 목록 */
.data-coverage { display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
.card.kosis { border-color: var(--violet-line); background: var(--kosis-bg); }
.card.kosis h3 .pill { margin-left: 4px; }

.hosp-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 10px; }
.hosp-filters input[type="search"] { grid-column: 1 / -1; }
input[type="search"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card); font-size: 15px;
  font-family: inherit; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.hosp-table td, .hosp-table th { font-size: 12.5px; }
.hosp-table td.num { white-space: nowrap; }
.hosp-count { font-size: 12px; color: var(--muted); margin: 8px 0; }
[data-hosp-more] { margin-bottom: 6px; }

@media (min-width: 700px) {
  .hosp-filters { grid-template-columns: 150px 150px 1fr; }
  .hosp-filters input[type="search"] { grid-column: auto; }
}

/* ── 로고 마크 (K-MediCheck) ─────────────────────── */
.logo svg.logo-mark { flex: none; border-radius: 7px; display: block; }

/* ── 신뢰 페이지 (소개·정책·면책·문의) ────────────── */
.doc { max-width: 860px; }
.doc .crumbs { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.doc .doc-sec { margin-top: 26px; }
.doc .doc-sec h2 {
  font-size: 17px; margin: 0 0 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line);
}
.doc .doc-sec p { font-size: 14.5px; color: var(--ink-2); margin: 0 0 10px; line-height: 1.72; }
.doc .doc-sec b { color: var(--ink); }
.doc-list { margin: 0 0 12px; padding-left: 18px; font-size: 14.5px; color: var(--ink-2); }
.doc-list li { margin: 3px 0; }
.form-embed { margin-top: 14px; }
.form-embed iframe {
  display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; min-height: 980px;
}
@media (max-width: 719px) {
  .form-embed iframe { min-height: 1100px; }
  .doc .doc-sec p { font-size: 14px; }
}

/* ==================================================== T-M13 5세대 전환 손익 시뮬레이터 */
.calc.sim-calc { max-width: 100%; }
.sim-calc .sim-step { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 6px; }
.sim-calc .sim-step:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.sim-calc .sim-step h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 10px; }
.sim-calc .sim-step h3 .n {
  width: 21px; height: 21px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 800; flex: none;
}
.seg.five { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.seg.five button { padding: 10px 2px; font-size: 12.5px; }
input[type="range"] {
  width: 100%; margin: 8px 0 2px; accent-color: var(--accent); height: 22px;
  -webkit-appearance: none; appearance: none; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(15, 118, 110, .4);
  margin-top: -8px;
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); }
input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border: 2px solid var(--card); border-radius: 50%; background: var(--accent); }
.chip-btn {
  flex: none; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.chip-btn[aria-pressed="true"] { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.visit-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.visit-row label { font-size: 12px; font-weight: 700; color: var(--ink-2); flex: 1 1 auto; }
.visit-row input { width: 96px; padding: 8px 10px; font-size: 14px; text-align: right; }
.visit-row .unit { font-size: 12px; color: var(--muted); font-weight: 700; }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; }
.check-row input { width: 18px; height: 18px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.sim-teaser { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--brand-line); border-radius: var(--radius-sm);
  padding: 12px 14px; }
.sim-teaser .tx { flex: 1 1 240px; }
.sim-teaser b { font-size: 14px; color: var(--accent-ink); }
.sim-teaser p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }

/* 결과 */
.result.sim-result { margin-top: 16px; border: 1px solid var(--line); border-top: 8px solid var(--bg-soft);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.sim-hold { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 14px 16px; font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.sim-hold b { color: var(--ink); }
.sim-verdict { border-radius: var(--radius); padding: 15px 16px 14px; border: 1px solid var(--line); background: var(--card); }
.sim-verdict.is-save { background: var(--tint-green-bg); border-color: var(--brand-line); }
.sim-verdict.is-loss { background: var(--tint-red-bg); border-color: var(--red-line); }
.sim-verdict.is-hold { background: var(--amber-soft); border-color: var(--amber-line); }
.sim-badge { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); }
.is-save .sim-badge { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.is-loss .sim-badge { background: var(--red); border-color: var(--red); color: #fff; }
.is-hold .sim-badge { background: var(--amber); border-color: var(--amber); color: #fff; }
.sim-big { font-size: 27px; font-weight: 800; letter-spacing: -0.035em; color: var(--ink);
  margin: 8px 0 4px; line-height: 1.22; word-break: keep-all; }
.is-save .sim-big { color: var(--accent-ink); }
.is-loss .sim-big { color: var(--red); }
.is-hold .sim-big { color: var(--amber); }
.sim-big em { font-style: normal; font-size: 16px; font-weight: 800; margin-left: 3px; }
.sim-say { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.62; }
.sim-costs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sim-costs > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; min-width: 0; }
.sim-costs .k { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.sim-costs b { font-size: 14px; font-variant-numeric: tabular-nums; }
.sim-est { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--amber);
  background: var(--amber-soft); border-radius: 999px; padding: 1px 7px; margin-left: 2px; }
.sim-h4 { font-size: 14px; margin: 18px 0 8px; }
.sim-why { margin: 0; padding: 0; list-style: none; }
.sim-why li { border-top: 1px solid var(--line-2); padding: 9px 0; font-size: 13px; color: var(--ink-2);
  line-height: 1.6; }
.sim-why li:first-child { border-top: 0; }
.sim-why b { color: var(--ink); }
.sim-hint { font-size: 11px; color: var(--muted); }
.sim-chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 2px; }
.sim-chart-svg { display: block; width: 100%; height: auto; }
.sim-notes { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sim-notes h4 { font-size: 13.5px; margin: 0 0 8px; }
.note-row { font-size: 11.5px; color: var(--muted); line-height: 1.62; margin: 0 0 7px;
  padding-left: 9px; border-left: 2px solid var(--line); }
.note-row b { color: var(--ink-2); }
.sim-share { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.sim-share .btn { flex: 1 1 auto; }
.sim-share .btn[disabled] { opacity: .5; cursor: not-allowed; }
.sim-share-msg { font-size: 12px; color: var(--accent-ink); margin: 8px 0 0; min-height: 1px; }
#sim-link { margin-top: 8px; font-size: 12.5px; }
@media (min-width: 720px) {
  .sim-costs { grid-template-columns: repeat(4, 1fr); }
  .sim-big { font-size: 34px; }
  .sim-calc .calc-body { padding-bottom: 22px; }
}
.sim-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--muted);
  margin: 8px 0 0; }
.sim-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sim-legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sim-legend .lg-cur::before { background: #1d4ed8; }
.sim-legend .lg-be::before { background: #b45309; border-radius: 1px; height: 11px; width: 3px; }
.sim-legend .lg-zero::before { background: transparent; border-top: 2px dashed #94a3b8; border-radius: 0; width: 12px; height: 2px; }

/* ==========================================================================
   다크모드 (2026-11-24 시범 적용)
   기기·브라우저의 prefers-color-scheme 설정을 따라 자동 전환한다(토글 없음).
   방식: 토큰 값만 어둡게 재정의하고, 토큰으로 못 덮는 곳만 아래에서 보정한다.
   라이트모드 규칙은 이 블록 밖에 있어 기존 화면은 달라지지 않는다.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101613;
    --bg-soft: #1b221e;
    --card: #171e1b;
    --ink: #e9eeeb;
    --ink-2: #b6c0ba;
    --muted: #8d9991;
    --line: #2b342f;
    --line-2: #232b26;
    --accent: #0d9488;
    --accent-solid: #0f766e;  /* 채움 버튼·선택 칩은 다크에서도 #0f766e 유지 → 흰 글씨 대비 5.47:1 */
    --accent-ink: #2dd4bf;
    --accent-soft: #11302b;
    --brand-line: #205048;
    --blue: #8db1ff;
    --blue-soft: #1c2a4d;
    --violet: #bda6fb;
    --violet-soft: #2b2145;
    --amber: #f2b04e;
    --amber-soft: #38280e;
    --red: #ff9a8a;
    --red-soft: #3c1e1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .65);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --header-bg: rgba(16, 22, 19, .88);
    --tint-green-bg: #122a22;
    --tint-red-bg: #2e1a16;
    --red-line: #71362d;
    --amber-line: #6e5318;
    --amber-ink-strong: #f6cf8f;
    --blue-line: #2e4476;
    --blue-ink-strong: #b9ccff;
    --blue-ink-deep: #d7e3ff;
    --violet-line: #4a3d78;
    --kosis-bg: #1e1930;
    --managed-bg: #122a24;
    --result-bg: #131916;
    --teal-ink-2: #2dd4bf;
  }
  /* --accent-ink 가 밝은 틸이라 흰 글씨 버튼 hover 배경으로는 못 쓴다 */
  .btn:hover { background: #115e59; }
  /* 로고 마크(진한 남색 박스)가 어두운 헤더에 묻히지 않게 얇은 테를 두른다 */
  .logo svg.logo-mark { box-shadow: 0 0 0 1px rgba(163, 196, 188, .5); }
  /* select 화살표를 어두운 배경에서도 보이게 밝은 획으로 교체 */
  select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23a7b3ad' stroke-width='1.8' fill='none' stroke-linecap='round'/></svg>"); }
  input.is-invalid { box-shadow: 0 0 0 3px rgba(255, 122, 102, .28); }
  .pct-up { color: #ff9a8a; }
  .pct-dn { color: #2dd4bf; }
  /* 차트 범례 점 색을 switch-gen5.js 의 다크 팔레트와 맞춘다 */
  .sim-legend .lg-cur::before { background: #8db1ff; }
  .sim-legend .lg-be::before { background: #f2b04e; }
  .sim-legend .lg-zero::before { border-top-color: #5f6f66; }
}
