:root {
  --blue: #08a0e1;
  --blue-ink: #0788c0;
  --blue-weak: #e6f5fc;
  --blue-halo: #d6effa;
  --ink: #14212b;
  --ink-2: #3b4a55;
  --muted: #66757f;
  --muted-2: #97a3ac;
  --line: #dce3e8;
  --line-2: #e5eaee;
  --line-soft: #edf1f4;
  --chip: #f0f3f5;
  --bg: #f4f7f9;
  --red: #e5484d;
  --red-dark: #b8282d;
  --red-weak: #fdecec;
  --red-ink: #c4262b;
  --green: #1da35f;
  --green-ink: #1d7a47;
  --green-weak: #e7f6ee;
  --orange-weak: #fff1e2;
  --orange-ink: #8a4307;
  --note-bg: #fff8e6;
  --note-ink: #8a5a00;
  --photo: repeating-linear-gradient(135deg, #e3ecf2 0 6px, #edf3f7 6px 12px);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; -webkit-font-smoothing: antialiased; }
input, textarea, button, select { font-family: inherit; color: var(--ink); }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
a { color: var(--blue-ink); }
[hidden] { display: none !important; }

.input { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 15px; background: #fff; outline: none; width: 100%; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; font-size: 13px; }
.input:focus { border-color: var(--blue); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 700; }
.help { font-size: 12px; color: var(--muted); line-height: 1.5; }
.btn { height: 44px; border: 0; border-radius: 12px; padding: 0 18px; font-size: 15px; font-weight: 700; background: #fff; border: 1px solid var(--line); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.gray { background: var(--line-soft); border-color: var(--line-soft); color: var(--ink-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.excel { background: var(--green-ink); border-color: var(--green-ink); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.link { border: 0; background: none; color: var(--blue-ink); font-size: 14px; font-weight: 700; padding: 4px 0; }
.link.red { color: var(--red-ink); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* 스위치 */
.switch { width: 42px; height: 24px; border-radius: 12px; padding: 3px; display: inline-flex; background: #c9d3da; border: 0; flex-shrink: 0; transition: background .15s; }
.switch::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(18px); }
.switch.green.on { background: var(--green); }
.switch.red.on { background: var(--red); }

/* 로그인 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--blue); }
.login { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 36px 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 50px rgba(5, 80, 115, .25); }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand b { font-size: 26px; font-weight: 800; color: var(--blue); }
.brand span { font-size: 14px; font-weight: 700; color: var(--muted); }
.login .input { height: 50px; border-radius: 12px; font-size: 16px; }
.login .btn { height: 54px; border-radius: 14px; font-size: 16px; margin-top: 8px; }
.keep { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.error { color: var(--red-ink); font-size: 14px; min-height: 1.2em; margin: 0; }

/* 영업 시작 */
.start { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px; text-align: center; }
.start .date { font-size: 15px; font-weight: 700; color: var(--muted); }
.start .go { width: 260px; height: 260px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font-size: 34px; font-weight: 800; box-shadow: 0 0 0 18px var(--blue-halo), 0 24px 50px rgba(8, 160, 225, .35); }
.start p { font-size: 15px; color: var(--ink-2); line-height: 1.6; max-width: 360px; margin: 16px 0 0; }

/* 레이아웃 */
.shell { min-height: 100vh; display: flex; }
.side { width: 232px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.side-brand .logo { width: 40px; height: 40px; border-radius: 11px; background: var(--blue) url(assets/icon.png) center / cover; flex-shrink: 0; }
.side-brand b { display: block; font-size: 16px; font-weight: 800; }
.side-brand small { display: block; font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; font-size: 15px; font-weight: 700; background: transparent; color: var(--ink-2); }
.nav button.on { background: var(--blue-weak); color: var(--blue-ink); }
.badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--red); color: #fff; font-size: 13px; display: grid; place-items: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.controls { background: var(--bg); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.control { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; }
.poll { font-size: 12px; color: var(--muted); line-height: 1.5; }
.poll.bad { color: var(--red-ink); font-weight: 700; }
.logout { height: 40px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.alert { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; color: #fff; font-size: 18px; font-weight: 800; border: 0; width: 100%; animation: blink 1.3s steps(1) infinite; background: var(--red); }
.alert span:last-child { font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .2); padding: 5px 10px; border-radius: 8px; }
@keyframes blink { 50% { background: var(--red-dark); } }
.paused { display: flex; align-items: center; justify-content: center; min-height: 44px; background: var(--orange-weak); color: var(--orange-ink); font-size: 14px; font-weight: 700; padding: 0 16px; text-align: center; }

.head { padding: 24px 28px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; font-weight: 800; }
.head .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.head .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { padding: 18px 28px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 42px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); }
.chip small { font-size: 13px; opacity: .8; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips.sm .chip { height: 38px; padding: 0 14px; border-radius: 10px; font-size: 14px; }

/* 주문 현황 */
.board { flex: 1; display: flex; gap: 20px; padding: 18px 28px 28px; align-items: flex-start; flex-wrap: wrap; }
.cards { flex: 1 1 420px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ocard { background: #fff; border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border: 2px solid transparent; text-align: left; font-size: inherit; }
.ocard.waiting { animation: border-blink 1.3s steps(1) infinite; }
@keyframes border-blink { 0% { border-color: var(--red); } 50% { border-color: transparent; } }
.ocard.on { border-color: var(--blue); box-shadow: 0 6px 18px rgba(8, 160, 225, .18); animation: none; }
.ocard .top { display: flex; align-items: center; justify-content: space-between; }
.ocard .no { font-size: 26px; font-weight: 800; }
.ocard .pick { display: flex; align-items: baseline; gap: 8px; }
.ocard .pick span { font-size: 13px; color: var(--muted); }
.ocard .pick b { font-size: 20px; font-weight: 800; }
.ocard .pick em { font-style: normal; font-size: 13px; color: var(--muted); margin-left: auto; }
.ocard .sum { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.ocard .foot { display: flex; justify-content: space-between; font-size: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.ocard .foot span { font-weight: 600; }
.ocard .foot b { font-weight: 800; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.tag.waiting { background: var(--red-weak); color: var(--red-ink); }
.tag.accepted { background: var(--blue-weak); color: var(--blue-ink); }
.tag.preparing { background: var(--orange-weak); color: var(--orange-ink); }
.tag.ready { background: var(--green); color: #fff; }
.tag.done { background: var(--green-weak); color: var(--green-ink); }
.tag.rejected, .tag.cancelled { background: var(--chip); color: var(--muted); }
.empty { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--muted-2); font-size: 15px; }

.detail { flex: 0 1 400px; min-width: 340px; background: #fff; border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 20px; }
.detail .row1 { display: flex; align-items: center; justify-content: space-between; }
.detail .row1 div { display: flex; align-items: baseline; gap: 10px; }
.detail .row1 div span { font-size: 15px; color: var(--muted); font-weight: 600; }
.detail .row1 b { font-size: 34px; font-weight: 800; }
.detail .row1 .tag { font-size: 13px; padding: 5px 10px; border-radius: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.tile span { display: block; font-size: 12px; color: var(--muted); }
.tile b { display: block; font-size: 22px; font-weight: 800; margin-top: 2px; }
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv div { display: flex; justify-content: space-between; font-size: 15px; }
.kv span { color: var(--muted); }
.kv b, .kv a { font-weight: 700; color: var(--ink); text-decoration: none; }
.items { border-top: 1px solid var(--line-soft); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item .q { min-width: 30px; height: 30px; border-radius: 8px; background: var(--blue-weak); color: var(--blue-ink); font-size: 15px; font-weight: 800; display: grid; place-items: center; }
.item .n { flex: 1; }
.item .n b { display: block; font-size: 16px; }
.item .n small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.item > span:last-child { font-size: 15px; font-weight: 600; white-space: nowrap; }
.note { background: var(--note-bg); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; }
.note b { color: var(--note-ink); margin-right: 6px; }
.reason { background: var(--red-weak); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: #9b1c20; }
.total { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.total span { font-size: 15px; font-weight: 700; }
.total b { font-size: 22px; font-weight: 800; }
.acts { display: flex; gap: 8px; }
.acts .btn { height: 60px; border-radius: 14px; font-size: 19px; font-weight: 800; flex: 1; border: 0; }
.acts .reject { flex: 0 0 110px; background: var(--red-weak); color: var(--red-ink); font-size: 17px; }
.acts .finish { background: var(--green); color: #fff; }
.acts .done { background: var(--ink); color: #fff; font-size: 17px; }

/* 표 (메뉴·주문 내역) */
.table-wrap { margin: 16px 28px 28px; background: #fff; border-radius: 18px; overflow-x: auto; }
.trow { display: grid; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid #f0f3f5; font-size: 14px; }
.trow.th { font-size: 12px; font-weight: 700; color: var(--muted); border-bottom-color: var(--line-soft); }
.menus .trow { grid-template-columns: 72px 64px minmax(180px, 1.6fr) minmax(110px, 1fr) 100px 80px 80px 70px; min-width: 880px; }
.hist .trow { grid-template-columns: 120px 60px 90px minmax(200px, 1fr) 130px 100px 90px; min-width: 900px; }
.r { text-align: right; }
.c { text-align: center; justify-self: center; }
.arrows { display: flex; gap: 4px; }
.arrows button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 12px; }
.arrows button:disabled { opacity: .3; cursor: default; }
.thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--photo); overflow: hidden; }
.thumb img, .photo-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mname b { display: block; font-size: 15px; }
.mname small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mname .best { font-size: 11px; font-weight: 700; color: var(--blue-ink); background: var(--blue-weak); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.trow.off .mname, .trow.off .cat { opacity: .45; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 메뉴 편집 패널 */
.dim { position: fixed; inset: 0; background: rgba(16, 22, 27, .4); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: #fff; z-index: 41; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); font-size: 19px; font-weight: 800; }
.x { width: 36px; height: 36px; border: 0; background: var(--chip); border-radius: 10px; font-size: 18px; }
.panel-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.panel-foot { padding: 16px 24px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; align-items: center; }
.panel-foot .btn { height: 52px; border-radius: 14px; }
.photo-row { display: flex; gap: 16px; align-items: center; }
.photo-lg { width: 112px; height: 112px; border-radius: 14px; flex-shrink: 0; background: var(--photo); overflow: hidden; }
.photo-row > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.group { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.group .gh { display: flex; gap: 8px; align-items: center; }
.group .gh .input { height: 40px; font-weight: 700; font-size: 14px; }
.req { height: 40px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 700; border: 0; background: var(--chip); color: var(--muted); white-space: nowrap; }
.req.on { background: var(--blue-weak); color: var(--blue-ink); }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-row .input { height: 38px; font-size: 14px; }
.opt-row .price { width: 100px; flex-shrink: 0; text-align: right; }
.del { width: 30px; height: 30px; border: 0; background: none; color: var(--muted-2); font-size: 18px; flex-shrink: 0; }

/* 모달 */
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); background: #fff; border-radius: 22px; padding: 26px; z-index: 41; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 20px; font-weight: 800; }
.modal p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reasons button { height: 50px; border-radius: 12px; font-size: 15px; font-weight: 700; border: 1.5px solid var(--line); background: #fff; }
.reasons button.on { border-color: var(--red); background: var(--red-weak); color: var(--red-ink); }
.modal .acts .btn { height: 54px; font-size: 16px; font-weight: 700; }

/* 설정 */
.settings { padding: 18px 28px 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.box { background: #fff; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.box h2 { margin: 0; font-size: 17px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 110px 1fr; gap: 12px 14px; align-items: center; font-size: 14px; }
.form-grid > span { font-weight: 700; }
.times { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.times .input { width: auto; height: 42px; padding: 0 10px; }
.week { display: flex; flex-direction: column; gap: 6px; }
.wday { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wday b { width: 22px; font-size: 14px; }
.wday b.sun { color: var(--red-ink); }
.wday b.sat { color: var(--blue-ink); }
.wday .input { width: auto; height: 40px; padding: 0 8px; }
.wday .closed { font-size: 13px; font-weight: 700; color: var(--red-ink); background: var(--red-weak); border-radius: 8px; padding: 9px 12px; }
.form-grid > span:first-child { align-self: start; padding-top: 10px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; font-weight: 700; border: 1px solid var(--line); background: #fff; }
.days button.on { background: var(--red-weak); color: var(--red-ink); border-color: #f3b5b7; }
.hol-list { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 2; }
.hol { display: inline-flex; align-items: center; gap: 4px; background: var(--red-weak); color: var(--red-ink); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 13px; font-weight: 700; }
.hol button { border: 0; background: none; color: inherit; font-size: 15px; padding: 0 4px; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rule b { display: block; font-size: 14px; }
.rule small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; flex-shrink: 0; }
.stepper button { width: 38px; height: 40px; border: 0; background: none; font-size: 17px; }
.stepper span { min-width: 64px; text-align: center; font-size: 15px; font-weight: 700; }
.info { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; line-height: 1.5; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip); border-radius: 12px; padding: 4px; }
.seg button { height: 40px; border: 0; border-radius: 9px; font-size: 14px; font-weight: 700; background: transparent; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.pay-note { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--orange-weak); color: var(--orange-ink); }
.pay-note.live { background: var(--green-weak); color: var(--green-ink); }

/* 주문 내역 */
.summary { padding: 16px 28px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.summary div { background: #fff; border-radius: 16px; padding: 16px 18px; }
.summary span { display: block; font-size: 13px; color: var(--muted); }
.summary b { display: block; font-size: 22px; font-weight: 800; margin-top: 4px; }
.head .input[type=date] { width: auto; height: 42px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: rgba(20, 33, 43, .94); color: #fff; font-size: 15px; font-weight: 600; padding: 14px 22px; border-radius: 14px; z-index: 60; max-width: calc(100vw - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .alert, .ocard.waiting { animation: none; }
  .ocard.waiting { border-color: var(--red); }
}

/* 좁은 화면 (태블릿 세로 등): 사이드바를 위로 */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .side-brand { padding: 0 8px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .controls { flex-direction: row; padding: 8px 12px; gap: 16px; align-items: center; }
  .controls .control { gap: 8px; }
  .poll { display: none; }
  .head, .chips, .board, .summary, .settings { padding-left: 16px; padding-right: 16px; }
  .table-wrap { margin-left: 16px; margin-right: 16px; }
  .detail { min-width: 0; flex-basis: 100%; position: static; order: -1; scroll-margin-top: 12px; } /* 폰: 선택한 주문과 버튼을 목록 위에 */
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); } /* 사파리 하단 툴바 영역에 버튼이 오지 않게 */
}
