/* FE-001: must start with import of design-system.css */
@import './design-system.css';

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* #59: do NOT put overflow-x:hidden on the global html/body — it turns overflow-y
   into a scroll-container (auto) and that broke vertical document scroll on the
   standalone public pages (over/faq). Keep the global scrollable; lock only the SPA.
   overscroll-behavior:none (no rubber-band) is safe on both and doesn't block scroll. */
html, body { max-width: 100%; overscroll-behavior: none; }

/* SPA only: pin the body to the viewport and clip — this locks the document so it
   can't scroll/rubber-band, which keeps the 100dvh app-shell (incl. the bottom nav)
   fully within the visible area. Removing this (only `overflow:hidden`, height auto)
   let the bottom nav fall below the fold on mobile (#59 regression). The public
   pages (.public-body) have no height/overflow lock and scroll normally. */
.app-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* FE-002: skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); }

/* FE-002: screen-reader-only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* FE-002: focus indicator */
*:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── App layout ────────────────────────────────────────────────── */
.app-layout {
  /* #58: app-shell — header + bottom nav are part of the NON-scrolling shell so
     they are always in view; only the middle (.screen-container) scrolls. 100dvh
     keeps the bars pinned regardless of the mobile browser's collapsing toolbar. */
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.screen-container {
  /* #58: the only scrolling region between the fixed header and bottom nav */
  order: 1;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0; /* #55: allow shrink so wide content can't push the page sideways */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain; /* #58: don't chain overscroll to the document (no shell bounce) */
  padding: var(--space-4);
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ── App Header / Top Bar ───────────────────────────────────────── */
.app-header {
  flex-shrink: 0;
  background-color: var(--color-text);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 7px,
    rgba(196, 162, 101, 0.07) 7px,
    rgba(196, 162, 101, 0.07) 8px
  );
  padding: var(--space-3) var(--space-4);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 640px;
  margin: 0 auto;
}

.app-header-icon {
  color: var(--color-accent);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.app-header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-header-profile {
  margin-left: auto;
  display: flex;
  align-items: center;
  color: var(--color-accent);
}
.app-header-profile svg { width: 26px; height: 26px; }
/* hidden attr must win over display:flex (lesson from #11/#47) */
.app-header-profile[hidden] { display: none; }

.app-header-title {
  font-family: var(--font-display);
  font-size: var(--text-h2-size);
  font-weight: var(--text-h2-weight);
  color: var(--color-accent);
  line-height: 1.2;
}

.app-header-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-caption-size);
  color: rgba(196, 162, 101, 0.65);
  letter-spacing: 0.2px;
  line-height: 1.3;
}

/* Screen clearance when both chrome bars are visible */
/* #58: with the app-shell the bars are in normal flow, so the screen no longer
   needs extra padding to clear fixed bars. */

/* ── Navigation ────────────────────────────────────────────────── */
.app-nav {
  flex-shrink: 0;
  order: 2;
  background-color: var(--color-text);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 7px,
    rgba(196, 162, 101, 0.07) 7px,
    rgba(196, 162, 101, 0.07) 8px
  );
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-3);
}

.nav-logo { text-decoration: none; }
.nav-logo-text {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  font-size: var(--text-lg);
}

.nav-links { display: flex; gap: var(--space-2); }

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  min-width: 44px; /* FE-002: touch target */
  min-height: 44px;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out);
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.nav-link svg { width: 20px; height: 20px; }
.nav-link.active { color: var(--color-accent); }
@media (hover: hover) {
  .nav-link:hover { color: var(--color-accent); }
}
.nav-link[hidden] { display: none; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px; /* FE-002 */
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-base);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-bg);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) { background: var(--color-primary-dark); color: var(--color-bg); }

.btn--secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1.5px solid var(--color-text-secondary);
}
.btn--secondary:hover:not(:disabled) { background: var(--color-surface); color: var(--color-text); }

.btn--danger {
  background: var(--color-error);
  color: var(--color-bg);
}
.btn--danger:hover:not(:disabled) { opacity: 0.9; color: var(--color-bg); }

.btn--full { width: 100%; }
.btn--icon { padding: var(--space-2); min-width: 44px; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-3);
}

/* Saldogebruik log (groepsbeheer) */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.usage-table th,
.usage-table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}
.usage-table th {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.usage-table tbody tr:last-child td { border-bottom: none; }
/* Amount column right-aligned with aligned digits */
.usage-table th:last-child,
.usage-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* #55: keep a wide table inside its card on narrow screens — scroll the table,
   never the whole page. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* #55: cap the reason column so a long reason can't balloon the table; the full
   text stays available via the native tooltip (title attr) on hover/tap. */
.usage-table td.usage-reason {
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group + .form-group { margin-top: var(--space-4); }

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.form-input:focus { border-color: var(--color-primary); outline: none; }
.form-input--error { border-color: var(--color-error); }

.form-error {
  font-size: var(--text-sm);
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ── Toast ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--space-5) + 64px); /* above nav */
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(360px, 90vw);
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  margin-top: var(--space-2);
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--color-success); color: var(--color-bg); }
.toast--error   { background: var(--color-error);   color: var(--color-bg); }
.toast--info    { background: var(--color-text);     color: var(--color-bg); }

/* ── Confirm dialog ─────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}
.confirm-dialog {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.confirm-dialog-title {
  font-family: var(--font-display);
  font-size: var(--text-h4-size);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin: 0;
}
.confirm-dialog-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}
.confirm-dialog-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ── Loading / empty states ─────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-12) var(--space-4) var(--space-10);
  text-align: center;
}
.empty-state-icon {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.empty-state-icon svg {
  width: 100%;
  height: 100%;
}
.empty-state-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}
.empty-state-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 260px;
  line-height: var(--text-body-lh);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-10);
}
.loading-state img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
}
.badge--draft      { background: var(--color-surface);       color: var(--color-text-secondary); }
.badge--processing { background: var(--color-cta-light);     color: var(--color-cta); }
.badge--purchased  { background: var(--color-confirm-light);  color: var(--color-confirm-dark); }
.badge--success    { background: var(--color-success-bg);     color: var(--color-success); }
.badge--error      { background: var(--color-error-bg);       color: var(--color-error); }
.badge--alert      { background: var(--color-alert-light);    color: var(--color-alert-dark); }

/* ── Profit/loss colours ────────────────────────────────────────── */
.profit-positive { color: var(--color-success); }
.profit-negative { color: var(--color-error); }

/* ── Onboarding: groep aanmaken (#52) ───────────────────────────── */
.onboarding {
  max-width: 420px;
  margin: 0 auto;
  padding-top: var(--space-6);
  text-align: center;
}
.onboarding-art { display: flex; justify-content: center; }
.onboarding-intro { max-width: 320px; margin: 0 auto; }
.onboarding form { text-align: left; }
.onboarding-invite-note { padding-top: var(--space-2); }

/* ── Scorelijst (#50) ───────────────────────────────────────────── */
.score-list { list-style: none; padding: 0; margin: 0; }

.score-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.score-rank {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
}

.score-row:first-child .score-rank {
  background: var(--color-cta-light);
  border-color: var(--color-cta);
  color: var(--color-cta-dark);
}

.score-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--font-weight-semibold);
}

.score-profit {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.score-profit-amount { font-weight: var(--font-weight-semibold); }
.score-profit-percent { font-size: var(--text-sm); }

/* inset ring instead of border — no 2px layout shift vs sibling cards */
.card--highlight { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--color-cta); }

/* ── Login screen ───────────────────────────────────────────────── */
.app--header-only .screen-container {
  display: flex;
  flex-direction: column;
}

.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  text-align: center;
}

.login-wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.login-wordmark-icon {
  font-size: 2.25rem;
  line-height: 1;
}

.login-wordmark-title {
  font-family: var(--font-display);
  font-size: var(--text-h1-size);
  font-weight: var(--text-h1-weight);
  color: var(--color-cta);
  letter-spacing: 0.5px;
}

.login-tagline {
  font-size: var(--text-body-lg-size);
  color: var(--color-text-secondary);
  max-width: 260px;
  line-height: var(--text-body-lh);
  margin: 0;
}

.login-actions { width: 100%; }

.login-join-notice {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--text-body-lh);
}

/* ── Dashboard tiles ────────────────────────────────────────────── */
.dashboard-title {
  padding: var(--space-4) 0 var(--space-2);
}

.dashboard-credits {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: calc(-1 * var(--space-1));
  margin-bottom: 0;
}
.dashboard-credits--low { color: var(--color-error); }

/* ── Mine|Group toggle (#25) ────────────────────────────────────── */
.view-toggle {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.view-toggle__btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle__btn + .view-toggle__btn {
  border-left: 1.5px solid var(--color-border);
}
.view-toggle__btn--active {
  background: var(--color-cta);
  color: #fff;
}

/* ── Assign modal (#25) ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-4);
}
.modal {
  width: 100%;
  max-width: 360px;
}
.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.dashboard-section-header {
  font-family: var(--font-body);
  font-size: var(--text-overline-size);
  font-weight: var(--text-overline-weight);
  letter-spacing: var(--text-overline-ls);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  padding: var(--space-4) 0 var(--space-2);
  margin: 0;
}

.dashboard-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.dashboard-tile {
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  text-decoration: none;
}

.tile-cta {
  background: var(--color-cta-light);
  border: 1.5px solid var(--color-cta);
}
.tile-cta:hover { opacity: 0.85; }

.tile-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
}

.tile-icon {
  font-size: 1.375rem;
  line-height: 1;
}

.tile-value {
  font-family: var(--font-display);
  font-size: var(--text-h2-size);
  font-weight: var(--text-h2-weight);
  color: var(--color-cta);
  line-height: 1.1;
}

.tile-stat .tile-value { color: var(--color-text); }

.tile-value--positive { color: var(--color-success); }
.tile-value--warning  { color: var(--color-error); }

.tile-label {
  font-family: var(--font-body);
  font-size: var(--text-overline-size);
  font-weight: var(--text-overline-weight);
  letter-spacing: var(--text-overline-ls);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ── Scan Detail PDP ────────────────────────────────────────────── */
.pdp-back {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.pdp-back:hover { color: var(--color-text); }

.pdp-header {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.pdp-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.pdp-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border-light);
  font-size: 1.75rem;
}

.pdp-header-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pdp-title {
  font-family: var(--font-display);
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  color: var(--color-text);
  line-height: var(--text-h3-lh);
}

.pdp-value-range {
  font-family: var(--font-display);
  font-size: var(--text-h2-size);
  font-weight: var(--text-h2-weight);
  color: var(--color-cta);
}

.pdp-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.pdp-no-ai {
  background: var(--color-alert-light);
  border: 1px solid var(--color-alert);
}

/* ── Advertentietekst (#42) ─────────────────────────────────────── */
.pdp-ad-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.pdp-ad-text {
  white-space: pre-wrap;
  align-self: stretch;
}
.pdp-ad-block .btn { align-self: flex-start; }

/* ── Members list (groepsbeheer) ────────────────────────────────── */
.members-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }

.member-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
}
.member-row:last-child { border-bottom: none; padding-bottom: 0; }

.member-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.member-name  { font-weight: var(--font-weight-semibold); font-size: var(--text-base); }
.member-email { word-break: break-all; }

/* ── Scan list cards ────────────────────────────────────────────── */
.scan-list { list-style: none; }

/* ── Scan camera — photo selection ─────────────────────────────── */
.photo-select-btns { display: flex; gap: var(--space-3); }
.photo-select-btns .btn { flex: 1; }
.photo-preview { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.photo-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--color-border); }

.scan-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.scan-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.scan-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border-light);
  font-size: 1.375rem;
}

.scan-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.scan-card-title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-base);
  line-height: var(--text-h4-lh);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 36px;
}

/* ── FAB (Floating Action Button) ───────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-bottom-height) + var(--space-5));
  right: var(--space-5);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-cta);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  z-index: 50;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { background: var(--color-cta-dark); color: var(--color-bg); }
.fab:active { transform: scale(0.93); }

/* ── Utility ────────────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-sm    { font-size: var(--text-sm); }
.mb-4       { margin-bottom: var(--space-4); }
.mt-4       { margin-top: var(--space-4); }
.gap-3      { gap: var(--space-3); }
.stack      { display: flex; flex-direction: column; }
.stack--sm  { gap: var(--space-2); }
.stack--md  { gap: var(--space-4); }

/* Build/version footer (profiel) */
.app-version {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-caption-size);
  margin-top: var(--space-2);
}

/* ── Public / marketing pages (over.html, faq.html) + login links ── */
/* Standalone, crawlable pages served as real HTML (not behind the SPA).
   Shared chrome: a simple public header + footer, design-system styled. */

.public-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.public-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.public-header-inner,
.public-main,
.public-footer-inner {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}
.public-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  flex-wrap: wrap; /* #59: on a narrow phone the nav drops below the brand instead of overflowing */
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.public-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  color: var(--color-cta);
  text-decoration: none;
  letter-spacing: 0.3px;
  white-space: nowrap; /* #59: keep "Kringloop Jager" on one line */
}
/* #59: let the nav fill the second row when it wraps under the brand on mobile */
.public-nav { flex-wrap: wrap; }
.public-brand-icon { font-size: 1.5rem; line-height: 1; }
.public-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.public-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-body-size);
  font-weight: 600;
}
.public-nav a:hover,
.public-nav a[aria-current="page"] { color: var(--color-cta); }
.public-nav .btn { padding-top: var(--space-2); padding-bottom: var(--space-2); }

.public-main {
  flex: 1;
  padding-top: var(--space-10);
  padding-bottom: var(--space-12);
}

.public-hero { text-align: center; margin-bottom: var(--space-12); }
.public-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-display-size);
  line-height: var(--text-display-lh);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}
.public-hero .public-lead {
  font-size: var(--text-body-lg-size);
  color: var(--color-text-secondary);
  line-height: var(--text-body-lh);
  max-width: 620px;
  margin: 0 auto var(--space-6);
}

.public-section { margin-bottom: var(--space-10); }
.public-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-h2-size);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.public-section p,
.public-section li {
  font-size: var(--text-body-lg-size);
  color: var(--color-text);
  line-height: var(--text-body-lh);
}
.public-section p { margin-bottom: var(--space-4); }
.public-section ul { padding-left: var(--space-5); margin-bottom: var(--space-4); }
.public-section li { margin-bottom: var(--space-2); }

/* Steps (how it works) */
.public-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  list-style: none;
  padding: 0;
}
.public-step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.public-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-cta);
  color: var(--color-bg);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.public-step h3 {
  font-size: var(--text-h4-size);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}
.public-step p { font-size: var(--text-body-size); margin: 0; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: var(--space-4); }
.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.faq-item h2 {
  font-family: var(--font-body);
  font-size: var(--text-h4-size);
  font-weight: 700;
  color: var(--color-cta);
  margin-bottom: var(--space-2);
}
.faq-item p { margin-bottom: 0; }
.faq-item p + p { margin-top: var(--space-3); }

.public-cta-row {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-8);
}

.public-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.public-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
}
.public-footer a { color: var(--color-text-secondary); }

/* ── PWA install banner (#54) ───────────────────────────────────── */
.install-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-bottom-height) + var(--space-4) + env(safe-area-inset-bottom));
  z-index: 1000;
  width: min(460px, calc(100vw - 2 * var(--space-4)));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.install-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.install-banner-text strong {
  font-size: var(--text-body-size);
  color: var(--color-text);
}
.install-banner-text span {
  font-size: var(--text-body-sm-size);
  color: var(--color-text-secondary);
  line-height: var(--text-body-lh);
}
.install-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.install-banner-dismiss {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--text-body-lg-size);
  line-height: 1;
  cursor: pointer;
  padding: var(--space-2);
  min-width: 44px;  /* FE-002 touch target */
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.install-banner-dismiss:hover { color: var(--color-cta); }

/* Login screen footer links to the public pages (#53) */
.login-links {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  margin-top: var(--space-6);
}
.login-links a {
  color: var(--color-text-secondary);
  font-size: var(--text-body-sm-size);
  font-weight: 600;
}
.login-links a:hover { color: var(--color-cta); }

/* ── PDP lifecycle stepper (#57) ─────────────────────────────────── */
.status-flow {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.status-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  position: relative;
}
/* connector line from the previous step's marker to this one */
.status-step::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.status-step:first-child::before { display: none; }
.status-step--done::before,
.status-step--current::before { background: var(--color-cta); }

.status-step-marker {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
}
.status-step--done .status-step-marker {
  background: var(--color-cta);
  border-color: var(--color-cta);
  color: var(--color-bg);
}
.status-step--current .status-step-marker {
  background: var(--color-cta);
  border-color: var(--color-cta);
  color: var(--color-bg);
  box-shadow: 0 0 0 4px var(--color-cta-light);
}
.status-step-label {
  font-size: var(--text-caption-size);
  line-height: 1.2;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.status-step--current .status-step-label {
  color: var(--color-text);
  font-weight: 600;
}

/* De-emphasised section title (e.g. "Overige acties" on the PDP) */
.card-title--muted {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}
