:root {
  --bg: #f4efe6;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #7a6b5d;
  --line: #e2d8c9;
  --accent: #8b2e1f;
  --accent-ink: #ffffff;
  --ok: #2e7d4f;
  --warn: #c77d0a;
  --info: #2b5f9e;
  --danger: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  padding-block: 0 24px;
  padding-inline: 16px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 16px;
}
header.top h1 { font-size: 1.35rem; margin: 0; }
header.top nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  margin-left: 14px;
}
header.top nav a.active { text-decoration: underline; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

button {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
button.info { background: var(--info); color: #fff; border-color: var(--info); }
button.warn { background: var(--warn); color: #fff; border-color: var(--warn); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.small { padding: 6px 10px; font-size: 0.9rem; }

input, textarea, select {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
  background: #fff;
  color: var(--ink);
}
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}
.badge.new { background: var(--danger); }
.badge.preparing { background: var(--warn); }
.badge.ready { background: var(--ok); }
.badge.served { background: var(--muted); }
.badge.cancelled { background: #555; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 10;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

/* ---------- Take an order ---------- */
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}
@media (max-width: 760px) {
  .order-layout { grid-template-columns: minmax(0, 1fr); }
}
.header-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .header-fields { grid-template-columns: 1fr; } }

.category-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.category-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.menu-item {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
}
.menu-item .name { font-weight: 600; line-height: 1.2; }
.menu-item .price { color: var(--muted); font-size: 0.9rem; }

.basket { position: sticky; top: 12px; }
.basket-lines { list-style: none; margin: 0; padding: 0; }
.basket-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.basket-line .controls { display: flex; align-items: center; gap: 6px; }
.basket-line .controls span { min-width: 24px; text-align: center; font-weight: 700; }
.basket-line input { grid-column: 1 / -1; font-size: 0.9rem; padding: 6px 8px; }
.basket-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 14px 0;
}
.basket .actions { display: flex; gap: 8px; }
.basket .actions button { flex: 1; }

/* ---------- Kitchen board ---------- */
.kitchen-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ticket {
  border-left: 8px solid var(--danger);
  font-size: 1.05rem;
}
.ticket.preparing { border-left-color: var(--warn); }
.ticket.ready { border-left-color: var(--ok); }
.ticket.late { box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.35); }
.ticket.late .age { color: var(--danger); }
.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.ticket-head .table { font-size: 1.6rem; font-weight: 800; }
.ticket-head .age { font-weight: 700; }
.ticket ul { list-style: none; margin: 0 0 10px; padding: 0; }
.ticket li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ticket li .qty { font-weight: 800; margin-right: 8px; }
.ticket li .note { display: block; color: var(--accent); font-style: italic; font-size: 0.92rem; }
.ticket .order-note { color: var(--accent); font-style: italic; margin-bottom: 8px; }
.ticket .actions { display: flex; gap: 8px; }
.ticket .actions button { flex: 1; font-size: 1.05rem; padding: 12px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 1.1rem; }

/* ---------- Waitress order prices ---------- */
.orders-table-wrap { overflow-x: auto; }
table.orders {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.orders th, table.orders td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.orders th { font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }
table.orders tr.expanded td { background: #fbf8f2; }
table.orders td.total { font-size: 1.15rem; font-weight: 800; text-align: right; }
table.orders .items { font-size: 0.92rem; color: var(--muted); }
table.orders .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.table-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.table-summary .tile { text-align: center; }
.table-summary .tile .t { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; }
.table-summary .tile .v { font-size: 1.5rem; font-weight: 800; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.receipt { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre; font-size: 0.95rem; }

/* ---------- Menu setup ---------- */
.card-title { margin: 0 0 8px; font-size: 1.1rem; }
.menu-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 3fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 800px) { .menu-layout { grid-template-columns: minmax(0, 1fr); } }

.profile-list { list-style: none; margin: 0; padding: 0; }
.profile-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}
.profile-list li:hover { border-color: var(--accent); }
.profile-list li.selected { background: #fbf8f2; border-color: var(--accent); }

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

table.items { width: 100%; border-collapse: collapse; }
table.items th, table.items td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.items th { font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }
table.items input[type="text"], table.items input:not([type]) { min-width: 140px; }
table.items input[type="number"] { width: 90px; }
table.items input[type="checkbox"] { width: 20px; height: 20px; }
table.items tr.sold-out input:not([type="checkbox"]) { color: var(--muted); text-decoration: line-through; }
table.items tr.disabled-item td { background: #f1efeb; }
table.items tr.disabled-item td > :not(.photo-actions):not([data-f="enabled"]):not([data-del]) { opacity: 0.45; }
table.items .add-row td { background: #fbf8f2; }
.profile-name { font-size: 0.95rem; font-weight: 500; }

/* ---------- Login & nav ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 100%; max-width: 360px; }
.error { color: var(--danger); font-weight: 600; margin: 0 0 10px; }
header.top nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; }
header.top nav a { margin-left: 0; }
header.top nav .who { display: flex; align-items: center; gap: 8px; margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.users-list { list-style: none; margin: 0; padding: 0; }
.users-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- Descriptions, import/export ---------- */
.menu-item .desc {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.menu-item .price { margin-top: auto; }
table.items input.desc { min-width: 220px; }
a.button-link {
  display: inline-block;
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}
a.button-link:hover { border-color: var(--accent); }
input[type="file"] { padding: 6px; }

/* ---------- Social media poster ---------- */
.poster-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 820px) { .poster-layout { grid-template-columns: minmax(0, 1fr); } }
.poster-controls .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.checks label { font-weight: 500; display: flex; align-items: center; gap: 8px; margin: 0; }
.checks input[type="checkbox"] { width: 18px; height: 18px; }
.poster-preview { display: flex; justify-content: center; }
.poster-preview canvas {
  max-width: 100%;
  max-height: 85vh;
  height: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  border-radius: 4px;
  background: #fff;
}

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
table.users-table select { width: auto; }
table.users-table input { min-width: 140px; }
.login-card .venue { color: var(--accent); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 6px; }

/* ---------- Dietary badges ---------- */
.diet {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--ok);
}
.diet.vegan { background: #1b6b3a; }
.ticket .diet { font-size: 0.8rem; }
table.items th.narrow { white-space: nowrap; }
input[readonly] { background: #f3efe8; color: var(--muted); cursor: default; }

/* ---------- Kitchen ticket steps ---------- */
.steps {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}
.steps .step {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 4px;
  font-size: 0.95rem;
  font-weight: 700;
  background: #fff;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.1;
}
.steps .step:last-child { border-right: 0; }
.steps .step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.8rem;
  background: var(--line);
  color: var(--ink);
}
.steps .step.done { background: #eaf4ee; color: var(--ok); }
.steps .step.done .num { background: var(--ok); color: #fff; }
.steps .step.current { color: #fff; cursor: default; }
.steps .step.current .num { background: rgba(255,255,255,0.3); color: #fff; }
.steps .step.current.new { background: var(--danger); }
.steps .step.current.preparing { background: var(--warn); }
.steps .step.current.ready { background: var(--ok); }
.steps .step.todo:hover { background: #f6f2ea; color: var(--ink); }

/* ---------- Kitchen timers ---------- */
.ticket .timer { text-align: right; line-height: 1.1; }
.ticket .timer .t-label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ticket .timer .t-val { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket .timer.new .t-val { color: var(--danger); }
.ticket .timer.preparing .t-val { color: var(--warn); }
.ticket .timer.ready .t-val { color: var(--ok); }
.ticket .late-text { color: var(--danger); font-weight: 700; }

/* ---------- Kitchen completed section ---------- */
.section-title { font-size: 1.1rem; margin: 28px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.kitchen-board.completed .ticket { border-left-color: var(--muted); opacity: 0.8; font-size: 0.95rem; }
.kitchen-board.completed .ticket:hover { opacity: 1; }
.kitchen-board.completed .ticket-head .table { font-size: 1.25rem; }
.kitchen-board.completed .ticket .timer .t-val { font-size: 1.1rem; color: var(--muted); }
.kitchen-board.completed .ticket li { padding: 3px 0; }
.kitchen-board.completed .steps .step { padding: 8px 2px; font-size: 0.8rem; }
.kitchen-board.completed .steps .step .num { width: 18px; height: 18px; font-size: 0.7rem; }
.steps .step.current.served { background: var(--muted); }
.ticket .timer.served .t-val { color: var(--muted); }
.steps .step { font-size: 0.85rem; padding: 10px 2px; }

/* ---------- Duplicate-name warning on the order screen ---------- */
.warn-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff4e0;
  border: 1px solid #e8c48a;
  color: #7a4a00;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ---------- Collapsible completed panel ---------- */
.completed-panel { margin-top: 28px; border-top: 1px solid var(--line); }
.completed-panel > summary.section-title {
  margin: 0;
  padding: 16px 0 10px;
  border-top: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.completed-panel > summary::-webkit-details-marker { display: none; }
.completed-panel .chev { display: inline-block; transition: transform 0.15s; color: var(--muted); margin-right: 4px; }
.completed-panel[open] .chev { transform: rotate(90deg); }
.completed-panel > summary:hover { color: var(--accent); }
.ticket .ticket-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.ticket .ticket-foot button { font-size: 0.8rem; padding: 4px 8px; opacity: 0.7; }
.ticket .ticket-foot button:hover { opacity: 1; }

/* ---------- Ready-to-serve bar (waitress screens) ---------- */
#ready-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #e6f4ea;
  border: 2px solid var(--ok);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(46, 125, 79, 0.2);
}
#ready-bar .ready-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--ok); font-size: 1.05rem; }
#ready-bar .ready-head button { margin-left: auto; }
#ready-bar .ready-list { display: flex; flex-wrap: wrap; gap: 8px; }
#ready-bar .ready-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px 6px 12px;
}
#ready-bar .ready-item .who { font-weight: 800; font-size: 1.1rem; }
@keyframes ready-flash {
  0%, 100% { background: #e6f4ea; }
  25%, 75% { background: #b9e4c6; }
  50% { background: #8fd4a6; }
}
#ready-bar.flash { animation: ready-flash 1.2s ease-in-out 3; }
.warn-box[hidden], #ready-bar[hidden] { display: none; }

/* ---------- Open orders panel on the take-order screen ---------- */
.open-orders { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.open-order { padding: 8px 0 8px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--danger); }
.open-order.preparing { border-left-color: var(--warn); }
.open-order.ready { border-left-color: var(--ok); }
.open-order:last-child { border-bottom: 0; }
.open-order .oo-main { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.open-order .oo-who { font-weight: 800; font-size: 1.05rem; }
.open-order .oo-meta { font-size: 0.82rem; margin-top: 2px; }
.open-order .oo-dots { display: flex; gap: 5px; margin-top: 6px; }
.open-order .dot { width: 26px; height: 6px; border-radius: 3px; background: var(--line); }
.open-order .dot.done { background: var(--ok); }
.open-order.new .dot.current { background: var(--danger); }
.open-order.preparing .dot.current { background: var(--warn); }
.open-order.ready .dot.current { background: var(--ok); }

/* ---------- Logo ---------- */
.rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0 12px; }
.logo-box { display: flex; align-items: center; justify-content: center; min-height: 90px; padding: 10px; background: #fff; border: 1px dashed var(--line); border-radius: 8px; }
.logo-box img { max-height: 140px; max-width: 100%; }
.login-logo { display: block; max-height: 90px; max-width: 220px; margin: 0 auto 10px; }

/* ---------- Item photos ---------- */
table.items td.photo-cell { white-space: nowrap; }
table.items td.photo-cell .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 6px; border: 1px solid var(--line); }
table.items td.photo-cell .photo-actions { display: inline-flex; gap: 4px; vertical-align: middle; }
.menu-item .tile-photo { width: 100%; height: 88px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 8px 0 0; }
.check-inline input { width: 18px; height: 18px; }
.logo-box-checks {
  background-color: #fff;
  background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
table.users-table td.user-cell { white-space: nowrap; }
table.users-table td.user-cell input { width: auto; min-width: 120px; max-width: 160px; }
table.users-table td.user-cell .you { margin-left: 6px; font-size: 0.85rem; }
table.users-table td input:not([type="checkbox"]) { min-width: 0; width: 130px; }
table.users-table td.user-cell input { min-width: 0; width: 118px; max-width: none; }
table.users-table .add-row td input { width: 120px; }
table.users-table th, table.users-table td { padding: 6px 4px; }
.badge.paid { background: var(--info); }
.ticket.paid { border-left-color: var(--info); }

/* ---------- Accounting ---------- */
.acc-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 16px; }
.acc-filters .filters { margin: 0; }
.acc-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acc-range label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.acc-range input[type="date"] { width: auto; padding: 8px; }
.acc-exports { margin-left: auto; }
a.button-link.primary-link { background: var(--accent); color: #fff; border-color: var(--accent); }
.acc-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.acc-table { width: 100%; }
.acc-table th.num, .acc-table td.num { text-align: right; white-space: nowrap; }
.acc-table td { padding: 6px 4px; }
.acc-scroll { max-height: 320px; overflow-y: auto; }
table.orders tr.cancelled-row td { opacity: 0.55; }
table.orders td.items-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.9rem; }

/* ---------- Trading sessions ---------- */
.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--info);
  border-radius: var(--radius);
}
.session-open { max-width: 560px; margin: 0 auto; }
.session-open .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .session-open .two-col { grid-template-columns: 1fr; } }
dialog.session-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  width: min(520px, calc(100vw - 32px));
  color: var(--ink);
  background: var(--card);
}
dialog.session-dialog::backdrop { background: rgba(0,0,0,0.4); }
dialog.session-dialog h2 { margin: 0 0 4px; font-size: 1.2rem; }
dialog.session-dialog label { margin-top: 6px; }
.cashup { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.cashup div { background: #f8f4ec; border-radius: 8px; padding: 8px; text-align: center; }
.cashup .t { display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }
.cashup .v { display: block; font-size: 1.15rem; font-weight: 800; }
.sessions-table td, .sessions-table th { white-space: nowrap; }
.sessions-table td:last-child { white-space: normal; max-width: 240px; }

/* hidden must always win, whatever display an element normally has */
[hidden] { display: none !important; }
table.items tr.paste-armed td { background: #fff4e0; }

/* ---------- Sessions page ---------- */
.sessions-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .sessions-layout { grid-template-columns: minmax(0, 1fr); } }
.session-now .sn-title { font-size: 1.25rem; font-weight: 800; }
.editable { cursor: text; border-bottom: 1px dashed var(--line); }
.editable:hover { border-bottom-color: var(--accent); }
td.notes-cell { white-space: normal; max-width: 220px; }
a.small.button-link { padding: 6px 10px; font-size: 0.9rem; }

/* ---------- Kitchen availability panel & sold-out tiles ---------- */
.availability-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 16px; }
.availability-list .avail-cat { grid-column: 1 / -1; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); margin-top: 8px; }
.avail-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.2fr) auto; gap: 8px; align-items: center; padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.avail-row.sold-out { background: #fbeaea; border-color: #e6b8b8; }
.avail-row.sold-out .avail-name { text-decoration: line-through; color: var(--muted); }
.avail-row .avail-name { font-weight: 600; }
.avail-row .avail-note { padding: 6px 8px; font-size: 0.9rem; }
.menu-item.sold-out { opacity: 0.55; cursor: not-allowed; background: #f6f2ea; }
.menu-item.sold-out .name { text-decoration: line-through; }
.menu-item .sold-out-tag { display: inline-block; font-size: 0.7rem; font-weight: 800; color: #fff; background: var(--danger); border-radius: 4px; padding: 2px 6px; letter-spacing: 0.04em; }
.menu-item .kitchen-note { color: #7a4a00; background: #fff4e0; border-radius: 4px; padding: 2px 6px; font-size: 0.78rem; font-weight: 600; }

/* ---------- Allergens ---------- */
.allergens { display: inline-block; color: #7a4a00; background: #fff4e0; border: 1px solid #f0d9a8; border-radius: 4px; padding: 1px 6px; font-size: 0.75rem; font-weight: 600; }
.menu-item .allergens { align-self: flex-start; }
.allergen-btn { min-width: 60px; font-size: 0.8rem; letter-spacing: 0.02em; white-space: nowrap; }
.allergen-btn.has { background: #fff4e0; border-color: #e8c48a; color: #7a4a00; font-weight: 700; }
.allergen-pop { position: absolute; z-index: 20; width: 330px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.2); padding: 12px; }
.allergen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.allergen-grid label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 0.9rem; margin: 0; cursor: pointer; }
.allergen-grid label b { font-size: 0.75rem; color: var(--muted); width: 22px; }
.allergen-grid input { width: 16px; height: 16px; }
.ticket li .allergens { font-size: 0.8rem; }


/* ==================================================================
   iPad / touch tablet support
   ================================================================== */

/* Respect the iPad's rounded corners / home indicator when running full screen from the home screen. */
body {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
.login-body { min-height: 100vh; min-height: 100dvh; }

/* Buttons, links and fields should never trigger double-tap zoom. */
button, a.button-link, input, select, textarea, label, .step, .menu-item, .profile-list li { touch-action: manipulation; }

@media (pointer: coarse) {
  /* iOS zooms into any field smaller than 16px; keep every field at least 16px. */
  input, select, textarea { font-size: 16px !important; }
  /* Finger-sized targets (Apple's guideline is 44pt). */
  button, a.button-link { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  button.small, a.small.button-link { min-height: 40px; padding: 8px 12px; font-size: 0.95rem; }
  input, select { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; }
  .checks label, .check-inline { min-height: 32px; }
  .category-tabs button { min-height: 44px; }
  .basket-line .controls button { min-width: 44px; }
  .steps .step { padding: 14px 4px; }
  .steps .step .num { width: 26px; height: 26px; }
  .avail-row { grid-template-columns: 1fr; }
  .avail-row .avail-note { min-height: 44px; }
  .ticket .ticket-foot button { min-height: 40px; }
  table.items input:not([type="checkbox"]), table.orders input { min-height: 40px; }
  header.top nav a { padding: 8px 4px; }
  /* Hover styles stick on touch screens; do not rely on them. */
  .menu-item:hover, button:hover { border-color: var(--line); }
  .menu-item.sold-out:hover { border-color: var(--line); }
}

/* iPad portrait (768px): keep the order screen in two columns but give the basket less room. */
@media (min-width: 700px) and (max-width: 900px) {
  .order-layout { grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr); }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kitchen-board { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .sessions-layout, .settings-layout, .menu-layout, .poster-layout { grid-template-columns: minmax(0, 1fr); }
  .acc-exports { margin-left: 0; }
}

/* Anything narrower than an iPad portrait stacks to one column. */
@media (max-width: 699px) {
  .order-layout { grid-template-columns: minmax(0, 1fr); }
  .basket { position: static; }
}

/* Wide tables scroll sideways under the finger instead of breaking the page. */
.orders-table-wrap { -webkit-overflow-scrolling: touch; }

/* Grid columns may always shrink below their content; wide tables scroll inside .orders-table-wrap. */
.menu-layout > *, .settings-layout > *, .sessions-layout > *, .poster-layout > *, .order-layout > *, .acc-grid > * { min-width: 0; }
.session-now, .cashup { min-width: 0; }
