/* Retourentool — gleiche Handschrift wie das Kampagnentool: dicht, ruhig. */
:root {
  --grund: #fbfbfa; --flaeche: #fff; --rand: #e3e1dd; --text: #1c1b19; --grau: #6b6862;
  --akzent: #1f5f3f; --akzent-hell: #e8f1ec;
  --warn: #9a5b00; --warn-hell: #fdf3e3; --fehler: #a32b1f; --fehler-hell: #fdeceb;
  --radius: 6px; --auf-akzent: #fff;
  /* Farbplätze für Diagramme, feste Reihenfolge (geprüfte Referenzpalette) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #161815; --flaeche: #1e211d; --rand: #33372f; --text: #e8e6e1; --grau: #a29e95;
    --akzent: #6fbf92; --akzent-hell: #21301f; --warn: #d9a24a; --warn-hell: #2e2717;
    --fehler: #e08b80; --fehler-hell: #2f1c1a; --auf-akzent: #0f1a12;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  --grund: #161815; --flaeche: #1e211d; --rand: #33372f; --text: #e8e6e1; --grau: #a29e95;
  --akzent: #6fbf92; --akzent-hell: #21301f; --warn: #d9a24a; --warn-hell: #2e2717;
  --fehler: #e08b80; --fehler-hell: #2f1c1a; --auf-akzent: #0f1a12;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--grund); color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--akzent-hell);
  padding: 1px 5px; border-radius: 4px; }

header { display: flex; align-items: center; gap: 24px; padding: 0 20px; min-height: 52px; flex-wrap: wrap;
  background: var(--flaeche); border-bottom: 1px solid var(--rand); position: sticky; top: 0; z-index: 5; }
.marke { font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.marke span { color: var(--grau); font-weight: 400; }
header nav { display: flex; gap: 4px; flex-wrap: wrap; }
header nav a { padding: 6px 10px; border-radius: var(--radius); color: var(--grau); }
header nav a.an { background: var(--akzent-hell); color: var(--akzent); font-weight: 550; }
.ich { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--grau); }
.ich form { margin: 0; }
.rolle { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  border: 1px solid var(--rand); border-radius: 999px; padding: 1px 8px; }

main { max-width: 1400px; margin: 0 auto; padding: 24px 20px 80px; }
h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 28px 0 10px; }
h1 .abzeichen { vertical-align: middle; margin-left: 6px; }
.kopfzeile { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  flex-wrap: wrap; margin-bottom: 14px; }
.kopfzeile p { margin: 2px 0; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kopfzeile .aktionen { margin-top: 0; }
.grau { color: var(--grau); }
.klein { font-size: 12px; }
.r { text-align: right; }
.leer { color: var(--grau); padding: 24px 0; }
.warn { color: var(--warn); font-weight: 600; }
.ok { color: var(--akzent); font-weight: 600; }
.fehlertext { color: var(--fehler); font-weight: 600; }

/* Knöpfe und Felder */
button, .knopf { font: inherit; padding: 6px 12px; border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); cursor: pointer; display: inline-block; }
button:hover, .knopf:hover { border-color: var(--grau); text-decoration: none; }
.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); font-weight: 550; }
.haupt:hover { filter: brightness(1.08); }
.gefahr { color: var(--fehler); }
button.link { border: 0; background: none; color: var(--akzent); padding: 0 4px; }
input, select, textarea { font: inherit; padding: 5px 8px; border: 1px solid var(--rand);
  border-radius: var(--radius); background: var(--flaeche); color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--akzent); outline-offset: -1px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--akzent); }
input.menge { width: 72px; }
select.grund { min-width: 240px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
label > span, .beschriftung { color: var(--grau); font-size: 13px; }
label.zeile { flex-direction: row; align-items: center; gap: 8px; }
label.haken { flex-direction: row; align-items: center; gap: 6px; }
label.breit { margin-top: 12px; }
label.breit textarea { width: 100%; }
.formular { display: flex; flex-direction: column; gap: 12px; max-width: 620px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 18px; }
.formular.schmal { max-width: 380px; margin: 10vh auto; }
.reihe { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.reihe > label { flex: 1 1 170px; }
.reihe > label.klein-feld { flex: 0 0 110px; }
.inline { display: inline; }
.leiste { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 10px 14px; }
.leiste input[name="q"] { flex: 1 1 240px; }

/* Meldungen */
.meldung { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; border: 1px solid; }
.meldung.info { background: var(--akzent-hell); border-color: var(--akzent-hell); color: var(--text); }
.meldung.fehler { background: var(--fehler-hell); border-color: var(--fehler); color: var(--fehler); }
.hinweis { background: var(--warn-hell); border: 1px solid var(--rand); padding: 10px 12px; border-radius: var(--radius); margin: 8px 0; }

/* Reiter */
.reiter { display: flex; gap: 2px; border-bottom: 1px solid var(--rand); flex-wrap: wrap; }
.reiter a { padding: 8px 12px; color: var(--grau); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.reiter a.an { color: var(--text); border-bottom-color: var(--akzent); font-weight: 600; }
.reiter a span { font-size: 12px; color: var(--grau); margin-left: 2px; }
.reiter a:hover { text-decoration: none; color: var(--text); }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 16px 0 8px; }
.kachel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; }
.kachel > span:first-child { font-size: 12px; color: var(--grau); }
.kachel strong { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }

/* Tabellen: breite Tabellen scrollen in ihrer Hülle, nie die Seite. */
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche); }
table { width: 100%; border-collapse: collapse; }
.tabelle-rahmen table { min-width: 720px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--grau); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--rand);
  background: var(--grund); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--rand); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--grund); }
tr.aus { opacity: 0.5; }
td.artikel { min-width: 240px; }
td.r, td.zahl { white-space: nowrap; }
.abschnitt { align-items: baseline; margin: 28px 0 10px; }
.abschnitt h2 { margin: 0; }
.umschalter { display: flex; gap: 2px; border: 1px solid var(--rand); border-radius: var(--radius); padding: 2px; }
.umschalter a { padding: 3px 10px; border-radius: 4px; color: var(--grau); font-size: 13px; }
.umschalter a.an { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
.grundname { display: block; }
.abzeichen { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--rand); color: var(--grau); white-space: nowrap; }
.abzeichen.gruen { background: var(--akzent-hell); color: var(--akzent); border-color: var(--akzent-hell); }
.abzeichen.gelb { background: var(--warn-hell); color: var(--warn); border-color: var(--warn-hell); }
.abzeichen.blau { background: var(--flaeche); color: var(--text); border-color: var(--grau); }
.abzeichen.rot { background: var(--fehler-hell); color: var(--fehler); border-color: var(--fehler-hell); }

/* Karten */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 14px 16px; margin: 14px 0; }
.karte h2:first-child, .karte .kopfzeile h2 { margin-top: 0; }
details.karte > summary { cursor: pointer; color: var(--grau); }
details.karte[open] > summary { margin-bottom: 10px; }
.storno { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--rand); }
.storno input { min-width: 260px; }

/* Neue Retoure */
tr.position.aus td { color: var(--grau); }
tr.position.gewaehlt { background: var(--akzent-hell); }
tr.position.gewaehlt:hover { background: var(--akzent-hell); }

/* Lager */
fieldset.position-befund { display: flex; flex-direction: column; gap: 10px; }
fieldset legend { padding: 0 6px; margin-left: -6px; font-size: 14px; }
.kunde { margin: 0; }
.verbleib-block { display: flex; flex-direction: column; gap: 6px; }
.wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--rand);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.chip:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); font-weight: 600; }
.zeilenform { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0; }

.protokoll { list-style: none; padding: 0; margin: 0; }
.protokoll li { padding: 6px 0; border-bottom: 1px solid var(--rand); }

/* ---------- Bilder ---------- */
.bilder h3 { font-size: 13px; margin: 14px 0 8px; color: var(--grau); font-weight: 600; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.galerie figure { margin: 0; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; overflow: hidden; }
.galerie img { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--grund); }
.galerie figcaption { padding: 6px 8px; line-height: 1.35; }
.bilder-eingaben { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.bilder-eingabe { margin-top: 12px; }
.bilder-eingaben .bilder-eingabe { margin-top: 0; }
.ablage { position: relative; border: 1.5px dashed var(--rand); border-radius: 8px; padding: 14px; cursor: pointer; background: var(--flaeche);
  gap: 2px; text-align: center; align-items: center; }
.ablage > span:first-child { color: var(--text); font-weight: 550; }
.ablage:hover, .ablage.ueber { border-color: var(--akzent); background: var(--akzent-hell); }
.ablage input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ablage:focus-within { outline: 2px solid var(--akzent); }
.vorschau { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.vorschau figure { margin: 0; position: relative; width: 88px; }
.vorschau img { width: 88px; height: 88px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rand); display: block; }
.vorschau figcaption { font-size: 11px; color: var(--grau); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vorschau button { position: absolute; top: 3px; right: 3px; padding: 0 6px; font-size: 13px; line-height: 20px; border-radius: 999px; }
.vorschau .fehler { color: var(--fehler); font-size: 12px; width: 100%; }
.bildzahl { font-size: 11px; color: var(--grau); border: 1px solid var(--rand); border-radius: 999px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }

/* ---------- Diagramme ---------- */
.punkt { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s4 { background: var(--s4); }
.s5 { background: var(--s5); } .s6 { background: var(--s6); } .s7 { background: var(--s7); } .s8 { background: var(--s8); }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--grau); margin: 0 0 10px; }

.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 900px) { .zweispaltig { grid-template-columns: 1fr; gap: 0; } }

.balkenliste { display: flex; flex-direction: column; gap: 2px; }
.balkenzeile { display: grid; grid-template-columns: minmax(150px, 42%) 1fr 48px; gap: 10px; align-items: center;
  padding: 3px 4px; border-radius: 4px; }
.balkenzeile:hover, .balkenzeile:focus-visible { background: var(--akzent-hell); }
.balkentext { font-size: 13px; line-height: 1.3; }
.balkentext .klein { display: block; }
.balkenbahn { height: 14px; display: flex; gap: 2px; }
.balken { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.balkenbahn.geteilt > div { height: 100%; min-width: 2px; }
.balkenbahn.geteilt > div:last-child { border-radius: 0 4px 4px 0; }
.balkenwert { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }

.saeulen { display: grid; grid-template-columns: repeat(var(--n), minmax(28px, 1fr)); gap: 6px;
  height: 220px; align-items: end; padding-bottom: 4px; border-bottom: 1px solid var(--rand); overflow-x: auto; }
.saeule { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0;
  border-radius: 4px; }
.saeule:hover, .saeule:focus-visible { background: var(--akzent-hell); }
.stapel { display: flex; flex-direction: column-reverse; gap: 2px; margin: 0 18%; }
.stapel > div { min-height: 2px; }
.stapel > div:last-child { border-radius: 4px 4px 0 0; }
.saeulenwert { text-align: center; font-size: 11px; color: var(--grau); font-variant-numeric: tabular-nums; }
.saeulenname { text-align: center; font-size: 11px; color: var(--grau); margin-top: 4px; white-space: nowrap; }
.tabellenansicht { margin-top: 10px; font-size: 13px; }
.tabellenansicht summary { cursor: pointer; color: var(--grau); }

#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--text); color: var(--grund);
  padding: 7px 10px; border-radius: 6px; font-size: 12px; line-height: 1.45; white-space: pre-line; max-width: 320px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); }
#tip strong { font-weight: 650; }

@media (max-width: 640px) {
  main { padding: 16px 16px 60px; }
  header { padding: 8px 16px; gap: 10px; }
  .ich { margin-left: 0; }
  .balkenzeile { grid-template-columns: 1fr 40px; }
  .balkenzeile .balkenbahn { grid-column: 1 / -1; grid-row: 2; }
  select.grund { min-width: 0; width: 100%; }
}

/* ---------- Ablauf: Schritte, Hinweise, Aufgaben ---------- */
[hidden] { display: none !important; }
.knopf.gross { padding: 9px 18px; font-size: 15px; }
.abzeichen.orange { background: var(--warn); color: var(--auf-akzent); border-color: var(--warn); }
.zahl-hervor { background: var(--warn); color: var(--auf-akzent) !important; border-radius: 999px; padding: 0 7px; font-weight: 700; }
.erklaerung { margin: 10px 0 0; }
tr.klickbar { cursor: pointer; }

.schritte { list-style: none; padding: 0; margin: 14px 0 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; counter-reset: s; }
.schritte li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px;
  background: var(--flaeche); border: 1px solid var(--rand); color: var(--grau); }
.schritte li > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.schritte .nr { flex: none; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  border: 1.5px solid var(--rand); font-weight: 700; font-size: 13px; }
.schritte li.fertig { color: var(--text); }
.schritte li.fertig .nr { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.schritte li.jetzt { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); color: var(--text); background: var(--akzent-hell); }
.schritte li.jetzt .nr { border-color: var(--akzent); color: var(--akzent); }
@media (max-width: 700px) { .schritte { grid-template-columns: 1fr 1fr; } }

.hinweis.warten { background: var(--flaeche); border-left: 3px solid var(--grau); }
.hinweis.dran { background: var(--warn-hell); border-left: 3px solid var(--warn); }
.hinweis.erledigt-box { background: var(--akzent-hell); border-left: 3px solid var(--akzent); }
.hinweis { margin: 0 0 16px; }
.anmerkung { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; }

.aufgaben { gap: 4px; }
.aufgaben h2 { margin: 0 0 8px; }
.aufgabe { flex-direction: row; align-items: flex-start; gap: 12px; padding: 10px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.aufgabe:hover { background: var(--grund); }
.aufgabe input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.aufgabe > span { display: flex; flex-direction: column; gap: 2px; }
.aufgabe.erledigt { opacity: .6; cursor: default; }
.aufgabe.erledigt strong { text-decoration: line-through; }
.info-zeile { margin: 6px 8px; color: var(--grau); }

/* Lager */
.suche-gross { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; padding: 18px; margin: 14px 0 8px; }
.suche-gross label { font-size: 15px; font-weight: 600; margin-bottom: 8px; display: block; }
.reihe-eng { display: flex; gap: 8px; }
.suche-gross input { font-size: 20px; padding: 10px 12px; flex: 1 1 auto; min-width: 0; letter-spacing: .02em; }
.suche-gross button { font-size: 16px; padding: 10px 20px; }
.schrittfeld { display: flex; flex-direction: column; gap: 6px; }
.schrittfeld .beschriftung { color: var(--text); font-weight: 600; font-size: 13px; }
.schrittfeld select { max-width: 360px; }
.position-befund input.menge { width: 90px; font-size: 16px; }
.aufbereitung-felder { background: var(--grund); border-radius: 6px; padding: 8px 10px; }
.abschluss { justify-content: flex-end; }
.abschluss .haupt { padding: 9px 18px; }
.admin-klappe > summary { font-weight: 550; }

details.verlauf { margin-top: 28px; }
details.verlauf > summary { cursor: pointer; font-weight: 600; font-size: 15px; }
details.verlauf[open] > summary { margin-bottom: 8px; }

/* ---------- Artikelbilder ---------- */
.artikelzelle { display: flex; gap: 10px; align-items: flex-start; }
.artikelbild { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 6px;
  background: #fff; border: 1px solid var(--rand); display: block; }
.artikelbild.gross { width: 96px; height: 96px; }
.artikelbild.leer { background: var(--grund); border-style: dashed; }
.lager-kopf { display: flex; gap: 14px; align-items: center; }
.aufgabe .artikelbild { width: 40px; height: 40px; }

/* ---------- Ampel: Wartezeit aufs Lager ---------- */
:root { --ampel-gruen: #1f7a45; --ampel-orange: #b35c00; --ampel-rot: #b3261e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ampel-gruen: #5cc98a; --ampel-orange: #f0a24a; --ampel-rot: #f08a80; } }
:root[data-theme="dark"] { --ampel-gruen: #5cc98a; --ampel-orange: #f0a24a; --ampel-rot: #f08a80; }
.ampel { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.ampel-punkt { width: 9px; height: 9px; border-radius: 999px; background: currentColor; flex: none; }
.ampel.gruen { color: var(--ampel-gruen); }
.ampel.orange { color: var(--ampel-orange); }
.ampel.rot { color: var(--ampel-rot); }
.ampel.rot .ampel-punkt { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ampel-rot) 25%, transparent); }
h1 .ampel { font-size: 13px; margin-left: 8px; }
.ampel-zeile { margin-top: 4px; }
.ampel-summe { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0 4px; padding: 10px 14px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 8px; }
.ampel-summe .ampel { font-size: 13px; font-weight: 500; }
.ampel-hinweis { margin: 6px 0 0; }

.inline-klappe { display: inline-block; margin-left: 10px; }
.inline-klappe > summary { list-style: none; cursor: pointer; color: var(--akzent); font-size: 13px; display: inline; }
.inline-klappe > summary::-webkit-details-marker { display: none; }
.inline-klappe[open] form { margin-top: 6px; }
.inline-klappe input { width: 200px; }
