/* Lager-App Hupe Haustechnik – Basis und Handy-Ansicht (iPhone zuerst, Vollbild).
   Look des Hupe-Dashboards: ruhig, hell, weiche Karten ohne Rahmen auf hellgrauem Grund, durchscheinende Leisten, runde Knöpfe.
   Farbrollen: Orange = Abgang (Entnommen), Blau = Zugang (Einlagern, Wareneingang), Violett = Zählung (Zählen, Leer/fehlt),
   Grün = Marke und Scannen; Grau = neutral. Alle Werte kommen aus tokens.css. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--ground); color: var(--ink);
  font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
h1, h2, h3 { letter-spacing: -.02em; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 700; margin: 8px 0 16px; }
h2 { font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink-2); margin: 24px 0 8px; letter-spacing: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
b, strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.nur-lesegeraet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Farbrollen ---- */
.rolle-abgang  { --brand: var(--orange); --rolle-text: var(--orange-text); --rolle-soft: var(--orange-soft); }
.rolle-zugang  { --brand: var(--blau);   --rolle-text: var(--blau-text);   --rolle-soft: var(--blau-soft); }
.rolle-zaehlung { --brand: var(--lila);  --rolle-text: var(--lila-text);   --rolle-soft: var(--lila-soft); }
.rolle-neutral { --rolle-text: var(--ink-2); --rolle-soft: var(--fill); }

/* ---- Kopfzeile: durchscheinend, mit Logo ---- */
.kopf {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--bar); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .kopf, .tabbar { background: var(--surface); } }
.marke { display: inline-flex; align-items: center; line-height: 0; }
.marke img { height: 28px; width: auto; }
.logo-hell { display: var(--logo-hell); }
.logo-dunkel { display: var(--logo-dunkel); }
.wer { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inhalt { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.inhalt--voll { max-width: none; padding: 0; }

/* ---- Symbole und runde Symbolfläche ---- */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-full);
  background: var(--rolle-soft, var(--surface-2)); color: var(--rolle-text, var(--ink-2));
}
.chip--gruen { background: var(--brand); color: var(--on-brand); }
.seitenkopf { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.seitenkopf h1 { margin: 0; }
.seitenkopf__text { display: flex; flex-direction: column; min-width: 0; }
.untertitel { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ---- Tab-Leiste unten (Grundmenü) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; min-height: 48px; padding: 4px 0;
  border-radius: var(--r-m); color: var(--ink-3); text-decoration: none; font-size: 12px; font-weight: 600; line-height: 1.2;
  transition: color var(--t-fast);
}
.tabbar a:hover { color: var(--ink); }
.tabbar a.aktiv { color: var(--ink); font-weight: 700; }
.tabbar a.aktiv .icon { stroke-width: 2.25; }
.tabbar .scan__kreis {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: -14px; border-radius: var(--r-full);
  background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-2);
}
.tabbar .scan.aktiv .scan__kreis { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-2); }

/* ---- Knöpfe: Pille. Die Hauptaktion trägt die Farbe der Seite (Standard Marken-Grün), alles Weitere ist grau ---- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none;
  min-height: 44px; padding: 8px 20px; margin-top: 16px; border: 0; border-radius: var(--r-full); cursor: pointer;
  background: var(--brand); color: var(--on-brand); font: inherit; font-size: 16px; font-weight: 700;
  transition: background var(--t-fast), transform var(--t-fast), filter var(--t-fast);
}
.knopf:hover { filter: brightness(.94); }
.knopf:active { transform: scale(.98); }
.knopf.gross { width: 100%; margin-top: 0; }
.knopf.klein, .knopf.abbrechen, .knopf.rolle-neutral { background: var(--fill); color: var(--ink); font-weight: 600; filter: none; }
.knopf.klein:hover, .knopf.abbrechen:hover, .knopf.rolle-neutral:hover { background: var(--line); }
.knopf.weich { background: var(--rolle-soft); color: var(--rolle-text); font-weight: 600; filter: none; }
.knopf.klein { min-height: 36px; padding: 4px 16px; margin: 0; font-size: 14px; }
.knopf.abbrechen { width: 100%; margin-top: 8px; }
.knopf.warn { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); filter: none; }
.knopf[disabled], button[disabled] { opacity: .5; cursor: default; }
.aktionen { display: grid; gap: 8px; margin: 16px 0; }
.aktionen + .aktionen { margin-top: 0; }
.aktionen .knopf { margin-top: 0; }
.aktionen.zwei { grid-template-columns: 1fr 1fr; }
.aktionen.zwei .knopf { font-size: 14px; padding: 8px 12px; }
.aktionen.zwei .knopf:last-child:nth-child(odd) { grid-column: 1 / -1; }
.aktionen .knopf.rolle-abgang, .aktionen .knopf.rolle-zugang, .aktionen .knopf.rolle-zaehlung:not(.weich) { min-height: 52px; }

/* ---- Karten und Kacheln ---- */
.karte, .kachel, .liste { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.karte { padding: 16px; margin-top: 8px; }
.karte h1, .karte .kartentitel { font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; margin: 16px 0 4px; }

/* ---- Bestandskarte: Laut System, Meldebestand, Sollbestand ---- */
.bestandskarte {
  display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px 16px; align-items: end; padding: 16px; margin: 8px 0 12px;
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1);
}
.karte .bestandskarte { box-shadow: none; background: var(--surface-2); margin: 12px 0 0; }
.bestandskarte .label { display: block; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.bestandskarte .gross b { font-size: 36px; line-height: 1.1; font-weight: 600; letter-spacing: -.03em; }
.bestandskarte .gross small { font-size: 16px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.bestandskarte .wert b { font-size: 20px; font-weight: 600; }
.bestandskarte .marke-warn { display: table; margin: 4px 0 0; }

/* ---- Bestandskorrektur bei der Entnahme ---- */
details.korrektur { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-m); background: var(--surface-2); }
details.korrektur summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); }
details.korrektur[open] summary { margin-bottom: 4px; }
details.korrektur .hinweis { background: var(--surface); margin: 12px 0 0; }
details.korrektur label { margin-top: 12px; }
.kacheln { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.kachel {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 120px; padding: 16px; color: var(--ink); text-decoration: none;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
a.kachel:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
a.kachel:active { transform: scale(.98); }
.kachel > b { font-size: 16px; font-weight: 600; color: var(--ink); }
.kachel .hint { color: var(--ink-2); font-size: 14px; }
.kachel .hint b { color: var(--ink); font-weight: 700; font-size: 16px; }
.kachel.gross {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "chip titel" "chip hint";
  column-gap: 16px; row-gap: 0; align-items: center; min-height: 88px;
}
.kachel.gross .chip { grid-area: chip; width: 48px; height: 48px; }
.kachel.gross > b { grid-area: titel; align-self: end; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.kachel.gross .hint { grid-area: hint; align-self: start; }
.kacheln > .kachel:last-child:nth-child(even) { grid-column: 1 / -1; min-height: 88px; }
.konto { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.konto form { margin: 0; }

/* ---- Hinweise ---- */
.hinweis { margin: 8px 0; padding: 12px 16px; border-radius: var(--r-m); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.hinweis.error { background: var(--crit-soft); color: var(--crit); font-weight: 600; }
.hinweis.warning { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.hinweis.success { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.meta, .klein-text { color: var(--ink-2); font-size: 14px; margin: 4px 0; }
.meta span { white-space: nowrap; }
.zurueck { margin: 4px 0 0; font-size: 14px; }

/* ---- Formulare ---- */
.formular label { display: block; margin: 16px 0 4px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.formular input[type=text], .formular input[type=search], .formular input[type=email], .formular input[type=password],
.formular input[type=number], .formular select {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; padding: 8px 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-s); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.formular select { text-overflow: ellipsis; }
.formular input:focus-visible, .formular select:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.formular input[type=file] { width: 100%; font: inherit; font-size: 14px; padding: 8px 0; color: var(--ink-2); }
.formular input[type=file]::file-selector-button {
  min-height: 44px; margin-right: 12px; padding: 8px 20px; border: 0; border-radius: var(--r-full); cursor: pointer;
  background: var(--fill); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600;
}
.formular .helptext, .formular .errorlist { font-size: 14px; color: var(--ink-3); margin: 4px 0 0; padding: 0; list-style: none; }
.formular .errorlist { color: var(--crit); font-weight: 600; }
.formular .errorlist.nonfield { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-m); background: var(--crit-soft); font-size: 14px; }
.formular > .knopf { width: 100%; margin-top: 24px; }
.inhalt > .formular { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); padding: 4px 16px 20px; margin-top: 12px; }

/* ---- Suche, Filter, Seiten ---- */
.suchleiste { display: flex; gap: 8px; margin: 8px 0 12px; }
.suchleiste input[type=search] {
  flex: 1; min-width: 0; min-height: 44px; font: inherit; font-size: 16px; padding: 8px 16px; border: 0; border-radius: var(--r-full);
  background: var(--fill); color: var(--ink);
}
.suchleiste input[type=search]:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.suchleiste .knopf { min-height: 44px; }
.segment { display: inline-flex; background: var(--fill); border-radius: var(--r-full); padding: 2px; margin-bottom: 8px; }
.segment a {
  font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 4px 16px; line-height: 1.5; border-radius: var(--r-full);
  transition: background var(--t-fast), color var(--t-fast);
}
.segment a.aktiv { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.leer-hinweis { padding: 16px; color: var(--ink-2); text-align: center; }
.seiten { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 16px 0; font-size: 14px; color: var(--ink-2); }

/* ---- Artikelkarte ---- */
.produktbild { display: block; width: 100%; max-height: 32vh; object-fit: contain; background: var(--surface-2); border-radius: var(--r-m); }
.kein-bild { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--r-m); background: var(--crit-soft); color: var(--crit); }
.kein-bild b { font-size: 16px; font-weight: 700; color: var(--crit); }
.kein-bild span { font-size: 14px; }
.bestand { margin: 8px 0 4px; font-size: 14px; color: var(--ink-2); }
.bestand b { display: inline-block; font-size: 36px; line-height: 1.1; font-weight: 600; letter-spacing: -.03em; color: var(--ink); margin-right: 4px; }
.marke-warn, .marker {
  display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: var(--r-full); background: var(--warn-soft); color: var(--warn);
  font-size: 12px; font-weight: 600; line-height: 1.7; white-space: nowrap; vertical-align: middle;
}
.marker { margin-left: 0; background: var(--rolle-soft); color: var(--rolle-text); }
.plaetze { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.plaetze li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.plaetze li span { font-weight: 600; }

/* ---- Listen ---- */
.liste { list-style: none; margin: 8px 0; padding: 8px; display: block; }
.liste li + li { border-top: 1px solid var(--line); }
.zeile {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--r-m); color: var(--ink); text-decoration: none; min-height: 56px;
  transition: background var(--t-fast);
}
a.zeile:hover { background: var(--surface-hover); }
a.zeile:active { background: var(--fill); }
.zeile b { font-size: 16px; font-weight: 600; }
.zeile > span:not(.text):not(.mini), .zeile .text > span { color: var(--ink-2); font-size: 14px; }
.zeile .marke-warn { margin-left: 4px; font-size: 12px; }
.zeile.mit-bild { flex-direction: row; align-items: center; gap: 12px; }
.zeile .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zeile .rest b { color: var(--ink); }
li.hinweis { margin: 0; }
.zeile .delta { color: var(--ink); font-weight: 700; font-size: 16px; }
.zeile .buchung { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.mini { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-s); flex: none; background: var(--surface-2); }
.mini.leer { display: flex; align-items: center; justify-content: center; padding: 4px; font-size: 12px; line-height: 1.2; text-align: center; color: var(--crit); background: var(--crit-soft); }

/* ---- Scanner ---- */
.scanner video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; border-radius: var(--r-l); }
.scanner .knopf { margin-top: 8px; }

/* ---- Anmeldung: Vollbild ---- */
.anmeldung {
  min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
}
.anmeldung .marke img { height: 50px; }
.anmeldung h1 { font-size: 30px; margin: 40px 0 4px; }
.anmeldung .sub { color: var(--ink-2); font-size: 14px; margin: 0 0 8px; }
.anmeldung .formular input[type=email], .anmeldung .formular input[type=password] { min-height: 48px; }
.anmeldung .formular > .knopf { min-height: 52px; margin-top: 24px; }

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