/*
 * Wurstserver 2.0 – Designsystem „Schick und Simpel“
 *
 * Grundsätze:
 *  - Mobile First: Basisregeln gelten fürs Smartphone, Breakpoints erweitern.
 *  - Ein Satz Design-Tokens (Farben, Abstände, Radien, Schrift) für alle Seiten.
 *  - Alle Farbpaare erfüllen WCAG 2.2 AA (Text ≥ 4,5:1, Bedienelemente ≥ 3:1),
 *    hell und dunkel; geprüft in docs/design.md.
 *  - Touchziele mindestens 44 × 44 px, sichtbarer Tastaturfokus.
 *  - Keine Webfonts, keine Frameworks, keine Pflicht-Animationen.
 *  - Bedeutung nie nur über Farbe: Status immer zusätzlich als Text/Symbol.
 */

/* ---------- 1. Design-Tokens ---------- */
:root {
  color-scheme: light dark;

  --c-bg: #faf7f2;
  --c-surface: #ffffff;
  --c-surface-2: #f4efe7;
  --c-border: #d9cfc2;
  --c-border-strong: #8c8076;
  --c-text: #1f1a17;
  --c-muted: #5c534b;
  --c-brand: #a3361f;          /* Bratwurst-Rotbraun */
  --c-brand-strong: #842a17;
  --c-on-brand: #ffffff;
  --c-accent: #e3a21a;         /* Senfgelb, nur mit dunkler Schrift */
  --c-on-accent: #1f1a17;
  --c-success: #1f6e3d;
  --c-success-bg: #e7f4ec;
  --c-warning: #7a4d00;
  --c-warning-bg: #fff3d6;
  --c-danger: #b3261e;
  --c-danger-bg: #fce9e7;
  --c-info: #1f4e8c;
  --c-info-bg: #e6eef8;
  --c-focus: #1f4e8c;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;
  --lh: 1.5;

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgb(31 26 23 / 0.06), 0 1px 1px rgb(31 26 23 / 0.04);
  --shadow-2: 0 6px 20px rgb(31 26 23 / 0.10);

  --tap: 2.75rem;               /* 44 px Mindestgröße für Bedienelemente */
  --container: 72rem;
  --header-h: 3.5rem;
  --bottom-nav-h: 4rem;
}

/* Dunkelmodus: automatisch nach Systemeinstellung oder fest gewählt im
   Profil (data-theme auf <html>, Cookie je Gerät). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #14110f;
  --c-surface: #1e1a17;
  --c-surface-2: #28221e;
  --c-border: #3d352f;
  --c-border-strong: #8a7f75;
  --c-text: #f3ede6;
  --c-muted: #bdb2a7;
  --c-brand: #f0876b;
  --c-brand-strong: #f6a58f;
  --c-on-brand: #1a0f0b;
  --c-accent: #f2b93b;
  --c-on-accent: #1a140a;
  --c-success: #6fcf97;
  --c-success-bg: #15291d;
  --c-warning: #f2c063;
  --c-warning-bg: #2e2411;
  --c-danger: #ff8a80;
  --c-danger-bg: #341816;
  --c-info: #8ab4f8;
  --c-info-bg: #16233a;
  --c-focus: #8ab4f8;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 8px 24px rgb(0 0 0 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #14110f;
    --c-surface: #1e1a17;
    --c-surface-2: #28221e;
    --c-border: #3d352f;
    --c-border-strong: #8a7f75;
    --c-text: #f3ede6;
    --c-muted: #bdb2a7;
    --c-brand: #f0876b;
    --c-brand-strong: #f6a58f;
    --c-on-brand: #1a0f0b;
    --c-accent: #f2b93b;
    --c-on-accent: #1a140a;
    --c-success: #6fcf97;
    --c-success-bg: #15291d;
    --c-warning: #f2c063;
    --c-warning-bg: #2e2411;
    --c-danger: #ff8a80;
    --c-danger-bg: #341816;
    --c-info: #8ab4f8;
    --c-info-bg: #16233a;
    --c-focus: #8ab4f8;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 8px 24px rgb(0 0 0 / 0.5);
  }
}

/* ---------- 2. Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s-3); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--c-brand); text-underline-offset: 0.15em; }
a:hover { color: var(--c-brand-strong); }

img, svg { max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--s-2); top: -4rem; z-index: 100;
  background: var(--c-surface); color: var(--c-text); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-weight: 600;
}
.skip-link:focus { top: var(--s-2); }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--c-muted); }
.small { font-size: var(--fs-sm); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .card--link, .stepper button, .bottom-nav a { transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease; }
}

/* ---------- 3. Seitenlayout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--s-4); }

.app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--c-border);
}
.app-header__inner { display: flex; align-items: center; gap: var(--s-3); min-height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--c-text); text-decoration: none; font-weight: 800; font-size: var(--fs-md); letter-spacing: -0.02em; }
.brand:hover { color: var(--c-text); }
.brand__logo { width: 2rem; height: 2rem; }
.brand__suffix { color: var(--c-brand); }

.app-header__spacer { flex: 1; }

.top-nav { display: none; }

.app-main { flex: 1; padding-block: var(--s-5) var(--s-7); }
.app-main--with-bottom-nav { padding-bottom: calc(var(--bottom-nav-h) + var(--s-6) + env(safe-area-inset-bottom)); }

.app-footer { border-top: 1px solid var(--c-border); color: var(--c-muted); font-size: var(--fs-sm); padding-block: var(--s-4); }
.app-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.app-footer__links { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.app-footer__links a { color: inherit; display: inline-block; padding-block: var(--s-1); }
.legal { max-width: 46rem; }
.legal h2 { margin-top: var(--s-6); }
.legal h3 { margin-top: var(--s-4); }
.legal ul { padding-left: 1.25rem; }
.legal-open { display: inline-block; font-size: var(--fs-sm); font-weight: 600; color: var(--c-warning); background: var(--c-warning-bg);
  border: 1px dashed currentColor; border-radius: 4px; padding: 0 0.35em; }

/* Untere Navigation auf dem Smartphone: Daumen-erreichbar */
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--bottom-nav-h); color: var(--c-muted); text-decoration: none; font-size: 0.75rem; font-weight: 600;
}
.bottom-nav a .icon { width: 1.5rem; height: 1.5rem; }
.bottom-nav a[aria-current="page"] { color: var(--c-brand); }
.bottom-nav a:hover { color: var(--c-text); }

@media (min-width: 48rem) {
  .container { padding-inline: var(--s-5); }
  .bottom-nav { display: none; }
  .app-main--with-bottom-nav { padding-bottom: var(--s-7); }
  .top-nav { display: block; }
  .top-nav ul { list-style: none; display: flex; gap: var(--s-1); margin: 0; padding: 0; }
  .top-nav a {
    display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap);
    padding-inline: var(--s-3); border-radius: var(--r-sm); color: var(--c-muted); text-decoration: none; font-weight: 600;
  }
  .top-nav a:hover { color: var(--c-text); background: var(--c-surface-2); }
  .top-nav a[aria-current="page"] { color: var(--c-brand); background: var(--c-surface-2); }
  h1 { font-size: var(--fs-2xl); }
}

/* ---------- 4. Layout-Helfer ---------- */
.stack > * + * { margin-top: var(--s-4); }
.stack--sm > * + * { margin-top: var(--s-2); }
.stack--lg > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.cluster--between { justify-content: space-between; }
.grid { display: grid; gap: var(--s-4); }
@media (min-width: 40rem) { .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.page-head { margin-bottom: var(--s-5); }
.flash { margin-bottom: var(--s-5); }
.page-head p { color: var(--c-muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.section-title h2 { margin: 0; }

/* ---------- 5. Komponenten ---------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: var(--s-2) var(--s-4);
  border: 1px solid transparent; border-radius: var(--r-sm);
  font: inherit; font-weight: 650; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border);
  touch-action: manipulation;
}
.btn:hover { border-color: var(--c-border-strong); color: var(--c-text); }
.btn--primary { background: var(--c-brand); color: var(--c-on-brand); border-color: var(--c-brand); }
.btn--primary:hover { background: var(--c-brand-strong); border-color: var(--c-brand-strong); color: var(--c-on-brand); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--c-brand); }
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-brand-strong); }
.btn--danger { background: var(--c-surface); color: var(--c-danger); border-color: var(--c-danger); }
.btn--danger:hover { background: var(--c-danger-bg); color: var(--c-danger); }
.btn--lg { min-height: 3.25rem; padding-inline: var(--s-5); font-size: var(--fs-md); }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* Karten */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r);
  padding: var(--s-4); box-shadow: var(--shadow-1);
}
@media (min-width: 48rem) { .card { padding: var(--s-5); } }
.card--flat { box-shadow: none; }
.card--link { display: block; color: inherit; text-decoration: none; }
.card--link:hover { border-color: var(--c-border-strong); color: inherit; box-shadow: var(--shadow-2); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.card__title { font-size: var(--fs-md); margin: 0; }
.card__meta { color: var(--c-muted); font-size: var(--fs-sm); }
.card__foot { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--c-border); }

/* Kennzeichen / Status */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 0.125rem var(--s-2); border-radius: var(--r-pill); border: 1px solid currentColor;
  font-size: 0.8125rem; font-weight: 650; line-height: 1.4; white-space: nowrap;
}
.badge .icon { width: 1em; height: 1em; }
.badge--open    { color: var(--c-success); background: var(--c-success-bg); }
.badge--soon    { color: var(--c-warning); background: var(--c-warning-bg); }
.badge--urgent  { color: var(--c-danger);  background: var(--c-danger-bg); }
.badge--closed  { color: var(--c-muted);   background: var(--c-surface-2); }
.badge--info    { color: var(--c-info);    background: var(--c-info-bg); }
.badge--accent  { color: var(--c-on-accent); background: var(--c-accent); border-color: var(--c-accent); }

/* Rückmeldungen */
.alert {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); border: 1px solid; border-left-width: 4px;
}
.alert .icon { margin-top: 0.15em; width: 1.25rem; height: 1.25rem; }
.alert__title { font-weight: 700; display: block; }
.alert--success { color: var(--c-success); background: var(--c-success-bg); }
.alert--error   { color: var(--c-danger);  background: var(--c-danger-bg); }
.alert--warning { color: var(--c-warning); background: var(--c-warning-bg); }
.alert--info    { color: var(--c-info);    background: var(--c-info-bg); }
.alert p, .alert a { color: inherit; }

/* Formulare */
.field { display: grid; gap: var(--s-1); }
.field__label { font-weight: 650; }
.field__hint { color: var(--c-muted); font-size: var(--fs-sm); }
.field__error { color: var(--c-danger); font-size: var(--fs-sm); font-weight: 600; display: flex; gap: var(--s-1); align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: var(--s-2) var(--s-3);
  font: inherit; font-size: max(1rem, 16px); /* verhindert Zoom auf iOS */
  color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
}
.textarea { min-height: 6rem; resize: vertical; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; border-color: var(--c-focus); }
.field--invalid .input, .field--invalid .select, .field--invalid .textarea { border-color: var(--c-danger); border-width: 2px; }
.checkbox { display: flex; gap: var(--s-3); align-items: flex-start; min-height: var(--tap); padding-block: var(--s-2); cursor: pointer; }
.checkbox input { width: 1.375rem; height: 1.375rem; margin: 0.05rem 0 0; accent-color: var(--c-brand); flex: none; }
.form-actions { display: flex; flex-direction: column-reverse; gap: var(--s-2); margin-top: var(--s-5); }
@media (min-width: 40rem) { .form-actions { flex-direction: row; justify-content: flex-end; } }

/* Mengenwahl (−  2  +): große Touchflächen, funktioniert auch ohne JavaScript */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--c-border-strong); border-radius: var(--r-sm); background: var(--c-surface); overflow: hidden; }
.stepper button {
  width: var(--tap); min-height: var(--tap); border: 0; background: var(--c-surface-2); color: var(--c-text);
  font: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.stepper button:hover { background: var(--c-border); }
.stepper button:disabled { color: var(--c-border-strong); cursor: not-allowed; background: var(--c-surface-2); }
.stepper input {
  width: 3rem; border: 0; border-inline: 1px solid var(--c-border); text-align: center;
  font: inherit; font-size: max(1rem, 16px); font-weight: 700; font-variant-numeric: tabular-nums;
  background: transparent; color: var(--c-text); -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper:focus-within { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.stepper :focus-visible { outline: none; }

/* Angebotskarte */
.offer { display: grid; gap: var(--s-3); }
.offer__title { font-size: var(--fs-md); margin: 0; }
.offer__facts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); color: var(--c-muted); font-size: var(--fs-sm); margin: 0; padding: 0; list-style: none; }
.offer__facts li { display: inline-flex; gap: var(--s-1); align-items: center; }
.offer__mine { background: var(--c-surface-2); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); }

/* Artikelliste im Bestellformular */
.items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--c-border); }
.item { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name stepper" "price stepper"; gap: 0 var(--s-3); align-items: center; padding-block: var(--s-3); border-bottom: 1px solid var(--c-border); }
.item__name { grid-area: name; font-weight: 650; }
.item__price { grid-area: price; color: var(--c-muted); font-size: var(--fs-sm); }
.item .stepper { grid-area: stepper; }
.item--selected .item__name::after { content: " ✓"; color: var(--c-success); }

/* Fixe Aktionsleiste unten (Bestellsumme + Speichern) */
.action-bar {
  position: sticky; bottom: 0; z-index: 15; margin-inline: calc(-1 * var(--s-4));
  background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -4px 16px rgb(0 0 0 / 0.06);
  padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
}
.app-main--with-bottom-nav .action-bar { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
.action-bar__sum { display: grid; line-height: 1.2; }
.action-bar__sum strong { font-size: var(--fs-lg); }
@media (min-width: 48rem) {
  .action-bar { position: static; margin: var(--s-4) 0 0; border: 1px solid var(--c-border); border-radius: var(--r); box-shadow: none; }
  .app-main--with-bottom-nav .action-bar { bottom: auto; }
}

/* Kontostand */
.balance { display: grid; gap: var(--s-1); }
.balance__label { color: var(--c-muted); font-size: var(--fs-sm); font-weight: 600; }
.balance__value { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.balance__value--negative { color: var(--c-danger); }
.balance__value--positive { color: var(--c-success); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }

/* Zusammenfassung / Definitionslisten */
.summary { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-4); margin: 0; }
.summary dt { color: var(--c-muted); }
.summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summary__total { font-weight: 800; border-top: 1px solid var(--c-border); padding-top: var(--s-2); }

/* Tabellen: auf dem Smartphone als gestapelte Karten */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--s-3); text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.table th { font-size: var(--fs-sm); color: var(--c-muted); font-weight: 650; }
.table .num { text-align: right; }
@media (max-width: 39.99rem) {
  .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--stack tr { display: block; border: 1px solid var(--c-border); border-radius: var(--r-sm); margin-bottom: var(--s-3); background: var(--c-surface); }
  .table--stack td { display: flex; justify-content: space-between; gap: var(--s-3); border-bottom: 1px solid var(--c-border); }
  .table--stack td:last-child { border-bottom: 0; }
  .table--stack td::before { content: attr(data-label); color: var(--c-muted); font-weight: 600; }
  .table--stack .num { text-align: right; }
}

/* Leerer Zustand */
.empty { text-align: center; padding: var(--s-6) var(--s-4); color: var(--c-muted); border: 2px dashed var(--c-border); border-radius: var(--r); }
.empty .icon { width: 2.5rem; height: 2.5rem; margin-bottom: var(--s-2); color: var(--c-border-strong); }
.empty strong { display: block; color: var(--c-text); font-size: var(--fs-md); margin-bottom: var(--s-1); }

/* Hero / Begrüßung */
.hero { display: grid; gap: var(--s-3); padding: var(--s-6) 0 var(--s-4); }
.hero__kicker { color: var(--c-brand); font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-sm); }
.hero p { color: var(--c-muted); font-size: var(--fs-md); max-width: 40rem; }

/* Styleguide (nur Entwicklungsmodus) */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--s-3); }
.swatch { border: 1px solid var(--c-border); border-radius: var(--r-sm); overflow: hidden; background: var(--c-surface); font-size: var(--fs-sm); }
.swatch__chip { height: 3rem; }
.swatch__label { padding: var(--s-2); }
.sg-section { scroll-margin-top: calc(var(--header-h) + var(--s-3)); }
.swatch__chip--bg { background: var(--c-bg); }
.swatch__chip--surface { background: var(--c-surface); }
.swatch__chip--surface-2 { background: var(--c-surface-2); }
.swatch__chip--border { background: var(--c-border); }
.swatch__chip--border-strong { background: var(--c-border-strong); }
.swatch__chip--text { background: var(--c-text); }
.swatch__chip--muted { background: var(--c-muted); }
.swatch__chip--brand { background: var(--c-brand); }
.swatch__chip--brand-strong { background: var(--c-brand-strong); }
.swatch__chip--accent { background: var(--c-accent); }
.swatch__chip--success { background: var(--c-success); }
.swatch__chip--warning { background: var(--c-warning); }
.swatch__chip--danger { background: var(--c-danger); }
.swatch__chip--info { background: var(--c-info); }

/* ---------- Phase 2: Anmeldung, Profil, Verwaltung ---------- */

/* Anmeldeseiten: schmale, zentrierte Spalte */
.auth { max-width: 26rem; margin: var(--s-4) auto 0; display: grid; gap: var(--s-4); }
.auth__head { text-align: center; display: grid; gap: var(--s-2); justify-items: center; }
.auth__head h1 { margin: 0; }
.auth__head p { margin: 0; }
.auth__links { text-align: center; margin: 0; }
.auth__links a { display: inline-block; padding: var(--s-2); min-height: var(--tap); }
.auth__email { font-size: var(--fs-md); font-weight: 700; word-break: break-all; text-align: center; }
.checkbox--small { min-height: auto; padding-block: 0; font-size: var(--fs-sm); color: var(--c-muted); }
.checkbox--small input { width: 1.125rem; height: 1.125rem; }

/* Reiter der Verwaltung */
/* Reiter (zentral für alle Tab-Leisten): nie eigenes Scrollen. Alle Reiter
   bleiben sichtbar; passt die Zeile nicht, wird umgebrochen. Smartphone:
   kompakte „Pill“-Reiter über mehrere Zeilen, aktiver Reiter gefüllt.
   Desktop: Unterstrich-Reiter. */
.tabs { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 0; max-width: 100%; }
.tabs a {
  display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tap); min-width: 0; max-width: 100%;
  padding: var(--s-1) var(--s-3); color: var(--c-text); text-decoration: none; font-weight: 650; line-height: 1.25;
  border: 1px solid var(--c-border); border-radius: var(--r-pill); background: var(--c-surface); overflow-wrap: anywhere;
}
.tabs a:hover { border-color: var(--c-border-strong); color: var(--c-text); }
.tabs a[aria-current="page"] { color: var(--c-on-brand); background: var(--c-brand); border-color: var(--c-brand); }
@media (min-width: 40rem) {
  .tabs { gap: var(--s-1) var(--s-1); border-bottom: 1px solid var(--c-border); }
  .tabs a {
    padding: 0 var(--s-3); color: var(--c-muted); background: none; border: 0; border-radius: 0;
    border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
  }
  .tabs a:hover { color: var(--c-text); }
  .tabs a[aria-current="page"] { color: var(--c-brand); background: none; border-bottom-color: var(--c-brand); }
}

.back { margin: 0 0 var(--s-2); }
.back a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* Filter: mobil untereinander, breit nebeneinander */
.filter { display: grid; gap: var(--s-3); margin-bottom: var(--s-4); align-items: end; }
@media (min-width: 48rem) { .filter { grid-template-columns: 2fr 1fr auto auto; } .filter .checkbox { padding-bottom: 0; } }

/* Benutzerliste als große, tippbare Zeilen */
.user-list, .area-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.user-row {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name icon" "meta icon" "badges icon";
  gap: 2px var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); min-height: var(--tap);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm);
  color: inherit; text-decoration: none;
}
.user-row:hover { border-color: var(--c-border-strong); color: inherit; }
.user-row > .icon { grid-area: icon; color: var(--c-muted); }
.user-row__name { grid-area: name; font-weight: 700; }
.user-row__meta { grid-area: meta; color: var(--c-muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.user-row__badges { grid-area: badges; display: flex; flex-wrap: wrap; gap: var(--s-1); }
.user-row__badges:empty { display: none; }

/* Schlüssel-Wert-Liste */
.kv { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: var(--s-2) var(--s-4); margin: 0; }
.kv dt { color: var(--c-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd .badge { margin: 0 var(--s-1) var(--s-1) 0; }

/* Rechte-Tabelle: große Ankreuzflächen */
.rights th, .rights td { vertical-align: middle; }
.rights td { text-align: center; width: 6rem; }
.check-cell { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); cursor: pointer; }
.check-cell input { width: 1.375rem; height: 1.375rem; accent-color: var(--c-brand); }

.alert__list { margin: var(--s-2) 0 0; padding-left: 1.25rem; }
.input--short { max-width: 10rem; }
.inline-form { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.inline-form .input { flex: 1 1 12rem; }

/* Aufklappbereich */
.details summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--c-brand); font-weight: 650; }
.details[open] summary { margin-bottom: var(--s-2); }

/* E-Mail-Einstellungen je Kategorie (OWN01) */
.topics { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.topics li { border-bottom: 1px solid var(--c-border); padding-block: var(--s-1); }
.topics li:last-child { border-bottom: 0; }
.topic-fixed { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: var(--tap); padding-block: var(--s-2); }

/* ---------- Phase 3: Angebotsverwaltung ---------- */

/* Bereichsauswahl als große Ankreuzflächen */
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tap); padding: 0 var(--s-4);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-pill); background: var(--c-surface); cursor: pointer; font-weight: 600;
}
.chip input:checked + span { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.chip input:checked + span::before { content: "✓"; }
.chip input:focus-visible + span { outline: 3px solid var(--c-focus); outline-offset: 2px; }
fieldset[disabled] .chip span { opacity: .6; cursor: not-allowed; }

/* Artikel-Editor: mobil Name über Preis, ab Tablet nebeneinander */
.items-editor { display: grid; gap: var(--s-3); }
.item-edit { display: grid; grid-template-columns: 1fr 7rem; grid-template-areas: "name price" "desc desc" "hint hint" "active active"; gap: var(--s-2) var(--s-3);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--c-border); }
.item-edit__name { grid-area: name; }
.item-edit__price { grid-area: price; }
.item-edit__price .input { text-align: right; font-variant-numeric: tabular-nums; }
.item-edit__active { grid-area: active; }
.item-edit--inactive .input { color: var(--c-muted); text-decoration: line-through; }
.item-edit__desc { grid-area: desc; }
.input--sm { min-height: 2.5rem; font-size: var(--fs-sm); }
.item-edit__hint { grid-area: hint; display: flex; gap: var(--s-2); align-items: flex-start; margin: 0; padding: var(--s-2) var(--s-3);
  color: var(--c-warning); background: var(--c-warning-bg); border-radius: var(--r-sm); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.item-edit__hint svg { flex: none; margin-top: 0.15em; }
@media (min-width: 40rem) { .item-edit { grid-template-columns: 1fr 9rem auto; grid-template-areas: "name price active" "desc desc desc" "hint hint hint"; align-items: end; } .item-edit__active { padding-bottom: var(--s-2); } }
.item__desc { display: block; font-weight: 400; color: var(--c-muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.textarea--code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); line-height: 1.45; }
.textarea--code { min-height: 10rem; }
.code { margin: 0; padding: var(--s-3); background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-sm);
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.info-link { min-width: var(--tap); justify-content: center; }

/* Preisliste (nur lesend) */
.price-list { list-style: none; margin: 0; padding: 0; }
.price-list li { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); }
.price-list li:last-child { border-bottom: 0; }

/* Verlauf der Einkäufer */
.history { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s-1); }

/* Hervorgehobene Aktionskarte (Entwurf veröffentlichen) */
.action-card { border-color: var(--c-brand); border-width: 2px; margin-bottom: var(--s-5); }

.offer__title a { color: inherit; text-decoration: none; }
.offer__title a:hover { color: var(--c-brand); text-decoration: underline; }

/* ---------- Phase 8: Verwaltung, Archiv, Darstellung ---------- */
.num--neg { color: var(--c-danger); }
.kv--compact { grid-template-columns: minmax(5rem, auto) 1fr; gap: 0 var(--s-3); font-size: var(--fs-sm); }
.pager { margin-top: var(--s-4); }
a.balance { color: inherit; text-decoration: none; padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r); background: var(--c-surface); }
a.balance:hover { border-color: var(--c-border-strong); }
.theme-choice { display: flex; flex-wrap: wrap; gap: var(--s-2); border: 0; padding: 0; margin: 0; }
/* Mobil höchstens fünf Punkte unten; bei mehr Rollen sitzt „Profil“ als
   Symbol in der Kopfzeile. Beschriftungen kürzen statt umbrechen. */
.header-profile { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); color: var(--c-text); border-radius: var(--r-pill); }
.header-profile .icon { width: 1.5rem; height: 1.5rem; }
.bottom-nav a span { max-width: 100%; padding-inline: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 48rem) { .header-profile { display: none; } }
/* Schmale Bildschirme: kompakte Zellen in nicht gestapelten Tabellen
   (z. B. Einkaufsliste nach Artikeln), Beträge nicht umbrechen. */
@media (max-width: 39.99rem) {
  .table:not(.table--stack) th, .table:not(.table--stack) td { padding: var(--s-2) var(--s-1); }
  .table .num { white-space: nowrap; }
}

/* --- Einkaufsliste: Stand, Kennzahlen, Ausgabeliste, Druck --- */
.stand { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  border-left: 4px solid currentColor; margin-bottom: var(--s-4); }
.stand > div { display: grid; gap: var(--s-1); }
.stand svg { flex: none; margin-top: 0.2em; }
.stand span { color: var(--c-text); }
.stand--frozen { color: var(--c-info); background: var(--c-info-bg); }
.stand--live { color: var(--c-warning); background: var(--c-warning-bg); }
.stand--final { color: var(--c-success); background: var(--c-success-bg); }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis--3 .balance__value { font-size: clamp(1.1rem, 5vw, 1.6rem); white-space: nowrap; }
.table tfoot th, .table tfoot td { border-top: 2px solid var(--c-border-strong); }
.pickup { list-style: none; margin: 0; padding: 0; }
.pickup__entry { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); padding-block: var(--s-3); border-bottom: 1px solid var(--c-border); }
.pickup__entry:last-child { border-bottom: 0; }
.pickup__check { width: 1.6rem; height: 1.6rem; margin: 0.15rem 0 0; accent-color: var(--c-success); }
.pickup__body { display: grid; gap: var(--s-1); min-width: 0; }
.pickup__name { font-size: 1.15rem; font-weight: 700; }
.pickup__meta { color: var(--c-muted); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
.pickup__items { list-style: none; margin: 0; padding: 0; font-size: 1.05rem; }
.pickup__items li { padding-block: 0.1rem; overflow-wrap: anywhere; }
.pickup__note { margin: 0; font-size: var(--fs-sm); font-style: italic; overflow-wrap: anywhere; }
.pickup__entry:has(.pickup__check:checked) .pickup__body { opacity: 0.55; }
.buy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.buy-card { display: grid; gap: var(--s-2); }
.buy-card__head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; }
.buy-card__facts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.print-only { display: none; }
@media print {
  @page { margin: 12mm; }
  :root { color-scheme: light; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .app-header, .app-footer, .bottom-nav, .skip-link, .flash, .no-print, .tabs, .back { display: none !important; }
  .app-main, .app-main--with-bottom-nav { padding: 0 !important; }
  .card { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: none !important; }
  .stand, .balance { border: 1px solid #000 !important; background: none !important; color: #000 !important; }
  .stand span, .muted, .pickup__meta { color: #000 !important; }
  .print-only { display: block !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .pickup__entry, .table tr { break-inside: avoid; }
  .pickup__body { opacity: 1 !important; }
  .pickup__check { appearance: none; -webkit-appearance: none; border: 1.5px solid #000; border-radius: 3px; width: 1.1rem; height: 1.1rem; }
  section { break-inside: auto; }
  h2 { break-after: avoid; }
}


/* Unterfeld zu einer Checkbox (z. B. Vorlaufzeit der Erinnerung) */
.field--indent { margin: var(--s-2) 0 var(--s-2) 2rem; max-width: 22rem; }

/* Zeitauswahl in 5-Minuten-Schritten (Partial time5) */
.time5 { border: 0; padding: 0; margin: 0; min-width: 0; }
.time5__row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.time5__date { flex: 1 1 10rem; min-width: 0; }
.time5__clock { display: inline-flex; align-items: center; gap: var(--s-1); }
.time5__part { width: auto; min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.time5__unit { color: var(--c-muted); }
.time5[disabled] .select, .time5[disabled] .input { opacity: 0.7; }

/* Entwürfe (P85) */
.draft-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.draft { display: grid; gap: var(--s-3); }
.draft__head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; }
.draft__title { margin: 0; font-size: var(--fs-lg, 1.15rem); overflow-wrap: anywhere; }
.draft__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--s-2) var(--s-4); margin: 0; }
.draft__facts div { min-width: 0; }
.draft__facts dt { color: var(--c-muted); font-size: var(--fs-sm); }
.draft__facts dd { margin: 0; overflow-wrap: anywhere; }

/* Ganz anklickbare Karte („stretched link“): Genau ein Link je Karte
   (.tap-card__link) deckt mit ::after die ganze Fläche ab – für Maus,
   Touch und Stift gleich. Keine verschachtelten Links oder Buttons; weitere
   Bedienelemente bräuchten .tap-above. Tastatur: Tab auf den Link, Enter
   öffnet; der Fokusrahmen liegt um die ganze Karte. */
.tap-card { position: relative; }
.tap-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.tap-card:hover { border-color: var(--c-border-strong); box-shadow: var(--shadow-2); }
.tap-card:hover .tap-card__link { color: var(--c-brand); text-decoration: underline; }
.tap-card:active { border-color: var(--c-brand); }
.tap-above { position: relative; z-index: 2; }
@supports selector(:has(*)) {
  .tap-card__link:focus-visible { outline: none; }
  .tap-card:has(.tap-card__link:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
}
@media (prefers-reduced-motion: no-preference) { .tap-card { transition: border-color .12s ease, box-shadow .12s ease; } }

/* Angebotsdetail: Links zu Einkaufsliste/Abrechnung, Aktionspaar
   „Übersicht für Teilnehmer“ / „Anpassen“ (Smartphone untereinander,
   Desktop nebeneinander), deutlicher Abstand zur eigenen Bestellung. */
.offer-links { margin-bottom: var(--s-3); }
.action-pair { display: grid; grid-template-columns: 1fr; gap: var(--s-2); margin-bottom: var(--s-6); }
.action-pair .btn { justify-content: center; width: 100%; }
@media (min-width: 40rem) { .action-pair { grid-template-columns: repeat(auto-fit, minmax(14rem, max-content)); } .action-pair .btn { width: auto; } }
.offer-links + #bestellen, .offer-links + .action-pair + #bestellen { margin-top: var(--s-6); }
.secondary-actions { background: none; }

/* Preise hervorheben (Bestellformular und Artikelliste), gut lesbar auf
   allen Breiten; Summe bleibt am stärksten hervorgehoben. */
.item__price { color: var(--c-text); font-weight: 750; font-size: var(--fs-md, 1rem); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-list .price { font-weight: 750; white-space: nowrap; }
.action-bar__sum strong { font-weight: 800; }
.prewrap { white-space: pre-line; overflow-wrap: anywhere; margin: 0; }

/* Neues Angebot: Auswahl „Einmalig“ / „Serie“ (große Auswahlflächen) */
.art-choice { border: 1px solid var(--c-border); }
.art-choice legend { padding: 0 var(--s-1); }
.choice-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
@media (min-width: 40rem) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3); min-height: var(--tap);
  border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); cursor: pointer; }
.choice input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; accent-color: var(--c-brand); flex: none; }
.choice:has(input:checked) { border-color: var(--c-brand); box-shadow: inset 0 0 0 1px var(--c-brand); }
.choice:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.art-only { font-size: var(--fs-sm); font-weight: 600; vertical-align: middle; }

/* Kontostände, Kostenübernahme, ausgesetzte Serientermine */
.steps { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); padding-left: 1.25rem; margin: 0 0 var(--s-4); }
.steps li { margin-right: var(--s-2); }
.row--neg td:first-child { box-shadow: inset 3px 0 0 var(--c-danger, #b42318); }
.checkbox--disabled { cursor: not-allowed; color: var(--c-muted); }
.checkbox--disabled input { cursor: not-allowed; }
.skip-list .user-row__name s { color: var(--c-muted); }
.input--count { width: 4.5rem; display: inline-block; min-height: auto; padding-block: var(--s-1); }
.confirm-card { border-color: var(--c-warning, #b26b00); box-shadow: inset 4px 0 0 var(--c-warning, #b26b00); }
