/* Freigaben-Oberfläche der Über-KI.
   Zuerst für das Telefon gebaut: eine Spalte, große Tippflächen, Leiste unten. Ab 48rem Breite die Leiste oben
   und zweispaltige Raster. Kein JavaScript, keine fremden Schriften oder Dateien. */

:root {
  --hintergrund: #f3f5f7;
  --flaeche: #ffffff;
  --flaeche-2: #f3f5f7;
  --text: #16202a;
  --gedaempft: #566371;
  --linie: #d5dce3;
  --akzent: #0f4c75;
  --akzent-text: #ffffff;
  --fokus: #1b7fc4;
  --gruen: #176b30;
  --gruen-hell: #dcf3e2;
  --gelb: #7a4f00;
  --gelb-hell: #fff1c9;
  --rot: #b3261e;
  --rot-hell: #fde4e1;
  --lila: #5b34a8;
  --lila-hell: #ece4fb;
  --blau: #0a559c;
  --blau-hell: #dfedfb;
  --grau-hell: #e6eaee;
  --radius: 12px;
  --schatten: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --leiste: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #0d1318;
    --flaeche: #172028;
    --flaeche-2: #101820;
    --text: #e7edf2;
    --gedaempft: #9fadba;
    --linie: #2b3843;
    --akzent: #6cb6ee;
    --akzent-text: #06141f;
    --fokus: #8fcaf5;
    --gruen: #7ddc98;
    --gruen-hell: #12351f;
    --gelb: #f2cc6b;
    --gelb-hell: #3b2e0a;
    --rot: #ff9c94;
    --rot-hell: #48191a;
    --lila: #c9b2f7;
    --lila-hell: #2d2147;
    --blau: #93c7f8;
    --blau-hell: #12304b;
    --grau-hell: #26323d;
    --schatten: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

a {
  color: var(--akzent);
}

h1 {
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 0.25rem 0 0.75rem;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

p {
  margin: 0.5rem 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprung {
  position: absolute;
  left: -999rem;
  top: 0;
  background: var(--flaeche);
  padding: 0.6rem 1rem;
  z-index: 30;
}

.sprung:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.klein {
  font-size: 0.85rem;
  color: var(--gedaempft);
  font-weight: 400;
}

/* ------------------------------------------------------------------ Kopf und Leiste */

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  padding-top: calc(0.5rem + env(safe-area-inset-top));
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}

.marke {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.abmelden {
  margin: 0;
}

.leiste {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}

.leiste a {
  position: relative;
  flex: 1 1 0;
  min-height: var(--leiste);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-size: 0.72rem;
  color: var(--gedaempft);
  text-decoration: none;
}

.leiste a[aria-current="page"] {
  color: var(--akzent);
  font-weight: 700;
}

.zaehler {
  position: absolute;
  top: 0.35rem;
  left: calc(50% + 0.4rem);
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--rot);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .zaehler {
    color: #2a0b09;
  }
}

body.mit-leiste main {
  padding-bottom: calc(var(--leiste) + env(safe-area-inset-bottom) + 1.5rem);
}

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1rem;
  padding-left: calc(1rem + env(safe-area-inset-left));
  padding-right: calc(1rem + env(safe-area-inset-right));
}

main.schmal {
  max-width: 27rem;
}

.fuss {
  display: none;
}

.banner {
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
}

.banner.gefahr {
  background: var(--rot);
  color: #fff;
}

.banner.gefahr a {
  color: #fff;
}

.banner.warnung {
  background: var(--gelb-hell);
  color: var(--gelb);
}

@media (prefers-color-scheme: dark) {
  .banner.gefahr {
    color: #2a0b09;
  }

  .banner.gefahr a {
    color: #2a0b09;
  }
}

/* --------------------------------------------------------------- Karten und Kennzeichen */

.karte,
.block {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}

.karte {
  padding: 0.85rem 1rem;
}

.block {
  padding: 1rem;
  margin: 1rem 0;
}

.block.hervor {
  border-left: 5px solid var(--gelb);
}

.block.alarm {
  border: 2px solid var(--rot);
}

.mitte {
  margin-top: 8vh;
}

.karten {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

a.vorschlag {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.vorschlag:hover {
  border-color: var(--akzent);
}

.vorschlag.dringend {
  border-left: 5px solid var(--rot);
}

.zeile-oben {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.nummer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.art {
  color: var(--gedaempft);
  font-size: 0.9rem;
}

.zusammenfassung {
  font-weight: 600;
  margin: 0.3rem 0;
  overflow-wrap: anywhere;
}

.zeile-unten {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
}

.betrag {
  font-weight: 700;
  color: var(--text);
}

.frist {
  white-space: nowrap;
}

.zeile-karte {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem 1rem;
}

.zeile-karte form {
  margin: 0;
}

.kennz {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--grau-hell);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.kennz.rot,
.status-abgelehnt,
.status-fehlgeschlagen {
  background: var(--rot-hell);
  color: var(--rot);
}

.kennz.gelb,
.status-veraltet {
  background: var(--gelb-hell);
  color: var(--gelb);
}

.kennz.gruen,
.status-freigegeben,
.status-ausgefuehrt {
  background: var(--gruen-hell);
  color: var(--gruen);
}

.kennz.blau,
.status-offen,
.status-in_ausfuehrung {
  background: var(--blau-hell);
  color: var(--blau);
}

.kennz.lila {
  background: var(--lila-hell);
  color: var(--lila);
}

.leer {
  text-align: center;
  color: var(--gedaempft);
  padding: 2.5rem 1rem;
}

/* -------------------------------------------------------------------- Auswahl und Reiter */

.auswahl {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.15rem 0.1rem 0.5rem;
  margin: 0 -0.1rem;
  scrollbar-width: thin;
}

.auswahl a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.klein-auswahl a {
  min-height: 2.1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.auswahl a[aria-current="true"] {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--akzent-text);
}

.zahl {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.reiter {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--linie);
  margin-bottom: 0.5rem;
  overflow-x: auto;
}

.reiter a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  color: var(--gedaempft);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.reiter a[aria-current="page"] {
  color: var(--akzent);
  border-bottom-color: var(--akzent);
}

.seiten {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.seiten > :last-child {
  justify-self: end;
}

.seiten > :first-child {
  justify-self: start;
}

.zurueck {
  margin: 0;
}

.zurueck a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  text-decoration: none;
  font-weight: 600;
}

/* ----------------------------------------------------------------------------- Inhalte */

.felder {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem 1.25rem;
  margin: 0.4rem 0;
}

.felder dt {
  font-size: 0.8rem;
  color: var(--gedaempft);
}

.felder dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.beschriftung {
  font-size: 0.8rem;
  color: var(--gedaempft);
  margin-top: 0.6rem;
}

.vortext {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  margin: 0.25rem 0;
}

.vortext.grund {
  margin-top: 0.35rem;
}

.punkte {
  margin: 0.4rem 0;
  padding-left: 1.2rem;
}

.punkte li {
  margin: 0.2rem 0;
  overflow-wrap: anywhere;
}

.abschnitt + .abschnitt {
  border-top: 1px solid var(--linie);
  margin-top: 0.9rem;
}

.abschnitt h3:first-child {
  margin-top: 0.75rem;
}

.block > .abschnitt:first-of-type h3 {
  margin-top: 0;
}

.tabelle {
  overflow-x: auto;
}

table.daten {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.daten th {
  text-align: left;
  font-size: 0.8rem;
  color: var(--gedaempft);
  font-weight: 600;
  white-space: nowrap;
}

table.daten th,
table.daten td {
  padding: 0.45rem 0.6rem 0.45rem 0;
  border-bottom: 1px solid var(--linie);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.einzelheit {
  display: block;
}

/* Am Telefon wird jede Tabellenzeile zu einer Karte; die Spaltenüberschrift steht vor dem Wert. */
@media (max-width: 47.99rem) {
  table.daten thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table.daten,
  table.daten tbody,
  table.daten tr,
  table.daten td {
    display: block;
  }

  table.daten tr {
    border: 1px solid var(--linie);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    margin-bottom: 0.5rem;
    background: var(--flaeche-2);
  }

  table.daten td {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.2rem 0;
    border: 0;
  }

  table.daten td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    color: var(--gedaempft);
  }

  table.daten td.volle-breite {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem;
  }
}

.regeln {
  margin-top: 0.6rem;
}

.belege,
.verlauf {
  margin: 0.4rem 0;
  padding-left: 1.4rem;
}

.belege li,
.verlauf li {
  margin: 0.5rem 0;
}

.belege .wert {
  overflow-wrap: anywhere;
}

.aenderungen {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0;
}

.aenderungen li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--linie);
  overflow-wrap: anywhere;
}

.aenderungen li:last-child {
  border-bottom: 0;
}

.stelle {
  display: block;
  font-size: 0.8rem;
  color: var(--gedaempft);
}

.vorher {
  text-decoration: line-through;
  color: var(--gedaempft);
}

.nachher {
  font-weight: 700;
}

/* Vergleich zweier Textfassungen: unveränderte Zeilen als Umgebung, Gestrichenes durchgestrichen, Neues
   unterstrichen und fett – erkennbar auch ohne Farbe. Ein Zeichen am Rand sagt, was mit der Zeile geschah. */
.textvergleich {
  margin-top: 0.3rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche-2);
  overflow: hidden;
}

.dz {
  position: relative;
  margin: 0;
  min-height: 1.5em;
  padding: 0.1rem 0.6rem 0.1rem 1.7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-left: 4px solid transparent;
}

.dz .dm {
  position: absolute;
  left: 0.45rem;
  font-weight: 700;
}

.dz.geaendert {
  border-left-color: var(--blau);
  background: var(--blau-hell);
}

.dz.weg {
  border-left-color: var(--rot);
  background: var(--rot-hell);
}

.dz.neu {
  border-left-color: var(--gruen);
  background: var(--gruen-hell);
}

.dz.luecke {
  color: var(--gedaempft);
  font-size: 0.85rem;
  text-align: center;
  padding-left: 0.6rem;
}

/* Ganze Zeilen bleiben gut lesbar: Zeichen am Rand und Hintergrund sagen, was geschah. Durchgestrichen und
   unterstrichen wird nur innerhalb einer geänderten Zeile – dort trägt die Auszeichnung die Aussage. */
.dz del,
.dz ins {
  color: inherit;
  text-decoration: none;
}

.dz.geaendert del {
  color: var(--rot);
  background: var(--rot-hell);
  text-decoration: line-through;
  border-radius: 3px;
}

.dz.geaendert ins {
  color: var(--gruen);
  background: var(--gruen-hell);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  border-radius: 3px;
}

.leerzeile {
  color: var(--gedaempft);
  font-style: italic;
  font-size: 0.85rem;
}

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0.3rem 0 0;
  color: var(--gedaempft);
}

.technisch {
  margin-top: 1rem;
  overflow-wrap: anywhere;
}

details > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

details.ablehnen {
  margin-top: 1rem;
  border-top: 1px solid var(--linie);
  padding-top: 0.25rem;
}

.entscheiden {
  border: 2px solid var(--akzent);
}

/* --------------------------------------------------------------------------- Formulare */

.stapel {
  display: grid;
  gap: 0.45rem;
  margin: 0.5rem 0;
}

label {
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  /* Mindestens 16px: Sonst vergrößert iOS die Seite beim Antippen eines Felds. */
  font-size: 1rem;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input.code {
  font-size: 1.5rem;
  letter-spacing: 0.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

input.zahlfeld {
  font-variant-numeric: tabular-nums;
}

fieldset.teil {
  border: 1px solid var(--linie);
  border-radius: 8px;
  padding: 0.6rem 0.8rem 0.8rem;
  margin: 0.3rem 0;
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

fieldset.teil legend {
  font-weight: 700;
  padding: 0 0.3rem;
  overflow-wrap: anywhere;
}

fieldset.gestrichen {
  opacity: 0.6;
}

.info-zeile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  margin: 0;
}

.haken {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.6rem;
  font-weight: 500;
  margin: 0;
}

.haken input {
  width: 1.3rem;
  height: 1.3rem;
  flex: 0 0 auto;
  accent-color: var(--akzent);
}

.haken.streichen {
  color: var(--rot);
}

.rollen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  margin: 0.4rem 0;
}

.filter {
  display: grid;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.filter label {
  display: block;
}

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0 1.1rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.knopf.haupt {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--akzent-text);
}

.knopf.gefahr {
  background: var(--rot);
  border-color: var(--rot);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .knopf.gefahr {
    color: #2a0b09;
  }
}

.knopf.schlicht {
  border-color: transparent;
  background: transparent;
  color: var(--akzent);
}

.knopf[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.knopf.breit {
  width: 100%;
}

.klein-knopf {
  min-height: 2.4rem;
  font-size: 0.85rem;
}

.knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.knoepfe > .knopf {
  flex: 1 1 9rem;
}

.knoepfe form {
  margin: 0;
  flex: 1 1 9rem;
  display: flex;
}

.knoepfe form .knopf {
  flex: 1;
}

/* Ein Feld mit seinem Knopf: am Telefon untereinander, ab Tablet-Breite nebeneinander. */
.feld-mit-knopf {
  display: grid;
  gap: 0.45rem;
}

.meldung {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin: 0.75rem 0;
}

.meldung.ok {
  background: var(--gruen-hell);
  color: var(--gruen);
}

.meldung.fehler {
  background: var(--rot-hell);
  color: var(--rot);
}

.meldung.warnung {
  background: var(--gelb-hell);
  color: var(--gelb);
}

.meldung.info {
  background: var(--blau-hell);
  color: var(--blau);
}

.meldung a {
  color: inherit;
  font-weight: 700;
}

.meldung .punkte {
  margin: 0.2rem 0;
}

/* ------------------------------------------------------------ Anmeldung und Einrichtung */

.schritte {
  padding-left: 1.2rem;
}

.schritte li {
  margin: 0.6rem 0;
}

.qr {
  margin: 0.6rem 0;
}

.qr svg {
  display: block;
  width: 13rem;
  max-width: 100%;
  height: auto;
  background: #fff;
  border-radius: 8px;
}

.geheimnis,
.geheim code {
  font-size: 1.15rem;
  font-weight: 700;
  user-select: all;
  overflow-wrap: anywhere;
}

.codes {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1rem;
}

.codes code {
  font-size: 1.05rem;
  font-weight: 600;
  user-select: all;
}

/* ------------------------------------------------------------------- ab Tablet-Breite */

@media (min-width: 48rem) {
  .kopf {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0 1.25rem;
  }

  .leiste {
    position: static;
    flex: 1;
    justify-content: flex-start;
    gap: 0.25rem;
    border: 0;
    padding: 0;
    margin-left: 1rem;
    background: transparent;
  }

  .leiste a {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 0.4rem;
    min-height: 3.25rem;
    padding: 0 0.8rem;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
  }

  .leiste a[aria-current="page"] {
    border-bottom-color: var(--akzent);
  }

  .zaehler {
    position: static;
  }

  body.mit-leiste main {
    padding-bottom: 2rem;
  }

  .feld-mit-knopf {
    grid-template-columns: minmax(0, 26rem) auto;
    justify-content: start;
    align-items: center;
  }

  main {
    padding: 1.5rem;
  }

  .fuss {
    display: block;
    text-align: center;
    padding: 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .felder {
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  }

  .knoepfe > .knopf,
  .knoepfe form {
    flex: 0 0 auto;
  }

  .raster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1.25rem;
    align-items: end;
  }

  .filter {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    align-items: end;
  }
}

@media print {
  .kopf,
  .leiste,
  .fuss,
  .banner,
  .knopf {
    display: none;
  }

  body {
    background: #fff;
  }
}
