/* 교통안전 표지판의 남색 + 신호봉 주황. 현장에서 햇빛 아래 한 손으로 쓰는 화면 */
:root {
  --navy: #16325c;
  --navy-2: #1f4478;
  --amber: #f28a1a;
  --amber-ink: #8a4300;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --fg: #17202c;
  --muted: #5d6878;
  --line: #d8dee7;
  --ok: #1d7a46;
  --ok-bg: #e3f4ea;
  --warn: #b4521b;
  --warn-bg: #fdeede;
  --bad: #b3261e;
  --bad-bg: #fbe6e4;
  --font: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1621; --surface: #182231; --fg: #e8edf4; --muted: #9aa7b8; --line: #2a3747;
    --navy: #0c1d36; --navy-2: #27507f; --amber: #ff9d35; --amber-ink: #ffc27e;
    --ok: #6fd39a; --ok-bg: #143323; --warn: #ffab70; --warn-bg: #3a2414; --bad: #ff8a80; --bad-bg: #3b1714;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.bar { background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top, 0px); position: sticky; top: 0; z-index: 5; }
.bar-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
.brand { font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; font-size: 17px; }
.baton { width: 8px; height: 22px; border-radius: 4px; background: linear-gradient(var(--amber) 0 62%, #fff 62% 74%, var(--amber) 74%); transform: rotate(20deg); }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.link { background: none; border: 0; color: #c9d6ea; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1100px; margin: 0 auto; padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#vWorker { max-width: 520px; margin: 0 auto; display: grid; gap: 16px; }

.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-height: 46px; }
textarea { resize: vertical; font-weight: 400; }
input[type=month] { width: auto; min-width: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.msg { min-height: 1.4em; margin: 0; font-weight: 600; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; }
.btn.primary { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.go { background: var(--ok); border-color: var(--ok); color: #fff; }

.auth { max-width: 400px; margin: 24px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: grid; gap: 18px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 8px; padding: 4px; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }

/* 공지 · 사용법 */
.notice { max-width: 520px; margin: 0 auto 16px; display: flex; gap: 10px; align-items: baseline; padding: 12px 14px;
  background: var(--warn-bg); border: 1px solid var(--amber); border-radius: var(--r); white-space: pre-line; overflow-wrap: anywhere; }
.notice b { flex: none; color: var(--amber-ink); }
.guide-link { justify-self: center; color: var(--navy-2); font-weight: 600; }
@media (prefers-color-scheme: dark) { .guide-link { color: #8fb8ee; } }
.duty { display: grid; gap: 10px; }
.duty-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.duty .btn { min-height: 52px; font-size: 17px; border: 2px solid var(--bad); color: var(--bad); }
.duty .btn.on { background: var(--bad); color: #fff; }
.pay-detail { display: grid; gap: 12px; max-height: 60vh; overflow: auto; }
.pay-detail table { font-size: 13px; }
dialog.wide { width: min(94vw, 640px); }
.row-end.inline { justify-content: flex-start; flex-wrap: wrap; }
.set-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: start; }

/* 신호수 */
.today { text-align: center; padding-top: 8px; }
.today-date { color: var(--muted); font-weight: 500; }
.clock { font-family: var(--mono); font-size: 56px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.state { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--line); }
.state.in { background: var(--ok-bg); color: var(--ok); }
.state.done { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.site-in input { font-weight: 500; }

.punch { width: 100%; min-height: 128px; border: 0; border-radius: 14px; cursor: pointer; display: grid; place-content: center; gap: 6px;
  background: var(--amber); color: #2a1500; box-shadow: 0 6px 0 var(--amber-ink); transition: transform .08s, box-shadow .08s; }
.punch:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--amber-ink); }
.punch.out { background: var(--navy-2); color: #fff; box-shadow: 0 6px 0 var(--navy); }
.punch:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: default; }
.punch-label { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.punch-sub { font-size: 13px; opacity: .85; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.narrow { max-width: 440px; }
.kv { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: 6px 0; }
.kv span { color: var(--muted); font-size: 14px; }
.kv b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kv a { color: var(--navy-2); font-size: 14px; font-weight: 600; }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
h2 { font-size: 17px; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.tile span { font-size: 13px; color: var(--muted); }
.tile b { font-size: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile.accent { border-color: var(--amber); }
.tile.accent b { color: var(--amber-ink); }
@media (max-width: 760px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.days li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 10px; align-items: center; }
.days .d { font-weight: 700; }
.days .t { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.days .s { grid-column: 2 / 4; color: var(--muted); font-size: 13px; }
.days .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 24px; border: 1px dashed var(--line); border-radius: var(--r); }

/* 관리자 */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--amber); }
.tabs em { font-style: normal; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; background: var(--bg); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--bg); }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.tbl .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl a { color: var(--navy-2); font-size: 12px; font-weight: 600; margin-left: 4px; }
.tbl td.memo { white-space: normal; min-width: 120px; color: var(--muted); font-size: 13px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.pending { background: var(--warn-bg); color: var(--warn); }
.pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.suspended, .pill.rejected { background: var(--bad-bg); color: var(--bad); }
.miss { color: var(--bad); font-weight: 700; }

.users { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.users li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.users li.pending { border-color: var(--warn); }
.u-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.u-name { font-weight: 700; font-size: 16px; }
.u-meta { color: var(--muted); font-size: 13px; }
.u-rate { font-variant-numeric: tabular-nums; font-weight: 600; }
.u-act { display: flex; gap: 6px; flex-wrap: wrap; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(92vw, 420px); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgb(10 20 35 / .5); }
dialog h3 { margin: 0; font-size: 17px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; min-height: 0; }

@media (prefers-color-scheme: dark) { .kv a, .tbl a { color: #8fb8ee; } }
.tbl-wrap + .hint { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 회사 로고 · 안전 문구 (2026-11) */
.logo-chip { display: inline-flex; align-items: center; background: #fff; border-radius: 6px; padding: 4px 8px; line-height: 0; }
.logo-chip img { height: 18px; width: auto; display: block; }
.brand-name { white-space: nowrap; }
@media (max-width: 380px) { .logo-chip img { height: 15px; } .brand { font-size: 15px; gap: 8px; } }
.hero { max-width: 400px; margin: 8px auto 0; text-align: center; display: grid; gap: 8px; justify-items: center; }
.hero-logo { width: min(220px, 60vw); height: auto; background: #fff; border-radius: 10px; padding: 10px 14px; }
.slogan { margin: 4px 0 0; font-size: 17px; font-weight: 700; color: var(--navy-2); letter-spacing: -0.01em; word-break: keep-all; }
@media (prefers-color-scheme: dark) { .slogan { color: #8fb8ee; } }
.hero + .auth { margin-top: 16px; }
.safety { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 4px; }
.safety-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.safety-badge { font-size: 12px; font-weight: 700; color: var(--amber-ink); background: var(--warn-bg); border-radius: 999px; padding: 2px 10px; }
.safety-head a { font-size: 13px; color: var(--navy-2); font-weight: 600; }
.safety b { font-size: 16px; }
.safety p { margin: 0; color: var(--muted); font-size: 14px; word-break: keep-all; }
@media (prefers-color-scheme: dark) { .safety-head a { color: #8fb8ee; } }
/* 하단 Netlify 배지가 버튼·링크를 가리지 않도록 */
.wrap { padding-bottom: 88px; }
.red { color: #d62828; }
@media (prefers-color-scheme: dark) { .red { color: #ff6b6b; } }
.blue { color: #1d4ed8; }
@media (prefers-color-scheme: dark) { .blue { color: #7aa7ff; } }
/* 수호신 듣기 버튼 */
.music { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.music small { color: var(--muted); font-weight: 400; font-size: 12px; }
.music.on { border-color: var(--navy-2); background: var(--navy-2); color: #fff; }
.music.on small { color: #c9d6ea; }
/* 장애대기표 — 앱 색(남색·주황)에 맞춤 */
.roster-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.roster { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.roster th, .roster td { border: 1px solid var(--line); padding: 6px 4px; text-align: center; white-space: nowrap; }
.roster tbody th { background: #eef2f8; color: var(--navy-2); font-weight: 700; font-size: 12px; min-width: 64px; }
.roster .r-date th { background: var(--navy-2); color: #fff; border-color: var(--navy-2); font-weight: 700; }
.roster .r-date th:first-child { background: var(--navy); }
.roster .r-date th small { display: block; font-size: 10px; font-weight: 400; color: #c9d6ea; }
.roster .r-date th.sun { color: #ffb3b3; } .roster .r-date th.sat { color: #a9c8ff; }
.roster .r-date th.out { opacity: .4; }
.roster .r-date th.today { background: var(--amber); color: #2a1500; }
.roster .r-date th.today small { color: #5a2c00; }
.roster td.today { box-shadow: inset 0 0 0 2px var(--amber); }
.roster .r-signal th { background: var(--warn-bg); color: var(--amber-ink); }
.roster .r-signal td { font-weight: 700; }
.roster td.me { background: var(--warn-bg); color: var(--amber-ink); font-weight: 700; }
.roster td.edit { cursor: pointer; } .roster td.edit:hover { background: var(--bg); }
@media (prefers-color-scheme: dark) { .roster tbody th { background: #1c2a3d; color: #b9cdea; } .roster .r-signal th { background: var(--warn-bg); } }
.oncall-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--navy-2); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.oc-badge { font-size: 12px; font-weight: 700; color: #fff; background: var(--navy-2); border-radius: 999px; padding: 2px 10px; }
.link-btn { border: 0; background: none; color: var(--navy-2); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.oc-me { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--amber-ink); font-weight: 700; }
.oc-day { display: grid; gap: 4px; }
.oc-day > b { font-size: 14px; }
.oc-list { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.oc-list em { font-style: normal; color: var(--muted); font-size: 12px; margin-right: 4px; }
.oc-list strong.me { color: var(--amber-ink); background: var(--warn-bg); padding: 0 4px; border-radius: 4px; }
@media (prefers-color-scheme: dark) { .link-btn { color: #8fb8ee; } }
