/* portal.css — civilTech-Designsprache (Basis tool-lager, a11y-geprüft). Mobil zuerst.
 *
 * Eine Quelle für die Gestaltung des Portals. Hex-Werte stehen nur im Token-Block
 * (und bei den Kopf-Transparenzen, Schatten und dem Backdrop). Spec:
 * Vault Projects/Portal-Redesign/2026-10-02-Design-Spec.md
 */

/* ── 1. Tokens und Dunkelmodus ─────────────────────────────────────────── */
:root {
  /* Flächen */
  --grund: #f3f3f0;        /* warmes Grau, Seitenhintergrund */
  --karte: #fff;           /* Karten, Felder, Navi-Leiste */
  --text: #1c1c1a;         /* 15,4:1 auf --grund */
  --leise: #5a5a55;        /* Nebentext: 6,2:1 auf --grund, 6,9:1 auf Weiß */
  --linie: #d6d6d0;        /* Trennlinien/Kartenrand, rein dekorativ */
  --feldrand: #8a8a84;     /* Feld- und Knopfbegrenzung: 3,47:1 auf Weiß (WCAG 1.4.11) */
  /* Marke */
  --marke: #2e3034;        /* Anthrazit-Kopf */
  --marke-text: #fff;      /* 13,2:1 */
  --akzent: #ffcc00;       /* Gelb: Logo-Punkt, Auswahlkante. Nie Text auf Hell (1,4:1) */
  --fokus: #12508f;        /* 8,2:1 auf Weiß */
  /* Hauptaktion und aktiver Reiter: hell Anthrazit, dunkel Gelb */
  --primaer: #2e3034; --primaer-text: #fff; --primaer-leise: #ffffffc0;
  --aktiv: #2e3034;   --aktiv-text: #fff;
  /* Signalfarben (= ct-ui FARBEN; weiße Schrift jeweils ≥ 5:1) */
  --rot: #c62828; --orange: #b35300; --blau: #12508f; --gruen: #22662a; --grau: #5c5c5c;
  --rot-hg: #fdecec; --orange-hg: #fff1e3; --blau-hg: #e8f0fa; --gruen-hg: #e7f4e8;
  /* Form */
  --radius: 10px; --radius-klein: 8px; --radius-box: 6px; --radius-dialog: 12px;
  --ziel: 44px; --ziel-gross: 56px;
  --schatten-pop: 0 8px 24px #0003;
  --schatten-dialog: 0 10px 40px #0005;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --breite: 60rem;         /* Text- und Formularseiten */
  --breite-weit: 75rem;    /* Übersicht, Admin-Tabellen, Plandatenbank */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #161616; --karte: #232322; --text: #ececea; --leise: #a9a9a3; --linie: #3c3c39;
    --feldrand: #85857e;                       /* 4,2:1 auf #232322 */
    --marke: #0e0e0e; --fokus: #8ab8ff;        /* Fokus 7,8:1 auf Karte */
    --aktiv: #ffcc00; --aktiv-text: #1c1c1a;   /* #0e0e0e auf #161616 wäre 1,1:1 → Gelb 12:1 */
    --primaer: #ffcc00; --primaer-text: #1c1c1a; --primaer-leise: #1c1c1ad0;
    --rot: #ff8a80; --orange: #ffb366; --blau: #8ab8ff; --gruen: #7fd38a; --grau: #b0b0b0;
    --rot-hg: #3a1f1f; --orange-hg: #3a2b1a; --blau-hg: #1b2a3d; --gruen-hg: #1c3020;
  }
}
/* Blau auf Anthrazit läge bei 1,62:1 — im Kopf ist der Fokusring gelb (8,74:1 hell, 12,8:1 dunkel). */
.kopf { --fokus: var(--akzent); }

/* ── 2. Grundgerüst ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%;
  /* Der Kopf klebt oben (≈52 px): ohne Abstand landen Fokus und Sprungziele darunter (WCAG 2.4.11). */
  scroll-padding-top: calc(52px + env(safe-area-inset-top) + .75rem); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--grund); color: var(--text); font: 16px/1.45 var(--schrift); overflow-x: hidden; }
h1 { font-size: 1.35rem; line-height: 1.3; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .8rem; }
a { color: var(--blau); }
code, pre, .code { font-family: var(--mono); }
code { font-size: .88em; overflow-wrap: anywhere; }
pre { background: var(--grund); border: 1px solid var(--linie); border-radius: var(--radius-box); padding: .6rem .8rem;
  overflow-x: auto; font-size: .85rem; max-width: 100%; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.sprung { position: absolute; left: -999px; top: .5rem; z-index: 20; background: var(--karte); color: var(--text);
  padding: .7rem 1rem; border-radius: var(--radius-klein); border: 1px solid var(--feldrand); }
.sprung:focus { left: .5rem; }
/* Der Sprunglink erscheint über dem Anthrazit-Kopf: Blau läge dort bei 1,62:1, Gelb hält 8,74:1 bzw. 12,8:1. */
.sprung:focus-visible { outline-color: var(--akzent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { flex: 1 0 auto; width: 100%; max-width: var(--breite); margin: 0 auto; padding: 1rem; outline: none; min-width: 0; }
main.weit { max-width: var(--breite-weit); }
.klein { font-size: .88rem; color: var(--leise); }
.leise { color: var(--leise); }
.zahl, td.num, td.zeit { font-variant-numeric: tabular-nums; }
body > footer.fuss { text-align: center; padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie); color: var(--leise); font-size: .85rem; }
body > footer.fuss .rueckmeldung { display: inline-flex; align-items: center; min-height: var(--ziel); padding: 0 .6rem;
  color: var(--text); font-weight: 600; }

/* ── 3. Kopf ───────────────────────────────────────────────────────────── */
.kopf { display: flex; align-items: center; gap: .6rem; padding: .4rem 1rem; padding-top: calc(.4rem + env(safe-area-inset-top));
  padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right));
  background: var(--marke); color: var(--marke-text); position: sticky; top: 0; z-index: 5; min-height: 52px; }
.marke { color: var(--marke-text); font-weight: 700; font-size: 1.2rem; text-decoration: none; min-height: var(--ziel);
  display: inline-flex; align-items: center; white-space: nowrap; }
.marke span { color: var(--akzent); }
.wer { margin-left: auto; font-size: .82rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; min-width: 0; }
.kopfknopf { display: inline-flex; align-items: center; background: #ffffff1f; color: var(--marke-text); border: 1px solid #ffffff40;
  border-radius: 999px; padding: .3rem .9rem; font: inherit; font-size: .9rem; min-height: var(--ziel); text-decoration: none;
  white-space: nowrap; cursor: pointer; flex: none; }
.kopfknopf:hover { background: #ffffff33; }

/* ── 4. Navigation ─────────────────────────────────────────────────────── */
/* Umbrechen statt seitlich scrollen: ein abgeschnittenes „Verwal…" ohne Hinweis findet niemand. */
.navi { display: flex; flex-wrap: wrap; gap: .2rem; padding: .3rem .6rem; background: var(--karte); border-bottom: 1px solid var(--linie); }
.navi a { padding: .5rem .8rem; min-height: var(--ziel); display: inline-flex; align-items: center; gap: .35rem; border-radius: var(--radius-klein);
  color: var(--text); text-decoration: none; white-space: nowrap; }
.navi a:hover { background: var(--grund); }
.navi a[aria-current="page"] { background: var(--aktiv); color: var(--aktiv-text); }
.navi .rechts { margin-left: auto; }
.navi-zahl { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--akzent); color: #1c1c1a; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.reiter { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.reiter a { display: inline-flex; align-items: center; min-height: var(--ziel); padding: .4rem .9rem; border-radius: 999px;
  border: 1px solid var(--feldrand); background: var(--karte); color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap; }
.reiter a[aria-current="page"] { background: var(--aktiv); color: var(--aktiv-text); border-color: var(--aktiv); font-weight: 600; }
/* Am Handy einzeilig wischen statt drei Zeilen umbrechen. Der ausgeblendete Rand (Klassen setzt _reiter.html
   je nach Scrollstand) zeigt, dass es weitergeht; ein Schatten hinter deckenden Pillen bliebe unsichtbar. */
@media (max-width: 699px) {
  .reiter.wisch { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -1rem; margin-right: -1rem;
    padding: 0 1rem .1rem; }
  .reiter.wisch::-webkit-scrollbar { display: none; }
  .reiter.wisch li { flex: none; }
  .reiter.wisch.mehr-rechts { -webkit-mask-image: linear-gradient(to left, transparent, #000 3rem); mask-image: linear-gradient(to left, transparent, #000 3rem); }
  .reiter.wisch.mehr-links { -webkit-mask-image: linear-gradient(to right, transparent, #000 3rem); mask-image: linear-gradient(to right, transparent, #000 3rem); }
  .reiter.wisch.mehr-links.mehr-rechts { -webkit-mask-image: linear-gradient(to right, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to right, transparent, #000 3rem, #000 calc(100% - 3rem), transparent); }
}

/* ── 5. Karte, Panel ───────────────────────────────────────────────────── */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; min-width: 0; }
.karte > :last-child { margin-bottom: 0; }
.karte > h2:first-child { margin-top: 0; }
.panel { border-width: 2px; border-color: var(--primaer); }
.abschnitt { margin: 1.4rem 0 .6rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.abschnitt h2 { margin: 0; }
.abschnitt .klein { margin: 0; }

/* ── 6. Kacheln ────────────────────────────────────────────────────────── */
.kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.kachel { display: flex; flex-direction: column; gap: .3rem; min-height: 96px; padding: 1rem; border-radius: var(--radius);
  background: var(--karte); border: 1px solid var(--linie); color: var(--text); text-decoration: none; font-size: 1.05rem; font-weight: 600; min-width: 0; }
a.kachel:hover { border-color: var(--feldrand); }
.kachel .zeichen { font-size: 1.4rem; line-height: 1; }
.kachel small { font-weight: 400; font-size: .82rem; color: var(--leise); }
.kachel.haupt { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
.kachel.haupt small { color: var(--primaer-leise); }
.zaehler { font-weight: 600; color: var(--orange); }
.zaehler.rot { color: var(--rot); }
.kachel.haupt .zaehler { color: inherit; }
.kachel .zahl { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }

/* ── 7. Knöpfe ─────────────────────────────────────────────────────────── */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--ziel); min-width: var(--ziel);
  padding: .55rem 1rem; border-radius: var(--radius-klein); border: 1px solid var(--feldrand); background: var(--karte); color: var(--text);
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center; }
.knopf:hover { background: var(--grund); }
.knopf.primaer { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
.knopf.primaer:hover { filter: brightness(1.15); }
.knopf.gefahr { color: var(--rot); border-color: var(--rot); }
.knopf.gefahr.voll { background: var(--rot); color: var(--karte); }
.knopf.gruen { color: var(--gruen); border-color: var(--gruen); }
.knopf.breit { width: 100%; }
.knopf.klein { font-weight: 500; padding: .35rem .75rem; font-size: .95rem; }
.knopf.gross { min-height: var(--ziel-gross); font-size: 1.05rem; padding: .7rem 1.1rem; }
.knopf[disabled], .knopf[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.knoepfe.rechts { justify-content: flex-end; }
.knoepfe form { display: contents; }
a.zurueck { display: inline-flex; align-items: center; min-height: var(--ziel); padding: 0 .4rem 0 0; }
form.inline { display: inline; }

/* ── 8. Segmentschalter und Chips ──────────────────────────────────────── */
.modus { display: inline-flex; flex-wrap: wrap; gap: .2rem; border: 1px solid var(--feldrand); border-radius: 999px; padding: .2rem;
  background: var(--karte); margin: 0 0 1rem; max-width: 100%; }
.modus button { min-height: var(--ziel); border: 0; background: transparent; padding: .4rem 1rem; border-radius: 999px;
  font: inherit; font-weight: 600; cursor: pointer; color: var(--leise); display: inline-flex; align-items: center; gap: .4rem; }
.modus button[aria-pressed="true"] { background: var(--aktiv); color: var(--aktiv-text); }
.modus .anzahl { display: inline-block; min-width: 1.6rem; padding: 0 .4rem; border-radius: 999px; background: var(--grund);
  color: var(--text); font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.modus button[aria-pressed="true"] .anzahl { background: var(--karte); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: .3rem; min-height: var(--ziel); padding: .4rem .9rem; border-radius: 999px;
  border: 1px solid var(--feldrand); background: var(--karte); color: var(--text); font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); font-weight: 600; }
.chip[aria-pressed="true"]::before { content: "✓"; }

/* ── 9. Formulare ──────────────────────────────────────────────────────── */
.feld { margin-bottom: .9rem; min-width: 0; }
.feld > label, .feld > .label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .3rem; }
.feld > label.haken { display: inline-flex; font-size: 1rem; font-weight: 400; margin-bottom: 0; }
.feld .optional { font-weight: 400; color: var(--leise); }
.hilfe { display: block; font-size: .85rem; color: var(--leise); margin-top: .3rem; }
input, select, textarea { width: 100%; min-height: var(--ziel); padding: .55rem .65rem; border: 1px solid var(--feldrand); border-radius: var(--radius-klein);
  font: inherit; font-size: 16px; background: var(--karte); color: var(--text); }
select[multiple] { min-height: 8rem; }
textarea { min-height: 4.5rem; resize: vertical; }
input[readonly] { background: var(--grund); }
input[type="checkbox"], input[type="radio"] { width: 1.4rem; min-height: 1.4rem; height: 1.4rem; margin: 0; accent-color: var(--primaer); flex: none; }
[aria-invalid="true"] { border-color: var(--rot); outline: 2px solid var(--rot); outline-offset: 0; }
.haken { display: inline-flex; align-items: center; gap: .55rem; min-height: var(--ziel); cursor: pointer; font-weight: 400; }
.haken.block { display: flex; }
.zeile2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 .8rem; }
.filter { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem .8rem; align-items: end; }
.filter .feld { margin-bottom: .5rem; }
.wahlliste { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; margin: 0; padding: 0; list-style: none; }
.wahlliste .haken { width: 100%; padding: .4rem .7rem; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--karte); }
.wahlliste .haken:has(input:checked) { border-color: var(--feldrand); border-left: 4px solid var(--akzent); }
fieldset { border: 0; margin: 0 0 .9rem; padding: 0; min-width: 0; }
legend { font-size: .9rem; font-weight: 600; margin-bottom: .4rem; padding: 0; }
/* display:flex nimmt Chromium/Safari das Dreieck: eigenes Zeichen, damit es als bedienbar erkennbar bleibt. */
details > summary { cursor: pointer; min-height: var(--ziel); display: flex; align-items: center; gap: .45rem; font-weight: 600;
  color: var(--blau); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; font-size: 1.1em; line-height: 1; }
details[open] > summary::before { content: "▾"; }
.suche { position: relative; min-width: 0; }
.suche input { padding-left: 2.2rem; }
.suche::before { content: "⌕"; position: absolute; left: .7rem; top: 50%; transform: translateY(-52%); color: var(--leise);
  font-size: 1.35rem; pointer-events: none; }
.treffer { list-style: none; margin: .2rem 0 0; padding: 0; position: absolute; left: 0; right: 0; top: 100%; z-index: 6; background: var(--karte);
  border: 1px solid var(--linie); border-radius: var(--radius-klein); max-height: 60vh; overflow-y: auto; box-shadow: var(--schatten-pop); }
.gewaehlt { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .7rem; border-left: 4px solid var(--akzent);
  background: var(--grund); border-radius: var(--radius-box); overflow-wrap: anywhere; }

/* ── 10. Listen und Tabellen ───────────────────────────────────────────── */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { border-bottom: 1px solid var(--linie); padding: .7rem 0; display: flex; gap: .6rem; align-items: flex-start; justify-content: space-between; min-width: 0; }
.liste > li:last-child { border-bottom: 0; }
.karte.liste { padding: 0 1rem; }
a.zeilenlink { display: flex; gap: .6rem; justify-content: space-between; align-items: flex-start; color: inherit; text-decoration: none; width: 100%; min-height: var(--ziel); }
.angaben { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem .9rem; margin: 0 0 .6rem; }
.angaben dt { color: var(--leise); font-size: .88rem; }
.angaben dd { margin: 0; overflow-wrap: anywhere; }
.tabelle { overflow-x: auto; min-width: 0; }
.karte.tabelle { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { color: var(--leise); font-weight: 600; font-size: .82rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.aktionen-zelle { white-space: nowrap; }
td .knoepfe { margin-top: 0; }
tr.inaktiv td { color: var(--leise); }
/* Datum und Uhrzeit: gleich breite Ziffern, aber linksbündig wie ihr Spaltenkopf. Rechtsbündig nur Zahlen. */
td.zeit, th.zeit { white-space: nowrap; }
@media (max-width: 699px) {
  /* Tabelle wird Kartenliste: Label links (7,5rem), Wert rechts daneben — nicht darüber, sonst wird jede Zeile
     doppelt so hoch. Positioniert statt Grid, damit gemischter Inhalt (Text, <br>, Pillen) eine Spalte bleibt. */
  .tabelle table.karten thead { display: none; }
  .tabelle table.karten, .tabelle table.karten tbody, .tabelle table.karten tr, .tabelle table.karten td { display: block; width: 100%; }
  .tabelle table.karten tr { padding: .6rem .8rem; border-bottom: 1px solid var(--linie); }
  .tabelle table.karten tbody tr:last-child { border-bottom: 0; }
  .tabelle table.karten td { border: 0; padding: .15rem 0; text-align: left; overflow-wrap: anywhere; white-space: normal; }
  .tabelle table.karten td[data-label] { position: relative; padding-left: 8.1rem; min-height: 1.6rem; }
  .tabelle table.karten td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: .2rem; width: 7.5rem;
    font-size: .78rem; font-weight: 600; color: var(--leise); line-height: 1.35; overflow-wrap: anywhere; }
  /* Titel der Zeile (Name, Vorgang) ohne Label über die volle Breite */
  .tabelle table.karten td.titel-zelle { padding: 0 0 .25rem; font-size: 1.02rem; }
  .tabelle table.karten td.titel-zelle::before { content: none; }
  .tabelle table.karten td.num { text-align: left; }
  .tabelle table.karten td.leer-wert { display: none; }
  .tabelle table.karten td.aktionen-zelle { padding-top: .5rem; }
  /* Protokoll: zwei Zeilen je Eintrag — Zeit | IP, darunter Karte | Person */
  .tabelle table.protokoll tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .8rem; }
  .tabelle table.protokoll td[data-label] { padding: 0; min-height: 0; width: auto; }
  .tabelle table.protokoll td[data-label]::before { content: none; }
  .tabelle table.protokoll td.p-zeit { font-weight: 600; order: 1; }
  .tabelle table.protokoll td.p-ip { order: 2; }
  .tabelle table.protokoll td.p-karte { order: 3; }
  .tabelle table.protokoll td.p-person { order: 4; }
  .tabelle table.protokoll td.p-ip, .tabelle table.protokoll td.p-person { text-align: right; color: var(--leise); font-size: .9rem; }
  .tabelle table.protokoll td.leer-zelle { grid-column: 1 / -1; }
}

/* ── 11. Status-Pillen: Farbe UND Zeichen UND Text ─────────────────────── */
.marke-status { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem;
  font-weight: 600; white-space: nowrap; border: 1px solid currentColor; line-height: 1.5; vertical-align: middle; }
.marke-status.ok { color: var(--gruen); background: var(--gruen-hg); }
.marke-status.warnung { color: var(--orange); background: var(--orange-hg); }
.marke-status.fehler { color: var(--rot); background: var(--rot-hg); }
.marke-status.info { color: var(--blau); background: var(--blau-hg); }
.marke-status.neutral { color: var(--grau); background: var(--grund); }
.pillen { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ── 12. Boxen ─────────────────────────────────────────────────────────── */
.infobox, .warnung:not(.marke-status), .fehlerbox, .erfolgbox { padding: .6rem .8rem; border-radius: var(--radius-box); margin: 0 0 1rem; border-left: 4px solid; color: var(--text); overflow-wrap: anywhere; }
.infobox { background: var(--blau-hg); border-left-color: var(--blau); }
.warnung:not(.marke-status) { background: var(--orange-hg); border-left-color: var(--orange); }
.fehlerbox { background: var(--rot-hg); border-left-color: var(--rot); }
.erfolgbox { background: var(--gruen-hg); border-left-color: var(--gruen); }
.infobox > :last-child, .warnung > :last-child, .fehlerbox > :last-child, .erfolgbox > :last-child { margin-bottom: 0; }
.leer { color: var(--leise); padding: 1.2rem 0; text-align: center; }
.hinweisliste { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.hinweisliste a { display: flex; align-items: center; min-height: var(--ziel); padding: .5rem .8rem; border-radius: var(--radius-klein);
  background: var(--blau-hg); color: var(--text); text-decoration: none; }

/* ── 13. Dialoge ───────────────────────────────────────────────────────── */
dialog { border: 0; border-radius: var(--radius-dialog); padding: 1.1rem; width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  background: var(--karte); color: var(--text); box-shadow: var(--schatten-dialog); }
dialog.breit { width: min(40rem, calc(100vw - 2rem)); }
dialog::backdrop { background: #0008; }
dialog h2 { margin-top: 0; }
/* ct-ui hängt sein <style> ans Ende von <head>: höhere Spezifität statt !important. */
body .ct-toast { border: 1px solid #ffffff30; bottom: calc(1.4rem + env(safe-area-inset-bottom)); font-family: var(--schrift); }
body .ct-dialog > div { background: var(--karte); color: var(--text); border: 1px solid var(--linie); width: min(28rem, 100%);
  box-shadow: var(--schatten-dialog); font-family: var(--schrift); }
body .ct-dialog .knoepfe { flex-wrap: wrap; }
body .ct-dialog button { min-height: var(--ziel); padding: .5rem 1rem; border-radius: var(--radius-klein); border: 1px solid var(--feldrand);
  background: var(--karte); color: var(--text); font-weight: 600; }
body .ct-dialog button.gefahr { background: var(--rot); border-color: var(--rot); color: var(--karte); }

/* ── 14. Layout-Helfer ─────────────────────────────────────────────────── */
.aktionen { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; margin: 0 0 1rem; }

/* ── 15. Portal-spezifisch ─────────────────────────────────────────────── */
/* Seitenkopf: h1 links, Aktionen rechts, bricht um */
.kopfzeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; margin-bottom: .8rem; }
.kopfzeile h1 { margin: .2rem 0 0; }
.kopfzeile .unter { color: var(--leise); font-size: .95rem; margin: 0; flex-basis: 100%; }

/* Projektgruppe auf der Übersicht */
.projekt { margin: 0 0 1rem; }
.projekt > summary { min-height: var(--ziel); color: var(--text); border-bottom: 1px solid var(--linie); padding: .2rem 0; }
.projekt > summary h2 { margin: 0; font-size: 1.1rem; display: inline; }
.projekt > summary .anzahl { margin-left: auto; color: var(--leise); font-weight: 400; font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.projekt > .kacheln { margin-top: .7rem; }
.projekt > .warnung { margin-top: .7rem; }

/* Typkennung in der Kachel: Zeichen + Wort, nie nur Farbe */
.kachel .kopfzeile-kachel { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.kachel .typ { font-size: .75rem; font-weight: 600; color: var(--leise); border: 1px solid var(--linie);
  border-radius: 999px; padding: .05rem .45rem; white-space: nowrap; }
.kachel .titel { font-size: 1.05rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; hyphens: auto; }
.kachel .beschreibung { font-weight: 400; font-size: .82rem; color: var(--leise); overflow-wrap: anywhere; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kachel .fuss { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; padding-top: .2rem; }

/* Suchzeile der Übersicht */
.suchzeile { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem .8rem; align-items: center; margin: 0 0 .4rem; }
.suchzeile .suche { display: flex; gap: .4rem; }
.suchzeile .suche input { flex: 1 1 auto; min-width: 0; }
#treffer-info { margin: 0 0 1rem; min-height: 1.2rem; }

/* Zuletzt geöffnet: Chips mit Umbruch statt Wischleiste, max. 5 */
.zuletzt-kopf { font-size: .88rem; font-weight: 600; color: var(--leise); margin: .4rem 0 .4rem; }
.zuletzt { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.2rem; padding: 0; list-style: none; }
.zuletzt li { min-width: 0; max-width: 100%; }
.zuletzt a { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--ziel); padding: .4rem .8rem; max-width: 100%;
  border: 1px solid var(--linie); border-radius: 999px; background: var(--karte); color: var(--text); text-decoration: none; }
.zuletzt a:hover { border-color: var(--feldrand); }
.zuletzt a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.zuletzt a small { color: var(--leise); white-space: nowrap; }

/* Übersicht nach Aufgaben (Spec Plattform-Ordnung 06.10.2026, A.1): Meine Werkzeuge,
   Gebietsfilter, Bereiche. Bereiche sehen aus wie die Projektgruppen. */
.meine { margin: 0 0 1.4rem; }
.meine h2 { margin-bottom: .1rem; }
.unterkopf { font-size: .88rem; font-weight: 600; color: var(--leise); margin: .6rem 0 .4rem; }
.leer-text { color: var(--leise); margin: 0 0 .4rem; }
.meine .zuletzt { margin-bottom: 0; }
.gebietzeile { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: .5rem 0 .2rem; }
.gebietzeile .label { font-size: .9rem; font-weight: 600; color: var(--leise); }
.gebietwahl { margin: 0 0 .2rem; }
.gebietwahl > summary { font-size: .92rem; }
.gebietwahl .chips { padding: .2rem 0 .4rem; }
#treffer-info { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: center; }
.textknopf { background: none; border: 0; color: var(--blau); font: inherit; text-decoration: underline; cursor: pointer;
  min-height: var(--ziel); padding: 0 .2rem; }
.bereich { margin: 0 0 1rem; }
.bereich > summary { min-height: var(--ziel); color: var(--text); border-bottom: 1px solid var(--linie); padding: .2rem 0; flex-wrap: wrap; }
.bereich > summary h2 { margin: 0; font-size: 1.1rem; display: inline; }
.bereich > summary .unter { color: var(--leise); font-weight: 400; font-size: .88rem; }
.bereich > summary .anzahl { margin-left: auto; color: var(--leise); font-weight: 400; font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bereich > .kacheln, .bereich > .warnung { margin-top: .7rem; }
/* Kachel mit Knöpfen: der Titel-Link deckt die Kachel ab, Knöpfe liegen darüber. */
.kachel.mit-link { position: relative; font-size: 1rem; font-weight: 400; }
.kachel.mit-link:hover { border-color: var(--feldrand); }
.kachel-link { color: inherit; text-decoration: none; }
.kachel-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.kachel-link:focus-visible { outline: none; }
.kachel.mit-link:has(.kachel-link:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
@supports not selector(:has(*)) { .kachel-link:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; } }
.kachel .fuss { align-items: center; }
.kachel .gebiet { font-weight: 400; white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.anheften { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  min-width: var(--ziel); min-height: var(--ziel); margin: -.6rem -.7rem -.6rem 0; padding: 0 .6rem; border: 1px solid transparent;
  border-radius: 999px; background: transparent; color: var(--leise); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.anheften > span:first-child { font-size: 1.3rem; line-height: 1; }
.anheften .pin-wort { display: none; }
.anheften:hover { background: var(--grund); color: var(--text); }
.anheften[aria-pressed="true"] { color: var(--text); background: var(--grund); border-color: var(--feldrand); }
.anheften[aria-pressed="true"] .pin-wort { display: inline; }
.anheften:disabled, .reihe-knopf:disabled { opacity: .6; cursor: progress; }
.kachel .reihe { display: inline-flex; gap: .3rem; margin-left: auto; position: relative; z-index: 1; }
.reihe-knopf { min-width: var(--ziel); min-height: var(--ziel); border: 1px solid var(--feldrand); border-radius: var(--radius-klein);
  background: var(--karte); color: var(--text); font: inherit; cursor: pointer; }
.reihe-knopf:hover { background: var(--grund); }
#angeheftet > .kachel:first-child .reihe-knopf[data-schieben="-1"],
#angeheftet > .kachel:last-child .reihe-knopf[data-schieben="1"] { visibility: hidden; }

/* Ladezustand (Follow-ups, Plandatenbank) */
.wartet { color: var(--leise); padding: 1rem 0; }
.wartet::before { content: "◷ "; }

/* Login/Hinweis: Karte zentriert ohne Navi */
.anmeldung { min-height: calc(100dvh - 52px - 8rem); display: grid; place-items: center; padding: 1rem 0; }
.anmeldung .karte { width: min(26rem, 100%); padding: 1.6rem 1.4rem; }
.anmeldung h1 { font-size: 1.6rem; margin: 0 0 .2rem; }
.anmeldung h1 span { color: var(--akzent); text-shadow: 0 0 1px var(--text); }
.anmeldung .knopf { margin: .6rem 0 1rem; }
.ms-logo { width: 20px; height: 20px; flex: none; }

/* Hinweisseiten */
.hinweisseite { max-width: 44rem; margin: 1.5rem auto; }
.hinweisseite .art { margin: 0 0 .6rem; }
.hinweisseite h1 { margin-top: 0; }
.hinweisseite p { line-height: 1.6; }

/* Follow-ups */
.nf-item { border-left: 4px solid var(--linie); }
.nf-item.p-overdue, .nf-item.p-today { border-left-color: var(--rot); }
.nf-item.p-soon, .nf-item.p-urgent { border-left-color: var(--orange); }
.nf-item.p-stale { border-left-color: var(--blau); }
.nf-item.p-scheduled { border-left-color: var(--gruen); }
.nf-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .3rem .8rem; }
.nf-titel { font-weight: 600; font-size: 1.02rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
.nf-meta { font-size: .88rem; color: var(--leise); }
.nf-meta a { font-family: var(--mono); font-weight: 600; }
/* 44-px-Ziel ohne die Zeile aufzureißen: senkrechtes Polster an einem Inline-Element vergrößert die
   Klickfläche, nicht die Zeilenhöhe. */
a.vorgang-link { display: inline; padding: .7rem .15rem; margin: 0 -.15rem; white-space: nowrap; }
.nf-jira { white-space: nowrap; }
.nf-frage { margin: .5rem 0 .2rem; overflow-wrap: anywhere; }
.nf-aktionen { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.nf-aktionen .abseits { margin-left: auto; }

/* Statistik-Banner Admin-Follow-ups */
.nf-banner { margin-bottom: 1rem; }

@media (max-width: 480px) {
  .navi { padding: .3rem .4rem; gap: .1rem; }
  .navi a { padding: .5rem .55rem; }
  .kopf { gap: .4rem; }
  .wer { max-width: 34vw; }
  .wer .rolle { display: none; }
  .nf-aktionen .knopf.primaer { flex: 1 1 100%; }
  .nf-aktionen .abseits { margin-left: 0; }
}
@media (min-width: 700px) {
  main { padding: 1.2rem 1.4rem; }
  main.weit .kacheln { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .zeile2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wahlliste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aktionen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suchzeile { grid-template-columns: minmax(0, 1fr) auto; }
  td.aktionen-zelle .knoepfe { flex-wrap: nowrap; }
  .wer { max-width: 40vw; }
}
@media (min-width: 1000px) {
  main.weit .kacheln { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .zweispaltig { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .kachel, .knopf, .chip, .navi a { transition: background-color .15s, border-color .15s, color .15s; }
}
