:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --primary: #005f73;
  --primary-press: #0a9396;
  --danger: #9b2226;
  --ok: #2a9d8f;
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
  /* Minimum interactive hit area (WCAG 2.5.5 / mobile touch target) */
  --tap-target: 44px;

  /* ── Brand tokens — overridden at runtime by brand-loader.js ── */
  --brand-logo-height: 96px;
  /* Raw brand colors */
  --brand-primary: #005d32;
  --brand-secondary: #004524;
  /* Back-compat alias (existing rules reference --brand-primary-dark) */
  --brand-primary-dark: #004524;
  /* Hover shades (computed by brand-loader; defaults match green palette) */
  --brand-primary-hover: #003d22;
  --brand-secondary-hover: #002d17;
  /* RGB triplets for rgba() usage */
  --brand-primary-rgb: 0, 93, 50;
  --brand-secondary-rgb: 0, 69, 36;
  /* Pale tints */
  --brand-primary-light: #e6f4ed;
  --brand-secondary-light: #e0f0e8;
  /* WCAG-AA text colors on brand backgrounds */
  --brand-text-on-primary: #ffffff;
  --brand-text-on-secondary: #ffffff;
  /* Accent (CTA / highlight) color — matches BrandSettings()'s bare default,
     where secondary_color is unset and accent falls back to primary_color */
  --brand-accent: #005d32;
  --brand-accent-hover: #009a53;
  --brand-text-on-accent: #ffffff;
  /* Optional brand font (injected by brand-loader if font_url allowlisted) */
  --brand-font-family: "Poppins", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--brand-font-family, "Poppins", "Segoe UI", sans-serif);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--text);
}

.app {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  margin-bottom: 16px;
}

.public-logo {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 20px;
}

.logo,
.logo-container {
  background-color: var(--brand-primary) !important;
}

.title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

#outlet-title {
  font-size: 30px;
  /* match Manager Console */
  font-weight: 700;
  /* bold */
  margin: 8px 0 6px 0;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Compact top bar (manager dashboard) ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  margin-bottom: 12px;
}

.topbar-logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* --brand-primary is always set by brand-loader (defaults to brand green);
     --border is a belt-and-suspenders neutral if the var is ever absent. */
  background: var(--brand-primary, var(--border));
  border-radius: 8px;
  padding: 6px 8px;
  flex-shrink: 0;
}

.topbar-logo {
  height: 32px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.topbar-outlet {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-manager {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}

.live-dot-ok {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.live-dot-warn {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.reconnect-banner {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* ── Stat chips (manager dashboard) ── */
.stat-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-chips .queue-stat-value {
  font-size: 2.1rem;
}

.grid {
  display: grid;
  gap: 12px;
}

.outlet-card,
.panel,
.token-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.15rem;
  margin: 0 0 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  color: var(--muted);
}

.metric-value {
  color: var(--text);
  font-weight: 700;
}

.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-press);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-tonal {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.btn-tonal:hover {
  background: var(--brand-secondary-light);
}

.btn-tonal:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline-danger {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: rgba(155, 34, 38, 0.08);
}

.tel-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.tel-link:hover {
  color: var(--primary-press);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  min-width: var(--tap-target);
  border: none;
  border-radius: 10px;
  background: #e2e8f0;
  color: var(--text);
  font-size: 1.1rem;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #cbd5e1;
}

.qc-call-icon {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.qc-call-icon:hover {
  background: var(--brand-secondary-light);
}

.queue-card {
  border-top: 4px solid var(--brand-primary);
}

.current-token-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}

.queue-card-item {
  background: #f8fafc;
}

.current-token-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.qc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.qc-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-elapsed {
  white-space: nowrap;
  flex-shrink: 0;
}

.qc-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.qc-contact .tel-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-more-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--brand-primary);
}

.view-more-btn:hover {
  background: var(--brand-primary-light);
}

.form {
  display: grid;
  gap: 10px;
}

.label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 1rem;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1e3a8a;
}

.status-ok {
  background: #d1fae5;
  color: #065f46;
}

.status-warn {
  background: #fee2e2;
  color: #991b1b;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row-between {
  justify-content: space-between;
}

.hidden {
  display: none !important;
}

#statePanel {
  margin-bottom: 20px;
}

#dashboardPanel {
  padding-bottom: 88px;
}

/* ── Sticky CALL NEXT bar (thumb zone) ── */
.sticky-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 -6px 18px rgba(2, 6, 23, 0.08);
  z-index: 150;
}

.sticky-action-bar .btn {
  max-width: 780px;
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Toasts ── */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.25);
  animation: toast-in 0.18s ease;
}

.toast-error {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Collapsed accordions (history / export) ── */
.history-accordion,
.export-accordion {
  padding: 0;
}

.history-summary,
.export-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  min-height: var(--tap-target);
  padding: 14px;
  font-size: 1.15rem;
  font-weight: 700;
}

.history-summary::-webkit-details-marker,
.export-summary::-webkit-details-marker {
  display: none;
}

.history-summary::marker,
.export-summary::marker {
  content: "";
}

.history-summary::after,
.export-summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform 0.15s ease;
}

details[open] > .history-summary::after,
details[open] > .export-summary::after {
  transform: rotate(180deg);
}

.history-accordion > .list {
  padding: 0 14px 14px;
}

.export-accordion .export-section {
  padding-left: 14px;
  padding-right: 14px;
  padding-bottom: 14px;
}

.export-summary {
  color: var(--text);
}

/* ── Empty-state list items ── */
.list-empty {
  text-align: center;
  color: var(--muted);
  padding: 18px 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (min-width: 768px) {
  .app {
    padding: 24px;
  }

  .title {
    font-size: 1.9rem;
  }

  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.85rem;
  width: auto;
  min-height: var(--tap-target);
}

.current-token-actions .btn {
  width: 100%;
}

.guest-badge {
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  font-weight: 600;
}

.waiting-item {
  position: relative;
  padding-top: 38px;
}

.token-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: var(--tap-target);
  height: var(--tap-target);
  min-width: var(--tap-target);
  border: none;
  border-radius: 50%;
  background: rgba(155, 34, 38, 0.08);
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.token-remove:hover {
  background: rgba(155, 34, 38, 0.16);
}

.token-remove:active {
  transform: scale(0.9);
  background: rgba(155, 34, 38, 0.24);
}

.waiting-item-primary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.waiting-token-number {
  font-size: 1.05rem;
}

.waiting-customer-name {
  font-weight: 600;
  color: var(--text);
}

.waiting-phone {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
}

.waiting-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.waiting-item-actions .btn {
  width: auto;
  min-width: 96px;
}

.token-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #666;
  margin-top: 6px;
}

.elapsed-time {
  font-weight: 600;
  color: #222;
}

.elapsed-warn {
  color: #b45309;
}

.elapsed-alert {
  color: #b91c1c;
}

/* ===== Primary Brand Button ===== */
#joinBtn,
#callNextBtn,
.call-btn,
.join-btn,
.call-next-btn,
.primary-btn {
  background-color: var(--brand-primary);
  border: none;
  color: var(--brand-text-on-primary, #ffffff);
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.05s ease;
}

/* Hover state — uses computed hover shade, not the secondary color */
#joinBtn:hover,
#callNextBtn:hover,
.call-btn:hover,
.join-btn:hover,
.call-next-btn:hover,
.primary-btn:hover {
  background-color: var(--brand-primary-hover);
}

/* Active press effect */
#joinBtn:active,
#callNextBtn:active,
.call-btn:active,
.join-btn:active,
.call-next-btn:active,
.primary-btn:active {
  transform: scale(0.98);
}

/* ===== Manager Login Button ===== */
.login-btn {
  background-color: var(--brand-primary);
  color: var(--brand-text-on-primary, #ffffff);
  border: none;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.05s ease;
}

.login-btn:hover {
  background-color: var(--brand-primary-hover);
}

.login-btn:active {
  transform: scale(0.98);
}

/* ===== Export / Download Section ===== */
.export-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.export-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.export-date-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.export-date-row label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.export-date-input {
  flex: 1;
  min-width: 130px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: #f8fafc;
}

.export-date-separator {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.download-container {
  position: relative;
  display: inline-block;
  margin-top: 10px;
  width: 100%;
}

.download-btn {
  background-color: var(--brand-primary);
  color: var(--brand-text-on-primary, #ffffff);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  width: 100%;
}

.download-btn:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-1px);
}

.download-btn:active {
  transform: scale(0.98);
}

.download-options {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 100;
}

.download-option {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: white;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s;
}

.download-option:hover {
  background-color: #f1f5f9;
}

.download-option + .download-option {
  border-top: 1px solid var(--border);
}

/* =====================================================================
   PUBLIC QUEUE PAGE — redesigned mobile-first brand surface
   ===================================================================== */

/* Remove default body background gradient for the public page so the
   brand header can bleed to the very top edge. */
.public-page {
  background: #f4f6f9;
}

/* ── Brand hero header ── */
.brand-header {
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  min-height: 96px;
}

.brand-header-logo {
  height: 64px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  display: block;
}

/* ── Page header below the hero ── */
.public-page-header {
  padding: 20px 0 4px;
  text-align: center;
}

.outlet-heading {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.2;
}

.outlet-subheading {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

/* ── Panel headings (public page only, scoped) ── */
.public-page .panel-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  letter-spacing: -0.1px;
}

/* ── Live queue state panel ── */
.queue-state-panel {
  border-top: 3px solid var(--brand-primary);
}

.queue-state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.queue-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-stat-wide {
  grid-column: 1 / -1;
}

.queue-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.queue-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--brand-primary);
  line-height: 1.1;
}

.queue-stat-wide .queue-stat-value {
  font-size: 1.1rem;
  color: var(--text);
}

.live-badge-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Join form ── */
.join-panel {
  border-top: 3px solid var(--brand-secondary);
}

.join-form {
  display: grid;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Enhanced input: brand secondary focus ring */
.join-form .input {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  background: #ffffff;
  -webkit-appearance: none;
}

.join-form .input:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(var(--brand-secondary-rgb), 0.18);
}

/* Primary brand action button */
.brand-btn {
  background: var(--brand-primary);
  color: var(--brand-text-on-primary, #ffffff);
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease;
}

.brand-btn:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 4px 14px rgba(var(--brand-primary-rgb), 0.3);
}

.brand-btn:active {
  transform: scale(0.98);
}

.brand-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.join-queue-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  margin-top: 4px;
}

/* ── Token panel ── */
.token-panel {
  text-align: center;
  border-top: 3px solid var(--brand-primary);
}

.token-display {
  margin: 8px 0 16px;
}

.token-number {
  display: block;
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--brand-primary);
}

/* ── Notice panel ── */
.message-text {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* ── Responsive tweaks ── */
@media (min-width: 480px) {
  .brand-header-logo { height: 72px; }
  .outlet-heading { font-size: 1.9rem; }
  .queue-state-grid { grid-template-columns: 1fr 1fr 1fr; }
  .queue-stat-wide { grid-column: auto; }
  .token-number { font-size: 5rem; }
}

/* ── Brand accent bar for manager/admin pages ── */
.brand-accent-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--brand-primary);
  z-index: 200;
}

/* Offset content below the accent bar */
.has-accent-bar {
  padding-top: 5px;
}

/* ── Admin brand banner ── */
.brand-banner {
  background: var(--brand-primary);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  width: 100%;
}

.brand-banner-logo {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: var(--brand-logo-height);
  object-fit: contain;
}

/* ── Recent history strip (manager dashboard) — navy/amber accent ── */
.history-panel {
  border-top: 4px solid #003888;
}

.history-title {
  color: #003888;
}

.history-item {
  padding: 8px 10px;
}

.history-token-number {
  color: #003888;
}

.history-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-called-time {
  font-weight: 700;
  color: #003888;
  background: rgba(248, 168, 0, 0.18);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Per-status badge colours; shape comes from .status-pill */
.history-status-called {
  background: #f8a800;
  color: #003888;
}

.history-status-served {
  background: #d1fae5;
  color: #065f46;
}

.history-status-noshow {
  background: #fee2e2;
  color: #991b1b;
}

.history-status-cancelled {
  background: #e2e8f0;
  color: #475569;
}

/* =====================================================================
   FEEDBACK (OCR) MODULE — manager dashboard
   Injected by feedback.js only for tenants with feedback_enabled, so none
   of this ever renders for a tenant without the flag.
   ===================================================================== */

.feedback-panel {
  border-top: 4px solid var(--brand-secondary);
  margin-bottom: 12px;
}

.feedback-title {
  margin-bottom: 10px;
}

/* Full-width thumb target; .brand-btn supplies the tenant's colours. */
.feedback-scan-btn {
  width: 100%;
  min-height: var(--tap-target);
  padding: 15px 16px;
  font-size: 1rem;
}

/* .btn-loading only makes text transparent, which colour-emoji glyphs ignore —
   hide the label outright so the spinner stands alone. */
.feedback-scan-btn.btn-loading .feedback-scan-label {
  visibility: hidden;
}

.feedback-note {
  margin: 10px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.feedback-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.88rem;
  font-weight: 600;
}

/* ── Collapsed list (same affordance as the history/export accordions) ── */
.feedback-list-wrap {
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.feedback-list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  min-height: var(--tap-target);
  padding: 12px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}

.feedback-list-summary::-webkit-details-marker {
  display: none;
}

.feedback-list-summary::marker {
  content: "";
}

.feedback-list-summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform 0.15s ease;
}

details[open] > .feedback-list-summary::after {
  transform: rotate(180deg);
}

/* ── Rows ── */
.feedback-item {
  padding: 0;
}

.feedback-row {
  display: block;
  width: 100%;
  min-height: var(--tap-target);
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.feedback-row:hover {
  background: var(--brand-primary-light);
}

.feedback-row:active {
  background: var(--brand-secondary-light);
}

.feedback-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.feedback-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.feedback-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Two pills plus a timestamp have to fit one line at ~380px. */
.feedback-badges .status-pill {
  padding: 4px 8px;
  font-size: 0.74rem;
  text-transform: capitalize;
}

.feedback-rating {
  background: #fef3c7;
  color: #92400e;
}

.feedback-sentiment-positive {
  background: #d1fae5;
  color: #065f46;
}

.feedback-sentiment-negative {
  background: #fee2e2;
  color: #991b1b;
}

.feedback-sentiment-neutral {
  background: #e2e8f0;
  color: #475569;
}

.feedback-sentiment-mixed {
  background: #ede9fe;
  color: #5b21b6;
}

.feedback-pill-empty {
  background: #f1f5f9;
  color: #94a3b8;
}

/* Long OCR text is clamped in the list; the full text is in the edit form. */
.feedback-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

/* ── Inline edit ── */
.feedback-item-editing {
  background: var(--surface);
  border-color: var(--brand-primary);
}

.feedback-edit-form {
  padding: 10px;
}

.feedback-textarea {
  min-height: 96px;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
}

.feedback-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Grid items default to min-width:auto, which lets a wide select push the
   panel past the viewport at ~380px. */
.feedback-edit-row > div {
  min-width: 0;
}

/* Font size stays at .input's 1rem so iOS doesn't zoom the page on focus. */
.feedback-select {
  min-height: var(--tap-target);
  padding: 11px 12px;
  font-family: inherit;
  background: #ffffff;
}

.feedback-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.feedback-edit-actions .btn {
  width: 100%;
  min-height: var(--tap-target);
}
