:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1f1c19;
  --muted: #6d665e;
  --line: #e9e2d8;
  --accent: #d9480f;
  --accent-text: #ffffff;
  --ok: #2b8a3e;
  --warn: #c92a2a;
  --pending: #b7791f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }

[hidden] { display: none !important; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.store { font-size: 18px; font-weight: 800; }
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.muted { color: var(--muted); }

/* 손님 주문 페이지 */

.menu { padding: 8px 16px 120px; max-width: 640px; margin: 0 auto; }
.category { margin: 20px 0 8px; font-size: 15px; color: var(--muted); font-weight: 700; }
.item {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.item img { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; display: block; }
.item h3 { margin: 0; font-size: 16px; }
.item .price { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: var(--bg);
  border: 1px solid var(--line);
}
.stepper output { min-width: 22px; text-align: center; font-weight: 700; }

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.cart-summary { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); }
.cart-summary strong { color: var(--text); font-size: 18px; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.sheet {
  width: 100%;
  max-width: 640px;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 18px 18px 0 0;
}
.sheet h2 { margin: 0 0 12px; font-size: 20px; }
.sheet-lines { list-style: none; margin: 0; padding: 0; }
.sheet-lines li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sheet-total { display: flex; justify-content: space-between; padding: 12px 0; font-size: 17px; }
.sheet-message { margin: 4px 0 12px; padding: 12px; border-radius: 10px; background: var(--bg); }
.sheet-message.ok { color: var(--ok); }
.sheet-message.warn { color: var(--warn); }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }

/* 직원 수신 페이지. 화면을 켜 둔 채로 쓰니 어둡게 둔다. */

body.staff {
  --bg: #121212;
  --surface: #1c1c1c;
  --text: #f1f1f1;
  --muted: #a3a3a3;
  --line: #2e2e2e;
  --ok: #51cf66;
  --warn: #ff6b6b;
  --pending: #fcc419;
}
.staff main { padding: 16px; max-width: 640px; margin: 0 auto; }
.start-panel { padding: 24px 0; text-align: center; }
.start-panel p { color: var(--muted); }
.big { width: 100%; padding: 20px; font-size: 20px; }
.status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.status div { padding: 10px; border-radius: 10px; background: var(--surface); font-size: 13px; color: var(--muted); }
.status strong { display: block; margin-top: 2px; color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--line); }
.pill.ok { background: var(--ok); color: #000; }
.pill.pending { background: var(--pending); color: #000; }
.pill.bad { background: var(--warn); color: #000; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li {
  padding: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.log li:first-child { outline: 2px solid var(--accent); }
.log .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.log .table { color: var(--text); font-weight: 800; font-size: 18px; }
.log .text { margin: 6px 0 0; font-size: 17px; }

/* 주방 현황판. 주방에서 멀리서도 읽히게 어둡고 크게 둔다. */

body.board {
  --bg: #0f1113;
  --surface: #1a1d21;
  --surface-2: #252a30;
  --text: #f4f5f6;
  --muted: #9aa2ab;
  --line: #31373e;
  --accent: #ff8a3d;
  --ok: #40c057;
  --warn: #f03e3e;
  --amber: #f59f00;
  --pending: #fcc419;
}

.kds-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.kds-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.kds-title strong { font-size: 20px; }
.kds-stats { color: var(--muted); font-size: 15px; }
.kds-stats b { color: var(--text); font-size: 17px; }
.kds-right { display: flex; align-items: center; gap: 12px; }
.kds-clock { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.kds-totals {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.kds-totals-label { flex: none; padding-top: 8px; color: var(--muted); font-size: 14px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 16px;
  white-space: nowrap;
}
.chip strong { color: var(--accent); font-size: 19px; font-variant-numeric: tabular-nums; }

.kds-main { padding: 16px; }
.kds-empty { padding: 18vh 16px; text-align: center; color: var(--muted); }
.kds-empty p { margin: 0; }
.kds-empty .big { margin-bottom: 8px; color: var(--text); font-size: 24px; font-weight: 800; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: start;
}
.card {
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
}
.card.fresh { border-color: var(--accent); animation: fresh-pulse 1.6s ease-in-out 3; }
@keyframes fresh-pulse {
  50% { box-shadow: 0 0 0 6px rgba(255, 138, 61, 0.35); }
}
@media (prefers-reduced-motion: reduce) {
  .card.fresh { animation: none; }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
}
.card.slow .card-head { background: var(--amber); color: #1c1400; }
.card.late .card-head { background: var(--warn); color: #fff; }
.card.served .card-head { background: #1d3325; color: var(--ok); }
.card-table strong { font-size: 34px; font-weight: 900; line-height: 1; }
.card-table span { margin-left: 2px; font-size: 18px; font-weight: 700; }
.card-time { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.order-block { padding: 10px 12px 12px; }
.order-block + .order-block { border-top: 1px dashed var(--line); }
.order-block.fresh { background: rgba(255, 138, 61, 0.1); }
.order-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.new-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #1c0d00;
  font-size: 12px;
  font-weight: 800;
}

.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.line {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  text-align: left;
}
.line:active { transform: scale(0.99); }
.line .check {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--muted);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
}
.line .qty {
  flex: none;
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 20px;
  font-weight: 900;
}
.line .name { flex: 1; font-size: 20px; font-weight: 700; }
.line.done { background: transparent; border-color: var(--line); color: var(--muted); }
.line.done .check { background: var(--ok); border-color: var(--ok); color: #0b1f10; }
.line.done .qty { background: var(--line); color: var(--muted); }
.line.done .name { text-decoration: line-through; font-weight: 500; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.foot-info { display: flex; flex-direction: column; }
.foot-left { color: var(--muted); font-size: 14px; }
.foot-total { font-size: 20px; font-variant-numeric: tabular-nums; }
.pay { padding: 12px 18px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font-weight: 800; }
.card.served .pay { background: var(--ok); border-color: var(--ok); color: #0b1f10; }
.card-foot.confirm { display: grid; grid-template-columns: 1fr 1fr; background: rgba(240, 62, 62, 0.12); }
.card-foot.confirm p { grid-column: 1 / -1; margin: 0; font-size: 16px; }
.danger { background: var(--warn); color: #fff; font-weight: 800; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
}

/* 데모 첫 화면 */

.hub { padding: 16px; max-width: 640px; margin: 0 auto; }
.hub h2 { font-size: 16px; margin: 24px 0 8px; }
.tables { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tables a, .hub .link {
  display: block;
  padding: 12px;
  text-align: center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.hub code { padding: 2px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
