/* TEL · Bereitstellungsraum – ruhige, sachliche Gestaltung für PC und Tablet (ab 1.3.0)
   Farbe nur dort, wo sie etwas bedeutet: BR-Farbe (Titelbalken), orange = verplant, gelb = Suchtreffer, rot = Fehler/Löschen. */
:root {
  --text: #1f2a30;
  --text-leise: #5f6f78;
  --dunkel: #263238;
  --dunkel-2: #37474f;
  --linie: #d5dde1;
  --linie-hell: #e7ecee;
  --flaeche: #f4f6f7;
  --flaeche-2: #eceff1;
  --weiss: #fff;
  --blau: #1565c0;
  --blau-dunkel: #1f4e79;
  --rot: #c62828;
  --gruen: #2e7d32;
  --gruen-hell: #e8f5e9;
  --orange: #e65100;
  --orange-hell: #fff0e0;
  --orange-rand: #ffb74d;
  --treffer: #fff59d;
  --br-farbe: #37474f;
  --br-text: #fff;
  --radius: 4px;
  --feld-h: 44px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Segoe UI", Calibri, system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.4; color: var(--text); background: var(--flaeche) !important;
  -webkit-tap-highlight-color: rgba(21, 101, 192, .12);
}
a { color: var(--blau); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
small { font-size: .82em; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  min-height: 50px; padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: var(--dunkel); color: #fff;
}
.marke { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; }
.marke-zeichen { background: #fff; color: var(--dunkel); font-weight: 800; letter-spacing: .5px; padding: 2px 7px; border-radius: 3px; font-size: 14px; }
.krumen { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-width: 0; font-size: 15px; }
.krumen a, .krumen span { color: #cfd8dc; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }
.krumen a:hover { color: #fff; text-decoration: underline; }
.krumen-trenner { color: #78909c !important; }
.benutzermenue { position: relative; }
.benutzermenue summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px; border-radius: var(--radius); min-height: 44px; }
.benutzermenue summary::-webkit-details-marker { display: none; }
.benutzermenue summary:hover { background: rgba(255,255,255,.08); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--dunkel-2); border: 1px solid #78909c; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.bm-liste { position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; color: var(--text); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 250px; padding: 4px; display: flex; flex-direction: column; }
.bm-liste a { padding: 11px 12px; color: var(--text); text-decoration: none; border-radius: 3px; }
.bm-liste a:hover { background: var(--flaeche-2); }
.bm-version { padding: 6px 12px; color: var(--text-leise); }

#ladebalken { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: #90a4ae; z-index: 100; }
body.laedt #ladebalken { width: 85%; transition: width 8s cubic-bezier(.1,.7,.3,1); }

.inhalt { padding: 14px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); max-width: 1800px; margin: 0 auto; }

/* ---------- Titelbalken (BR-Farbe) und Reiter ---------- */
.br-titel { background: var(--dunkel); color: #fff; padding: 10px 14px; border-radius: var(--radius) var(--radius) 0 0; }
.br-titel.br-farbig { background: var(--br-farbe); color: var(--br-text); }
.br-titel.orange, .einsatz-titel { background: var(--dunkel); color: #fff; }
.einsatz-titel { border-radius: var(--radius); margin-bottom: 12px; }
.br-titel h1 { font-size: 21px; font-weight: 700; }
.br-titel a { color: inherit; }
.br-titel-zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.br-unterzeile { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 3px; font-size: 15px; opacity: .92; }
.br-lage { margin-top: 3px; font-size: 14px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marke-status { background: rgba(0,0,0,.2); padding: 1px 8px; border-radius: 3px; font-size: 13px; font-weight: 600; }
.live-stand { opacity: .8; }
.titel-knopf { margin-left: auto; background: transparent !important; border-color: currentColor !important; color: inherit !important; opacity: .9; }
.titel-knopf:hover { opacity: 1; background: rgba(255,255,255,.12) !important; }

.reiter { display: flex; overflow-x: auto; background: #fff; border: 1px solid var(--linie); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 14px; scrollbar-width: thin; }
.reiter a { flex: 0 0 auto; padding: 12px 16px; min-height: 46px; color: var(--text-leise); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.reiter a:hover { color: var(--text); background: var(--flaeche); }
.reiter a.aktiv { color: var(--text); border-bottom-color: var(--br-farbe); }

/* ---------- Abschnittsüberschriften (einheitlich, neutral) ---------- */
.abschnitt-titel, .abschnitt-titel.br-farbig {
  display: block; background: var(--flaeche-2) !important; color: var(--text) !important; padding: 9px 12px; font-size: 16px; font-weight: 700;
  border: 1px solid var(--linie); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; margin: 14px 0 0;
}
.abschnitt-titel small { font-weight: 400; color: var(--text-leise); }
.abschnitt-titel.klein { font-size: 14px; padding: 6px 10px; margin: 0; }
.block > .abschnitt-titel:first-child { margin-top: 0; }
.titel-mit-info { display: flex !important; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.titel-info { margin-left: auto; font-weight: 400; font-size: 15px; }
.titel-info b { font-size: 18px; }

.seitenkopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.seitenkopf h1 { font-size: 23px; }

/* ---------- Raster ---------- */
.block { min-width: 0; }
.raster-zwei { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.kartenraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .raster-zwei, .zwei-spalten { grid-template-columns: 1fr; } }

/* ---------- Karten ---------- */
.karte { background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px; }
.karte.schmal { max-width: 440px; margin: 8vh auto; }
.karte h2 { font-size: 19px; }
.karte-titel { color: var(--text); text-decoration: none; }
.karte-titel:hover h2 { text-decoration: underline; }
.karte-kopf { display: flex; align-items: center; gap: 8px; }
.karte-kopf .karte-titel { flex: 1; }
.karte-meta { color: var(--text-leise); margin: 2px 0 10px; }
.einsatz-karte { border-top: 3px solid var(--dunkel); }
.br-karte { border-top: 4px solid var(--br-farbe); }
.aufgeloest { opacity: .6; }
.br-liste { list-style: none; padding: 0; margin: 0 0 12px; }
.br-zeile { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 10px; min-height: 46px; text-decoration: none; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie-hell); border-left: 5px solid var(--br-farbe); border-radius: var(--radius); margin-bottom: 6px; flex-wrap: wrap; }
.br-zeile:hover { background: var(--flaeche-2); }
.br-zahlen { display: flex; gap: 12px; font-variant-numeric: tabular-nums; color: var(--text-leise); font-size: 14px; }
.verplant-zahl { color: var(--orange); }
.leer { padding: 18px; text-align: center; color: var(--text-leise); }
.leise { color: var(--text-leise); }
.erklaerung { color: var(--text-leise); max-width: 120ch; }
.abgeschlossen { margin-top: 24px; }
.abgeschlossen summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.anmeldung-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.anmeldung-kopf .marke-zeichen { background: var(--dunkel); color: #fff; }
.anmeldung-kopf h1 { font-size: 20px; }

/* ---------- Kennzahlen ---------- */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; background: #fff; padding: 10px; border: 1px solid var(--linie); border-radius: 0 0 var(--radius) var(--radius); }
.kacheln.klein { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); padding: 0; border: 0; margin-bottom: 10px; }
.kacheln.gross { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 4px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie-hell); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; justify-content: space-between; min-height: 62px; }
.kachel-titel { font-size: 13px; color: var(--text-leise); }
.kachel-wert { color: var(--text); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kacheln.gross .kachel { min-height: 78px; }
.kacheln.gross .kachel-wert { font-size: 28px; }
.kachel.orange .kachel-wert { color: var(--orange); }
.kachel.blau .kachel-wert { color: var(--blau); }

.umbruch { white-space: pre-line; }

/* ---------- Formulare ---------- */
.formular { display: flex; flex-direction: column; gap: 12px; }
.raster-formular { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; background: #fff; padding: 12px; border: 1px solid var(--linie); border-radius: 0 0 var(--radius) var(--radius); }
.karte .raster-formular, .dialog .raster-formular { border: 0; padding: 0; }
.raster-formular .voll { grid-column: 1 / -1; }
.raster-formular .halb { grid-column: span 2; }
.raster-formular.vier-spalten { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; padding: 14px 16px; }
@media (max-width: 1100px) { .raster-formular.vier-spalten { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .raster-formular, .raster-formular.vier-spalten { grid-template-columns: 1fr; }
  .raster-formular .halb { grid-column: auto; }
}
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--dunkel); font-size: 15px; }
label small { font-weight: 400; color: var(--text-leise); }
.pflicht { position: relative; }
.pflicht::after { content: "*"; position: absolute; top: 0; right: 2px; color: var(--rot); font-weight: 700; }
input, select, textarea, button { font: inherit; font-size: 16px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; min-height: var(--feld-h); padding: 8px 10px; border: 1px solid #b8c4ca; border-radius: var(--radius); background: #fff; color: var(--text); font-weight: 400;
}
input[readonly] { background: var(--flaeche) !important; }
textarea { min-height: 62px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(21, 101, 192, .35); outline-offset: 0; border-color: var(--blau); }
.gelb { background: #fff; }
.vorbelegt { color: var(--blau-dunkel) !important; font-style: italic; background: #eef5fc !important; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--dunkel); flex: 0 0 auto; }
.schalter { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: 40px; cursor: pointer; }
.feld-inline { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.feld-inline span { white-space: nowrap; }
fieldset { border: 1px solid var(--linie); border-radius: var(--radius); padding: 10px 12px; margin: 0; }
legend { font-weight: 700; color: var(--dunkel); padding: 0 6px; }
.vorschau { color: var(--blau-dunkel); font-weight: 600; min-height: 1.4em; padding: 2px; }
.vorschau:empty { display: none; }
.vorschau.fehlt { color: var(--orange); }
.dialog .vorschau { background: var(--flaeche); border: 1px solid var(--linie-hell); border-radius: var(--radius); padding: 6px 10px; }
.warnung { background: #ffebee; color: var(--rot); font-weight: 600; padding: 8px 10px; border-radius: var(--radius); }
.inline-formular { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.inline-formular label { min-width: 260px; flex: 1; }
form.inline { display: inline; }
.listen-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.liste-feld { min-height: 340px !important; border-radius: 0 0 var(--radius) var(--radius) !important; }
.rechte { display: flex; flex-direction: column; gap: 6px; }
.recht { flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 400; padding: 8px; border-radius: var(--radius); background: var(--flaeche); cursor: pointer; }
.recht span { display: flex; flex-direction: column; }
.br-auswahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 12px; margin: 4px 0 0 32px; }
.br-auswahl-einsatz { grid-column: 1 / -1; font-weight: 700; margin-top: 8px; color: var(--text-leise); }
.rechteliste { padding-left: 18px; }

/* Stärke mit −/+ */
.staerke { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; background: var(--flaeche); }
.vier-spalten .staerke { grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(220px, 1.3fr); align-items: end; }
.dialog .staerke { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.staerke > label { font-size: 14px; }
.staerke > label input { text-align: center; font-weight: 700; }
.schnellwahl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.schnellwahl span { font-weight: 600; color: var(--text-leise); font-size: 14px; }
.staerke-summe { grid-column: 1 / -1; background: #fff; border: 1px solid var(--linie); padding: 8px 10px; border-radius: var(--radius); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.vier-spalten .staerke .staerke-summe { grid-column: auto; align-self: stretch; display: flex; align-items: center; }
@media (max-width: 1100px) {
  .vier-spalten .staerke { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .vier-spalten .staerke .staerke-summe { grid-column: 1 / -1; }
}
@media (max-width: 700px) { .staerke, .vier-spalten .staerke { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dialog .staerke { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.zaehler { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.zaehler > label { font-size: 14px; }
.zaehler > label small { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zaehler-reihe { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; border: 1px solid #b8c4ca; border-radius: var(--radius); overflow: hidden; background: #fff; }
.zaehler-reihe input { border: 0 !important; border-radius: 0 !important; text-align: center; font-size: 19px !important; font-weight: 700 !important; padding: 4px 2px !important; min-width: 0; -moz-appearance: textfield; appearance: textfield; }
.zaehler-reihe input::-webkit-outer-spin-button, .zaehler-reihe input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.zaehler-knopf { border: 0; background: var(--flaeche-2); color: var(--dunkel); font-size: 22px; font-weight: 600; line-height: 1; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; min-height: 46px; }
.zaehler-knopf:hover { background: #dfe5e8; }
.zaehler-knopf:active { background: var(--dunkel); color: #fff; }
.zaehler.ausstattung .zaehler-reihe { grid-template-columns: 52px minmax(0, 1fr) 52px; }

/* Fähigkeiten-Feld */
.fae-feld { display: flex; gap: 6px; }
.fae-feld input { flex: 1; cursor: pointer; }
.fae-feld .knopf { flex: 0 0 auto; }

/* ---------- Knöpfe ---------- */
.knopfleiste { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knopfleiste.oben { margin-bottom: 12px; }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: var(--radius); border: 1px solid #b8c4ca; background: #fff; color: var(--text); font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.knopf:hover { background: var(--flaeche); }
.knopf:active { transform: translateY(1px); }
.knopf.klein { min-height: 38px; padding: 6px 12px; font-size: 15px; }
.knopf.gross { min-height: 50px; padding: 10px 20px; font-size: 17px; }
/* Hauptaktionen einheitlich dunkel, Nebenaktionen weiß */
.knopf.primaer, .knopf.rot, .knopf.blau, .knopf.orange { background: var(--dunkel); border-color: var(--dunkel); color: #fff; }
.knopf.primaer:hover, .knopf.rot:hover, .knopf.blau:hover, .knopf.orange:hover { background: var(--dunkel-2); }
.knopf.blau-hell, .knopf.orange-hell { background: #fff; border-color: #b8c4ca; color: var(--text); }
.knopf.gefahr { background: #fff; border-color: var(--rot); color: var(--rot); }
.knopf.gefahr:hover { background: #ffebee; }
.knopf.rechts { margin-left: auto; }
.knopf[disabled], body.laedt .knopf.gesendet { opacity: .55; pointer-events: none; }
.aktionsleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 4px; }
.oben-abstand { margin-top: 12px; }

/* ---------- Status / Hinweise ---------- */
.statuszeile { background: var(--gruen-hell); color: var(--gruen); font-weight: 600; padding: 9px 12px; border-radius: var(--radius); margin: 10px 0; }
.statuszeile-fehler { background: #ffebee; color: var(--rot); }
.statuszeile-warnung { background: var(--orange-hell); color: var(--orange); }
.block > .statuszeile:first-of-type { margin: 0; border-radius: 0; border-left: 1px solid var(--linie); border-right: 1px solid var(--linie); }
.hinweis { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; font-weight: 600; }
.hinweis-ok { background: var(--gruen-hell); color: var(--gruen); }
.hinweis-fehler { background: #ffebee; color: var(--rot); }
.hinweis-warnung { background: var(--orange-hell); color: var(--orange); }
.hinweis-info { background: #e3f2fd; color: var(--blau-dunkel); }
.etikett { display: inline-block; background: var(--flaeche-2); padding: 1px 8px; border-radius: 3px; font-size: 13px; margin: 1px 0; }
.etikett.rot { background: var(--dunkel); color: #fff; }
#live-hinweis { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--dunkel); color: #fff; padding: 9px 16px; border-radius: var(--radius); z-index: 90; box-shadow: 0 4px 14px rgba(0,0,0,.25); font-size: 15px; }
#live-hinweis button { margin-left: 10px; }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--linie); border-radius: 0 0 var(--radius) var(--radius); max-width: 100%; }
.tabelle { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { padding: 8px; border-bottom: 1px solid var(--linie-hell); text-align: left; vertical-align: top; }
.tabelle thead th { position: sticky; top: 0; z-index: 2; background: var(--flaeche); color: var(--text-leise); font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 1px solid var(--linie); }
.tabelle thead tr.gruppen th { color: var(--text); background: var(--flaeche-2); }
.tabelle tbody th { font-weight: 600; white-space: nowrap; }
.tabelle tfoot th, .tabelle tfoot td { background: var(--flaeche); font-weight: 700; border-top: 1px solid var(--linie); }
.tabelle.kompakt th, .tabelle.kompakt td { padding: 6px 8px; }
.tabelle.zahlen td { text-align: right; }
.tabelle.zahlen td.text { text-align: left; }
.tabelle td.zahl { text-align: right; }
.tabelle td.mitte { text-align: center; }
.tabelle .fett { font-weight: 600; }
.tabelle td.klein, .klein { font-size: 13px; color: var(--text-leise); }
.tabelle td.lang { min-width: 220px; }
.tabelle td.fae { min-width: 140px; }
.tabelle td.hell { background: var(--flaeche); }
.tabelle td.frei { color: var(--gruen); font-weight: 700; }
.tabelle td.aktionen { white-space: nowrap; }
.tabelle .nowrap { white-space: nowrap; }
.tabelle tr.blass, .tabelle tr.blass th { color: #a3b0b6; }
.tabelle tr.raus td { color: var(--blau-dunkel); }
.tabelle thead th.br-spalte { border-top: 4px solid var(--br-farbe); color: var(--text); }
/* jede zweite Zeile grau hinterlegt (vor den Bedeutungsfarben, damit orange/gelb gewinnen) */
.tabelle tbody tr:nth-child(even) { background: #eef1f3; }
.fae-tabelle tbody tr:nth-child(even) { background: #f6f8f9; }
.tabelle tbody tr.fae-trenner { background: var(--flaeche) !important; }
.em-tabelle tbody tr.verplant { background: var(--orange-hell); }
.em-tabelle tbody tr.verplant td.plan { color: var(--orange); font-weight: 700; }
.em-tabelle tbody tr.treffer td.trifft { background: var(--treffer); font-weight: 700; }
.em-tabelle tbody tr.treffer { box-shadow: inset 3px 0 0 #fbc02d; }
.em-tabelle.nur-treffer tbody tr:not(.treffer):not(.leerzeile), .em-tabelle tbody tr.ausgefiltert { display: none; }
.em-tabelle td.status { font-weight: 600; }
table[data-waehlen] tbody tr:not(.leerzeile) { cursor: pointer; }
table[data-waehlen] tbody tr:not(.leerzeile):hover { background: #eef5fc; }
table[data-waehlen] tbody tr.gewaehlt { outline: 2px solid var(--blau); outline-offset: -2px; }
.eingabe-tabelle td { padding: 4px; }
.eingabe-tabelle input:not([type=checkbox]) { min-width: 140px; }

.suchleiste, .filterleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: #fff; padding: 8px 10px; border: 1px solid var(--linie); border-bottom: 0; }
.suchleiste input[type=search] { min-width: 260px; }
.suche-info { color: var(--text-leise); font-weight: 600; }
.abschnitt-titel + .suchleiste, .abschnitt-titel + .filterleiste { border-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip { padding: 8px 14px; min-height: 42px; border-radius: var(--radius); background: #fff; border: 1px solid #b8c4ca; color: var(--text); text-decoration: none; font: inherit; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.chip b { color: var(--text-leise); font-weight: 600; }
.chip.aktiv { background: var(--dunkel); border-color: var(--dunkel); color: #fff; }
.chip.aktiv b { color: #cfd8dc; }
.chip.blass { opacity: .55; }
.br-chip { border-left: 6px solid var(--br-farbe); }
.br-chip.aktiv { border-left-color: var(--br-farbe); }
.br-marke { display: inline-block; border-left: 5px solid var(--br-farbe); background: var(--flaeche); color: var(--text); padding: 2px 8px; border-radius: 3px; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }

.einklappbar { margin-bottom: 4px; }
.einklappbar > summary { list-style: none; cursor: pointer; display: flex !important; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; }
.einklappbar > summary::-webkit-details-marker { display: none; }
.einklappbar > summary::before { content: "▸"; font-size: 13px; color: var(--text-leise); transition: transform .15s; }
.einklappbar[open] > summary::before { transform: rotate(90deg); }
.einklappbar:not([open]) > summary { border-radius: var(--radius); border-bottom: 1px solid var(--linie); }
.summary-kurz { margin-left: auto; font-weight: 400; font-size: 14px; color: var(--text-leise); }

.gefahrenzone { margin-top: 28px; border: 1px solid #ef9a9a; border-radius: var(--radius); background: #fff; padding: 0 14px; }
.gefahrenzone summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--rot); }

/* ---------- Dialoge ---------- */
.dialog { border: 1px solid var(--linie); border-radius: 6px; padding: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 16px 48px rgba(0,0,0,.28); }
.dialog.breit { width: min(980px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(38, 50, 56, .5); }
.dialog h2 { font-size: 19px; margin-bottom: 4px; }
.dialog h3.abschnitt-titel { border-radius: var(--radius); margin: 6px 0 0; border-bottom: 1px solid var(--linie); }
.dialog-titel { display: flex; align-items: center; gap: 10px; margin: -18px -18px 4px !important; padding: 12px 18px; background: var(--flaeche-2); color: var(--text); font-size: 19px; border-bottom: 1px solid var(--linie); position: sticky; top: -18px; z-index: 3; }
.dialog-x { margin-left: auto; background: transparent; color: var(--text); border: 1px solid #b8c4ca; width: 40px; height: 40px; border-radius: var(--radius); font-size: 17px; cursor: pointer; }
.dialog-x:hover { background: #fff; }

/* Farbauswahl im BR-Dialog */
.farbwahl { display: flex; flex-wrap: wrap; gap: 8px; }
.farbfeld { flex-direction: row; cursor: pointer; position: relative; }
.farbfeld input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.farbfeld span, .farbfeld input[type=color] { display: block; width: 40px; height: 40px; border-radius: var(--radius); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--linie); }
.farbfeld input[type=color] { padding: 0; background: none; cursor: pointer; }
.farbfeld input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.farbfeld input[type=color]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.farbfeld input[type=radio]:checked + span, .farbfeld input[type=radio]:checked + input[type=color] { box-shadow: 0 0 0 3px var(--dunkel); }

/* Vorschlagsliste (Listen mit Sofortsuche) */
.vorschlaege { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 320px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 3px; }
.vorschlaege button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; min-height: 44px; border-radius: 3px; font-size: 16px; color: var(--text); cursor: pointer; }
.vorschlaege button:hover, .vorschlaege button.aktiv { background: #eef5fc; }
.vorschlaege mark { background: var(--treffer); padding: 0; }
.vorschlaege .vorschlag-leer { padding: 10px 12px; color: var(--text-leise); font-size: 14px; }
input[data-vorschlag] { background-image: linear-gradient(45deg, transparent 50%, #78909c 50%), linear-gradient(135deg, #78909c 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 30px !important; }

/* Fähigkeiten-Popup */
.fae-suche { margin-bottom: 8px; }
.fae-tabelle td { vertical-align: middle; }
.fae-tabelle td.fae-check { width: 52px; text-align: center; }
.fae-tabelle td.fae-name { font-weight: 600; }
.fae-tabelle td.fae-name input, .fae-tabelle td.fae-bem input { min-height: 40px; }
.fae-tabelle td.fae-bem { width: 40%; }
.fae-tabelle td.fae-weg { width: 52px; text-align: center; }
.fae-tabelle tr.an { background: #eef5fc; }
.fae-tabelle tr.fae-trenner td { background: var(--flaeche); color: var(--text-leise); font-size: 13px; font-weight: 600; padding: 5px 8px; }
.fae-auswahl { color: var(--text-leise); font-size: 14px; }

/* ---------- Marschbefehl (Bildschirm) ---------- */
.mb-seite { background: #fff; max-width: 210mm; margin: 0 auto; padding: 10mm 12mm; border: 1px solid var(--linie); }
.marschbefehl { display: flex; flex-direction: column; gap: 2mm; font-size: 12px; color: #000; }
.mb-kopf { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1.5px solid #000; padding-bottom: 1.5mm; }
.mb-kopf h1 { font-size: 19px; }
.mb-org { text-align: right; font-weight: 700; font-size: 11px; line-height: 1.25; }
.mb-tabelle { width: 100%; border-collapse: collapse; font-size: 12px; }
.mb-tabelle th, .mb-tabelle td { border: 1px solid #666; padding: 2px 5px; text-align: left; vertical-align: top; }
.mb-tabelle th { background: #eee; width: 19%; white-space: nowrap; font-size: 11px; font-weight: 600; }
.mb-tabelle th small { font-size: 9px; font-weight: 400; }
.mb-tabelle td.gross { font-size: 13px; font-weight: 700; }
.mb-text h2 { font-size: 11.5px; background: #eee; padding: 1px 5px; border: 1px solid #666; border-bottom: 0; }
.mb-text p { margin: 0; min-height: 10mm; max-height: 22mm; overflow: hidden; border: 1px solid #666; padding: 2px 5px; white-space: pre-line; font-size: 12px; line-height: 1.3; }
.mb-fuss { display: flex; justify-content: space-between; padding-top: 5mm; font-size: 12px; }
.mb-trenner { text-align: center; color: #666; white-space: nowrap; overflow: hidden; font-size: 9px; padding: 4mm 0; }
.mb-text p { min-height: 12mm; }

/* ---------- Druck ---------- */
@media print {
  /* Keine festen Höhen und keine Umbruch-Regeln: Safari rechnet beim Drucken anders um und schob sonst das 2. Exemplar auf Seite 2.
     Jedes Exemplar ist nur so hoch wie sein Inhalt (ca. 9–10 cm) – zwei passen in jedem Browser auf eine A4-Seite. */
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; height: auto !important; }
  .kopf, .reiter, .nicht-drucken, .statuszeile, .hinweis, #live-hinweis, #ladebalken, dialog { display: none !important; }
  .inhalt { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .mb-seite { border: 0; padding: 0; max-width: none; margin: 0; }
  .marschbefehl { display: block; height: auto; }
  .marschbefehl > * + * { margin-top: 2mm; }
  .mb-tabelle th, .mb-text h2 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Tablet / Handy ---------- */
@media (max-width: 820px) {
  .kopf { flex-wrap: wrap; }
  .marke-text, .bm-name { display: none; }
  .krumen { order: 3; flex-basis: 100%; }
  .br-titel h1 { font-size: 19px; }
  .kartenraster { grid-template-columns: 1fr; }
  .suchleiste input[type=search] { min-width: 0; }
  .feld-inline { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  .tabelle th, .tabelle td { padding-top: 11px; padding-bottom: 11px; }
}

/* Feld ohne <label> (Fähigkeiten mit Knopf) */
.feld { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--dunkel); font-size: 15px; }
.fae-feld input[readonly] { background: #fff !important; }
.fae-tabelle tbody tr.an { background: #e3eefa; }

/* Filterleiste */
.filterleiste { border-top: 0; }
.filtergruppe { align-items: center; margin: 0; }
.filter-titel { font-size: 14px; font-weight: 600; color: var(--text-leise); margin-right: 2px; }
.filterleiste .chip { min-height: 40px; padding: 6px 12px; }

/* Suche + Filter in einer Zeile */
.suchleiste { gap: 8px 14px; }
.suche-feld input[type=search] { width: 240px; min-width: 0 !important; }
.filter-slot { display: contents; }
.filter-slot .filterleiste { display: contents; }
.filter-slot .filtergruppe { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 14px; border-left: 1px solid var(--linie); }
.suche-info:empty { display: none; }
@media (max-width: 820px) { .suche-feld input[type=search] { width: 100%; } .suche-feld { flex: 1 1 100%; } .filter-slot .filtergruppe { padding-left: 0; border-left: 0; } }

/* Fehler oben im Popup (Vordergrund) */
.dialog-fehler { background: #ffebee; color: var(--rot); border: 1px solid #ef9a9a; border-left: 5px solid var(--rot); font-weight: 700; padding: 10px 12px; border-radius: var(--radius); position: sticky; top: 46px; z-index: 2; }
.dialog-fehler[hidden] { display: none; }

/* Kennzahlen auf der Startseite: immer „Zahl Text“ in einer Zeile */
.br-zahlen { flex-wrap: wrap; gap: 4px 14px; }
.br-zahlen > span { white-space: nowrap; }

/* Zahlenspalten: Überschrift und Werte gleich ausgerichtet (rechtsbündig), erste Spalte links */
.tabelle.zahlen thead th { text-align: right; }
.tabelle.zahlen thead th:first-child, .tabelle.zahlen thead th.text { text-align: left; }
.tabelle.zahlen thead tr:first-child th[colspan] { text-align: center; }
.tabelle.zahlen td { white-space: nowrap; }
.em-tabelle thead th { text-align: left; }
.tabelle thead th.zahl { text-align: right; }
.tabelle thead th.mitte { text-align: center; }
