/* ============================================================
   app.css – Aussehen der App

   Inhalt
     1. Farben und Grundlagen
     2. Knöpfe und Status-Anzeigen
     3. Kopfleiste
     4. Übersicht (Liste, Suche)
     5. Formular (Werkzeugleiste, Blatt, Felder)
     6. Dialoge (allgemein, Auswahl, Löschen/Lieferscheine, Kundensuche)
     7. Unterschrift
     8. Datumsauswahl
     9. Zellenmenü (Symbol am Feld)
    10. Scanner-Overlay und Lieferschein-Ansicht
    11. Hinweise am unteren Rand
    12. Anmeldung und Verwaltung (Cloud)
    13. Dekadenabgabe (Auswahlmodus)
   ============================================================ */

/* ---------- 1. Farben und Grundlagen ---------- */
:root{
  --blue:#1b4f8f; --blue-dark:#123a68; --gray-line:#8a8a8a; --bg:#f2f4f7; --card:#ffffff;
  --text:#1a1a1a; --muted:#666; --danger:#b3392c; --warn:#b26a00;
  /* Farben der ausfüllbaren Felder (Input/Textarea/Select/contenteditable) für die drei Zustände
     unhovered / hovered / selected (= fokussiert) – hier anpassen, wirkt überall. */
  --field-idle: rgba(202, 235, 250, .3);
  --field-hover: rgba(136,170,216,.3);
  --field-active: rgba(202, 235, 250, .3);
}
/* iOS koppelt simuliertes :hover an die Touch-KOORDINATE statt an ein Element: nach dem Entfernen eines
   angetippten Kalendertags würde das Formularfeld dahinter kurz die Hover-Farbe bekommen (siehe datepicker.js).
   Diese Klasse zwingt --field-hover kurzzeitig auf den Ruhewert. */
body.dp-suppress-hover{ --field-hover: var(--field-idle); }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){ --bg:#15181c; --card:#1e2227; --text:#e8e8e8; --muted:#9aa0a6; --gray-line:#555; }
}
:root[data-theme="dark"]{ --bg:#15181c; --card:#1e2227; --text:#e8e8e8; --muted:#9aa0a6; --gray-line:#555; }
*{box-sizing:border-box;}
[hidden]{display:none !important;}
/* iOS Safari ignoriert maximum-scale=1 im viewport-Tag: die native Pinch-/Doppeltipp-Zoom-Geste bliebe aktiv.
   Läuft sie parallel zum eigenen Zoom (zoom.js), driftet der tatsächliche Maßstab vom JS-Wert weg und Tipps
   landen auf dem falschen Feld. pan-x pan-y erlaubt normales Scrollen, unterbindet aber jede native Zoom-Geste. */
html, body{touch-action:pan-x pan-y;}
body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;}
/* Solange ein Dialog offen ist, bewegt sich die Seite dahinter nicht (siehe ui/dialogs.js) */
body.modal-open{overflow:hidden;}

/* ---------- 2. Knöpfe und Status-Anzeigen ---------- */
button{font:inherit;border:none;border-radius:8px;padding:9px 14px;cursor:pointer;font-size:13px;font-weight:600;}
button:disabled{opacity:.45;cursor:default;}
.btn-primary{background:var(--blue);color:#fff;}
.btn-primary:active{background:var(--blue-dark);}
.btn-secondary{background:rgba(128,128,128,.15);color:var(--text);}
.btn-danger{background:var(--danger);color:#fff;}
.btn-small{padding:6px 10px;font-size:12px;border-radius:6px;}
.status-pill{font-size:11px;padding:3px 8px;border-radius:20px;background:rgba(128,128,128,.15);color:var(--muted);}
.status-pill.warn{background:rgba(178,106,0,.18);color:var(--warn);font-weight:600;}
.status-pill.bad{background:rgba(179,57,44,.18);color:var(--danger);font-weight:600;}

/* ---------- 3. Kopfleiste (nur in der Übersicht) ---------- */
.topbar{position:sticky;top:0;z-index:50;background:var(--card);border-bottom:1px solid rgba(128,128,128,.25);
  padding:10px 14px;display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.topbar h1{font-size:15px;margin:0;font-weight:600;flex:1;min-width:120px;}
body.in-form .topbar{display:none;}

/* ---------- 4. Übersicht ---------- */
#listView{padding:14px;max-width:900px;margin:0 auto;}
.list-tools{display:flex;gap:8px;margin-bottom:10px;}
.list-tools input, .list-tools select{font:inherit;font-size:14px;padding:9px 10px;border-radius:8px;
  border:1px solid rgba(128,128,128,.3);background:var(--card);color:var(--text);min-width:0;}
.list-tools input{flex:1;}
.list-item{background:var(--card);border-radius:10px;padding:12px 14px;margin-bottom:8px;
  display:flex;flex-wrap:wrap;align-items:center;gap:10px;box-shadow:0 1px 3px rgba(0,0,0,.08);}
.list-item.draft{border-left:4px solid var(--warn);}
.list-item .meta{flex:1 1 150px;min-width:0;}
.list-item .meta .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.list-item .meta .sub{font-size:12px;color:var(--muted);margin-top:2px;}
.list-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;flex-shrink:0;}
.badge-slot{display:contents;}
.tag{display:inline-block;font-size:10px;font-weight:700;padding:1px 6px;border-radius:10px;background:rgba(128,128,128,.18);color:var(--muted);vertical-align:1px;}
.tag.warn{background:rgba(178,106,0,.18);color:var(--warn);}
.empty-state{text-align:center;padding:60px 20px;color:var(--muted);}
.list-footer{font-size:11px;color:var(--muted);text-align:center;margin:18px 0 6px;}

/* ---------- 5. Formular ---------- */
#formView{display:none;}
.form-toolbar{padding:10px 14px;display:flex;gap:8px;flex-wrap:wrap;background:var(--card);
  border-bottom:1px solid rgba(128,128,128,.2);position:sticky;top:0;z-index:40;}
/* Zentrierung per auto-Margin statt justify-content:center: bei Überlauf (Handy, Zoom) würde justify-content die
   linke Seite über den Rand schieben, ohne dass man dorthin scrollen kann. Auto-Margins zentrieren nur, wenn Platz übrig ist. */
.sheet-scroll{overflow:auto;padding:14px;display:flex;-webkit-overflow-scrolling:touch;}
/* Zoom per transform:scale() statt CSS-zoom: zoom löst bei jedem Schritt ein Neu-Layout aller Felder aus (ruckelt),
   transform läuft auf der GPU. #sheetBox trägt die SKALIERTE Größe (applyZoom), damit der Scrollbereich mitwächst;
   .sheet behält sein festes 596x842-Layout und wird nur skaliert. */
#sheetBox{position:relative;margin-left:auto;margin-right:auto;flex-shrink:0;width:596px;height:842px;}
.sheet{position:absolute;left:0;top:0;transform-origin:0 0;width:596px;height:842px;
  background-size:cover;background-repeat:no-repeat;box-shadow:0 2px 14px rgba(0,0,0,.25);}
/* Nur während einer Zoom-Geste auf eine eigene GPU-Ebene heben; danach entfernen, damit der Browser scharf neu rastert. */
.sheet.zooming{will-change:transform;}
.f{position:absolute;overflow:hidden;}
/* Manche Browser (v. a. Safari) setzen auf Formularelemente einen Standard-border-radius: hier überall scharfe Ecken. */
.f input, .f select, .f textarea, .f .ce-field, .chk{border-radius:0;}
.f input[type=text], .f textarea{
  width:100%;height:100%;border:0;background:var(--field-idle);outline:none;
  font-family:"Helvetica Neue",Arial,sans-serif;color:#111;padding:0 2px;margin:0;
  resize:none;box-sizing:border-box;-webkit-appearance:none;appearance:none;display:block;
}
/* :hover nur bei echtem Zeigegerät (Maus/Trackpad); auf reinen Touchscreens gäbe es sonst hängende Hover-Zustände. */
@media (hover:hover){
  .f input:not(:focus):hover, .f textarea:not(:focus):hover{background:var(--field-hover);}
}
.f input:focus, .f textarea:focus{background:var(--field-active);}
/* Tastaturfokus sichtbar machen (die Feldfarbe allein ändert sich beim Fokus nicht) */
.f input[type=text]:focus-visible, .f textarea:focus-visible, .f select:focus-visible, .f .ce-field:focus-visible{
  outline:1.5px solid rgba(27,79,143,.75);outline-offset:-1.5px;}
.chk:focus-visible{outline:1.5px solid rgba(27,79,143,.75);outline-offset:1px;}
/* Schreibgeschützt (z. B. automatisch berechneter Leistungszeitraum): antippbar, aber ohne Eingabemarke */
.f input[readonly]{caret-color:transparent;cursor:default;}
.f input.cellinput{padding:0 1px;}
.f input.cellinput.num-right{text-align:right;padding-right:3px;}
.f select{
  width:100%;height:100%;border:0;background:var(--field-idle);outline:none;
  font-family:"Helvetica Neue",Arial,sans-serif;color:#111;padding:0 1px;margin:0;
  box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;
  line-height:normal;display:block;min-height:0;
}
@media (hover:hover){ .f select:not(:focus):hover{background:var(--field-hover);} }
.f select:focus{background:var(--field-active);}
/* text-align allein reicht in Safari nicht (natives Select ignoriert es); direction:rtl erzwingt Rechtsbündigkeit. */
.f select.sel-right{direction:rtl;text-align:right;padding-right:6px;}
.f select.sel-right option{direction:rtl;text-align:right;}
/* Mehrzeilige Felder mit Einrückung der ersten Zeile (contenteditable) */
.f .ce-field{width:100%;height:100%;outline:none;font-family:"Helvetica Neue",Arial,sans-serif;color:#111;
  padding:0 2px;margin:0;box-sizing:border-box;white-space:pre-wrap;overflow:hidden;word-wrap:break-word;}
.f textarea{white-space:pre-wrap;}
.chk{position:absolute;cursor:pointer;display:flex;align-items:center;justify-content:center;background:var(--field-idle);}
@media (hover:hover){ .chk:hover{background:var(--field-hover);} }
.chk.on{background:var(--field-active);}
.chk.on::after{content:"✕";font-weight:700;color:#111;font-size:90%;line-height:1;}
.sigbox{position:absolute;background:var(--field-idle);border:1px dashed rgba(0,80,180,.5);cursor:pointer;}
.sigbox canvas{width:100%;height:100%;touch-action:none;pointer-events:none;}
.sheet.locked .f, .sheet.locked .chk{opacity:.82;}
.sheet.locked .sigbox{cursor:default;}

/* ---------- 6. Dialoge ---------- */
/* Hintergrund aller Dialoge. touch-action:none sperrt Wischen auf dem Hintergrund; scrollbare Listen im Dialog
   (eigene Scroll-Container) behalten ihr Scrollen und geben es nicht an die Seite dahinter weiter. */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:500;display:flex;align-items:center;justify-content:center;}
.modal-overlay, .kunden-modal-overlay{touch-action:none;overscroll-behavior:contain;}
.modal-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;}
/* Der allgemeine Dialog kann über einem anderen Dialog stehen (Rückfragen) */
#dlg{z-index:600;}

/* Allgemeiner Dialog (dialog() in ui/dialogs.js): Titel, Text, Inhalt, Knöpfe */
.dlg{background:var(--card);border-radius:12px;padding:16px;display:flex;flex-direction:column;gap:12px;
  box-shadow:0 10px 40px rgba(0,0,0,.4);width:min(460px,94vw);max-height:88vh;}
.dlg h2{margin:0;font-size:16px;}
.dlg-body{overflow-y:auto;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
.dlg-text{margin:0 0 8px;font-size:14px;line-height:1.4;white-space:pre-line;}
.dlg-list{margin:6px 0 0;padding-left:20px;font-size:13px;line-height:1.5;}
.choice-list{display:flex;flex-direction:column;gap:6px;}
.choice{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:44px;text-align:left;
  background:rgba(128,128,128,.12);color:var(--text);font-weight:500;font-size:14px;padding:8px 12px;border-radius:8px;}
.choice small{color:var(--muted);font-size:12px;}
@media (hover:hover){ .choice:hover{background:rgba(128,128,128,.22);} }

/* Fenster mit Bereichen und Listen (Löschen, Lieferscheine, Mehr) – alle Ziele mindestens 44 px hoch */
.panel-modal{background:var(--card);border-radius:12px;padding:14px;display:flex;flex-direction:column;
  gap:10px;box-shadow:0 10px 40px rgba(0,0,0,.4);width:min(520px,94vw);max-height:88vh;}
.panel-head{display:flex;align-items:center;justify-content:space-between;}
.panel-head strong{font-size:15px;}
.panel-body{overflow-y:auto;display:flex;flex-direction:column;gap:16px;min-height:0;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;}
.panel-sec-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;
  font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;}
.panel-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.panel-grid button{min-height:44px;text-align:left;padding:9px 10px;font-size:12px;overflow-wrap:anywhere;}
.panel-all{min-height:44px;}
.panel-row{display:flex;align-items:center;gap:8px;padding:2px 0;border-top:1px solid rgba(128,128,128,.15);}
.panel-row .panel-text{flex:1;min-width:0;font-size:13px;line-height:1.3;padding:6px 0;}
.panel-row button{min-width:44px;min-height:44px;}
.panel-empty{font-size:12px;color:var(--muted);padding:4px 0;}
.panel-note{font-size:12px;color:var(--muted);line-height:1.4;margin:0;}
.menu-list{display:flex;flex-direction:column;gap:6px;}
.menu-list button{min-height:46px;text-align:left;padding:10px 12px;font-size:14px;}

/* Kunden-/Adresssuche: Rechnungsempfänger links, Lieferadressen rechts */
.kunden-modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:500;display:flex;align-items:center;justify-content:center;padding:20px;}
.kunden-modal{background:var(--card);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:10px;
  box-shadow:0 10px 40px rgba(0,0,0,.4);width:min(760px,94vw);height:min(600px,88vh);}
.kunden-modal-head{display:flex;gap:8px;align-items:center;}
.kunden-modal-head input{flex:1;padding:8px 10px;border-radius:8px;border:1px solid rgba(128,128,128,.3);background:var(--bg);color:var(--text);font-size:14px;}
.kunden-modal-body{display:flex;gap:10px;flex:1;min-height:0;}
.kunden-col{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;gap:6px;}
.kunden-col-title{font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;}
/* flex:1 statt max-height: die Liste füllt den Platz immer, das Fenster schrumpft nicht mit der Trefferzahl */
.kunden-chip-list{overflow-y:auto;display:flex;flex-direction:column;gap:6px;flex:1;min-height:0;
  border:1px solid rgba(128,128,128,.15);border-radius:8px;padding:6px;overscroll-behavior:contain;}
.kunden-chip{display:block;width:100%;text-align:left;background:rgba(128,128,128,.1);border:1px solid transparent;
  border-radius:8px;padding:7px 9px;cursor:pointer;font-size:13px;line-height:1.3;font:inherit;color:var(--text);}
@media (hover:hover){ .kunden-chip:hover{background:rgba(128,128,128,.2);} }
.kunden-chip.selected{background:var(--blue);color:#fff;border-color:var(--blue-dark);}
.kunden-chip .chip-sub{font-size:11px;color:var(--muted);}
.kunden-chip.selected .chip-sub{color:rgba(255,255,255,.8);}
.kunden-modal-actions{display:flex;justify-content:flex-end;gap:8px;}
.kunden-empty{font-size:12px;color:var(--muted);padding:8px;}
@media (max-width:600px){ .kunden-modal-body{flex-direction:column;} }

/* ---------- 7. Unterschrift ----------
   Eigenes Overlay statt Inline-Zeichnen. Auf dem Smartphone (kürzere Bildschirmseite < 600 px) gibt es im
   Hochformat nur einen Dreh-Hinweis; sobald das Gerät echt quer liegt, füllt das Feld den ganzen Bildschirm
   (.sig-modal.phone.landscape). Tablet/Desktop bekommen immer den normalen, kleineren Dialog. */
.sig-modal{background:var(--card);border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:10px;
  box-shadow:0 10px 40px rgba(0,0,0,.4);width:min(960px,92vw);}
#sigRotateView{display:none;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:28px 20px;text-align:center;color:var(--text);}
.sig-rotate-icon{font-size:56px;line-height:1;animation:sigRotatePulse 1.6s ease-in-out infinite;}
@keyframes sigRotatePulse{0%,100%{transform:rotate(0deg);}50%{transform:rotate(90deg);}}
.sig-rotate-text{margin:0;font-size:16px;font-weight:600;}
.sig-rotate-hint{margin:0;font-size:12px;color:var(--muted);max-width:280px;}
/* Breite/Höhe der Zeichenfläche setzt signature.js exakt im Seitenverhältnis des Zielfelds:
   die Anzeige verzerrt nicht und das PDF hat keinen unnötigen Leerraum um die Unterschrift. */
#sigPadView{display:flex;flex-direction:column;gap:10px;flex:1;min-height:0;}
.sig-modal-canvas-wrap{position:relative;background:#fff;border:1px solid rgba(128,128,128,.3);border-radius:8px;overflow:hidden;}
.sig-modal-canvas-wrap canvas{display:block;width:100%;height:100%;touch-action:none;}
/* 100dvh statt 100vh: ein-/ausblendende Adressleisten auf iOS lösen sonst ständig neues Layout aus */
.sig-modal.phone.landscape{width:100vw;height:100dvh;max-width:none;border-radius:0;margin:0;}

/* ---------- 8. Datumsauswahl ---------- */
.datepicker-pop{position:fixed;z-index:1000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;
  box-shadow:0 4px 18px rgba(0,0,0,.25);padding:8px;width:340px;max-width:calc(100vw - 16px);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;font-size:14px;}
.datepicker-pop .dp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;}
.datepicker-pop .dp-head button{background:none;border:0;font-size:18px;line-height:1;cursor:pointer;padding:8px 12px;color:#111;font-weight:700;border-radius:4px;}
@media (hover:hover){ .datepicker-pop .dp-head button:hover{background:#eee;} }
.datepicker-pop .dp-title{font-weight:600;text-transform:capitalize;}
.datepicker-pop .dp-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px;text-align:center;}
.datepicker-pop .dp-dow{font-size:11px;color:#888;padding:2px 0;}
/* Mindestens ~44 px Kantenlänge (Apples Richtlinie für Touch-Ziele), sonst Fehltipps auf Nachbartage */
.datepicker-pop .dp-day{min-height:44px;display:flex;align-items:center;justify-content:center;border-radius:4px;cursor:pointer;}
/* Auf reinen Touchscreens (hover:none) greift Hover gar nicht erst: verhindert das „Nachleuchten“ des Felds dahinter */
@media (hover:hover){ .datepicker-pop .dp-day:hover{background:#eef3fb;} }
.datepicker-pop .dp-day.dp-muted{color:#bbb;}
.datepicker-pop .dp-day.dp-today{box-shadow:inset 0 0 0 1px #1b4f8f;}
.datepicker-pop .dp-day.dp-selected{background:#1b4f8f;color:#fff;}
.datepicker-pop .dp-clear{margin-top:6px;width:100%;background:rgba(128,128,128,.15);border:0;border-radius:6px;padding:8px;cursor:pointer;font-size:12px;color:#111;}
@media (hover:hover){ .datepicker-pop .dp-clear:hover{background:rgba(128,128,128,.28);} }

/* ---------- 9. Zellenmenü ----------
   #cellWrap hängt beim Bearbeiten INNERHALB von .sheet (Blattkoordinaten): so wandert das Symbol beim Scrollen und
   Zoomen exakt mit dem Feld, unabhängig von Tastatur und visuellem Viewport (iOS). Gegen den Zoom des Blatts
   wird es per scale(1/zoom) auf gleicher Bildschirmgröße gehalten (siehe ui/cellmenu.js). */
#cellWrap{position:absolute;width:0;height:0;display:none;transform-origin:0 0;z-index:30;}
#cellBtn{position:absolute;left:0;top:-18px;display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;
  border-radius:8px;background:var(--blue);color:#fff;font-size:18px;line-height:1;box-shadow:0 2px 8px rgba(0,0,0,.35);}
#cellBtn:active{background:var(--blue-dark);}
#cellMenu{position:absolute;right:-36px;display:none;width:min(300px,86vw);max-height:min(60vh,440px);overflow-y:auto;
  overscroll-behavior:contain;background:var(--card);color:var(--text);border-radius:10px;padding:6px;
  box-shadow:0 6px 26px rgba(0,0,0,.35);border:1px solid rgba(128,128,128,.25);}
#cellMenu button{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;
  text-align:left;background:none;color:var(--text);border-radius:8px;padding:8px 10px;font-size:14px;font-weight:600;}
#cellMenu button.sub{font-weight:400;padding-left:24px;}
#cellMenu button small{color:var(--muted);font-size:12px;font-weight:400;flex-shrink:0;}
#cellMenu .cm-note{font-size:12px;color:var(--muted);padding:6px 10px 8px 24px;}
@media (hover:hover){ #cellMenu button:hover{background:rgba(128,128,128,.16);} }

/* ---------- 10. Scanner-Overlay und Lieferschein-Ansicht ---------- */
/* overflow:hidden macht das Overlay zum Scroll-Container: das touch-action von html/body reicht dann nicht in den
   Scanner hinein (er braucht seine eigenen Gesten). */
#scannerOverlay{position:fixed;inset:0;z-index:800;background:var(--bg);overflow:hidden;touch-action:auto;}
#scannerOverlay iframe{display:block;width:100%;height:100%;border:0;}
#lsViewer{position:fixed;inset:0;z-index:850;background:#000;display:none;flex-direction:column;}
#lsViewer .lv-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;color:#fff;font-size:14px;font-weight:600;}
/* Auf schwarzem Hintergrund brauchen die Knöpfe eigene helle Farben */
#lsViewer .lv-head button{background:rgba(255,255,255,.2);color:#fff;min-height:44px;padding:8px 16px;flex-shrink:0;}
#lsViewer .lv-head span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
/* Scroll-Container: touch-action von html/body gilt hier nicht, die Seiten lassen sich per Pinch vergrößern */
#lsViewer .lv-body{flex:1;overflow:auto;padding:0 10px 14px;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y pinch-zoom;}
#lsViewer img{display:block;width:100%;max-width:900px;margin:0 auto 10px;background:#fff;}

/* ---------- 11. Hinweise am unteren Rand ---------- */
#toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#222;color:#fff;padding:10px 18px;
  border-radius:8px;font-size:13px;z-index:900;opacity:0;transition:opacity .25s;pointer-events:none;max-width:92vw;text-align:center;}
#toast.show{opacity:1;}
/* Rückgängig-Hinweis: über den Dialogen (z-index 500) sichtbar */
#undoToast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:900;display:none;align-items:center;gap:12px;
  max-width:92vw;background:#222;color:#fff;padding:8px 8px 8px 16px;border-radius:8px;font-size:13px;box-shadow:0 4px 18px rgba(0,0,0,.35);}
#undoToast button{background:rgba(255,255,255,.18);color:#fff;min-height:36px;padding:6px 12px;}

/* ---------- 12. Anmeldung und Verwaltung (Cloud) ---------- */
/* Vor der Anmeldung ist von der App nichts zu sehen (siehe ui/login.js) */
#loginView{display:none;min-height:100vh;min-height:100dvh;align-items:center;justify-content:center;padding:20px;}
body.logged-out #loginView{display:flex;}
body.logged-out .topbar, body.logged-out #listView, body.logged-out #formView, body.logged-out #scannerOverlay{display:none !important;}
.login-card{width:100%;max-width:380px;background:var(--card);border-radius:14px;padding:22px 20px;box-shadow:0 2px 12px rgba(0,0,0,.12);}
.login-card h1{font-size:19px;margin:0 0 4px;}
.login-sub{margin:0 0 14px;color:var(--muted);font-size:13px;line-height:1.4;}
.login-card form{display:flex;flex-direction:column;gap:6px;}
.login-card label{font-size:12px;font-weight:600;color:var(--muted);margin-top:6px;}
.login-card input{font:inherit;font-size:16px;padding:11px 12px;border-radius:8px;border:1px solid rgba(128,128,128,.35);background:var(--bg);color:var(--text);width:100%;}
.login-card input:focus-visible, .admin-row input:focus-visible, .admin-row select:focus-visible{outline:2px solid var(--blue);outline-offset:1px;}
.login-card form .btn-primary{margin-top:12px;padding:12px 14px;font-size:15px;}
.login-card .btn-secondary{width:100%;margin-top:8px;padding:11px 14px;}
.btn-link{background:none;color:var(--blue);padding:10px 2px;font-weight:600;margin-top:4px;}
.login-msg{min-height:1.2em;margin:8px 0 0;font-size:13px;line-height:1.4;color:var(--muted);}
.login-msg.bad{color:var(--danger);}
.login-wait-text{font-size:14px;line-height:1.5;margin:0 0 6px;}
/* Verwaltung (Nutzer, Einladungen, Stammdaten) */
.admin-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 0;border-top:1px solid rgba(128,128,128,.15);}
.admin-row input[type=text], .admin-row input[type=email], .admin-row select{font:inherit;font-size:14px;padding:8px 9px;border-radius:7px;border:1px solid rgba(128,128,128,.3);background:var(--bg);color:var(--text);min-width:0;}
.admin-row .grow{flex:1 1 140px;}
.admin-row .mail{flex:1 1 100%;font-size:12px;color:var(--muted);word-break:break-all;}
.admin-row label.chk{display:flex;align-items:center;gap:5px;font-size:13px;}
.admin-row button{min-height:38px;}
.pane-wide{max-width:560px;width:100%;}

/* ---------- 13. Dekadenabgabe (Auswahlmodus, siehe ui/dekade.js) ---------- */
.list-tools #dekadeBtn{white-space:nowrap;}
.list-item.selectable{cursor:pointer;user-select:none;-webkit-user-select:none;}
.list-item.selectable.selected{outline:2px solid var(--blue);background:rgba(27,79,143,.08);}
.sel-box{font-size:24px;line-height:1;color:var(--blue);flex-shrink:0;}
.tag.orig{background:rgba(27,79,143,.16);color:var(--blue);}
.list-item.abgegeben{opacity:.75;border-left:4px solid var(--gray-line);}
#dekadeBar{position:fixed;left:0;right:0;bottom:0;z-index:60;background:var(--card);border-top:1px solid rgba(128,128,128,.35);
  padding:10px 14px calc(10px + env(safe-area-inset-bottom));display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;box-shadow:0 -2px 10px rgba(0,0,0,.15);}
#dekadeBar[hidden]{display:none !important;}
#dekadeCount{flex:1 1 100%;font-size:13px;font-weight:600;}
.dekade-actions{display:flex;flex-wrap:wrap;gap:6px;}
.dekade-actions:last-child{margin-left:auto;}
#dekadeBar .dekade-actions button{min-height:40px;}
body.dekade-aktiv #listView{padding-bottom:150px;}
body.logged-out #dekadeBar{display:none !important;}
body.in-form #dekadeBar{display:none !important;}
