/* Midway Orders — staff app. Built for a landscape tablet on a kitchen counter: big targets, high contrast, no hover-only anything. */
:root {
  --red: #B91C1C; --red-d: #991B1B; --brand: #CC1F1F;
  --ink: #1A1A1A; --mute: #4B5563; --line: #E2D9C8; --bg: #F6F1E7; --card: #FFFFFF;
  --new: #B91C1C; --new-bg: #FEF2F2;
  --prep: #1D4ED8; --prep-bg: #EFF6FF;
  --ready: #15803D; --ready-bg: #F0FDF4;
  --warn: #92400E; --warn-bg: #FEF3C7;
  --r: 14px; --tap: 52px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #1D4ED8; outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

/* ── buttons ── */
.btn { min-height: var(--tap); padding: 0 1.1em; border-radius: 12px; border: 2px solid #C9BEA8; background: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .4em; touch-action: manipulation; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ready { background: var(--ready); border-color: var(--ready); color: #fff; }
.btn.prep { background: var(--prep); border-color: var(--prep); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: #fff; }
.btn.danger { color: var(--red-d); border-color: #E3A5A5; background: #fff; }
.btn.big { min-height: 60px; font-size: 1.1rem; width: 100%; }
.btn.sm { min-height: 44px; padding: 0 .9em; font-size: .95rem; }

/* ── login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-card h1 { color: var(--brand); font-size: 1.8rem; }
.login-card .sub { margin: .2em 0 1em; color: var(--mute); }
label { display: block; font-weight: 700; margin: .9em 0 .3em; }
input[type=text], input[type=password], input[type=search], input[type=number], input:not([type]), select, textarea { width: 100%; min-height: var(--tap); padding: .55em .8em; border: 2px solid #A8A29E; border-radius: 10px; background: #fff; }
.form-err { min-height: 1.4em; margin: .6em 0; color: var(--red-d); font-weight: 600; }

/* ── top bar ── */
.chrome { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.logo { font-size: 1.5rem; }
.spacer { flex: 1; }
.badge.test { background: #FDE68A; color: #78350F; font-weight: 800; font-size: .8rem; padding: 4px 10px; border-radius: 999px; }
.pill { font-size: .85rem; font-weight: 800; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.2); }
.pill.live.ok { background: #DCFCE7; color: #14532D; }
.pill.live.warn { background: #FEF3C7; color: #78350F; }
.pill.live.bad { background: #FEE2E2; color: #7F1D1D; }

.soundbar button { display: block; width: 100%; padding: 14px; background: #FDE68A; color: #78350F; border: 0; border-bottom: 3px solid #D97706; font-weight: 700; text-align: center; }
.alertbar { padding: 14px 16px; background: var(--new); color: #fff; font-size: 1.35rem; font-weight: 900; text-align: center; letter-spacing: .01em; animation: flash 1s steps(2, start) infinite; }
.pausebar { padding: 10px 16px; background: #FEF3C7; color: #78350F; font-weight: 800; text-align: center; border-bottom: 2px solid #F59E0B; }
@keyframes flash { 50% { background: #7F1D1D; } }
@media (prefers-reduced-motion: reduce) { .alertbar { animation: none; } .card.st-new { animation: none; } }

/* ── tabs ── */
.tabs { display: flex; gap: 6px; padding: 10px 12px 0; border-bottom: 2px solid var(--line); background: var(--bg); overflow-x: auto; }
.tabs button { white-space: nowrap; min-height: var(--tap); padding: 0 1.2em; border: 2px solid transparent; border-bottom: 0; border-radius: 12px 12px 0 0; background: transparent; font-weight: 800; color: var(--mute); }
.tabs button[aria-selected=true] { background: #fff; border-color: var(--line); color: var(--ink); margin-bottom: -2px; box-shadow: 0 -2px 0 var(--brand) inset; }
.count { display: inline-block; min-width: 1.6em; padding: 0 .4em; border-radius: 999px; background: var(--new); color: #fff; font-size: .85rem; text-align: center; margin-left: .3em; }

main#view { padding: 14px 12px 60px; outline: none; }

/* ── order board ── */
.board { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
@media (max-width: 1000px) { .board { grid-template-columns: 1fr; } }
.col > h2 { display: flex; align-items: center; gap: .5em; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .05em; padding: 6px 4px 10px; }
.col > h2 .n { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 0 .6em; font-size: .95rem; }
.col.c-new > h2 { color: var(--new); } .col.c-prep > h2 { color: var(--prep); } .col.c-ready > h2 { color: var(--ready); }
.empty { padding: 22px 12px; text-align: center; color: var(--mute); border: 2px dashed var(--line); border-radius: var(--r); }
.stack { display: grid; gap: 12px; }

.card { background: var(--card); border: 2px solid var(--line); border-left-width: 9px; border-radius: var(--r); padding: 12px 14px 14px; }
.card.st-new { border-color: var(--new); background: var(--new-bg); animation: pulse 1.6s ease-in-out infinite; }
.card.st-accepted { border-color: var(--prep); }
.card.st-ready { border-color: var(--ready); background: var(--ready-bg); }
.card.done { border-color: #D6D3D1; opacity: .85; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(185,28,28,.22); } }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.num { font-size: 1.45rem; font-weight: 900; letter-spacing: .01em; }
.when { font-weight: 800; }
.age { margin-left: auto; color: var(--mute); font-size: .9rem; }
.due { font-weight: 800; }
.due.late { color: var(--red-d); }
.chip { display: inline-block; font-size: .75rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase; }
.chip.sched { background: #E0E7FF; color: #3730A3; }
.chip.carry { background: var(--warn-bg); color: var(--warn); }
.who { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 4px; font-weight: 700; }
.who a { color: var(--prep); font-weight: 800; text-decoration: none; padding: 4px 0; }
.lines { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.lines > li { display: grid; grid-template-columns: auto 1fr auto; gap: 0 8px; }
.lines .q { font-weight: 900; font-size: 1.15rem; }
.lines .nm { font-weight: 800; font-size: 1.1rem; }
.lines .pr { color: var(--mute); font-variant-numeric: tabular-nums; }
.mods { grid-column: 2 / 4; list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: .98rem; }
.mods .no { color: var(--red-d); font-weight: 900; }
.mods .add { font-weight: 700; }
.mods .note { background: #FEF08A; padding: 0 .4em; border-radius: 4px; font-weight: 700; }
.onote { margin: 10px 0 0; padding: 8px 10px; background: #FEF08A; border-radius: 8px; font-weight: 700; }
.total { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; font-weight: 800; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.acts .btn { flex: 1 1 auto; }
.acts .btn.primary, .acts .btn.ready, .acts .btn.prep { flex: 2 1 12em; }
.mins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.mins h3 { grid-column: 1 / -1; font-size: 1rem; }
.mins .btn { padding: 0; }
.done-wrap { margin-top: 18px; }
.done-wrap > summary { cursor: pointer; font-weight: 800; padding: 12px 6px; min-height: var(--tap); }
.hist-line { color: var(--mute); font-size: .88rem; margin-top: 6px; }

/* ── panels (menu / history) ── */
.panel { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 auto 16px; max-width: 900px; }
.panel > h2 { font-size: 1.25rem; margin-bottom: 4px; }
.hint { color: var(--mute); margin: 2px 0 12px; font-size: .95rem; }
.status-line { font-size: 1.15rem; font-weight: 800; margin: 8px 0 12px; }
.status-line.on { color: var(--ready); } .status-line.off { color: var(--red-d); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chips button { min-height: 44px; padding: 0 1em; border-radius: 999px; border: 2px solid #C9BEA8; background: #fff; font-weight: 700; }
.search { margin: 8px 0 12px; }
details.cat { border-top: 1px solid var(--line); }
details.cat > summary { min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; font-weight: 800; cursor: pointer; padding: 4px 2px; }
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 6px 2px; border-top: 1px solid #F0EADC; }
.row .nm { flex: 1; font-weight: 700; }
.row .sub { display: block; font-weight: 500; font-size: .88rem; color: var(--mute); }
.row .px { font-variant-numeric: tabular-nums; font-weight: 800; }
.tag { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: #E5E7EB; }
.tag.edited { background: #DBEAFE; color: #1E3A8A; } .tag.hidden { background: #FEE2E2; color: #7F1D1D; } .tag.sold { background: #FEF3C7; color: #78350F; }
.sw { appearance: none; -webkit-appearance: none; width: 64px; height: 36px; flex: none; border-radius: 999px; background: #A8A29E; position: relative; border: 0; cursor: pointer; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform .15s; }
.sw:checked { background: var(--red); } .sw:checked::after { transform: translateX(28px); }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #F0EADC; }
.hist-row .t { width: 5.5em; color: var(--mute); font-variant-numeric: tabular-nums; flex: none; }
.hist-row .d { flex: 1; }
.hist-row.undone .d { text-decoration: line-through; color: var(--mute); }

/* ── modal ── */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 14px; }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: #fff; border-radius: 18px; padding: 20px; }
.modal h2 { font-size: 1.3rem; margin-bottom: 6px; }
.modal .body { margin: 8px 0 14px; }
.modal .btns { display: flex; gap: 10px; flex-wrap: wrap; }
.modal .btns .btn { flex: 1 1 8em; }
.field-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.field-row label { margin: 0; flex: 1; font-weight: 700; }
.field-row input[type=text] { width: 8em; text-align: right; }
.field-row .was { color: var(--mute); font-size: .85rem; font-weight: 500; display: block; }
.pin-input { text-align: center; letter-spacing: .5em; font-size: 1.6rem; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%); z-index: 60; max-width: 92vw; background: #111827; color: #fff; padding: 14px 20px; border-radius: 12px; font-weight: 700; transition: transform .2s, opacity .2s; opacity: 0; visibility: hidden; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.err { background: var(--red-d); }

@media (max-width: 640px) {
  .brand b { display: none; }
  .badge.test { font-size: .72rem; }
  .btn.ghost { padding: 0 .6em; }
  .tabs button { padding: 0 .8em; }
  .alertbar { font-size: 1.1rem; }
}
