/* ============================================================
   ERECEIPT & NEWSLETTER PWA - STYLES
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  /* Pavers brand - pavers.co.uk (deep purple + gold) */
  --color-brand-dark:    #2d2860;
  --color-brand:         #413b7a;
  --color-brand-light:   #5c559e;
  --color-accent:        #e0b800;
  --color-accent-dark:   #c09900;

  /* Neutrals */
  --color-bg:            #f7f7f7;
  --color-surface:       #ffffff;
  --color-surface-alt:   #f0eee8;
  --color-border:        #e0dbd4;
  --color-border-strong: #c5bfb7;

  /* Text */
  --color-text:          #1a1a1a;
  --color-text-secondary:#5c5650;
  --color-text-muted:    #9a9189;
  --color-text-inverse:  #ffffff;

  /* Semantic */
  --color-success:       #2e7d50;
  --color-success-bg:    #e8f5ee;
  --color-warning:       #b45309;
  --color-warning-bg:    #fef3c7;
  --color-error:         #c0392b;
  --color-error-bg:      #fdecea;

  /* Typography */
  --font-brand: 'Playfair Display', Georgia, serif;
  --font-ui:    'Inter', system-ui, -apple-system, sans-serif;

  /* Sizing */
  --header-height: 64px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-full:   9999px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);

  --touch-target: 48px;
  --transition:   160ms ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the HTML hidden attribute always wins over display rules */
[hidden] { display: none !important; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-ui);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── App Shell ──────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, var(--color-brand-dark) 0%, var(--color-brand) 100%);
  height: var(--header-height);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  gap: 16px;
}

.header-logo {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-svg { height: 34px; width: auto; }

.logo-tagline {
  font-family: var(--font-brand);
  font-size: 10px;
  font-style: italic;
  color: var(--color-accent);
  letter-spacing: 1.5px;
  line-height: 1;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
}

.till-badge {
  background: rgba(255,255,255,.15);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
}

.header-time {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
  min-width: 54px;
  text-align: right;
}

.connection-status { display: flex; align-items: center; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-online  { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.status-offline { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,.25); }

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,.9);
  transition: background var(--transition);
  flex-shrink: 0;
}
.header-icon-btn:hover { background: rgba(255,255,255,.28); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ── View Container ─────────────────────────────────────── */
.view-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  animation: fadeIn .18s ease;
}

.view.active { display: flex; flex-direction: column; }

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

/* ── Flow Centre ────────────────────────────────────────── */
.flow-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Ready Screen ───────────────────────────────────────── */
.ready-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 400px;
  width: 100%;
}

.ready-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.ready-icon svg { width: 40px; height: 40px; stroke: #fff; }

.ready-title {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.ready-sub {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

/* ── Flow Card ──────────────────────────────────────────── */
.flow-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flow-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}
.btn-back:hover { background: var(--color-border); }

.flow-title {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.flow-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.flow-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.flow-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  gap: 12px;
}

/* ── Form Fields ────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.field-optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 12px;
}

.field-hint {
  font-size: 12px;
  color: var(--color-error);
  min-height: 16px;
}

/* ── Inputs ─────────────────────────────────────────────── */
.input-group { position: relative; }

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--color-text-muted);
  pointer-events: none;
}

.input {
  width: 100%;
  height: var(--touch-target);
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(65,59,122,.1);
}

.input.error { border-color: var(--color-error); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
.input::placeholder { color: var(--color-text-muted); }
.input-lg { height: 58px; font-size: 17px; }

/* ── Email Suffix Pills ─────────────────────────────────── */
.email-suffix-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suffix-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-brand-dark);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}
.suffix-btn:hover  { background: var(--color-brand-dark); border-color: var(--color-brand-dark); color: #fff; }
.suffix-btn:active { transform: scale(.95); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: var(--touch-target);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--color-brand-dark); color: #fff; }
.btn-primary:hover { background: var(--color-brand); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-alt); }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #246040; box-shadow: var(--shadow-md); }

.btn-error { background: var(--color-error); color: #fff; }
.btn-error:hover { background: #a93226; box-shadow: var(--shadow-md); }

.btn-xl   { height: 60px; font-size: 17px; padding: 0 32px; border-radius: var(--radius-lg); }
.btn-lg   { height: 56px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-sm   { height: 36px; padding: 0 14px; font-size: 13px; }

/* ── Preference Items ───────────────────────────────────── */
.pref-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pref-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--color-surface-alt);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.pref-item:hover { border-color: var(--color-brand-light); }
.pref-item:has(input:checked) {
  border-color: var(--color-brand);
  background: rgba(65,59,122,.05);
}

.pref-check { position: relative; width: 22px; height: 22px; flex-shrink: 0; }
.pref-check input { position: absolute; opacity: 0; width: 0; height: 0; }

.pref-checkmark {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border-strong);
  border-radius: 6px;
  background: var(--color-surface);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.pref-check input:checked + .pref-checkmark {
  background: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
}
.pref-check input:checked + .pref-checkmark::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.pref-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pref-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.pref-desc  { font-size: 13px; color: var(--color-text-muted); }

.pref-icon { width: 24px; height: 24px; stroke: var(--color-text-muted); flex-shrink: 0; }

.pref-note { font-size: 13px; color: var(--color-error); text-align: center; min-height: 18px; }

/* ── Reports ────────────────────────────────────────────── */
.reports-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--color-border); /* closes the grid visually */
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 28px 16px 22px;
  text-align: center;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
/* Remove right border on last column */
.stat-card:nth-child(3n) { border-right: none; }
/* Last-row border-bottom is removed via JS in reports._render() so it works
   for any card count. CSS rule here is a fallback for 9-card multiples-of-3. */
.stat-card:nth-last-child(-n+3) { border-bottom: none; }

.stat-card-accent {
  background: linear-gradient(135deg, var(--color-brand-dark), var(--color-brand));
}

.stat-icon {
  opacity: .5;
  margin-bottom: 4px;
}
.stat-card-accent .stat-icon { stroke: #fff; opacity: .7; }

.stat-value {
  font-family: var(--font-brand);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-brand-dark);
}
.stat-card-accent .stat-value { color: #fff; }

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}
.stat-card-accent .stat-label { color: rgba(255,255,255,.8); }

.stat-detail {
  font-size: 11px;
  color: var(--color-text-muted);
}
.stat-card-accent .stat-detail { color: rgba(255,255,255,.55); }

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(3n)       { border-right: 1px solid var(--color-border); }
  .stat-card:nth-child(2n)       { border-right: none; }
  /* Last-row bottom border handled by JS; restore border for any CSS-removed cells */
  .stat-card:nth-last-child(-n+3){ border-bottom: 1px solid var(--color-border); }
}

/* ── Active Transaction ─────────────────────────────────── */
.active-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 480px;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
}

.active-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-success);
}

.active-pulse {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,125,80,.4); }
  50%       { box-shadow: 0 0 0 7px rgba(46,125,80,0); }
}

.tx-id-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

.tx-id-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-text-muted);
}

.tx-id {
  font-family: monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-brand-dark);
  letter-spacing: 1px;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.btn-copy:hover { color: var(--color-brand); }

.active-summary {
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.active-summary span { display: flex; justify-content: space-between; }
.active-summary strong { color: var(--color-text); }

.active-hint {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.timeout-bar-wrap { width: 100%; display: flex; flex-direction: column; gap: 6px; }

.timeout-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}

.timeout-bar-inner {
  height: 100%;
  width: 100%;
  background: var(--color-warning);
  border-radius: 99px;
  transition: width 1s linear, background .5s;
}
.timeout-bar-inner.critical { background: var(--color-error); }

.timeout-label { font-size: 12px; color: var(--color-text-muted); text-align: right; }

.active-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ── Customer Search Results ────────────────────────────── */
.customer-results {
  border: 1.5px solid var(--color-brand-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.customer-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.btn-text {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-brand);
  padding: 0;
  transition: color var(--transition);
}
.btn-text:hover { color: var(--color-brand-dark); }

.customer-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}
.customer-result-item:last-child { border-bottom: none; }
.customer-result-item:hover { background: var(--color-surface-alt); }
.customer-result-item.selected {
  background: rgba(65,59,122,.06);
  border-left: 3px solid var(--color-brand);
  padding-left: 11px;
}
[data-theme="jones"] .customer-result-item.selected {
  background: rgba(0,0,0,.05);
  border-left-color: var(--color-brand);
}

.customer-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-brand-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.customer-result-info { flex: 1; min-width: 0; }
.customer-result-name  { font-size: 14px; font-weight: 600; color: var(--color-text); }
.customer-result-email { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.customer-result-pc {
  font-size: 12px;
  font-family: monospace;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.customer-result-tick { stroke: var(--color-success); flex-shrink: 0; }

.customer-no-results {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

/* ── Newsletter (tablet mode) ───────────────────────────── */
.newsletter-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

.ready-secondary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.nl-back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
}

.nl-back-label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.newsletter-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.nl-logo { height: 36px; width: auto; color: var(--color-brand-dark); }

.nl-tagline {
  font-family: var(--font-brand);
  font-size: 11px;
  font-style: italic;
  color: var(--color-accent-dark);
  letter-spacing: 1.5px;
}

.newsletter-title {
  font-family: var(--font-brand);
  font-size: 26px;
  font-weight: 700;
  color: var(--color-brand-dark);
}

.newsletter-desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.nl-form { display: flex; flex-direction: column; gap: 16px; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.consent-row input { position: absolute; opacity: 0; width: 0; height: 0; }

.consent-check {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border-strong);
  border-radius: 5px;
  background: var(--color-surface);
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--transition);
  position: relative;
}
.consent-row input:checked + .consent-check {
  background: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
}
.consent-row input:checked + .consent-check::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.consent-text { font-size: 13px; color: var(--color-text-secondary); line-height: 1.5; }

.nl-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  color: var(--color-success);
}
.nl-success p {
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-brand-dark);
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(480px, 95vw);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}
.modal-title { font-family: var(--font-brand); font-size: 20px; font-weight: 700; color: var(--color-brand-dark); }
.modal-close {
  width: 36px; height: 36px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 20px;
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--color-error-bg); color: var(--color-error); }

.modal-body   { padding: 4px 24px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Settings Tabs ──────────────────────────────────────── */
.cfg-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1.5px solid var(--color-border);
  margin: -4px -24px 20px;
  background: var(--color-surface);
}
.cfg-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  background: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.cfg-tab:hover { color: var(--color-brand); }
.cfg-tab.active { color: var(--color-brand-dark); border-bottom-color: var(--color-brand); }
.cfg-tab svg { opacity: 0.7; }
.cfg-tab.active svg { opacity: 1; }

/* ── Config Form ────────────────────────────────────────── */

/* Stack all panels in the same grid cell so the dialog stays the height of
   the tallest panel regardless of which tab is active. */
.cfg-panels { display: grid; }
.cfg-panel   { grid-area: 1 / 1; }

/* Keep hidden panels in the layout (for consistent sizing) but invisible */
.cfg-panels .cfg-panel[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.config-grid { display: flex; flex-direction: column; gap: 16px; }

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

.config-label { font-size: 13px; font-weight: 600; color: var(--color-text); }

.config-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1.5px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-secondary);
}
.config-info-row svg { flex-shrink: 0; opacity: 0.6; }

.config-input-suffix {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}
.config-input-suffix .config-input {
  border: none;
  flex: 1;
}
.config-input-suffix .config-input:focus { outline: none; }
.config-input-suffix:focus-within { border-color: var(--color-brand); }
.config-suffix {
  padding: 0 12px;
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-left: 1.5px solid var(--color-border);
  height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.config-input {
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.config-input:focus { border-color: var(--color-brand); }

.mode-toggle {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.mode-btn {
  flex: 1;
  height: 44px;
  border: none;
  background: var(--color-surface);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.mode-btn + .mode-btn { border-left: 1.5px solid var(--color-border); }
.mode-btn.active { background: var(--color-brand-dark); color: #fff; }

.config-mode-display {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--color-text-secondary);
  background: var(--color-surface-alt);
}

.config-help {
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.config-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
}

.config-check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.config-check-item:hover {
  border-color: var(--color-brand-light);
  box-shadow: var(--shadow-sm);
}

.config-check-item:has(input:checked) {
  border-color: var(--color-brand);
  background: rgba(65,59,122,.05);
}

.config-check-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.config-check-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.config-check-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ── Leaderboard ────────────────────────────────────────── */

/* Allow the card to align to the top when it grows tall */
.flow-center-top { align-items: flex-start; }

#view-leaderboard .flow-center {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.leaderboard-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--header-height) - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lb-metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.lb-metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lb-metric-select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 36px 12px 14px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  background-color: var(--color-surface-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.lb-metric-select:hover {
  border-color: var(--color-border-strong);
}

.lb-metric-select:focus {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.lb-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Each row: rank | store | bar | value — fixed-width outer cols keep everything aligned */
.lb-item {
  display: grid;
  grid-template-columns: 48px 1fr 96px;
  align-items: center;
  gap: 0 14px;
  padding: 13px 16px 13px 6px;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}
.lb-item:last-child { border-bottom: none; }
.lb-item:hover { background: var(--color-surface-alt); }

.lb-item-current { background: rgba(65,59,122,.05); }
.lb-item-current:hover { background: rgba(65,59,122,.09); }
[data-theme="jones"] .lb-item-current { background: rgba(0,0,0,.04); }
[data-theme="jones"] .lb-item-current:hover { background: rgba(0,0,0,.07); }

.lb-item-rank {
  font-size: 20px;
  text-align: center;
  line-height: 1;
  color: var(--color-text-muted);
  font-weight: 700;
}

.lb-item-store { min-width: 0; }

.lb-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.lb-store-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-branch {
  display: block;
  font-size: 11px;
  font-family: monospace;
  color: var(--color-text-muted);
}

.lb-you {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 1px 7px;
  background: var(--color-brand-dark);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.lb-item-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.lb-val-num {
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-brand-dark);
}

.lb-val-label {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.lb-val-context {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
  margin-top: 2px;
}

.lb-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

.lb-status {
  padding: 9px 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  line-height: 1.4;
}

.lb-spinner {
  color: var(--color-text-muted);
  animation: lb-spin 1s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* Dark mode overrides */
[data-color-scheme="dark"] .lb-metric-select {
  background-color: var(--color-surface-alt);
  color: var(--color-text);
}
[data-color-scheme="dark"] .lb-item-current { background: rgba(92,85,158,.12); }
[data-color-scheme="dark"] .lb-item-current:hover { background: rgba(92,85,158,.18); }
[data-color-scheme="dark"] .lb-val-num { color: var(--color-text); }

/* ── Toasts ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; z-index: 9999; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: var(--color-brand-dark); color: #fff;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn .2s ease, toastOut .2s ease 2.8s forwards;
  max-width: 360px;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-error); }
.toast.warning { background: var(--color-warning); }

@keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
@keyframes toastOut { to   { opacity:0; transform:translateY(8px); } }

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --header-height: 56px; }
  .logo-tagline, .store-badge { display: none; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .header-time { font-size: 15px; }
  .flow-center { padding: 16px 12px; }
  .newsletter-card { padding: 28px 20px; }
  .active-card { padding: 24px 18px; gap: 16px; }
  .flow-body { padding: 18px; }
  .flow-card-header { padding: 16px 18px; }
  .flow-footer { padding: 14px 18px; }
  .modal { width: 100vw; max-width: 100vw; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; }
  .modal-header { padding: 16px 20px; }
  .modal-body { padding: 4px 20px 20px; }
  .cfg-tabs { padding: 0 20px; margin: -4px -20px 16px; }
  .modal-footer { padding: 12px 20px; }
}

@media (max-width: 480px) {
  :root { --header-height: 50px; }
  .header-inner { padding: 0 12px; gap: 8px; }
  .till-badge { display: none; }
  .logo-svg { height: 26px; }
  .header-time { font-size: 13px; min-width: 40px; }
  .header-icon-btn { width: 32px; height: 32px; }
  .flow-center { padding: 10px 8px; align-items: flex-start; }
  .flow-card { border-radius: var(--radius-md); }
  .flow-card-header { padding: 14px; gap: 10px; }
  .flow-body { padding: 14px; gap: 14px; }
  .flow-footer { padding: 12px 14px; flex-wrap: wrap; }
  .flow-footer > .btn { flex: 1; min-width: 120px; text-align: center; }
  .active-card { padding: 18px 14px; gap: 14px; border-radius: var(--radius-md); }
  .ready-card { gap: 12px; }
  .ready-icon { width: 64px; height: 64px; }
  .ready-icon svg { width: 30px; height: 30px; }
  .newsletter-card { padding: 24px 16px; border-radius: var(--radius-md); }
}

@media (max-width: 360px) {
  :root { --header-height: 46px; }
  .header-inner { padding: 0 8px; gap: 6px; }
  .header-time { display: none; }
  .logo-svg { height: 22px; }
  .flow-center { padding: 6px; }
  .flow-body { padding: 12px; gap: 12px; }
  .flow-footer { padding: 10px 12px; }
  .active-card { padding: 14px 12px; }
}

@media print {
  .app-header, .modal-overlay { display: none !important; }
  .view-container { height: auto !important; overflow: visible !important; }
  .view { display: flex !important; }
}

/* ── Jones Bootmaker Theme ──────────────────────────────── */
[data-theme="jones"] {
  /* jonesbootmaker.com: black primary + white secondary */
  --color-brand-dark:    #000000;
  --color-brand:         #1a1a1a;
  --color-brand-light:   #3d3d3d;
  --color-accent:        #ffffff;
  --color-accent-dark:   #e8e8e8;
  --color-bg:            #f7f7f7;
  --color-surface-alt:   #f4f4f4;
  --font-ui: 'Lato', system-ui, -apple-system, sans-serif;
}

[data-theme="jones"] .app-header {
  background: linear-gradient(135deg, #0d0d0d 0%, #1e1e1e 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.55);
}

/* Input focus ring: replace purple tint with neutral black */
[data-theme="jones"] .input:focus {
  box-shadow: 0 0 0 3px rgba(0,0,0,.1);
}

/* Checked pref-item: replace purple tint with neutral black */
[data-theme="jones"] .pref-item:has(input:checked) {
  background: rgba(0,0,0,.05);
}

/* nl-tagline uses --color-accent-dark which is near-white on a light card — override to stay readable */
[data-theme="jones"] .nl-tagline {
  color: var(--color-text-muted);
}

/* Focus rings: --color-accent is white, invisible on light backgrounds — use brand (black) instead */
[data-theme="jones"] :focus-visible,
[data-theme="jones"] .skip-link:focus,
[data-theme="jones"] .input:focus-visible,
[data-theme="jones"] .pref-check input:focus-visible + .pref-checkmark,
[data-theme="jones"] .consent-row input:focus-visible + .consent-check,
[data-theme="jones"] .customer-result-item:focus-visible {
  outline-color: var(--color-brand);
}

/* ── Dark Colour Scheme - Pavers ────────────────────────── */
[data-color-scheme="dark"] {
  --color-bg:            #1a1825;   /* page bg - dark but not pure black */
  --color-surface:       #26233a;   /* cards - noticeably lighter than bg */
  --color-surface-alt:   #302c47;   /* inputs / alt rows - clear step up */
  --color-border:        #453f68;   /* visible borders */
  --color-border-strong: #5e5688;   /* focused / prominent borders */
  --color-text:          #f4f2ff;   /* near-white primary text */
  --color-text-secondary:#c5bfe0;   /* clearly readable secondary text */
  --color-text-muted:    #9e98bc;   /* muted but still passes WCAG AA */
  --color-text-inverse:  #1a1825;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.45);
  --shadow-md:  0 4px 16px rgba(0,0,0,.6);
  --shadow-lg:  0 8px 36px rgba(0,0,0,.75);
  --color-success-bg:    #0c3320;
  --color-warning-bg:    #312200;
  --color-error-bg:      #330e0e;
}

/* Elements that use --color-brand-dark as a text/border colour need
   lightening in dark mode - brand-dark (#2d2860) is near-black and
   invisible against dark surfaces. */
[data-color-scheme="dark"] .ready-title,
[data-color-scheme="dark"] .flow-title,
[data-color-scheme="dark"] .modal-title,
[data-color-scheme="dark"] .newsletter-title,
[data-color-scheme="dark"] .nl-success p,
[data-color-scheme="dark"] .tx-id,
[data-color-scheme="dark"] .stat-value { color: var(--color-text); }

[data-color-scheme="dark"] .suffix-btn {
  color: var(--color-text-secondary);
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}
[data-color-scheme="dark"] .suffix-btn:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand-light);
  color: #fff;
}

[data-color-scheme="dark"] .nl-logo { color: var(--color-accent); }

[data-color-scheme="dark"] .btn-text:hover { color: var(--color-text); }

/* Checked custom checkboxes - use brand-light so they're visible on dark bg */
[data-color-scheme="dark"] .pref-check input:checked + .pref-checkmark,
[data-color-scheme="dark"] .consent-row input:checked + .consent-check {
  background: var(--color-brand-light);
  border-color: var(--color-brand-light);
}

[data-color-scheme="dark"] .config-check-item:has(input:checked) {
  background: rgba(92,85,158,.18);
}
[data-color-scheme="dark"] .cfg-tabs { background: var(--color-surface); }
[data-color-scheme="dark"] .cfg-tab.active { color: var(--color-text); border-bottom-color: var(--color-brand-light); }
[data-color-scheme="dark"] .cfg-tab:hover { color: var(--color-brand-light); }
[data-color-scheme="dark"] .config-info-row { background: var(--color-surface); }

/* ── Dark Colour Scheme - Jones ─────────────────────────── */
[data-theme="jones"][data-color-scheme="dark"] {
  --color-bg:            #111010;
  --color-surface:       #1a1818;
  --color-surface-alt:   #221f1f;
  --color-border:        #332e2e;
  --color-border-strong: #453f3f;
  --color-text:          #f2eeed;
  --color-text-secondary:#b8adac;
  --color-text-muted:    #7a6e6d;
  --color-text-inverse:  #111010;
}


/* ── Accessibility ──────────────────────────────────────── */

/* Visually hidden but still announced by screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip to main content link - visible only when focused */
.skip-link {
  position: fixed;
  top: -100%;
  left: 0;
  z-index: 99999;
  background: var(--color-brand-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-md) 0;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0s;
}
.skip-link:focus { top: 0; outline: 3px solid var(--color-accent); outline-offset: 3px; }

/* ── Focus visible rings (keyboard-only, not mouse) ─────── */

/* All interactive elements - default ring */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inputs use border+shadow focus; also show ring for keyboard */
.input:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 0;
}

/* Custom checkboxes: real input is opacity:0, show ring on the visible element */
.pref-check input:focus-visible + .pref-checkmark {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.consent-row input:focus-visible + .consent-check {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 5px;
}


/* Customer result items are keyboard-focusable */
.customer-result-item:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
  background: var(--color-surface-alt);
}

/* Headings that receive programmatic focus for navigation */
.flow-title:focus,
.ready-title:focus,
.newsletter-title:focus {
  outline: none; /* focus is managed, not user-initiated */
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .active-pulse { animation: none; background: var(--color-success); }
  .timeout-bar-inner { transition: none !important; }
}

/* ── Font Size Scales ───────────────────────────────────── */

[data-font-size="xs"] .flow-title,
[data-font-size="xs"] .modal-title { font-size: 14px; }
[data-font-size="xs"] .ready-title { font-size: 20px; }
[data-font-size="xs"] .newsletter-title { font-size: 19px; }
[data-font-size="xs"] .input,
[data-font-size="xs"] .config-input,
[data-font-size="xs"] .pref-title,
[data-font-size="xs"] .active-hint,
[data-font-size="xs"] .ready-sub,
[data-font-size="xs"] .newsletter-desc { font-size: 12px; }
[data-font-size="xs"] .btn { font-size: 11px; }
[data-font-size="xs"] .field-label,
[data-font-size="xs"] .pref-desc,
[data-font-size="xs"] .config-label { font-size: 11px; }
[data-font-size="xs"] .config-help,
[data-font-size="xs"] .config-check-desc { font-size: 10px; }
[data-font-size="xs"] .config-check-title { font-size: 12px; }

[data-font-size="sm"] .flow-title,
[data-font-size="sm"] .modal-title { font-size: 17px; }
[data-font-size="sm"] .newsletter-title { font-size: 22px; }
[data-font-size="sm"] .ready-title { font-size: 24px; }
[data-font-size="sm"] .input,
[data-font-size="sm"] .config-input,
[data-font-size="sm"] .pref-title,
[data-font-size="sm"] .active-hint,
[data-font-size="sm"] .ready-sub,
[data-font-size="sm"] .newsletter-desc { font-size: 13px; }
[data-font-size="sm"] .btn,
[data-font-size="sm"] .field-label { font-size: 13px; }
[data-font-size="sm"] .pref-desc,
[data-font-size="sm"] .config-label { font-size: 12px; }
[data-font-size="sm"] .config-help,
[data-font-size="sm"] .config-check-desc { font-size: 11px; }
[data-font-size="sm"] .config-check-title { font-size: 13px; }

[data-font-size="lg"] .flow-title,
[data-font-size="lg"] .modal-title { font-size: 23px; }
[data-font-size="lg"] .newsletter-title { font-size: 30px; }
[data-font-size="lg"] .ready-title { font-size: 32px; }
[data-font-size="lg"] .input,
[data-font-size="lg"] .config-input,
[data-font-size="lg"] .pref-title,
[data-font-size="lg"] .active-hint,
[data-font-size="lg"] .ready-sub,
[data-font-size="lg"] .newsletter-desc { font-size: 17px; }
[data-font-size="lg"] .btn,
[data-font-size="lg"] .field-label { font-size: 16px; }
[data-font-size="lg"] .pref-desc,
[data-font-size="lg"] .config-label { font-size: 15px; }
[data-font-size="lg"] .config-help,
[data-font-size="lg"] .config-check-desc { font-size: 14px; }
[data-font-size="lg"] .config-check-title { font-size: 16px; }

[data-font-size="xl"] .flow-title,
[data-font-size="xl"] .modal-title { font-size: 26px; }
[data-font-size="xl"] .newsletter-title { font-size: 32px; }
[data-font-size="xl"] .ready-title { font-size: 36px; }
[data-font-size="xl"] .input,
[data-font-size="xl"] .config-input,
[data-font-size="xl"] .pref-title,
[data-font-size="xl"] .active-hint,
[data-font-size="xl"] .ready-sub,
[data-font-size="xl"] .newsletter-desc { font-size: 19px; }
[data-font-size="xl"] .btn,
[data-font-size="xl"] .field-label { font-size: 18px; }
[data-font-size="xl"] .pref-desc,
[data-font-size="xl"] .config-label { font-size: 17px; }
[data-font-size="xl"] .config-help,
[data-font-size="xl"] .config-check-desc { font-size: 16px; }
[data-font-size="xl"] .config-check-title { font-size: 18px; }

/* ── QR printable poster (till) ─────────────────────────── */
.qr-staff-card {
  max-width: 480px;
}

.qr-screen-hint {
  font-size: 14px;
  color: var(--color-text-secondary);
  text-align: center;
  margin: 0;
  line-height: 1.45;
}

.qr-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  width: 100%;
}

.qr-print-sheet {
  width: 100%;
  max-width: 420px;
  padding: 0 8px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-sizing: border-box;
}

.qr-print-title {
  font-family: var(--font-brand);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--color-brand-dark);
  margin: 0;
  line-height: 1.2;
}

.qr-print-lead {
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-text-secondary);
}

.qr-print-advice {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--color-text);
  max-width: 38ch;
}

.qr-code-wrap .qr-code-img {
  display: block;
  margin: 0 auto;
}

.qr-error {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 8px 0 0;
}

@media print {
  @page {
    margin: 14mm;
  }

  body {
    background: #fff !important;
  }

  .no-print,
  .toast-container,
  .modal-overlay,
  .skip-link {
    display: none !important;
  }

  body * {
    visibility: hidden;
  }

  #qrPrintArea,
  #qrPrintArea * {
    visibility: visible;
  }

  #qrPrintArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    padding: 0;
    gap: 22px;
  }

  .qr-print-title {
    font-size: 26pt;
    color: #000 !important;
  }

  .qr-print-lead,
  .qr-print-advice {
    font-size: 12pt !important;
    color: #222 !important;
  }

  .qr-code-wrap .qr-code-img {
    width: 300px;
    height: 300px;
  }
}

/* ── Customer newsletter (QR scan) — compact on phones ─────── */
.nl-customer-help {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin: 0;
  max-width: 36ch;
  align-self: center;
}

.newsletter-card--customer {
  max-width: 100%;
  padding: 22px 18px;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

.newsletter-card--customer .newsletter-title {
  font-size: 1.35rem;
  line-height: 1.25;
}

.newsletter-card--customer .newsletter-desc {
  font-size: 14px;
  margin: 0;
}

.newsletter-card--customer .newsletter-brand {
  margin-bottom: -4px;
}

.newsletter-card--customer .nl-logo {
  height: 28px;
}

.newsletter-card--customer .input.input-lg {
  font-size: 16px;
  padding: 14px 16px;
}

.newsletter-card--customer .btn-xl {
  padding: 14px 20px;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .newsletter-card--customer {
    padding: 18px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }

  .newsletter-card--customer .newsletter-title {
    font-size: 1.25rem;
  }
}

/* Keep customer QR page readable on phones even when till font size is XL */
[data-font-size] .newsletter-card--customer .newsletter-title {
  font-size: 1.35rem;
  line-height: 1.25;
}

[data-font-size] .newsletter-card--customer .newsletter-desc {
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 480px) {
  [data-font-size] .newsletter-card--customer .newsletter-title {
    font-size: 1.25rem;
  }
}

/* ── Forced colours (high contrast mode) ────────────────── */
@media (forced-colors: active) {
  .pref-checkmark,
  .consent-check {
    forced-color-adjust: none;
    border: 2px solid ButtonText;
    background: Field;
  }
  .pref-check input:checked + .pref-checkmark,
  .consent-row input:checked + .consent-check {
    background: Highlight;
    border-color: Highlight;
  }
  .status-dot {
    forced-color-adjust: none;
  }
  .timeout-bar-inner {
    forced-color-adjust: none;
    background: Highlight;
  }
  .btn-primary,
  .btn-success,
  .btn-error {
    forced-color-adjust: none;
  }
}
