/* Inventar-Verwaltung. Rick.Software-Designsprache: Petrol, Bernstein, Roboto (wie Familien-Dashboard von Echt-Check) */
@font-face { font-family: Roboto; src: url("/roboto-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Roboto; src: url("/roboto-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --petrol: #14566a; --petrol-hell: #1e7189; --petrol-dunkel: #0e4252; --bernstein: #e8a84a; --bernstein-dunkel: #b5761e;
  --grund: #f3f6f7; --karte: #ffffff; --text: #14343d; --leise: #4c6670; --rand: #d5dddd;
  --gruen: #1f7a3a; --rot: #b3261e; --feld: #ffffff; --flaeche: color-mix(in srgb, var(--petrol) 8%, var(--karte));
  --schatten: 0 1px 2px rgba(13, 60, 75, .06), 0 4px 14px rgba(13, 60, 75, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-farben="hell"]) {
    --grund: #0f1719; --karte: #172226; --text: #e6eeee; --leise: #a6b6b6; --rand: #2b3a3e; --feld: #10191c;
    --gruen: #5cc27a; --rot: #ff8a80; --petrol: #2a8aa5; --schatten: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-farben="dunkel"] {
  --grund: #0f1719; --karte: #172226; --text: #e6eeee; --leise: #a6b6b6; --rand: #2b3a3e; --feld: #10191c;
  --gruen: #5cc27a; --rot: #ff8a80; --petrol: #2a8aa5; --schatten: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--grund); min-height: 100%; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; background: var(--grund); color: var(--text);
  font: 17px/1.45 Roboto, "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Kopf */
header { background: linear-gradient(135deg, var(--petrol-hell), #14566a, var(--petrol-dunkel)); color: #fff;
  padding-top: env(safe-area-inset-top); position: sticky; top: 0; z-index: 5; }
.kopf { max-width: 760px; margin: 0 auto; padding: 14px 16px 16px; display: flex; align-items: center; gap: 12px; }
.kopf-titel { flex: 1; min-width: 0; }
h1 { margin: 0; font-size: 23px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strich { width: 48px; height: 4px; border-radius: 99px; background: var(--bernstein); margin-top: 7px; }
.kopf-zurueck { background: transparent; border: 0; color: #fff; font-size: 34px; line-height: 1; width: 44px; height: 44px;
  margin-left: -10px; cursor: pointer; border-radius: 50%; }
.status { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.12); border: 0; color: #fff;
  border-radius: 99px; padding: 6px 12px; font-size: 14px; cursor: pointer; min-height: 36px; }
.status-punkt { width: 9px; height: 9px; border-radius: 50%; background: #7ee29a; flex: none; }
.status.wartet .status-punkt { background: var(--bernstein); }
.status.offline .status-punkt { background: #c9d3d6; }
.status.fehler .status-punkt { background: #ff8a80; }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(150px + env(safe-area-inset-bottom)); display: grid; gap: 14px; outline: none; }

.karte { background: var(--karte); border: 1px solid color-mix(in srgb, var(--rand) 60%, transparent); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--schatten); }
h2 { margin: 0 0 8px; font-size: 20px; }
h3 { margin: 14px 0 6px; font-size: 16px; color: var(--leise); font-weight: 700; }
.leise { color: var(--leise); }
.klein { font-size: 14px; color: var(--leise); margin: 8px 0 0; }
p { margin: 0 0 8px; }

/* Knöpfe */
.knopf { font-weight: 700; font-size: 17px; color: #fff; background: #14566a; border: 0; border-radius: 99px;
  padding: 12px 24px; min-height: 48px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.knopf:hover { background: var(--petrol-hell); }
.knopf:disabled { opacity: .55; cursor: default; }
.knopf.zweit { background: transparent; color: var(--text); border: 2px solid var(--rand); }
.knopf.zweit:hover { border-color: var(--leise); }
.knopf.warn { background: var(--rot); }
.knopf.breit { width: 100%; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.knoepfe .knopf { flex: 1 1 auto; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--bernstein); outline-offset: 2px; }
.textknopf { background: none; border: 0; color: var(--petrol); font-weight: 700; padding: 8px 4px; cursor: pointer; }
:root[data-farben="dunkel"] .textknopf { color: #7cc4d8; }
@media (prefers-color-scheme: dark) { :root:not([data-farben="hell"]) .textknopf { color: #7cc4d8; } }

/* Felder */
label.feld { display: grid; gap: 4px; margin-top: 12px; font-size: 15px; color: var(--leise); }
label.feld:first-child { margin-top: 0; }
input, select, textarea { background: var(--feld); border: 2px solid var(--rand); border-radius: 12px; padding: 10px 12px;
  min-height: 48px; width: 100%; font-size: 17px; color: var(--text); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--petrol); outline: none; }
.zeile { display: flex; gap: 10px; }
.zeile > * { flex: 1; min-width: 0; }
.fehler-text { color: var(--rot); font-size: 15px; margin-top: 10px; }

/* Ortswahl (Chips) */
.orte { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; margin: 0 -2px; scrollbar-width: none; }
.orte::-webkit-scrollbar { display: none; }
.orte button { flex: none; font-weight: 700; font-size: 16px; background: var(--karte); color: var(--text); border: 2px solid var(--rand);
  border-radius: 99px; padding: 8px 18px; min-height: 44px; cursor: pointer; }
.orte button[aria-pressed="true"] { background: #14566a; border-color: #14566a; color: #fff; }

/* Suche */
.suche { display: flex; gap: 8px; }
.suche input { flex: 1; border-radius: 99px; padding-left: 18px; }
.rund { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--rand); background: var(--karte);
  cursor: pointer; font-size: 20px; display: grid; place-items: center; color: var(--text); }
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.filter button { background: transparent; border: 1.5px solid var(--rand); border-radius: 99px; padding: 5px 14px; font-size: 14px;
  min-height: 34px; cursor: pointer; color: var(--leise); }
.filter button[aria-pressed="true"] { border-color: var(--petrol); color: var(--text); background: var(--flaeche); font-weight: 700; }

/* Artikelliste */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rand); }
.liste > li:first-child { border-top: 0; }
.eintrag { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 4px 0; cursor: pointer; }
.eintrag .name { font-weight: 700; display: block; overflow-wrap: anywhere; }
.eintrag .neben { font-size: 14px; color: var(--leise); display: block; }
.menge { text-align: right; min-width: 64px; font-variant-numeric: tabular-nums; }
.menge .ist { font-size: 22px; font-weight: 700; line-height: 1.1; display: block; }
.menge .soll { font-size: 13px; color: var(--leise); display: block; }
.menge.knapp .ist { color: var(--bernstein-dunkel); }
.menge.leer .ist { color: var(--rot); }
:root[data-farben="dunkel"] .menge.knapp .ist { color: var(--bernstein); }
@media (prefers-color-scheme: dark) { :root:not([data-farben="hell"]) .menge.knapp .ist { color: var(--bernstein); } }
.plusminus { display: flex; gap: 6px; }
.plusminus button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--rand); background: var(--karte);
  font-size: 22px; font-weight: 700; cursor: pointer; color: var(--text); display: grid; place-items: center; }
.plusminus button.minus { background: var(--flaeche); border-color: transparent; }
.plusminus button:active { transform: scale(.94); }
.leer-hinweis { text-align: center; padding: 18px 8px; color: var(--leise); }
.gruppe-kopf { font-size: 13px; font-weight: 700; color: var(--leise); text-transform: uppercase; letter-spacing: .04em;
  padding: 14px 0 2px; border-top: 0 !important; }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kachel { background: var(--flaeche); border-radius: 14px; padding: 10px 12px; }
.kachel .zahl { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--petrol); }
:root[data-farben="dunkel"] .kachel .zahl { color: #7cc4d8; }
@media (prefers-color-scheme: dark) { :root:not([data-farben="hell"]) .kachel .zahl { color: #7cc4d8; } }
.kachel .art { font-size: 14px; color: var(--leise); }

/* Bestand pro Ort im Artikel */
.ortbestand { display: grid; gap: 8px; }
.ortbestand .ob { display: flex; align-items: center; gap: 12px; background: var(--flaeche); border-radius: 14px; padding: 10px 14px; }
.ortbestand .ob .n { flex: 1; font-weight: 700; }
.ortbestand .ob .m { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ortbestand .ob .s { font-size: 13px; color: var(--leise); }

/* Verlauf */
.buchung { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 9px 0; border-top: 1px solid var(--rand); }
.buchung:first-child { border-top: 0; }
.buchung .w { font-weight: 700; overflow-wrap: anywhere; }
.buchung .d { font-size: 14px; color: var(--leise); }
.buchung .z { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.buchung .z.minus { color: var(--rot); }
.buchung .z.plus { color: var(--gruen); }
.tag-kopf { font-size: 14px; font-weight: 700; color: var(--leise); margin: 12px 0 2px; }
.tag-kopf:first-child { margin-top: 0; }

/* Untere Leiste */
.leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--karte); border-top: 1px solid var(--rand);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(13,60,75,.06); }
.leiste button { flex: 1; max-width: 190px; background: none; border: 0; padding: 8px 4px 10px; display: grid; justify-items: center;
  gap: 2px; font-size: 13px; color: var(--leise); cursor: pointer; position: relative; min-height: 60px; }
.leiste .sym { font-size: 21px; line-height: 1.2; }
.leiste button[aria-current="page"] { color: var(--text); font-weight: 700; }
.leiste button[aria-current="page"] .sym { color: var(--bernstein-dunkel); }
.zahl-marke { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--bernstein); color: #14343d; border-radius: 99px;
  font-size: 12px; font-weight: 700; padding: 0 6px; min-width: 20px; line-height: 20px; }

/* Schwebender Knopf */
.fab { position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 4;
  width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--bernstein); color: #14343d; font-size: 30px;
  font-weight: 700; box-shadow: 0 4px 14px rgba(13,60,75,.25); cursor: pointer; }

/* Blatt (Dialog von unten) */
.blatt-grund { position: fixed; inset: 0; background: rgba(8, 25, 30, .45); z-index: 10; }
.blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 640px; margin: 0 auto; max-height: 92dvh; overflow-y: auto;
  background: var(--karte); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: hoch .22s ease-out; }
.blatt::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--rand); margin: 0 auto 12px; }
@keyframes hoch { from { transform: translateY(40px); } to { transform: none; } }
@media (min-width: 700px) { .blatt { bottom: auto; top: 8vh; border-radius: 22px; } }

.stepper { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.stepper input { text-align: center; font-size: 26px; font-weight: 700; flex: 1; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--rand); background: var(--flaeche);
  font-size: 26px; font-weight: 700; cursor: pointer; flex: none; color: var(--text); }
.schnell { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.schnell button { background: var(--flaeche); border: 0; border-radius: 99px; padding: 6px 14px; min-height: 36px; cursor: pointer; font-size: 15px; }
.auswahl-art { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.auswahl-art button { background: var(--karte); border: 2px solid var(--rand); border-radius: 14px; padding: 10px; min-height: 52px; font-weight: 700; cursor: pointer; }
.auswahl-art button[aria-pressed="true"] { border-color: var(--petrol); background: var(--flaeche); }

/* Meldung unten */
.meldung { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20; max-width: 520px; margin: 0 auto;
  background: #14343d; color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: hoch .2s ease-out; }
.meldung span { flex: 1; }
.meldung button { background: none; border: 0; color: var(--bernstein); font-weight: 700; cursor: pointer; padding: 6px; }

/* Anmeldung */
.anmeldung { max-width: 440px; margin: 6vh auto 0; width: 100%; }
.reiter { display: flex; gap: 6px; margin-bottom: 14px; background: var(--flaeche); border-radius: 99px; padding: 4px; }
.reiter button { flex: 1; border: 0; background: none; border-radius: 99px; padding: 9px; font-weight: 700; cursor: pointer; color: var(--leise); }
.reiter button[aria-pressed="true"] { background: var(--karte); color: var(--text); box-shadow: var(--schatten); }

/* Scanner */
.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .rahmen { position: absolute; inset: 28% 12%; border: 3px solid var(--bernstein); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

.einstellungen li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--rand); }
.einstellungen li:first-child { border-top: 0; }
.einstellungen li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 420px) {
  .kacheln { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .kachel { padding: 8px 10px; }
  .kachel .zahl { font-size: 22px; }
  .plusminus button { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .blatt, .meldung { animation: none; }
}
.knoepfe.ohne-abstand { margin-top: 0; }
.liste.mit-abstand { margin-top: 8px; }
.auswahl-art.drei { grid-template-columns: repeat(3, 1fr); }
