/* 사장님 급여장부: 색·모양 값은 _tools/design-dna.json(레퍼런스 측정값)에서. 좁은 화면 규칙은 1279px 까지, 2단은 1280px 부터 */
:root {
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --bg: #eff2f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --tint: #d7e5f5;
  --text: #06080c;
  --muted: #4b5058;
  --line: #c9d3e0;
  --line-strong: #7c8796;
  --brand: #1f5fbf;
  --brand-ink: #ffffff;
  --brand-soft: #e3eefb;
  --sky-0: #1f5fbf;
  --sky-1: #2c6fd1;
  --sky-2: #4c95e9;
  --sky-3: #a1c7f3;
  --glass: rgba(255, 255, 255, 0.84);
  --ok: #1d7a51;
  --warn: #8a4d05;
  --warn-soft: #fbefdc;
  --err: #b4232f;
  --row-1: #dcefea;
  --row-2: #f6efb8;
  --row-3: #f2dfdb;
  --row-ink: #23303b;
  --r-s: 12px;
  --r-m: 20px;
  --r-l: 28px;
  --shadow-1: 0 1px 2px rgba(23, 52, 97, 0.06);
  --shadow-2: 0 6px 20px rgba(23, 52, 97, 0.08);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light dark;
}
@media screen and (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1724;
    --surface: #172234;
    --surface-2: #1d2a3f;
    --tint: #22334d;
    --text: #eef2f8;
    --muted: #b3bdcb;
    --line: #33445e;
    --line-strong: #8696ad;
    --brand: #8fbcf5;
    --brand-ink: #0b1626;
    --brand-soft: #22344f;
    --sky-0: #12305f;
    --sky-1: #173f7a;
    --sky-2: #24579c;
    --sky-3: #1a2c48;
    --glass: rgba(15, 23, 36, 0.62);
    --ok: #6fd3a3;
    --warn: #f3c27a;
    --warn-soft: #3a2c16;
    --err: #ff9aa2;
    --row-1: #1f3b38;
    --row-2: #3b3820;
    --row-3: #3d2a2a;
    --row-ink: #eef2f8;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  word-break: keep-all; overflow-wrap: break-word;
}
::selection { background: var(--sky-3); color: var(--text); }
a { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky-2); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 40px; height: 40px; stroke-width: 1.6; }
.sr-only { position: absolute; 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: 12px; top: -60px; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--r-s); z-index: 10; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }

/* ---- 첫 화면: 파랑 그라데이션 + 숫자 하나 크게 (레퍼런스 1) ---- */
.hero {
  background: linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 70%, var(--sky-2) 88%, var(--sky-3) 96%, var(--bg) 100%); /* 흰 글자(15~16px)는 70% 위(#2c6fd1 이상 진한 곳, 대비 4.8:1)에만 놓인다 */
  background-size: 100% 115%;
  color: #ffffff;
  padding: 18px 16px 40px;
  animation: drift 18s var(--ease) infinite alternate;
}
@keyframes drift { from { background-position: 50% 0%; } to { background-position: 50% 100%; } }
.hero-in { max-width: 760px; margin: 0 auto; text-align: center; }
.home { text-align: left; font-size: 15px; }
.home a { color: #ffffff; display: inline-flex; min-height: 44px; align-items: center; font-weight: 600; }
.hero h1 { font-size: 28px; letter-spacing: -0.01em; margin-top: 6px; }
.lede { margin: 8px auto 0; max-width: 34em; font-size: 16px; color: #ffffff; }

.month { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px auto 0; }
.month-step {
  width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.18); color: #ffffff; display: grid; place-items: center;
}
.month-step:hover { background: rgba(255, 255, 255, 0.3); }
.month-strip { display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.month-strip span { width: 54px; text-align: center; font-size: 15px; color: rgba(255, 255, 255, 0.78); line-height: 1.2; padding-bottom: 8px; }
.month-strip span b { display: block; font-size: 20px; font-weight: 600; }
.month-strip span.near { padding-bottom: 4px; }
.month-strip span.now { color: #ffffff; padding-bottom: 0; }
.month-strip span.now b { font-size: 24px; font-weight: 700; }
.month-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.seg { display: inline-flex; gap: 4px; padding: 4px; margin: 18px 0 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.18); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 600; color: #ffffff; }
.seg input:checked + span { background: var(--glass); color: var(--text); }
.seg input:focus-visible + span { outline: 3px solid #ffffff; outline-offset: 1px; }

.total { margin-top: 18px; }
.total-label { font-size: 16px; font-weight: 600; color: #ffffff; }
.total-num { margin-top: 2px; display: flex; justify-content: center; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.total-num output { font-size: clamp(48px, 13vw, 96px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.total-num .unit { font-size: 22px; font-weight: 600; }
.total-note { font-size: 15px; color: #ffffff; max-width: 30em; margin: 6px auto 0; }
.size-note { font-size: 14px; color: #ffffff; max-width: 30em; margin: 8px auto 0; }

.chips { list-style: none; margin: 20px auto 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 620px; }
.chips li {
  background: var(--glass); color: var(--text); border-radius: var(--r-m); padding: 14px 8px;
  border: 1px solid rgba(255, 255, 255, 0.6); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.chip-k { font-size: 14px; color: var(--muted); }
.chip-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---- 본문 ---- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 8px 16px 48px; }
.nojs { background: var(--warn-soft); color: var(--warn); padding: 12px 16px; border-radius: var(--r-s); }
.board { display: grid; gap: 24px; align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; white-space: nowrap;
  transition: transform 120ms var(--ease), background-color 160ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--sky-1); color: #ffffff; }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--surface); color: var(--err); border-color: var(--line); }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; }

/* 직원 목록: 큰 개수 + 행 카드 (레퍼런스 2) */
.staff { min-width: 0; }
.staff-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 16px; }
.staff-head h2 { font-size: 22px; }
.staff-count { font-variant-numeric: tabular-nums; margin-right: auto; }
.staff-count b { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.staff-count span { color: var(--muted); margin-left: 2px; }
.staff-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.staff-hint { color: var(--muted); font-size: 15px; margin-top: 6px; }
.empty { margin-top: 16px; background: var(--surface); border-radius: var(--r-m); padding: 28px 20px; text-align: center; color: var(--muted); box-shadow: var(--shadow-1); display: grid; justify-items: center; gap: 10px; }
.staff-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.row { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-2); overflow: hidden; }
.row-sum {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 16px; background: none; border: 0; text-align: left; cursor: pointer; min-height: 76px;
}
.row-sum:hover { background: var(--surface-2); }
.avatar { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; color: var(--row-ink); background: var(--row-1); }
.row:nth-child(3n+2) .avatar { background: var(--row-2); }
.row:nth-child(3n) .avatar { background: var(--row-3); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 14px; color: var(--muted); }
.row-amt { text-align: right; font-variant-numeric: tabular-nums; }
.row-amt b { display: block; font-size: 19px; }
.row-amt span { font-size: 13px; color: var(--muted); }
.row-body { padding: 0 16px 18px; border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 12px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field label, .field legend { font-size: 15px; font-weight: 600; padding: 0; }
.field .help { font-size: 14px; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field input[type="date"], .field input[type="email"], .field input[type="tel"] {
  width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px; border-radius: var(--r-s);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums;
}
.checks { display: grid; gap: 4px; margin-top: 12px; }
.checks .help { font-size: 14px; color: var(--muted); margin: 0 0 4px 30px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.row-warn { margin-top: 12px; display: grid; gap: 6px; }
.row-warn p { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-s); padding: 8px 12px; font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.csv-note { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* 명세서 */
.slip { min-width: 0; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-2); padding: 16px; }
.slip-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.paper { margin-top: 12px; }
.p-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--text); }
.p-title { font-size: 20px; font-weight: 700; }
.p-who { font-size: 15px; color: var(--muted); }
.p-net { margin: 16px 0 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.p-net b { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.p-sec { margin-top: 16px; }
.p-sec h3 { font-size: 16px; margin-bottom: 6px; }
.p-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.p-table th, .p-table td { padding: 8px 0; text-align: left; font-weight: 400; font-size: 15px; vertical-align: top; }
.p-table td { text-align: right; white-space: nowrap; padding-left: 12px; }
.p-table tr + tr th, .p-table tr + tr td { border-top: 1px solid var(--line); }
.p-table tr.sum th, .p-table tr.sum td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.p-table small { display: block; color: var(--muted); font-size: 13px; }
.p-note { font-size: 14px; color: var(--muted); margin-top: 6px; }
.p-prorate { margin-top: 8px; background: var(--warn-soft); color: var(--warn); border-left: 4px solid var(--warn); border-radius: var(--r-s); padding: 8px 12px; font-size: 14px; }
/* 이 달 근무 없음: 카드를 흐리게, 금액은 0원 */
.row.off .row-amt b, .row.off .row-name { color: var(--muted); }
.row.off .avatar { opacity: 0.55; }
/* 공제가 지급보다 많은 달: 지급 0원, 모자라는 금액은 빨간 줄로 따로 (게이트 r3 필수 1) */
.row.neg .row-amt span { color: var(--err); font-weight: 600; }
.row-warn p.neg, .p-neg { background: var(--surface-2); color: var(--err); border-left: 4px solid var(--err); font-weight: 600; }
.p-neg { margin-top: 8px; border-radius: var(--r-s); padding: 8px 12px; font-size: 14px; }
.p-net.neg b { color: var(--err); }
.p-table tr.neg th, .p-table tr.neg td { color: var(--err); font-weight: 700; }
.total-note.neg { background: var(--surface); color: var(--err); font-weight: 600; border-radius: var(--r-s); padding: 8px 12px; }
.meter { margin-top: 10px; }
.meter-track { position: relative; height: 10px; border-radius: 999px; background: var(--tint); }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sky-3), var(--sky-2)); }
.meter-mark { position: absolute; top: 12px; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 10px solid var(--muted); transform: translateX(-7px); }
.meter-scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 14px; }
.meter-state { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }
.state-ok { color: var(--ok); font-weight: 700; }
.state-wait { color: var(--warn); font-weight: 700; }
.p-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.p-foot a { overflow-wrap: anywhere; }
.slip-actions { margin-top: 16px; display: grid; gap: 8px; }
.print-note { font-size: 14px; color: var(--muted); }

/* 계산 방법·대기명단·고지 */
.basis, .wait, .notice { margin-top: 48px; }
.basis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.basis-card { background: var(--surface); border-radius: var(--r-m); padding: 16px; box-shadow: var(--shadow-1); }
.basis-card:first-child { background: var(--brand-soft); }
.basis-card h3 { font-size: 17px; margin-bottom: 6px; }
.basis-card p { font-size: 15px; color: var(--muted); }
.asof { margin-top: 12px; font-size: 14px; color: var(--muted); }
.wait { background: var(--surface); border-radius: var(--r-l); padding: 20px 16px; box-shadow: var(--shadow-2); }
.wait-lede { margin-top: 6px; color: var(--muted); max-width: 40em; }
.wait-form { display: grid; gap: 18px; margin-top: 16px; max-width: 560px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--line); cursor: pointer; }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.consent { background: var(--surface-2); border-radius: var(--r-s); padding: 14px; font-size: 15px; }
.consent-title { font-weight: 700; }
.consent ul { margin: 6px 0 4px; padding-left: 20px; color: var(--muted); }
.consent li.key { color: var(--text); } /* 법 검수 R2: 목적·보관은 「중요한 내용」이라 굵게·본문색(시행령 제17조) */
.err { color: var(--err); font-size: 14px; }
.wait-status { min-height: 24px; font-weight: 600; }
.wait-status.ok { color: var(--ok); }
.wait-status.bad { color: var(--err); }
.disclaimer { margin-top: 8px; max-width: 46em; }
.src-h { margin-top: 18px; font-size: 16px; }
.src-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 15px; }
.src-list a { display: inline-block; padding: 6px 0; overflow-wrap: anywhere; }
.foot { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.foot-links { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* 좁은 화면(1279px 까지): 한 단. 아주 좁은 폭(360)에서 칩·입력 2열을 줄인다 */
@media (max-width: 1279px) {
  .board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .chips { gap: 6px; }
  .chips li { padding: 12px 4px; }
  .chip-k { font-size: 13px; }
  .chip-v { font-size: 15px; }
  .month-strip span { width: 44px; }
  .month-strip span.far { display: none; }
  .staff-tools { width: 100%; }
  .staff-tools .btn { flex: 1 1 0; padding: 0 10px; }
  .basis-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 359px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1280px) {
  .hero { padding: 24px 24px 56px; }
  .hero h1 { font-size: 32px; }
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .slip { position: sticky; top: 16px; }
  .wrap { padding: 8px 24px 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero { animation: none; }
  .btn { transition: none; }
}

/* 인쇄: 명세서 종이만 */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #ffffff; color: #000000; }
  .hero, .skip, .staff, .basis, .wait, .notice, .foot, .no-print, .sprite, noscript { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .board { display: block; }
  .slip { display: block !important; box-shadow: none; padding: 0; border-radius: 0; background: #ffffff; }
  .slip, .paper { opacity: 1 !important; transform: none !important; } /* 열리는 움직임 중간에 인쇄해도 흐리지 않게 */
  .p-sec { margin-top: 10px; }
  .p-table th, .p-table td { padding: 5px 0; font-size: 13px; }
  .p-table small { font-size: 11px; }
  .p-net { margin: 10px 0 2px; }
  .p-net b { font-size: 24px; }
  .p-foot { margin-top: 12px; font-size: 11px; }
  .p-sec, .p-foot, .meter { break-inside: avoid; }
  .paper { margin: 0; }
  .p-head { border-bottom-color: #000000; }
  .p-table tr + tr th, .p-table tr + tr td { border-top-color: #999999; }
  .p-foot, .p-note, .p-who, .p-table small, .meter-scale { color: #333333; }
  .p-prorate { background: #ffffff; color: #000000; border: 1px solid #000000; border-left-width: 4px; }
  .meter-track { background: #dddddd; }
  a { color: #000000; }
}

/* 명세서 열 때 제목으로 옮긴 초점(tabindex=-1)은 테두리를 그리지 않는다. 키보드 초점 표시는 버튼·입력칸에 그대로 */
#h-slip:focus { outline: none; }
