:root {
  /* Brand colours. These are the "Next Up" defaults; _brand_head.html overrides
     them with the shop's own (Admin > Branding, see app/branding.py). */
  --brand-dark: #1f2933;
  --brand-dark-light: #353e47;
  --brand-dark-deep: #141b21;
  --brand-dark-rgb: 31, 41, 51;
  --brand-accent: #0d9488;
  --brand-accent-dark: #0b7e74;
  --brand-accent-deep: #09685f;
  --brand-accent-rgb: 13, 148, 136;

  /* Fixed colours, the same for every shop. Warnings and errors stay red
     whatever the brand colours are. */
  --color-bg: #f6f7f7;
  --color-muted: #5b5a56;
  --color-border: #c2c3c1;
  --color-danger: #c8181f;
  --color-danger-bright: #ea1f27;
  --color-danger-soft: #fde5e6;

  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Inter Tight", "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* List items animating in/out (see .anim-enter/.anim-exit) briefly translate
     past their own bounds - this is a fixed-layout app that never needs to
     scroll horizontally, so clip it rather than let that flash a scrollbar. */
  overflow-x: hidden;
}

body {
  background: var(--color-bg);
  color: var(--brand-dark);
  font-family: var(--font-body);
}

h1,
h2,
h3,
.display-font {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

a {
  color: var(--brand-accent);
}

.site-header {
  background: var(--brand-dark);
  color: var(--color-bg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-header img {
  height: 32px;
  max-width: 40vw;
  object-fit: contain;
  display: block;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Pages with wide tables (admin) */
.container-wide {
  max-width: 1200px;
}

.nowrap {
  white-space: nowrap;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(var(--brand-dark-rgb), 0.06);
  transition: box-shadow 0.2s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--brand-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.9rem 1.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(var(--brand-dark-rgb), 0.15);
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover {
  background: var(--brand-accent-dark);
  box-shadow: 0 4px 12px rgba(var(--brand-dark-rgb), 0.18);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 2px rgba(var(--brand-dark-rgb), 0.15);
}

.btn-secondary {
  background: var(--brand-dark);
}

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

.btn-danger {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.btn-danger:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: var(--color-danger-bright);
  box-shadow: none;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.is-loading {
  cursor: wait;
  animation: btnPulse 1s ease-in-out infinite;
}

@keyframes btnPulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 0.45;
  }
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
select {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--brand-dark);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-muted);
}

.field {
  margin-bottom: 1.25rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.flash-error {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.flash-success {
  background: #e4f3e6;
  color: #256a2e;
}

/* The public demo (app/demo_mode.py): a bar above the header, and a small label
   in the top corner on the kiosk and TV (.demo-banner-screen). */
.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  padding: 0.55rem 1rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
  background: var(--brand-accent-deep);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}

.demo-banner strong {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.demo-banner-screen {
  /* Top right is clear on both: the kiosk's logo is centred, the TV's title is on the left. */
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  padding-top: 0.45rem;
  z-index: 40;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(var(--brand-dark-rgb), 0.25);
  pointer-events: none;
}

/* The demo's login page: intro, login and shop screens. Side by side on a wide
   screen with the login on the right; stacked on a phone, login second. */
.container-demo {
  max-width: 1040px;
}

.demo-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "intro" "login" "screens";
  gap: 1.5rem;
  margin-top: 1rem;
}

.demo-layout .card {
  margin-bottom: 0;
}

.demo-intro { grid-area: intro; }
.demo-login { grid-area: login; }
.demo-screens-card { grid-area: screens; }

@media (min-width: 820px) {
  .demo-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas: "intro login" "screens login";
    /* Any extra height from the taller login card goes below the screens. */
    grid-template-rows: auto 1fr;
    align-items: start;
  }

  .demo-login {
    position: sticky;
    top: 1.5rem;
  }
}

.demo-intro h1 {
  margin-top: 0;
}

.demo-login h2,
.demo-screens-card h2 {
  margin: 0 0 0.75rem;
}

.demo-logins {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.demo-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.demo-divider::before,
.demo-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--color-border);
}

.demo-login-hint {
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.demo-logins .btn {
  width: 100%;
}

.demo-note {
  color: var(--color-muted);
}

.demo-screens {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.demo-screens li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--color-border);
}

.demo-screens strong {
  flex: 1 1 100%;
}

.top-bar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-text {
  color: #fff;
  font-size: 1.1rem;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.nav-user {
  color: var(--color-border);
}

.top-bar a,
.nav-button {
  color: var(--color-bg);
  text-decoration: none;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-links a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--brand-accent);
}

/* Log out is a POST (CSRF-protected), so it's a button styled as a nav link. */
.nav-form {
  display: inline;
  margin: 0;
}

.nav-button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: inherit;
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }

  .nav-links {
    font-size: 0.85rem;
    gap: 0.4rem 0.7rem;
  }

  .nav-user {
    width: 100%;
  }

  /* Taller tap targets on phones without changing how the links look. */
  .nav-links a,
  .nav-button {
    padding: 0.4rem 0;
  }
}

/* --- Staff dashboard rows --- */

.staff-section h2 {
  border-bottom: 3px solid var(--brand-accent);
  padding-bottom: 0.5rem;
}

.staff-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--color-border);
}

.staff-row:last-child {
  border-bottom: none;
}

.staff-row .meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.staff-row form {
  margin: 0;
}

.staff-row .queue-number {
  font-family: var(--font-display);
  color: var(--brand-accent);
}

/* A waiting customer who asked for the barber viewing the page. */
.staff-row.is-mine {
  background: var(--color-bg);
  box-shadow: inset 4px 0 0 var(--brand-accent);
  padding-left: 0.9rem;
  padding-right: 0.5rem;
  border-radius: 6px;
}

.staff-row.is-mine .meta {
  color: var(--brand-accent-dark);
  font-weight: 600;
}

.break-card {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.break-card.is-on-break {
  border-left: 6px solid var(--brand-accent);
}

.store-card {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.store-card.is-closed {
  border-left: 6px solid var(--color-danger-bright);
}

.announcement-card {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.announcement-card label {
  color: var(--brand-dark);
}

.announcement-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.announcement-fields input {
  flex: 1 1 14rem;
  width: auto;
}

.announcement-fields [hidden] {
  display: none;
}

.kiosk-offline-note {
  margin-top: 0.35rem;
  color: var(--color-danger);
  font-weight: 600;
}

.staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.staff-actions form {
  flex: 1;
}

.staff-actions .btn {
  width: 100%;
  white-space: nowrap;
}

@media (min-width: 480px) {
  .staff-actions {
    width: auto;
  }

  .staff-actions .btn {
    width: auto;
  }
}

/* --- Confirm dialog (replaces browser confirm()) --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--brand-dark-rgb), 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(var(--brand-dark-rgb), 0.35);
  transform: scale(0.92) translateY(8px);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

.modal-message {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  color: var(--brand-dark);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

.modal-actions .btn {
  flex: 1;
}

/* --- Animated (keyed) list items: used for live queue updates --- */

.anim-enter {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

.anim-enter-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.anim-exit {
  opacity: 0;
  transform: translateX(16px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* --- Page entrance --- */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container,
.kiosk-screen,
.display-screen {
  animation: fadeIn 0.35s ease both;
}

/* --- Admin tables --- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.admin-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.admin-table .cell-action {
  margin-top: 0.4rem;
}

.admin-table th.cell-center,
.admin-table td.cell-center {
  text-align: center;
}

.admin-table tbody tr {
  transition: background-color 0.1s ease;
}

.admin-table tbody tr:hover {
  background: var(--color-bg);
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-table .btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  min-height: 36px;
}

/* On/off switch (a form submit button with role="switch", no JS needed) */
.switch {
  background: none;
  border: 0;
  padding: 0.25rem;
  cursor: pointer;
  line-height: 0;
}

.switch-track {
  display: inline-block;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--color-border);
  transition: background-color 0.15s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(var(--brand-dark-rgb), 0.3);
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] .switch-track {
  background: var(--brand-accent);
}

.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(20px);
}

.switch:focus-visible .switch-track {
  outline: 2px solid var(--brand-dark);
  outline-offset: 2px;
}

/* --- Metrics page --- */

.metrics-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

/* --- Activity tab filters --- */

.activity-filters {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.activity-filters .field {
  margin-bottom: 0;
  flex: 1 1 160px;
  min-width: 140px;
}

.activity-filters .field label {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.activity-filters .field-date {
  flex: 0 1 150px;
  min-width: 130px;
}

.activity-filters .field-date input {
  padding: 0.75rem 0.5rem;
}

.activity-filters-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.5rem;
}

.activity-filters-actions .btn {
  min-height: 48px;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
}

.metrics-filter select {
  width: auto;
}

.metrics-export {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Secondary actions: sized to sit level with the Period select, not as hero buttons. */
.metrics-export .btn {
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
}

.print-only {
  display: none;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-tile {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(var(--brand-dark-rgb), 0.06);
}

.stat-tile .stat-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  margin: 0 0 0.4rem;
}

.stat-tile .stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--brand-dark);
  line-height: 1;
}

.stat-tile .stat-value .stat-unit {
  font-size: 1rem;
  color: var(--color-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 0.25rem;
}

.chart-card h2 {
  margin-top: 0;
}

.chart-card canvas {
  max-height: 320px;
}

.chart-box {
  position: relative;
}

.chart-box canvas {
  max-height: none;
}

.chart-empty {
  color: var(--color-muted);
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.chart-card-header h2 {
  margin: 0;
}

.chart-card-header .field {
  margin: 0;
}

.chart-card-header select {
  width: auto;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
}

.chart-subtitle,
.metrics-note {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.chart-subtitle {
  margin: 0.5rem 0 1rem;
}

.metrics-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Busiest-times heatmap: one hue (brand red), light -> dark = quiet -> busy. */
.heat-0 { background: #efefed; }
.heat-1 { background: rgba(var(--brand-accent-rgb), 0.14); }
.heat-2 { background: rgba(var(--brand-accent-rgb), 0.38); }
.heat-3 { background: rgba(var(--brand-accent-rgb), 0.68); }
.heat-4 { background: var(--brand-accent); }
.heat-5 { background: var(--brand-accent-deep); }

.heatmap-scroll {
  overflow-x: auto;
}

.heatmap {
  border-collapse: separate;
  border-spacing: 2px;
  min-width: 100%;
}

.heatmap th {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.heatmap thead th {
  padding: 0 0 0.25rem;
  text-align: center;
}

.heatmap tbody th {
  text-align: left;
  padding-right: 0.5rem;
}

.heatmap td {
  height: 32px;
  min-width: 32px;
  border-radius: 4px;
  cursor: default;
}

.heatmap td:hover,
.heatmap td:focus-visible {
  outline: 2px solid var(--brand-dark);
  outline-offset: 1px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.heat-swatch {
  width: 18px;
  height: 12px;
  border-radius: 3px;
}

.heatmap-legend .metrics-note {
  margin-left: auto;
  font-size: 0.8rem;
}

.heatmap-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--brand-dark);
  color: #fff;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
  max-width: 240px;
}

.heatmap-tooltip strong {
  font-family: var(--font-display);
  font-weight: 500;
  display: block;
}

/* --- Device links (kiosk / display secret URLs) --- */

.device-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 260px;
}

.device-link a {
  text-decoration: none;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
}

.device-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
}

.device-status-online {
  color: #256a2e;
}

.device-status-online::before {
  background: #2e9e4f;
}

.device-status-offline {
  color: var(--color-danger);
}

.device-status-offline::before {
  background: var(--color-danger-bright);
}

.device-status-unknown::before {
  background: transparent;
  border: 2px solid var(--color-border);
  box-sizing: border-box;
}

.device-status-note {
  margin: 0;
  font-size: 0.8rem;
}

.device-link code {
  font-size: 0.78rem;
  background: var(--color-bg);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  word-break: break-all;
  color: var(--brand-dark);
  display: block;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.device-link a:hover code,
.device-link a:focus-visible code {
  background: #fff;
  box-shadow: 0 0 0 2px var(--brand-accent);
}

/* --- Tabs (admin page) --- */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--brand-dark);
}

.tab-btn.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
}

.tab-panel {
  animation: fadeIn 0.25s ease both;
}

/* --- Printing (metrics "Print / Save as PDF") --- */

@media print {
  /* The screen layout makes body a viewport-height scroll box (see html, body
     above), which Chrome prints as a single clipped page. Let it flow. */
  html,
  body {
    height: auto;
    overflow: visible;
  }

  .site-header,
  .demo-banner,
  .top-bar .btn,
  .metrics-filter,
  .heatmap-picker,
  .flash {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  /* Print every location's heatmap, not just the one picked on screen. */
  .heatmap-view[hidden] {
    display: block !important;
    margin-top: 1rem;
  }

  body {
    background: #fff;
  }

  .container {
    max-width: none;
    padding: 0;
    animation: none;
  }

  .card,
  .stat-tile {
    box-shadow: none;
    break-inside: avoid;
  }

  .heatmap td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* The busiest-times card holds one heatmap per location and is usually taller
     than a page: let it break between heatmaps, but never through one. */
  .card.heatmap-card {
    break-inside: auto;
    /* Start on a fresh page so its heading isn't stranded above a page break. */
    break-before: page;
  }

  .heatmap-view {
    break-inside: avoid;
  }

  /* Shrink heatmaps to the page width instead of the on-screen sideways scroll. */
  .heatmap-scroll {
    overflow: visible;
  }

  .heatmap {
    width: 100%;
    table-layout: fixed;
    border-spacing: 1px;
  }

  .heatmap thead th:first-child {
    width: 2.25rem;
  }

  .heatmap thead th {
    font-size: 0.55rem;
  }

  .heatmap td {
    min-width: 0;
    height: 18px;
    border-radius: 2px;
  }

  .heatmap-swatch,
  .heat-swatch {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Admin > Branding */
.colour-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 1.5rem;
}

.colour-fields input[type="color"] {
  width: 88px;
  height: 48px;
  padding: 4px;
  cursor: pointer;
}

.brand-preview {
  --preview-dark: var(--brand-dark);
  --preview-accent: var(--brand-accent);
  margin: 0.5rem 0 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  max-width: 420px;
}

.brand-preview-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--preview-dark);
  color: #fff;
}

.brand-preview-header img {
  height: 26px;
  max-width: 50%;
  object-fit: contain;
}

.brand-preview-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: #fff;
  color: var(--preview-dark);
}

.brand-preview-number {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--preview-accent);
}

.brand-preview-button {
  margin-left: auto;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  background: var(--preview-accent);
  color: #fff;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.brand-image-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
  padding: 1.25rem;
  border-radius: 10px;
  background: var(--brand-dark);
}

.brand-image-preview img {
  max-height: 96px;
  max-width: 100%;
  object-fit: contain;
}

.brand-icon-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.brand-icon-preview img {
  border-radius: 18%;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.upload-form input[type="file"] {
  width: auto;
  max-width: 100%;
}

/* Admin > Getting Started checklist (new installs) */
.setup-card {
  border-left: 6px solid var(--brand-accent);
}

.setup-steps {
  margin: 1rem 0 0;
  padding-left: 1.5rem;
  display: grid;
  gap: 0.5rem;
}

.setup-steps li.is-done a {
  color: var(--color-muted);
  text-decoration: line-through;
}

.setup-steps li.is-done::marker {
  content: "\2713  ";
  color: var(--brand-accent);
}

.setup-step-status {
  display: block;
  font-size: 0.85rem;
}

.setup-step-status:empty {
  display: none;
}

.setup-all-done {
  margin: 1rem 0 0;
  font-weight: 600;
  color: var(--brand-accent-dark);
}

/* Login and setup pages: why a login won't stick (cookie-check.js). */
.cookie-warning {
  text-align: left;
  line-height: 1.45;
}

.cookie-warning p {
  margin: 0.5rem 0 0;
  font-weight: 400;
}

.cookie-warning code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}
