/* Flohmarkt-Kasse — Oberfläche für die Bedienung mit einer Hand,
   im Stehen, bei Sonnenlicht, mit einem wartenden Käufer davor.
   Deshalb: große Flächen, starke Kontraste, wenig Text. */

:root {
  color-scheme: light dark;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --ink: #15181d;
  --ink-soft: #5c6470;
  --line: #dde1e7;
  --accent: #14724e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ea;
  --danger: #a3232b;
  --danger-soft: #fbe9ea;
  --warn: #8a5a00;
  --warn-soft: #fdf3dd;

  --p-teal: #0f766e;
  --p-rose: #b03060;
  --p-amber: #a2650a;
  --p-violet: #6b3fa0;
  --p-sky: #12609a;
  --p-lime: #4d7016;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 5%);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Dark-Mode in Scalable-Capital-Farben: helles Smaragd/Mint (#28EBCF) auf
   Fast-Schwarz. Akzenttext bleibt dunkel, damit er auf dem hellen Mint lesbar ist.
   Gilt automatisch bei System-Dark (solange keine manuelle Wahl getroffen ist)
   UND wenn per Einstellungen [data-theme="dark"] gesetzt wurde. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #101112;
    --surface: #191a1c;
    --surface-2: #232529;
    --ink: #f2f4f5;
    --ink-soft: #9aa1a8;
    --line: #2c2f33;
    --accent: #28ebcf;
    --accent-ink: #05231e;
    --accent-soft: #10312c;
    --danger: #f0757e;
    --danger-soft: #2c1618;
    --warn: #e0b050;
    --warn-soft: #2b2210;

    --p-teal: #3fd6c4;
    --p-rose: #ef7ba4;
    --p-amber: #dfa63c;
    --p-violet: #ab8ce0;
    --p-sky: #5cb0ec;
    --p-lime: #9bc75a;
  }
}
:root[data-theme="dark"] {
  --bg: #101112;
  --surface: #191a1c;
  --surface-2: #232529;
  --ink: #f2f4f5;
  --ink-soft: #9aa1a8;
  --line: #2c2f33;
  --accent: #28ebcf;
  --accent-ink: #05231e;
  --accent-soft: #10312c;
  --danger: #f0757e;
  --danger-soft: #2c1618;
  --warn: #e0b050;
  --warn-soft: #2b2210;

  --p-teal: #3fd6c4;
  --p-rose: #ef7ba4;
  --p-amber: #dfa63c;
  --p-violet: #ab8ce0;
  --p-sky: #5cb0ec;
  --p-lime: #9bc75a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  /* Die App füllt immer genau den Bildschirm; gescrollt wird nur innerhalb der
     dafür vorgesehenen Bereiche (Inhalt/Positionsliste), nie die Seite selbst. */
  overflow: hidden;
  overscroll-behavior-y: contain;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

/* ------------------------------------------------------------------ Gerüst */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;          /* Fallback für ältere Browser */
  height: 100dvh;         /* dynamische Viewporthöhe (mobile Browserleisten) */
  overflow: hidden;
  padding-top: var(--safe-t);
}

/* Auf Tablet/Desktop die App als zentrierte, angenehm breite Spalte zeigen —
   die einhändig-optimierte Ein-Spalten-Bedienung bleibt, wirkt aber nicht
   verloren auf großen Bildschirmen. */
@media (min-width: 720px) {
  body { background: var(--surface-2); }
  #app {
    max-width: 560px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line);
  }
  #toast { left: 50%; right: auto; transform: translateX(-50%); width: min(536px, calc(100% - 24px)); }
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.appbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.appbar__title { flex: 1; min-width: 0; }
.appbar__title h1 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar__title p {
  margin: 1px 0 0;
  font-size: .8rem;
  color: var(--ink-soft);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 1.15rem;
  flex: 0 0 auto;
  /* Der Zurück-Knopf ist ein Link und würde sonst die Browser-Linkfarbe erben. */
  color: var(--ink);
  text-decoration: none;
}
.iconbtn:active { background: var(--line); }
.iconbtn--sm { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; flex: 0 0 auto; }

.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px calc(20px + var(--safe-b));
}

.body--flush { padding: 0 0 var(--safe-b); }

/* ------------------------------------------------------------- Sync-Anzeige */

.sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--ink-soft);
  flex: 0 0 auto;
}
.sync--offline { background: var(--warn-soft); color: var(--warn); }
.sync--pending { background: var(--accent-soft); color: var(--accent); }
.sync--ok { background: var(--accent-soft); color: var(--accent); }
.sync--busy .sync__dot { animation: pulse 1.1s ease-in-out infinite; }
.sync__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
@keyframes pulse { 50% { opacity: .25; } }

/* --------------------------------------------------------------- Bausteine */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card--tap { display: block; width: 100%; text-align: left; }
.card--tap:active { background: var(--surface-2); }

.section-title {
  margin: 22px 2px 8px;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.section-title:first-child { margin-top: 4px; }

/* Aufklappbarer Abschnitt (z. B. Rechte) — Zusammenfassung sieht aus wie ein
   Abschnittstitel, ist aber antippbar. */
.disclosure__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.disclosure__summary::-webkit-details-marker { display: none; }
.disclosure__summary::before {
  content: "▸";
  font-size: .8em;
  transition: transform .15s ease;
}
.disclosure[open] .disclosure__summary::before { transform: rotate(90deg); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 1rem;
}
.btn:active { transform: scale(.985); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--big { min-height: 64px; font-size: 1.15rem; }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--ghost { background: none; border: 1.5px solid var(--line); }
.btn[disabled] { opacity: .4; pointer-events: none; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-soft);
}
.empty__icon { font-size: 2.4rem; }

/* ------------------------------------------------- Verkäufer-Umschalter */

.sellers {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sellers--2 { grid-template-columns: 1fr 1fr; }
.sellers--many { grid-auto-flow: column; grid-auto-columns: minmax(88px, 1fr); overflow-x: auto; }

.seller {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.seller small { font-weight: 600; font-size: .72rem; opacity: .8; }
.seller[aria-pressed="true"] {
  border-color: var(--seller);
  background: var(--seller);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .seller[aria-pressed="true"] { color: #0d1014; }
}
:root[data-theme="dark"] .seller[aria-pressed="true"] { color: #0d1014; }

.dot-teal   { --seller: var(--p-teal); }
.dot-rose   { --seller: var(--p-rose); }
.dot-amber  { --seller: var(--p-amber); }
.dot-violet { --seller: var(--p-violet); }
.dot-sky    { --seller: var(--p-sky); }
.dot-lime   { --seller: var(--p-lime); }
.dot-none   { --seller: var(--ink-soft); }

.chip-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--seller, var(--ink-soft));
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ Kasse */

.register { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Ziffernfeld und Aktionsleiste bleiben unten stehen; alles darüber scrollt.
   So ist die Kasse auch auf kleinen Displays vollständig bedienbar. */
.register__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
/* Auf großen Displays sammelt sich der Inhalt unten am Ziffernfeld statt oben
   wegzuwandern — alles bleibt in Daumenreichweite. margin-top:auto statt
   justify-content:flex-end, weil letzteres beim Überlaufen oben abschneidet. */
.register__inner { margin-top: auto; }

.amount {
  padding: 14px 16px 10px;
  text-align: center;
}
.amount__value {
  font-size: clamp(2.6rem, 15vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.amount__value--empty { color: var(--line); }
.amount__hint { margin-top: 4px; font-size: .84rem; color: var(--ink-soft); }

.positions {
  margin: 0 12px 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.position {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  font-size: .9rem;
}
.position + .position { border-top: 1px solid var(--line); }

/* Feste Geld-Eingabemaske auf dem Bezahlscreen: bleibt unten stehen, während der
   Bereich darüber (Positionen) scrollt. Auf sehr kleinen Displays darf sie zur
   Not selbst scrollen, damit „Buchen" nie verdeckt wird. */
.paydock {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 10px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
/* Im festen Dock etwas kompakter, damit oben mehr Platz für die Positionen bleibt. */
.paydock .change { margin-bottom: 8px; padding: 9px 16px; }
.paydock .change__value { font-size: 1.8rem; }
.position__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position__price { font-weight: 800; font-variant-numeric: tabular-nums; }
.position__del { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); font-size: .95rem; }

.quickrow {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 12px 10px;
  scrollbar-width: none;
}
.quickrow::-webkit-scrollbar { display: none; }
.quickchip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: .87rem;
  font-weight: 600;
}
.quickchip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 12px;
}
.key {
  min-height: 58px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
}
.key:active { background: var(--accent-soft); transform: scale(.97); }
.key--soft { font-size: 1.2rem; color: var(--ink-soft); }

.actionbar {
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr;
  padding: 8px 12px calc(10px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.actionbar--single { grid-template-columns: 1fr; }

.detailrow {
  display: flex;
  gap: 7px;
  padding: 0 12px 8px;
}
.detailrow .quickchip { flex: 1; text-align: center; }

.detailbox {
  margin: 0 12px 10px;
  padding: 12px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.detailbox .field:last-child { margin-bottom: 0; }

.thumb {
  width: 46px; height: 46px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-2);
  flex: 0 0 auto;
}

/* ------------------------------------------------------------- Bezahlen */

.pay { padding: 12px; }

.pay__lines {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.pay__line { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; }
.pay__line b { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.pay__line--total b { font-size: 1.35rem; }

.change {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  text-align: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid transparent;
}
.change--short { background: var(--warn-soft); color: var(--warn); }
.change--exact { background: var(--surface-2); color: var(--ink-soft); }
.change__label {
  font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  opacity: .85;
}
.change__value {
  font-size: clamp(2.4rem, 13vw, 3.2rem);
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.change__hint { font-size: .84rem; font-weight: 600; }

.denoms__label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 2px 2px 6px;
}
.denoms__label:not(:first-child) { margin-top: 10px; }
/* Labelzeile mit Aktion rechts (z. B. „Löschen" neben MÜNZEN). */
.denoms__label--row { display: flex; align-items: center; justify-content: space-between; }
.denoms__label--row .quickchip { text-transform: none; letter-spacing: normal; padding: 5px 12px; font-size: .8rem; }

.bills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
/* Roter Löschen-Baustein im freien sechsten Slot des Scheine-Rasters. */
.denom-clear {
  border-radius: 11px;
  border: 2px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  font-size: .95rem;
  min-height: 0;
}
.denom-clear:active { transform: scale(.95); }
.billbtn {
  padding: 0;
  border-radius: 11px;
  overflow: hidden;
  background: none;
  line-height: 0;
  border: 2px solid transparent;
}
.billbtn:active { transform: scale(.95); border-color: var(--accent); }
.billbtn svg { width: 100%; height: auto; display: block; }

.coins {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  justify-items: center;
  margin-top: 10px;
}
.coinbtn { padding: 0; background: none; line-height: 0; border-radius: 50%; }
.coinbtn:active { transform: scale(.92); }
.coinbtn svg { width: 100%; height: auto; max-width: 72px; margin: 0 auto; display: block; }


/* Fortschrittsbalken „bis die Standgebühr drin ist". */
.goalbar {
  height: 10px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 9px 0;
}
.goalbar__fill {
  display: block;
  height: 100%;
  background: var(--ink-soft);
  border-radius: 6px;
  transition: width .3s ease;
}
.goalbar__fill--done { background: var(--accent); }

/* Suchfeld in der Verkaufsliste. */
.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.searchbar__icon { flex: 0 0 auto; opacity: .6; }
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 1rem;
}
.searchbar__clear {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: .85rem;
}

/* Artikeldatenbank-Zeile. */
.artrow {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: none;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.artrow:first-child { border-top: 0; }
.artrow__nr { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); min-width: 3.4em; }
.artrow__main { flex: 1; min-width: 0; }
.artrow__title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artrow__price { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- Etikettendruck */
/* Ein A4-Blatt in echten Millimetern; Etiketten absolut positioniert. */
.print-sheet {
  position: relative;
  width: 210mm; height: 297mm;
  background: #fff;
  page-break-after: always;
  overflow: hidden;
}
.print-label {
  position: absolute;
  display: flex; align-items: center; gap: 1mm;
  padding: 0.8mm; box-sizing: border-box;
  color: #000;
}
.print-label svg { height: 100%; width: auto; display: block; }
.print-label__nr { font: 700 10pt/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .5px; }

/* Verkleinerte Bildschirm-Vorschau (ein Blatt), damit es aufs Handy passt. */
.label-preview {
  overflow: hidden;
  height: calc(297mm * .42);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.label-preview .print-sheet {
  transform: scale(.42);
  transform-origin: top left;
  page-break-after: initial;
}

/* ------------------------------------------------------------- QR-Scanner */
.scanner {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.scanner__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner__frame {
  position: relative;
  width: min(70vw, 260px); aspect-ratio: 1;
  border: 3px solid #ffffff;
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.scanner__hint {
  position: absolute; bottom: 22%; left: 0; right: 0;
  text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.scanner__actions {
  position: absolute; bottom: calc(24px + var(--safe-b)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.scanner__manual, .scanner__cancel {
  padding: 13px 26px; border-radius: 999px;
  font-weight: 700; font-size: 1rem;
  min-width: min(70vw, 280px);
}
.scanner__manual { background: #fff; color: #111; }
.scanner__cancel { background: rgba(255, 255, 255, .18); color: #fff; }

/* Gedruckt wird über ein eigenständiges iframe-Dokument (views/etiketten.js) —
   die App selbst braucht keine Print-Sonderbehandlung mehr. */

/* Kassensturz-Zählbrett */
.count-row {
  display: grid;
  grid-template-columns: 3.6em 1fr 1fr 4.4em;
  gap: 8px;
  align-items: end;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.count-row:first-child { border-top: 0; }
.count-row__val { font-weight: 700; font-variant-numeric: tabular-nums; align-self: center; }
.count-row__in { font-size: .68rem; color: var(--ink-soft); }
.count-row__in span { display: block; margin-bottom: 2px; }
.count-row__in input {
  width: 100%; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--bg); text-align: center; font-variant-numeric: tabular-nums;
}
.count-row__sum { align-self: center; text-align: right; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Zahlart-Umschalter (Bar / PayPal) auf dem Bezahlscreen. */
.paymethods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
/* Fester Zahlart-Umschalter oben auf dem Bezahlscreen. */
.paybar { flex: 0 0 auto; padding: 10px 12px 2px; }
.paybar .paymethods { margin-bottom: 8px; }
.paymethod {
  min-height: 48px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 1rem;
}
.paymethod[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.paypal-pay {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
}
/* QR klein genug, dass der Bezahlscreen nie scrollt — auf kurzen Displays
   schrumpft er weiter (22vh), bleibt aber problemlos scanbar. */
.paypal-pay__qr {
  width: min(180px, 22vh);
  max-width: 70vw;
  aspect-ratio: 1;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
}
/* PayPal-Karte lebt im festen Dock — dort ohne Rahmen doppelt gemoppelt. */
.paydock--paypal { padding: 10px 12px; }
.paydock--paypal .paypal-pay { margin-top: 0; border: 0; padding: 4px 0 0; background: none; }

/* Auffällige Preis-Hinweise unter dem Betrag (Wunschpreis + Schmerzgrenze). */
.pricehints {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 10px;
}
.pricehint {
  padding: 6px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .95rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.pricehint--min {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn);
}
.paypal-pay__qr svg { width: 100%; height: 100%; display: block; }
.paypal-pay .btn { align-self: stretch; }

.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 2px 0; }
.chart { display: block; }

.statfilter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.statfilter .quickchip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.statfilter__custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.statfilter__custom input[type="date"] {
  padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink);
}

/* ------------------------------------------------------- Verkaufsliste */

.daygroup { margin-bottom: 18px; }
.daygroup__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 6px;
  font-size: .8rem; font-weight: 800; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em;
}

.sale {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
}
.sale:active { background: var(--surface-2); }
.sale--voided { opacity: .5; }
.sale--voided .sale__total { text-decoration: line-through; }
.sale--pending { border-style: dashed; }

.sale__bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--seller, var(--ink-soft)); flex: 0 0 auto; }
.sale__main { flex: 1; min-width: 0; }
.sale__title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale__meta { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale__total { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* --------------------------------------------------------- Auswertung */

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}
.kpi--wide { grid-column: 1 / -1; }
.kpi__label { font-size: .76rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.kpi__value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi__value--xl { font-size: 2.1rem; }
.kpi__sub { font-size: .82rem; color: var(--ink-soft); }

.share {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0;
}
.share + .share { border-top: 1px solid var(--line); }
.share__bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
/* display:block ist nötig: als Inline-Element (span) würden Höhe und Breite
   ignoriert und der Balken bliebe unsichtbar. */
.share__fill { display: block; height: 100%; background: var(--seller, var(--accent)); border-radius: 4px; }
.share__name { width: 5.5em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share__value { width: 5.5em; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.timeline { display: flex; align-items: flex-end; gap: 3px; height: 76px; margin-top: 8px; }
.timeline__bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.timeline__axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-soft); margin-top: 4px; }

.balance { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; }
.balance + .balance { border-top: 1px dashed var(--line); }
.balance b { font-variant-numeric: tabular-nums; }
.balance--result { font-size: 1.05rem; }

/* -------------------------------------------------------------- Hinweise */

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: .9rem;
  background: var(--warn-soft);
  color: var(--warn);
}
.banner--danger { background: var(--danger-soft); color: var(--danger); }
.banner--info { background: var(--accent-soft); color: var(--accent); }
.banner b { display: block; }

/* ----------------------------------------------------------------- Toast */

#toast {
  position: fixed;
  left: 12px; right: 12px;
  /* Hoch genug, um die Aktionsleiste der Kasse nicht zu verdecken — der
     „Rückgängig“-Knopf im Toast muss antippbar bleiben. */
  bottom: calc(88px + var(--safe-b));
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 8px 28px rgb(0 0 0 / 26%);
  font-weight: 600;
  pointer-events: auto;
  animation: rise .2s ease-out;
}
.toast__action {
  margin-left: auto;
  padding: 7px 12px;
  border-radius: 9px;
  background: rgb(255 255 255 / 16%);
  color: inherit;
  font-weight: 800;
  flex: 0 0 auto;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* ---------------------------------------------------------------- Dialog */

/* Zentrierter Dialog (kein Swipe-up mehr): ruhig eingeblendet, auf allen
   Bildschirmgrößen mittig, mit begrenzter Breite und innen scrollbar. */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(0 0 0 / 45%);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 28%);
  animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.sheet h2 { margin: 0 0 14px; font-size: 1.15rem; }

/* ------------------------------------------------------------- Anmeldung */

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-b));
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.login__logo { font-size: 3rem; text-align: center; }
.login h1 { text-align: center; margin: 6px 0 4px; font-size: 1.5rem; }
.login p.lead { text-align: center; color: var(--ink-soft); margin: 0 0 24px; }

/* ------------------------------------------------------------ Nutzerliste */

.user { display: flex; align-items: center; gap: 11px; padding: 11px 0; }
.user + .user { border-top: 1px solid var(--line); }
.user__main { flex: 1; min-width: 0; }
.user__name { font-weight: 700; }
.user__mail { font-size: .82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.tag {
  font-size: .7rem; font-weight: 800; padding: 3px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .05em;
}
.tag--admin { background: var(--accent-soft); color: var(--accent); }
.tag--off { background: var(--danger-soft); color: var(--danger); }

.linkbox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  word-break: break-all;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px;
  margin-bottom: 10px;
}

@media (min-width: 620px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .bills { grid-template-columns: repeat(5, 1fr); }
  .coins { grid-template-columns: repeat(6, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
