/* AlphaTill Orders - the ordering app for shops with no AlphaTill till.
   alphatill.store's palette and typefaces (css/alpha.css), the same as the
   till, so a shop that later gets a till sees one system. */
@font-face {
  font-family: 'Manrope';
  src: url('/fonts/Manrope.woff2') format('woff2-variations'), url('/fonts/Manrope.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces.woff2') format('woff2-variations'), url('/fonts/Fraunces.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}
:root {
  --shop: #68283d;
  --on-shop: #fdf6ef;
  --go: #2f7a4f;
  --on-go: #fdf6ef;
  --ground: #f6f1e6;
  --panel: #fffdf8;
  --unlit: #ece4d4;
  --steel: #c9bb9f;
  --line: #e2d8c4;
  --ink: #2c2620;
  --ink-2: #6d6357;
  --err: #b23b30;
  --err-tint: #f8e6e2;
  --warn: #9a5b0c;
  --warn-tint: #f7ead3;
  --go-tint: #e3efe6;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --sign: 'Fraunces', Georgia, 'Times New Roman', serif;
  --r: 6px;
  --pad: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.45 var(--ui); overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid var(--shop); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- gates -- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) var(--pad) calc(24px + var(--safe-b)); background: var(--shop); }
.gate-card { width: 100%; max-width: 420px; background: var(--panel); border-radius: 10px; padding: 26px 22px; }
.brand { margin: 0 0 18px; display: flex; align-items: center; gap: 10px; font-family: var(--sign); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; color: var(--ink); }
.brand img { width: 34px; height: 34px; flex: none; }
.brand span { color: var(--ink-2); font-family: var(--ui); font-weight: 700; font-size: 18px; letter-spacing: 0; }
.gate h1 { margin: 0 0 14px; font-family: var(--sign); font-weight: 700; font-stretch: condensed; font-size: 32px; line-height: 1.05; }
.gate .lead { margin: 0 0 20px; font-size: 18px; color: var(--ink-2); }
.small { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }

/* --------------------------------------------------------------- fields -- */
.field { display: block; margin: 0 0 14px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input, .field select, .field textarea, .inline-input {
  width: 100%; font-size: 16px; padding: 12px; border-radius: var(--r);
  background: var(--panel); border: 2px solid var(--steel);
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-input:focus { outline: none; border-color: var(--shop); }
.hint { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.err { color: var(--err); font-weight: 700; min-height: 0; margin: 0 0 10px; }
.err:empty { display: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }

/* -------------------------------------------------------------- buttons -- */
.go {
  width: 100%; min-height: 54px; border-radius: var(--r); padding: 0 18px;
  background: var(--go); color: var(--on-go); font-weight: 800; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 120ms var(--ease-out), filter 160ms ease;
}
.go.big { min-height: 64px; font-size: 20px; }
.go:active { transform: scale(0.98); }
.btn {
  min-height: 46px; padding: 0 16px; border-radius: var(--r); font-weight: 700;
  background: var(--unlit); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 120ms var(--ease-out), background-color 140ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.dark { background: var(--ink); color: var(--panel); }
.btn.bad { background: var(--err-tint); color: var(--err); }
.btn.ok { background: var(--go); color: var(--on-go); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn .ico { width: 20px; height: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; min-width: 56px; padding: 0 12px; border-radius: var(--r); background: var(--unlit); font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform 120ms var(--ease-out), background-color 140ms ease; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.chip:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .go:hover { filter: brightness(1.06); }
  .btn:hover { background: #e3d8c3; }
  .btn.dark:hover { background: var(--ink); filter: brightness(1.2); }
  .btn.ok:hover { background: var(--go); filter: brightness(1.08); }
  .btn.bad:hover { background: #f2d6d0; }
}

/* ------------------------------------------------------------- app shell -- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top { background: var(--shop); color: var(--on-shop); padding: calc(10px + var(--safe-t)) var(--pad) 10px; }
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shop-name { margin: 0; font-family: var(--sign); font-weight: 700; font-stretch: condensed; font-size: 24px; line-height: 1.05; }
.status { margin-top: 4px; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: var(--on-shop); font-weight: 700; font-size: 15px; }
.status .lamp { width: 10px; height: 10px; border-radius: 50%; background: #7fd39c; box-shadow: 0 0 0 3px rgba(127, 211, 156, .25); }
.status.paused .lamp { background: #f2c14e; box-shadow: 0 0 0 3px rgba(242, 193, 78, .25); }
.status.off .lamp { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 248, 236, .7); }
.clockline { font-family: var(--sign); font-stretch: condensed; font-size: 22px; font-variant-numeric: tabular-nums; opacity: .9; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--panel); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabs button { position: relative; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tabs button[aria-current="page"] { color: var(--shop); }
.tabs button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--shop); }
.tabs .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--err); color: #fff; font-size: 13px; line-height: 22px; text-align: center; }
.view { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 14px var(--pad) calc(90px + var(--safe-b)); }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); padding: 0; max-width: none; }
  .tabs button { flex-direction: row; gap: 8px; min-height: 52px; font-size: 15px; }
  .tabs button[aria-current="page"]::before { top: auto; bottom: 0; border-radius: 3px 3px 0 0; }
  .tabs .count { position: static; }
  .view { padding-bottom: 40px; }
}

/* ------------------------------------------------------------- sections -- */
.h2 { margin: 18px 0 10px; font-family: var(--sign); font-weight: 700; font-stretch: condensed; font-size: 24px; line-height: 1.1; display: flex; align-items: baseline; gap: 10px; }
.h2 .n { font-family: var(--ui); font-size: 15px; font-weight: 700; color: var(--ink-2); }
.h2:first-child { margin-top: 4px; }
.empty { margin: 0; padding: 18px; border-radius: var(--r); background: var(--panel); color: var(--ink-2); }
.panel { background: var(--panel); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.panel h3 { margin: 0 0 4px; font-size: 18px; }
.panel .lead { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch span { font-weight: 600; }
.switch small { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; }
.toggle { position: relative; width: 52px; height: 32px; flex: none; border-radius: 16px; background: var(--steel); transition: background-color 160ms ease; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 200ms var(--ease-out); }
.toggle[aria-checked="true"] { background: var(--go); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }
.saved { margin: 10px 0 0; font-weight: 700; font-size: 14px; color: var(--go); min-height: 1.2em; }
.saved.bad { color: var(--err); }

/* --------------------------------------------------------------- orders -- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--warn-tint); color: var(--warn); font-weight: 600; margin-bottom: 12px; }
.alert.bad { background: var(--err-tint); color: var(--err); }
.alert .ico { width: 20px; height: 20px; margin-top: 2px; }
.orders { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); align-items: start; }
.card { background: var(--panel); border-radius: 10px; overflow: hidden; border: 2px solid transparent; }
.card.new { border-color: var(--shop); }
.card.arrive { animation: arrive 420ms var(--ease-out); }
@keyframes arrive { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--unlit); }
.card.new .card-head { background: var(--shop); color: var(--on-shop); }
.kind { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sign); font-weight: 700; font-stretch: condensed; font-size: 22px; line-height: 1; }
.kind .ico { width: 24px; height: 24px; }
.ago { font-size: 14px; font-weight: 700; text-align: right; }
.card-body { padding: 12px 14px; }
.who { margin: 0 0 8px; }
.who strong { font-size: 18px; display: block; }
.who a { color: inherit; font-weight: 600; }
.who .addr { display: block; margin-top: 2px; }
.from { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pay { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r); font-weight: 800; margin: 8px 0; }
.pay.card { background: var(--go-tint); color: var(--go); }
.pay.cash { background: var(--warn-tint); color: var(--warn); }
.note { padding: 9px 12px; border-radius: var(--r); background: var(--warn-tint); font-weight: 600; margin: 8px 0; }
.lines { list-style: none; margin: 8px 0 0; padding: 0; }
.lines li { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.lines li:first-child { border-top: 0; }
.lines .q { font-weight: 800; font-size: 18px; }
.lines .nm { font-weight: 700; font-size: 17px; }
.lines .amt { font-variant-numeric: tabular-nums; }
.lines .sub { grid-column: 2 / -1; font-size: 15px; color: var(--ink-2); margin-top: -2px; }
.lines .sub.no { color: var(--err); font-weight: 600; }
.totals { margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--line); display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 20px; font-weight: 800; }
.totals .off { color: var(--go); font-weight: 700; }
.decide { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.decide .label { font-weight: 700; font-size: 14px; color: var(--ink-2); }
/* Accept is the big one, full width; turning an order down sits underneath, smaller */
.decide-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.decide-row .btn { min-height: 44px; }
.next-row { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.next-row .go { flex: 1 1 220px; width: auto; }
.step { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 14px; background: var(--unlit); }
.step.out, .step.ready { background: var(--warn-tint); color: var(--warn); }
.step.done { background: var(--go-tint); color: var(--go); }
.step.no { background: var(--err-tint); color: var(--err); }
.done-list .card { opacity: .82; }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 10px 0; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }

/* ----------------------------------------------------------------- menu -- */
.cat { margin-bottom: 18px; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 8px; }
.cat-head h3 { margin: 0; font-family: var(--sign); font-weight: 700; font-stretch: condensed; font-size: 22px; }
.cat-tools { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r); background: var(--unlit); display: grid; place-items: center; transition: transform 120ms var(--ease-out); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .ico { width: 20px; height: 20px; }
.dish { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: var(--panel); margin-bottom: 6px; }
.dish.gone .dish-name { color: var(--ink-2); text-decoration: line-through; }
.thumb { width: 56px; height: 56px; border-radius: 6px; background: var(--unlit); overflow: hidden; display: grid; place-items: center; color: var(--ink-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-main { min-width: 0; text-align: left; }
.dish-name { font-weight: 700; display: block; }
.dish-meta { font-size: 14px; color: var(--ink-2); display: block; }
.dish-flags { display: flex; gap: 6px; }
/* a tick box you can read across the counter: ticked is on */
.flag { min-height: 40px; padding: 0 12px 0 10px; border-radius: var(--r); font-size: 14px; font-weight: 700; background: var(--unlit); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px; transition: transform 120ms var(--ease-out), background-color 140ms ease; }
.flag::before { content: ""; width: 18px; height: 18px; flex: none; border: 2px solid currentColor; border-radius: 4px; }
.flag[aria-pressed="true"]::before { background: currentColor; box-shadow: inset 0 0 0 3px var(--panel); }
.flag:active { transform: scale(0.97); }
.flag.sold[aria-pressed="true"] { background: var(--err-tint); color: var(--err); }
.flag.web[aria-pressed="true"] { background: var(--go-tint); color: var(--go); }
.flag.web[aria-pressed="false"] { background: var(--err-tint); color: var(--err); }
.menu-bar { position: sticky; top: 0; z-index: 4; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; background: var(--ground); }
@media (max-width: 520px) {
  .dish { grid-template-columns: 48px 1fr; }
  .thumb { width: 48px; height: 48px; }
  .dish-flags { grid-column: 1 / -1; }
  .dish-flags .flag { flex: 1; }
}

/* -------------------------------------------------------------- takings -- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tile { background: var(--panel); border-radius: 10px; padding: 12px 14px; }
.tile span { display: block; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.tile strong { display: block; font-family: var(--sign); font-stretch: condensed; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile small { color: var(--ink-2); }
.tile.big { background: var(--shop); color: var(--on-shop); }
.tile.big span, .tile.big small { color: var(--on-shop); opacity: .9; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; }
.tbl th { font-size: 13px; color: var(--ink-2); }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- shop --- */
.hours { display: grid; gap: 6px; }
.day { display: grid; grid-template-columns: 96px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--ground); }
.day select { padding: 8px; border-radius: 6px; border: 2px solid var(--steel); background: var(--panel); font-variant-numeric: tabular-nums; }
.day .times { display: flex; align-items: center; gap: 6px; }
.day.closed .times { opacity: .4; }
.day label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.areas { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.area { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 6px 0 12px; border-radius: 19px; background: var(--unlit); font-weight: 700; }
.area button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.area .ico { width: 16px; height: 16px; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
.offer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--ground); margin-bottom: 6px; }
.offer.off strong { color: var(--ink-2); text-decoration: line-through; }
.code { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--warn-tint); color: var(--warn); margin-left: 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); }
.c-68283d { background: #68283d; } .c-b23b30 { background: #b23b30; } .c-2f7a4f { background: #2f7a4f; } .c-2b5fa8 { background: #2b5fa8; }
.c-5b3a8c { background: #5b3a8c; } .c-1f1f1f { background: #1f1f1f; } .c-c2185b { background: #c2185b; } .c-e07b00 { background: #e07b00; }

/* ---------------------------------------------------------------- sheet -- */
.layer { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(28, 22, 16, .5); opacity: 0; transition: opacity 200ms ease; }
.layer.open .scrim { opacity: 1; }
.sheet { position: relative; width: 100%; max-width: 640px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 14px 14px 0 0; transform: translateY(100%); transition: transform 300ms var(--ease-drawer); }
.layer.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px var(--pad) 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--pad) 16px; }
.sheet-foot { display: flex; gap: 8px; padding: 12px var(--pad) calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.sheet-foot .go { flex: 1; width: auto; }
.photo-pick { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.photo-pick .thumb { width: 96px; height: 96px; }
.group { padding: 12px; border-radius: 8px; background: var(--ground); margin-bottom: 10px; }
.group .row3 input { padding: 10px; }
.answer { display: grid; grid-template-columns: 1fr 96px 44px; gap: 6px; margin-bottom: 6px; }
@media (min-width: 720px) {
  .layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 14px; transform: translateY(20px); opacity: 0; transition: transform 240ms var(--ease-out), opacity 180ms ease; }
  .layer.open .sheet { opacity: 1; }
}

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 60; margin: 0 auto; width: fit-content; max-width: 560px;
  transform: translateY(20px); opacity: 0; padding: 12px 16px; border-radius: 8px; background: var(--ink); color: var(--panel); font-weight: 600;
  transition: transform 220ms var(--ease-out), opacity 180ms ease; pointer-events: none; }
.toast.show { transform: none; opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* -------------------------------------------------------------- printing -- */
.print-area { display: none; }
@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; font: 13px/1.35 "Courier New", monospace; width: 72mm; color: #000; }
  .print-area h1 { font-size: 20px; margin: 0 0 4px; }
  .print-area .big { font-size: 18px; font-weight: 700; }
  .print-area hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
  .print-area .two { display: flex; justify-content: space-between; }
  @page { margin: 4mm; }
}

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