/* Portal – schlichtes, gut lesbares Layout; Firmenfarbe kommt als --marke aus der Konfiguration */
:root {
  --marke: #1f4e78;
  --text: #1d1d1f;
  --text-2: #5f6368;
  --hinter: #f4f5f7;
  --flaeche: #ffffff;
  --linie: #dfe1e5;
  --rot: #b3261e;
  --rot-hell: #fce8e6;
  --gruen: #1e7e34;
  --gruen-hell: #e6f4ea;
  --gelb-hell: #fff4ce;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .05);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--hinter);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--marke); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
.karte h2:first-child { margin-top: 0; }

/* Kopf und Fuss */
.kopf { background: var(--marke); color: #fff; }
.kopf-innen {
  max-width: 1080px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.markenzeichen { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.markenzeichen img { height: 34px; width: auto; display: block; }
.portalname { font-size: .9rem; opacity: .9; }
.nur-leser { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.test .kopf { background-image: repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 255, 255, .08) 18px 36px); }

.inhalt { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 40px; }
.fuss {
  max-width: 1080px; width: 100%; margin: 0 auto; padding: 16px; color: var(--text-2); font-size: .85rem;
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between;
}
.fuss nav { display: flex; gap: 16px; }
.fuss a { color: var(--text-2); }

/* Karten und Layout */
.karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 24px; margin-bottom: 16px; }
.karte.schmal { max-width: 460px; margin: 4vh auto 16px; }
.karte.text { max-width: 760px; margin: 2vh auto 16px; line-height: 1.55; }
.karte.text h2 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.karte.text ul { padding-left: 1.2rem; margin: .4rem 0; }
.karte.text li { margin: .25rem 0; }
.einleitung { color: var(--text-2); margin-top: 0; }
.unter { color: var(--text-2); font-size: .9rem; margin: .15rem 0; }
.hinweis { color: var(--text-2); font-size: .85rem; margin: .5rem 0 0; }
.leer { color: var(--text-2); background: var(--flaeche); border-radius: var(--radius); padding: 24px; text-align: center; }
.laden { color: var(--text-2); text-align: center; padding: 32px 0; }

.seitenkopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.seitenkopf h1 { margin: 0; }

.spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.spalten .karte { margin: 0; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.kachel {
  display: block; background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 20px;
  color: var(--text); text-decoration: none; border: 2px solid transparent; position: relative;
}
.kachel h2 { margin: 0 0 .4rem; }
.kachel p { margin: 0; color: var(--text-2); font-size: .95rem; }
.kachel.aktiv:hover, .kachel.aktiv:focus-visible { border-color: var(--marke); }
.marke-klein { display: inline-block; margin-top: 10px; font-size: .75rem; background: var(--gelb-hell); padding: 2px 8px; border-radius: 99px; }

/* Formulare */
.formular { display: flex; flex-direction: column; gap: 14px; }
.feld label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.feld input, .feld select, .feld textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; background: #fff; color: var(--text);
}
.feld textarea { resize: vertical; min-height: 4.5em; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 2px solid var(--marke); outline-offset: 1px; border-color: var(--marke); }
.feld input[type="file"] { padding: 8px; }
.felder-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.felder-plz { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr; gap: 14px; }
fieldset.gruppe { border: 1px solid var(--linie); border-radius: 8px; padding: 12px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
fieldset.gruppe legend { font-weight: 600; padding: 0 4px; }
.fehlertext { color: var(--rot); }
input.code { font-size: 1.5rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

fieldset.rollen { border: 1px solid var(--linie); border-radius: 8px; padding: 8px 12px 12px; margin: 0; }
fieldset.rollen legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.auswahl { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.auswahl input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.auswahl span { display: flex; flex-direction: column; }
.auswahl small { color: var(--text-2); }

.aktionen { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--linie); background: #fff; color: var(--text); min-height: 44px;
}
.knopf:hover { border-color: var(--marke); }
.knopf.primaer { background: var(--marke); border-color: var(--marke); color: #fff; }
.knopf.primaer:hover { filter: brightness(1.08); }
.knopf.klein { padding: 6px 12px; font-size: .875rem; min-height: 36px; }
.knopf.warnung { color: var(--rot); }
.knopf.gefahr { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf:disabled { opacity: .6; cursor: progress; }
.knopf.laedt::after {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: drehen .8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }

.link { background: none; border: 0; padding: 0; font: inherit; color: var(--marke); text-decoration: underline; cursor: pointer; }

/* Meldungen */
.meldung { padding: 12px 14px; border-radius: 8px; margin-bottom: 4px; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot); }
.meldung.ok { background: var(--gruen-hell); color: var(--gruen); }

/* Zwei-Faktor */
.schritte { padding-left: 1.2rem; }
.schritte li { margin-bottom: 12px; }
.qr { display: block; margin: 12px 0; background: #fff; padding: 8px; border: 1px solid var(--linie); border-radius: 8px; width: 200px; height: 200px; }
.schluessel { display: block; font-size: 1rem; word-break: break-all; background: var(--hinter); padding: 8px; border-radius: 6px; user-select: all; }
details summary { cursor: pointer; color: var(--marke); }

/* Listen */
.reiter { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--linie); overflow-x: auto; scrollbar-width: none; }
.reiter::-webkit-scrollbar { display: none; }
.reiter button { white-space: nowrap; flex: none; }
.reiter button {
  font: inherit; background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--text-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.reiter button.aktiv { color: var(--text); border-bottom-color: var(--marke); font-weight: 600; }
/* Benutzer verwalten: Firma umschalten (nur wo mehrere Firmen eine Datenbank teilen) */
.firmenwahl { margin-bottom: 8px; }
.firmenwahl > .unter { font-size: .85rem; }
.firmenwahl .reiter { margin-bottom: 4px; }
.firmenwahl .hinweis { margin: 0 0 12px; }
.einladen summary { font-weight: 600; }
.einladen[open] summary { margin-bottom: 16px; }

.liste { display: flex; flex-direction: column; gap: 10px; }
.eintrag { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; }
.eintrag p { margin: .25rem 0; }
.eintrag .aktionen { margin-top: 10px; }
.eintrag .formular { margin-top: 12px; }
.eintrag.gesperrt { opacity: .75; }
.eintrag-kopf { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.status { font-size: .75rem; background: var(--hinter); border-radius: 99px; padding: 2px 10px; margin-left: 4px; }
.status.rot { background: var(--rot-hell); color: var(--rot); }
.status.ok { background: var(--gruen-hell); color: var(--gruen); }
.status.laeuft { background: var(--gelb-hell); }

/* Neuigkeiten (Verwaltung; Fenster, Banner und Rundgänge in neuigkeiten.css) */
.hinweise:empty { display: none; }
.neu-angaben { margin: 2px 0; font-size: .9rem; }
.neu-zahlen { margin: 6px 0 10px; }
.neu-eintrag.archiviert { opacity: .8; }
.neu-archiv { margin-top: 18px; }
.neu-archiv summary { cursor: pointer; font-weight: 600; }
.neu-formular { max-width: 760px; }
.neu-liste .wn-karte { margin: 0; }

/* Mein Konto → Kalender */
.kalender-karte h3 { font-size: 1rem; margin: 14px 0 6px; }
.kalender-karte h3:first-child { margin-top: 4px; }
.kalender-karte input[type="text"], .kalender-karte input[type="url"] {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--linie); border-radius: 8px; background: #fff;
}
.kalender-neu { background: var(--hinter); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.kalender-neu .aktionen { margin-top: 8px; }
.kalender-hilfe { margin-top: 10px; font-size: .9rem; }
.kalender-hilfe summary { cursor: pointer; color: var(--text-2); }
.kalender-hilfe ul { margin: 6px 0; padding-left: 1.2rem; }
.kalender-privat { border-top: 1px solid var(--linie); margin-top: 16px; padding-top: 4px; }

/* ERP-Versionen */
.erp-version.aktiv { border-left: 4px solid var(--gruen); }
.erp-version h3 .status { vertical-align: middle; }
.neuerungen summary { cursor: pointer; color: var(--text-2); font-size: .9rem; }
.neuerungen ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.erp-aktiv { font-size: 1.05rem; margin: 0; }
.dokumente { margin: .5rem 0 0; padding-left: 1.2rem; }

.angaben { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 16px; }
.angaben dt { color: var(--text-2); }
.angaben dd { margin: 0; overflow-wrap: anywhere; }

/* Freie Texte aus den Firmenangaben (Zeilenumbrueche bleiben) */
.freitext { white-space: pre-line; }
.hinweisbox { background: var(--flaeche); border-left: 4px solid var(--marke); border-radius: 8px; padding: 12px 16px; box-shadow: var(--schatten); }
.notiz { color: var(--text-2); font-size: .9rem; }

/* Suche und Filter */
.werkzeugleiste { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
input.suche { flex: 1; min-width: 200px; font: inherit; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; }
select.klein { font: inherit; font-size: .875rem; padding: 6px 8px; border: 1px solid var(--linie); border-radius: 8px; background: #fff; min-height: 36px; max-width: 100%; }
.filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.aktionen.mittig { justify-content: center; margin-top: 16px; }

/* Portal-Vorschau */
.vorschau-banner {
  display: flex; flex-direction: column; gap: 2px; background: var(--gelb-hell); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px;
}
.vorschau-banner span { color: var(--text-2); font-size: .9rem; }
.vorschau-rahmen { border: 2px dashed var(--marke); border-radius: var(--radius); background: var(--hinter); margin-bottom: 16px; overflow: hidden; }
.vorschau-kopf { background: var(--marke); color: #fff; padding: 10px 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vorschau-inhalt { padding: 16px; }
.vorschau-inhalt h2 { margin-top: 0; }
.rechte-liste { margin: 0; }
.rechte-liste dt { font-weight: 600; margin-top: 10px; }
.rechte-liste dd { margin: 0; }
.rechte-liste ul { margin: 4px 0 0; padding-left: 1.2rem; }

/* Rollen & Rechte */
.matrix-huelle { overflow-x: auto; background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); }
table.matrix { border-collapse: collapse; width: 100%; font-size: .9rem; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: middle; }
.matrix thead th { position: sticky; top: 0; background: var(--flaeche); font-size: .85rem; white-space: nowrap; }
.matrix th small { display: block; font-weight: 400; color: var(--text-2); font-size: .75rem; }
.matrix tbody th[scope="row"] { font-weight: 400; min-width: 220px; }
.matrix tr.bereich th { background: var(--hinter); font-weight: 600; }
.matrix td { white-space: nowrap; color: var(--text-2); }
.matrix td.an { color: var(--text); background: var(--gruen-hell); }
.matrix td.gespeichert { outline: 2px solid var(--gruen); outline-offset: -2px; }
.matrix select { font: inherit; padding: 4px 6px; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }

/* Firmen */
ul.personen { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--linie); }
ul.personen li { display: flex; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie); }
ul.personen li.gesperrt { opacity: .7; }
ul.personen .aktionen { margin: 0; }

/* Protokoll */
ol.protokoll { list-style: none; margin: 0; padding: 0; background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); }
ol.protokoll li { display: grid; grid-template-columns: 150px 1fr; gap: 4px 16px; padding: 12px 16px; border-bottom: 1px solid var(--linie); }
ol.protokoll time { color: var(--text-2); font-size: .85rem; font-variant-numeric: tabular-nums; }
.protokoll-satz { margin: 0; }
.protokoll-details summary { font-size: .85rem; margin-top: 4px; }
table.diff { border-collapse: collapse; font-size: .85rem; margin-top: 6px; width: 100%; }
.diff th, .diff td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--linie); overflow-wrap: anywhere; vertical-align: top; }
.diff thead th { color: var(--text-2); font-weight: 600; }

/* Firmenangaben */
.kopf-vorschau {
  background: var(--marke); color: #fff; border-radius: 8px; padding: 12px 16px; min-height: 58px;
  display: flex; align-items: center; gap: 10px; font-weight: 700;
}
.kopf-vorschau .logo-bild { height: 34px; width: auto; display: block; }
.farbzeile { display: flex; gap: 10px; align-items: center; }
.farbzeile input.farbtext { flex: 1; }
.feld input.farbwahl { width: 56px; height: 44px; flex: none; padding: 2px; border: 1px solid var(--linie); border-radius: 8px; cursor: pointer; }

/* Zähler (ungelesen) */
.zaehler {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--rot); color: #fff; font-size: .75rem; font-weight: 700; line-height: 1;
  margin-left: 6px; vertical-align: middle;
}

/* Kundenportal: Stand wie die Statusseite der ERP Planung */
progress.fortschritt { width: 100%; height: 12px; border: 0; border-radius: 6px; overflow: hidden; background: #e6ebf1; appearance: none; margin: 12px 0 4px; }
progress.fortschritt::-webkit-progress-bar { background: #e6ebf1; border-radius: 6px; }
progress.fortschritt::-webkit-progress-value { background: var(--gruen); border-radius: 6px; }
progress.fortschritt::-moz-progress-bar { background: var(--gruen); border-radius: 6px; }
.fortschritt-text { margin: 0 0 6px; }
.projekt-kopf h2 { margin: 0; }
.meilensteine { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.ms { font-size: .8rem; padding: 3px 10px; border-radius: 12px; background: #e6ebf1; color: var(--text-2); }
.ms.erledigt { background: var(--gruen); color: #fff; }
.ms.arbeit { background: #f0b400; color: #fff; }
.termine { margin: 12px 0 0; }
.karte.bitte { border-left: 4px solid var(--rot); }
.phase + .phase { margin-top: 18px; }
.phase h2 { margin: 0 0 6px; }
.schritte-liste { list-style: none; margin: 0; padding: 0; }
.schritte-liste li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--linie); }
.schritte-liste li:last-child { border-bottom: 0; }
.schritte-liste .zeichen {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; background: #e6ebf1; color: var(--text-2); margin-top: 1px;
}
.schritt.ok .zeichen { background: var(--gruen); color: #fff; }
.schritt.arbeit .zeichen { background: #f0b400; color: #fff; }
.schritt.kunde .zeichen { background: var(--rot); color: #fff; }
.schritt-text { font-size: .95rem; color: #3b4553; }
.schritt-zustand { font-size: .82rem; color: var(--text-2); margin-top: 2px; }
.dokumente-liste { list-style: none; margin: 0; padding: 0; }
.dokumente-liste li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.dokumente-liste li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dokumente-liste .zeichen { font-size: 1.2rem; }
a.projekt-karte { display: block; color: var(--text); text-decoration: none; border: 2px solid transparent; }
a.projekt-karte:hover, a.projekt-karte:focus-visible { border-color: var(--marke); }
.bitte-kurz { color: var(--rot); font-weight: 600; font-size: .9rem; }
.reiter-inhalt > .karte:first-child { margin-top: 0; }

/* Chat (wie ein Messenger) */
.chat {
  position: relative; display: flex; flex-direction: column; height: clamp(420px, 70vh, 760px);
  background: #ece5dd; border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden;
}
.chat-verlauf { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 16px; }
.chat-leer { margin: auto; max-width: 420px; text-align: center; color: var(--text-2); background: rgba(255, 255, 255, .7); padding: 14px 18px; border-radius: 10px; }
.chat-aelter { align-self: center; margin-bottom: 8px; }
.chat-tag { align-self: center; margin: 10px 0 6px; }
.chat-tag span { background: rgba(255, 255, 255, .85); color: var(--text-2); font-size: .78rem; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.blase {
  max-width: min(78%, 560px); padding: 6px 10px 4px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  margin-top: 8px; background: #fff;
}
.blase.folge { margin-top: 2px; }
.blase.andere { align-self: flex-start; border-top-left-radius: 4px; }
.blase.eigene { align-self: flex-end; border-top-right-radius: 4px; background: #dff3e4; background: color-mix(in srgb, var(--marke) 14%, #fff); }
.blase.folge.andere { border-top-left-radius: 10px; }
.blase.folge.eigene { border-top-right-radius: 10px; }
.blase.wartet { opacity: .7; }
.blase-von { font-size: .8rem; font-weight: 700; color: #b05a00; margin-bottom: 2px; }
.blase-von.team { color: var(--marke); }
.blase-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.blase-text a { overflow-wrap: anywhere; }
.blase-fuss { display: flex; justify-content: flex-end; gap: 4px; font-size: .7rem; color: var(--text-2); margin-top: 2px; }
.haken { letter-spacing: -2px; }
.haken.gelesen { color: #1d8fe1; }
.chat-bild-knopf { display: block; margin: 2px 0 4px; padding: 0; border: 0; background: none; cursor: zoom-in; }
.bild-ebene {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .85); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 16px;
}
.bild-ebene img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 6px; background: #fff; }
.chat-bild { display: block; max-width: 100%; width: 260px; max-height: 280px; object-fit: cover; border-radius: 8px; background: #ddd; min-height: 60px; }
.chat-datei {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: rgba(0, 0, 0, .05); border: 0; border-radius: 8px; padding: 8px 10px; margin: 2px 0 4px; cursor: pointer;
}
.chat-datei small { display: block; color: var(--text-2); }
.chat-datei-icon { font-size: 1.4rem; }
.chat-neu {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 84px; font: inherit; font-size: .85rem;
  background: #fff; border: 1px solid var(--linie); border-radius: 16px; padding: 6px 14px; box-shadow: var(--schatten); cursor: pointer;
}
.chat > .meldung { margin: 0 8px 6px; }
.chat-eingabe { background: #f7f7f7; border-top: 1px solid var(--linie); padding: 8px; }
.chat-zeile { display: flex; align-items: flex-end; gap: 8px; }
.chat-text {
  flex: 1; font: inherit; resize: none; border: 1px solid var(--linie); border-radius: 20px; padding: 10px 14px;
  min-height: 44px; max-height: 160px; background: #fff; color: var(--text);
}
.chat-text:focus { outline: 2px solid var(--marke); outline-offset: 1px; }
.chat-knopf {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--linie); background: #fff;
  font-size: 1.2rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.chat-knopf.senden { background: var(--marke); border-color: var(--marke); color: #fff; }
.chat-knopf:disabled { opacity: .6; cursor: progress; }
.chat-anhang-wahl { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .85rem; padding: 4px 8px 8px; overflow-wrap: anywhere; }
.chat-nurlesen { margin: 0; padding: 12px; text-align: center; color: var(--text-2); background: #f7f7f7; border-top: 1px solid var(--linie); }

/* Kundenchat im Mitarbeiterportal: Liste links, Chat rechts */
.chat-layout { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; }
.chat-seitenliste { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 10px; max-height: 78vh; overflow-y: auto; }
.chat-seitenliste .suche { width: 100%; margin-bottom: 8px; }
.chat-projekt { display: block; padding: 10px 8px; border-radius: 8px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--linie); }
.chat-projekt:hover, .chat-projekt.aktiv { background: var(--hinter); }
.chat-projekt b { font-weight: 600; }
.chat-projekt.ungelesen b { font-weight: 800; }
.chat-projekt-letzte { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--text-2); margin-top: 2px; }
.chat-projekt-letzte span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-projekt-letzte time { flex: none; }
.chat-kopf { margin-bottom: 10px; }
.chat-kopf h2 { margin: 4px 0 2px; }
.nur-handy { display: none; }
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout.mit-auswahl .chat-seitenliste { display: none; }
  .chat-layout:not(.mit-auswahl) .chat-bereich { display: none; }
  .nur-handy { display: inline; }
  .nur-gross { display: none; }
  .chat { height: calc(100vh - 230px); min-height: 380px; border-radius: 0; margin: 0 -16px; }
  .blase { max-width: 86%; }
}

@media (max-width: 520px) {
  ol.protokoll li { grid-template-columns: 1fr; }
  .karte { padding: 18px; }
  .karte.schmal { margin-top: 8px; }
  .aktionen .knopf.primaer { flex: 1; }
}

/* Handy und Tablet: Rechtematrix mit fester erster Spalte, Reiter zeigen, dass es weitergeht, Chat-Höhe ohne die
   Adressleiste (dvh), Knöpfe und Kästchen gross genug für den Finger */
@media (max-width: 760px) {
  .matrix tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--flaeche);
    min-width: 160px;
  }
  .matrix tr.bereich th {
    position: sticky;
    left: 0;
  }
  .matrix thead th:first-child {
    left: 0;
    z-index: 2;
  }
  .reiter {
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .chat {
    height: calc(100dvh - 230px);
  }
}
@media (pointer: coarse) {
  button.link,
  a.link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  input[type="checkbox"],
  input[type="radio"] {
    width: 22px;
    height: 22px;
  }
  select,
  .knopf,
  button.knopf {
    min-height: 40px;
  }
  .reiter button {
    min-height: 44px;
  }
}
