.header-link { color: var(--brand-ink); }
/* Round 15: "Sign out" stays on one line at 320 (the name gives way first). */
.site-header .header-row { gap: 8px; }
.site-header .header-link { white-space: nowrap; flex-shrink: 0; }
.site-header .header-row .brand { white-space: nowrap; }
/* "Marquam Hill Admin" with the TEST MODE badge and Sign out does not fit one line on a phone:
   the name takes two short lines from 420 px down (inside the 56 px header). */
@media (max-width: 420px) {
  .site-header .header-row .brand { min-width: 0; white-space: normal; font-size: 1rem; line-height: 1.15; gap: 6px; }
}
@media (max-width: 360px) {
  .site-header .mode-badge { padding: 3px 7px; font-size: 0.72rem; }
}
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-top: 12px; }
.tabs a { padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a.active { background: var(--brand-soft); color: var(--brand); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
/* On a phone the four lists sit on one row, so the first order starts higher. */
@media (max-width: 480px) {
  .segmented { gap: 4px; flex-wrap: nowrap; margin-bottom: 10px; }
  .segmented button { padding: 6px 4px; flex: 1 1 0; min-width: 0; white-space: nowrap; font-size: 0.95rem; }
}
/* Too narrow for four whole words on one row ("Delivered", "Cancelled" were cut at 320, "Cancelled" by a
   pixel at 390): smaller words up to 420 px, two by two under 375 px. */
@media (max-width: 420px) {
  .segmented button { padding: 6px 2px; font-size: 0.88rem; }
}
@media (max-width: 374px) {
  .segmented { display: grid; grid-template-columns: 1fr 1fr; }
  .segmented button { min-height: 44px; }
}
.check input[type="checkbox"] { width: 24px; height: 24px; min-width: 24px; flex: none; margin: 0; }
/* (round 14: the pay-mode choices are 24 px circles in a 44 px row, like the boxes) */
.check input[type="radio"] { width: 24px; height: 24px; min-width: 24px; flex: none; margin: 0; accent-color: var(--brand, #c2410c); }
label.check.pay-mode { min-height: 44px; padding: 4px 0; cursor: pointer; }
.order .when { gap: 4px 12px; margin: 4px 0; }
.order .when p { margin: 0; }
.call-in .call-head { flex-wrap: nowrap; }
/* A long restaurant name ("Call Marquam Hill Teriyaki & Pho House") wraps inside its button instead of
   widening the panel (a grid track and a flex item would otherwise grow to the unwrapped text). */
.call-in { grid-template-columns: minmax(0, 1fr); }
.call-in > * { min-width: 0; }
.call-in .call-head > a { min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.call-in .call-step .primary-action { min-width: 0; white-space: normal; }
.segmented button { background: var(--card); color: var(--text); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }
.segmented button.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.order header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.order h3 { font-size: 1.1rem; }
.order .contact a { margin-right: 12px; }
/* On the way: Delivered, then Call and Maps on the same row. */
.order .next-step { flex-wrap: nowrap; gap: 8px; margin: 10px 0; }
.order .next-step .primary-action { flex: 1; margin: 0; min-height: 48px; }
.order .next-step .button { flex: none; min-height: 48px; display: inline-flex; align-items: center; padding: 0 14px; }
.order .items { margin: 8px 0; padding-left: 18px; }
.order .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.order .actions button { flex: 1; min-width: 120px; }
.pill { font-size: 0.8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--line); }
.pill.new { background: var(--warn-soft); color: var(--warn); }
.pill.picked_up { background: var(--brand-soft); color: var(--brand); }
.pill.cancelled { background: var(--error-soft); color: var(--error); }
button.danger { background: var(--error); color: #fff; }
button.small { padding: 6px 10px; font-size: 0.875rem; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: var(--radius); margin-bottom: 16px; }
.switch.on { background: var(--brand-soft); }
.switch.off { background: var(--warn-soft); }
.switch strong { font-size: 1.1rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.panel h3 { margin-bottom: 10px; }
.grid2 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
select { font: inherit; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
.hours-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; min-height: 160px; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 5.5em 1fr 2.5em; gap: 8px; align-items: center; margin: 3px 0; font-size: 0.9rem; }
.bar { height: 14px; background: var(--brand); border-radius: 4px; min-width: 2px; }
.item-row { border-bottom: 1px solid var(--line); padding: 10px 0; }
.photo-preview { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.options-editor { margin: 12px 0 8px; padding-left: 10px; border-left: 3px solid var(--brand-soft); }
.options-editor h4 { margin: 0 0 8px; }
.opt-row { margin: 6px 0; }
.opt-row > summary { cursor: pointer; }

/* Restaurant balances and payments. */
td.due { color: var(--error); }
.pay-form { display: grid; gap: 4px 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; margin-top: 14px; }
.pay-form h4, .pay-form button { grid-column: 1 / -1; }
.pay-form button { justify-self: start; }
tr.take-home td { border-top: 2px solid var(--line); }

/* Paying restaurants */
.pay-counter { background: var(--warn-soft); color: var(--text); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 1.05rem; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
fieldset.plain legend { font-weight: 700; margin-bottom: 6px; }
fieldset.plain .check { align-items: flex-start; }

/* Call-in mode */
.call-in { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; margin: 8px 0; display: grid; gap: 8px; }
.call-in.late { background: var(--error-soft); }
.call-in .script ol { margin: 6px 0 0; padding-left: 18px; }
.call-in select { width: auto; display: inline-block; }
/* Ready in and Called in side by side, right under the call: the big button takes the rest of the row. */
.call-in .call-step { flex-wrap: nowrap; }
.call-in .call-step label { white-space: nowrap; }
.call-in .call-step .primary-action { flex: 1; margin: 0; }

/* Paste a whole menu */
.paste-table { overflow-x: auto; }
.paste-notes { margin: 6px 0 0; padding-left: 18px; }
.paste-notes li { margin-bottom: 6px; }
.paste-notes code { font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; }

/* Test mode is never easy to miss. */
.mode-badge { background: #facc15; color: #1d1d1b; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.04em; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.mode-badge[hidden] { display: none; }
.banner.test { background: #facc15; color: #1d1d1b; border: 2px solid #1d1d1b; }

/* One-tap sold out, beside each item. */
.item-row { display: flex; gap: 8px; align-items: flex-start; }
.item-row[hidden] { display: none; }
.item-row > details { flex: 1; min-width: 0; }
.soldout-toggle { min-width: 92px; min-height: 44px; }

/* A hidden row stays hidden even where a row is laid out as a flex box. */
.address-row[hidden] { display: none; }

.paste-choices { margin-top: 4px; }
.paste-choices button { min-height: 44px; }
.paste-table tr.warn td { background: #fef3c7; color: #1d1d1b; }
.paste-warn { font-weight: 700; }

/* Never missed: a new order while the list is held, and alerts being off. */
.list-waiting:empty { display: none; }
.new-order-bar { font-size: 1.1rem; padding: 16px; margin-bottom: 12px; background: var(--error); color: #fff; }
.alerts-off { display: flex; flex-direction: column; gap: 2px; background: var(--error); color: #fff; padding: 12px 16px; margin-bottom: 12px; text-align: left; min-height: 48px; justify-content: center; }
.alerts-off span { font-weight: 400; font-size: 0.9rem; }
/* One line on a phone: the reason is still read out by a screen reader. */
@media (max-width: 599px) {
  .alerts-off .alerts-why { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* "Before you start": a summary line with how many things there are; one line once read today. */
details.checklist > summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; cursor: pointer; min-height: 44px; align-content: center; list-style: none; }
details.checklist > summary::-webkit-details-marker { display: none; }
details.checklist > summary h3 { margin: 0; }
details.checklist > summary::after { content: '▾'; margin-left: auto; }
details.checklist[open] > summary::after { content: '▴'; }
details.checklist:not([open]) { padding-top: 6px; padding-bottom: 6px; }
.pickup-undo button { margin-top: 8px; min-height: 44px; }

/* The menu review table: one card per pasted line on a phone, one table row on a computer. */
.paste-row { border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
.paste-row.unsure { border-color: #b45309; border-left-color: #b45309; background: #fef3c7; color: #1d1d1b; }
.paste-row.bad { border-color: var(--error); border-left-color: var(--error); }
.paste-row.settled { border-left-color: var(--muted); }
.paste-row .field { margin: 0 0 8px; }
.paste-row input, .paste-row select { min-height: 44px; }
.paste-original code { white-space: pre-wrap; word-break: break-word; font-size: 0.9rem; }
.paste-row.unsure .muted, .paste-row.unsure label { color: #1d1d1b; }
.paste-actions { margin: 4px 0; }
.paste-actions[hidden] { display: none; }
.paste-actions button, .paste-buttons button { min-height: 44px; }
.paste-status { margin: 4px 0 0; }
.paste-buttons { margin: 10px 0; }
.paste-row input, .paste-row select { width: 100%; }
/* The name wraps, so a long one is all there. */
.paste-row textarea { width: 100%; min-height: 44px; resize: none; overflow: hidden; field-sizing: content; }
.paste-row button { min-height: 44px; }
.paste-row.unsure button.secondary { color: #1d1d1b; border-color: #1d1d1b; }
.paste-original[hidden], .paste-done[hidden], .paste-tick[hidden], .paste-buttons button[hidden] { display: none; }
.paste-look { font-weight: 700; }
.paste-lead { font-weight: 700; font-size: 1.05rem; margin: 0 0 6px; }
.paste-section { margin: 0 0 22px; }
.paste-title { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.paste-title.plain { margin: 0 0 8px; }
.paste-head { border-left-color: var(--text); }
.paste-head-actions { margin-top: 4px; }
/* A dish the reader is sure of: one line, "Name … $price", Edit. */
.paste-row.compact { padding: 2px 8px 2px 12px; margin-bottom: 4px; }
.paste-row.compact.paste-head { padding: 8px 12px; margin-bottom: 8px; }
.paste-line { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.paste-name { flex: 0 1 auto; min-width: 0; background: none; border: 0; box-shadow: none; padding: 0; color: var(--text); font: inherit; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.paste-row.left .paste-name { font-weight: 400; color: var(--muted); }
.paste-dots { flex: 1 1 12px; min-width: 12px; border-bottom: 2px dotted var(--line); }
.paste-price { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.paste-edit { flex: none; min-width: 44px; }
.paste-desc { margin: -6px 0 6px; overflow-wrap: anywhere; }
.paste-row.compact .paste-status { margin: 0 0 6px; }
.paste-row.compact .paste-status:empty { display: none; }
.paste-tick { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-top: 8px; padding: 8px 12px; border: 2px solid var(--brand); border-radius: 10px; font-weight: 600; cursor: pointer; }
.paste-tick input { width: 24px; height: 24px; min-height: 0; flex: none; margin: 0; }
.paste-already { margin: 0 0 12px; }
.paste-already summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.paste-already code { white-space: pre-wrap; word-break: break-word; }
@media (min-width: 700px) {
  .paste-fields { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: start; }
  .paste-fields.kind-dish { grid-template-columns: 120px 110px minmax(0, 2fr) 84px minmax(0, 1.2fr); }
  .paste-row .field { margin: 0; }
}

/* "More" on an order card: a full-width, thumb-sized tap target. */
details.more > summary { display: block; width: 100%; min-height: 44px; line-height: 44px; cursor: pointer; }
details.more > summary::before { content: '\25B8\00a0'; }
details.more[open] > summary::before { content: '\25BE\00a0'; }
details.more > summary::-webkit-details-marker { display: none; }
.double-keep { display: inline-flex; margin-top: 4px; }
.double-keep button { min-height: 44px; }
.line-amounts { list-style: none; margin: 0 0 8px; padding: 0; }
.line-amounts li { margin: 0 0 6px; }
.line-amount { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; width: 100%; min-height: 44px; text-align: left; font-weight: 400; }
.line-amount span:last-child { font-variant-numeric: tabular-nums; }
.line-amount.one { margin-top: 6px; width: calc(100% - 16px); margin-left: 16px; }

/* Refund part of a paid order (under More). */
.part-refund { margin: 10px 0; }
.part-refund .row { display: flex; gap: 8px; align-items: center; }
.part-refund .part-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.part-refund .so-far { font-size: 1.05rem; white-space: nowrap; }
.part-refund input { max-width: 140px; }
.part-refund .hint[hidden] { display: none; }
.checklist li button { margin: 4px 0; }

/* Review pass 5: a highlighted row is short on a phone: the pasted line and the reason, the guessed
   name and price side by side, the buttons on one row; the rest under More. */
.paste-row .paste-status:empty { display: none; }
.paste-row.held { padding: 8px 10px; }
.paste-row.held .paste-original { margin: 0 0 6px; }
.paste-pair { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 8px; align-items: start; }
.paste-pair .field { margin: 0; }
.paste-row.held .paste-fields { margin-bottom: 4px; }
.paste-extra[hidden] { display: none; }
.paste-extra { margin-top: 6px; }
.paste-row.held .paste-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.paste-row.held .paste-actions button { padding: 6px 10px; }
.paste-guess { margin: 2px 0 4px; overflow-wrap: anywhere; }
.paste-extras { margin: 0 0 10px; }
.paste-extras p { margin: 0 0 6px; }
.paste-more-box { margin: 10px 0; }
.paste-more-box button, .paste-tidy { min-height: 44px; }
.paste-tidy { margin: 0 0 6px; }

/* Every control on the admin page is a thumb-sized target. */
.segmented button { min-height: 44px; }
details.panel > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.paste-head .paste-actions button, .paste-head-actions button { min-width: 44px; min-height: 44px; }
.order details.more a, .refund-box a, .order a[data-testid='stripe-payment'] { display: inline-flex; align-items: center; min-height: 44px; }
.paste-name { min-height: 44px; min-width: 44px; }
.paste-row.held { margin-bottom: 6px; }
.paste-pair label { display: block; margin: 0 0 2px; font-size: 0.8rem; line-height: 1.2; }
.paste-pair input, .paste-pair textarea { min-height: 44px; height: auto; padding-top: 8px; padding-bottom: 8px; }
.paste-row.held .paste-original { line-height: 1.35; }
.paste-section { margin-bottom: 14px; }
.fix-link, .order details.more a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
@media (min-width: 700px) {
  .paste-row.held .paste-fields { display: block; }
  .paste-pair { grid-template-columns: minmax(0, 1fr) 120px; max-width: 760px; }
  .paste-extra { display: grid; grid-template-columns: 200px 200px minmax(0, 1fr); gap: 10px; }
  .paste-extra[hidden] { display: none; }
}

/* Review pass 6 */
select { min-height: 44px; }
.paste-buttons button:disabled { opacity: 1; background: var(--off-bg); color: var(--off-ink); box-shadow: none; }
.paste-extra .paste-kind { grid-column: 1 / -1; }
.paste-extra .paste-kind select { width: 100%; max-width: 420px; }
.paste-sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 4px 0; }
.paste-sizes .field { margin: 0; }
.paste-sizes input { min-height: 44px; width: 100%; }
.paste-extras-list { list-style: none; margin: 0; padding: 0; }
.paste-extras-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.paste-extras-list button { min-height: 44px; min-width: 44px; }
.paste-extras-list button[aria-pressed='true'] { background: var(--brand); color: #fff; }
.paste-tidy-box { gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.paste-tidy-all, .paste-tidy-undo { min-height: 44px; }
@media (min-width: 700px) {
  /* "This line is" on its own row, wide enough for "Description of the dish above". */
  .paste-fields .paste-kind { grid-column: 1 / -1; }
  .paste-fields .paste-kind select { width: 100%; max-width: 420px; }
}
/* Review pass 6, admin: thumb-sized "What to say" and in-sentence links. */
details.script > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
a.tap-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; margin: -12px 0; vertical-align: middle; }
.refund-ask { display: block; margin-top: 4px; }

/* Review pass 11: at 360 px and under the four top tabs share one row with no sideways scroll, and
   the call-in title sits over its button or note, so "Call it in now" and "Called in" stay whole. */
@media (max-width: 480px) {
  .tabs { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 0; overflow-x: visible; }
  .tabs a { padding: 8px 10px; justify-content: center; }
}
/* Review pass 12: a delivery-hours row on a phone is the day and remove on one row, then opens and
   closes side by side (each wide enough for "05:00 PM" at 320 px), so the day never shrinks to its
   arrow and nothing scrolls sideways. */
.hours-row > * { min-width: 0; }
@media (max-width: 480px) {
  .hours-row {
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px;
    grid-template-areas: "day day day remove" "opens opens closes closes";
    margin-bottom: 14px;
  }
  .hours-row select { grid-area: day; }
  .hours-row input[type=time] { padding-left: 8px; padding-right: 6px; }
  .hours-row input[aria-label=Opens] { grid-area: opens; width: 100%; }
  .hours-row input[aria-label=Closes] { grid-area: closes; width: 100%; }
  .hours-row button { grid-area: remove; min-height: 44px; min-width: 44px; }
}
@media (max-width: 360px) {
  /* Report tables (five columns) fit 320 px: tighter cells, names wrap, amounts stay whole. */
  table { font-size: 0.85rem; }
  th, td { padding: 6px 2px; }
  /* (round 14: a gap between columns, so "$38.85 $3.89" never reads as one number) */
  th + th, td + td { padding-left: 8px; }
  /* Names may break anywhere; a header word ("Restaurant") only shrinks, never splits. */
  td:first-child { overflow-wrap: anywhere; }
  th { overflow-wrap: normal; word-break: normal; hyphens: none; font-size: 0.8rem; }
  .tabs a { padding: 8px 7px; font-size: 0.9rem; }
  .call-in .call-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .call-in .call-step { flex-wrap: wrap; }
  .call-in .call-step .primary-action { white-space: normal; flex-basis: 100%; }
  .call-in .call-head > a { align-self: stretch; }
}
