:root {
  color-scheme: light dark;
  --bg: #f3f5f8; --flaeche: #ffffff; --flaeche2: #eaeef3; --rand: #c4ccd6;
  --text: #1b1f24; --leise: #4b5563;
  --akzent: #0b5cad; --auf-akzent: #ffffff;
  --ok-t: #14632f; --ok-b: #e1f4e7;
  --warn-t: #7a4200; --warn-b: #fff1cf;
  --bad-t: #a3201a; --bad-b: #fde7e5;
  --fokus: #0b5cad;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b; --flaeche: #1b2128; --flaeche2: #262e37; --rand: #46515e;
    --text: #e8edf2; --leise: #aab5c1;
    --akzent: #6aa9ff; --auf-akzent: #08111f;
    --ok-t: #86e0a1; --ok-b: #11301c;
    --warn-t: #ffd27a; --warn-b: #3a2b09;
    --bad-t: #ffa39d; --bad-b: #411815;
    --fokus: #8fc0ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
h1 { font-size: 1.2rem; margin: 0 0 .6rem; }
h2 { font-size: 1rem; margin: 1rem 0 .4rem; color: var(--leise); text-transform: none; }
p { margin: .4rem 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--rand); background: var(--flaeche); line-height: 1.2;
}
button:disabled { opacity: .55; cursor: not-allowed; }
button.primaer { background: var(--akzent); color: var(--auf-akzent); border-color: var(--akzent); font-weight: 600; }
button.gefahr { color: var(--bad-t); border-color: var(--bad-t); }
input[type=text], input[type=password], input[type=date], input[type=time], select, textarea {
  min-height: 44px; padding: 8px 10px; border: 1px solid var(--rand); border-radius: 8px;
  background: var(--flaeche); width: 100%;
}
textarea { resize: vertical; }
label { display: block; font-size: .9rem; color: var(--leise); margin: .6rem 0 .2rem; }

/* Kopfzeile: eine dünne Zeile */
.kopf {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  height: 48px; padding: 0 6px 0 10px; background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.marke { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; gap: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; border-radius: 8px; white-space: nowrap; padding: 0 10px;
  color: var(--leise); position: relative; flex: none;
}
.tabs button[aria-selected=true] { color: var(--akzent); font-weight: 700; background: var(--flaeche2); }
.tabs .zahl {
  display: inline-block; min-width: 1.4em; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--akzent); color: var(--auf-akzent); font-size: .75rem; text-align: center;
}
#abmelden { border: 0; background: transparent; color: var(--leise); }

main { padding: 10px 12px 28px; max-width: 900px; margin: 0 auto; }
.panel[hidden] { display: none; }
.zeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.zeile > * { min-width: 0; }
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.leise { color: var(--leise); font-size: .9rem; }
.meldung { padding: 8px 10px; border-radius: 8px; margin: 8px 0; }
.meldung.fehler { background: var(--bad-b); color: var(--bad-t); }
.meldung.hinweis { background: var(--flaeche2); color: var(--text); }
.marke-b {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .8rem; font-weight: 600;
  background: var(--flaeche2); color: var(--text); white-space: nowrap;
}
.marke-b.ok { background: var(--ok-b); color: var(--ok-t); }
.marke-b.warn { background: var(--warn-b); color: var(--warn-t); }
.marke-b.bad { background: var(--bad-b); color: var(--bad-t); }

/* Zähler */
.zaehler { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.zaehler button { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; min-height: 64px; }
.zaehler b { font-size: 1.5rem; line-height: 1.1; }
.zaehler span { font-size: .8rem; color: var(--leise); }

/* Listen als Raster */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: grid; grid-template-columns: 5.6em 1fr; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--rand); }
.liste li:first-child { border-top: 0; }
.liste .spalte { color: var(--leise); font-variant-numeric: tabular-nums; }
.liste .ueber { color: var(--bad-t); font-weight: 600; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--akzent); }
.briefing p { margin: .3rem 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0; font: .85rem/1.4 ui-monospace, Consolas, monospace; }

/* Sprechen */
#t-sprechen:not([hidden]) { display: flex; flex-direction: column; min-height: calc(100dvh - 48px - 40px); }
.leiste { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.leiste select { flex: 1 1 140px; width: auto; }
.schalter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; color: var(--text); font-size: .95rem; }
.schalter input { width: 22px; height: 22px; accent-color: var(--akzent); }
#verlauf { flex: 1; overflow-y: auto; padding: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.blase { max-width: 88%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; }
.blase.user { align-self: flex-end; background: var(--akzent); color: var(--auf-akzent); }
.blase.wilma { align-self: flex-start; background: var(--flaeche); border: 1px solid var(--rand); }
.blase.fehler { background: var(--bad-b); color: var(--bad-t); border-color: var(--bad-t); }
.jn { display: none; gap: 10px; margin-top: 8px; }
.laut .jn { display: flex; }
.jn button { flex: 1; white-space: nowrap; padding: 0 8px; min-height: 64px; font-size: 1.4rem; font-weight: 800; }
.jn .ja { background: var(--ok-b); color: var(--ok-t); border-color: var(--ok-t); }
.jn .nein { background: var(--bad-b); color: var(--bad-t); border-color: var(--bad-t); }
.eingabe { display: flex; gap: 6px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding: 6px 0; }
.eingabe textarea { flex: 1; min-height: 44px; max-height: 140px; }
#mikro[aria-pressed=true] { background: var(--bad-b); color: var(--bad-t); border-color: var(--bad-t); }
#freihaendig[aria-pressed=true] { background: var(--ok-b); color: var(--ok-t); border-color: var(--ok-t); }
.pegel { height: 6px; background: var(--flaeche2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.pegel i { display: block; height: 100%; width: 0; background: var(--bad-t); }

/* Entscheidungen */
.opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 8px 12px; min-height: 44px; height: auto; }
.opt.empfohlen { border: 2px solid var(--akzent); background: var(--flaeche2); font-weight: 600; }
.opt .stern { color: var(--akzent); font-size: .8rem; display: block; }
.frei { display: flex; gap: 6px; margin-top: 8px; }
.frei input { flex: 1; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Reise */
.reiseform { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.reiseform .voll { grid-column: 1 / -1; }
.reiseform .gruppe { display: flex; gap: 14px; flex-wrap: wrap; }
.verbindung .kopfzeile { display: grid; grid-template-columns: 5.4em 1fr auto; gap: 8px; align-items: baseline; }
.verbindung .zeit { font-weight: 700; font-variant-numeric: tabular-nums; }
.abschn { display: grid; grid-template-columns: 4.6em 1fr; gap: 2px 8px; font-size: .9rem; }

/* Zustand */
.ampeln { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ampel { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.punkt { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--leise); }
.punkt.ok { background: var(--ok-t); }
.punkt.bad { background: var(--bad-t); }
.punkt.warn { background: var(--warn-t); }

dialog { border: 1px solid var(--rand); border-radius: 12px; background: var(--flaeche); color: var(--text); max-width: min(92vw, 440px); padding: 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog .aktionen { justify-content: flex-end; }

/* Anmeldung / Einrichten */
body.login { display: flex; justify-content: center; padding: 24px 16px; }
.loginbox { width: 100%; max-width: 380px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 18px; align-self: flex-start; }
.loginbox button { width: 100%; margin-top: 14px; }

@media (min-width: 700px) {
  .blase { max-width: 70%; }
  .liste li { grid-template-columns: 8em 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
#dialog-titel { font-size: 1.05rem; }

/* 01.10.2026 Nachbesserung nach Sichtpruefung der Screenshots */
@media (max-width: 700px) {
  .marke { display: none; }
  #abmelden { font-size: 0; width: 44px; padding: 0; }
  #abmelden::before { content: "⎋"; font-size: 1.3rem; }
  .tabs { scroll-snap-type: x proximity;
          -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
                  mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs button { scroll-snap-align: center; }
}
/* Laute Umgebung: Wilmas Antwort volle Breite, damit JA/NEIN gross genug sind */
.laut .blase.wilma { align-self: stretch; max-width: 100%; }
.jn button { min-width: 7rem; }
#verlauf { padding-bottom: 16px; }

/* Sicherheitsaudit 01.10.2026: Sendedialog */
.sendevorschau { margin: 8px 0; }
.sendevorschau .empfaenger {
  font-weight: 700; font-size: 1.05rem; padding: 6px 10px; margin: 2px 0 6px; border-radius: 8px;
  background: var(--warn-b); color: var(--warn-t); border: 2px solid var(--warn-t);
}
.sendevorschau pre { max-height: 40vh; overflow-y: auto; background: var(--flaeche2); padding: 8px; border-radius: 8px; }
dialog { width: min(92vw, 440px); }
