/* Kitchen order screen: paper tickets on a dark rail. Built to be read from
   six feet away under kitchen lights, with big touch targets. */

:root {
  --bg: #1A1F1C;
  --bg-2: #242B27;
  --bar: #11150F;
  --line: #3A433D;
  --text: #F2EEE4;
  --muted: #A9B0A9;
  --paper: #FBF8F1;
  --paper-2: #EFE8D7;
  --ink: #1E1A16;
  --ink-2: #5E554A;
  --rule: #CBBFAA;
  --green: #2F6B3A;
  --green-bright: #4CAF5E;
  --red: #B6321F;
  --red-bright: #E34B33;
  --gold: #E0A81E;
  --gold-dark: #8A6300;
  --blue: #2E6FBF;
  --note: #FFF2B8;
  --display: "Alfa Slab One", Georgia, serif;
  --body: "Barlow Semi Condensed", "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--body); font-size: 18px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
:focus-visible { outline: 3px solid #7CC0FF; outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--bg-2); color: var(--text);
  font-weight: 700; font-size: 18px; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: transparent; border-color: var(--red-bright); color: var(--red-bright); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-small { min-height: 42px; padding: 0 14px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; text-align: center; }
.login-mark { width: 90px; height: 56px; fill: var(--text); margin: 0 auto 8px; --bg: var(--bg-2); }
.login h1 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; }
.login-sub { margin: 4px 0 20px; color: var(--muted); }
.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span { display: block; margin-bottom: 6px; font-weight: 600; }
.login-field input { width: 100%; padding: 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--bg); color: var(--text); font-size: 20px; }
.login-error { color: var(--red-bright); font-weight: 600; margin: 12px 0 0; }

/* ---------- top bar ---------- */
.screen { display: flex; flex-direction: column; min-height: 100dvh; }
.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 14px; background: var(--bar); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.bar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 20px; }
.bar-mark { width: 42px; height: 26px; fill: var(--text); --bg: var(--bar); }
.tabs { display: flex; gap: 4px; }
.tab { border: 0; background: transparent; padding: 10px 14px; border-radius: 8px; font-weight: 700; font-size: 18px; color: var(--muted); }
.tab.active { background: var(--bg-2); color: var(--text); }
.tab-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--red-bright); color: #fff; font-size: 14px; margin-left: 4px; }
.tab-count:empty, .tab-count.zero { display: none; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: transparent; font-weight: 700; font-size: 16px; }
.pill-pause.paused { background: var(--red); border-color: var(--red); color: #fff; }
.pill.off { color: var(--muted); border-style: dashed; }
.pill-icon { padding: 0 12px; font-size: 18px; }
.conn { font-size: 15px; font-weight: 700; color: var(--green-bright); }
.conn.off { color: var(--red-bright); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 22px; min-width: 90px; text-align: right; }

.banner { padding: 10px 16px; font-weight: 600; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner-sound { background: var(--gold); color: #2A1F00; cursor: pointer; }
.banner-paused { background: var(--red); color: #fff; }
.banner-paused em { font-style: italic; font-weight: 400; }
.banner-paused .btn { border-color: #fff; background: transparent; color: #fff; }
.banner-offline { background: var(--gold-dark); color: #fff; }

/* ---------- board ---------- */
.board { flex: 1; display: grid; grid-template-columns: 1fr; gap: 12px; padding: 12px; align-items: start; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.col { min-width: 0; }
.col-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; padding: 6px 10px; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--muted); border-bottom: 2px solid var(--line); }
.col[data-status="new"] .col-head { color: var(--red-bright); border-color: var(--red-bright); }
.col[data-status="preparing"] .col-head { color: var(--gold); border-color: var(--gold); }
.col[data-status="ready"] .col-head { color: var(--green-bright); border-color: var(--green-bright); }
.col-count { font-family: var(--body); font-weight: 700; font-size: 22px; }
.col-body { display: grid; gap: 12px; }
.col-empty { padding: 26px 10px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }

/* ticket card */
.ticket-card {
  background: var(--paper); color: var(--ink); border-radius: 12px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  border-top: 10px solid var(--rule);
}
.ticket-card[data-status="new"] { border-top-color: var(--red-bright); }
.ticket-card[data-status="preparing"] { border-top-color: var(--gold); }
.ticket-card[data-status="ready"] { border-top-color: var(--green-bright); }
.ticket-card.flash { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { box-shadow: 0 0 0 6px var(--gold); } 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .35); } }
@media (prefers-reduced-motion: reduce) { .ticket-card.flash { animation: none; } }
.tc-head { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 14px 6px; border-bottom: 2px dotted var(--rule); }
.tc-num { font-family: var(--display); font-size: 36px; line-height: 1; color: var(--ink); }
.tc-who { min-width: 0; }
.tc-name { font-weight: 700; font-size: 22px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-phone { color: var(--ink-2); font-size: 16px; text-decoration: none; }
.tc-timer { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 22px; }
.tc-timer.warn { color: var(--gold-dark); }
.tc-timer.late { color: var(--red); }
.tc-pickup { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 16px; color: var(--ink-2); }
.tc-pickup .chip { padding: 2px 10px; border-radius: 999px; background: var(--paper-2); font-weight: 700; color: var(--ink); }
.tc-pickup .chip.sched { background: #DCE8F8; color: #173E7A; }
.tc-pickup .chip.due { background: var(--red); color: #fff; }
.tc-pickup .chip.dinein { background: var(--ink); color: var(--paper); }
.tc-pickup .chip.lang { background: #E6EFE3; color: #235229; }
.status-tag.dinein { background: var(--line); color: var(--text); }
.tc-items { padding: 8px 14px; }
.tc-item { padding: 6px 0; border-bottom: 1px dotted var(--rule); }
.tc-item:last-child { border-bottom: 0; }
.tc-item-main { display: flex; gap: 10px; align-items: baseline; font-size: 21px; font-weight: 700; line-height: 1.15; }
.tc-qty { min-width: 34px; color: var(--red); }
.tc-opts { margin: 2px 0 0 44px; font-size: 17px; color: var(--ink-2); }
.tc-note { margin: 4px 0 0 44px; padding: 4px 8px; border-radius: 6px; background: var(--note); font-size: 17px; font-weight: 600; }
.tc-order-note { margin: 0 14px 8px; padding: 6px 10px; border-radius: 6px; background: var(--note); font-weight: 600; font-size: 17px; }
.tc-total { margin: 0 14px 8px; display: flex; justify-content: space-between; color: var(--ink-2); font-size: 16px; }
.tc-total strong { color: var(--ink); font-size: 18px; }
.tc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 14px 14px; }
.tc-actions .btn { min-height: 56px; font-size: 20px; border-color: var(--rule); background: var(--paper-2); color: var(--ink); }
.tc-actions .btn-go { grid-column: 1 / -1; background: var(--green); border-color: var(--green); color: #fff; }
.tc-actions .btn-go.ready { background: var(--blue); border-color: var(--blue); }
.tc-actions .btn-go.done { background: var(--ink); border-color: var(--ink); }
.tc-actions .btn-quiet { min-height: 44px; font-size: 16px; font-weight: 600; color: var(--ink-2); background: transparent; }
.tc-actions .btn-cancel { color: var(--red); }

/* ---------- panels (history, settings) ---------- */
.panel { flex: 1; padding: 14px; max-width: 1100px; width: 100%; margin: 0 auto; }
.panel-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.tool { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 15px; color: var(--muted); }
.tool-grow { flex: 1; min-width: 200px; }
.tool input, .panel input[type=text], .panel input[type=tel], .panel input[type=search], .panel input[type=date] {
  padding: 10px 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 17px; min-height: 46px; width: 100%;
}
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; }
.hist-list { display: grid; gap: 8px; }
.hist-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 4px 14px; align-items: center; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.hist-num { font-family: var(--display); font-size: 22px; }
.hist-main { min-width: 0; }
.hist-name { font-weight: 700; font-size: 18px; }
.hist-items { color: var(--muted); font-size: 15px; }
.hist-right { text-align: right; font-size: 15px; color: var(--muted); }
.hist-right b { display: block; color: var(--text); font-size: 18px; }
.status-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; text-transform: capitalize; }
.status-tag.new { background: var(--red-bright); color: #fff; }
.status-tag.preparing { background: var(--gold); color: #2A1F00; }
.status-tag.ready { background: var(--green-bright); color: #0D2412; }
.status-tag.completed { background: var(--line); color: var(--text); }
.status-tag.cancelled { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.hist-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

.settings-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; align-content: start; }
.card h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 20px; }
.switch { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { width: 26px; height: 26px; accent-color: var(--green-bright); }
.field { display: grid; gap: 6px; font-weight: 600; }
.field small { color: var(--muted); font-weight: 400; }
.saved { color: var(--green-bright); font-weight: 700; }
.sold-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; gap: 2px; }
.sold-cat { color: var(--muted); font-size: 14px; font-weight: 700; padding: 8px 8px 2px; }
.sold-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; }
.sold-item:hover { background: var(--bg); }
.sold-item input { width: 22px; height: 22px; accent-color: var(--red-bright); }
.sold-item.on { color: var(--red-bright); font-weight: 700; }
.tool-row { display: flex; gap: 8px; }
.tool-row .btn { white-space: nowrap; flex: 0 0 auto; }
.sms-log { display: grid; gap: 4px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.sms-log .ok { color: var(--green-bright); }
.sms-log .fail { color: var(--red-bright); }
details summary { cursor: pointer; font-weight: 600; }
.link { color: var(--green-bright); }

/* ---------- cancel modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px)); z-index: 50; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; }
.modal h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason { min-height: 48px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); font-weight: 600; }
.reason.active { border-color: var(--red-bright); color: var(--red-bright); }
.modal input { padding: 10px 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- print ticket ---------- */
.ticket { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .screen, .login, .modal, .modal-backdrop { display: none !important; }
  .ticket { display: block; font-family: "Courier New", monospace; font-size: 13pt; width: 72mm; }
  .ticket h1 { font-size: 22pt; margin: 0; }
  .ticket .t-line { display: flex; justify-content: space-between; }
  .ticket .t-items { margin: 8px 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 6px 0; }
  .ticket .t-opt { padding-left: 18px; font-size: 11pt; }
  .ticket .t-note { padding-left: 18px; font-weight: bold; }
  @page { margin: 6mm; }
}

/* full-screen visual alert for new orders (v1.2) */
.new-flash { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.new-flash.run { animation: edge-pulse .55s ease-in-out 7 alternate; }
@keyframes edge-pulse {
  from { box-shadow: inset 0 0 0 0 rgba(192, 57, 43, 0); background: rgba(192, 57, 43, 0); }
  to   { box-shadow: inset 0 0 0 26px #C0392B; background: rgba(192, 57, 43, .18); }
}
.new-flash-text {
  position: absolute; top: 14vh; left: 50%; transform: translateX(-50%);
  padding: 18px 36px; border-radius: 16px; background: #C0392B; color: #fff;
  font-family: var(--display, inherit); font-weight: 700; font-size: clamp(28px, 5vw, 56px); letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); pointer-events: auto; cursor: pointer;
}
.new-flash.run .new-flash-text { animation: text-pop .55s ease-in-out 7 alternate; }
@keyframes text-pop { from { opacity: .75; transform: translateX(-50%) scale(.97); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
