/* 톤즈의원 잠실점 업무관리 · 공통 스타일
   색상을 바꾸고 싶으면 :root 의 --brand 계열만 바꾸면 됩니다. */
:root {
  color-scheme: only light;
  --brand: #bb2649;
  --brand-ink: #ffffff;
  --brand-soft: #f8e7eb;
  --accent: #202020;

  --bg: #f3eee6;
  --surface: #fffdf9;
  --ink: #202020;
  --ink-2: #5e5850;
  --ink-3: #948c81;
  --line: #e8dfd1;

  --ok: #2e7d4f;     --ok-soft: #e3f2e8;
  --warn: #a8661b;   --warn-soft: #fbefdc;
  --bad: #b23b3b;    --bad-soft: #f8e3e3;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --side-w: 236px;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }

/* ---------- 로그인 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 36px 28px 28px; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .mark { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-weight: 800; font-size: 22px; letter-spacing: -1px; }
.auth-brand h1 { font-size: 20px; margin: 14px 0 2px; letter-spacing: -.3px; }
.auth-brand p { margin: 0; color: var(--ink-3); font-size: 13px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-2); }
.auth-switch button { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; padding: 4px; }
.notice-box { background: var(--brand-soft); border-radius: 10px; padding: 14px 16px; font-size: 14px; color: var(--ink-2); }

/* ---------- 폼 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { background: #fafaf8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: #ecc9c9; }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- 레이아웃 ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side-head { padding: 22px 20px 16px; display: flex; align-items: center; gap: 10px; }
.side-head .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.side-head b { font-size: 15px; letter-spacing: -.3px; }
.side-head small { display: block; color: var(--ink-3); font-size: 11px; }
.nav { padding: 4px 10px 20px; flex: 1; }
.nav-group { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .5px; padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav .soon { font-size: 10px; color: var(--ink-3); background: var(--bg); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.side-foot .who b { display: block; font-size: 14px; }
.side-foot .who small { color: var(--ink-3); }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.page { max-width: 1100px; margin: 0 auto; padding: 32px 32px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; margin: 0; letter-spacing: -.5px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.stat { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.muted { color: var(--ink-3); }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-3); }

/* ---------- 탭 / 표 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .cnt { margin-left: 4px; opacity: .7; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafaf8; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: var(--bg); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- 모달 / 토스트 ---------- */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(20,24,22,.45); }
.modal-head { padding: 20px 22px 4px; display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 14px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 12px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 4px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }

/* ---------- 모바일 ---------- */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar b { font-size: 16px; }
  .hamb { background: none; border: 0; font-size: 22px; padding: 4px 8px; cursor: pointer; }
  .page { padding: 20px 16px 80px; }
  .page-head h2 { font-size: 21px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-m { display: none; }
}

/* =========================================================
   2단계: 근무 스케줄 / 연차 / 홈
   ========================================================= */
.s-e   { --c-bg: #e4edf7; --c-fg: #2b5a8a; }
.s-l   { --c-bg: #ece6f6; --c-fg: #5a3f8f; }
.s-d   { --c-bg: #dff0ec; --c-fg: #2f6b63; }
.s-s   { --c-bg: #fbf0dc; --c-fg: #8a5a14; }
.s-off { --c-bg: #f7e1e1; --c-fg: #a63a3a; }
.lv    { --c-bg: #dcefe2; --c-fg: #2e7d4f; }

.wide-page { max-width: none; }
.month-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-nav b { font-size: 16px; min-width: 96px; text-align: center; }

.brushes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; background: var(--surface); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.brush { border: 2px solid transparent; background: var(--c-bg, #fff); color: var(--c-fg, var(--ink-2)); padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; }
.brush.clr { background: #fff; border-color: var(--line); }
.brush.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.save-state { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); margin: 4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-style: normal; font-size: 11px; font-weight: 700; background: var(--c-bg); color: var(--c-fg); }
.hol-sw { background: #fff; border: 2px solid #e05252; }

.sched-card { padding: 0; overflow: hidden; }
.sched-wrap { overflow: auto; max-height: calc(100vh - 260px); }
table.sched { border-collapse: separate; border-spacing: 0; font-size: 13px; width: max-content; min-width: 100%; }
.sched th, .sched td { border-bottom: 1px solid var(--line); border-right: 1px solid #efede8; text-align: center; padding: 0; }
.sched thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; color: var(--ink-2); padding: 6px 0; }
.sched th.d { width: 34px; min-width: 34px; }
.sched th.d div { font-size: 13px; color: var(--ink); }
.sched th.d small { font-size: 10px; color: var(--ink-3); }
.sched th.sat div, .sched th.sat small { color: #2b5a8a; }
.sched th.sun div, .sched th.sun small, .sched th.hol div, .sched th.hol small { color: #d23c3c; }
.sched th.today { background: var(--brand-soft); }
.sched .name { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 6px 10px; min-width: 92px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched thead .name { z-index: 3; }
.sched td.name b { font-size: 13px; display: block; }
.sched td.name small { font-size: 11px; color: var(--ink-3); }
.sched td.c { height: 36px; font-weight: 700; font-size: 12px; background: var(--c-bg, #fff); color: var(--c-fg, var(--ink)); user-select: none; -webkit-user-select: none; }
.sched td.c.sun { background: #f1f0ec; }
.sched td.c.hol { box-shadow: inset 0 -3px 0 #e05252; }
.sched td.c.ed { cursor: pointer; }
.sched td.c.ed:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.sched td.c.empty-c.ed { background: repeating-linear-gradient(45deg, #fff, #fff 4px, #fafaf7 4px, #fafaf7 8px); }
.sched .sum { min-width: 48px; font-weight: 700; position: relative; }
.warn-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 11px; margin-left: 4px; cursor: help; }
.team-row td { background: #f8f7f3; text-align: left; padding: 0; border-right: 0; }
.team-label { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; }
.team-label b { font-size: 13px; }

/* 연차 */
.leave-card { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; }
.leave-remain small { color: var(--ink-3); font-size: 13px; }
.leave-remain .stat { font-size: 36px; color: var(--brand); }
.leave-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px 16px; }
.leave-meta span { display: block; font-size: 12px; color: var(--ink-3); }
.leave-meta b { font-size: 15px; }
.lv-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lv-row:last-child { border-bottom: 0; }
.lv-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lv-reason { width: 100%; font-size: 13px; }
.lv-act { display: flex; align-items: center; gap: 6px; }
.neg { color: var(--bad); }
.sub { margin: 18px 0 6px; font-size: 14px; }
.adj-form { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; margin-top: 12px; }
.seg { display: flex; gap: 6px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.modal.wide { width: min(680px, calc(100vw - 24px)); }

/* 홈 */
.home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.home-side { display: grid; gap: 14px; }
.link-card { text-decoration: none; color: inherit; display: block; }
.link-card:hover { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.alert-card { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--warn); background: var(--warn-soft); box-shadow: none; padding: 14px 18px; }
.alert-card span { font-size: 13px; }
.roster { display: grid; gap: 12px; }
.roster-team { font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 8px; margin: 0 6px 6px 0; font-size: 14px; font-weight: 600; background: var(--c-bg, var(--bg)); color: var(--c-fg, var(--ink)); }
.chip small { font-size: 11px; opacity: .85; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .leave-card { grid-template-columns: 1fr; gap: 12px; }
  .adj-form { grid-template-columns: 1fr; }
  .sched-wrap { max-height: calc(100vh - 220px); }
  .sched th.d { width: 32px; min-width: 32px; }
  .sched .name { min-width: 72px; max-width: 84px; padding: 4px 6px; }
}

/* 인쇄 (근무 스케줄) */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; }
  .side, .topbar, .no-print, .brushes, .scrim, .toast { display: none !important; }
  .page { padding: 0; }
  .card { box-shadow: none; }
  .sched-wrap { max-height: none; overflow: visible; }
  table.sched { font-size: 9px; width: 100%; }
  .sched th.d { width: auto; min-width: 0; }
  .sched td.c { height: 20px; font-size: 9px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sched .name { position: static; min-width: 60px; }
  .sched thead th { position: static; }
}

/* 3단계: 명단 입력 / 가입코드 / 생일 */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--ink); background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.code.big { font-size: 18px; padding: 3px 10px; background: #fff; }
table.bulk { width: 100%; border-collapse: collapse; }
table.bulk th { font-size: 12px; color: var(--ink-3); text-align: left; padding: 0 4px 6px; font-weight: 600; }
table.bulk td { padding: 3px 4px; }
table.bulk td:nth-child(1) { width: 130px; }
table.bulk .input { padding: 8px 10px; font-size: 14px; }
.bday { padding: 4px 0; font-size: 14px; }
.bday.past { opacity: .5; }
.bday.is-today b { color: var(--ok); }
@media (max-width: 860px) { table.bulk { min-width: 560px; } }

/* 4단계: 입퇴사 서류 */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.doc { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 13px; background: #fff; }
.doc input { width: 16px; height: 16px; accent-color: var(--ok); margin: 0; }
.doc span { flex: 1; }
.doc small { color: var(--ok); font-size: 11px; }
.doc.on { background: var(--ok-soft); border-color: #bfe0cb; }
.resign-box { background: var(--bad-soft); color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.modal-foot { align-items: center; }
.sched td.c.out { background: #f3f2ee; }

/* OT 관리 */
.sched.ot td.oc { height: 34px; min-width: 40px; padding: 0; font-size: 12px; font-weight: 600; }
.sched.ot td.oc.sun { background: #f1f0ec; }
.sched.ot td.oc.pos { background: #e7f4ec; color: var(--ok); }
.sched.ot td.oc.neg { background: #fbe9e9; color: var(--bad); }
.ot-in { width: 100%; height: 34px; border: 0; background: transparent; text-align: center; font: inherit; font-weight: 600; color: inherit; padding: 0; outline: none; }
.ot-in:focus { box-shadow: inset 0 0 0 2px var(--brand); background: #fff; }
.sched.ot .ot-h { min-width: 52px; font-size: 12px; background: #f8f7f3; }
.sched.ot td.ot-s { min-width: 52px; font-size: 13px; font-weight: 600; background: #fbfaf7; }
.sched.ot td.ot-s.strong { font-weight: 800; }
.sched.ot td.ot-s.pos { color: var(--ok); }
.sched.ot td.ot-s.neg { color: var(--bad); }
.sched.ot td.ot-s.pay { background: #fff8ea; }
.pay-in::placeholder { color: #c4b99f; }
.pos-t { color: var(--ok); } .neg-t { color: var(--bad); }
/* OT 요약 칸을 오른쪽에 고정 */
.sched.ot thead th:nth-last-child(-n+5), .sched.ot tbody tr[data-row] td:nth-last-child(-n+5) { position: sticky; z-index: 1; width: 52px; min-width: 52px; max-width: 52px; }
.sched.ot thead th:nth-last-child(-n+5) { z-index: 3; }
.sched.ot :is(th, td):nth-last-child(1) { right: 0; }
.sched.ot :is(th, td):nth-last-child(2) { right: 52px; }
.sched.ot :is(th, td):nth-last-child(3) { right: 104px; }
.sched.ot :is(th, td):nth-last-child(4) { right: 156px; }
.sched.ot :is(th, td):nth-last-child(5) { right: 208px; box-shadow: -4px 0 6px -4px rgba(0,0,0,.15); }
.sched.ot tr.team-row td { position: static; }
@media print { .sched.ot :is(th, td) { position: static !important; box-shadow: none !important; } }
@media (max-width: 860px) { .sched.ot :is(th, td):nth-last-child(-n+5) { position: static !important; box-shadow: none !important; } }

/* 근무 스케줄 · 달력 보기 */
.view-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.view-toggle button { border: 0; background: none; padding: 6px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.view-toggle button.on { background: var(--ink); color: #fff; }
.cal-wrap { display: grid; gap: 12px; }
.calcard { padding: 0; overflow-x: auto; }
table.calw { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 760px; font-size: 13px; }
.calw th, .calw td { border-bottom: 1px solid var(--line); border-right: 1px solid #efede8; padding: 6px; vertical-align: top; }
.calw thead th { background: #f8f7f3; text-align: left; font-weight: 600; color: var(--ink-2); }
.calw thead th b { color: var(--ink); font-size: 14px; }
.calw thead th span { font-size: 12px; }
.calw thead th em { display: block; font-style: normal; font-size: 11px; color: #d23c3c; }
.calw thead th.sat b, .calw thead th.sat span { color: #2b5a8a; }
.calw thead th.hol b, .calw thead th.hol span { color: #d23c3c; }
.calw th.today, .calw td.today { background: var(--brand-soft); }
.calw .out { opacity: .45; }
.calw th.team { width: 58px; background: #f8f7f3; font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center; vertical-align: middle; }
.calw tr.offrow td, .calw tr.offrow th { background: #fdf8f8; }
.cchip { display: inline-flex; align-items: baseline; gap: 3px; margin: 2px 3px 2px 0; padding: 2px 7px; border-radius: 6px; font-weight: 700; font-size: 13px; background: var(--c-bg, var(--bg)); color: var(--c-fg, var(--ink)); white-space: nowrap; }
.cchip small { font-size: 10px; font-weight: 600; opacity: .85; }
@media print {
  .calcard { break-inside: avoid; }
  table.calw { min-width: 0; font-size: 10px; }
  .cchip { font-size: 10px; padding: 1px 4px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .view-toggle { display: none; }
}

/* 재고 · 발주 */
.inv-alerts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
.inv-alerts .alert { display: flex; justify-content: space-between; align-items: center; border: 2px solid transparent; cursor: pointer; text-align: left; font: inherit; padding: 14px 18px; }
.inv-alerts .alert span { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.inv-alerts .alert b { font-size: 24px; }
.inv-alerts .alert.on { border-color: var(--ink); }
.warn-t { color: var(--warn); }
.inv-tools { margin-bottom: 10px; max-width: 320px; }
table.tbl.inv td, table.tbl.inv th { white-space: nowrap; }
.tbl .num { text-align: right; }
.tbl tr.cat-row td { background: #f8f7f3; font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 7px 12px; }
.tbl tr.inactive td { opacity: .45; }
.tbl b.stock { font-size: 16px; }
.tbl td.acts { text-align: right; }
.tbl td.acts .btn { margin-left: 4px; }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-3); }
.proc-grid { display: grid; grid-template-columns: 1fr 280px; gap: 14px; align-items: start; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 6px; cursor: pointer; }
.sched.invgrid .name { min-width: 150px; max-width: 190px; }
.ord-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ord-sum .card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.ord-sum .card b { font-size: 19px; letter-spacing: -.5px; }
.ord-sum .card small { font-size: 12px; }
.ord-sum .card.total { background: var(--ink); color: #fff; }
.ord-sum .card.total span, .ord-sum .card.total small { color: #c9cfcd; }
.low-card { margin-top: 12px; border: 1px solid #f0d4d4; background: #fffafa; }
.low-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-btn { border: 1px solid #ecc9c9; background: #fff; color: var(--bad); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.chip-btn small { color: var(--ink-3); font-weight: 500; }
@media (max-width: 860px) {
  .proc-grid { grid-template-columns: 1fr; }
  .ord-sum { grid-template-columns: 1fr 1fr; }
  .inv-alerts { grid-template-columns: 1fr; }
}
.sched.invgrid thead th:nth-last-child(-n+2), .sched.invgrid tbody tr[data-row] td:nth-last-child(-n+2) { position: sticky; z-index: 1; width: 56px; min-width: 56px; background: #fbfaf7; }
.sched.invgrid thead th:nth-last-child(-n+2) { z-index: 3; }
.sched.invgrid :is(th, td):nth-last-child(1) { right: 0; }
.sched.invgrid :is(th, td):nth-last-child(2) { right: 56px; box-shadow: -4px 0 6px -4px rgba(0,0,0,.15); }
.sched.invgrid tr.team-row td { position: static; }
@media (max-width: 860px) { .sched.invgrid :is(th, td):nth-last-child(-n+2) { position: static !important; box-shadow: none !important; } }

/* 직원 연락망 */
.contact-card { margin-bottom: 12px; padding: 14px 18px; }
.contact-card h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.contact-row:first-of-type { border-top: 0; }
.contact-row .who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contact-row .who b { font-size: 15px; }
.contact-row .who .muted { font-size: 13px; }
.contact-row .tel { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.contact-row .tel a { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--brand); }
.contact-row .tel a.sms { font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; color: var(--ink-2); }
.badge.lv-b { background: var(--ok-soft); color: var(--ok); }
@media print { .contact-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; } .contact-row .badge { display: none; } }

/* 식대 관리 */
.sched.meal th.mh { min-width: 64px; font-size: 12px; }
.sched.meal th.mh small { color: var(--ink-3); font-weight: 500; }
.sched.meal td.mc { min-width: 64px; height: 34px; padding: 0; }
.sched.meal td.mc .ot-in { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.sched.meal td.mc .ot-in::placeholder { color: #b9b4aa; font-weight: 500; font-size: 11px; }
.sched.meal td.mc.off { background: #f4f3ef; }
.sched.meal td.mc.over { background: var(--bad-soft); }
.sched.meal td.mc.over .ot-in { color: var(--bad); }
.sched.meal .name { min-width: 92px; }
.sched.meal tr.sat-row td { background-color: #f9fbfd; }
.sched.meal tr.today-row td.name { background: var(--brand-soft); }
.sat-t { color: #2b5a8a; }
.sched.meal td.ex-cell { cursor: pointer; min-width: 74px; }
.sched.meal td.ex-cell:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.sched.meal tfoot td { position: sticky; bottom: 0; background: #f8f7f3; border-top: 2px solid var(--line); z-index: 1; font-variant-numeric: tabular-nums; }
.sched.meal tfoot td.name { z-index: 2; }
.ex-form { display: grid; grid-template-columns: 100px 120px 1fr 110px auto; gap: 8px; margin-top: 10px; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.rc { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.rc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc .x { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.9); border-radius: 50%; width: 26px; height: 26px; padding: 0; }
.rc-pdf { display: grid; place-items: center; height: 100%; font-weight: 800; color: var(--ink-2); }
.rc-add { display: grid; place-items: center; cursor: pointer; border-style: dashed; color: var(--ink-2); font-weight: 700; font-size: 13px; }
@media (max-width: 860px) { .ex-form { grid-template-columns: 1fr 1fr; } }
.sched.meal td.name b { display: inline; } .sched.meal td.name { white-space: nowrap; }
.sched.meal td.mc { position: relative; }
.sched.meal td.mc .ot-in { padding-right: 16px; }
.rc-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; border-radius: 5px; border: 1px solid var(--line); background: #fff; color: var(--ink-3); font-size: 10px; font-weight: 800; line-height: 1; padding: 0; cursor: pointer; opacity: .55; }
.sched.meal td.mc:hover .rc-btn, .rc-btn.has { opacity: 1; }
.rc-btn.has { background: var(--brand); border-color: var(--brand); color: #fff; }
.rc-name { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 6px; }
@media (max-width: 860px) { .rc-btn { opacity: 1; } }

/* ---------- 업무 매뉴얼 ---------- */
.m-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; align-items: start; }
.m-list { padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.m-list a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.m-list a:hover { background: var(--bg); }
.m-list a.active { background: var(--brand-soft); color: var(--brand); }
.m-doc { padding: 22px 26px; min-width: 0; }
.m-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.m-doc-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.4px; }
.m-actions { display: flex; gap: 6px; flex-shrink: 0; }
.m-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; padding: 10px; background: var(--bg); border-radius: 10px; }
.m-toc a { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); }
.m-toc a:hover { border-color: var(--brand); color: var(--brand); }
.m-hit { display: block; padding: 10px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.m-hit:last-child { border-bottom: 0; }
.m-hit:hover { background: var(--bg); }
.m-hit .small, .small { font-size: 12.5px; }
mark { background: #fff2a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.md { font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.md h2 { font-size: 18px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--brand-soft); scroll-margin-top: 16px; }
.md h3 { font-size: 15.5px; margin: 20px 0 6px; color: var(--brand); }
.md h4 { font-size: 14.5px; margin: 14px 0 4px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md hr { border: 0; border-top: 1px dashed var(--line); margin: 26px 0; }
.md-note { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.md-table { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.md-table table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md-table th { background: var(--bg); text-align: left; font-weight: 700; white-space: nowrap; }
.md-table th, .md-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table td:first-child { font-weight: 600; white-space: nowrap; }
.m-edit-tabs { align-items: center; margin: 4px 0 8px; }
.m-text { width: 100%; min-height: 52vh; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; resize: vertical; }
.m-prev { min-height: 52vh; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.m-chk { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; font-weight: 600; font-size: 14px; }
@media (max-width: 860px) {
  .m-layout { grid-template-columns: 1fr; }
  .m-list { position: static; max-height: none; display: flex; gap: 6px; overflow-x: auto; padding: 6px; }
  .m-list a { white-space: nowrap; flex-shrink: 0; background: var(--bg); }
  .m-doc { padding: 16px; }
  .md-table td:first-child { white-space: normal; }
}
@media print {
  .page.manual .m-list, .page.manual .page-head { display: none; }
  .page.manual .m-layout { display: block; }
  .page.manual .m-doc { box-shadow: none; border: 0; padding: 0; }
}

/* ---------- 공지 · 인수인계 ---------- */
.n-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.n-row:last-child { border-bottom: 0; }
.n-row:hover { background: var(--bg); }
.n-row .n-main { flex: 1; min-width: 0; }
.n-row .n-title { font-size: 15px; margin-bottom: 3px; }
.n-row:not(.unread) .n-title b { font-weight: 600; color: var(--ink-2); }
.n-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); vertical-align: middle; }
.n-reads { margin-top: 18px; padding: 12px 14px; background: var(--bg); border-radius: 10px; font-size: 13px; line-height: 2; }
.n-reads .chip { margin: 0 2px; }
.n-mini { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; color: var(--ink-2); }
.n-mini:last-child { border-bottom: 0; }
.n-mini.unread { color: var(--ink); font-weight: 600; }
.ho-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ho-bar .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.ho-form { padding: 12px; margin-bottom: 12px; }
.ho-form textarea { width: 100%; resize: vertical; }
.ho-form-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.ho-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ho-item:last-child { border-bottom: 0; }
.ho-item.urgent { background: linear-gradient(90deg, var(--bad-soft), transparent 60%); border-radius: 8px; padding-left: 8px; }
.ho-chk input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.ho-main { flex: 1; min-width: 0; }
.ho-text { font-size: 14.5px; line-height: 1.55; margin-bottom: 3px; white-space: normal; word-break: break-all; }
.ho-item.done .ho-text { color: var(--ink-3); text-decoration: line-through; }
.ho-item .btn.ghost { flex-shrink: 0; }
.n-mini .badge, .n-mini .muted { flex-shrink: 0; white-space: nowrap; }
.n-mini .n-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 거래처 ---------- */
.vd-row { align-items: flex-start; }
.vd-main { flex: 1; min-width: 220px; }
.vd-main .small { margin-top: 2px; line-height: 1.5; }
.vd-row .tel { flex-wrap: wrap; justify-content: flex-end; }
.vd-p2 a, .vd-p2 span { font-size: 13px !important; font-weight: 600 !important; color: var(--ink-2) !important; }

/* ---------- 톤즈 로고 ---------- */
.auth-brand .logo { width: 240px; max-width: 80%; height: auto; display: block; margin: 0 auto 6px; }
.side-head { flex-direction: column; align-items: flex-start; gap: 4px; padding: 24px 20px 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-head .logo { width: 170px; height: auto; display: block; }
.side-head small { margin-left: 2px; letter-spacing: .5px; }
.topbar .logo { height: 22px; width: auto; margin-right: 6px; vertical-align: middle; }

/* ---------- 새 홈 (직원 C · 대시보드 D) ---------- */
.home2 .h2-hero { margin-bottom: 18px; }
.home2 .h2-hero h2 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.6px; }
.home2 .h2-hero .muted { font-size: 14px; }
.h2-alerts:empty { display: none; }
.h2-alerts { display: grid; gap: 10px; margin-bottom: 14px; }
.alert-card.bad { color: var(--bad); background: var(--bad-soft); }
.h2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; align-items: start; }
.h2-wide { grid-column: 1 / -1; }
.home2 .card h3 { margin: 0 0 10px; font-size: 15px; }
.h2-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.h2-head .more { font-size: 13px; color: var(--brand); font-weight: 600; white-space: nowrap; }
.home2 .stat, .kpi b { font-size: 28px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.home2 .stat small, .kpi b small { font-size: 15px; font-weight: 500; margin-left: 1px; }
.wk { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.wk-d { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 0; border-radius: 12px; background: var(--bg); }
.wk-d span, .wk-d small { font-size: 12px; color: var(--ink-2); }
.wk-d b { font-size: 17px; }
.wk-d.off small { color: var(--brand); font-weight: 700; }
.wk-d.today { background: var(--brand); color: #fff; }
.wk-d.today span, .wk-d.today small { color: #fff; }
.chip.off { background: var(--brand-soft); color: #8f1c38; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.neg { color: var(--brand); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.tiles > div { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.tiles span { display: block; font-size: 12px; color: var(--ink-2); }
.tiles b { font-size: 22px; font-weight: 800; }
.ho-mini { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; line-height: 1.5; }
.ho-mini .box { width: 16px; height: 16px; border: 2px solid var(--brand); border-radius: 5px; flex-shrink: 0; margin-top: 2px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 13px; text-decoration: none; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.hot { border-color: var(--brand); color: var(--brand); font-weight: 700; }
/* 대시보드 */
.page.dash { max-width: 1280px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 20px; }
.kpi span { font-size: 14px; color: var(--ink-2); }
.kpi small { font-size: 13px; color: var(--ink-3); }
.kpi.hot { background: var(--brand); color: #fff; }
.kpi.hot span, .kpi.hot small { color: rgba(255,255,255,.88); }
.dash-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.dash-grid > .card { flex: 999 1 520px; min-width: 0; }
.dash-side { flex: 1 1 320px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.pend { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pend:first-child { border-top: 0; padding-top: 0; }
.pend span { color: var(--ink-2); }

/* ---------- 휴대폰 아래 탭바 ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .topbar { justify-content: space-between; }
  .topbar .logo { height: 24px; }
  .topbar b { font-size: 14px; color: var(--ink-2); font-weight: 600; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 62px;
    text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 600; background: none; border: 0; cursor: pointer; font-family: inherit; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .active { color: var(--brand); font-weight: 800; }
  .main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .page.home2 { padding: 18px 16px 30px; }
  .home2 .h2-hero h2 { font-size: 22px; }
  .h2-grid { grid-template-columns: 1fr; gap: 12px; }
  .wk { gap: 5px; }
  .wk-d { padding: 8px 0; }
  .wk-d small { font-size: 11px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 22px; }
}
@media print { .tabbar { display: none !important; } }
.h2-grid > *, .dash-side > * { min-width: 0; }
.pend span { text-align: right; }
