/* Bestandsliste – Smilytoys
   Farben: Schwarz und Smilytoys-Rot (#b7393e), kein Gelb.
   Schrift: Red Hat Display (Hausschrift des Shops). */

/* SCHRIFT-START */
@font-face {
  font-family: "Red Hat Display";
  src: url("fonts/RedHatDisplay.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}
/* SCHRIFT-ENDE */

:root {
  --papier: #ffffff;
  --flaeche: #f2f2f3;
  --flaeche-stark: #e6e6e9;
  --linie: #d9d9de;
  --text: #000000;
  --text-leise: #5a5a63;
  --kopf: #000000;
  --kopf-text: #ffffff;
  --kopf-leise: #b9b9c0;
  --rot: #b7393e;
  --rot-text: #9b2e33;
  --rot-flaeche: #f7e4e5;
  --gruen: #2e7d4f;
  --gruen-text: #23633e;
  --gruen-flaeche: #e2f1e7;
  --knopf: #000000;
  --knopf-text: #ffffff;
  --fokus: #b7393e;
  --schatten: 0 10px 30px rgba(0, 0, 0, 0.18);
  color-scheme: light;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #161618;
    --flaeche: #202023;
    --flaeche-stark: #2b2b2f;
    --linie: #39393f;
    --text: #f3f3f4;
    --text-leise: #a6a6af;
    --kopf: #000000;
    --kopf-text: #ffffff;
    --kopf-leise: #9d9da6;
    --rot: #d5585d;
    --rot-text: #ef8a8e;
    --rot-flaeche: #3b2023;
    --gruen: #5cb884;
    --gruen-text: #86d3a6;
    --gruen-flaeche: #1d3627;
    --knopf: #f3f3f4;
    --knopf-text: #000000;
    --fokus: #ef8a8e;
    --schatten: 0 10px 30px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --papier: #161618;
  --flaeche: #202023;
  --flaeche-stark: #2b2b2f;
  --linie: #39393f;
  --text: #f3f3f4;
  --text-leise: #a6a6af;
  --kopf: #000000;
  --kopf-text: #ffffff;
  --kopf-leise: #9d9da6;
  --rot: #d5585d;
  --rot-text: #ef8a8e;
  --rot-flaeche: #3b2023;
  --gruen: #5cb884;
  --gruen-text: #86d3a6;
  --gruen-flaeche: #1d3627;
  --knopf: #f3f3f4;
  --knopf-text: #000000;
  --fokus: #ef8a8e;
  --schatten: 0 10px 30px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  background: var(--papier);
  color: var(--text);
  font-family: "Red Hat Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }

.zahl { font-variant-numeric: tabular-nums; }
.leise { color: var(--text-leise); }
.versteckt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ Kopf */

.kopf {
  background: var(--kopf);
  color: var(--kopf-text);
  border-bottom: 4px solid var(--rot);
}
.kopf-innen {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.wortmarke {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1;
}
.wortmarke span { color: var(--rot); }
.stand { color: var(--kopf-leise); font-size: 13px; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.menue { position: relative; }
.menue > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #3c3c42;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.menue > summary::-webkit-details-marker { display: none; }
.menue[open] > summary { background: #2a2a2e; }
.menue-liste {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: var(--papier);
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: 6px;
  z-index: 20;
}
.menue-liste p { margin: 6px 10px 8px; font-size: 13px; color: var(--text-leise); }
.menue-liste button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.menue-liste button:hover { background: var(--flaeche); }

/* ------------------------------------------------------------ Navigation */

.reiter {
  border-bottom: 1px solid var(--linie);
  background: var(--papier);
}
.reiter-innen {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.reiter button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 14px 12px 11px;
  font-weight: 600;
  color: var(--text-leise);
  cursor: pointer;
  white-space: nowrap;
}
.reiter button:hover { color: var(--text); }
.reiter button[aria-current="page"] { color: var(--text); border-bottom-color: var(--rot); }

/* ------------------------------------------------------------ Inhalt */

.inhalt {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.hinweis {
  max-width: 1320px;
  margin: 14px auto 0;
  padding: 0 20px;
}
.hinweis p {
  margin: 0;
  padding: 10px 14px;
  border-left: 4px solid var(--rot);
  background: var(--rot-flaeche);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
}
.hinweis.demo p { border-left-color: var(--text-leise); background: var(--flaeche); }

h2.titel {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 4px 0 4px;
}
p.unterzeile { margin: 0 0 18px; color: var(--text-leise); max-width: 70ch; }

/* ------------------------------------------------------------ Preisschilder (Standort-Filter) */

.schilder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.schild {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 30px;
  border: 1.5px solid var(--text);
  border-radius: 6px 16px 16px 6px;
  background: var(--papier);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
}
.schild::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  transform: translateY(-50%);
}
.schild .anzahl {
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--flaeche-stark);
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.schild:hover { background: var(--flaeche); }
.schild[aria-pressed="true"] { background: var(--text); color: var(--papier); }
.schild[aria-pressed="true"] .anzahl { background: var(--rot); color: #ffffff; }

/* ------------------------------------------------------------ Werkzeugleiste */

.werkzeuge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.werkzeuge .wachsen { flex: 1 1 220px; min-width: 180px; }
.werkzeuge .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

input[type="search"], input[type="text"], input[type="password"], select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--papier);
  max-width: 100%;
}
input[type="search"] { width: 100%; }
select { padding-right: 30px; }

.knopf {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--knopf);
  background: var(--knopf);
  color: var(--knopf-text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.knopf:hover { opacity: 0.88; }
.knopf.zweit { background: transparent; color: var(--text); border-color: var(--linie); }
.knopf.zweit:hover { background: var(--flaeche); opacity: 1; }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #ffffff; }
.knopf:disabled { opacity: 0.5; cursor: default; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

.aufklapp { position: relative; }
.aufklapp-knopf {
  list-style: none;
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--papier);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.aufklapp-knopf::-webkit-details-marker { display: none; }
.aufklapp-knopf::after { content: "▾"; position: absolute; right: 12px; color: var(--text-leise); }
.aufklapp-knopf.gefiltert { border-color: var(--text); font-weight: 600; }
.aufklapp[open] .aufklapp-knopf { border-color: var(--text); }
.aufklapp-liste {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 15;
  min-width: 260px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: 8px 12px;
  display: grid;
  gap: 4px;
}
.aufklapp-liste .check { padding: 4px 0; width: 100%; }
.aufklapp-liste .check.alle { border-bottom: 1px solid var(--linie); padding-bottom: 8px; margin-bottom: 2px; }
.aufklapp-name { flex: 1; }
.aufklapp-zahl { color: var(--text-leise); font-size: 13px; font-variant-numeric: tabular-nums; }
.check input { width: 18px; height: 18px; accent-color: var(--rot); }

.zusammenfassung { margin: 0 0 12px; font-size: 14px; color: var(--text-leise); }
.zusammenfassung strong { color: var(--text); }

/* ------------------------------------------------------------ Tabellen */

.tabelle-rahmen {
  overflow-x: auto;
  border-top: 2px solid var(--text);
}
table.liste {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
table.liste th, table.liste td {
  padding: 10px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--linie);
}
table.liste th {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-leise);
  white-space: nowrap;
  vertical-align: bottom;
}
table.liste th button {
  background: none;
  border: 0;
  padding: 0;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}
table.liste th[aria-sort] button { color: var(--text); }
table.liste th .pfeil { display: inline-block; width: 1em; color: var(--rot); }
table.liste td.rechts, table.liste th.rechts { text-align: right; }
table.liste tbody tr:hover { background: var(--flaeche); }

.artikel-name { font-weight: 600; }
.artikel-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-leise); margin-top: 2px; }

.bestand { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bestand.leer { color: var(--rot-text); }
.bestand-hinweis { font-size: 12px; color: var(--rot-text); font-weight: 600; }

.lager { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.lager .zahl { font-weight: 700; min-width: 2ch; text-align: right; }

.marke {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.marke.ok { background: var(--gruen-flaeche); color: var(--gruen-text); }
.marke.nein { background: var(--rot-flaeche); color: var(--rot-text); }
.marke.neutral { background: var(--flaeche-stark); color: var(--text-leise); }

td select.status { height: 34px; min-width: 170px; color: var(--text-leise); }
td select.status.gesetzt { border-color: var(--text); color: var(--text); font-weight: 600; }
td input.notiz {
  height: 34px;
  width: 100%;
  min-width: 180px;
  border-color: transparent;
  background: transparent;
}
td input.notiz:hover { border-color: var(--linie); }
td input.notiz:focus { border-color: var(--text); background: var(--papier); }
.seit { white-space: nowrap; }
.seit small { display: block; color: var(--text-leise); font-size: 12px; }
.oft { color: var(--rot-text); font-weight: 600; }

.orte { display: flex; flex-wrap: wrap; gap: 6px; }
.ort {
  display: inline-flex;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--linie);
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
}
.ort b { font-variant-numeric: tabular-nums; }

.mehr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  font-size: 14px;
  color: var(--text-leise);
}

.leer-zustand {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-leise);
  border-bottom: 1px solid var(--linie);
}
.leer-zustand strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 4px; }

/* ------------------------------------------------------------ Umlagerung */

.abschnitt { margin: 0 0 34px; }
.abschnitt-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 10px;
}
.abschnitt-kopf h3 { margin: 0; font-size: 19px; font-weight: 800; }
.abschnitt-kopf .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ Verlauf */

.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 2px solid var(--text);
  border-bottom: 1px solid var(--linie);
  margin: 0 0 30px;
}
.kennzahl { padding: 14px 16px 14px 0; }
.kennzahl + .kennzahl { padding-left: 16px; border-left: 1px solid var(--linie); }
.kennzahl .wert { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kennzahl .text { font-size: 13.5px; color: var(--text-leise); }

h3.bereich { font-size: 18px; font-weight: 800; margin: 0 0 10px; }

.aenderungen { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--text); }
.aenderungen li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--linie);
  font-size: 14px;
}
.aenderungen time { color: var(--text-leise); font-variant-numeric: tabular-nums; }

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

.anmeldung {
  min-height: 80vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.anmeldung-karte {
  width: 100%;
  max-width: 380px;
}
.anmeldung-karte .wortmarke { color: var(--text); font-size: 34px; margin-bottom: 6px; }
.anmeldung-karte .rotlinie { height: 4px; width: 56px; background: var(--rot); margin: 0 0 24px; }
.anmeldung-karte label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.anmeldung-karte input { width: 100%; }
.anmeldung-karte .knopf { width: 100%; margin-top: 20px; height: 44px; }
.anmeldung-karte .fehlertext { color: var(--rot-text); font-weight: 600; min-height: 1.4em; margin: 12px 0 0; }
.demo-zugaenge { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--linie); font-size: 14px; color: var(--text-leise); }
.demo-zugaenge ul { margin: 6px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------ Dialoge */

dialog {
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  background: var(--papier);
  color: var(--text);
  box-shadow: var(--schatten);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog form { padding: 22px; }
dialog h3 { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
dialog label.feld { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
dialog input[type="text"], dialog input[type="password"], dialog select { width: 100%; }
dialog fieldset { border: 0; padding: 0; margin: 12px 0 0; }
dialog legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
dialog .auswahl-liste { display: grid; gap: 6px; }
dialog .fehlertext { color: var(--rot-text); font-weight: 600; min-height: 1.4em; margin: 12px 0 0; }
dialog .knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
dialog.breit { width: min(580px, calc(100vw - 32px)); }
dialog input[type="date"] { height: 38px; padding: 0 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--papier); }
.aufgabe-titel { margin: 0 0 10px; padding: 10px 12px; background: var(--flaeche); border-left: 4px solid var(--rot); border-radius: 0 8px 8px 0; font-weight: 600; }
.personen { max-height: 320px; overflow-y: auto; border: 1px solid var(--linie); border-radius: 8px; padding: 6px 12px; }
.personen .gruppe { padding: 8px 0; }
.personen .gruppe + .gruppe { border-top: 1px solid var(--linie); }
.gruppe-kopf { margin-bottom: 6px; }
.gruppe-personen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; padding-left: 26px; }
td.auswahl-zelle, th.auswahl-zelle { width: 34px; padding-right: 0; }
input.auswahl { width: 18px; height: 18px; accent-color: var(--rot); margin-top: 2px; }

/* ------------------------------------------------------------ Meldung unten */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: var(--knopf);
  color: var(--knopf-text);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }
.toast.fehler { background: var(--rot); color: #ffffff; }

.laden { padding: 60px 20px; text-align: center; color: var(--text-leise); }

/* ------------------------------------------------------------ Schmale Bildschirme */

@media (max-width: 720px) {
  .kopf-innen { padding: 12px 16px; gap: 10px; }
  .wortmarke { font-size: 19px; }
  .stand { order: 3; width: 100%; }
  .reiter-innen, .inhalt, .hinweis { padding-left: 16px; padding-right: 16px; }
  .werkzeuge select, .werkzeuge .aufklapp { flex: 1 1 calc(50% - 5px); }
  .aufklapp-knopf { width: 100%; }
  .aufklapp-liste { left: 0; right: 0; min-width: 0; }
  .werkzeuge .rechts { margin-left: 0; }
  .aenderungen li { grid-template-columns: 1fr; gap: 2px; }

  /* Preisschilder nebeneinander wischen statt untereinander stapeln */
  .schilder { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 6px; }
  .schild { flex: 0 0 auto; }

  /* Liste als Karten statt breiter Tabelle */
  table.karten-mobil { min-width: 0; }
  table.karten-mobil thead { display: none; }
  table.karten-mobil, table.karten-mobil tbody { display: block; }
  table.karten-mobil tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "artikel bestand"
      "standort lager"
      "kategorie seit"
      "status status"
      "notiz notiz";
    gap: 6px 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--linie);
  }
  table.karten-mobil td { display: block; padding: 0; border: 0; }
  table.karten-mobil .f-artikel { grid-area: artikel; }
  table.karten-mobil .f-bestand { grid-area: bestand; }
  table.karten-mobil .f-standort { grid-area: standort; font-weight: 600; }
  table.karten-mobil .f-lager { grid-area: lager; justify-self: end; }
  table.karten-mobil .f-kategorie { grid-area: kategorie; color: var(--text-leise); font-size: 13.5px; }
  table.karten-mobil .f-seit { grid-area: seit; text-align: right; font-size: 13px; }
  table.karten-mobil .f-seit small { display: inline; margin-left: 4px; }
  table.karten-mobil .f-seit small.oft { display: block; margin-left: 0; }
  table.karten-mobil .f-status { grid-area: status; }
  table.karten-mobil .f-status select { width: 100%; }
  table.karten-mobil .f-notiz { grid-area: notiz; }
  table.karten-mobil .f-notiz input.notiz { border-color: var(--linie); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ------------------------------------------------------------ Druck (Umlagerungsliste) */

@media print {
  :root { --papier: #ffffff; --text: #000000; --linie: #999999; --text-leise: #444444; padding: 0; }
  body { background: #ffffff; color: #000000; font-size: 12px; }
  .kopf, .reiter, .hinweis, .werkzeuge, .toast, .abschnitt-kopf .rechts, .keindruck { display: none !important; }
  body.druckmodus .abschnitt:not(.druck-ziel) { display: none !important; }
  .inhalt { padding: 0; max-width: none; }
  .tabelle-rahmen { overflow: visible; }
  table.liste { min-width: 0; }
  select.status { border: 0; appearance: none; padding: 0; height: auto; }
}
