:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #2f5fd0;
  --accent-soft: #e8eefc;
  --green: #1f8a4c;
  --green-soft: #e3f4ea;
  --amber: #a86200;
  --amber-soft: #fdf1df;
  --red: #c0392b;
  --red-soft: #fbe7e5;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --panel: #1c2029;
    --text: #e6e8ee;
    --muted: #949bab;
    --line: #2d323d;
    --accent: #6d93f2;
    --accent-soft: #23304d;
    --green: #5ccb8a;
    --green-soft: #1c3427;
    --amber: #f0b458;
    --amber-soft: #3a2c16;
    --red: #f07b6e;
    --red-soft: #3c201d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
code { font-size: 12.5px; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; margin-top: 8px; }
.spacer { flex: 1; }

/* Kopfzeile */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; color: var(--accent); }
.brand { white-space: nowrap; }
nav { display: flex; gap: 4px; height: 100%; }
.tab {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 550;
  padding: 0 14px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }
body:has(#view-feste.active) main { max-width: 1480px; }
.view { display: none; }
.view.active { display: block; }

/* Panels & Karten */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.panel.flush { padding: 0; overflow-x: auto; }
.panel h2 { font-size: 14px; margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span2 { grid-column: span 2; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12.5px; }
.card .value { font-size: 26px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--accent); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 36px; align-items: center; gap: 10px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--accent-soft); border-radius: 4px; height: 10px; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 4px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { color: var(--text); text-decoration: none; }
#funktionen-liste li { gap: 16px; }
#funktionen-liste a.muted { color: var(--muted); white-space: nowrap; }
#funktionen-liste .personen { text-align: right; }
.list li.small-li { font-size: 12.5px; }
.list a:hover { color: var(--accent); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#suche { width: 320px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 550; text-decoration: none;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn.ghost { border-color: transparent; color: var(--accent); }
.icon { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }

/* Tabelle */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th.sorted::after { content: " ▲"; font-size: 9px; }
.table th.sorted.desc::after { content: " ▼"; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td .sub { color: var(--muted); font-size: 12.5px; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table.compact tbody tr { cursor: default; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.aktiv { background: var(--green-soft); color: var(--green); }
.badge.passiv { background: var(--amber-soft); color: var(--amber); }
.badge.ausgetreten { background: var(--line); color: var(--muted); }
.offen, .table td .sub.offen { color: var(--red); font-weight: 600; }
.ok, .table td .sub.ok { color: var(--green); }

/* Dialog */
dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  width: min(760px, 94vw); background: var(--panel); color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(15, 20, 30, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.dlg-head h2 { margin: 0; font-size: 17px; }
.subtabs { display: flex; gap: 4px; padding: 8px 20px 0; border-bottom: 1px solid var(--line); }
.subtab { border: 0; background: none; font: inherit; color: var(--muted); padding: 8px 10px; cursor: pointer; border-bottom: 2px solid transparent; }
.subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pane { display: none; padding: 16px 20px 20px; }
.pane.active { display: block; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.fgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.fgrid .c2 { grid-column: span 2; }
.fgrid .c3 { grid-column: span 3; }
.fgrid input, .fgrid select, .fgrid textarea { color: var(--text); font-weight: 400; }
.dlg-foot { display: flex; gap: 8px; margin-top: 18px; }
.error { margin-top: 12px; padding: 8px 12px; border-radius: 7px; background: var(--red-soft); color: var(--red); }
.beitrag-info { display: flex; gap: 24px; margin-bottom: 14px; }
.beitrag-info div span { display: block; font-size: 12px; color: var(--muted); }
.beitrag-info div b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pay-form { margin-bottom: 12px; }
.pay-form input { width: 9rem; }

/* Feuerwehr-Beitragsbefreiung */
.fgrid .fw-box {
  flex-direction: column; gap: 2px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.fgrid .fw-box:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.fw-row { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.fw-row input { width: 16px; height: 16px; accent-color: var(--red); }
.fw-hint { font-weight: 400; }
.badge.feuerwehr { background: var(--red-soft); color: var(--red); }
.fgrid input:disabled { opacity: .6; }

/* Kasse */
#r-suche { width: 280px; }
dialog.wide { width: min(1040px, 96vw); }
.r-layout { display: grid; grid-template-columns: 1fr 300px; gap: 0; border-top: 1px solid var(--line); margin-top: 12px; }
.r-layout .pane { border-right: 1px solid var(--line); }
.dlg-foot.pad { padding: 14px 20px 18px; margin: 0; border-top: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.seg label { cursor: pointer; }
.seg input { display: none; }
.seg span { display: block; padding: 6px 16px; color: var(--muted); font-weight: 550; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg label:first-child input:checked + span { background: var(--red); }
.seg label:last-child input:checked + span { background: var(--green); }
.beleg { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.beleg-head { font-weight: 600; font-size: 13px; }
.beleg-vorschau:empty { display: none; }
.beleg-vorschau { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.beleg-vorschau iframe, .beleg-vorschau img { display: block; width: 100%; height: 300px; border: 0; object-fit: contain; }
.beleg-vorschau .datei { padding: 14px; word-break: break-all; }
.dropzone {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--line); border-radius: 10px; padding: 18px; min-height: 110px;
  color: var(--muted); cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone b { color: var(--accent); }
.beleg-actions .btn { padding: 5px 10px; }
#r-drop.over { outline: 2px dashed var(--accent); outline-offset: 4px; }
.badge.offen { background: var(--amber-soft); color: var(--amber); }
.badge.bezahlt { background: var(--green-soft); color: var(--green); }
.badge.storniert { background: var(--line); color: var(--muted); text-decoration: line-through; }
.badge.ueberfaellig { background: var(--red-soft); color: var(--red); }
.betrag-aus { color: var(--red); }
.betrag-ein { color: var(--green); }
tr.storniert td { opacity: .55; }
.clip { color: var(--accent); text-decoration: none; font-size: 16px; }
.card .value.neg { color: var(--red); }
.card .value.pos { color: var(--green); }

/* Anmeldung */
.login {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.login-brand { margin-bottom: 4px; white-space: normal; line-height: 1.3; }
.brand .name-kurz { display: none; }
@media (max-width: 1100px) {
  .brand .name-lang { display: none; }
  .brand .name-kurz { display: inline; }
}
.login-box h1 { font-size: 20px; margin: 4px 0 0; }
.login-box p { margin: 0; }
.login-box label, .stack label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.login-box input, .stack input { color: var(--text); font-weight: 400; }
.login:not(.setup) .setup-only { display: none; }
.btn.block { justify-content: center; padding: 9px 14px; margin-top: 4px; }
body.locked .topbar, body.locked main { visibility: hidden; }

/* Benutzermenü */
.usermenu { position: relative; }
.userbtn {
  display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none;
  font: inherit; color: var(--text); padding: 4px 8px; border-radius: 8px; cursor: pointer;
}
.userbtn:hover { border-color: var(--line); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 650; font-size: 12px;
}
.caret { color: var(--muted); font-size: 10px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.menu button:hover { background: var(--accent-soft); }
.menu-info { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.menu-info b { display: block; color: var(--text); font-size: 14px; }

/* Benutzerverwaltung */
dialog.narrow { width: min(440px, 94vw); }
.stack { display: flex; flex-direction: column; gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-size: 12.5px; color: var(--muted); font-weight: 550; padding: 0 4px; }
.stack .check { color: var(--text); }
.badge.recht { background: var(--accent-soft); color: var(--accent); margin-right: 4px; }
.badge.inaktiv { background: var(--line); color: var(--muted); }

/* Dokumente & Bilder */
.seg.seg-plain { margin-bottom: 0; }
.seg.seg-plain label input:checked + span { background: var(--accent); color: #fff; }
.seg.seg-plain span { padding: 6px 12px; }
.seg small { opacity: .75; font-weight: 400; }
#d-suche { width: 240px; }
/* Ordnerstruktur */
body:has(#view-dokumente.active) main { max-width: 1480px; }
.dok-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.dok-baum { position: sticky; top: 72px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.dok-baum .panel-kopf { padding: 10px 12px; }
.btn.klein { padding: 3px 9px; font-size: 12.5px; }
.baum { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.baum ul { list-style: none; margin: 0; padding-left: 14px; }
.baum .knoten {
  display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; user-select: none; border: 1px solid transparent;
}
.baum .knoten:hover { background: var(--accent-soft); }
.baum .knoten.aktiv { background: var(--accent); color: #fff; }
.baum .knoten.aktiv .n { color: rgba(255,255,255,.8); }
.baum .knoten.drop { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.baum .pfeil { width: 16px; text-align: center; color: var(--muted); font-size: 10px; flex: none; }
.baum .knoten.aktiv .pfeil { color: #fff; }
.baum .name { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.baum .n { font-size: 11.5px; color: var(--muted); }
.baum-tipp { padding: 0 12px 12px; margin: 0; }
.dok-inhalt { min-width: 0; }
.dok-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pfad { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 16px; font-weight: 600; }
.pfad a { color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.pfad a:hover { background: var(--accent-soft); color: var(--accent); }
.pfad a.drop { background: var(--accent-soft); outline: 1px solid var(--accent); }
.pfad .sep { color: var(--muted); }
.pfad b { padding: 2px 6px; }
.kachel.ordner .thumb { background: var(--accent-soft); }
.ordner-icon { font-size: 52px; line-height: 1; filter: saturate(.9); }
.kachel.ordner.drop, tr.ordner-zeile.drop td { outline: 2px solid var(--accent); background: var(--accent-soft); }
.kachel { position: relative; }
.kachel .wahl {
  position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; z-index: 2;
  opacity: 0; transition: opacity .1s; accent-color: var(--accent); cursor: pointer;
}
.kachel:hover .wahl, .kachel .wahl:checked, .galerie.auswahl-modus .wahl { opacity: 1; }
.kachel.gewaehlt { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
tr.gewaehlt td { background: var(--accent-soft); }
.auswahl-leiste {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 12px;
  border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent);
}
.pfad-klein { font-size: 11.5px; color: var(--accent); }
/* Freigaben */
.freigabe-liste { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow-y: auto; }
.freigabe-zeile { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.freigabe-zeile:last-child { border-bottom: 0; }
.freigabe-zeile.alle { background: var(--bg); }
.freigabe-zeile .wer { flex: 1; min-width: 0; }
.freigabe-zeile .wer small { display: block; color: var(--muted); }
.stack .freigabe-zeile label {
  display: flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer;
  font-size: 14px; font-weight: 400; color: var(--text);
}
.stack .freigabe-zeile label.hoch { font-size: 12.5px; color: var(--muted); gap: 6px; flex: none; }
.freigabe-zeile input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.freigabe-zeile .hoch { font-size: 12.5px; color: var(--muted); }
.freigabe-zeile.aus .hoch { opacity: .4; pointer-events: none; }
.freigabe-zeile.voll { opacity: .6; }
/* Rollen & Stufen im Benutzer-Dialog */
.rollen-wahl, .bereich-rechte { display: flex; flex-direction: column; gap: 6px; }
.stack .rollen-wahl label.rolle { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; color: var(--text); cursor: pointer; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.rollen-wahl label.rolle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rollen-wahl label.rolle input { margin-top: 3px; accent-color: var(--accent); }
.rollen-wahl label.rolle small { display: block; color: var(--muted); font-size: 12px; }
.bereich-zeile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 14px; }
.stufen { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stack .stufen label { display: inline-flex; flex-direction: row; margin: 0; cursor: pointer; font-weight: 400; }
.stufen input { position: absolute; opacity: 0; pointer-events: none; }
.stufen span { padding: 4px 10px; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line); }
.stufen label:first-child span { border-left: 0; }
.stufen input:checked + span { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.stufen input:focus-visible + span { outline: 2px solid var(--accent); }
.badge.lesend { background: var(--line); color: var(--text); }
.badge.rolle-funktion { background: var(--accent-soft); color: var(--accent); }
.ru-tabelle select { font-size: 12.5px; padding: 3px 6px; }
.ru-stufe.stufe-keine { color: var(--muted); }
.ru-stufe.stufe-bearbeiten { font-weight: 600; }

/* Nur-Lese-Konten: Bearbeiten-Elemente ausblenden (der Server lehnt Änderungen ohnehin ab) */
body.nur-lesen-mitglieder :is(#btn-neu, #btn-loeschen, #sub-stamm button[type="submit"], #sub-beitraege .pay-form, #zahlungen [data-del]),
body.nur-lesen-daten #import-panel,
body.nur-lesen-kasse :is(#btn-r-neu, #btn-r-loeschen, #dlg-r button[type="submit"], #beleg-entfernen, #dropzone),
body.nur-lesen-feste :is(#btn-fest-neu, #btn-fest-loeschen, #form-fest button[type="submit"], #btn-uebernehmen, #posten-neu, #posten-tabelle [data-del], #uebernahme-hinweis) { display: none !important; }
#ru-panel { margin-top: 16px; }
#ru-panel .panel-kopf { display: flex; align-items: center; gap: 12px; }
.ru-hinweis { margin: 0; padding: 0 16px 8px; }
.ru-titel { font-size: 14px; margin: 16px 16px 4px; }
.ru-tabelle td { vertical-align: top; white-space: normal; }
.ru-tabelle .ru-recht { text-align: center; width: 1%; white-space: nowrap; font-size: 12px; padding-left: 6px; padding-right: 6px; }
.ru-tabelle td:nth-last-child(2) { min-width: 300px; }
.ru-tabelle td:first-child { white-space: nowrap; }
.ru-ordner { line-height: 1.4; margin-bottom: 6px; }
.ru-ordner:last-child { margin-bottom: 0; }
.ru-inaktiv td { opacity: .55; }
@media print {
  body.druck-rechte .topbar, body.druck-rechte .view:not(#view-benutzer), body.druck-rechte #view-benutzer > :not(#ru-panel),
  body.druck-rechte #ru-drucken, body.druck-rechte #toast { display: none !important; }
  body.druck-rechte, body.druck-rechte * { color: #000 !important; background: #fff !important; }
  body.druck-rechte #ru-panel { border: 0; margin: 0; }
}
.einmal-box { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--bg); }
.einmal-box > div { display: flex; flex-direction: column; gap: 2px; }
.einmal-box code { font-size: 15px; user-select: all; word-break: break-all; }
.einmal-box code.gross { font-size: 22px; font-weight: 700; letter-spacing: 1px; color: var(--accent); }
#dlg-ds { width: min(720px, 94vw); }
.ds-text { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px 12px; font-size: 14px; line-height: 1.55; }
.ds-text h3 { font-size: 15px; margin: 16px 0 4px; }
.ds-text p, .ds-text ul { margin: 4px 0; }
.ds-text ul { padding-left: 20px; }
.ds-text .ergaenzen { background: #fde68a; color: #111; padding: 0 4px; border-radius: 3px; }
.stack label.ds-check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; color: var(--text); cursor: pointer; }
.ds-check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.f-zurueck { font-size: 13px; text-decoration: none; align-self: flex-start; }
.f-unter-titel { margin: 4px 0 0; font-size: 14px; }
.f-unter-titel small { font-weight: 400; }
.unter-zeile { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.unter-zeile:last-child { border-bottom: 0; }
.unter-zeile .wer { flex: 1; min-width: 0; }
.unter-zeile .wer small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unter-zeile .wer small.eigen { color: var(--accent); }
.unter-zeile .btn { flex: none; padding: 4px 10px; font-size: 12.5px; }
.hinweis-klein { font-size: 12.5px; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); }
.geteilt { font-size: 12px; margin-left: 2px; }
.kachel .geteilt-badge {
  position: absolute; top: 8px; right: 8px; background: var(--accent); color: #fff; border-radius: 99px;
  font-size: 11px; padding: 2px 8px; font-weight: 600;
}
.nur-lesen-hinweis { padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); margin-bottom: 12px; font-size: 13px; }
@media (max-width: 760px) {
  .dok-layout { grid-template-columns: 1fr; }
  .dok-baum { position: static; max-height: 260px; }
}
.d-drop { min-height: 200px; border-radius: var(--radius); transition: .15s; }
.d-drop.over { outline: 2px dashed var(--accent); outline-offset: 6px; background: var(--accent-soft); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.galerie:empty { display: none; }
.kachel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; transition: .15s;
}
.kachel:hover { border-color: var(--accent); transform: translateY(-1px); }
.kachel .thumb { aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.kachel .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon {
  width: 56px; height: 70px; border-radius: 6px; position: relative; display: grid; place-items: end center;
  padding-bottom: 8px; font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .03em;
  background: var(--muted);
}
.ficon::before {
  content: ""; position: absolute; top: 0; right: 0; width: 16px; height: 16px;
  background: linear-gradient(225deg, var(--bg) 50%, rgba(255,255,255,.35) 50%); border-bottom-left-radius: 4px;
}
.ficon.pdf { background: #d0453a; }
.ficon.doc, .ficon.docx, .ficon.odt, .ficon.rtf { background: #2f5fd0; }
.ficon.xls, .ficon.xlsx, .ficon.ods, .ficon.csv { background: #1f8a4c; }
.ficon.ppt, .ficon.pptx, .ficon.odp { background: #c46a12; }
.ficon.sm { width: 28px; height: 34px; font-size: 8px; padding-bottom: 4px; border-radius: 4px; }
.ficon.sm::before { width: 9px; height: 9px; }
.kachel .info { padding: 9px 11px 11px; min-width: 0; }
.kachel .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kachel .info span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mini-thumb { width: 40px; height: 32px; object-fit: cover; border-radius: 4px; display: block; }
.d-progress { margin-bottom: 12px; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); }
.d-progress ul { margin: 6px 0 0; padding-left: 18px; color: var(--red); }
.d-layout { display: grid; grid-template-columns: 1.4fr 1fr; border-top: 1px solid var(--line); margin-top: 12px; }
.d-vorschau { background: var(--bg); display: grid; place-items: center; min-height: 420px; border-right: 1px solid var(--line); }
.d-vorschau img { max-width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.d-vorschau iframe { width: 100%; height: 62vh; border: 0; display: block; }
.d-vorschau .ohne { text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.d-layout .stack textarea { color: var(--text); }
.d-meta { margin: 0; line-height: 1.6; }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.subnav .subtab { font-weight: 550; }
#ag-suche { width: 300px; }
.ampel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.ampel::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.ampel.bald::before { background: var(--amber); }
.ampel.ueberfaellig::before, .ampel.fehlt::before { background: var(--red); }
.ampel.ueberfaellig, .ampel.fehlt { color: var(--red); font-weight: 600; }
.ampel.bald { color: var(--amber); font-weight: 600; }
.ampel.keine::before { background: var(--line); }
.ampel.keine { color: var(--muted); }
.badge.einsatzbereit { background: var(--green-soft); color: var(--green); }
.badge.in-wartung { background: var(--amber-soft); color: var(--amber); }
.badge.defekt { background: var(--red-soft); color: var(--red); }
.badge.ausgesondert { background: var(--line); color: var(--muted); }
.badge.nicht-bereit { background: var(--red-soft); color: var(--red); }
.as-layout { display: grid; grid-template-columns: 1fr 1.15fr; border-top: 1px solid var(--line); margin-top: 12px; }
.as-layout > form.pane { border-right: 1px solid var(--line); }
.as-seite { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.as-seite h3 { font-size: 13px; margin: 6px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fgrid.zwei { grid-template-columns: 1fr 1fr; }
.fgrid.zwei .c2 { grid-column: span 2; }
.fristen { display: flex; flex-direction: column; gap: 6px; }
.frist { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.frist .was { font-weight: 550; }
.frist .was small { display: block; color: var(--muted); font-weight: 400; }
.frist.ok { color: var(--text); }
.frist.ueberfaellig, .frist.fehlt { border-color: var(--red); background: var(--red-soft); }
.frist.bald { border-color: var(--amber); background: var(--amber-soft); }
.kpi-ampel .value.neg { color: var(--red); }
#ap-tabelle input[data-f="name"], #ap-neu-name { width: 100%; min-width: 280px; }
.intervall-zelle { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.intervall-zelle input { width: 64px; text-align: right; }
.intervall-zelle select { width: 96px; }
#as-uebersicht .table td { white-space: normal; vertical-align: top; }
#as-uebersicht .table td:last-child { white-space: nowrap; }
@media (max-width: 760px) {
  .as-layout { grid-template-columns: 1fr; }
  .as-layout > form.pane { border-right: 0; border-bottom: 1px solid var(--line); }
  #ag-suche { width: 100%; }
}

/* Wetter-Haken */
.wetter-feld { display: flex; flex-direction: column; gap: 6px; }
.wetter-label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.wetter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wetter-chips label { cursor: pointer; }
.wetter-chips input { position: absolute; opacity: 0; pointer-events: none; }
.wetter-chips span {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; user-select: none;
}
.wetter-chips span:hover { border-color: var(--accent); }
.wetter-chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.wetter-chips input:checked + span::after { content: "✓"; font-size: 11px; }
.wetter-chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.wetter-icons { letter-spacing: 1px; }

/* Festlichkeiten */
.feste-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.feste-seite { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 72px; }
.feste-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 200px); overflow-y: auto; }
.feste-liste li {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer;
}
.feste-liste li:hover { border-color: var(--accent); }
.feste-liste li.active { border-color: var(--accent); background: var(--accent-soft); }
.feste-liste b { display: block; }
.feste-liste span { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.feste-liste .jahr { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 2px 0; background: none; border: 0; cursor: default; }
.feste-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.feste-detail .cards { margin: 0; }
.fest-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.fest-kopf h2 { margin: 0; font-size: 17px; }
.panel-kopf { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-kopf h2 { margin: 0; font-size: 14px; }
.table-scroll { overflow-x: auto; }
.table.posten td { padding: 4px 6px; }
.table.posten th { padding: 9px 6px; }
.table.posten tbody tr { cursor: default; }
.table.posten tbody tr:hover { background: none; }
.table.posten input, .table.posten select { width: 100%; padding: 5px 7px; border-color: transparent; background: transparent; }
.table.posten input:hover, .table.posten select:hover { border-color: var(--line); }
.table.posten input:focus, .table.posten select:focus { background: var(--panel); }
.table.posten th { font-size: 11px; line-height: 1.25; vertical-align: bottom; }
.table.posten th small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.table.posten { min-width: 1040px; }
.table.posten td:nth-child(1) { width: 98px; min-width: 98px; }
.table.posten td:nth-child(2) { min-width: 128px; }
.table.posten td:last-child { width: 26px; padding-left: 0; padding-right: 2px; }
.table.posten .calc { padding-right: 4px !important; }
.table.posten td:nth-child(3) { width: 84px; min-width: 84px; }
.table.posten td:nth-child(4), .table.posten td:nth-child(5),
.table.posten td:nth-child(7), .table.posten td:nth-child(9) { width: 74px; min-width: 74px; }
.table.posten td:nth-child(8) { width: 124px; min-width: 124px; }
.table.posten td, .table.posten th { padding-left: 4px; padding-right: 4px; }
.inhalt-zelle { display: flex; align-items: center; gap: 2px; }
.inhalt-zelle input { min-width: 0; flex: 1 1 50px; }
.table.posten .inhalt-zelle select { width: 70px; flex: 0 0 70px; padding: 5px 2px; }
.inhalt-zelle.portion { margin-top: 2px; font-size: 12px; color: var(--muted); }
.inhalt-zelle.portion input { flex: 0 1 60px; }
.table.posten td:nth-child(4) input, .table.posten td:nth-child(5) input, .table.posten td:nth-child(7) input,
.table.posten td:nth-child(8) input, .table.posten td:nth-child(9) input { text-align: right; }
.table.posten .calc.neg { color: var(--red); }
.table.posten .calc.pos { color: var(--green); }
.table.posten tfoot td { border-bottom: 0; }
.table.posten .calc { text-align: right; font-variant-numeric: tabular-nums; padding-right: 12px; white-space: nowrap; }
.table.posten tr.saved td { background: var(--green-soft); transition: background .6s; }
.table.posten tr.kat-kopf td { background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 12px; }
.neu-zeile td { border-top: 2px solid var(--line); background: var(--bg); }
.neu-zeile input, .neu-zeile select { border-color: var(--line) !important; background: var(--panel) !important; }
.hinweis { margin: 12px 16px 0; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vergleich-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 14px 16px; }
.vk { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.vk .label { font-size: 12px; color: var(--muted); }
.vk .werte { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.vk .werte b { font-size: 18px; }
.vk .werte span { color: var(--muted); font-size: 12.5px; }
.delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--amber); }
.delta.down { color: var(--accent); }
.delta.gleich { color: var(--muted); }
.table.vergleich td, .table.vergleich th { padding: 7px 9px; font-size: 13px; }
.table.vergleich th { font-size: 11px; }
.table.vergleich td:last-child { white-space: normal; min-width: 170px; }
.table.vergleich .vz { font-size: 12px; color: var(--muted); margin-top: 2px; }
#vergleich-panel { overflow: visible; }
.table.vergleich tbody tr { cursor: default; }
.table.vergleich th.grp { text-align: center; border-bottom: 0; padding-bottom: 0; }
.table.vergleich .nur { color: var(--muted); font-style: italic; font-size: 12px; }
.table.vergleich tr.kat-kopf td { background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); }
.table.vergleich td.trenner, .table.vergleich th.trenner { border-left: 1px solid var(--line); }

#import-ergebnis { margin-top: 12px; }
#import-ergebnis ul { margin: 6px 0 0; padding-left: 18px; color: var(--red); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fgrid .c3 { grid-column: span 2; }
  #suche { width: 100%; }
  .topbar { gap: 8px; padding: 0 12px; overflow-x: auto; }
  .r-layout { grid-template-columns: 1fr; }
  .r-layout .pane { border-right: 0; border-bottom: 1px solid var(--line); }
  #r-suche, #d-suche { width: 100%; }
  .feste-layout { grid-template-columns: 1fr; }
  .feste-seite { position: static; }
  .feste-liste { max-height: 220px; }
  .d-layout { grid-template-columns: 1fr; }
  .d-vorschau { min-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
}
