/* ============================================================
 * 2420 REALTY_CALC · 집셈 — kit-dashboard 평면 변형
 * 원형(kit-dashboard)의 조밀한 관제 레이아웃·1px 괘선·작은 모서리만 취하고
 * 블러·그라디언트 워시·다색 아이콘은 모두 걷어냈다. 액센트 1색(파인 그린).
 * 데스크톱 = 좌측 계산기 레일 + 본문 / 모바일 = 가로 스크롤 탭.
 * ============================================================ */
:root {
  --bg: #f3f4f1; --surface: #ffffff; --surface-2: #f8f9f7;
  --ink: #15191a; --ink-2: #464d52; --ink-3: #7d858a;
  --line: #dde0db; --line-2: #c9cdc7;
  --accent: #1d5c4d; --accent-ink: #ffffff; --accent-weak: #e4eeea;
  --warn: #8a5a12; --warn-weak: #f6efe2;
  --r: 6px; --r-lg: 8px;
  --rail: 232px; --top: 52px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1110; --surface: #151918; --surface-2: #1a1f1d;
    --ink: #e6e9e7; --ink-2: #a8b0ac; --ink-3: #74807a;
    --line: #262d2a; --line-2: #333b38;
    --accent: #62b59c; --accent-ink: #0b1411; --accent-weak: #18261f;
    --warn: #d9a654; --warn-weak: #2a2215;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1110; --surface: #151918; --surface-2: #1a1f1d;
  --ink: #e6e9e7; --ink-2: #a8b0ac; --ink-3: #74807a;
  --line: #262d2a; --line-2: #333b38;
  --accent: #62b59c; --accent-ink: #0b1411; --accent-weak: #18261f;
  --warn: #d9a654; --warn-weak: #2a2215;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 6px 10px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── 상단 바 ─── */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 5px; font-size: 13px; font-weight: 800; }
.brand small { font-weight: 500; color: var(--ink-3); font-size: 12px; letter-spacing: 0; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-links a { color: var(--ink-2); font-size: 13.5px; padding: 6px 9px; border-radius: var(--r); }
.top-links a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.top-links a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.theme-btn { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.theme-btn:hover { border-color: var(--line-2); color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; }

/* ─── 셸: 레일 + 본문 ─── */
.shell { display: block; }
.rail { display: none; }
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; font-size: 13.5px; color: var(--ink-2); padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.tabs a:hover { text-decoration: none; border-color: var(--line-2); }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.main { padding: 16px; max-width: 1180px; margin: 0 auto; min-width: 0; }

@media (min-width: 1000px) {
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
  .tabs { display: none; }
  .rail {
    display: block; background: var(--surface); border-right: 1px solid var(--line);
  }
  .rail-in { position: sticky; top: var(--top); max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 18px 12px; }
  .rail-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--ink-3); padding: 0 10px; margin: 14px 0 6px; text-transform: uppercase; }
  .rail-label:first-child { margin-top: 0; }
  .rail a { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--ink-2); font-size: 14px; }
  .rail a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
  .rail a .no { font-size: 11px; color: var(--ink-3); width: 18px; font-weight: 600; }
  .rail a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
  .rail a[aria-current="page"] .no { color: var(--accent); }
  .rail-foot { margin-top: 18px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); line-height: 1.5; }
  .main { padding: 24px 28px 40px; }
}

/* ─── 도구 헤더(한 줄) ─── */
.tool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 2px 0 14px; }
.tool-head h1, .tool-head .h1 { font-size: 20px; letter-spacing: -0.02em; margin: 0; font-weight: 800; }
.asof { font-size: 12px; color: var(--ink-3); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; background: var(--surface); white-space: nowrap; }

/* ─── 패널 ─── */
.board { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .board { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.panel-b { padding: 16px; }

/* ─── 폼 ─── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input { position: relative; display: flex; align-items: center; }
.input input, .input select, select.sel {
  width: 100%; height: 42px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  padding: 0 12px; font-size: 16px; font-variant-numeric: tabular-nums;
}
.input input { padding-right: 52px; text-align: right; }
.input .unit { position: absolute; right: 12px; font-size: 13px; color: var(--ink-3); pointer-events: none; }
.input input:focus, select.sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; min-height: 1em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 9px 4px; font-size: 13.5px; color: var(--ink-2); border-left: 1px solid var(--line); cursor: pointer; }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 3px 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.field > label.check { display: flex; margin: 0; font-size: 14px; font-weight: 400; color: var(--ink); }
.check small { display: block; color: var(--ink-3); font-size: 12px; }
details.more { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 10px; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 600; }
details.more[open] summary { margin-bottom: 12px; }

/* ─── 결과 ─── */
.kpi { padding: 18px 16px; border-bottom: 1px solid var(--line); }
.kpi .k-l { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi .k-v { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; margin-top: 2px; word-break: keep-all; }
.kpi .k-s { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.tile { padding: 12px 16px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
.tiles .tile:nth-child(-n+2) { border-top: 0; }
.tiles .tile:nth-child(2n) { border-right: 0; }
@media (min-width: 560px) {
  .tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles.t3 .tile:nth-child(2n) { border-right: 1px solid var(--line); }
  .tiles.t3 .tile:nth-child(3n) { border-right: 0; }
  .tiles.t3 .tile:nth-child(-n+3) { border-top: 0; }
}
.tile .t-l { font-size: 12px; color: var(--ink-3); }
.tile .t-v { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-weight: 500; color: var(--ink-2); }
.tbl td.n, .tbl th.n { text-align: right; white-space: nowrap; }
.tbl tr.sum th, .tbl tr.sum td { font-weight: 800; color: var(--ink); border-bottom: 0; }
.tbl tr.minus td { color: var(--accent); }
.tbl tr.on th, .tbl tr.on td { background: var(--accent-weak); color: var(--ink); font-weight: 700; }
.tbl thead th { font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap.scroll { max-height: 460px; overflow-y: auto; }
.tbl-wrap.scroll thead th { position: sticky; top: 0; z-index: 1; }
.bar { display: flex; height: 10px; margin: 14px 16px 4px; border-radius: 2px; overflow: hidden; background: var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); border-right: 2px solid var(--surface); }
.bar i:nth-child(2) { opacity: .7; } .bar i:nth-child(3) { opacity: .45; } .bar i:nth-child(4) { opacity: .25; }
.flag { margin: 12px 16px; padding: 9px 12px; font-size: 13px; border-radius: var(--r); background: var(--warn-weak); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.flag.ok { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.src { padding: 12px 16px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); line-height: 1.55; }
.src a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { color: var(--accent-ink); opacity: .92; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.more-link { display: inline-block; margin-top: 14px; font-size: 13.5px; font-weight: 600; }

/* ─── index: 계산기 바로가기 ─── */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
@media (min-width: 720px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.quick a { padding: 13px 16px; color: var(--ink); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.quick a:hover { background: var(--surface-2); text-decoration: none; }
.quick a b { display: block; font-size: 14.5px; }
.quick a span { font-size: 12.5px; color: var(--ink-3); }
.quick a .no { font-size: 11px; color: var(--accent); font-weight: 700; }

/* ─── 문서형 페이지 ─── */
.doc { max-width: 760px; }
.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.crumb a { color: var(--ink-2); }
.doc h1 { font-size: 26px; line-height: 1.35; letter-spacing: -0.025em; margin: 0 0 8px; }
.doc .lede { color: var(--ink-2); font-size: 16px; margin: 0 0 6px; }
.doc .meta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.prose { font-size: 16px; line-height: 1.8; }
.prose h2 { font-size: 19px; margin: 34px 0 10px; letter-spacing: -0.015em; padding-top: 14px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 16.5px; margin: 24px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 14.5px; background: var(--surface); border: 1px solid var(--line); }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose thead th { background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.prose .tbl-wrap { margin-bottom: 18px; }
.prose blockquote { margin: 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface); color: var(--ink-2); font-size: 15px; }
.prose blockquote p { margin: 0; }
.prose code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.cta { margin: 26px 0 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r); font-size: 15px; }
.faq h3 { font-size: 16px; margin: 20px 0 6px; }
.cards { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin: 10px 0 18px; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; color: var(--ink); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; font-size: 15.5px; margin-bottom: 3px; }
.card span { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; display: block; }
.card small { display: block; margin-top: 8px; font-size: 12px; color: var(--accent); font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 30px 0 0; }
.pager a { flex: 1; border: 1px solid var(--line); background: var(--surface); padding: 10px 14px; border-radius: var(--r); font-size: 13px; color: var(--ink-3); }
.pager a b { display: block; color: var(--ink); font-size: 14px; }
.pager a.next { text-align: right; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }

/* ─── 광고 (래퍼에 radius·overflow 금지 — 애드핏 §4-1) ─── */
.ad-wrap { margin: 22px 0 6px; }
.ad-grid { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 672px; margin-left: auto; margin-right: auto; }
.ad-grid[data-ad-layout="mixed"] { max-width: 760px; }
.ad-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.ad-cell { min-height: 50px; max-width: 100%; }
.ad-pc { display: none; }
@media (min-width: 720px) { .ad-pc { display: flex; } .ad-mo { display: none; } }

/* ─── 푸터 ─── */
.footer { border-top: 1px solid var(--line); margin-top: 34px; padding: 22px 0 8px; font-size: 13px; color: var(--ink-3); }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.footer nav a { color: var(--ink-2); }
.footer p { margin: 4px 0; }

@media print {
  .topbar, .rail, .tabs, .ad-wrap, .footer, .panel-actions, .theme-btn { display: none !important; }
  .shell { display: block; } body { background: #fff; }
}
