/* ───────── 기본 ───────── */
:root {
  --bg: #f8f6fd;
  --surface: #ffffff;
  --surface-2: #f2eefb;
  --line: #e5dff3;
  --text: #1e1930;
  --muted: #706987;
  --accent: #8b6ff0;         /* 퍼스널 컬러: 연보라 */
  --accent-deep: #6e4fdc;    /* 연보라 위 글자/진한 강조 */
  --accent-soft: #efeafe;
  --accent-light: #c8b8fa;
  --red: #e5484d;
  /* 관리자 화면 상태색: 조리 중 = 빨강, 수령 대기 = 초록, 오래 대기 = 주황 */
  --cook: #e5484d;
  --cook-soft: #fdeded;
  --cook-line: #f6b8ba;
  --wait: #16a34a;
  --wait-deep: #12813c;
  --wait-soft: #e7f6ec;
  --wait-line: #a6dfb9;
  --stale: #ef7d00;
  --stale-soft: #fff1e0;
  --stale-line: #ffc581;
  /* 수령완료 = 검정 */
  --picked: #1f1d27;
  --booth: #e89b0c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 120, .05), 0 6px 20px rgba(60, 40, 120, .06);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: 'tnum' 1;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.booth-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--booth) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--booth) 40%, transparent);
  font-weight: 700; font-size: 14px; line-height: 1.25; max-width: 100%; min-width: 0; word-break: keep-all;
}
.booth-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--booth); flex: none; }

.btn-primary, .btn-soft, .btn-ghost, .btn-text, .btn-danger-text {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active, .btn-soft:active, .btn-ghost:active { transform: scale(.97); }
.btn-soft { background: var(--accent-soft); border: 1px solid var(--accent-light); color: var(--accent-deep); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-text { background: transparent; color: var(--muted); }
.btn-danger-text { background: transparent; color: var(--red); font-size: 13px; min-height: 36px; padding: 0 8px; }
.btn-lg { min-height: 56px; font-size: 17px; }

/* ───────── 안내/오류 페이지 ───────── */
.msg-wrap, .login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
}
.msg-card, .login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow);
}
.msg-site, .login-site { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.msg-card h1 { margin: 10px 0 8px; font-size: 24px; }
.msg-card p { margin: 0; color: var(--muted); }

/* ───────── 로그인 ───────── */
.login { background: radial-gradient(100% 60% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 2px 0 0; font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.login-sub { margin: -6px 0 4px; color: var(--muted); font-size: 14px; }
.login-pin {
  width: 100%; height: 60px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); text-align: center; font-size: 28px; letter-spacing: .4em; outline: none;
}
.login-pin::placeholder { font-size: 17px; letter-spacing: 0; }
.login-pin:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.login-error { margin: 0; color: var(--red); font-size: 14px; font-weight: 600; }
.login-card .btn-primary { min-height: 52px; font-size: 16px; }
.login-card .btn-ghost { min-height: 52px; font-size: 16px; }
.login-card .kcp-login { min-height: 58px; font-size: 17px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-error[hidden] { display: none; }

/* ───────── 고객 화면 ───────── */
.cust {
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg);
  transition: background-color .4s ease;
}
.cust[data-state="ready"] {
  background:
    radial-gradient(120% 70% at 50% 0%, #b9a4fb, transparent 70%),
    var(--accent);
  color: #fff;
}

.cust-wrap {
  max-width: 460px; margin: 0 auto; min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 22px;
}
.cust-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cust-site { font-size: 13px; font-weight: 600; color: var(--muted); flex: none; }
.cust[data-state="ready"] .cust-site { color: rgba(255,255,255,.9); }
.cust[data-state="ready"] .booth-chip { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.45); }

/* 티켓 모양 카드 */
.cust-ticket {
  position: relative; text-align: center; padding: 22px 16px 26px;
  background: var(--surface); border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.cust-ticket::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: var(--booth); border-radius: 22px 22px 0 0;
}
.cust-ticket-label { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
.cust-ticket-num {
  font-size: clamp(96px, 34vw, 150px); font-weight: 850; line-height: 1; letter-spacing: -.04em;
  margin-top: 6px;
}
.cust[data-state="ready"] .cust-ticket { background: #fff; color: var(--accent-deep); border-color: transparent; box-shadow: 0 10px 30px rgba(60, 30, 140, .25); }
.cust[data-state="ready"] .cust-ticket-label { color: #8e7cc9; }

.cust-status { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cust-icon { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 6px; }
.cust-icon .ic { position: relative; width: 44px; height: 44px; display: none; z-index: 1; }
.cust-icon::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-light);
}
.cust-icon .ring {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0;
  animation: ring 2.4s ease-out infinite;
}
.cust-icon .ring.r2 { animation-delay: 1.2s; }
@keyframes ring { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.65); opacity: 0; } }
.cust[data-state="cooking"] .ic-cooking { display: block; color: var(--accent-deep); }
.cust[data-state="waiting"] .ic-waiting { display: block; color: var(--muted); }
.cust[data-state="waiting"] .ring { display: none; }
.ic-cooking .steam { animation: steam 1.8s ease-in-out infinite; }
@keyframes steam { 0%, 100% { opacity: .35; transform: translateY(2px); } 50% { opacity: 1; transform: translateY(-1px); } }

.cust[data-state="ready"] .cust-icon::before { background: #fff; border-color: #fff; }
.cust[data-state="ready"] .ic-ready { display: block; color: var(--accent-deep); }
.cust[data-state="ready"] .ring { border-color: #fff; animation-duration: 1.4s; }
.cust[data-state="ready"] .cust-icon { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

/* 수령완료(검정) */
.cust[data-state="picked"] { background: var(--picked); color: #fff; }
.cust[data-state="picked"] .cust-site { color: rgba(255,255,255,.75); }
.cust[data-state="picked"] .booth-chip { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.cust[data-state="picked"] .cust-ticket { background: #2c2a36; color: #fff; border-color: transparent; box-shadow: none; }
.cust[data-state="picked"] .cust-ticket-label { color: rgba(255,255,255,.6); }
.cust[data-state="picked"] .cust-icon::before { background: #fff; border-color: #fff; }
.cust[data-state="picked"] .ic-picked { display: block; color: var(--picked); }
.cust[data-state="picked"] .ring { display: none; }
.cust[data-state="picked"] .st p { color: rgba(255,255,255,.85); }
.cust[data-state="picked"] .cust-actions { display: none; }
.cust[data-state="picked"] .cust-foot { color: rgba(255,255,255,.6); }
.cust[data-state="picked"] .live i { background: rgba(255,255,255,.7); }


.st { display: none; }
.cust[data-state="waiting"] .st-waiting,
.cust[data-state="cooking"] .st-cooking,
.cust[data-state="ready"] .st-ready,
.cust[data-state="picked"] .st-picked { display: block; }
.st h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.st-ready h1 { font-size: 38px; }
.st p { margin: 0; color: var(--muted); font-size: 16px; }
.cust[data-state="ready"] .st p { color: rgba(255,255,255,.95); font-size: 17px; }
.st-elapsed { margin-top: 10px !important; font-size: 14px !important; opacity: .8; }

.cust-actions { margin-top: auto; }
.btn-sound {
  width: 100%; min-height: 54px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 15px;
}
.btn-sound svg { width: 22px; height: 22px; }
.btn-sound[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-light); color: var(--accent-deep); }
.cust[data-state="ready"] .btn-sound { border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.16); color: #fff; }

.cust-foot { text-align: center; font-size: 12px; color: var(--muted); }
.cust[data-state="ready"] .cust-foot { color: rgba(255,255,255,.85); }
.live { display: inline-flex; align-items: center; gap: 7px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: live 2s infinite; }
.cust[data-state="ready"] .live i { background: #fff; }
.live i.off { background: var(--red); animation: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

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

/* ───────── 관리자 공통 ───────── */
.adm-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.adm-title { flex: 1 1 auto; min-width: 0; }
.adm-booth { font-size: 18px; font-weight: 800; }
.adm-booth .booth-chip { font-size: 16px; }
.adm-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.adm-stats { display: flex; gap: 8px; }
.adm-stats > div {
  display: flex; flex-direction: column; align-items: center; min-width: 74px;
  padding: 6px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.adm-stats b { font-size: 22px; line-height: 1.1; }
.adm-stats .is-cooking b { color: var(--cook); }
.adm-stats .is-ready b { color: var(--wait-deep); }
.adm-stats span { font-size: 11px; color: var(--muted); }
.adm-menu { display: flex; gap: 4px; flex-wrap: wrap; }
.adm-menu a {
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted);
  padding: 8px 10px; border-radius: 10px;
}
.adm-menu a:hover { background: var(--accent-soft); color: var(--accent-deep); }
body.offline .adm-bar::after {
  content: '연결이 끊겼어요 · 다시 연결 중…'; flex-basis: 100%; text-align: center;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 700; border-radius: 8px; padding: 4px;
}

.adm-main { display: grid; gap: 14px; padding: 14px 16px 120px; max-width: 1280px; margin: 0 auto; }
.adm-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 960px) {
  .adm-main { grid-template-columns: 400px minmax(0, 1fr); align-items: start; }
  .adm-col { position: sticky; top: 92px; }
}

.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-hint { font-size: 12px; color: var(--muted); }
.count-pill { background: var(--accent); color: #fff; font-size: 13px; padding: 1px 9px; border-radius: 999px; }
.count-pill.is-wait { background: var(--wait); }
.count-pill.is-cook { background: var(--cook); }

/* 빠른 입력 */
.quick label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.quick-hint { font-size: 11px; font-weight: 500; }
.quick-row { display: flex; gap: 8px; }
.quick-row input {
  flex: 1; min-width: 0; width: 100%; height: 60px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 30px; font-weight: 800; text-align: center; outline: none;
}
.quick-row input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.quick-row .btn-primary, .quick-row .btn-soft { height: 60px; font-size: 16px; padding: 0 16px; border-radius: 14px; }
@media (max-width: 400px) { .quick-row .btn-primary, .quick-row .btn-soft { padding: 0 11px; font-size: 15px; } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pad button {
  height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 22px; font-weight: 700;
}
.pad button:active { background: var(--accent-soft); border-color: var(--accent-light); }
.pad .pad-fn { font-size: 15px; color: var(--muted); }
@media (max-width: 640px) and (pointer: coarse) { .pad { display: none; } }

/* 수령 대기 목록 */
.ready-list { display: grid; gap: 8px; }
.ready-item {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border-radius: 14px;
  background: var(--wait-soft); border: 1px solid var(--wait-line);
}
.ready-item.is-stale { background: var(--stale-soft); border-color: var(--stale-line); }
.ri-num { font-size: 32px; font-weight: 850; min-width: 2.2ch; text-align: center; color: var(--wait-deep); line-height: 1; }
.is-stale .ri-num { color: var(--stale); }
.ri-meta { display: flex; flex-direction: column; min-width: 0; }
.ri-meta b { font-size: 15px; white-space: nowrap; }
.ri-meta span { font-size: 12px; color: var(--muted); }
.is-stale .ri-meta span { color: var(--stale); font-weight: 600; }
.ri-pick { min-height: 46px; }
.ri-more { min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; }
/* 조리 중 목록 */
.cooking-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.cooking-item {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 6px 6px 6px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
}
.ci-num { font-size: 22px; font-weight: 850; min-width: 2.2ch; text-align: center; color: var(--cook); line-height: 1; }
.ci-meta { font-size: 12px; color: var(--muted); min-width: 0; }
.ci-done { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.cooking-item .ri-more { min-height: 38px; border-radius: 10px; }

.empty { margin: 4px 0 0; color: var(--muted); font-size: 14px; text-align: center; padding: 14px 0; }

/* 전체 번호 그리드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.cell {
  height: 50px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted);
  font-size: 17px; font-weight: 700; transition: background .15s, transform .08s;
}
.cell:active { transform: scale(.94); }
.cell.is-cooking { background: var(--cook); border-color: var(--cook); color: #fff; }
.cell.is-ready { background: var(--wait); border-color: var(--wait); color: #fff; }
.cell.is-stale { background: var(--stale); border-color: var(--stale); color: #fff; }
.cell.is-picked { background: var(--picked); border-color: var(--picked); color: #fff; }
.cell.is-busy { opacity: .45; pointer-events: none; }

/* 바텀 시트 */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(30, 22, 60, .35);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  animation: fade .15s ease;
}
.sheet {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 22px 18px max(14px, env(safe-area-inset-bottom));
  display: grid; gap: 10px; animation: up .2s ease; box-shadow: 0 20px 50px rgba(30, 22, 60, .2);
}
.sheet-num { font-size: 44px; font-weight: 850; text-align: center; line-height: 1; color: var(--wait-deep); }
.sheet-num.is-plain { color: var(--text); }
.sheet-msg { margin: 2px 0 10px; text-align: center; font-size: 16px; line-height: 1.5; }
.sheet-msg b { color: var(--wait-deep); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 8px; }
.sheet-actions button { min-height: 52px; padding: 0 10px; }
.sheet-actions.is-two { grid-template-columns: 1fr 1.4fr; }
.sheet-num.is-picked, .sheet-msg b.is-picked { color: var(--picked); }
.btn-primary.btn-dark { background: var(--picked); border-color: var(--picked); color: #fff; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 12px 12px 12px 18px; border-radius: 14px;
  background: var(--text); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 30px rgba(30, 22, 60, .25); animation: up .2s ease;
}
.toast button { border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.toast-error { background: var(--red); color: #fff; }
.toast-error button { background: rgba(0,0,0,.2); }

/* 총괄 대시보드 */
.master-main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 60px; }
.master-hint { color: var(--muted); font-size: 14px; margin: 4px 0 16px; }
.master-hint code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; color: var(--text); }
.master-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.master-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  border-top: 4px solid var(--booth); display: grid; gap: 12px; box-shadow: var(--shadow);
}
.master-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.master-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.master-loc { font-size: 13px; color: var(--muted); margin-top: -4px; }
.master-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.master-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; }
.master-stats b { display: block; font-size: 26px; line-height: 1.1; }
.master-stats .is-cooking b { color: var(--cook); }
.master-stats .is-ready b { color: var(--wait-deep); }
.master-stats span { font-size: 12px; color: var(--muted); }
.master-links { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.master-links a { padding: 0 8px; font-size: 14px; }
.master-card .btn-danger-text { justify-self: start; }

/* ───────── 현황판 ───────── */
.board {
  background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--booth) 10%, transparent), transparent 70%), var(--bg);
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden;
}
.board-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 3vh 4vw 1vh; gap: 16px; }
.board-booth .booth-chip { font-size: clamp(14px, 2vh, 22px); }
.board-title { margin: 1vh 0 0; font-size: clamp(28px, 6vh, 64px); font-weight: 850; letter-spacing: -.02em; line-height: 1.1; }
.board-tools { display: flex; gap: 8px; }
.board-tools .btn-ghost { min-height: 38px; font-size: 13px; opacity: .55; }
.board-tools .btn-ghost:hover, .board-tools .is-on { opacity: 1; }
.board-tools .is-on { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-soft); }
/* 왼쪽 = 조리 완료(크게), 오른쪽 = 조리 중 */
.board-main {
  flex: 1; min-height: 0; padding: 1vh 4vw;
  display: grid; grid-template-columns: minmax(0, 1fr) 27vw; gap: 2.5vw;
}
.board-ready { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board-nums { width: 100%; display: grid; gap: 2vh 1.8vw; justify-content: center; align-content: center; }
.board-nums[data-size="xl"] { grid-template-columns: repeat(auto-fit, minmax(14vw, 19vw)); }
.board-nums[data-size="lg"] { grid-template-columns: repeat(auto-fit, minmax(11vw, 14vw)); }
.board-nums[data-size="md"] { grid-template-columns: repeat(auto-fill, minmax(8vw, 1fr)); }
.board-nums[data-size="sm"] { grid-template-columns: repeat(auto-fill, minmax(6vw, 1fr)); }
.bn {
  display: grid; place-items: center; border-radius: 2.4vh;
  background: var(--accent); color: #fff; font-weight: 850; letter-spacing: -.03em; line-height: 1;
  aspect-ratio: 1.35; box-shadow: 0 1vh 3vh color-mix(in srgb, var(--accent) 30%, transparent);
}
.board-nums[data-size="xl"] .bn { font-size: min(15vh, 8.5vw); }
.board-nums[data-size="lg"] .bn { font-size: min(10vh, 6.5vw); }
.board-nums[data-size="md"] .bn { font-size: min(6.5vh, 4.5vw); }
.board-nums[data-size="sm"] .bn { font-size: min(4.5vh, 3.2vw); border-radius: 1.4vh; }
.bn.is-fresh { animation: fresh 1s cubic-bezier(.3, 1.5, .5, 1), glow 2.2s ease-in-out 3; }
@keyframes fresh { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes glow { 50% { box-shadow: 0 0 0 1.4vh color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-deep); } }
.board-empty { font-size: clamp(20px, 4vh, 40px); color: var(--muted); font-weight: 700; margin: 0; }

.board-cooking {
  min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2vh;
  background: var(--surface); border: 1px solid var(--line); border-radius: 2.4vh;
  padding: 2.6vh 1.6vw; box-shadow: var(--shadow);
}
.board-cooking-title {
  margin: 0; display: flex; align-items: center; gap: .5em;
  font-size: clamp(18px, 3.6vh, 38px); font-weight: 800; color: var(--muted); letter-spacing: -.01em;
}
.board-cooking-title::before {
  content: ''; width: .45em; height: .45em; border-radius: 50%; background: var(--accent-light);
  animation: live 2s infinite;
}
.board-cooking-title span {
  font-size: .7em; padding: .05em .55em; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep);
}
.board-cooking-title span:empty { display: none; }
.board-cook-nums { display: grid; gap: 1.2vh .8vw; align-content: start; }
.board-cook-nums[data-size="lg"] { grid-template-columns: repeat(3, 1fr); }
.board-cook-nums[data-size="md"] { grid-template-columns: repeat(4, 1fr); }
.board-cook-nums[data-size="sm"] { grid-template-columns: repeat(5, 1fr); }
.cn {
  display: grid; place-items: center; aspect-ratio: 1.5; border-radius: 1.4vh;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  font-weight: 800; letter-spacing: -.03em; line-height: 1;
}
.board-cook-nums[data-size="lg"] .cn { font-size: min(6.5vh, 3.6vw); }
.board-cook-nums[data-size="md"] .cn { font-size: min(4.6vh, 2.6vw); }
.board-cook-nums[data-size="sm"] .cn { font-size: min(3.4vh, 1.9vw); border-radius: 1vh; }
.cn.is-fresh { animation: fade .6s ease; }
.board-cook-empty { margin: 0; font-size: clamp(14px, 2.4vh, 24px); color: var(--muted); font-weight: 600; }

/* 세로 화면(태블릿 세로 등): 조리 중을 아래로 */
@media (max-aspect-ratio: 1/1) {
  .board-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .board-cooking { max-height: 32vh; }
  .board-nums[data-size="xl"] { grid-template-columns: repeat(auto-fit, minmax(22vw, 26vw)); }
  .board-nums[data-size="lg"] { grid-template-columns: repeat(auto-fit, minmax(16vw, 19vw)); }
  .board-nums[data-size="md"] { grid-template-columns: repeat(auto-fill, minmax(11vw, 1fr)); }
  .board-nums[data-size="sm"] { grid-template-columns: repeat(auto-fill, minmax(8vw, 1fr)); }
  .board-nums[data-size="xl"] .bn { font-size: min(18vh, 13vw); }
  .board-nums[data-size="lg"] .bn { font-size: min(12vh, 9vw); }
  .board-nums[data-size="md"] .bn { font-size: min(7.5vh, 6vw); }
  .board-nums[data-size="sm"] .bn { font-size: min(5vh, 4vw); }
  .board-cook-nums[data-size] { grid-template-columns: repeat(auto-fill, minmax(12vw, 1fr)); }
  .board-cook-nums[data-size] .cn { font-size: min(4vh, 6vw); }
}
.board-foot {
  display: flex; justify-content: center; align-items: center; gap: 3vw; padding: 2vh 4vw 3vh;
  font-size: clamp(16px, 3vh, 32px); color: var(--muted); text-align: center;
}
.board-foot b { color: var(--text); }
.board-foot > span:first-child { display: inline; }
.board-clock { font-weight: 800; color: var(--text); opacity: .6; }
body.board.offline .board-foot::before { content: '● 연결 끊김'; color: var(--red); font-weight: 700; }

/* ───────── QR 카드 인쇄 ───────── */
.print-body { background: #ece8f5; color: #111; color-scheme: light; }
.print-toolbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 12px 16px; display: grid; gap: 6px;
}
.print-toolbar form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.print-toolbar label { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.print-toolbar input, .print-toolbar select {
  height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 8px;
}
.print-toolbar input { width: 72px; }
.print-toolbar .btn-ghost, .print-toolbar .btn-primary { min-height: 38px; }
.print-toolbar p { margin: 0; font-size: 12px; color: var(--muted); }

/* 카드 규격 48×92mm (A4당 12장, 4열×3줄) — qr·seat 인쇄물 공통 */
.print-body.per-12 { --cw: 48mm; --ch: 92mm; --num: 16mm; --qr: 37mm; --note: 2.6mm; --pad: 4.5mm; --top: 3mm; }

.print-page {
  width: 194mm; height: 280mm; margin: 16px auto; background: #fff; overflow: hidden;
  display: grid; grid-template-columns: repeat(var(--cols), var(--cw)); grid-auto-rows: var(--ch);
  align-content: start;
  padding: .2mm;   /* 바깥 재단선이 잘리지 않게 */
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  font-family: var(--font);
}
.qcard {
  outline: .2mm solid #000; outline-offset: -.1mm;   /* 재단선: 이웃 카드와 같은 선에 겹침 */
  padding: var(--pad); display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center; overflow: hidden; break-inside: avoid;
}
.qc-top { display: flex; flex-direction: column; align-items: center; gap: 1.6mm; width: 100%; }
.qc-id { display: flex; flex-direction: column; align-items: center; gap: .8mm; min-width: 0; width: 100%; }
.qc-booth {
  align-self: center; background: var(--booth); color: #fff; font-weight: 800;
  font-size: var(--top); line-height: 1.2; padding: .5mm 1.6mm; border-radius: 1mm; max-width: 100%; word-break: keep-all;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.qc-site { font-size: calc(var(--top) * .72); color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-num { font-size: var(--num); font-weight: 900; line-height: .85; letter-spacing: -.04em; color: #111; white-space: nowrap; }
.qc-num small { font-size: .3em; font-weight: 700; letter-spacing: 0; color: #888; margin-right: .6mm; vertical-align: .9em; }
.qc-qr { width: var(--qr); height: var(--qr); align-self: center; }
.qc-qr svg { width: 100%; height: 100%; display: block; }
.qc-note { font-size: var(--note); line-height: 1.35; text-align: center; color: #444; word-break: keep-all; }
.qc-note b { color: #111; }

@page { size: A4 portrait; margin: 8mm; }
@media print {
  .no-print { display: none !important; }
  html, body.print-body { background: #fff !important; }
  .print-page { margin: 0; box-shadow: none; page-break-after: always; break-after: page; }
  .print-page:last-of-type { page-break-after: auto; break-after: auto; }
}
@media screen and (max-width: 800px) {
  .print-page { zoom: .5; }
}

/* 알림이 울리는 중: 버튼을 눈에 띄게 (눌러서 끄기) */
.btn-sound.is-ringing,
.cust[data-state="ready"] .btn-sound.is-ringing {
  background: #fff; color: var(--accent-deep); border-color: #fff;
  animation: ringing 1s ease-in-out infinite;
}
@keyframes ringing { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(255, 255, 255, .25); } }

/* ── 보기 전용 (일반관리자: 주점은 보기만) ── */
.adm-readonly { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: #ecf0ff; color: #412ad8; font-size: 12px; font-weight: 700; }
.adm-sub .adm-readonly { margin-left: 0; font-size: 11px; }
.readonly .cell:disabled { opacity: 1; cursor: default; color: inherit; }
.readonly .cell:disabled:active { transform: none; }
.readonly .cell.is-cooking:disabled, .readonly .cell.is-ready:disabled, .readonly .cell.is-stale:disabled, .readonly .cell.is-picked:disabled { color: #fff; }

/* ── 주점관리자 카드 초기화 (비밀번호 또는 휴대폰 본인확인 한 번 더) ── */
.adm-reset { display: flex; justify-content: flex-end; }
.sheet-title { font-size: 22px; font-weight: 800; text-align: center; color: var(--red); }
.reset-form { display: grid; gap: 10px; }
.btn-primary.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
