/* Kistn App - gemeinsames Design fuer Tablet, Handy und Admin. */

/* Bernstein ist getrennt in drei Rollen: --accent ist ausschliesslich Flaeche,
   --on-accent die Schrift DARAUF, --accent-ink Bernstein ALS Schrift. Sonst
   landet man bei Weiss auf Bernstein und damit bei 2,9:1 Kontrast. */
:root {
  --bg: #f2eee4;
  --bg-glow: #fdfbf5;
  --surface: #fffdf9;
  --surface-2: #f7f3ea;
  --border: #e0d9c9;
  --hairline: rgba(255, 255, 255, .75);

  --text: #211d16;
  --muted: #6f675b;

  --accent: #c8871a;
  --accent-strong: #ad6f0c;
  --accent-ink: #8a5307;
  --accent-soft: #fbeed6;
  --accent-line: #e6d1a6;
  --on-accent: #241a09;

  --ok: #2a6f2e;
  --ok-soft: #e7f2e5;
  --warn: #8f5600;
  /* Fuellfarbe des Warnbalkens. Der alte Ton hatte gegen die Spur nur 1,76:1
     und war damit ausgerechnet im Zustand "wird knapp" kaum zu sehen. */
  --warn-fill: #9a6205;
  --track: #d9d1bd;
  --warn-soft: #fdf1dc;
  --danger: #a8261e;
  --danger-soft: #fbe9e6;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 1px rgba(60, 42, 16, .05), 0 2px 4px rgba(60, 42, 16, .05), 0 12px 28px rgba(60, 42, 16, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-glow: #221d15;
    --surface: #211d16;
    --surface-2: #2a251d;
    --border: #3b342a;
    --hairline: rgba(255, 240, 214, .06);
    --text: #f3ece0;
    --muted: #a99f8f;
    --accent: #dd9f37;
    --accent-strong: #eeb254;
    --accent-ink: #f0b455;
    --accent-soft: #362a15;
    --accent-line: #574326;
    --on-accent: #241a09;
    --ok: #74c477;
    --ok-soft: #1d2a1e;
    --warn: #e6ae51;
    --warn-fill: #e0a63f;
    --track: #4a4235;
    --warn-soft: #332818;
    --danger: #f08a80;
    --danger-soft: #3a201d;
    --shadow: 0 1px 1px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(1100px 620px at 50% -8%, var(--bg-glow), transparent 68%);
  background-attachment: fixed;
  color: var(--text);
  /* Ohne das laeuft aller Fliesstext mit ~1.2 - am Handy, wo fast jede Zeile
     umbricht, kleben die Zeilen dann aufeinander. */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Sicherheitsnetz: nichts soll die Seite seitlich schiebbar machen. */
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.75rem); }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
h3 { font-size: .95rem; }
p { margin: 0; }

button, input, select { font: inherit; color: inherit; }

/* width:100% ist noetig, weil .wrap im Kiosk ein Flex-Item ist - ohne die
   Breite wuerde "margin: 0 auto" es auf Inhaltsbreite zusammenschrumpfen. */
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
.wrap-narrow { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- Header */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 1px 14px rgba(60, 42, 16, .07);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  font-size: 1.05rem;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, var(--accent-soft), var(--surface-2) 78%);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* ---------------------------------------------------------------- Karten */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* Lichtkante oben - laesst die Karte gedruckt statt gezeichnet wirken und
   traegt vor allem den Dunkelmodus, wo Schatten fast unsichtbar sind. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--hairline);
  pointer-events: none;
}

.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* 44 px ist die Grenze, unter der Fingertippen unzuverlaessig wird. */
  min-height: 44px;
  touch-action: manipulation;
  padding: 11px 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}

.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent-strong); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { padding: 15px 22px; font-size: 1.05rem; border-radius: 13px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- Felder */

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select {
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  width: 100%;
}

input:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- Stat / Balken */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* Die grosse Zahl bekommt die volle Zeile, sonst bricht das Euro-Zeichen um.
   "1 / -1" statt "span 2": bei nur einer Spalte (schmale Geraete) wuerde
   "span 2" eine zweite Spalte erfinden und die Seite seitlich aufziehen. */
.stat:has(.stat-value.big) { grid-column: 1 / -1; }
.stat-value.big { white-space: nowrap; }

.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
/* Beträge sind auf jedem Bildschirm die Hauptsache - eigene Skala, gleiche
   Ziffernbreite, damit Spalten nicht zappeln. */
.stat-value {
  font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.02em;
  line-height: 1.05;
  margin-top: 6px;
}
.stat-value.big { font-size: clamp(2.6rem, 1.6rem + 4vw, 4rem); letter-spacing: -.035em; }
.stat.accent { background: var(--accent-soft); border-color: var(--accent-line); }
.stat.good .stat-value { color: var(--ok); }
.stat.warn { background: var(--warn-soft); border-color: var(--accent-line); }
.stat.warn .stat-value { color: var(--warn); }
.stat.bad { background: var(--danger-soft); border-color: var(--danger); }
.stat.bad .stat-value { color: var(--danger); }

.bar { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s ease; }
.bar.warn > span { background: var(--warn-fill); }
.bar.bad > span { background: var(--danger); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.badge-bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* ---------------------------------------------------------------- Listen */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.list-item.clickable:hover { background: var(--surface-2); }
.list-item.voided { opacity: .5; }
.list-item.voided .amount { text-decoration: line-through; }

.amount { font-variant-numeric: tabular-nums lining-nums; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.amount.pay { color: var(--ok); }

/* ---------------------------------------------------------------- Meldungen */

.msg { padding: 11px 13px; border-radius: 11px; font-weight: 600; border: 1px solid transparent; }
.msg-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.msg-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.msg-info { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* ---------------------------------------------------------------- Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow: auto;
  padding: 0 20px 20px;
}

/* Kopf bleibt stehen - im Detailfenster stehen bis zu 500 Buchungen. */
.modal-zu { flex: none; min-width: 44px; padding: 11px 12px; font-size: 1rem; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  padding: 16px 0 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ---------------------------------------------------------------- Tabs */

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  cursor: pointer;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }

/* ---------------------------------------------------------------- Kiosk */

.kiosk { min-height: 100vh; display: flex; flex-direction: column; }

/* Ruhebildschirm: mindestens eine Bildschirmhoehe, damit die Kartenleiste am
   Tablet ohne Scrollen sichtbar ist.
   Bewusst KEIN "height + overflow: hidden": passt der Inhalt nicht (Handy),
   laeuft der zentrierte Block sonst nach oben UND unten aus seinem Kasten und
   legt sich ueber die Schichtleiste. Lieber scrollen als ueberlappen. */
.kiosk.idle-mode { min-height: 100dvh; }

.idle {
  flex: 1 1 auto;
  min-height: 0;
  /* Verhindert, dass zentrierter Inhalt bei Platzmangel nach oben ausbricht. */
  overflow: hidden auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

/* Kartensymbol statt Emoji: ruhig, gezeichnet, ohne Bewegung. */
.idle-symbol {
  width: clamp(112px, 14vw, 156px);
  height: auto;
  display: block;
  opacity: .9;
}

.idle-symbol-karte {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 3.2;
}

.idle-symbol-chip {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2;
}

.idle-symbol-welle {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
}

.idle-title { font-size: clamp(1.7rem, 1.1rem + 2vw, 2.3rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.idle .muted { max-width: 34ch; }

/* Kleiner Schriftzug statt eines grossen Emojis - das Geraet soll sich
   zu erkennen geben, ohne sich in den Vordergrund zu draengen. */
.idle-marke {
  margin-top: 8px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
}

.sim-bar {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 16px;
}

/* Schichtleiste: wer darf gerade buchen. */
.shift-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.shift-bar.on { background: var(--accent-soft); border-bottom-color: var(--accent-line); }

.sim-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.badge-demo { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }

/* Fusszeile am Ruhebildschirm: haelt fest, dass kein echtes Geld fliesst, und
   ist der einzige Weg von der Tablet-Ansicht zu den anderen beiden. */
.kiosk-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
}
.kiosk-foot a { color: var(--accent-ink); font-weight: 650; }

.nav-link { text-decoration: none; color: inherit; }

.sim-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sim-card {
  min-height: 68px;
  padding: 16px 24px;
  border-radius: 16px;
  border: 2px dashed var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 650;
  font-size: 1.15rem;
  touch-action: manipulation;
}
.sim-card:hover { border-color: var(--accent); color: var(--accent-ink); }
.sim-card:active { transform: scale(.96); border-color: var(--accent); background: var(--accent-soft); }
/* Wer gerade bedient wird - waehrend der Schicht steht die Leiste unter der Sitzung. */
.sim-card.aktiv { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform .07s ease, border-color .15s ease, box-shadow .15s ease;
}
.tile:hover { border-color: var(--accent-line); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.tile:active { transform: scale(.96); border-color: var(--accent); background: var(--accent-soft); }
/* Nicht leistbar - sieht gesperrt aus, bleibt aber tippbar und erklärt sich. */
.tile-blocked { background: var(--surface-2); color: var(--muted); border-style: dashed; box-shadow: none; }
.tile-blocked .tile-emoji { filter: grayscale(1); opacity: .45; }
.tile-blocked .tile-price { color: var(--danger); background: var(--danger-soft); }

/* Bierdeckel unter dem Emoji: macht aus dem Platzhalter ein Produktbild. */
.tile-emoji {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  line-height: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, var(--accent-soft), var(--surface-2) 76%);
  box-shadow: inset 0 0 0 1px var(--accent-line), inset 0 -3px 8px rgba(60, 42, 16, .07);
}
.tile-name { font-weight: 650; text-align: center; line-height: 1.25; }
.tile-price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: .9rem;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 3px 10px;
}

.qty-row { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0; }
.qty-btn {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1.7rem;
  font-weight: 700;
  cursor: pointer;
}
.qty-btn:active { transform: scale(.95); }
.qty-value { font-size: 2.6rem; font-weight: 700; min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }

/* Untereinander: nebeneinander bricht die Reihe am Handy um und der Abbruch
   landet ueber der eigentlichen Aktion. */
.qty-actions { display: flex; flex-direction: column; gap: 10px; }

.flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}
.flash-mark { font-size: 4.5rem; }
.flash-title { font-size: 2rem; font-weight: 700; }
.flash.ok .flash-title { color: var(--ok); }
.flash.bad .flash-title { color: var(--danger); }

/* Bestätigung als schmale Leiste unten - blockiert den Bildschirm nicht. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--ok);
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
}

@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Der Haken soll aufpoppen - das ist die Rückmeldung, auf die alle warten. */
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.flash-mark { animation: pop .22s cubic-bezier(.2, 1.4, .4, 1); }

/* Tablet: Trefferflaechen und Schrift fuer einen Meter Abstand. Alles unter
   .kiosk gescoped, damit die Handy-Ansicht unveraendert bleibt. */
.kiosk .products { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kiosk .tile { min-height: 150px; }
.kiosk .tile-emoji { width: 88px; height: 88px; font-size: 3rem; }
.kiosk .tile-name { font-size: 1.25rem; }
.kiosk .tile-price { font-size: 1.05rem; }
.kiosk .btn { min-height: 56px; padding: 14px 20px; font-size: 1.05rem; }
.kiosk .qty-btn { width: 88px; height: 88px; font-size: 2.2rem; }
.kiosk .who { font-size: 1.45rem; font-weight: 700; }

/* Laufender Balken in der Topbar: zeigt, wie lange man noch angemeldet ist. */
.idle-countdown {
  position: absolute;
  left: 0;
  bottom: -3px;
  height: 3px;
  width: 100%;
  background: var(--accent-strong);
  transform-origin: left;
  animation: drain 45s linear forwards;
}

@keyframes drain { to { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .flash-mark { animation: none; }
}

/* ---------------------------------------------------------------- PIN-Pad */

.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pin-key {
  min-height: 64px;
  padding: 18px 0;
  font-size: 1.4rem;
  font-weight: 650;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  /* Ohne das loest ein schnelles Doppeltippen derselben Ziffer (PIN 1122)
     den Doppeltipp-Zoom von iOS aus. */
  touch-action: manipulation;
  user-select: none;
}
.pin-key:active { transform: scale(.96); background: var(--surface-2); }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border); }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- Tabelle */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

.footnote { margin-top: 18px; text-align: center; color: var(--muted); font-size: .8rem; padding-bottom: 24px; }

/* Einordnender Hinweis auf den Startbildschirmen ("Probeversion", "kein echtes
   Geld"). Ohne diese Regel stand der Text unformatiert im Raum. */
.note {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
  font-size: .88rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- Anmeldung am Handy */

.anmelde-kopf { text-align: center; padding: 26px 0 20px; }
.anmelde-kopf h1 { margin-top: 12px; }
.anmelde-kopf p { margin-top: 6px; max-width: 30ch; margin-left: auto; margin-right: auto; }

.anmelde-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, var(--accent-soft), var(--surface-2) 76%);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.people { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* Ganze Zeile ist ein Knopf - am Handy zaehlt die Trefferflaeche, nicht der Text. */
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .06s ease, border-color .15s ease, background .15s ease;
}

.person:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.person:active { transform: scale(.985); border-color: var(--accent); }

.person-mark {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  color: var(--accent-ink);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.person-pfeil { color: var(--muted); font-size: 1.2rem; }

/* ---------------------------------------------------------------- Hero-Zahl */

/* Die eine Zahl, die zaehlt: im Admin der Gesamtstand, am Handy die eigene
   Schuld. Alles andere ordnet sich darunter ein. */
.hero { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); padding: 18px; text-align: center; }
.hero-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.hero-value { font-size: clamp(2.6rem, 1.6rem + 4vw, 4rem); font-weight: 800; line-height: 1.05; letter-spacing: -.035em; font-variant-numeric: tabular-nums lining-nums; margin: 4px 0 2px; }
.hero-sub { font-size: .88rem; color: var(--muted); }
.hero.warn { background: var(--warn-soft); }
.hero.warn .hero-value { color: var(--warn); }
.hero.bad { background: var(--danger-soft); border-color: var(--danger); }
.hero.bad .hero-value { color: var(--danger); }

.delta { font-weight: 650; }
.delta.up { color: var(--danger); }
.delta.down { color: var(--ok); }

.spark { display: block; width: 100%; height: 44px; margin-top: 12px; }
.spark-line { fill: none; stroke: var(--accent-ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-fill { fill: var(--accent); opacity: .16; }

/* ---------------------------------------------------------------- Monate / Leerzustand */

.month > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px 4px;
  font-weight: 650;
  border-bottom: 1px solid var(--border);
  list-style: none;
}
.month > summary::-webkit-details-marker { display: none; }
.month > summary::after { content: '▾'; color: var(--muted); transition: transform .15s ease; }
.month[open] > summary::after { transform: rotate(180deg); }

.empty { text-align: center; padding: 28px 12px; }
.empty-mark { font-size: 2.4rem; }

/* ---------------------------------------------------------------- Handy */

@media (max-width: 560px) {
  .wrap, .wrap-narrow { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* Seiten ohne Kopfleiste (Anmeldung, PIN) liegen sonst unter der Statusleiste. */
  .wrap-narrow { padding-top: calc(16px + env(safe-area-inset-top)); }
  .topbar + .wrap-narrow, .topbar + .wrap { padding-top: 16px; }

  /* Listenzeilen: der Textblock bekommt die erste Zeile mit dem Betrag,
     Kennzeichen und Knoepfe rutschen darunter. Ohne das laufen die Zeilen
     ueber die Bildschirmbreite hinaus und die Seite wird seitlich schiebbar. */
  .list-item { flex-wrap: wrap; row-gap: 8px; padding-top: 13px; padding-bottom: 13px; }
  .list-item > .grow { flex: 1 1 60%; min-width: 0; }
  .list-item > .amount { flex: 0 0 auto; margin-left: auto; }
  .list-item > .btn { flex: 0 1 auto; }
  .list-item > input { flex: 1 1 100%; width: 100%; }
  .list-item .row { flex-wrap: wrap; }
  .badge { white-space: nowrap; }

  /* Fuenf Reiter passen nicht in eine Zeile - festes Raster statt Ausfransen. */
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tab { min-height: 44px; padding: 11px 6px; border-color: var(--border); }

  /* Detailfenster als Blatt von unten, mit begrenztem Mitscrollen dahinter. */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overscroll-behavior: contain;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  /* Im Detailfenster stapeln sich die drei Kennzahlen sonst untereinander und
     schieben die Zahlungseingabe aus dem Bild. Kurze Betraege passen zu dritt. */
  .modal .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .modal .stat { padding: 10px; }
  .modal .stat-label { font-size: .62rem; letter-spacing: .06em; }
  .modal .stat-value { font-size: 1.05rem; margin-top: 3px; }

  /* Schnellbetraege: die festen Betraege nebeneinander, der wichtigste Knopf
     ganz breit. Reihenfolge zaehlt - beide Regeln sind gleich spezifisch,
     die spaetere gewinnt, deshalb steht btn-primary hier unten. */
  .row-wrap > .btn { flex: 1 1 30%; }
  .row-wrap > .btn-primary { flex: 1 1 100%; }

  /* Produkttabelle: gestapelt statt seitwaerts scrollen. Die Knoepfe lagen
     vorher rund 280 px ausserhalb des Bildschirms. */
  .table-scroll table, .table-scroll tbody { display: block; }
  .table-scroll tr {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .table-scroll td { display: block; border: 0; padding: 0; white-space: normal; }
  .table-scroll td:nth-child(2) { font-weight: 650; }
  .table-scroll td:nth-child(3) input { width: 100%; }
  .table-scroll td:nth-child(4), .table-scroll td:nth-child(5) { grid-column: span 1; }
  .table-scroll td .btn { width: 100%; }

  .pinpad { max-width: 320px; gap: 12px; }

  /* Ziffernfeld in die untere Bildschirmhaelfte: dort erreicht der Daumen
     auch die Reihe 1-2-3, ohne dass man das Handy umgreifen muss. */
  .pin-screen { min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; }

  /* Produktkacheln: die Tablet-Maße (minmax 190px) ergeben am Handy eine
     einzige Spalte - 12 Getraenke wurden dadurch zu 4000 px Scrollstrecke.
     Zwei Spalten mit kleineren Medaillons passen bequem. */
  .products, .kiosk .products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kiosk .tile { min-height: 0; padding: 14px 8px 12px; }
  .kiosk .tile-emoji { width: 60px; height: 60px; font-size: 2rem; }
  .kiosk .tile-name { font-size: 1rem; }
  .kiosk .tile-price { font-size: .88rem; }
  .kiosk .stat-value.big { font-size: 2.1rem; }

  /* Die wichtigste Zahl nach oben und ueber die volle Breite, die beiden
     Nebenwerte darunter nebeneinander. Sonst entsteht eine Treppe aus drei
     vollbreiten Kaesten. */
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:has(.stat-value.big) { order: -1; }
  .kiosk .who { font-size: 1.15rem; }

  /* Ruhebildschirm zusammenziehen: die Tablet-Maße kosten am Handy ~130 px,
     die woanders fehlen. */
  .idle { padding: 16px; gap: 12px; }
  .idle-symbol { width: 76px; }
  .idle-title { font-size: 1.5rem; }

  /* Kartenknoepfe zweispaltig statt acht Reihen untereinander. */
  .sim-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sim-card {
    min-height: 54px;
    padding: 12px 10px;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Die Fusszeile ist der einzige Weg zu den anderen Ansichten - sie darf
     nicht ganz unten hinter der Kartenliste verschwinden. */
  .kiosk-foot { position: sticky; bottom: 0; z-index: 10; }
  .kiosk-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: .95rem; }

  .row { flex-wrap: wrap; }
}

/* Sichere Bereiche am unteren Rand: sonst liegen Knopf und Meldung unter dem
   Home-Indikator, wo iOS die Wischgeste abfaengt. */
.flash { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
.footnote { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
