/* Teamraum: schlicht, gut lesbar, Farben aus dem PflegeZert-Logo.
   Logo-Cyan #069AC1 nur für Flächen und Fokus, Text und Knöpfe in Aktions-Cyan #037594 (5,3:1). */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --logo-cyan: #069ac1;
  --aktion: #037594;
  --aktion-dunkel: #025a72;
  --aktion-hell: #e6f4f8;
  --auf-aktion: #ffffff;
  --text: #1e2326;
  --leise: #5b6266;
  --rand: #e3e6e8;
  --rand-stark: #c9ced2;
  --rand-hover: #9aa2a8;
  --flaeche: #f5f6f7;
  --flaeche-leicht: #fbfcfc;
  --karte: #ffffff;
  --feld: #ffffff;
  --gefahr: #b91c1c;
  --gefahr-rand: #e7b4b4;
  --gefahr-hell: #fdecec;
  --warn-text: #7a4f00;
  --warn-flaeche: #fdf1d3;
  --ok-text: #1d6b45;
  --ok-flaeche: #e5f3ea;
  --ok-punkt: #2e8b57;
  --schatten: rgb(15 23 42 / 0.25);
  --abdunkeln: rgb(15 23 42 / 0.35);
  --kopf: 56px;
  --radius: 12px;
  color-scheme: light;
}

/* Dunkles Design: Flächen in Grauschwarz statt reinem Schwarz, Aktionsfarbe heller für genug Kontrast. */
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --aktion: #5ccbe8;
    --aktion-dunkel: #8fdcf0;
    --aktion-hell: #10343f;
    --auf-aktion: #04222c;
    --text: #e6e8ea;
    --leise: #a3abb1;
    --rand: #2c3136;
    --rand-stark: #3d444a;
    --rand-hover: #5d666d;
    --flaeche: #121417;
    --flaeche-leicht: #171a1e;
    --karte: #1b1e22;
    --feld: #15181b;
    --gefahr: #f87171;
    --gefahr-rand: #7f2a2a;
    --gefahr-hell: #331b1d;
    --warn-text: #f4c66b;
    --warn-flaeche: #352a10;
    --ok-text: #74e0a3;
    --ok-flaeche: #11301f;
    --ok-punkt: #4cc285;
    --schatten: rgb(0 0 0 / 0.55);
    --abdunkeln: rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-thema="dunkel"] {
  --aktion: #5ccbe8;
  --aktion-dunkel: #8fdcf0;
  --aktion-hell: #10343f;
  --auf-aktion: #04222c;
  --text: #e6e8ea;
  --leise: #a3abb1;
  --rand: #2c3136;
  --rand-stark: #3d444a;
  --rand-hover: #5d666d;
  --flaeche: #121417;
  --flaeche-leicht: #171a1e;
  --karte: #1b1e22;
  --feld: #15181b;
  --gefahr: #f87171;
  --gefahr-rand: #7f2a2a;
  --gefahr-hell: #331b1d;
  --warn-text: #f4c66b;
  --warn-flaeche: #352a10;
  --ok-text: #74e0a3;
  --ok-flaeche: #11301f;
  --ok-punkt: #4cc285;
  --schatten: rgb(0 0 0 / 0.55);
  --abdunkeln: rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--flaeche);
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
a { color: var(--aktion); text-underline-offset: 2px; }
a:hover { color: var(--aktion-dunkel); }
:focus-visible { outline: 3px solid var(--logo-cyan); outline-offset: 2px; }
.leise { color: var(--leise); margin: 0; }
.klein { font-size: 0.875rem; }
.unsichtbar { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rechts { margin-left: auto; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Kopfzeile */
.leiste {
  position: sticky; top: 0; z-index: 20;
  height: var(--kopf);
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
  background: var(--karte);
  border-bottom: 1px solid var(--rand);
}
.marke { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.haupt { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.haupt a {
  padding: 7px 12px; border-radius: 8px; color: var(--leise); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.haupt a:hover { background: var(--flaeche); color: var(--text); }
.haupt a[aria-current="page"] { background: var(--aktion-hell); color: var(--aktion-dunkel); }
.ich { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ich form { margin: 0; }
.ich .knopf.symbol { padding: 0; min-height: 34px; width: 34px; height: 34px; }
.knopf.symbol svg { flex: none; }
.knopf.symbol .sonne { display: none; }
:root[data-thema="dunkel"] .knopf.symbol .mond { display: none; }
:root[data-thema="dunkel"] .knopf.symbol .sonne { display: block; }
@media (prefers-color-scheme: dark) {
  :root[data-thema="system"] .knopf.symbol .mond { display: none; }
  :root[data-thema="system"] .knopf.symbol .sonne { display: block; }
}
.knopf.symbol[aria-pressed="false"] { opacity: 0.7; }
.wahl { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.wahl:disabled { opacity: 0.6; }
.wahl legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.wahl-zeile { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.wahl-zeile input { accent-color: var(--aktion); width: 18px; height: 18px; }
.person { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 600; }
.kreis {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--farbe, var(--aktion)); color: #fff; font-weight: 700; font-size: 0.8rem;
}

/* ---------------------------------------------------------------- Rahmen */
.inhalt { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; }
.mitte { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.titelzeile { margin-bottom: 20px; }
.raster { display: grid; gap: 16px; margin-bottom: 16px; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.raster.drei { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.karte {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 20px;
}
.karte.schmal { width: min(440px, 100%); padding: 28px; }
.karte-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.karte-kopf h2 { margin: 0; }
.kopf-marke { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.kopf-marke h1 { font-size: 1.4rem; }
.leer-hinweis { color: var(--leise); margin: 4px 0 0; }
.meldungen { max-width: 1240px; margin: 16px auto 0; padding: 0 20px; }
.meldung { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--ok-flaeche); color: var(--ok-text); font-weight: 600; }
body.schlicht .meldungen { position: fixed; top: 12px; left: 0; right: 0; }

/* ---------------------------------------------------------------- Formulare */
.stapel { display: grid; gap: 14px; }
label { font-weight: 600; display: grid; gap: 6px; }
input, select, textarea {
  font: inherit; color: inherit;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rand-stark); border-radius: 8px; background: var(--feld);
}
input:hover, select:hover, textarea:hover { border-color: var(--rand-hover); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--logo-cyan) 45%, transparent); outline-offset: 0; border-color: var(--aktion); }
input[type="checkbox"], input[type="radio"] { width: auto; }
.feld { display: grid; gap: 6px; }
.feld label { display: block; }
.hilfe { margin: 0; color: var(--leise); font-size: 0.875rem; }
.fehler { margin: 0; color: var(--gefahr); font-weight: 600; font-size: 0.9rem; }
.hat-fehler input, .hat-fehler select, .hat-fehler textarea { border-color: var(--gefahr); border-width: 2px; }
.fehlerbox { border: 2px solid var(--gefahr); background: var(--gefahr-hell); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.fehlerbox h2 { font-size: 1rem; margin: 0 0 6px; color: var(--gefahr); }
.fehlerbox p, .fehlerbox ul { margin: 0; }
.fehlerbox a { color: var(--gefahr); font-weight: 600; }
.zeile-form { display: flex; gap: 8px; margin-top: 12px; }
.zeile-form input { flex: 1; }
.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.knopf {
  font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; min-height: 40px;
  border-radius: 8px; border: 1px solid var(--rand-stark);
  background: var(--karte); color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, transform 80ms;
}
.knopf:hover { background: var(--flaeche); border-color: var(--rand-hover); }
.knopf:active { transform: translateY(1px); }
.knopf.haupt { background: var(--aktion); border-color: var(--aktion); color: var(--auf-aktion); }
.knopf.haupt:hover { background: var(--aktion-dunkel); border-color: var(--aktion-dunkel); }
.knopf.leise { border-color: transparent; background: transparent; color: var(--leise); }
.knopf.leise:hover { background: var(--flaeche); color: var(--text); }
.knopf.gefahr { color: var(--gefahr); border-color: var(--gefahr-rand); }
.knopf.gefahr:hover { background: var(--gefahr-hell); }
.knopf.klein { padding: 5px 11px; min-height: 32px; font-size: 0.875rem; }
.knopfzeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

.farbwahl { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.farbwahl legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.farbfeld { position: relative; cursor: pointer; }
.farbfeld input { position: absolute; opacity: 0; inset: 0; }
.farbfeld .punkt { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--farbe); border: 3px solid var(--karte); box-shadow: 0 0 0 1px var(--rand); }
.farbfeld input:checked + .punkt { box-shadow: 0 0 0 2px var(--text); }
.farbfeld input:focus-visible + .punkt { outline: 3px solid var(--logo-cyan); outline-offset: 2px; }

/* ---------------------------------------------------------------- Listen */
.kurzliste { list-style: none; margin: 0; padding: 0; }
.kurzliste li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--rand); }
.kurzliste li:first-child { border-top: 0; }
.kurzliste .titel { font-weight: 600; }
.kurzliste .meta { color: var(--leise); font-size: 0.875rem; }
.spaet { color: var(--gefahr); font-weight: 700; }
.pille { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--aktion-hell); color: var(--aktion-dunkel); }
.pille.warte { background: var(--warn-flaeche); color: var(--warn-text); }
.pille.arbeit { background: var(--aktion-hell); color: var(--aktion-dunkel); }

.person-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); white-space: nowrap; }
.person-chip .kreis { width: 22px; height: 22px; font-size: 0.7rem; }
.person-chip.leer { color: var(--leise); font-weight: 400; }

.verlauf { list-style: none; margin: 0; padding: 0; }
.ereignis { display: grid; grid-template-columns: 9.5rem 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--rand); }
.ereignis:first-child { border-top: 0; }
.ereignis time { color: var(--leise); font-size: 0.875rem; padding-top: 1px; }
.ereignis .satz a { color: var(--text); text-decoration: none; }
.ereignis .satz a:hover { text-decoration: underline; }
.verlauf.kompakt .ereignis { grid-template-columns: 1fr; gap: 0; }
.verlauf.kompakt .ereignis time { order: 2; font-size: 0.8rem; }

.reiter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.reiter a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rand); background: var(--karte);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.reiter a:hover { border-color: var(--rand-hover); }
.reiter a[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--flaeche); }
.reiter .punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--farbe); }

/* ---------------------------------------------------------------- Aufgaben */
.neue-aufgabe { display: grid; grid-template-columns: 1fr 190px 170px auto; gap: 10px; align-items: end; }
.neue-aufgabe label { gap: 0; }
.filterzeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 8px; }
.filterzeile .reiter { margin: 0; }
.hinweis-neu { margin: 0 0 8px; }
.aufgabenliste { list-style: none; margin: 0; padding: 0; background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); }
.aufgabe { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; border-top: 1px solid var(--rand); }
.aufgabe:first-child { border-top: 0; }
.abhaken { width: 22px !important; height: 22px; margin: 2px 0 0; accent-color: var(--aktion); cursor: pointer; }
.aufgabe-text { display: grid; gap: 2px; min-width: 0; }
.aufgabe-text .titel { font-weight: 600; overflow-wrap: anywhere; }
.aufgabe-text .notiz { color: var(--leise); font-size: 0.9rem; }
.aufgabe-text .meta { color: var(--leise); font-size: 0.8rem; }
.aufgabe-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.termin { font-size: 0.9rem; color: var(--leise); white-space: nowrap; }
.aufgabe.erledigt .titel { text-decoration: line-through; color: var(--leise); }
.aufgabe-bearbeiten { display: block; background: var(--flaeche-leicht); }
.bearbeiten-form { display: grid; gap: 12px; }
.raster-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.htmx-request.aufgabe { opacity: 0.6; }

/* ---------------------------------------------------------------- Vollbild-Seiten (Board, Zeitstrahl) */
body.vollbild { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.vollbild > main { flex: 1; min-height: 0; }
.board-seite { position: relative; display: flex; flex-direction: column; }
.board-kopf { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--karte); border-bottom: 1px solid var(--rand); }
.board-name { margin: 0; }
.board-name input { font-weight: 700; border-color: transparent; padding: 4px 8px; width: 22ch; }
.board-name input:hover { border-color: var(--rand); }
.board-wahl { display: flex; gap: 4px; overflow-x: auto; }
.board-wahl a { padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--leise); font-weight: 600; font-size: 0.875rem; white-space: nowrap; }
.board-wahl a[aria-current="page"] { background: var(--flaeche); color: var(--text); }
.board-status { margin-left: auto; font-size: 0.8rem; font-weight: 700; color: var(--leise); display: inline-flex; align-items: center; gap: 6px; }
.board-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rand-hover); }
.board-status[data-status="verbunden"] { color: var(--ok-text); }
.board-status[data-status="verbunden"]::before { background: var(--ok-punkt); }
.board-status[data-status="getrennt"], .board-status[data-status="abgemeldet"] { color: var(--gefahr); }
.board-status[data-status="getrennt"]::before, .board-status[data-status="abgemeldet"]::before { background: var(--gefahr); }
.board-flaeche { position: relative; flex: 1; min-height: 0; }

.zeitstrahl-seite { display: flex; flex-direction: column; padding: 16px 20px 20px; gap: 12px; }
.zeitstrahl-kopf { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.zeitstrahl-kopf h1 { margin: 0; font-size: 1.35rem; }
.werkzeuge { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.werkzeuge .gruppe { display: inline-flex; gap: 4px; }
.hilfezeile { flex-basis: 100%; }
.zeitstrahl-flaeche { flex: 1; min-height: 0; }

.dialog { border: 0; border-radius: 14px; padding: 24px; width: min(520px, calc(100% - 32px)); box-shadow: 0 24px 64px var(--schatten); background: var(--karte); color: var(--text); }
.dialog::backdrop { background: var(--abdunkeln); }
.dialog h2 { font-size: 1.2rem; margin: 0; }
.spurenliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.spurenliste li { display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- Effekte-Pult (nur Admin) */
.wahl-quer { grid-auto-flow: column; justify-content: start; gap: 8px 24px; margin-bottom: 8px; }
.speicherstand { color: var(--leise); font-weight: 600; }
.speicherstand[data-stand="gespeichert"] { color: var(--ok-text); }
.speicherstand[data-stand="fehler"] { color: var(--gefahr); }
.effektliste { list-style: none; margin: 0; padding: 0; }
.effekt {
  display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 1fr) 5.5rem;
  grid-template-areas: "schalter regler test" "text regler test";
  gap: 2px 20px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rand);
}
.effekt:first-child { border-top: 0; }
.effekt .schalter { grid-area: schalter; }
.effekt-beschreibung { grid-area: text; margin: 0 0 0 54px; }
.effekt .regler { grid-area: regler; }
.effekt > .knopf { grid-area: test; justify-self: end; }
.effekt.ist-aus .regler, .effekt.ist-aus .effekt-beschreibung { opacity: 0.45; }
.effekt-name { font-weight: 700; }

.schalter { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.schiene {
  position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px;
  background: var(--rand-stark); transition: background-color 200ms;
}
.schiene::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: translate 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.schalter input:checked + .schiene { background: var(--aktion); }
.schalter input:checked + .schiene::after { translate: 18px 0; }
.schalter input:focus-visible + .schiene { outline: 3px solid var(--logo-cyan); outline-offset: 2px; }

.regler { display: grid; grid-template-columns: 6.5rem 1fr 3.6rem; align-items: center; gap: 10px; font-weight: 400; }
.regler output { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.regler input[type="range"] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--aktion); }
@media (max-width: 760px) {
  .effekt { grid-template-columns: 1fr auto; grid-template-areas: "schalter test" "text text" "regler regler"; }
  .effekt-beschreibung { margin-left: 54px; }
  .wahl-quer { grid-auto-flow: row; }
}

/* Kurze Hinweise unten in der Mitte (z. B. „Tobias hat die Animationen für alle eingeschaltet“). */
.blase {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--flaeche); font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 12px 30px -12px var(--schatten);
  transition: opacity 250ms, translate 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.blase.zeigen { opacity: 1; translate: -50% 0; }

/* ---------------------------------------------------------------- Schmale Bildschirme */
@media (max-width: 860px) {
  .neue-aufgabe { grid-template-columns: 1fr 1fr; }
  .neue-aufgabe .breit { grid-column: 1 / -1; }
  .raster-form { grid-template-columns: 1fr 1fr; }
  .nur-breit { display: none; }
}
@media (max-width: 640px) {
  .leiste { gap: 12px; padding: 0 12px; }
  .marke span { display: none; }
  .inhalt { padding: 20px 16px 48px; }
  .ereignis { grid-template-columns: 1fr; gap: 0; }
  .ereignis time { order: 2; font-size: 0.8rem; }
  .aufgabe { grid-template-columns: auto 1fr; }
  .aufgabe-info { grid-column: 2; justify-content: flex-start; }
  .neue-aufgabe, .raster-form, .zwei-spalten { grid-template-columns: 1fr; }
  .zeile-form { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
