:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --minus: #dc2626;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --card: #141a2e;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #273049;
    --accent: #60a5fa;
    --accent-soft: #1b2a4a;
    --minus: #f87171;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--card); }
.site-header .wrap { height: 56px; display: flex; align-items: center; }
.logo { font-weight: 800; color: var(--accent); text-decoration: none; font-size: 18px; }

.hero { padding: 28px 20px 8px; } /* 좌우 여백을 카드 안쪽 내용과 맞춤 */
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 12px; font-size: 14px; }

.card {
  --pad: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  margin: 16px 0;
}
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field small, th small { color: var(--muted); font-weight: 400; }
.input-unit { position: relative; }
.input-unit em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); }
input, select {
  width: 100%;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}
select { padding-right: 14px; font-size: 16px; }
#annual { font-weight: 700; }
.toggle input { font-weight: normal; }
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hint { color: var(--accent); font-size: 13px; display: block; margin-top: 4px; min-height: 1em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.quick { display: flex; gap: 8px; margin: -6px 0 16px; flex-wrap: wrap; }
.quick button {
  font: inherit; font-size: 13px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer;
}
.quick button:active { background: var(--accent-soft); }

.toggle { border: 0; padding: 0; margin: 0; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.toggle legend { font-weight: 600; font-size: 14px; float: left; margin-right: 8px; }
.toggle input { width: auto; margin-right: 4px; }

.result { background: var(--accent-soft); border-color: transparent; }
.result-label { margin: 0; color: var(--muted); font-size: 14px; }
.result-net { margin: 2px 0; font-size: 34px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.result-meta { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
.breakdown th { text-align: left; font-weight: 500; padding: 8px 0; }
.breakdown td { text-align: right; padding: 8px 0; font-variant-numeric: tabular-nums; }
.breakdown td[id]:not(#gross) { color: var(--minus); }
.breakdown tr + tr { border-top: 1px solid var(--line); }
.breakdown .total th, .breakdown .total td { font-weight: 700; }

.table-scroll { overflow: visible; } /* 스크롤 컨테이너가 있으면 sticky 헤더가 동작하지 않음 */
.salary-table th, .salary-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.salary-table th:first-child, .salary-table td:first-child { text-align: left; }
.salary-table thead th { color: var(--muted); font-weight: 600; font-size: 13px; }
/* 링크가 있는 행만 행 전체 클릭 가능 (site.js) */
.salary-table tbody tr:has(a) { cursor: pointer; }
.salary-table tbody tr:has(a):hover { background: var(--accent-soft); }

.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { color: var(--muted); margin: 8px 0 0; font-size: 16px; line-height: 1.7; }

.disclaimer { color: var(--muted); font-size: 12px; text-align: center; margin: 24px 0; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ── 네비게이션 · 상세 페이지 ── */
.site-header .wrap { justify-content: space-between; }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600; }
.nav a:hover { color: var(--accent); }
a { color: var(--accent); }
.crumbs { font-size: 13px; color: var(--muted); padding: 16px 20px 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs + .hero { padding-top: 8px; }
.breakdown td.minus { color: var(--minus); }
.summary { font-size: 15px; margin: 0 0 12px; }
.btn {
  display: block; text-align: center; margin-top: 16px;
  padding: 12px; border-radius: 12px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 700;
}
@media (prefers-color-scheme: dark) { .btn { color: #0b1020; } }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-grid div { background: var(--bg); border-radius: 12px; padding: 12px; }
.stat-grid span { display: block; font-size: 13px; color: var(--muted); }
.stat-grid b { font-size: 18px; font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.salary-table tr.self td { font-weight: 700; background: var(--accent-soft); }
.salary-table a { text-decoration: none; font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.pager a {
  flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); text-decoration: none; font-size: 14px; font-weight: 600;
}
.pager a:last-child { text-align: right; }
.more-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; font-size: 14px; }
.more-links a { text-decoration: none; font-weight: 600; }

@media (max-width: 420px) {
  .card { --pad: 16px; }
  .hero { padding-left: 16px; padding-right: 16px; }
  .crumbs { padding-left: 16px; padding-right: 16px; }
  .salary-table th, .salary-table td { padding: 10px 4px; font-size: 13px; }
}

/* ── sticky: 실수령액 요약, 표 헤더 ── */
.result-head {
  position: sticky; top: 0; z-index: 3;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 12px;
  padding: var(--pad) var(--pad) 12px;
  background: var(--accent-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 1px 0 var(--line);
}
.result-head .result-meta { margin-bottom: 0; }
.salary-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--card);
  box-shadow: inset 0 -1px 0 var(--line);
}

/* ── 함께 보면 좋은 사이트 ── */
.link-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.link-list a {
  display: block; height: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: var(--text); background: var(--bg);
}
.link-list a:hover { border-color: var(--accent); }
.link-list b { display: block; font-size: 15px; color: var(--accent); }
.link-list b::after { content: " ↗"; font-weight: 400; font-size: 13px; }
.link-list span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
@media (max-width: 520px) { .link-list { grid-template-columns: 1fr; } }

/* ── 맨 위로 버튼 ── */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { filter: brightness(1.1); }
@media (prefers-color-scheme: dark) { .to-top { color: #0b1020; } }
