/* Funkbüro – gemeinsame Gestaltung. Große Ziele, hoher Kontrast, hell und dunkel. */

:root {
  --bg: #f4f4f2;
  --flaeche: #ffffff;
  --text: #111111;
  --text-leise: #555555;
  --rand: #c8c8c4;
  --blitz: #c40000;
  --blitz-text: #ffffff;
  --sofort: #e06a00;
  --sofort-text: #ffffff;
  --normal: #6b6b6b;
  --gruen: #13802f;
  --blau: #1f5fbf;
  --gelb: #f2c200;
  --gelb-text: #111111;
  --fokus: #1f5fbf;
  --schatten: 0 1px 3px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --flaeche: #1d1f22;
    --text: #f2f2f2;
    --text-leise: #a9a9a9;
    --rand: #3b3e43;
    --blitz: #ff3030;
    --sofort: #ff8a1f;
    --sofort-text: #111111;
    --normal: #9a9a9a;
    --gruen: #2fbf55;
    --blau: #5a96ff;
    --gelb: #ffd23a;
    --fokus: #8fb6ff;
    --schatten: none;
  }
}

:root[data-theme="dark"] {
  --bg: #111214;
  --flaeche: #1d1f22;
  --text: #f2f2f2;
  --text-leise: #a9a9a9;
  --rand: #3b3e43;
  --blitz: #ff3030;
  --sofort: #ff8a1f;
  --sofort-text: #111111;
  --normal: #9a9a9a;
  --gruen: #2fbf55;
  --blau: #5a96ff;
  --gelb: #ffd23a;
  --fokus: #8fb6ff;
  --schatten: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 2px solid var(--rand);
  background: var(--flaeche);
  border-radius: 12px;
  padding: 0.6em 1em;
  min-height: 56px;
  font-weight: 600;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

input, textarea, select {
  width: 100%;
  border: 2px solid var(--rand);
  background: var(--flaeche);
  border-radius: 10px;
  padding: 0.6em 0.8em;
}
textarea { resize: vertical; }

.kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
  font-size: 15px;
  color: var(--text-leise);
  min-height: 48px;
}
.kopf .marke { font-weight: 800; color: var(--text); letter-spacing: 0.02em; }
.kopf .rechts { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.kopf button { min-height: 36px; min-width: 40px; padding: 4px 10px; font-size: 16px; border-radius: 8px; }
@media (max-width: 640px) {
  .kopf { gap: 8px; padding: 6px 10px; }
  .kopf .breit { display: none; }
}

.verbindung { display: inline-flex; align-items: center; gap: 6px; }
.verbindung::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--gruen); }
.verbindung.weg::before { background: var(--blitz); }
.verbindung.weg { color: var(--blitz); font-weight: 700; }

.banner-offline {
  display: none;
  background: var(--blitz);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 10px 16px;
}
.offline .banner-offline { display: block; }

/* Prioritäten */
.prio-blitz { --p: var(--blitz); --p-text: var(--blitz-text); }
.prio-sofort { --p: var(--sofort); --p-text: var(--sofort-text); }
.prio-normal { --p: var(--normal); --p-text: #fff; }

.prio-schild {
  display: inline-block;
  background: var(--p);
  color: var(--p-text);
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 14px;
  letter-spacing: 0.04em;
}
.prio-normal.prio-schild { background: transparent; color: var(--text-leise); border: 1px solid var(--rand); }

/* Rückgängig-Leiste: oben, damit sie nie über den großen Aktionsknöpfen liegt */
.rueckgaengig {
  position: fixed;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 16px;
  padding: 8px 8px 8px 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 32px);
}
.rueckgaengig .text { flex: 1 1 auto; min-width: 0; font-size: 20px; }
.rueckgaengig.sichtbar { display: flex; }
.rueckgaengig button { background: var(--bg); color: var(--text); border: none; min-height: 56px; font-size: 20px; }
.rueckgaengig .text { font-weight: 600; }
.rueckgaengig button { flex: none; }

.fehler-leiste {
  position: fixed;
  top: 136px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blitz);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  z-index: 60;
  display: none;
  max-width: calc(100% - 32px);
}
.fehler-leiste.sichtbar { display: block; }

.leise { color: var(--text-leise); }
.versteckt { display: none !important; }

/* ---------------------------------------------------------------- Kopfzeile: Navigation, Menü */
.kopf a.nav { color: var(--text); text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rand); }
.kopf a.nav[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.kopf .zaehler, .chat-kontakt .zaehler {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 11px;
  background: var(--blitz); color: #fff; font-size: 13px; font-weight: 800; text-align: center;
}
.kopf .zaehler:empty, .kopf .zaehler[hidden] { display: none; }
.menue { position: fixed; top: 52px; right: 12px; z-index: 70; background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.menue[hidden] { display: none; }
.menue-kopf { padding: 6px 8px 10px; border-bottom: 1px solid var(--rand); }
.menue button { text-align: left; }

/* ---------------------------------------------------------------- Sprech-Anzeige („Pille“) */
.sprech-pille { position: fixed; left: 50%; top: 132px; transform: translateX(-50%); z-index: 80; display: none;
  align-items: center; gap: 12px; max-width: min(720px, calc(100% - 32px)); padding: 12px 20px; border-radius: 999px;
  background: #5b3fd6; color: #fff; font-weight: 600; font-size: 18px; box-shadow: 0 6px 24px rgba(0,0,0,.35); pointer-events: none; }
.sprech-pille.sichtbar { display: flex; }
.sprech-pille .punkt { width: 14px; height: 14px; border-radius: 50%; background: #fff; flex: none; animation: pochen 0.9s ease-in-out infinite alternate; }
.sprech-pille[data-zustand="fertig"] { background: var(--gruen); }
.sprech-pille[data-zustand="fertig"] .punkt, .sprech-pille[data-zustand="fehler"] .punkt { animation: none; }
.sprech-pille[data-zustand="fehler"] { background: var(--blitz); }
.sprech-pille .text { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@keyframes pochen { from { transform: scale(0.7); opacity: .6; } to { transform: scale(1.1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sprech-pille .punkt { animation: none; } }
button.hoert { background: #5b3fd6 !important; border-color: #5b3fd6 !important; color: #fff !important; }
button.ohne-sprache { opacity: .75; }

/* ---------------------------------------------------------------- Chat */
.chat-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 65; background: var(--flaeche);
  border-left: 1px solid var(--rand); box-shadow: -6px 0 24px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.chat-panel[hidden] { display: none; }
.chat-kopf { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--rand); }
.chat-kopf .chat-titel { flex: 1; font-size: 20px; }
.chat-kopf button { min-height: 48px; min-width: 48px; font-size: 20px; }
.chat-liste { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-liste[hidden], .chat-gespraech[hidden] { display: none; }
.chat-kontakt { display: flex; align-items: center; gap: 12px; text-align: left; font-weight: 400; min-height: 64px; }
.chat-kontakt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-kontakt-text .leise { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--rand); flex: none; }
.status-punkt.an { background: var(--gruen); }
.chat-leer { text-align: center; padding: 16px; }
.chat-gespraech { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-verlauf { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-blase { max-width: 85%; align-self: flex-start; background: var(--bg); border: 1px solid var(--rand); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; word-break: break-word; }
.chat-blase .chat-text { white-space: pre-wrap; }
.chat-blase.eigen { align-self: flex-end; background: var(--blau); border-color: var(--blau); color: #fff; border-radius: 14px 14px 4px 14px; }
.chat-von { font-size: 13px; font-weight: 800; color: var(--text-leise); }
.chat-zeit { font-size: 12px; opacity: .7; text-align: right; }
.chat-schnell { display: flex; gap: 6px; padding: 6px 10px; overflow-x: auto; border-top: 1px solid var(--rand); }
.chat-schnell button { min-height: 40px; padding: 4px 12px; border-radius: 20px; font-size: 15px; white-space: nowrap; }
.chat-eingabe { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 10px; border-top: 1px solid var(--rand); }
.chat-eingabe textarea { min-height: 56px; }
.chat-senden { background: var(--blau); border-color: var(--blau); color: #fff; }
.chat-hinweis { position: fixed; top: 60px; right: 16px; z-index: 66; display: none; flex-direction: column; align-items: flex-start; gap: 2px;
  max-width: min(380px, calc(100% - 32px)); text-align: left; background: var(--blau); color: #fff; border: none; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.chat-hinweis.sichtbar { display: flex; }
.chat-hinweis span { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media print { .chat-panel, .chat-hinweis, .menue, .sprech-pille { display: none !important; } }

/* Hinweis, wenn die Spracheingabe auf dem Gerät noch nicht eingerichtet ist */
.sprach-hilfe { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sprach-hilfe[hidden] { display: none; }
.sprach-hilfe .kasten { background: var(--flaeche); color: var(--text); border-radius: 16px; padding: 20px; max-width: 460px; font-size: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.sprach-hilfe .knoepfe { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.sprach-hilfe .los { display: inline-flex; align-items: center; min-height: 56px; padding: 0 18px; border-radius: 12px; background: var(--blau); color: #fff; font-weight: 800; text-decoration: none; }
