/* admin-dashboard.css
 * Vanilla CSS, no framework. Uses CSS variables for the colour scheme
 * so theming is one block away if we ever need it.
 */

/* ── Modal (driver stats, shift form, etc.) ─────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-dialog {
  background: var(--surface, #fff);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border, #e0e0e0);
}
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted, #666); padding: 0 6px;
}
.modal-body { padding: 20px; }

/* ── Driver stats grid ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.stats-card {
  background: var(--surface2, #f7f7f7);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stats-card-strong {
  background: var(--accent-light, #fdf3f3);
  border-color: var(--accent, #d92d20);
}
.stats-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted, #666);
}
.stats-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stats-unit  { font-size: 13px; font-weight: 500; color: var(--muted, #666); }
.stats-sub   { font-size: 12px; }

/* ── Schedule grid ──────────────────────────────────────────────────────── */
.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.schedule-table th, .schedule-table td {
  border: 1px solid var(--border, #e0e0e0);
  padding: 8px;
  vertical-align: top;
  font-size: 13px;
}
.schedule-table th {
  background: var(--surface2, #f7f7f7);
  text-align: left;
  font-weight: 600;
}
.schedule-driver { font-weight: 600; min-width: 120px; }
.schedule-cell   {
  min-height: 60px;
  position: relative;
  /* `display: flex` on <td> breaks table column layout in Safari/Chrome —
     keep the cell itself as table-cell and flex an inner wrapper. */
  vertical-align: top;
}
.schedule-cell-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 50px;
}
.schedule-table {
  table-layout: fixed;        /* equal-width day columns */
}
.schedule-table th + th,
.schedule-table td + td      { width: calc((100% - 120px) / 7); }
.shift-pill {
  background: var(--accent, #d92d20); color: #fff;
  border: none; border-radius: 6px; padding: 4px 8px;
  font-size: 12px; cursor: pointer; text-align: left;
}
.shift-pill:hover { filter: brightness(.9); }
.shift-add {
  background: transparent; border: 1px dashed var(--border, #ccc);
  color: var(--muted, #888); border-radius: 6px;
  padding: 2px; font-size: 14px; cursor: pointer;
  align-self: stretch;
}
.shift-add:hover { background: var(--surface2, #f0f0f0); }

:root {
  --bg:           #f7f7f5;
  --surface:      #ffffff;
  --border:       #e5e3df;
  --text:         #1d1d1b;
  --muted:        #6b6864;
  --accent:       #1f4d8b;
  --accent-soft:  #e6efff;
  --ok:           #0f7b3f;
  --warn:         #b16500;
  --danger:       #b3261e;
  --danger-soft:  #fde8e6;
  --shadow:       0 1px 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 18px; margin-bottom: 4px; }
h3 { font-size: 15px; }
p  { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---- Top nav --------------------------------------------------------- */

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav .brand p { margin-top: 2px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.ctrl {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
}
.ctrl--inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
}
.ctrl input[type="date"] {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

button {
  font: inherit;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
}
button:hover { background: var(--accent-soft); }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
button.primary:hover { filter: brightness(1.1); }
button.danger {
  border-color: var(--danger);
  color: var(--danger);
}
button.danger:hover { background: var(--danger-soft); }

.status {
  font-size: 13px;
  color: var(--muted);
  min-width: 120px;
}
.status .error { color: var(--danger); }

/* ---- Tabs ------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tabs button[role="tab"] {
  border: none;
  background: transparent;
  padding: 12px 18px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-weight: 500;
  color: var(--muted);
}
.tabs button[role="tab"]:hover { background: var(--accent-soft); color: var(--text); }
.tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* ---- Panels ---------------------------------------------------------- */

main { padding: 24px; }
section[role="tabpanel"] { max-width: 1200px; margin: 0 auto; }
section[role="tabpanel"][hidden] { display: none; }

.panel-content { margin-top: 16px; }

/* ---- Slots table ----------------------------------------------------- */

.slots-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.slots-table th, .slots-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.slots-table th {
  background: #fafaf8;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.slots-table tr:last-child td { border-bottom: none; }

.slots-table tr.warn td { background: #fff8eb; }
.slots-table tr.full td { background: var(--danger-soft); }

.bar {
  position: relative;
  height: 8px;
  background: #ece9e3;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--accent);
  width: 0%;
}
tr.warn .bar-fill { background: var(--warn); }
tr.full .bar-fill { background: var(--danger); }

.bar-row { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.bar { flex: 1; }
.bar-label { font-size: 12px; color: var(--muted); width: 50px; text-align: right; }

/* ---- Wave clustering badges ---------------------------------------- */

.slot-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.slot-badge.tight   { background: #e8f6ee; color: var(--ok); }
.slot-badge.spread  { background: #fff8eb; color: var(--warn); }
.slot-badge.locked  { background: #ece9e3; color: var(--text); }
.slot-badge.muted   { background: transparent; color: var(--muted); }

.slots-table tr.locked td { opacity: .6; }
.slots-table tr.locked .slot-cap-btn { pointer-events: none; opacity: .4; }

/* ---- Slot capacity +/- controls ------------------------------------ */

.slot-cap-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
}
.slot-cap-btn {
  width: 26px; height: 26px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.slot-cap-btn:hover { background: var(--accent-soft); }
.slot-cap-val {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

/* ---- Catalog (Media) filters --------------------------------------- */

.catalog-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.catalog-filters select {
  font: inherit;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  min-width: 160px;
}

/* ---- Order cards (Orders timeline) ----------------------------------- */

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.order-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}
.badge.cancelled  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.badge.completed,
.badge.delivered  { background: #e8f6ee; color: var(--ok); }

.order-meta { color: var(--muted); font-size: 13px; }
.brand-group { margin-top: 6px; }
.brand-group h4 { margin: 4px 0 2px; font-size: 14px; }
.brand-group ul { margin: 0; padding-left: 18px; }
.brand-group li { font-size: 13px; }
.note { color: var(--muted); font-size: 12px; }
.total { font-weight: 600; }

/* ---- Kitchen lanes --------------------------------------------------- */

.kitchen-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.lane {
  background: #efeee9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  min-height: 120px;
}
.lane h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.lane-empty { color: var(--muted); font-size: 13px; padding: 4px; }

.ticket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.ticket-head .order-id { font-weight: 600; }
.ticket-head .slot-time { color: var(--muted); font-size: 13px; }
.ticket-customer { color: var(--muted); font-size: 12px; margin-top: 4px; }
.ticket-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.ticket-actions button {
  flex: 1;
  padding: 4px 8px;
  font-size: 13px;
}

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
}

/* ---- Catalog tab ---- */

.catalog-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.catalog-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.catalog-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.catalog-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efeee9;
  color: var(--muted);
  font-size: 11px;
}
.catalog-info { flex: 1; min-width: 0; }
.catalog-name { font-weight: 500; }
.catalog-meta { font-size: 13px; margin-top: 2px; }
.catalog-video-link { color: var(--accent); text-decoration: none; }
.catalog-video-link:hover { text-decoration: underline; }
.catalog-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.catalog-actions button {
  font-size: 13px;
  padding: 5px 10px;
}

/* ---- Footer ---------------------------------------------------------- */

footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}

/* ---- Settings tab -------------------------------------------------- */

.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .settings-two-col { grid-template-columns: 1fr; } }

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.notif-grid { display: flex; flex-direction: column; gap: 10px; }
.notif-row  { display: flex; flex-direction: column; gap: 4px; }
.notif-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.notif-input {
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.notif-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- Orders archive ------------------------------------------------ */
.archive-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--surface);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 4px;
}

/* ---- Analytics ----------------------------------------------------- */
.anl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.anl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.anl-card-accent { border-color: var(--accent); background: var(--accent-soft); }
.anl-card-value  { font-size: 22px; font-weight: 700; }
.anl-card-label  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.anl-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 800px) { .anl-two-col { grid-template-columns: 1fr; } }

/* ---- Products CMS tab ---------------------------------------------- */

.prod-brand-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.prod-brand-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.prod-brand-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.prod-brand-section { margin-bottom: 28px; }
.prod-brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
}
.prod-brand-header h3 { flex: 1; }
.prod-add-cat, .prod-add-uncategorised {
  font-size: 12px;
  padding: 4px 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
}
.prod-add-cat:hover, .prod-add-uncategorised:hover {
  color: var(--text); border-color: var(--text);
}
.prod-add-uncategorised { margin-top: 8px; display: block; }

.prod-category { margin-bottom: 16px; }
.prod-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.prod-cat-name {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  flex: 1;
}
.prod-cat-add { font-size: 12px; padding: 3px 8px; }

.prod-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}
.prod-row.prod-unavailable { opacity: .55; }
.prod-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.prod-thumb-empty {
  width: 52px; height: 52px;
  background: #efeee9;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.prod-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.prod-row-name  { font-weight: 600; font-size: 14px; }
.prod-row-price { font-size: 13px; color: var(--accent); font-weight: 700; }
.prod-row-desc  { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-row-mods  { font-size: 11px; }
.prod-row-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.prod-row-actions button { font-size: 12px; padding: 4px 8px; }
.toggle-avail.primary { background: var(--ok); border-color: var(--ok); color: #111; }

/* Product edit form */
.prod-form-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.prod-form-header h3 { margin: 0; }
.prod-edit-form { max-width: 900px; }
.prod-edit-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
}
@media (max-width: 700px) { .prod-edit-grid { grid-template-columns: 1fr; } }
.prod-edit-main { display: flex; flex-direction: column; }
.prod-image-preview {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #efeee9;
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
}

/* Modifier editor */
.mod-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mod-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafaf8;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.mod-options { padding: 10px 14px; }
.mod-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}
.mod-option-row:last-child { border-bottom: none; }
.mod-option-row span:first-child { flex: 1; font-weight: 500; }

/* ---- Opening hours tab --------------------------------------------- */

.hours-editor { max-width: 700px; }
.hours-grid { display: flex; flex-direction: column; gap: 10px; }
.hours-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.hours-day-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.hours-day-name { user-select: none; }
.hours-ranges { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.hours-range-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hours-time-input {
  font: inherit;
  font-size: 14px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}
.hours-add-range { align-self: flex-end; font-size: 12px; padding: 4px 8px; }
.hours-remove-range {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 16px;
}
.hours-remove-range:hover { color: var(--danger); }

/* ---- SMS Marketing tab --------------------------------------------- */

.sms-dry-run-banner {
  background: #fff8eb;
  border: 1px solid var(--warn);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.sms-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.sms-stats { display: flex; gap: 24px; }
.sms-stat  { display: flex; flex-direction: column; font-size: 13px; }
.sms-stat strong { font-size: 22px; font-weight: 700; }

.sms-back-bar { margin-bottom: 12px; }
.sms-back-bar button { font-size: 13px; }

.sms-import-drop {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 100ms, background 100ms;
}
.sms-import-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sms-drop-inner { pointer-events: none; }

.sms-compose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .sms-compose-grid { grid-template-columns: 1fr; } }

.sms-compose-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.sms-compose-section h4 { font-size: 15px; margin-bottom: 12px; }

.crit-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.crit-label {
  min-width: 180px;
  color: var(--muted);
  font-weight: 500;
}
.crit-row input[type="text"],
.crit-row input[type="date"],
.crit-row select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.seg-preview {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
}
.seg-preview strong { font-size: 20px; }

.field-label-admin {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.field-label-admin input,
.field-label-admin textarea {
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  resize: vertical;
}
.field-label-admin input:focus,
.field-label-admin textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- Contact merge ------------------------------------------------- */

.sms-merge-pick-banner {
  background: #e6efff;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 600;
}

.dupe-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.dupe-group-label { font-size: 13px; margin-bottom: 8px; }
.dupe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.dupe-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 120px; }
.dupe-row button { font-size: 12px; padding: 4px 10px; }

/* ---- Routing tab --------------------------------------------------- */

.routing-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.route-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
}

.route-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.route-col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafaf8;
  border-bottom: 1px solid var(--border);
}
.route-col-head strong { flex: 1; }

.route-map-wrap {
  height: 240px;
  border-bottom: 1px solid var(--border);
}

.route-stops {
  list-style: none;
  margin: 0;
  padding: 0;
}
.route-stop {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.route-stop:last-child { border-bottom: none; }
.route-stop.en-route { background: rgba(15,123,63,.05); }

.route-stop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.route-stop-num {
  width: 22px; height: 22px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.route-stop-name { font-weight: 600; font-size: 14px; flex: 1; }
.route-stop-addr { font-size: 12px; margin-bottom: 6px; }
.route-stop-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.route-stop-actions select,
.reassign-select {
  font: inherit;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  flex: 1;
}
.route-stop-actions button { font-size: 12px; padding: 4px 8px; }

.route-unassigned {
  margin-top: 16px;
  padding: 14px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 6px;
}
.route-unassigned h3 {
  font-size: 14px; margin-bottom: 10px; color: var(--danger);
}

/* ---- Driver live card (kitchen tab) -------------------------------- */

.driver-live-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.driver-live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafaf8;
}
.driver-live-title { font-weight: 700; font-size: 14px; }

.btn-map-toggle {
  font-size: 13px;
  padding: 4px 12px;
}
.driver-rows {
  display: flex;
  flex-wrap: wrap;
}
.driver-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-right: 1px solid var(--border);
  min-width: 160px;
}
.driver-row-name { font-weight: 600; font-size: 14px; flex-shrink: 0; }
.driver-eta {
  font-size: 13px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(177,101,0,.1); color: var(--warn);
}
.driver-eta.here { background: rgba(15,123,63,.12); color: var(--ok); }
.driver-eta.off  { background: transparent; color: var(--muted); font-weight: 400; }

.kitchen-map-wrap {
  height: 320px;
  border-top: 1px solid var(--border);
}

/* ---- A11y ---------------------------------------------------------- */

:focus { outline: none; }              /* default off */
:focus-visible {                       /* but always visible on keyboard */
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* ---- Login page ---------------------------------------------------- */

.login-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 32px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { font-size: 14px; }
.login-card form { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.login-card label { font-size: 13px; color: var(--muted); font-weight: 500; }
.login-card input[type="password"] {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  width: 100%;
}
.login-card input[type="password"]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card button.primary {
  margin-top: 8px;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  padding: 10px 14px;
  font-weight: 600;
}
.login-card .error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-top: 4px;
}
.login-card .small { font-size: 12px; margin-top: 18px; }

/* ---- Manual order form -------------------------------------------- */
.manual-form { max-width: 800px; }
.manual-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.manual-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  font-size: 13px;
}
.manual-field-grow { flex: 1 1 280px; }
.manual-field span { font-weight: 600; color: var(--muted); }
.manual-field input,
.manual-field select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.manual-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
  background: var(--surface);
}
.manual-group legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.manual-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.manual-item input,
.manual-item select {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.manual-item input[type="text"] { flex: 1 1 200px; min-width: 180px; }
.manual-item select            { flex: 0 0 140px; }
.manual-add-item {
  margin-top: 6px;
  background: transparent;
  border: 1px dashed var(--border);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
}
.manual-add-item:hover { color: var(--text); border-color: var(--text); }
.manual-remove {
  width: 28px; height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
}
.manual-remove:hover { color: var(--danger); border-color: var(--danger); }
.manual-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.manual-actions button.primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.manual-actions button.primary:hover { filter: brightness(1.06); }
.manual-error {
  color: var(--danger);
  background: var(--danger-soft);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0 0;
}
.manual-ok {
  color: #0f7b3f;
  background: #d6f5e2;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0 0;
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Weekly P&L panel
   --------------------------------------------------------------------------- */
.pnl-week-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.pnl-week-bar .pnl-week-label { font-size: 14px; }
.pnl-week-bar .pnl-week-label strong { font-size: 15px; }
.pnl-week-nav {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.pnl-week-nav:hover { background: var(--accent-soft); border-color: var(--accent); }

.pnl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}
.pnl-grid .pnl-summary {
  grid-column: 1 / -1;
}
@media (max-width: 920px) {
  .pnl-grid { grid-template-columns: 1fr; }
}

.pnl-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.pnl-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.pnl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--border);
  font-size: 14px;
}
.pnl-row:last-child { border-bottom: none; }
.pnl-row-label { color: var(--text); }
.pnl-row-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pnl-row-auto .pnl-row-value { color: var(--accent); }
.pnl-row-sub  .pnl-row-label { padding-left: 8px; color: var(--muted); font-size: 13px; }
.pnl-row-sub  .pnl-row-value { font-weight: 500; }

.pnl-row-input {
  align-items: center;
}
.pnl-input-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
}
.pnl-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pnl-input-prefix {
  color: var(--muted);
  margin-right: 4px;
  font-weight: 600;
}
.pnl-input {
  width: 110px;
  border: none;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  padding: 2px 0;
}
.pnl-input::-webkit-inner-spin-button,
.pnl-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

.pnl-row-total .pnl-row-value,
.pnl-row-emphasis .pnl-row-value {
  font-size: 16px;
  font-weight: 700;
}
.pnl-row-total {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.pnl-row-negative .pnl-row-value { color: var(--danger); }

.pnl-pcts {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.pnl-actions {
  display: flex;
  align-items: center;
  margin-top: 18px;
}
.pnl-actions button.primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.pnl-actions button.primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}
.pnl-actions button.primary:not(:disabled):hover { filter: brightness(1.06); }

/* ---------------------------------------------------------------------------
   Recipe builder + Ingredients panel
   --------------------------------------------------------------------------- */
.recipe-panel {
  border-top: 1px dashed var(--border);
  padding-top: 18px;
}
.recipe-panel h4 {
  font-size: 14px;
  letter-spacing: 0.02em;
}
.ing-low-stock { color: var(--danger); font-weight: 600; }

/* Discount scoping multi-select */
.disc-scope-list {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.disc-scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
}
.disc-scope-row input[type="checkbox"] { margin: 0; }
.disc-scope-row:hover { background: var(--accent-soft); border-radius: 4px; padding-left: 4px; padding-right: 4px; }

/* ---------------------------------------------------------------------------
   Sunday Truth — optimisation signals dashboard
   --------------------------------------------------------------------------- */
.st-bar {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.st-week { font-size: 14px; }
.st-counts { display: flex; gap: 6px; }
.st-pill {
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
}
.st-alert { background: #fee2e2; color: #991b1b; }
.st-warn  { background: #fef3c7; color: #92400e; }
.st-info  { background: #dbeafe; color: #1e40af; }

.st-stack { display: flex; flex-direction: column; gap: 10px; }

.st-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; cursor: pointer;
}
.st-card-alert { border-left: 4px solid #ef4444; }
.st-card-warn  { border-left: 4px solid #f59e0b; }
.st-card-info  { border-left: 4px solid #3b82f6; }

.st-card summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.st-card summary::-webkit-details-marker { display: none; }
.st-card .st-icon { font-size: 16px; }
.st-card-alert .st-icon { color: #ef4444; }
.st-card-warn  .st-icon { color: #f59e0b; }
.st-card-info  .st-icon { color: #3b82f6; }
.st-card .st-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.st-card .st-msg { font-size: 14px; flex: 1; }
.st-details { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

.st-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; margin: 0; }
.st-kv dt { color: var(--muted); }
.st-kv dd { margin: 0; }
.st-loss { color: var(--danger); }
.st-loss td { font-weight: 600; }

/* ---------------------------------------------------------------------------
   Reports tab
   --------------------------------------------------------------------------- */
.reports-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 920px) { .reports-grid { grid-template-columns: 1fr; } }
.report-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px;
}
.report-section h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: 0.02em; }

/* ---------------------------------------------------------------------------
   Rota tab
   --------------------------------------------------------------------------- */
.rota-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.rota-summary-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; min-width: 160px;
}
.rota-summary-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rota-summary-label { font-size: 12px; color: var(--muted); }
.rota-brand-list { font-size: 13px; padding-left: 18px; margin: 8px 0 0; }
.rota-cell {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 4px 8px; margin: 2px 4px 2px 0;
  background: var(--accent-soft); border-radius: 6px; font-size: 11px;
  min-width: 40px;
}
.rota-unconfirmed { background: var(--bg); border: 1px dashed var(--border); opacity: 0.7; }
.rota-clock { font-size: 10px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Bookings tab (floor plan)
   --------------------------------------------------------------------------- */
.bk-floor-canvas {
  position: relative; width: 100%; aspect-ratio: 2 / 1;
  background: linear-gradient(45deg, #f6f4ef 25%, transparent 25%) 0 0/30px 30px,
              linear-gradient(-45deg, #f6f4ef 25%, transparent 25%) 0 0/30px 30px,
              var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.bk-table {
  position: absolute;
  width: 70px; height: 70px;
  transform: translate(-50%, -50%);
  background: var(--surface); border: 2px solid var(--accent);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.bk-table-label { font-weight: 700; }
.bk-table-cap { color: var(--muted); font-size: 11px; }
.bk-status-seated td { background: var(--accent-soft); }
.bk-status-finished td { opacity: 0.55; }
.bk-status-cancelled td { opacity: 0.45; text-decoration: line-through; }
