/* 근거있는 계산기 — 신뢰가 읽히는 것이 목표. 장식보다 판독성. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-raise: #ffffff;
  --fg: #14181f;
  --fg-muted: #5a6472;
  --fg-faint: #8b95a3;
  --line: #e2e6ec;
  --line-strong: #cdd4dd;
  --accent: #1f4fd8;
  --accent-soft: #eef2fe;
  --accent-fg: #ffffff;
  --minus: #c02b2b;
  --plus: #1a7f4b;
  --warn-bg: #fff6e6;
  --warn-line: #f0c46a;
  --warn-fg: #8a5a05;
  --ok-bg: #ecf8f1;
  --ok-line: #9ad2b4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 14px rgba(16, 24, 40, 0.05);
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --bg-soft: #161b23;
    --bg-raise: #171d26;
    --fg: #e8ecf2;
    --fg-muted: #9aa5b4;
    --fg-faint: #6d7787;
    --line: #262e3a;
    --line-strong: #37404f;
    --accent: #6f9bff;
    --accent-soft: #182338;
    --accent-fg: #0f1319;
    --minus: #ff8a8a;
    --plus: #6ddba0;
    --warn-bg: #2a2211;
    --warn-line: #6b5312;
    --warn-fg: #f0c46a;
    --ok-bg: #10251b;
    --ok-line: #2c5b42;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo',
    'Segoe UI', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--fg); letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }
.nav { display: flex; gap: 16px; margin-left: auto; font-size: 14px; overflow-x: auto; }
.nav a { color: var(--fg-muted); white-space: nowrap; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--fg); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 36px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.25; margin: 0 0 14px; letter-spacing: -0.02em; }
.hero p { font-size: 17px; color: var(--fg-muted); margin: 0 0 8px; max-width: 60ch; }
.hero .stamp {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 18px; padding: 5px 11px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* ---------- calculator grid ---------- */
.cat { margin: 40px 0; }
.cat h2 { font-size: 15px; color: var(--fg-faint); font-weight: 700; letter-spacing: 0.04em; margin: 0 0 14px; text-transform: none; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: block; padding: 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-raise); color: var(--fg);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 16.5px; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 13.5px; color: var(--fg-muted); line-height: 1.55; }
/* 설명 길이가 달라도 카드 높이가 들쭉날쭉하지 않게 */
.grid { grid-auto-rows: 1fr; }
.card { display: flex; flex-direction: column; }
.card p { flex: 1; }

/* ---------- calculator page ---------- */
.calc-head { padding: 34px 0 22px; border-bottom: 1px solid var(--line); }
.breadcrumb { font-size: 13px; color: var(--fg-faint); margin-bottom: 10px; }
.breadcrumb a { color: var(--fg-faint); }
.calc-head h1 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 10px; letter-spacing: -0.02em; }
.calc-head .summary { color: var(--fg-muted); margin: 0; max-width: 68ch; font-size: 15.5px; }

.layout { display: grid; gap: 26px; grid-template-columns: 340px 1fr; align-items: start; padding: 26px 0 60px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-raise); padding: 18px;
}
@media (min-width: 861px) { .panel.sticky { position: sticky; top: 78px; } }

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--fg-faint); margin-top: 5px; line-height: 1.5; }
.input-row { display: flex; align-items: stretch; }
.field input[type='number'], .field select {
  width: 100%; padding: 9px 11px; font-size: 15px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--fg);
  font-family: inherit; font-variant-numeric: tabular-nums;
}
.input-row input[type='number'] { border-radius: 8px 0 0 8px; text-align: right; }
.input-row .unit {
  display: flex; align-items: center; padding: 0 11px;
  border: 1px solid var(--line-strong); border-left: none; border-radius: 0 8px 8px 0;
  background: var(--bg-soft); color: var(--fg-muted); font-size: 13.5px; white-space: nowrap;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field.check { display: flex; align-items: flex-start; gap: 9px; }
.field.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.field.check label { margin: 0; font-weight: 500; }
/* 입력창은 콤마를 못 넣으므로(type=number) 바로 아래에 한국식으로 다시 읽어준다.
   "50000000" 만 보이면 자릿수를 세게 된다. */
.readout {
  font-size: 13px; color: var(--accent); font-weight: 600;
  margin-top: 5px; min-height: 1.25em;
}

/* ---------- results ---------- */
.headline { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); margin-bottom: 24px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--bg-raise); min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--fg-muted); margin-bottom: 5px; }
/* 금액은 통째로 한 줄에 읽혀야 한다. "42,787,716" 다음 줄에 "원"만 떨어지면 안 된다. */
.stat .v {
  font-size: clamp(17px, 2.1vw, 21px); font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow-x: auto;
}
.stat.primary { grid-column: 1 / -1; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.stat.primary .k { color: var(--accent); font-weight: 600; }
.stat.primary .v { font-size: clamp(30px, 6vw, 40px); color: var(--accent); }

h2.sec { font-size: 19px; margin: 34px 0 12px; letter-spacing: -0.01em; }
h2.sec:first-child { margin-top: 0; }
.sec-note { color: var(--fg-muted); font-size: 14px; margin: -6px 0 14px; }

.steps { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.steps caption { text-align: left; font-size: 13px; color: var(--fg-faint); padding: 12px 0 7px; font-weight: 600; }
.steps th, .steps td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.steps td.val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.steps td.val.neg { color: var(--minus); }
.steps tr.hl { background: var(--bg-soft); }
.steps tr.hl td { font-weight: 700; }
.steps .lbl { font-weight: 500; }
.steps .formula { display: block; font-size: 12.5px; color: var(--fg-faint); font-family: var(--mono); margin-top: 3px; line-height: 1.5; }
.steps .note { display: block; font-size: 12.5px; color: var(--fg-muted); margin-top: 4px; line-height: 1.55; }

.src {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 5px;
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-muted);
}
.src:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.notes { margin: 22px 0 0; padding: 0; list-style: none; }
.notes li {
  padding: 11px 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.6;
  background: var(--bg-soft); border-left: 3px solid var(--line-strong); border-radius: 0 8px 8px 0;
  color: var(--fg-muted);
}
.notes li strong { color: var(--fg); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--plus); border: 1px solid var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }

details.sched { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
details.sched summary { padding: 12px 14px; cursor: pointer; font-size: 14px; font-weight: 600; background: var(--bg-soft); }
details.sched .scroll { max-height: 460px; overflow: auto; }
details.sched table { width: 100%; border-collapse: collapse; font-size: 13px; }
details.sched th { position: sticky; top: 0; background: var(--bg-raise); border-bottom: 1px solid var(--line-strong); }
details.sched th, details.sched td { padding: 7px 12px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
details.sched th:first-child, details.sched td:first-child { text-align: left; }
details.sched tbody tr:nth-child(even) { background: var(--bg-soft); }

.faq { margin-top: 12px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { padding: 14px 2px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: 'Q'; color: var(--accent); font-weight: 800; flex: none; }
.faq .a { padding: 0 2px 16px 24px; color: var(--fg-muted); font-size: 14.5px; line-height: 1.7; }

.sources-box { margin-top: 30px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.sources-box h2 { font-size: 14px; margin: 0 0 10px; color: var(--fg-muted); }
.sources-box ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.9; }
.sources-box .asof { color: var(--fg-faint); font-size: 12.5px; }

.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.related a { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; background: var(--bg-raise); }
.related a:hover { border-color: var(--accent); text-decoration: none; }

.disclaimer {
  margin: 34px 0 0; padding: 14px 16px; font-size: 13px; line-height: 1.65;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--fg-muted);
}

.site-footer { border-top: 1px solid var(--line); margin-top: 50px; padding: 28px 0 44px; font-size: 13.5px; color: var(--fg-muted); }
.site-footer a { color: var(--fg-muted); text-decoration: underline; }
.site-footer .row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }

/* ---------- 회사별 성과급 페이지 ---------- */
.notice {
  margin: 20px 0 0; padding: 14px 17px; font-size: 14px; line-height: 1.65;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius); color: var(--fg);
}
.notice strong { color: var(--warn-fg); }

.schemes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.scheme {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 19px; background: var(--bg-raise);
}
.scheme h3 { margin: 0 0 12px; font-size: 16px; letter-spacing: -0.01em; }
.scheme .former { font-size: 12px; font-weight: 500; color: var(--fg-faint); }
.scheme dl { margin: 0 0 12px; display: grid; gap: 5px; font-size: 13.5px; }
.scheme dl > div { display: flex; gap: 10px; }
.scheme dt { color: var(--fg-faint); min-width: 5.5em; }
.scheme dd { margin: 0; font-weight: 600; }
.scheme > p { margin: 0; font-size: 13.5px; color: var(--fg-muted); line-height: 1.65; }

.js-only { display: none; }
.has-js .js-only { display: block; }
.has-js .no-js { display: none; }

/* ---------- 구성 분해 바 ----------
   색은 dataviz 검증기 통과값(라이트 표면 #ffffff / 다크 #171d26).
   라이트에서 3번 계열이 3:1 미만이라 직접 라벨이 필수 — legend 가 그 역할을 한다. */
:root {
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; }
}

.breakdown { margin: 0 0 26px; }
.breakdown figcaption { font-size: 13px; color: var(--fg-muted); margin-bottom: 9px; font-weight: 600; }
.breakdown .bar {
  display: flex; gap: 2px; height: 40px;
  border-radius: 5px; overflow: hidden; background: var(--bg-soft);
}
.breakdown .seg { display: block; min-width: 3px; transition: filter 0.15s; }
.breakdown .bar:hover .seg { filter: saturate(1.15); }
.breakdown .seg.s1 { background: var(--s1); }
.breakdown .seg.s2 { background: var(--s2); }
.breakdown .seg.s3 { background: var(--s3); }

.breakdown .legend {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; gap: 2px;
}
.breakdown .legend li {
  display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px;
  align-items: baseline; padding: 6px 2px; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.breakdown .legend li:last-child { border-bottom: none; }
.breakdown .dot { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.breakdown .dot.s1 { background: var(--s1); }
.breakdown .dot.s2 { background: var(--s2); }
.breakdown .dot.s3 { background: var(--s3); }
.breakdown .lg-label { color: var(--fg); }
.breakdown .lg-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.breakdown .lg-pct { font-variant-numeric: tabular-nums; color: var(--fg-faint); font-size: 13px; min-width: 3.4em; text-align: right; }

/* ---------- 홈 인터랙티브 히어로 ---------- */
.try {
  margin: 26px 0 6px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-raise); box-shadow: var(--shadow);
}
.try h2 { font-size: 15px; margin: 0 0 14px; color: var(--fg-muted); font-weight: 600; }
.try .row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.try .in { flex: 1 1 220px; min-width: 0; }
.try label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.try .input-row input {
  width: 100%; padding: 12px 13px; font-size: 20px; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong); border-radius: 9px 0 0 9px;
  background: var(--bg); color: var(--fg); font-family: inherit;
}
.try .input-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.try .input-row .unit { font-size: 15px; border-radius: 0 9px 9px 0; }
.try .out { flex: 1 1 220px; text-align: right; }
.try .out .k { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.try .out .v {
  font-size: clamp(30px, 6vw, 42px); font-weight: 800; letter-spacing: -0.03em;
  color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1;
}
.try .out .sub { font-size: 13px; color: var(--fg-muted); margin-top: 4px; }
.try .more { margin-top: 14px; font-size: 13.5px; }

/* ---------- 신뢰 배지 ---------- */
.proof { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.proof span, .proof a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--bg-raise); color: var(--fg-muted);
}
.proof a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.proof b { color: var(--fg); font-variant-numeric: tabular-nums; }

/* ---------- 계산기 검색 ---------- */
.finder { margin: 30px 0 6px; }
.finder input {
  width: 100%; padding: 13px 16px; font-size: 16px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--bg-raise); color: var(--fg); font-family: inherit;
}
.finder input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.finder .count { margin-top: 8px; font-size: 13px; color: var(--fg-faint); min-height: 1.2em; }
.cat.is-empty { display: none; }
.card.is-hidden { display: none; }

/* 대표 계산기 강조 */
.card.feat { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.card .tag {
  display: inline-block; margin-bottom: 7px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.card .tag.season { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }
/* 이번 달이 납부·신고 시기인 카드는 눈에 띄게 (JS 가 붙인다) */
.card.is-now { border-color: var(--warn-line); background: color-mix(in srgb, var(--warn-bg) 45%, var(--bg-raise)); }
.card.is-now .tag.season::before { content: '지금 '; }

/* 히어로 미니 분해 바 */
.try .mini { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 12px; background: var(--bg-soft); }
.try .mini span { display: block; }
.try .mini .s1 { background: var(--s1); }
.try .mini .s2 { background: var(--s2); }
.try .mini .s3 { background: var(--s3); }
.try .mini-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; font-size: 12.5px; color: var(--fg-muted); }
.try .mini-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.try .mini-legend .s1 { background: var(--s1); }
.try .mini-legend .s2 { background: var(--s2); }
.try .mini-legend .s3 { background: var(--s3); }
