/* 시급 계산기 3.0 R2 — 회녹 단일면(카드 0 · 괘선·여백만) + 머리 아래 전 폭 최저임금 눈금자.
   토큰 정본 = han/디자인/DESIGN_HourlyWageCalc_v3.md 「R2 개정」(2026-11-15 20시 형제 배정표).
   서체 = 시스템 고딕만(호스팅 0) · 웨이트 400/800 · 본문 행간 1.45 · 비율 1.333(16·21·28·38) · radius 0 · 그림자 0 · 그라디언트 0. */
:root {
  --ground: #dfecdd;
  --field: #eef5ec;
  --ink: #14201a;
  --sub: #4a5850;
  --line: #a9bfa9;
  --hair: #c3d6c2;
  --ok: #0a6b4b;
  --ok-tint: #c4e0c6;
  --bad: #b42318;
  --bad-tint: #f6d9d4;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px; line-height: 1.45; font-weight: 400;
  word-break: keep-all; overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--ok); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nw { white-space: nowrap; word-break: keep-all; }
b, strong, th, dt, summary, h1, h2 { font-weight: 800; }   /* 브라우저 기본 굵게(700) 를 배정 웨이트 800 으로 — 실물 집합 400/800 */

.page {
  max-width: 1216px; min-height: 100vh; margin: 0 auto; padding: 16px 32px 8px;
  display: grid; gap: 0 48px; align-content: center;
  grid-template-columns: 392px minmax(0, 1fr);
  grid-template-areas: "mast mast" "ruler ruler" "terms board" "rates board" "tail tail";
}

/* ── 머리 — 제목 + 연도 분절, 아래 굵은 괘선 ── */
.mast { grid-area: mast; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 3px solid var(--ink); }
h1 { margin: 0; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.years { margin: 0; padding: 0; border: 0; display: flex; align-items: stretch; }
.years legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* 공방 R5-01: display:none 은 접근 이름까지 지운다 */
.years label { position: relative; }
.years label + label { border-left: 1px solid var(--ink); }
.years input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.years span { display: block; min-height: 44px; min-width: 96px; padding: 0 16px; line-height: 44px; font-size: 21px; font-weight: 800; text-align: center; color: var(--sub); }
.years input:checked + span { color: var(--ink); text-decoration: underline 3px; text-underline-offset: 8px; }
.years input:focus-visible + span { outline: 3px solid var(--ok); outline-offset: -3px; }

/* ── 시그니처 — 최저임금 눈금자(전 폭) ── */
.ruler { grid-area: ruler; position: relative; height: 104px; margin: 0 8px 8px; }
.ruler .track { position: absolute; left: 0; right: 0; top: 40px; height: 12px; background: var(--ok-tint); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); overflow: hidden; }
.ruler .track .lo { display: block; height: 100%; width: var(--cut, 30%); background: var(--bad-tint); }
.ruler .ticks { position: absolute; inset: 0; }
.ruler .tick { position: absolute; top: 32px; width: 0; height: 28px; border-left: 2px solid var(--ink); }
.ruler .tick span { position: absolute; top: 30px; left: 0; transform: translateX(-50%); font-size: 16px; color: var(--sub); white-space: nowrap; }
.ruler .tick.cur { border-left-width: 3px; }
.ruler .tick.cur span { color: var(--ink); font-weight: 800; }
.ruler .tick.alt span { top: 52px; }
.ruler .tick.alt::after { content: ""; position: absolute; left: -1px; top: 28px; height: 24px; border-left: 1px dotted var(--sub); }
.needle { position: absolute; top: 4px; height: 52px; width: 0; border-left: 4px solid var(--ok); }
.needle .nlab { position: absolute; top: -4px; left: 8px; font-size: 16px; font-weight: 800; color: var(--ok); white-space: nowrap; }
.needle.flip .nlab { left: auto; right: 8px; }
body[data-verdict=below] .needle { border-left-color: var(--bad); }
body[data-verdict=below] .needle .nlab { color: var(--bad); }
body[data-verdict=empty] .needle { display: none; }

/* ── 조건(왼쪽 열 — 면 없이 괘선만) ── */
.terms { grid-area: terms; padding: 16px 0 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start; }
.flag, .cell.days, .yoy { grid-column: 1 / -1; }
.cell { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-width: 0; }   /* 라벨 줄 수가 달라도 두 입력칸 바닥 맞춤 */
.cell .k { font-size: 16px; font-weight: 800; }
.cell .k small { font-size: 16px; font-weight: 400; color: var(--sub); }
.cell .v { position: relative; display: block; }
.cell .v i { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 16px; color: var(--sub); pointer-events: none; }
.cell input {
  width: 100%; min-height: 48px; padding: 8px 48px 8px 16px; border: 0; border-bottom: 2px solid var(--ink);
  background: var(--field); color: var(--ink); font: inherit; font-size: 21px; font-weight: 800; text-align: right;
  -moz-appearance: textfield; appearance: textfield;
}
.cell input:focus { border-bottom-color: var(--ok); }
.cell input:focus-visible { outline: 3px solid var(--ok); outline-offset: 0; }
.dayset { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.dayset label { position: relative; }
.dayset label + label { border-left: 1px solid var(--hair); }
.dayset input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dayset span { display: block; min-height: 44px; line-height: 44px; text-align: center; font-size: 16px; font-weight: 800; color: var(--sub); }
.dayset input:checked + span { background: var(--ink); color: #ffffff; }
.dayset input:focus-visible + span { outline: 3px solid var(--ok); outline-offset: -4px; }
.flag { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 800; color: var(--bad); }
.yoy { margin: 0; font-size: 16px; color: var(--sub); display: none; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.yoy span { white-space: nowrap; }   /* R2: 전년 대비 줄은 눈금자 두 눈금과 같은 값 — 같은 값 두 번 표시 금지(공통 ④)로 숨김(값은 app.js 가 계속 채움) */
.yoy .y2 { font-weight: 800; color: var(--ink); }

/* ── 결과(오른쪽 열 — 왼쪽 세로 괘선 하나로 나눔) ── */
.board { grid-area: board; align-self: stretch; padding: 16px 0 0 48px; margin-left: -48px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "h v" "n v"; column-gap: 16px; align-items: end; }
.hero h2 { grid-area: h; margin: 0; font-size: 16px; font-weight: 800; color: var(--sub); }
.specimen { margin-left: 4px; font-size: 16px; font-weight: 400; color: var(--sub); white-space: nowrap; }
.specimen::before { content: "("; } .specimen::after { content: ")"; }
.hero .net { grid-area: n; margin: 0; display: flex; flex-direction: column; }
.hero .net .amt { font-size: 50px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.hero .net .why { font-size: 16px; color: var(--sub); text-wrap: balance; }
.verdict { grid-area: v; margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.verdict .amt { padding: 4px 16px; border: 2px solid var(--ok); background: var(--ok-tint); color: var(--ok); font-size: 21px; font-weight: 800; }
.verdict .why { font-size: 16px; color: var(--ink); }
body[data-verdict=below] .verdict .amt { background: var(--bad-tint); color: var(--bad); border-color: var(--bad); }
body[data-verdict=below] .verdict .why { color: var(--bad); font-weight: 800; }
body[data-verdict=empty] .verdict .amt { background: var(--ground); color: var(--sub); border-color: var(--sub); }

/* 기간 환산 표 */
.period { width: 100%; border-collapse: collapse; }
.period th, .period td { padding: 16px 0 8px; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: baseline; font-weight: 400; }
.period tr:first-child th, .period tr:first-child td { border-top: 1px solid var(--ink); }
.period th { font-size: 16px; font-weight: 800; white-space: nowrap; padding-right: 16px; }
.period th small { font-size: 16px; font-weight: 400; color: var(--sub); margin-left: 4px; }
.period td.amt { font-size: 28px; font-weight: 800; text-align: right; white-space: nowrap; padding-right: 24px; }
.period td.why { font-size: 16px; color: var(--sub); width: 52%; text-wrap: pretty; }
.cut { margin: 0; padding: 4px 0; border-top: 1px dotted var(--sub); border-bottom: 1px dotted var(--sub); font-size: 16px; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.cut .c { white-space: nowrap; }
.printline { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 8px; border-top: 1px solid var(--ink); }
.printline p { margin: 0; }
.printline a { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 800; color: var(--ok); }
.note-mark { min-height: 44px; padding: 0 16px; border: 0; border-left: 1px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* ── 요율표 ── */
.rates { grid-area: rates; padding: 8px 0 0; border-top: 1px solid var(--line); }
.fold summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 16px; font-weight: 800; min-height: 44px; }
.fold summary::-webkit-details-marker { display: none; }
.fold .hint { font-size: 16px; font-weight: 400; color: var(--ok); text-decoration: underline; text-underline-offset: 3px; }
.fold:not([open]) .when-open, .fold[open] .when-closed { display: none; }
.rt { width: 100%; border-collapse: collapse; }
.rt th, .rt td { text-align: left; padding: 8px 16px 8px 0; border-top: 1px solid var(--line); font-size: 16px; vertical-align: baseline; font-weight: 400; }
.rt th:last-child, .rt td:last-child { padding-right: 0; }
.rt thead th { color: var(--sub); border-top: 0; }
.rt tbody th { font-weight: 800; white-space: nowrap; }
.rt .num { white-space: nowrap; font-weight: 800; }
.rt .st { text-wrap: pretty; }
.rt tr.st-fallback .st, .rt tr.st-pending .st, .rt tr.st-stale .st, .rt tr.st-excluded .st { color: var(--bad); }
.rt .src { padding-top: 0; padding-bottom: 0; }
.rt .src a { white-space: nowrap; display: inline-block; min-height: 44px; line-height: 44px; }
.fine { margin: 0; padding-top: 8px; font-size: 16px; color: var(--sub); }
@media (min-width: 1180px) { .fold .hint { display: none; } .fold summary { cursor: default; } }

/* ── 꼬리 ── */
.tail { grid-area: tail; padding-top: 8px; text-align: right; font-size: 14px; color: var(--sub); }   /* 꼬리 = 오른쪽 정렬 각주 한 줄(법정 고지 — 유일한 14px 예외) */
.tail p { margin: 0; }

/* ── 근거 판(모달) ── */
.basis { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; scroll-padding-bottom: 48px; border: 2px solid var(--ink); padding: 16px 24px; background: var(--field); color: var(--ink); font-size: 16px; }
.basis::backdrop { background: rgba(20, 32, 26, 0.55); }
.basis-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.basis-head h2 { margin: 0; font-size: 21px; font-weight: 800; }
.basis-close { min-height: 44px; padding: 0 16px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.notes { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; }
.notes dt { font-weight: 800; }
.notes dd { margin: 0; text-wrap: pretty; }
.notes dd > a { display: inline-block; min-height: 44px; line-height: 44px; }
.notes dd.laws { display: flex; flex-wrap: wrap; gap: 0 16px; }
.notes dd.laws a { display: inline-block; min-height: 44px; line-height: 44px; }
.basis .more { position: sticky; bottom: 0; margin: 8px 0 0; padding: 8px; background: var(--ink); color: #ffffff; font-weight: 800; text-align: center; }
.tallies { border-collapse: collapse; }
.tallies th, .tallies td { padding: 2px 16px 2px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }

/* ── 1179 이하: 1열 · 한 화면(폰 320~430 · 태블릿) ── */
@media (max-width: 1179px) {
  .page { max-width: 720px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "mast" "ruler" "terms" "board" "rates" "tail"; padding: 8px 16px 4px; gap: 0; align-content: start; }
  .mast { flex-wrap: nowrap; gap: 8px; padding-bottom: 4px; }
  h1 { font-size: 28px; }
  .years span { min-width: 64px; padding: 0 8px; font-size: 16px; }
  .terms { padding: 8px 0; gap: 4px 8px; }
  .cell { gap: 2px; }
  .cell .k small { display: none; }
  .cell input { min-height: 44px; padding: 4px 48px 4px 8px; }
  .yoy { display: none; }
  .board { margin-left: 0; padding: 8px 0 0; border-left: 0; gap: 8px; justify-content: flex-start; }
  .hero { grid-template-areas: "h v" "n n" "w w"; row-gap: 0; }
  .hero h2 { white-space: nowrap; }
  .hero .net .amt { font-size: 38px; }
  .hero .net .why { display: none; }
  .verdict { display: contents; }
  .verdict .amt { grid-area: v; justify-self: end; align-self: center; font-size: 16px; padding: 2px 16px; }
  .verdict .why { grid-area: w; font-size: 16px; text-align: left; text-wrap: balance; }
  .ruler { height: 92px; margin: 0 4px; }
  .ruler .track { top: 32px; height: 8px; }
  .ruler .tick { top: 26px; height: 20px; }
  .ruler .tick span { top: 22px; }
  .ruler .tick.alt span { top: 44px; }
  .ruler .tick.alt::after { top: 20px; height: 24px; }
  .needle { height: 44px; }
  .period td.why { display: none; }
  .period th, .period td { padding: 4px 0; }
  .period td.amt { font-size: 21px; padding-right: 0; }
  #eHoliday { display: none; }
  .cut { padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .rates { padding: 0; }
  .fold[open] { position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--ground); padding: 16px; }
  .fold[open] .fine { margin-top: 16px; }
  /* 경고 줄이 보이면 연 환산 행·둘째 눈금 글자를 접어 한 화면 유지 */
  body:has(#inputFlag:not([hidden])) #eYear { display: none; }
  body:has(#inputFlag:not([hidden])) .ruler { height: 72px; }
  body:has(#inputFlag:not([hidden])) .ruler .tick.alt span, body:has(#inputFlag:not([hidden])) .ruler .tick.alt::after { display: none; }
  /* 근거 판 — 패널 자신 scrollHeight ≤ clientHeight */
  .basis { width: calc(100vw - 16px); padding: 8px; border-width: 1px; max-height: calc(100vh - 16px); line-height: 1.45; }
  .basis-head { margin-bottom: 4px; }
  .notes { gap: 0 8px; }
  .notes dd.laws { gap: 0 16px; }
  .notes dd > a, .notes dd.laws a { line-height: 1.45; min-height: 44px; display: inline-flex; align-items: center; }
  .tallies thead { display: none; }
  .tallies tbody { display: grid; grid-template-columns: max-content max-content max-content max-content; gap: 0 8px; }
  .tallies tr { display: contents; }
  .tallies th { white-space: nowrap; }
  .tallies td { justify-self: end; }
  .tallies th, .tallies td { border: 0; padding: 0; }
}
@media (max-width: 640px) {
  .rt thead { display: none; }
  .rt, .rt tbody { display: block; width: 100%; }
  .rt tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; border-top: 1px solid var(--line); padding: 8px 0; }
  .rt th, .rt td { border: 0; padding: 0; }
  .rt tbody th { grid-column: 1; }
  .rt .num { grid-column: 2; text-align: right; }
  .rt .st { grid-column: 1; }
  .rt .src { grid-column: 2; text-align: right; }
}
@media (max-width: 480px) and (max-height: 800px) {
  .page { padding-top: 4px; padding-bottom: 4px; }
  .ruler { height: 72px; }
  .ruler .tick.alt span, .ruler .tick.alt::after { display: none; }
  .period th, .period td { padding: 2px 0; }
  .basis { padding: 8px; }
  .notes { gap: 0 8px; }
}
@media (max-width: 374px) {
  .hero .net .amt { font-size: 28px; }
  .period td.amt { font-size: 16px; }
  .years span { min-width: 52px; }
}
@media (max-width: 340px) {
  .notes { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .notes dd { margin-bottom: 4px; }
  .mast { flex-wrap: wrap; }
  .years { width: 100%; }
  .years label { flex: 1; }
}
@media (max-width: 300px) {
  .hero .net .amt, .period td.amt { white-space: normal; overflow-wrap: anywhere; }
  .nw, .cut .c, .period th { white-space: normal; overflow-wrap: anywhere; }
  .cut { grid-template-columns: minmax(0, 1fr); }
  .terms { grid-template-columns: minmax(0, 1fr); }
  .dayset { grid-template-columns: repeat(4, 1fr); }
  .rt tr { grid-template-columns: minmax(0, 1fr); }
  .rt .num, .rt .src { grid-column: 1; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }   /* 장식 전환·애니메이션은 원래 0 — 정지 경로 보증 */
@media (forced-colors: active) {
  .years input:checked + span, .dayset input:checked + span { border: 4px double Highlight; }
  .verdict .amt { outline: 2px solid CanvasText; }
  .needle { forced-color-adjust: none; border-left-color: CanvasText; }
}
/* 404 */
.nf { grid-template-columns: minmax(0, 480px); grid-template-areas: "board"; justify-content: center; }
.nf .board { justify-content: center; margin: 0; padding: 32px 0; border-left: 0; border-top: 3px solid var(--ink); }
.nf a { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 800; color: var(--ok); }
