:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --flaeche: #161616;
  --flaeche-2: #1f1f1f;
  --linie: #2c2c2c;
  --text: #f4f4f2;
  --text-2: #b9b8b0;
  --text-3: #85847d;
  --akzent: #ff8a3d;
  --akzent-text: #0d0d0d;
  --instagram: #199e70;
  --gut: #2fa05a;
  --warnung: #e0a100;
  --fehler: #e5484d;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
code { overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--akzent); }
.versteckt { display: none !important; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: 22px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.logo-punkt { width: 26px; height: 26px; border-radius: 7px; background: var(--akzent); display: grid; place-items: center; color: var(--akzent-text); font-size: 14px; font-weight: 800; }

/* Layout */
.nav-liste { display: contents; }
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.seitenleiste { background: var(--flaeche); border-right: 1px solid var(--linie); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.seitenleiste .logo { padding: 0 8px 18px; }
.nav-knopf { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; color: var(--text-2); cursor: pointer; }
.nav-knopf:hover { background: var(--flaeche-2); color: var(--text); }
.nav-knopf.aktiv { background: var(--flaeche-2); color: var(--text); box-shadow: inset 3px 0 0 var(--akzent); }
.nav-zahl { margin-left: auto; background: var(--akzent); color: var(--akzent-text); border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.seitenleiste .unten { margin-top: auto; display: grid; gap: 6px; }
main { padding: 26px 32px 60px; min-width: 0; overflow-wrap: break-word; }
.kopf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.kopf h2 { margin: 0; font-size: 24px; }
.kopf .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Bausteine */
.knopf { background: var(--flaeche-2); border: 1px solid var(--linie); padding: 9px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.knopf:hover { border-color: #444; }
.knopf.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); font-weight: 600; }
.knopf.primaer:hover { filter: brightness(1.05); }
.knopf.gefahr { color: #ff8b8e; }
.knopf.klein { padding: 5px 10px; font-size: 13px; }
.knopf:disabled { opacity: .5; cursor: default; }
.karte { min-width: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px; }
.karte h3 { margin: 0 0 12px; font-size: 15px; color: var(--text-2); font-weight: 600; }
.raster { display: grid; gap: 16px; }
.raster > * { min-width: 0; }
.raster.k4 { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.raster.k2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.kennzahl .wert { font-size: 30px; font-weight: 700; margin-top: 4px; }
.kennzahl .label { color: var(--text-2); font-size: 13px; }
.kennzahl .sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.feld { display: grid; gap: 6px; }
.feld > span { font-size: 13px; color: var(--text-2); }
input[type=text], input[type=password], input[type=datetime-local], input[type=number], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--linie); border-radius: 8px; padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
input[type=text], input[type=password], input[type=datetime-local], input[type=number], textarea, select { min-width: 0; }
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.hinweis { color: var(--text-3); font-size: 13px; }
.fehlertext { color: #ff8b8e; font-size: 14px; }
.leer { color: var(--text-3); padding: 22px; text-align: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--linie); color: var(--text-2); white-space: nowrap; }
.punkt { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.netz-instagram { background: var(--instagram); }
.status-entwurf { color: var(--text-2); }
.status-freigabe { color: var(--warnung); border-color: #5f3412; }
.status-geplant { color: #86b6ef; border-color: #1c3d66; }
.status-veroeffentlicht { color: #6fd39a; border-color: #1d5a35; }
.status-fehler, .status-teilweise { color: #ff8b8e; border-color: #6a2224; }
.status-wird_veroeffentlicht { color: var(--akzent); }
.reiter { display: flex; gap: 4px; flex-wrap: wrap; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 9px; padding: 3px; }
.reiter button { background: none; border: 0; padding: 6px 12px; border-radius: 6px; color: var(--text-2); cursor: pointer; }
.reiter button.aktiv { background: var(--flaeche-2); color: var(--text); }

/* Beitragsliste */
.liste { display: grid; gap: 10px; }
.eintrag { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.eintrag:hover { border-color: #444; }
.eintrag .vorschaubild { width: 64px; height: 64px; border-radius: 8px; background: var(--flaeche-2) center/cover no-repeat; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.eintrag .titel { font-weight: 600; margin-bottom: 3px; overflow-wrap: anywhere; }
.eintrag .auszug { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.eintrag.idee { grid-template-columns: 1fr auto; cursor: default; }
.eintrag.idee .auszug { -webkit-line-clamp: 4; }
.eintrag .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.eintrag .aktionen { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Rückfrage vor dem Löschen aus der Liste */
.frage-hg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; justify-content: center; align-items: center; padding: 16px; z-index: 40; }
.frage { width: min(440px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; padding: 20px; }
.frage h3 { margin: 0 0 10px; font-size: 18px; overflow-wrap: anywhere; }
.frage p { margin: 0 0 14px; color: var(--text-2); overflow-wrap: anywhere; }
.frage-knoepfe { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }
.metriken { display: flex; gap: 12px; color: var(--text-3); font-size: 13px; }
/* Mehrfachauswahl in der Beitragsliste (Auftrag #27) */
.eintrag.mit-wahl { grid-template-columns: 44px 64px minmax(0, 1fr) auto; gap: 10px 14px; }
.eintrag.gewaehlt { border-color: var(--akzent); background: #231610; }
.wahl { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -8px; cursor: pointer; }
.wahl input { width: 22px; height: 22px; margin: 0; accent-color: var(--akzent); cursor: pointer; }
.wahl input:disabled { cursor: not-allowed; opacity: .35; }
.auswahl-zeile { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: -6px 0 14px; }
.auswahl-zeile .hinweis { flex: 1 1 260px; min-width: 0; }
.liste.beschaeftigt { opacity: .55; pointer-events: none; }
.auswahl-leiste { position: fixed; left: 230px; right: 0; bottom: 0; z-index: 14; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--flaeche); border-top: 2px solid var(--akzent); padding: 12px 32px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(0,0,0,.5); }
.auswahl-zahl { font-weight: 700; }
.auswahl-knoepfe { display: flex; gap: 12px; flex-wrap: wrap; }
body:has(.auswahl-leiste:not(.versteckt)) main { padding-bottom: 110px; }
body:has(.auswahl-leiste:not(.versteckt)) .toast { bottom: 90px; }
/* Rückfrage «Ausgewählte löschen» */
.frage.mehrfach { width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.frage.mehrfach h3 { flex: none; }
.frage-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.frage-scroll p.warnung { color: var(--akzent); font-weight: 600; background: rgba(255, 138, 61, .1); border: 1px solid #5f3412; border-radius: 8px; padding: 10px 12px; }
.frage-liste { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--linie); border-radius: 8px; max-height: 240px; overflow-y: auto; }
.frage-liste li { padding: 8px 12px; border-bottom: 1px solid var(--linie); display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; }
.frage-liste li:last-child { border-bottom: 0; }
.frage-liste li.bald { background: rgba(255, 138, 61, .1); }
.frage-liste .t { overflow-wrap: anywhere; min-width: 0; flex: 1 1 140px; }
.frage-liste .grund { flex: 1 1 100%; color: #ff8b8e; font-size: 14px; overflow-wrap: anywhere; }
.chip.bald-chip { color: var(--akzent); border-color: #5f3412; white-space: normal; }
.frage-haken { flex: none; margin-top: 4px; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid #6a2224; border-radius: 8px; background: rgba(229, 72, 77, .08); cursor: pointer; min-height: 44px; }
.frage-haken input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--fehler); }

/* Kalender */
.kalender { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.kalender .wt { background: var(--flaeche); padding: 8px; font-size: 12px; color: var(--text-3); text-align: center; border-bottom: 1px solid var(--linie); }
.kalender .tag { min-height: 118px; padding: 6px; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); background: var(--bg); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kalender .tag:nth-child(7n) { border-right: 0; }
.kalender .tag:hover { background: #121212; }
.kalender .tag.fremd { opacity: .45; }
.kalender .tag.heute .nr { background: var(--akzent); color: var(--akzent-text); border-radius: 99px; padding: 0 7px; font-weight: 700; }
.kalender .nr { font-size: 12px; color: var(--text-2); align-self: flex-start; }
.kal-beitrag { font-size: 12px; background: var(--flaeche-2); border: 1px solid var(--linie); border-left: 3px solid var(--text-3); border-radius: 5px; padding: 3px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: flex; gap: 5px; align-items: center; }
.kal-beitrag.s-geplant { border-left-color: #3987e5; }
.kal-beitrag.s-freigabe { border-left-color: var(--warnung); }
.kal-beitrag.s-veroeffentlicht { border-left-color: var(--gut); }
.kal-beitrag.s-fehler, .kal-beitrag.s-teilweise { border-left-color: var(--fehler); }
.kal-beitrag .zeit { color: var(--text-3); }

/* Agenda (Handy-Ansicht des Kalenders) */
.agenda { display: none; }

/* Wiederkehrende Zeilen mit Eingabe und Knopf */
.verb-aktionen { margin-left: auto; display: flex; gap: 6px; }
.eingabe-zeile { display: flex; gap: 6px; }
.eingabe-zeile input { min-width: 0; flex: 1; }
.fuss-links { display: contents; }
.heatmap-rahmen { display: block; }
textarea.mono { font-family: monospace; font-size: 12px; }

/* Modal / Editor */
.modal-hg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; justify-content: center; align-items: flex-start; padding: 32px 16px; overflow-y: auto; z-index: 20; }
.modal { width: min(1100px, 100%); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; }
.modal-kopf { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--linie); }
.modal-kopf h3 { margin: 0; font-size: 18px; }
.modal-kopf .x-knopf { margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--text-2); }
.modal-inhalt { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; padding: 20px; }
.modal-fuss { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 20px; border-top: 1px solid var(--linie); align-items: center; }
.modal-fuss .rechts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.spalte { display: grid; gap: 16px; align-content: start; }
.netz-wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.netz-wahl label { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--linie); border-radius: 8px; cursor: pointer; }
.netz-wahl input { accent-color: var(--akzent); }
.textblock { display: grid; gap: 6px; }
.textblock .zeile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.textblock .zaehler { margin-left: auto; font-size: 12px; color: var(--text-3); }
.textblock .zaehler.zuviel { color: #ff8b8e; font-weight: 700; }
.reel-zeile { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche-2); }
.schalter { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.schalter .schiene { width: 36px; height: 20px; border-radius: 99px; background: #3a3a3a; position: relative; transition: background .15s; flex: none; }
.schalter .schiene::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.schalter input:checked + .schiene { background: var(--akzent); }
.schalter input:checked + .schiene::after { transform: translateX(16px); background: var(--akzent-text); }
.schalter input:focus-visible + .schiene { outline: 2px solid var(--akzent); outline-offset: 2px; }
.schalter input:disabled + .schiene { opacity: .5; }
.ki-box { border: 1px dashed #5f3412; background: #17140a; border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.ki-box h4 { margin: 0; font-size: 14px; color: var(--akzent); }
.bildwahl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bildwahl > div { min-width: 0; max-width: 100%; }
.bildwahl img, .bildwahl video { max-height: 90px; max-width: 160px; border-radius: 8px; border: 1px solid var(--linie); display: block; }
.bildwahl video { max-height: 240px; max-width: min(100%, 220px); background: #000; }
.bildwahl #ed-cover-vorschau img { max-height: 120px; max-width: min(100%, 120px); }

/* Upload: Fortschrittsbalken und Ergebnis der Videoprüfung */
.upload { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche-2); }
.balken { height: 10px; border-radius: 99px; background: #3a3a3a; overflow: hidden; }
.balken .fuellung { height: 100%; width: 0; background: var(--akzent); border-radius: 99px; transition: width .15s linear; }
.upload-zeile { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.video-info { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche-2); font-size: 14px; overflow-wrap: anywhere; }
.video-info .v-gut { color: var(--gut); }

/* Assets: Bibliothek (Karten in einem Raster, Vorschau oben) */
.asset-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.asset-raster > * { min-width: 0; }
.asset { display: grid; gap: 8px; align-content: start; padding: 12px; }
.asset-vorschau { height: 170px; border-radius: 8px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--linie); }
.asset-vorschau img, .asset-vorschau video { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.asset-vorschau audio { width: calc(100% - 16px); }
.asset-name code { overflow-wrap: anywhere; font-size: 14px; }
.asset-meta { margin: 0; }
.asset-aktionen { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.asset-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; line-height: 1.4; min-height: 44px; }
.asset-check input { flex: none; margin-top: 2px; width: 22px; height: 22px; }

/* Vorschau */
.vorschau { background: #fff; color: #0f1419; border-radius: 12px; padding: 14px; font-size: 14px; line-height: 1.4; }
.vorschau.dunkel { background: #000; color: #e7e9ea; border: 1px solid #2f3336; }
.vorschau .vk { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.vorschau .ava { width: 38px; height: 38px; border-radius: 50%; background: var(--akzent); display: grid; place-items: center; color: #000; font-weight: 800; }
.vorschau .name { font-weight: 700; }
.vorschau .klein { color: #65676b; font-size: 12px; }
.vorschau.dunkel .klein { color: #71767b; }
.vorschau .vtext { white-space: pre-wrap; word-wrap: break-word; }
.vorschau img, .vorschau video { width: 100%; border-radius: 10px; margin-top: 10px; display: block; background: #000; }
.vorschau video { max-height: 420px; }
.vorschau-titel { font-size: 12px; color: var(--text-3); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }

/* Diagramme */
.diagramm { position: relative; }
.diagramm svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagramm .achse { fill: var(--text-3); font-size: 11px; }
.diagramm .gitter { stroke: #262626; stroke-width: 1; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.legende span { display: inline-flex; gap: 6px; align-items: center; }
.tooltip { position: absolute; pointer-events: none; background: #262626; border: 1px solid #3a3a3a; border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--text); white-space: nowrap; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip .tt-zeile { display: flex; gap: 6px; align-items: center; }
.heatmap { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; color: var(--text-3); }
.heatmap .zelle { aspect-ratio: 1; border-radius: 3px; background: #1a1a1a; }
.heatmap .zelle.daten { cursor: default; }
.heatmap .kopfz { text-align: center; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th { text-align: left; color: var(--text-3); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--linie); }
.tabelle td { padding: 9px 8px; border-bottom: 1px solid #222; vertical-align: top; }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle td { overflow-wrap: anywhere; }
.tabelle .gesamt { font-weight: 700; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #262626; border: 1px solid #3a3a3a; padding: 10px 16px; border-radius: 9px; z-index: 50; max-width: calc(100% - 32px); }
.toast.fehler { border-color: #6a2224; color: #ffb3b5; }
.lade { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: dreh .7s linear infinite; vertical-align: -2px; }
@keyframes dreh { to { transform: rotate(360deg); } }
.verb { display: grid; gap: 12px; }
.verb-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verb-kopf h3 { margin: 0; }
details summary { cursor: pointer; color: var(--text-2); }
details ol { color: var(--text-2); font-size: 14px; line-height: 1.6; padding-left: 20px; }

/* Gewinnspiele */
.chip.gw { color: var(--akzent); border-color: #5f3412; }
a.knopf { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.gw-block { gap: 8px; padding: 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche-2); }
.gw-felder { background: var(--bg); }
.gw-karte { display: grid; gap: 12px; align-content: start; }
.gw-kopf { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.gw-kopf a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.gw-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.gw-karte h4 { margin: 10px 0 4px; font-size: 13px; color: var(--text-2); }
.gw-ergebnis { display: grid; gap: 10px; }
.gw-ergebnis h4 { margin: 0; font-size: 15px; color: var(--text); }
.gw-person { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--linie); min-width: 0; }
.gw-person:last-child { border-bottom: 0; }
.gw-person-kopf { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.gw-kommentar { color: var(--text-2); overflow-wrap: anywhere; font-size: 14px; }
.gw-pruef ul { list-style: none; padding-left: 0; margin: 4px 0; color: var(--text-2); font-size: 14px; line-height: 1.7; }
.gw-eintraege { border-top: 1px solid var(--linie); padding-top: 4px; min-width: 0; }

/* LinkedIn-Kontakte (Desktop: Typ und Status in einer Zeile, Notiz darf umbrechen, Knöpfe in zwei Reihen) */

/* ===== Handy und kleines Tablet (bis 900 px) ===== */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  /* Kopfleiste: oben Name und Abmelden, darunter die Reiter einzeilig wischbar */
  .seitenleiste { min-width: 0; position: sticky; top: 0; z-index: 15; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 6px 12px 0; gap: 0; border-right: 0; border-bottom: 1px solid var(--linie); }
  .seitenleiste .logo { order: 1; padding: 0 4px; flex: 1; min-height: 44px; }
  .seitenleiste .unten { order: 2; margin: 0; display: flex; }
  .nav-liste { order: 3; flex: 1 0 100%; display: flex; gap: 2px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; scroll-snap-type: x proximity; }
  .nav-liste::-webkit-scrollbar { display: none; }
  .nav-knopf { width: auto; flex: none; white-space: nowrap; min-height: 44px; padding: 0 14px; border-radius: 8px 8px 0 0; scroll-snap-align: center; }
  .nav-liste .nav-knopf.aktiv { background: var(--flaeche-2); box-shadow: inset 0 -3px 0 var(--akzent); }
  .seitenleiste .unten .nav-knopf { padding: 0 10px; border-radius: 8px; }
  /* «+ Neuer Beitrag» schwebt unten rechts, gut mit dem Daumen erreichbar */
  #neu-knopf { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 12; box-shadow: 0 6px 20px rgba(0,0,0,.55); border-radius: 99px; padding: 0 20px; }
  main { padding: 18px max(16px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)); }
  .kopf h2 { font-size: 22px; }
  .kopf .rechts { margin-left: 0; width: 100%; min-width: 0; }
  .kopf .rechts > .knopf { flex: 1; }
  .reiter { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; flex: 1 1 100%; }
  .reiter::-webkit-scrollbar { display: none; }
  .reiter button { flex: 1 0 auto; white-space: nowrap; min-height: 44px; padding: 0 14px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Tippflächen und Eingabefelder */
  .knopf, .knopf.klein { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; white-space: normal; text-align: center; }
  .knopf.klein { font-size: 14px; }
  input[type=text], input[type=password], input[type=datetime-local], input[type=number], textarea, select { font-size: 16px; min-height: 44px; padding: 10px 12px; -webkit-appearance: none; appearance: none; }
  select { background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
  textarea { min-height: 120px; }
  textarea.mono { font-size: 16px; }
  input[type=datetime-local] { display: block; }
  .netz-wahl label { min-height: 44px; flex: 1 1 auto; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .schalter { min-height: 44px; }
  details summary { padding: 12px 0; list-style-position: inside; }
  .textblock .zeile a { display: inline-flex; align-items: center; min-height: 44px; }
  .verb-aktionen { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .verb-aktionen .knopf { flex: 1; }
  .eingabe-zeile { flex-wrap: wrap; }
  .eingabe-zeile .knopf { flex: 1 1 100%; }

  /* Raster */
  .raster.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .raster.k4.einspaltig, .raster.k2 { grid-template-columns: minmax(0, 1fr); }
  .raster.k4 .kennzahl { padding: 14px; }
  .kennzahl .wert { font-size: 26px; }
  .karte { padding: 14px; }

  /* Beitragsliste */
  .eintrag { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; }
  .eintrag.mit-wahl { grid-template-columns: 44px 56px minmax(0, 1fr); gap: 12px 8px; }
  .wahl { margin-left: -6px; align-self: center; }
  .auswahl-zeile { margin: 0 0 12px; }
  .auswahl-zeile .knopf { flex: 1 1 100%; }
  .auswahl-leiste { left: 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); gap: 8px; }
  .auswahl-zahl { flex: 1 1 100%; }
  .auswahl-knoepfe { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  body:has(.auswahl-leiste:not(.versteckt)) #neu-knopf { display: none; }
  body:has(.auswahl-leiste:not(.versteckt)) main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  body:has(.auswahl-leiste:not(.versteckt)) .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .frage-liste { max-height: 30vh; }
  .eintrag .vorschaubild { width: 56px; height: 56px; }
  .eintrag.mit-wahl .aktionen { grid-column: 1 / -1; }
  .eintrag .aktionen { grid-column: 1 / -1; justify-content: flex-start; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: 12px; }
  .frage-hg { padding: 16px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
  .frage-knoepfe { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .eintrag.idee { grid-template-columns: minmax(0, 1fr); }
  .metriken { flex-wrap: wrap; }

  /* Kalender: Agenda statt Monatsraster */
  .kalender, .legende .kal-hinweis { display: none; }
  #kal-zurueck, #kal-vor { font-size: 24px; }
  .karte.ohne-rahmen { background: none; border: 0; padding: 0; }
  .agenda { display: grid; gap: 14px; }
  .agenda-tag h4 { margin: 0 0 6px; font-size: 14px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .agenda-tag.heute h4 { color: var(--akzent); }
  .agenda-tag .liste { gap: 8px; }
  .agenda-eintrag { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: start; background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid var(--text-3); border-radius: var(--radius); padding: 10px 12px; min-height: 56px; cursor: pointer; }
  .agenda-eintrag.s-geplant { border-left-color: #3987e5; }
  .agenda-eintrag.s-freigabe { border-left-color: var(--warnung); }
  .agenda-eintrag.s-veroeffentlicht { border-left-color: var(--gut); }
  .agenda-eintrag.s-fehler, .agenda-eintrag.s-teilweise { border-left-color: var(--fehler); }
  .agenda-eintrag .zeit { font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 1px; }
  .agenda-eintrag .titel { font-weight: 600; overflow-wrap: anywhere; margin-bottom: 6px; }
  .agenda-eintrag .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

  /* Dialog: bildschirmfüllend, Knöpfe unten sichtbar */
  body:has(.modal-hg) { overflow: hidden; }
  .modal-hg { padding: 0; align-items: flex-start; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal { width: 100%; min-height: 100%; border: 0; border-radius: 0; display: flex; flex-direction: column; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .modal-kopf { position: sticky; top: 0; z-index: 3; background: var(--flaeche); padding: 6px 8px 6px 16px; min-height: 56px; padding-top: calc(6px + env(safe-area-inset-top)); }
  .modal-kopf .x-knopf { width: 44px; height: 44px; font-size: 28px; }
  .modal-inhalt { grid-template-columns: minmax(0, 1fr); padding: 16px; flex: 1; }
  .modal-fuss { display: contents; }
  .fuss-links { display: flex; gap: 8px; padding: 0 16px 16px; }
  .fuss-links .knopf { flex: 1; }
  .modal-fuss .rechts { position: sticky; bottom: 0; z-index: 3; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; background: var(--flaeche); border-top: 1px solid var(--linie); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .modal-fuss .rechts .primaer { order: -1; grid-column: 1 / -1; }
  .modal-fuss .rechts #ed-jetzt { grid-column: 1 / -1; }
  .modal-fuss .rechts .knopf { padding: 0 8px; }
  .bildwahl img, .bildwahl video { max-width: 100%; }
  .bildwahl video { max-width: min(100%, 240px); }
  #ed-bild-vorschau:has(video) { flex: 1 1 100%; }
  .upload-zeile .knopf { flex: 1 1 100%; }
  .balken { height: 12px; }
  .vorschau video { max-height: 320px; }

  /* Tabellen als Karten (Klasse «karten» am table-Element, Beschriftung in data-label) */
  .tabelle.karten, .tabelle.karten tbody { display: block; width: 100%; }
  .tabelle.karten thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tabelle.karten tr { display: block; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--radius); padding: 4px 14px; margin-bottom: 10px; overflow: hidden; }
  .tabelle.karten td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px solid #262626; text-align: right; }
  .tabelle.karten td:last-child { border-bottom: 0; }
  .tabelle.karten td::before { content: attr(data-label); color: var(--text-3); font-size: 13px; text-align: left; flex: none; }
  .tabelle.karten td.karten-titel { display: block; text-align: left; font-weight: 600; font-size: 16px; padding: 12px 0 10px; }
  .tabelle.karten td.karten-titel::before { content: none; }
  .tabelle.karten td.gesamt { margin: 4px -14px 0; padding: 12px 14px; background: rgba(255, 138, 61, .12); border-bottom: 0; color: var(--akzent); font-size: 16px; }
  .tabelle.karten td.gesamt::before { color: var(--akzent); font-size: 14px; font-weight: 600; }
  .tabelle.karten td.aktionen-zelle { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 10px 0 8px; }
  .tabelle.karten td.aktionen-zelle::before { content: none; }
  .tabelle.karten td.aktionen-zelle .knopf { width: 100%; }
  /* Kompakte Karten (Top-Beiträge): Titel oben, Kennzahlen in einer Reihe */
  .tabelle.karten.kompakt tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 6px; }
  .tabelle.karten.kompakt td.karten-titel { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 4px; }
  .tabelle.karten.kompakt td:not(.karten-titel) { display: block; text-align: center; border-bottom: 0; padding: 8px 0 10px; }
  .tabelle.karten.kompakt td:not(.karten-titel)::before { display: block; margin-bottom: 2px; font-size: 12px; text-align: center; }
  .tabelle.karten.kompakt td.karten-titel a { display: inline-block; padding: 4px 0; min-height: 44px; line-height: 1.5; }

  /* Gewinnspiele: Knöpfe untereinander bzw. zweispaltig, Links gut tippbar */
  .gw-aktionen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .gw-aktionen .knopf { width: 100%; }
  .gw-kopf a, .gw-person .hinweis a, .tabelle.karten td a { display: inline-flex; align-items: center; min-height: 44px; }
  .gw-kopf a { min-height: 0; }
  .gw-block { padding: 12px; }
  .gw-pruef summary { min-height: 44px; display: flex; align-items: center; }
  .reiter button { flex: 1 0 auto; }

  /* Diagramme und Heatmap */
  .diagramm svg { max-width: 100%; }
  .heatmap-rahmen { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; padding-bottom: 6px; }
  .heatmap-rahmen .heatmap { min-width: 560px; }
  .tooltip { width: max-content; max-width: 260px; white-space: normal; }
  .tabelle { font-size: 15px; }
}

/* Breiteres Handy / quer: Karten in zwei Spalten */
@media (min-width: 560px) and (max-width: 900px) {
  .tabelle.karten tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .tabelle.karten tr { margin-bottom: 0; }
  .netz-karten { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; align-items: start; }
}

/* Schmale Handys: Ränder etwas enger */
@media (max-width: 420px) {
  main { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .karte { padding: 12px; }
}

/* Quer auf dem Handy: wenig Höhe, daher nichts Festklebendes ausser dem Dialog-Fuss (in einer Zeile) */
@media (max-width: 900px) and (max-height: 500px) {
  .seitenleiste { position: static; }
  .modal-kopf { position: static; min-height: 48px; }
  .modal-fuss .rechts { grid-template-columns: repeat(4, 1fr); padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .modal-fuss .rechts .primaer { order: 0; grid-column: auto; }
  .modal-fuss .rechts #ed-jetzt { grid-column: auto; }
  .bildwahl video { max-height: 170px; }
  #neu-knopf { bottom: calc(10px + env(safe-area-inset-bottom)); }
}
