/* 월급렌즈 — 모바일 우선 반응형 + 다크모드 */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --ink: #161821;
  --muted: #6b7280;
  --line: #e7e9f2;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-soft: #eef0fe;
  --minus: #d6455c;
  --net: #0e9f6e;
  --shadow: 0 1px 2px rgba(20,25,50,.06), 0 8px 24px rgba(20,25,50,.06);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --ink: #e9ebf2;
    --muted: #9aa3b2; --line: #2a2f3a; --brand: #818cf8; --brand-2: #a5b4fc;
    --brand-soft: #20253a; --minus: #f0788c; --net: #34d399;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Malgun Gothic", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-size: 1.15rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { margin-right: 2px; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600;
  padding: 8px 10px; border-radius: 9px;
}
.nav a:hover { color: var(--brand); background: var(--brand-soft); }

/* layout */
.container { max-width: 680px; margin: 0 auto; padding: 20px 16px 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px;
}
.hero { text-align: center; padding: 14px 8px 4px; }
.hero h1 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -.03em; }
.hero .tagline { margin: 0; color: var(--muted); }
.section-title { margin: 0 0 14px; font-size: 1.15rem; }
.section-title small, .label small { color: var(--muted); font-weight: 500; font-size: .8rem; margin-left: 4px; }

/* form */
.calc-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-weight: 700; font-size: .95rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2);
  border-radius: 14px; padding: 5px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 48px; border-radius: 10px; font-weight: 700; color: var(--muted); cursor: pointer;
  transition: all .12s ease;
}
.segmented span small { font-weight: 500; font-size: .72rem; opacity: .85; }
.segmented input:checked + span { background: var(--surface); color: var(--brand);
  box-shadow: 0 1px 3px rgba(20,25,50,.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.money-input { position: relative; display: flex; align-items: center; }
.money-input input {
  width: 100%; height: 52px; padding: 0 44px 0 14px;
  font-size: 17px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  -moz-appearance: textfield;
}
.money-input input::-webkit-outer-spin-button,
.money-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.money-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.money-input .suffix { position: absolute; right: 14px; color: var(--muted); font-size: .95rem; pointer-events: none; }

.btn-primary, .btn-ghost {
  display: flex; align-items: center; justify-content: center; min-height: 54px;
  border-radius: 14px; font-size: 1.05rem; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 0; width: 100%; letter-spacing: -.01em;
}
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--brand); border: 1px solid var(--line); }
.note { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .86rem; }
.alert { background: color-mix(in srgb, var(--minus) 12%, transparent); color: var(--minus);
  padding: 11px 13px; border-radius: 11px; margin: 0 0 16px; font-weight: 600; }

/* result */
.result-hero { text-align: center; background: linear-gradient(160deg, var(--brand-soft), var(--surface)); }
.result-sub { margin: 0 0 4px; color: var(--muted); font-size: .92rem; }
.result-net { margin: 2px 0 6px; font-size: 2.6rem; font-weight: 900; letter-spacing: -.04em;
  color: var(--net); font-variant-numeric: tabular-nums; line-height: 1.1; }
.result-net .won { font-size: 1.1rem; font-weight: 700; margin-left: 4px; }
.result-meta { margin: 0; color: var(--muted); font-size: .85rem; }
.result-compare { margin: 8px 0 0; color: var(--muted); font-size: .85rem; }
.result-compare b { font-variant-numeric: tabular-nums; }
.result-compare .diff-up { color: var(--net); }
.result-compare .diff-down { color: var(--minus); }

.breakdown { margin: 0; display: flex; flex-direction: column; }
.breakdown .row { display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 2px; border-bottom: 1px solid var(--line); }
.breakdown dt { color: var(--ink); }
.breakdown dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.breakdown .sub dt, .breakdown .sub dd { color: var(--muted); font-weight: 500; font-size: .9rem; }
.breakdown .minus dd { color: var(--minus); }
.breakdown .total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 13px; }
.breakdown .total dt, .breakdown .total dd { font-weight: 800; }
.breakdown .net { background: var(--brand-soft); margin: 8px -10px 0; padding: 14px 12px; border: 0;
  border-radius: 12px; }
.breakdown .net dt { font-weight: 800; }
.breakdown .net dd { font-weight: 900; font-size: 1.2rem; color: var(--net); }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn-primary, .actions .btn-ghost { width: auto; flex: 1; }

/* salary table */
.table-scroll { overflow-x: auto; margin: 14px -6px 0; -webkit-overflow-scrolling: touch; }
.salary-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .84rem; }
.salary-table th, .salary-table td { padding: 9px 10px; text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.salary-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  color: var(--muted); font-weight: 700; }
.salary-table .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface);
  text-align: left; font-weight: 800; box-shadow: 1px 0 0 var(--line); }
.salary-table thead .sticky-col { z-index: 3; background: var(--surface-2); }
.salary-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.salary-table tbody tr:nth-child(even) .sticky-col { background: var(--surface-2); }
.salary-table .net { color: var(--net); font-weight: 700; }

/* footer */
.site-footer { max-width: 680px; margin: 16px auto 32px; padding: 0 16px;
  color: var(--muted); font-size: .8rem; text-align: center; }
.disclaimer { margin: 0 0 6px; }
.credit { margin: 0; }

/* desktop niceties */
@media (min-width: 720px) {
  .hero h1 { font-size: 1.9rem; }
  .result-net { font-size: 3rem; }
}
/* small phones */
@media (max-width: 380px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav a { padding: 8px 7px; }
}

/* 시급 통계 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 10px; text-align: center; }
.stat span { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; margin-bottom: 3px; }
.stat span small { font-size: .68rem; opacity: .8; margin-left: 2px; }
.stat b { font-size: 1.02rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 520px) { .stat-row { grid-template-columns: 1fr 1fr; } }

/* 공제 구성 막대 + 범례 */
.deduction-bar { display: flex; height: 16px; border-radius: 9px; overflow: hidden; margin: 0 0 14px;
  background: var(--surface-2); }
.deduction-bar .seg { height: 100%; }
.chart-legend { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap;
  gap: 8px 14px; font-size: .82rem; color: var(--muted); }
.chart-legend li { display: flex; align-items: center; gap: 5px; }
.chart-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.seg-net { background: var(--net); }
.seg-pension { background: #6366f1; }
.seg-health { background: #0ea5e9; }
.seg-ltc { background: #22b8cf; }
.seg-emp { background: #f59e0b; }
.seg-tax { background: var(--minus); }
.seg-local { background: #ec4899; }

/* 탭 (연봉/월급 표) */
.tabs { margin-bottom: 14px; }
.tabs a { display: flex; align-items: center; justify-content: center; min-height: 44px;
  border-radius: 10px; text-decoration: none; font-weight: 700; color: var(--muted); }
.tabs a.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(20,25,50,.12); }

/* 인쇄 */
@media print {
  .site-header, .site-footer, .no-print, .nav { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* 계산기 허브 */
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hub-grid a { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px;
  background: var(--surface-2); text-decoration: none; color: var(--ink); }
.hub-grid a:hover { background: var(--brand-soft); }
.hub-grid b { font-size: .95rem; }
.hub-grid span { font-size: .76rem; color: var(--muted); }
@media (max-width: 380px) { .hub-grid { grid-template-columns: 1fr; } }

/* 인사이트 */
.insight-list { margin: 0; padding-left: 18px; color: var(--ink); font-size: .9rem; }
.insight-list li { margin: 6px 0; }
.guide-steps { margin: 0; padding-left: 20px; color: var(--ink); }
.guide-steps li { margin: 8px 0; }

/* 연봉-실수령 곡선 */
.curve { width: 100%; height: auto; display: block; }
.curve-area { fill: var(--brand-soft); opacity: .55; }
.curve-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.curve-dot { fill: var(--net); stroke: var(--surface); stroke-width: 2; }
.curve-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; margin-top: 6px; }
