/* 스마트 포장 — 현장 화면
   체계: 박스라벨메이커 ver.10 화면과 같은 밝은 톤 — 연회색 캔버스 + 흰 카드 + 1px 헤어라인, 무그림자 플랫.
   위계: 현재 카드 4칸 숫자 > 기관·반·박스 > 이전/다음 > 나머지.
   색: 주 버튼만 잉크(#111418) 채움. 식판은 흰 카드 + 파랑 윗변. 간식은 사장님 지시(2026-10-13)로 예외 —
       카드·이전/다음·화면 바탕을 호박색으로 칠하고 큰 「간식 포장 차례」 머리띠를 둔다(1~2m에서 곁눈으로 구별).
       빨강은 수량 빈칸/확인 필요와 주의사항에만. 모서리 반경은 10px 하나. 간격은 4px 배수.
   가독성 하한: 본문 #111418, 보조 #3D4450, 설명 최저 #5F6773·14px (라벨메이커 2026-09-28 지적 이력). */
/* v6 정돈(2026-10-13): 순검정 → 짙은 남색 잉크, 깊이는 1px 헤어라인 + 표면 톤 차이(그림자 없음), 모서리 12px(카드·버튼) / 8px(칩·배지),
   숫자는 고정폭. 색은 의미에만 — 식기 칸(식판 파랑·간식판 호박)만 품목 색 면, 수저 3칸은 중립. 가독성 하한(본문 고대비·12px 이상)은 그대로. */
:root {
  --canvas: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --line: #DDE3EA;
  --line-strong: #A3AFBD;
  --ink: #0F172A;
  --ink-2: #334155;
  --meta: #526070;
  --tray: #1D4ED8;
  --tray-ink: #1E40AF;     /* 식판 칸 라벨 */
  --tray-num: #172554;     /* 식판 칸 숫자 */
  --tray-tint: #EAF1FF;    /* 식판 칸 면 */
  --tray-line: #BCD0F7;
  --snack-deep: #8A3B0A;   /* 간식판 칸 면 (흰 글씨 대비 8:1+) */
  --go: #17703C;           /* 포장 완료 — 채도 낮춘 진한 초록 */
  --go-press: #0F5A2E;
  --r-sm: 8px;
  --snack: #B45309;        /* 간식: 호박색 — 빨강(#C8102E)과 색상이 다르게 */
  --snack-bg: #FFE3BA;     /* 간식 카드 면 (진한 글씨 대비 15:1+) */
  --snack-canvas: #F2C27E; /* 간식 차례일 때 화면 바탕 */
  --snack-ink-2: #4A2F05;  /* 간식 면 위 보조 글씨 (대비 9:1+) */
  --snack-line: #DDA65C;
  --bad: #C8102E;
  --bad-tint: #FDECEE;
  --warn-ink: #7A4F00;
  --warn-tint: #FFF3D1;
  --ok: #127A3A;
  --ok-tint: #E4F3E9;
  --rk: #6D28D9;           /* 수량 변경 · 재확인 (클레임 빨강·일정 노랑·간식 호박색과 다른 보라, 흰 글씨 대비 7:1) */
  --rk-tint: #F1EBFF;
  --rk-ink: #4C1D95;
  --same: #0E7490;         /* 같은 수량 연속 (청록 — 식판 파랑·간식 호박·클레임 빨강·일정 노랑·재확인 보라와 다르게, 흰 글씨 대비 5.4:1) */
  --same-tint: #DDF4F8;
  --same-ink: #134E5E;
  --r: 12px;
  --gap: 8px;
  font-family: "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body { font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; font-variant-numeric: tabular-nums;
  /* 한글은 단어 중간에서 줄을 바꾸지 않는다. 한 단어가 칸보다 길 때만 끊는다(anywhere는 최소 폭을 0으로 만들어 글자가 한 자씩 떨어지므로 쓰지 않음) */
  word-break: keep-all; overflow-wrap: break-word; }
button, select, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.meta { color: var(--meta); font-size: 14px; }
.meta b { color: var(--ink); }

/* ── 버튼: 채움(주) · 외곽선(보조) 두 형태만, 그림자 없음 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--r); padding: 10px 16px; font-weight: 800; cursor: pointer; background: var(--surface); touch-action: manipulation; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .35; cursor: default; }
.btn:focus-visible, .tab:focus-visible, .ctx-btn:focus-visible, .seg-btn:focus-visible, .al-strip:focus-visible { outline: 3px solid var(--tray); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:active { background: #1E293B; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:active { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-outline { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-lg { padding: 12px 20px; font-size: 17px; }
.btn-xl { min-height: 64px; padding: 0 16px; font-size: 20px; }
.btn-block { width: 100%; }

/* ── 칩(태그): 작은 강조 펀처에이션, 면 대용 금지 ── */
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--r-sm); font-size: 13px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.chip-ink { background: var(--ink); color: #fff; }
.chip-outline { border-color: var(--line-strong); color: var(--ink-2); background: var(--surface); }
.chip-mute { background: var(--surface-2); color: var(--meta); border-color: var(--line); }
.chip-done { background: var(--ok-tint); color: var(--ok); border-color: #A9D8B8; }
.chip-chg { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.chip-bad, .chip-grade-special { background: var(--bad-tint); color: var(--bad); border-color: #F0A9B4; }
.chip-grade-focus3 { background: #FFF0E8; color: #A33A08; border-color: #F2B999; }
.chip-grade-focus1 { background: var(--warn-tint); color: var(--warn-ink); border-color: #E8CF8A; }

/* ── 로그인·로딩 ── */
.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.notice-card, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px 20px; width: min(400px, 100%); }
.notice-card { font-size: 18px; font-weight: 700; text-align: center; }
.login-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.login-eyebrow { font-size: 14px; font-weight: 800; color: var(--meta); letter-spacing: .08em; }
.login-title { font-size: 28px; font-weight: 900; letter-spacing: -.02em; margin-top: -8px; }
.login-label { font-size: 15px; font-weight: 800; color: var(--ink-2); }
#login-code { width: 100%; min-width: 0; box-sizing: border-box; font-size: 32px; letter-spacing: .3em; text-align: center; padding: 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); }
#login-code:focus { outline: 3px solid var(--tray); outline-offset: 1px; }
.form-error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 15px; font-weight: 700; }
.hint { color: var(--meta); font-size: 14px; margin: 0; }

/* ── 앱 골격: 상단 한 줄 · 본문 · 하단 바 (스크롤 없이 한 화면) ── */
#screen-main { display: flex; flex-direction: column; height: 100vh; height: var(--app-h, 100vh); }
.topbar { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs { flex: 1 1 auto; display: flex; gap: 2px; min-width: 0; align-self: stretch; }
.tab { position: relative; background: none; border: 0; padding: 0 8px; font-size: 15px; font-weight: 800; color: var(--meta); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.tab-s, .sb-s, .ob-s { display: none; }
/* 상단 맞춤 단계: 1 「출고분」 숨김 → 2 탭 짧은 이름 → 3 여백·글자 축소 */
.topbar.fit1 .ctx-sfx { display: none; }
.topbar.fit2 .tab-l { display: none; }
.topbar.fit2 .tab-s { display: inline; }
.topbar.fit3 { gap: 4px; padding: 0 4px; }
.topbar.fit3 .tab { padding: 0 5px; font-size: 14px; }
.topbar.fit3 .ctx-btn { padding: 0 6px; font-size: 14px; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; background: var(--ink); border-radius: 3px 3px 0 0; }
.tab-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r); background: var(--bad); color: #fff; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; }
.ctx-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-size: 15px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.ctx-caret { font-size: 12px; color: var(--meta); }
.pbar { flex: 0 0 auto; height: 3px; background: var(--line); }
.pfill { height: 100%; background: var(--ok); width: 0; transition: width .2s; }
main { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--gap); }
main:has(> .stage), main:has(> .done-screen) { overflow: hidden; }
.bottombar { flex: 0 0 auto; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.bottombar:empty { display: none; }

/* ── 배너 ── */
.banner { padding: 8px 12px; font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.banner-warn { background: var(--warn-tint); color: var(--warn-ink); }
.banner-info { background: var(--surface-2); color: var(--ink-2); }
.banner-error { background: var(--bad-tint); color: var(--bad); }
/* 인터넷 끊김(조작 기기): 주황 면 + 흰 글씨(대비 5:1+) — 멈춤 빨강·간식 호박색과 구별. 한 줄, 좁으면 뒤 설명이 아래로 */
.banner-offline { background: #C2410C; color: #fff; border-bottom: 0; flex-wrap: wrap; justify-content: flex-start; gap: 2px 10px; padding: 6px 12px; }
.banner-offline b { font-size: 16px; font-weight: 900; }
.banner-offline span { font-size: 13px; font-weight: 700; }
.banner-sending { background: #9A3412; }
.banner-net { flex-wrap: wrap; justify-content: flex-start; gap: 0 8px; }
.banner-net span { white-space: nowrap; }
.banner-sent { background: var(--ok-tint); color: var(--ok); }
.oq-failed { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.oq-failed li { display: grid; gap: 2px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.oq-failed li span { color: var(--bad); font-size: 13px; }
.empty { color: var(--ink-2); padding: 24px 16px; text-align: center; font-weight: 700; }
.empty-sm { color: var(--meta); padding: 8px 4px 16px; font-size: 14px; }

/* ── 투입 작업: 이전 · 현재 · 다음 ── */
.stage { height: 100%; display: flex; flex-direction: column; gap: var(--gap); }
.slot-prev, .slot-next { flex: 0 0 auto; }
.slot-cur { flex: 1 1 auto; min-height: 0; display: flex; }

/* 맞춤 단계 (app.js fitAll — 세로 화면만). 현재 카드가 절대 우선:
   1 이전·다음을 이름 줄 + 수량 한 줄 요약으로 → 2 기사 띠 압축 → 3 이전 숨김 → 4 현재 카드 여백·글자 축소 → 5 다음 숨김
   → 6 현재 카드 한 단계 더 축소 → 7 정식 기관명 줄(보조 정보) 숨김. 숫자가 칸보다 넓을 때는 단계와 따로 그 숫자만 줄인다(fitNumbers) */
.stage.fit1 .mini { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 4px 8px; }
.stage.fit1 .mini-flag { order: 9; }
.stage.fit1 .mini-inst { font-size: 17px; }
.stage.fit1 .mini-cls { font-size: 16px; }
.stage.fit1 .mini-box { font-size: 15px; }
.stage.fit1 .mini-q { display: flex; flex-wrap: wrap; gap: 0 10px; border: 0; border-radius: 0; overflow: visible; background: none; }
.stage.fit1 .mq { flex-direction: row; align-items: baseline; gap: 3px; padding: 0; border: 0; background: none; }
.stage.fit1 .mq i { font-size: 13px; }
.stage.fit1 .mq b, .stage.fit1 .mq.q-zero b, .stage.fit1 .mq.q-bad b { font-size: 17px; line-height: 1.25; }
.stage.fit1 .mq.q-bad b { color: var(--bad); }
.stage.fit1 .mq.q-bad i { color: var(--bad); }
.stage.fit2 .seg-bar { min-height: 36px; gap: 4px; }
.stage.fit2 .sb-k { display: none; }
.stage.fit2 .sb-name { font-size: 17px; }
.stage.fit2 .sb-btn { height: auto; min-height: 34px; padding: 2px 8px; font-size: 13px; }
.stage.fit2 #sb-search .sb-l, .stage.fit2 .sb-l { display: none; }
.stage.fit2 .sb-s { display: inline; }
.stage.fit3 .slot-prev { display: none; }
.stage.fit4 .label-head { padding: 4px 10px; }
.stage.fit4 .label.is-snack .label-head { padding: 4px 10px; }
.stage.fit4 .label.is-snack .type-tag { font-size: 20px; }
.stage.fit4 .label-body { padding: 4px 10px 6px; }
.stage.fit4 .label-inst { font-size: clamp(28px, 8.5vw, 44px); }
.stage.fit4 .label-full { font-size: 13px; margin-top: 0; }
.stage.fit4 .label-row { margin-top: 2px; }
.stage.fit4 .label-cls { font-size: clamp(22px, 6.8vw, 36px); }
.stage.fit4 .label-box { font-size: clamp(20px, 5.8vw, 30px); padding: 0 10px; }
.stage.fit4 .size-big { font-size: 16px; padding: 0 8px; }
.stage.fit4 .al-strip { min-height: 32px; padding: 2px 10px; }
.stage.fit4 .label-foot, .stage.fit4 .label-note { padding: 4px 10px; font-size: 13px; }
.stage.fit4 .q { padding: 2px; gap: 0; }
.stage.fit4 .qk { font-size: 13px; }
.stage.fit4 .qv { font-size: clamp(36px, min(13vw, calc(var(--app-h, 640px) * .085)), 120px); }
.stage.fit4 .al-text { font-size: 14px; }
.stage.fit5 .slot-next { display: none; }
.stage.fit6 .label-inst { font-size: clamp(24px, 7vw, 36px); }
.stage.fit6 .label-cls { font-size: clamp(20px, 6vw, 30px); }
.stage.fit6 .qv { font-size: clamp(32px, min(11vw, calc(var(--app-h, 640px) * .07)), 100px); }
.stage.fit6 .q-long .qv { font-size: clamp(26px, 8.5vw, 80px); }
.stage.fit7 .label-full { display: none; }
/* 「없음」·「확인 필요」 칸은 단계와 상관없이 작은 글씨 그대로 (단계 규칙이 덮어쓰지 않게 뒤에 둔다) */
.stage .q-zero .qv, .stage .q-bad .qv { font-size: 20px; white-space: normal; text-align: center; }
/* 하단 조작 바 맞춤: 1 글자 축소 → 2 옆 버튼은 화살표만 */
.op-bar.fit1 .btn-xxl { font-size: 20px; }
.op-bar.fit1 .btn-side { min-width: 60px; padding: 0 6px; }
.op-bar.fit2 .ob-l { display: none; }
.op-bar.fit2 .ob-s { display: inline; }
.op-bar.fit2 .btn-side { min-width: 52px; font-size: 22px; }

/* 이전·다음 = 두 줄 요약 */
.mini { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r); padding: 8px 10px; display: grid; gap: 6px; }
.mini.is-tray { border-left-color: var(--tray); }
.mini.is-snack { border-left-color: var(--snack); }
.mini.is-driver { border-left-color: var(--ink); }
.mini-empty { display: flex; gap: 8px; align-items: center; }
/* 기관명·반명은 말줄임 없이 — 넘치면 다음 줄로(단어 단위) */
.mini-l1 { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.mini-tag { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--meta); white-space: nowrap; }
.mini-type { flex: 0 0 auto; font-size: 13px; font-weight: 900; white-space: nowrap; }
.mini.is-tray .mini-type { color: var(--tray); }
.mini.is-snack .mini-type { color: var(--snack); }
.mini-inst { flex: 0 1 auto; font-size: 22px; font-weight: 900; min-width: 0; letter-spacing: -.02em; line-height: 1.2; }
.mini-cls { flex: 0 1 auto; font-size: 20px; font-weight: 800; color: var(--ink-2); min-width: 0; letter-spacing: -.01em; line-height: 1.2; }
.mini-box { flex: 0 0 auto; font-size: 18px; font-weight: 800; border: 1.5px solid var(--ink-2); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
/* 「기관 변경」 = 카드 위 작은 띠 (제목 줄을 차지하지 않게) */
.mini-flag { justify-self: start; font-size: 12px; font-weight: 900; line-height: 18px; color: #fff; background: var(--ink); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.mini-done { flex: 0 0 auto; margin-left: auto; color: var(--ok); font-weight: 900; font-size: 20px; }
.mini .chip { height: 22px; font-size: 12px; }
.mini-q { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mq { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 2px 2px 4px; border-right: 1px solid var(--line); }
.mq:last-child { border-right: 0; }
.mq i { font-style: normal; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.mq b { font-size: 26px; font-weight: 900; line-height: 1.05; color: var(--ink); letter-spacing: -.02em; }
/* 이전·다음의 작은 수량도 같은 규칙: 식기 수량만 품목 색 */
.mq-main { background: var(--tray-tint); }
.mq-main i { color: var(--tray-ink); }
.mq-main b { color: var(--tray-num); }
.mq.q-zero { background: var(--surface-2); }
.mq.q-zero b { font-size: 16px; line-height: 1.7; color: var(--meta); font-weight: 700; letter-spacing: 0; }
.stage.fit1 .mq-main { background: var(--tray-tint); border-radius: 6px; padding: 0 6px; }
.stage.fit1 .mq-main.q-zero { background: none; padding: 0; }
.stage.fit1 .mini .mq-cut, .stage.fit1 .mini.is-snack .mq-cut.q-zero { background: none; }
.mini.is-snack .mq-main:not(.q-zero):not(.q-bad) { background: var(--snack-deep); }
.mini.is-snack .mq-main:not(.q-zero):not(.q-bad) i, .mini.is-snack .mq-main:not(.q-zero):not(.q-bad) b { color: #fff; }
.mq.q-bad { background: var(--bad); }
.mq.q-bad i, .mq.q-bad b { color: #fff; }
.mq.q-bad b { font-size: 15px; line-height: 1.8; letter-spacing: 0; }
.mini.is-done .mini-inst, .mini.is-done .mq b { color: var(--ink-2); }

/* 현재 카드 = 라벨지 */
.label { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--tray); border-radius: var(--r); overflow: hidden; }
.label.is-snack { border-top-color: var(--snack); }
.label-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.type-tag { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-sm); border: 0; background: var(--tray-tint); color: var(--tray-ink); font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.label.is-snack .type-tag { border-color: var(--snack); color: var(--snack); }
.label-driver .type-tag { border-color: var(--ink); color: var(--ink); }
.band-seq { margin-left: auto; font-size: 15px; font-weight: 800; color: var(--ink-2); }
.label-body { flex: 0 0 auto; padding: 8px 12px 10px; }
.label-inst { font-size: clamp(34px, 10.5vw, 56px); font-weight: 900; line-height: 1.08; letter-spacing: -.03em; }
.label-full { font-size: 14px; color: var(--meta); font-weight: 700; margin-top: 2px; }
.label-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.label-cls { flex: 1 1 auto; min-width: 0; font-size: clamp(26px, 8vw, 44px); font-weight: 900; line-height: 1.12; letter-spacing: -.02em; }
/* BOX 번호 = 배지(1.5px 남색 테두리, 8px 모서리) — 두꺼운 검정 박스 대신 */
.label-box { flex: 0 0 auto; border: 1.5px solid var(--ink); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); padding: 2px 12px; font-size: clamp(22px, 6.6vw, 36px); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.label-box.no-box { font-size: 14px; border: 1px dashed var(--line-strong); color: var(--meta); }

/* 4칸 높이는 fitAll()이 「이름+숫자가 칸 안에 들어오는가」로 지킨다(모자라면 이전·다음 카드부터 줄임) */
/* 수량 4칸 = 「식기 1칸 | 수저 3칸」 두 묶음. 식기 칸은 품목 색 면(식판 연파랑 / 간식판 진호박+흰 글씨), 수저 3칸은 흰 면 한 덩어리 */
.qty4 { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--surface-2); padding: 8px; }
.q { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 6px 4px; }
.qk { font-size: 14px; font-weight: 700; color: var(--meta); white-space: nowrap; letter-spacing: -.01em; }
.q-main { margin-right: 8px; border-radius: var(--r-sm); background: var(--tray-tint); border: 1px solid var(--tray-line); }
.q-main .qk { color: var(--tray-ink); font-weight: 800; }
.q-main .qv { color: var(--tray-num); }
.q-cut { background: var(--surface); border: 1px solid var(--line); border-left: 0; }
.q-cut:nth-child(2) { border-left: 1px solid var(--line); border-radius: var(--r-sm) 0 0 var(--r-sm); }
.q-cut:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.q-cut + .q-cut { box-shadow: inset 1px 0 0 var(--line); }
/* 높이 기준 = 실제로 보이는 높이(--app-h). 100vh는 인앱 브라우저에서 실제보다 커서 쓰지 않는다 */
.qv { font-size: clamp(40px, min(15vw, calc(var(--app-h, 640px) * .10)), 140px); font-weight: 900; line-height: 1; letter-spacing: -.02em; white-space: nowrap; }
.q-long .qv { font-size: clamp(30px, min(10.5vw, calc(var(--app-h, 640px) * .075)), 104px); }
.q-zero .qv { font-size: 20px; color: var(--meta); letter-spacing: 0; font-weight: 700; }
.q-main.q-zero { background: var(--surface); border: 1px dashed var(--line-strong); }
.q-main.q-zero .qk { color: var(--meta); }
.q-bad, .q-main.q-bad, .q-cut.q-bad { background: var(--bad); border-color: var(--bad); }
.q-bad .qk, .q-bad .qv { color: #fff; }
.q-bad .qv { font-size: 20px; letter-spacing: 0; }
.label-note { flex: 0 0 auto; padding: 8px 12px; border-top: 1px solid var(--line); font-weight: 900; font-size: 16px; background: var(--warn-tint); color: var(--warn-ink); }
.label-foot { flex: 0 0 auto; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--ink-2); }

/* 주의사항: 현재 카드 안 얇은 띠 → 눌러서 펼치기 */
.al-strip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; font-size: 15px; font-weight: 700; }
.al-strip.al-claim { background: var(--bad-tint); color: var(--bad); }
.al-strip.al-sched { background: var(--warn-tint); color: var(--warn-ink); }
/* 「반복 내용 강조」·특별관리 고정: 빨강 면 + 흰 글씨로 진하게 (대비 5.9:1) */
.al-strip.al-strong { background: var(--bad); color: #fff; border-bottom-color: var(--bad); }
.al-strip.al-strong .al-icon { background: #fff; }
.al-strip.al-strong .al-icon::before { color: var(--bad); }
.al-icon { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; background: currentColor; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; }
.al-icon::before { content: "!"; color: #fff; font-size: 13px; }
/* 주의 띠 글자는 말줄임 없이 줄바꿈 (펼친 목록 높이는 fitAll이 4칸을 지키는 만큼만 준다) */
.al-text { flex: 1 1 auto; min-width: 0; }
.al-text b { font-weight: 900; }
.al-caret { flex: 0 0 auto; font-size: 13px; font-weight: 800; text-decoration: underline; }
.al-panel { flex: 0 1 auto; min-height: 48px; list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); max-height: 40%; overflow-y: auto; }
.al-item { display: grid; gap: 2px; padding: 8px 12px 8px 14px; border-left: 4px solid var(--bad); }
.al-item + .al-item { border-top: 1px solid var(--line); }
.al-item.al-sched { border-left-color: #D99A00; }
/* 특수 식기 일정: 접지 않는 진한 노랑 띠 + 검은 굵은 글씨(주의 표지판) — 연한 면의 다른 띠들과 한눈에 다르게 (2026-10-21) */
.sched-strip { flex: 0 0 auto; display: grid; gap: 2px; padding: 6px 12px; background: #FACC15; color: #1A1300; border-top: 3px solid #1A1300; border-bottom: 3px solid #1A1300; }
.ss-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ss-tag { flex: 0 0 auto; padding: 1px 8px; border-radius: 6px; background: #1A1300; color: #FACC15; font-size: 14px; font-weight: 900; }
.ss-title { font-size: 22px; font-weight: 900; }
.ss-detail { font-size: 15px; font-weight: 700; }
.stage.fit4 .sched-strip { padding: 3px 10px; }
.stage.fit4 .ss-title { font-size: 18px; }
.q.q-sched { outline: 4px solid #1A1300; outline-offset: -4px; }
.q.q-sched .qk { background: #FACC15; color: #1A1300; font-weight: 900; border-radius: 4px; padding: 0 4px; max-width: 100%; white-space: normal; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.mini-flag.mini-flag-sched { background: #FACC15; color: #1A1300; font-weight: 900; }
.al-item b { font-size: 16px; font-weight: 900; }
.al-meta { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.al-detail { font-size: 14px; color: var(--ink-2); }

/* 기사 구간 끝 */
.label-driver { border-top-color: var(--ink); }
.driver-stripe { flex: 0 0 auto; height: 10px; background: repeating-linear-gradient(-45deg, var(--ink) 0 12px, #F2B705 12px 24px); }
.driver-body { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; gap: 4px; }
.driver-title { font-size: 22px; font-weight: 900; }
.driver-name { font-size: clamp(44px, 14vw, 88px); font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.driver-sub { font-size: 16px; font-weight: 700; color: var(--ink-2); }

/* ── 하단 조작/보기 바 ── */
.op-bar { display: flex; gap: var(--gap); max-width: 1100px; margin: 0 auto; }
.btn-grow { flex: 1 1 auto; }
.btn-side { flex: 0 0 auto; min-width: 88px; }
.view-bar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; min-height: 40px; font-size: 15px; color: var(--ink-2); }
.view-who b { color: var(--ink); }

/* ── 목록 페이지 공통 (박스 완료·주의사항) ── */
.page { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); padding-bottom: 16px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -.01em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.group-head { padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 900; color: var(--ink-2); letter-spacing: .02em; }
/* 좁으면 상태·버튼이 기관명 아래 줄로 내려간다(기관명이 버튼에 눌려 한 글자씩 끊기지 않게) */
.inst-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 1px solid var(--line); }
.inst-row:last-child { border-bottom: 0; }
.inst-row.is-done { background: #F7FBF8; }
.inst-main { flex: 1 1 210px; min-width: 0; }
.inst-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 18px; font-weight: 900; }
.inst-no { color: var(--meta); font-size: 14px; font-weight: 800; min-width: 22px; }
.inst-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.inst-sub b { color: var(--ink); }
.inst-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; flex: 0 1 auto; margin-left: auto; }
.inst-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg-btn { background: none; border: 0; border-right: 1px solid var(--line); padding: 10px 4px; font-size: 15px; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.active { background: var(--ink); color: #fff; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats3 > div { display: flex; flex-direction: column; padding: 10px 12px; border-right: 1px solid var(--line); }
.stats3 > div:last-child { border-right: 0; }
.stats3 > div { min-width: 0; }
.stats3 span { font-size: 14px; color: var(--meta); font-weight: 700; }
.stats3 b { font-size: 26px; font-weight: 900; white-space: nowrap; }
.tl-group { border-bottom: 1px solid var(--line); }
.tl-group:last-child { border-bottom: 0; }
.tl-group summary { display: flex; justify-content: space-between; align-items: center; padding: 12px; font-weight: 900; cursor: pointer; font-size: 16px; }
.tl-item, .sched-item { display: grid; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--line); }
.sched-item:first-child { border-top: 0; }
.tl-top { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: space-between; font-size: 17px; }
.tl-group summary { gap: 8px; }
.tl-title { font-weight: 800; font-size: 16px; }
.tl-detail { color: var(--ink-2); font-size: 14px; }
.tl-item .btn, .sched-item .btn { justify-self: start; margin-top: 2px; }

/* ── 시트·모달·토스트 ── */
.overlay { position: fixed; inset: 0; background: rgba(17, 20, 24, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
#modal { align-items: center; padding: 16px; }
.sheet-card { background: var(--surface); width: min(520px, 100%); max-height: 92dvh; overflow-y: auto; border-radius: var(--r) var(--r) 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 900; }
.sheet-card .meta { margin: 0; }
.sheet-card .stats3 { border: 1px solid var(--line); border-radius: var(--r); }
.sheet-role { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions:empty { display: none; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; width: min(440px, 100%); }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 900; }
.modal-card p { margin: 6px 0; font-size: 16px; color: var(--ink-2); }
.modal-card p b { color: var(--ink); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.field { display: grid; gap: 4px; font-weight: 800; font-size: 14px; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px; font-size: 16px; font-weight: 600; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--tray); outline-offset: 0; }
.toast { position: fixed; left: 0; right: 0; top: 55px; z-index: 30; background: var(--ink); color: #fff; padding: 8px 16px; font-weight: 800; font-size: 15px; text-align: center; border-bottom: 1px solid #000; } /* 탭 바로 아래 얇은 띠 — 탭 글자·수량을 가리지 않게 */

/* ── 가로 화면(태블릿·벽 모니터): 좌(이전) · 중(현재) · 우(다음) ── */
@media (orientation: landscape) and (min-width: 900px) {
  .topbar { padding: 0 16px; gap: 16px; }
  .tabs { gap: 8px; }
  .tab { font-size: 17px; padding: 0 12px; }
  main { padding: 12px 16px; }
  .stage { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
  .slot-cur { height: 100%; }
  .mini { padding: 12px; gap: 10px; }
  .mini-l1 { flex-wrap: wrap; white-space: normal; row-gap: 4px; }
  .mini-inst { font-size: 30px; flex-basis: 100%; }
  .mini-cls { font-size: 24px; }
  .mini-box { font-size: 22px; }
  .mq { padding: 6px 2px 8px; }
  .mq i { font-size: 15px; }
  .mq b { font-size: 44px; }
  .mq.q-zero b, .mq.q-bad b { font-size: 20px; line-height: 2.2; }
  .label-inst { font-size: clamp(44px, min(5.4vw, 9vh), 96px); }
  .label-cls { font-size: clamp(32px, min(4vw, 6.5vh), 68px); }
  .label-box { font-size: clamp(28px, min(3.4vw, 5.5vh), 56px); }
  .label-full { font-size: 16px; }
  .qk { font-size: 20px; }
  .qv { font-size: clamp(64px, min(7.4vw, 15vh), 170px); }
  .q-long .qv { font-size: clamp(48px, min(5.4vw, 11vh), 124px); }
  .q-zero .qv, .q-bad .qv, .stage .q-zero .qv, .stage .q-bad .qv { font-size: 28px; }
  .type-tag { height: 34px; font-size: 20px; }
  .band-seq { font-size: 17px; }
  .al-strip { font-size: 17px; min-height: 44px; }
  .btn-xl { min-height: 64px; font-size: 22px; }
}

/* ── 간식 차례: 카드·화면 바탕을 호박색으로 (사장님 2026-10-13 — 곁눈으로도 "지금 간식") ── */
body[data-tab="work"][data-cur="SNACK"] main { background: var(--snack-canvas); }
.label.is-snack { background: var(--snack-bg); border-color: var(--snack-line); border-top: 0; }
.label.is-snack .label-head { background: var(--snack); border-bottom: 0; padding: 10px 12px; }
.label.is-snack .type-tag { border: 0; padding: 0; height: auto; background: none; color: #fff; font-size: 26px; letter-spacing: .02em; }
.label.is-snack .band-seq { color: #fff; }
.label.is-snack .chip-chg { background: #fff; }
.label.is-snack .label-full, .label.is-snack .qk, .label.is-snack .label-foot { color: var(--snack-ink-2); }
/* 간식 차례: 화면이 이미 호박색이라 간식판 칸은 진한 호박 면 + 흰 글씨, 수저 3칸은 흰 면으로 확실히 갈라 보이게 */
.label.is-snack .qty4 { border-top-color: var(--snack-line); background: #FAD6A2; }
.label.is-snack .q-main { background: var(--snack-deep); border-color: var(--snack-deep); }
.label.is-snack .q-main .qk, .label.is-snack .q-main .qv { color: #fff; }
.label.is-snack .q-main.q-zero { background: var(--surface); border: 1px dashed var(--snack-line); }
.label.is-snack .q-main.q-zero .qk, .label.is-snack .q-main.q-zero .qv { color: var(--snack-ink-2); }
.label.is-snack .q-cut { border-color: var(--snack-line); }
.label.is-snack .q-cut + .q-cut { box-shadow: inset 1px 0 0 var(--snack-line); }
.label.is-snack .q-cut .qk, .label.is-snack .q-cut.q-zero .qv { color: var(--snack-ink-2); }
.label.is-snack .label-foot { border-top-color: var(--snack-line); }
.label.is-snack .label-box { background: #fff; }
.mini.is-snack { background: var(--snack-bg); border-color: var(--snack-line); border-left: 8px solid var(--snack); }
.mini.is-snack .mini-type { color: #fff; background: var(--snack); padding: 0 6px; border-radius: var(--r); }
.mini.is-snack .mini-tag, .mini.is-snack .mini-cls, .mini.is-snack .mq i, .mini.is-snack .mq.q-zero b { color: var(--snack-ink-2); }
.mini.is-snack .mini-q { border-color: var(--snack-line); }
.mini.is-snack .mq { border-right-color: var(--snack-line); }
.mini.is-snack .mq.q-zero { background: rgba(74, 47, 5, .07); }
.mini.is-snack .mini-box { background: #fff; }

/* ── 박스 크기 별표: ★ 작은 박스 / ★★★ 큰 박스 (현황판 R열 = 박스 라벨 배송정보) ── */
.box-col { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
/* ★ 배지도 BOX와 같은 체계: ★ 작은 박스 = 1.5px 테두리, ★★★ 큰 박스 = 남색 채움 */
.size { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-sm); font-weight: 800; white-space: nowrap; border: 1.5px solid var(--ink); }
.size small { font-size: 12px; font-weight: 700; margin-left: 4px; opacity: .85; }
.size-small { background: #fff; color: var(--ink); }
.size-large { background: var(--ink); color: #fff; }
.size-big { font-size: 20px; padding: 2px 10px; }
.size-mini { font-size: 13px; padding: 0 6px; border-width: 1px; flex: 0 0 auto; }
.inst-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 14px; }
.inst-size-boxes { color: var(--ink-2); font-weight: 700; margin-right: 6px; }
.inst-size-boxes .ib { white-space: nowrap; }
@media (orientation: landscape) and (min-width: 900px) {
  .size-big { font-size: 26px; padding: 2px 12px; }
  .label.is-snack .type-tag { font-size: 32px; }
  .size-mini { font-size: 14px; }
}

/* ── 포장 완료 버튼 (사장님 2026-10-13: 무엇을 눌러야 완료인지 한눈에) ── */
.btn-go { background: var(--go); color: #fff; }
.btn-go:active { background: var(--go-press); transform: translateY(1px); }
.btn-xxl { min-height: 72px; padding: 0 12px; font-size: 24px; font-weight: 900; }
/* 이전·건너뛰기는 가볍게(옅은 면 + 헤어라인), 큰 버튼 하나만 채움 */
.op-bar .btn-side { min-width: 76px; padding: 0 8px; font-size: 14px; font-weight: 700; background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.op-bar .btn-side:active { background: var(--line); }
.op-bar .btn-danger-outline.btn-side { background: var(--surface); border-color: #E7A1AC; color: var(--bad); }
.op-bar { align-items: stretch; }
/* 완료된 작업: 큰 「완료」 도장 + 흐리게 (보기 화면도 동일) */
.label { position: relative; }
.label.is-done .label-body, .label.is-done .qty4, .label.is-done .label-foot, .label.is-done .label-note, .label.is-done .al-strip { opacity: .38; }
.done-stamp { position: absolute; left: 50%; top: 62%; transform: translate(-50%, -50%) rotate(-8deg); border: 6px solid var(--ok); color: var(--ok); background: rgba(255, 255, 255, .94); border-radius: var(--r); padding: 4px 28px; font-size: clamp(48px, 15vw, 96px); font-weight: 900; letter-spacing: .1em; line-height: 1.1; pointer-events: none; }

/* ── 기사 띠 (투입 화면 맨 위) ── */
.seg-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-height: 44px; }
.sb-driver { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.sb-k { font-size: 13px; font-weight: 800; color: var(--meta); }
.sb-name { font-size: 20px; font-weight: 900; }
.sb-p { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.sb-btn { height: 40px; flex: 0 0 auto; }
.seg-search .sb-return { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-height: 44px; width: 100%; padding: 6px 12px; border: 2px solid #1F5BD8; border-radius: var(--r); background: #E8F0FF; color: #123E9C; text-align: left; cursor: pointer; font-weight: 800; }
.seg-search .sb-k { color: #123E9C; }
.seg-search .sb-name { font-size: 18px; color: var(--ink); flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.sb-go { flex: 0 0 auto; font-size: 14px; text-decoration: underline; }

/* ── 시작 화면 · 대기 화면 · 기사 카드 ── */
.start-step { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 900; margin-top: 8px; flex-wrap: wrap; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.branch-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.branch-btn { min-height: 64px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-size: 24px; font-weight: 800; cursor: pointer; }
.branch-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.start-date { width: 100%; min-height: 48px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 0 10px; font-size: 17px; font-weight: 800; }
.drv-list { display: grid; gap: var(--gap); }
.drv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 6px; }
.drv-card.is-current { border-color: var(--tray); box-shadow: inset 0 0 0 1px var(--tray); }
.drv-card.st-COMPLETED { background: #F5FAF7; }
.drv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drv-name { font-size: 22px; font-weight: 900; }
.drv-meta { font-size: 14px; color: var(--ink-2); font-weight: 700; }
.drv-bar { height: 8px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.drv-fill { height: 100%; background: var(--ok); }
.drv-prog { font-size: 14px; color: var(--ink-2); }
.drv-prog b { color: var(--ink); font-size: 16px; }
.drv-card .btn-block { margin-top: 4px; min-height: 52px; font-size: 18px; }
.wait-card { background: var(--surface); border: 2px dashed var(--line-strong); border-radius: var(--r); padding: 28px 16px; text-align: center; display: grid; gap: 8px; }
.wait-title { font-size: 22px; font-weight: 900; }

/* ── 기사 포장 완료 화면 ── */
.done-screen { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px 16px; }
.done-check { width: 112px; height: 112px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 64px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.done-title { font-size: 34px; font-weight: 900; line-height: 1.2; letter-spacing: -.02em; }
.done-sub { font-size: 17px; font-weight: 700; color: var(--ink-2); }
.done-screen .meta { max-width: 520px; }

/* ── 기관 검색 ── */
.overlay-top { align-items: flex-start; }
.search-card { background: var(--surface); width: min(640px, 100%); max-height: 90dvh; display: flex; flex-direction: column; border-radius: 0 0 var(--r) var(--r); }
.search-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
#search-input { flex: 1 1 auto; min-width: 0; min-height: 48px; border: 2px solid var(--ink); border-radius: var(--r); padding: 0 12px; font-size: 18px; font-weight: 700; }
.search-results { overflow-y: auto; padding: 8px 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.sr-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; width: 100%; min-width: 0; text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.sr-item:active { background: var(--surface-2); }
.sr-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; font-size: 19px; }
.sr-sub { font-size: 14px; color: var(--ink-2); }
.sr-boxes { font-size: 14px; color: var(--bad); font-weight: 700; }

@media (orientation: landscape) and (min-width: 900px) {
  .stage { grid-template-rows: auto minmax(0, 1fr); }
  .seg-bar { grid-column: 1 / -1; }
  .done-stamp { font-size: clamp(64px, 8vw, 128px); }
  .drv-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .page.start, .page.waiting { max-width: 1100px; }
}
/* ── 박스 포장용 화면 (2026-10-13) — 같은 디자인 체계. 박스 포장자는 BOX 번호·박스 크기가 가장 중요 → 더 크게, BOX는 남색 채움 ── */
.mode-pick { gap: 12px; }
.mode-card { display: grid; gap: 4px; text-align: left; width: 100%; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.mode-card b { font-size: 22px; font-weight: 800; color: var(--ink); }
.mode-card span { font-size: 15px; color: var(--ink-2); }
.mode-card em { font-style: normal; font-weight: 800; color: var(--ink); }
.mode-card:active { background: var(--surface-2); }
.box-bar .tun { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.tun-k { font-size: 13px; font-weight: 700; color: var(--meta); }
.tun-btn { min-width: 36px; min-height: 36px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 16px; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.tun-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.box-wait { border-top-color: var(--line-strong); }
body[data-mode="box"] .slot-cur .label-box { background: var(--ink); color: #fff; border-color: var(--ink); font-size: clamp(30px, 9.5vw, 52px); padding: 2px 14px; }
body[data-mode="box"] .slot-cur .size-big { font-size: clamp(20px, 6vw, 30px); padding: 2px 12px; }
body[data-mode="box"] .stage.fit4 .slot-cur .label-box { font-size: clamp(24px, 7.5vw, 40px); }
body[data-mode="box"] .stage.fit4 .slot-cur .size-big { font-size: 18px; }
.sheet-mode { display: grid; gap: 6px; }
.seg.seg2 { grid-template-columns: repeat(2, 1fr); }

/* 잠깐 멈춤! 버튼: 길게 누르는 동안 채워지는 막대로 진행을 보여 준다 */
.btn-stop { position: relative; overflow: hidden; flex-direction: column; gap: 2px; background: var(--bad); color: #fff; }
.btn-stop .stop-main { font-size: 28px; font-weight: 900; letter-spacing: -.01em; position: relative; }
.btn-stop .stop-sub { font-size: 13px; font-weight: 700; opacity: .92; position: relative; }
.btn-stop::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(0, 0, 0, .28); }
.btn-stop.holding::before { width: 100%; transition: width .5s linear; }
.box-paused { align-items: center; }
.pause-info { flex: 0 0 auto; display: grid; justify-items: center; padding: 0 8px; color: var(--bad); }
.pause-info b { font-size: 15px; font-weight: 800; }
.pause-info .pause-sec { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.btn-locked { background: var(--line); color: var(--ink-2); cursor: not-allowed; }
.btn-locked:disabled { opacity: 1; }

/* 조작자 화면 경고 띠: 크고 빨갛게. 3분 넘으면 더 진하게(자동 해제는 하지 않음) */
.banner-pause { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--bad); color: #fff; border-bottom: 0; }
.banner-pause .pb-text { display: grid; gap: 2px; min-width: 0; }
.banner-pause .pb-text b { font-size: 19px; font-weight: 900; }
.banner-pause .pb-text span { font-size: 15px; font-weight: 700; }
.banner-pause .pb-release { background: #fff; color: var(--bad); border: 0; font-weight: 900; }
.banner-pause.pause-long { background: #8F0B21; animation: pk-blink 1s steps(2, start) infinite; }
@keyframes pk-blink { 50% { background: var(--bad); } }
.banner-pause-view { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 12px; background: var(--bad-tint); color: var(--bad); border-bottom: 1px solid #F0A9B4; font-size: 15px; }
.banner-pause-view b { font-size: 17px; font-weight: 900; }
.banner-pause-view.pause-long { background: #FAD4DA; }
@media (prefers-reduced-motion: reduce) { .banner-pause.pause-long { animation: none; } .btn-stop.holding::before { transition: none; } }
/* 로그아웃: 「지점 · 출고분」 시트 맨 아래 (모든 역할) */
.sheet-logout { color: var(--ink-2); border-color: var(--line-strong); }

/* 박스 크기 피드백 (박스 포장 화면) — 「잠깐 멈춤!」(빨강 채움, 맨 아래)과 헷갈리지 않게 남색 외곽선 버튼, 메인 카드 바로 아래 */
.fb-row { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.fb-btn { min-height: 48px; padding: 6px 8px; border: 1.5px solid var(--ink-2); background: var(--surface); color: var(--ink); font-size: 17px; font-weight: 800; gap: 6px; }
.fb-btn:active { background: var(--surface-2); }
.fb-ic { font-size: 12px; color: var(--ink-2); }
.fb-btn.sent { background: var(--tray-tint); border-color: var(--tray); color: var(--tray-ink); }
.fb-btn.sent::after { content: "✓"; font-weight: 900; }
.stage.fit4 .fb-btn { min-height: 40px; font-size: 15px; }
.fb-toast { position: fixed; left: 8px; right: 8px; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--ink); color: #fff; border-radius: var(--r); font-size: 15px; font-weight: 700; }
.fb-toast .fbt-text { min-width: 0; }
.fb-toast .fbt-undo { flex: 0 0 auto; background: #fff; color: var(--ink); border: 0; font-weight: 800; }
/* 맞춤 마지막 단계(8): 그래도 모자라면 카드 아래 보조 줄(간식판 묶음 안내 등)을 숨기고 피드백 버튼을 낮춘다 — 4칸 숫자가 우선 */
.stage.fit8 .label-foot { display: none; }
.stage.fit8 .fb-btn { min-height: 34px; font-size: 14px; padding: 2px 6px; }
.stage.fit8 .fb-ic { display: none; }
/* 가로(3단) 박스 포장 화면: 피드백 버튼은 가운데 칸 아래 */
@media (orientation: landscape) and (min-width: 900px) {
  .box-stage { grid-template-rows: auto minmax(0, 1fr) auto; }
  .box-stage > .slot-prev { grid-column: 1; grid-row: 2; }
  .box-stage > .slot-cur { grid-column: 2; grid-row: 2; }
  .box-stage > .slot-next { grid-column: 3; grid-row: 2; }
  .box-stage > .fb-row { grid-column: 2; grid-row: 3; }
}
/* 공간이 모자랄 때 멈춤 경고 띠를 한 줄로(경과 시간은 박스 포장 화면에 그대로 보임) */
body.pause-tight .banner-pause { flex-wrap: nowrap; padding: 4px 8px; gap: 6px; }
body.pause-tight .banner-pause .pb-text span { display: none; }
body.pause-tight .banner-pause .pb-text b { font-size: 15px; }
body.pause-tight .banner-pause .pb-release { flex: 0 0 auto; padding: 4px 10px; font-size: 14px; min-height: 36px; }

/* 수량 변경 · 재확인 (새 판 반영 때 완료를 이어받았는데 수량이 바뀐 작업) — 완료 카드 흐림(.is-done)에도 또렷하게 */
.rk-strip { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 12px; background: var(--rk-tint); color: var(--rk-ink); border-bottom: 2px solid var(--rk); font-size: 15px; font-weight: 800; }
.rk-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; background: var(--rk); color: #fff; font-size: 14px; font-weight: 900; white-space: nowrap; }
.rk-diff { min-width: 0; }
.rk-ok { margin-left: auto; background: var(--rk); color: #fff; border: 0; font-weight: 900; }
.stage.fit4 .rk-strip { padding: 2px 10px; font-size: 13px; }
.mini-flag-rk { background: var(--rk); }
.tab-badge-rk { background: var(--rk); }
.drv-rk { margin: 2px 0 6px; }
.inst-rk { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; padding: 6px 8px; border-radius: var(--r-sm); background: var(--rk-tint); color: var(--rk-ink); font-size: 14px; font-weight: 700; }
.inst-rk .rk-line b { font-weight: 900; }

/* 「포장 완료」 이중 탭 방지: 누른 뒤 잠금 동안 큰 버튼을 흐리게 + 안에서 진행 막대가 차오름(다 차면 다시 눌림) */
/* 막대는 버튼 바탕 위·글자 아래(isolation + z-index:-1). 글자 묶음은 display:contents라 기존 하단 바 맞춤(fit) 측정이 그대로 동작 */
.btn-xxl { position: relative; isolation: isolate; }
.btn-txt { display: contents; }
.btn.is-cooling { background: #5E8C70; color: rgba(255, 255, 255, .92); cursor: default; }
.btn-primary.is-cooling { background: #5B6B86; }
.cool-bar { position: absolute; inset: 0; z-index: -1; border-radius: inherit; transform-origin: left center; background: rgba(255, 255, 255, .28); border-right: 3px solid #fff;
  transform: scaleX(var(--lock-from, 0)); animation: pk-cool var(--lock-left, 1500ms) linear forwards; }
@keyframes pk-cool { to { transform: scaleX(1); } }
/* 다음 카드가 0.3초 밀려 들어옴 */
.label.slide-in { animation: pk-slide .3s ease-out both; }
@keyframes pk-slide { from { transform: translateX(28px); opacity: .35; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .label.slide-in { animation: none; } .cool-bar { animation-duration: 1ms; } }

/* 같은 수량 연속 (2026-10-15): 카드 위 청록 띠 + 묶음 안 순번 크게, 반·BOX 줄 테두리, 넘어온 순간 청록 번쩍 */
.same-strip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px 10px; padding: 6px 12px; background: var(--same-tint); color: var(--same-ink); border-bottom: 2px solid var(--same); font-size: 15px; font-weight: 800; }
.same-tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border-radius: 6px; background: var(--same); color: #fff; font-size: 15px; font-weight: 900; white-space: nowrap; }
.same-sub { min-width: 0; }
.same-sub b { font-weight: 900; color: var(--same-ink); }
.same-count { margin-left: auto; font-size: 30px; font-weight: 900; line-height: 1; color: var(--same); font-variant-numeric: tabular-nums; white-space: nowrap; }
.same-count small { font-size: 18px; font-weight: 800; color: var(--same-ink); }
.label.same-run .label-row { outline: 3px solid var(--same); outline-offset: 3px; border-radius: var(--r-sm); }
.stage.fit4 .same-strip { padding: 2px 10px; font-size: 13px; }
.stage.fit4 .same-count { font-size: 22px; }
.stage.fit6 .same-sub { display: none; }
.mini-flag-same { background: var(--same); }
.label.same-flash { animation: pk-same .9s ease-out both; }
.label.slide-in.same-flash { animation: pk-slide .3s ease-out both, pk-same .9s ease-out both; }
@keyframes pk-same { 0%, 40% { outline: 6px solid var(--same); outline-offset: -6px; } 20%, 60% { outline: 6px solid transparent; outline-offset: -6px; } 80% { outline: 6px solid var(--same); outline-offset: -6px; } 100% { outline: 0 solid transparent; } }
@media (prefers-reduced-motion: reduce) { .label.same-flash, .label.slide-in.same-flash { animation: none; } }

/* 여러 날짜 요약처럼 길어질 수 있는 칩은 줄바꿈 허용 */
.chip.chip-wrap { white-space: normal; height: auto; min-height: 24px; padding: 2px 8px; }

/* USB 풋페달: 밟았을 때 잠깐 「페달 ✓」 · 등록 상태 */
.pedal-flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 40; padding: 8px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 18px; font-weight: 900; pointer-events: none; }
.pedal-now { font-size: 16px; font-weight: 800; margin: 2px 0 6px; }
.pedal-big { font-size: 22px; font-weight: 900; margin: 4px 0 8px; }
.pedal-hold { position: fixed; left: 12px; right: 12px; top: 60px;   /* 위쪽(하단 「방금 완료 · 되돌리기」와 겹치지 않게) */ z-index: 41; height: 52px; border-radius: var(--r); background: var(--ink); color: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.pedal-hold .ph-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); background: #3B5BDB; }
.pedal-hold.ph-full .ph-fill { background: var(--go); }
.pedal-hold .ph-text { position: relative; font-size: 18px; font-weight: 900; }
@keyframes pk-hold { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .pedal-hold .ph-fill { animation-duration: 1ms !important; } }

/* ── 저울 누적 계량 (v2, 2026-10-20) ── 라벨 숫자 아래 「센 개수」(크게) + 「해야 할 행동」(숫자로). 색은 보조 */
.qs { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; min-width: 0; padding: 2px 0 0; border-radius: 6px; }
.qs-none { visibility: hidden; }
.qs-n { display: block; width: 100%; text-align: center; font-size: clamp(30px, min(12vw, calc(var(--app-h, 640px) * .075)), 110px); font-weight: 900; line-height: 1; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qs-a { display: block; max-width: 100%; text-align: center; font-size: 16px; font-weight: 900; line-height: 1.3; white-space: nowrap; border-radius: 6px; padding: 1px 6px; }
.qs-wait .qs-n { color: var(--line-strong); }
.qs-wait .qs-a { color: var(--meta); font-weight: 700; }
.qs-low .qs-n { color: #8A5A00; }
.qs-low .qs-a { background: #FFD43B; color: #3D2E00; }
.qs-over .qs-n { color: var(--bad); }
.qs-over .qs-a { background: var(--bad); color: #fff; }
.qs-match .qs-n, .qs-ok .qs-n, .qs-plus .qs-n { color: var(--ok); }
.qs-match .qs-a, .qs-ok .qs-a { background: var(--ok); color: #fff; }
.qs-plus .qs-a { background: var(--ok-tint); color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); }
.qs-skip .qs-a { background: var(--warn-tint); color: var(--warn-ink); }
.qs-bad .qs-a { background: var(--bad-tint); color: var(--bad); }
/* 흔들리는 중(소문자 net): 숫자는 따라 움직이되 흐리게 + 점선 */
.qs-moving .qs-n { opacity: .5; }
.qs-moving { outline: 2px dashed var(--line-strong); outline-offset: -1px; }
/* 지금 단계 칸 강조 */
.q.q-scur { box-shadow: inset 0 0 0 3px var(--ink); }
.label.is-snack .q-main .qs-n { color: #fff; }
.q-bad .qs-n { color: #fff; }
.stage.fit4 .qs-n { font-size: clamp(28px, min(10vw, calc(var(--app-h, 640px) * .06)), 96px); }
.stage.fit4 .qs-a { font-size: 14px; }
.stage.fit6 .qs-n { font-size: clamp(24px, min(8.5vw, calc(var(--app-h, 640px) * .05)), 80px); }
.stage.fit6 .qs-a { font-size: 13px; padding: 0 4px; }
/* 카드 안 위 띠: 지금 무게 + 할 일 */
.sc-strip { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 3px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 16px; font-weight: 800; }
.sc-w { flex: 0 0 auto; min-width: 5.2em; font-size: 18px; font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-w.moving { color: var(--meta); }
.sc-msg { flex: 1 1 auto; min-width: 0; word-break: keep-all; overflow-wrap: break-word; }
.sc-skip { flex: 0 0 auto; }
.sc-strip.sc-empty { background: var(--warn-tint); color: var(--warn-ink); }
.sc-strip.sc-done { background: var(--ok-tint); color: var(--ok); }
.sc-strip.sc-off { background: var(--bad-tint); color: var(--bad); }
.stage.fit4 .sc-strip { min-height: 32px; padding: 2px 10px; font-size: 14px; }
.stage.fit4 .sc-w { font-size: 16px; }
/* 다 맞기 전 「포장 완료」: 회색(누르면 경고 → 3초 안 한 번 더 = 강제) */
.btn-go.scale-wait { background: #64748B; }
/* 강제 넘김 경고(첫 누름) — 버튼은 가리지 않고 다시 누를 수 있게 */
.scale-warn { position: fixed; left: 12px; right: 12px; top: 60px; z-index: 42; background: var(--bad); color: #fff; border-radius: var(--r); padding: 12px 16px; pointer-events: none; }
.scale-warn h3 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.scale-warn ul { margin: 0 0 6px; padding-left: 20px; font-size: 18px; font-weight: 800; line-height: 1.35; word-break: keep-all; }
.scale-warn p { margin: 0; font-size: 16px; font-weight: 800; }
.scale-warn .sw-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.scale-warn .sw-bar i { display: block; height: 100%; background: #fff; transform-origin: left center; animation: pk-sw 3s linear forwards; }
@keyframes pk-sw { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* 개당 무게 등록 창 */
.uw-items { flex-wrap: wrap; }
.uw-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 800; }
.uw-n { width: 80px; font-size: 18px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.uw-live { font-size: 22px; font-weight: 900; margin: 6px 0; font-variant-numeric: tabular-nums; }
/* 시뮬레이터(?scaleSim=1) */
.scale-sim { position: fixed; right: 6px; bottom: 100px; z-index: 50; display: flex; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 12px; opacity: .92; }
.scale-sim input[type=number] { width: 76px; }
@media (orientation: landscape) and (min-width: 900px) {
  .qs-n { font-size: clamp(44px, min(6vw, 10vh), 140px); }
  .qs-a { font-size: 20px; }
  .sc-strip { font-size: 18px; }
  .sc-w { font-size: 20px; }
}
@media (orientation: landscape) and (min-width: 900px) {
  .stage.fit4 .qs-a { font-size: 18px; }
  .stage.fit6 .qs-a { font-size: 16px; }
}
