/* Layout: road-sign dispatch. Condensed display type for order numbers and
   headers, plain body type for details, mono for times and money. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --line: #d9dee4;
  --fg: #16202b;
  --muted: #5f6b78;
  --accent: #1f4fd6;
  --accent-fg: #ffffff;
  --accent-soft: #e3eafc;

  --s-pending: #b86e00;
  --s-pending-bg: #fdf0d9;
  --s-accepted: #1f4fd6;
  --s-accepted-bg: #e3eafc;
  --s-picked: #7a3fc4;
  --s-picked-bg: #f0e7fb;
  --s-done: #1d7f45;
  --s-done-bg: #dff3e7;
  --s-off: #6b7480;
  --s-off-bg: #eceff2;
  --danger: #c4302b;
  --go-fg: #ffffff;

  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 43, 0.06), 0 4px 14px rgba(22, 32, 43, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #18202a;
    --surface-2: #1e2732;
    --line: #2b3643;
    --fg: #e8edf2;
    --muted: #93a0ae;
    --accent: #5b85ff;
    --accent-fg: #0b1020;
    --accent-soft: #1d2b4f;
    --s-pending: #f0a63a;
    --s-pending-bg: #3a2a10;
    --s-accepted: #7c9dff;
    --s-accepted-bg: #1d2b4f;
    --s-picked: #b98cf0;
    --s-picked-bg: #2f2242;
    --s-done: #4fc382;
    --s-done-bg: #133423;
    --s-off: #8a95a1;
    --s-off-bg: #252e38;
    --danger: #ff6b63;
    --go-fg: #06210f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.label {
  font: 600 12px/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, .tab:focus-visible, .order:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.go { background: var(--s-done); border-color: var(--s-done); color: var(--go-fg); }
.btn.danger { color: var(--danger); }
.btn.big { width: 100%; padding: 16px; font-size: 18px; border-radius: 12px; font-family: var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

/* form fields */
.field { display: grid; gap: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.field textarea { min-height: 72px; resize: vertical; }
.error { color: var(--danger); font-weight: 600; min-height: 1.4em; margin: 0; }

/* status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font: 700 12px/1.4 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.pending { color: var(--s-pending); background: var(--s-pending-bg); }
.pill.accepted { color: var(--s-accepted); background: var(--s-accepted-bg); }
.pill.picked_up { color: var(--s-picked); background: var(--s-picked-bg); }
.pill.delivered { color: var(--s-done); background: var(--s-done-bg); }
.pill.cancelled, .pill.off { color: var(--s-off); background: var(--s-off-bg); }

/* route: pickup -> dropoff */
.route { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.route li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; min-width: 0; }
.route .dot {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  font: 700 12px/1 var(--font-display);
  color: #fff;
}
.route .dot.p { background: var(--s-pending); }
.route .dot.d { background: var(--fg); color: var(--bg); }
.route span { overflow-wrap: anywhere; }

/* call / text buttons */
.call-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.call-row .btn { padding: 8px 14px; }
.btn.call { background: var(--s-done); border-color: var(--s-done); color: var(--go-fg); }

/* itemized food receipt */
.rcpt { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 14px; display: grid; gap: 8px; font-size: 15px; }
.rc-line { display: grid; grid-template-columns: 2.2ch 1fr auto; gap: 10px; align-items: baseline; }
.rc-qty { font-family: var(--font-mono); font-weight: 600; color: var(--accent); text-align: right; }
.rc-name { min-width: 0; overflow-wrap: anywhere; }
.rc-name small { display: block; color: var(--muted); font-size: 12px; }
.rc-amt { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.rc-sum { border-top: 1px dashed var(--line); padding-top: 8px; display: grid; gap: 4px; }
.rc-sum div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 14px; }
.rc-sum span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.rc-sum .rc-total { color: var(--fg); font-weight: 700; font-size: 17px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 12px 18px; border-radius: 10px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 2000;
  max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
