/* Leitstelle: Funkpult für einen großen Bildschirm (Entwurf A, drei Spalten).
   Farbwelt der Verwaltung: Tannengrün, LCD-Grün. Grün nur für Empfang,
   Rot nur für Senden und Notruf. Gruppen sind Kanaltasten mit LCD-Zeile. */

:root {
  --body: #17201c;          /* überschreibt ../style.css: Grund */
  --pult-flaeche: #202b26;
  --pult-flaeche-2: #26332d;
  --field: #121915;
  --line: #33423a;
  --text: #e3ebe5;
  --muted: #93a69a;
  --lcd: #c9dccb;
  --lcd-ink: #1a2e22;
  --lcd-dim: #6f8a78;
  --rx: #5cc285;
  --tx: #ec6a52;
  --leitstelle: #e3b341;
  /* Kreisfarben wie in der Verwaltung */
  --kreis-1: #6cc08b;
  --kreis-2: #e3b341;
  --kreis-3: #7fb2e5;
  --kreis-4: #e08aa8;
}

body { background: var(--body); }

.pult {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(440px, 1.9fr) minmax(300px, 1.2fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas:
    "kopf kopf kopf"
    "alarme alarme alarme"
    "gruppen mitte verlauf";
  gap: 14px 18px;
  height: 100vh;
  padding: 0 18px 14px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; color: inherit; }
.pult button { background: var(--pult-flaeche-2); border: 1px solid var(--line); border-radius: 7px; padding: 0.35rem 0.75rem; cursor: pointer; }
.pult button:hover:not(:disabled) { border-color: var(--muted); }
.pult button:disabled { opacity: 0.45; cursor: not-allowed; }
.pult :focus-visible { outline: 2px solid var(--lcd); outline-offset: 2px; }
.pult input, .pult select { background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 0.45rem 0.6rem; color: var(--text); font: inherit; min-width: 0; }
.pult input[type="checkbox"] { accent-color: var(--lcd); }

/* ---- Kopf: Platz links, Ziel-LCD in der Mitte, Person rechts ---- */
.kopf {
  grid-area: kopf;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 0 -18px;
  padding: 10px 18px;
  background: var(--pult-flaeche);
  border-bottom: 1px solid var(--line);
}
.kopf .platz { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kopf #who { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf .led { width: 10px; height: 10px; border-radius: 50%; background: #3c4b43; flex: none; }
.kopf .led.rx { background: var(--rx); box-shadow: 0 0 10px var(--rx); }
.kopf .led.tx { background: var(--tx); box-shadow: 0 0 10px var(--tx); }
.kopf .link { font-size: 0.82rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.6rem; white-space: nowrap; }
.kopf .link.up { color: var(--rx); border-color: color-mix(in srgb, var(--rx) 45%, transparent); }
.ziel-lcd {
  display: flex; align-items: baseline; gap: 0.6rem;
  background: var(--lcd); color: var(--lcd-ink); border-radius: 8px;
  padding: 0.3rem 1rem; min-width: 18rem; justify-content: center;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 0 0 1px rgb(0 0 0 / 0.2);
}
.ziel-lcd small { color: var(--lcd-dim); font-size: 0.78rem; }
.ziel-lcd #ziel-anzeige { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.kopf .person { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.kopf #person { color: var(--muted); }
.kopf #anmelden { background: var(--lcd); color: var(--lcd-ink); border-color: var(--lcd); font-weight: 650; }

/* ---- Notruf ---- */
.alarme { grid-area: alarme; display: grid; gap: 8px; }
.alarme:empty { display: none; }
.notruf-balken {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 10px;
  background: var(--tx); color: #fff; font-weight: 650; font-size: 1.05rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tx) 35%, transparent);
}
.notruf-balken .text { flex: 1; }
.notruf-balken .quittiert { font-weight: 450; font-size: 0.95rem; opacity: 0.92; }
.notruf-balken button { background: #fff; color: #7a1a0c; border: 0; border-radius: 7px; padding: 0.35rem 0.9rem; font-weight: 650; }
.notruf-balken button.gesehen { background: transparent; color: #fff; border: 1px solid rgb(255 255 255 / 0.7); }
@media (prefers-reduced-motion: no-preference) {
  .notruf-balken:has(.gesehen) { animation: notruf 1.2s ease-in-out infinite alternate; }
  @keyframes notruf { to { box-shadow: 0 0 0 8px color-mix(in srgb, var(--tx) 20%, transparent); } }
}

/* ---- Spalten ---- */
.spalte { min-height: 0; overflow: auto; }
.spalte h2 {
  font-size: 1rem; font-weight: 650; color: var(--text); letter-spacing: -0.01em;
  margin: 0 0 10px; display: flex; gap: 10px; align-items: center;
}
.gruppen { grid-area: gruppen; }
.mitte { grid-area: mitte; display: flex; flex-direction: column; }
.verlauf { grid-area: verlauf; display: flex; flex-direction: column; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0 0; }

/* ---- Gruppen als Kanaltasten ---- */
#gruppen { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#gruppen li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "name name knopf" "sprecher hoeren knopf";
  align-items: center;
  gap: 6px 10px;
  padding: 10px 10px 10px 14px;
  background: var(--pult-flaeche);
  border: 1px solid var(--line);
  border-left: 4px solid #3c4b43;
  border-radius: 10px;
}
#gruppen li.mit-kreis { border-left-color: var(--kreis); }
#gruppen li.gewaehlt { border-color: var(--lcd); }
#gruppen .kreis-marke {
  display: inline-block; margin-left: 0.5rem; padding: 0 0.5rem; border-radius: 999px;
  border: 1px solid var(--kreis); color: var(--kreis); font-size: 0.75rem; font-weight: 600; vertical-align: 0.1rem;
}
#gruppen .lampe { display: none; }
#gruppen .gname { grid-area: name; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#gruppen .gname small { color: var(--muted); font-weight: 500; margin-left: 0.35rem; }
#gruppen .sprecher {
  grid-area: sprecher;
  background: var(--field); color: var(--lcd-dim); border-radius: 6px;
  padding: 0.2rem 0.6rem; font-size: 0.9rem; min-height: 1.75rem; display: flex; align-items: center;
  box-shadow: inset 0 0 0 1px var(--line);
}
#gruppen .sprecher:empty::before { content: "frei"; }
#gruppen .hoeren-feld, #gruppen .fest { grid-area: hoeren; color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
#gruppen .sprechen {
  grid-area: knopf; align-self: stretch;
  min-width: 6.5rem; border-radius: 9px; font-weight: 650;
  background: linear-gradient(#34443c, #2a3832); border-color: #46594f;
  user-select: none; touch-action: none;
}
#gruppen .sprechen:active { background: var(--tx); border-color: var(--tx); color: #fff; }

/* Empfang: Taste grün, LCD-Zeile leuchtet mit dem Sprecher */
#gruppen li:has(.lampe.rx) { border-left-color: var(--rx); background: color-mix(in srgb, var(--rx) 9%, var(--pult-flaeche)); }
#gruppen li:has(.lampe.rx) .sprecher { background: var(--lcd); color: var(--lcd-ink); font-weight: 700; box-shadow: 0 0 12px color-mix(in srgb, var(--rx) 45%, transparent); }
/* Eigenes Senden: rot */
#gruppen li:has(.lampe.tx) { border-left-color: var(--tx); background: color-mix(in srgb, var(--tx) 10%, var(--pult-flaeche)); }
#gruppen li:has(.lampe.tx) .sprecher { background: var(--tx); color: #fff; font-weight: 700; }
#gruppen li:has(.lampe.tx) .sprechen { background: var(--tx); border-color: var(--tx); color: #fff; }
/* Notruf- und Leitstellen-Gruppen erkennt man am Namen; All Call als eigene Taste */
#gruppen li[data-tg="alle"] { border-left-color: var(--leitstelle); }

/* ---- Teilnehmer ---- */
.tabelle-box { background: var(--pult-flaeche); border: 1px solid var(--line); border-radius: 10px; overflow: auto; flex: 1; min-height: 0; }
table.teilnehmer { width: 100%; border-collapse: collapse; }
.teilnehmer th { position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 500; color: var(--muted); font-size: 0.82rem; padding: 0.5rem 0.7rem; background: var(--pult-flaeche-2); border-bottom: 1px solid var(--line); }
.teilnehmer td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.teilnehmer tr:last-child td { border-bottom: 0; }
.teilnehmer td.name { font-weight: 600; }
.teilnehmer td.name::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.55rem; background: #4a5a51; vertical-align: 0.05rem; }
.teilnehmer tr.online td.name::before { background: var(--rx); box-shadow: 0 0 6px color-mix(in srgb, var(--rx) 60%, transparent); }
.teilnehmer tr.offline td { color: var(--muted); }
.teilnehmer td:nth-child(2) { color: var(--muted); }
.teilnehmer tr.online .erreichbar { color: var(--rx); }
.teilnehmer td.status:not(:empty) span, .teilnehmer td.status:not(:empty) { color: var(--text); }
.teilnehmer .aktionen { white-space: nowrap; display: flex; gap: 4px; align-items: center; justify-content: flex-end; position: relative; }
.teilnehmer .aktionen button { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.teilnehmer button.ruf { user-select: none; touch-action: none; }
.teilnehmer button.ruf:active { background: var(--tx); border-color: var(--tx); color: #fff; }
.mehr summary { list-style: none; cursor: pointer; padding: 0.15rem 0.55rem; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); }
.mehr summary::-webkit-details-marker { display: none; }
.mehr[open] summary { border-color: var(--lcd); color: var(--text); }
.mehr .eingriffe {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5;
  display: grid; gap: 4px; padding: 6px; min-width: 11rem;
  background: var(--pult-flaeche-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
}
.mehr .eingriffe button { text-align: left; }
.mehr .e-sperren-ja { background: var(--tx); border-color: var(--tx); color: #fff; }

/* Nachricht und Status unten angedockt */
.senden-box { margin-top: 12px; padding: 12px; background: var(--pult-flaeche); border: 1px solid var(--line); border-radius: 10px; }
.nachricht { display: flex; gap: 8px; align-items: end; }
.nachricht label { display: grid; gap: 0.2rem; color: var(--muted); font-size: 0.8rem; }
.nachricht input { flex: 1; }
.nachricht button[type="submit"] { background: var(--lcd); color: var(--lcd-ink); border-color: var(--lcd); font-weight: 650; }
.status-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.status-knoepfe button { border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.88rem; }

/* ---- Verlauf als Zeitleiste ---- */
.verlauf-liste, .pult .log { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.verlauf-liste li {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.6rem; border-left: 3px solid transparent; border-radius: 0 6px 6px 0;
}
.verlauf-liste li + li { margin-top: 2px; }
.verlauf-liste time { color: var(--muted); }
.verlauf-liste li.art-ruf_beginn, .verlauf-liste li.art-ruf_ende { border-left-color: color-mix(in srgb, var(--rx) 70%, transparent); }
.verlauf-liste li.art-daten { border-left-color: var(--lcd-dim); }
.verlauf-liste li.art-anmeldung, .verlauf-liste li.art-abmeldung, .verlauf-liste li.art-verloren, .verlauf-liste li.art-abgelehnt { color: var(--muted); }
.verlauf-liste li.art-leitstelle { border-left-color: var(--leitstelle); background: color-mix(in srgb, var(--leitstelle) 8%, transparent); }
.verlauf-liste li.art-belegt, .verlauf-liste li.art-verdraengt { border-left-color: #8a7a4a; }
.verlauf-liste li.notruf { border-left-color: var(--tx); background: color-mix(in srgb, var(--tx) 14%, transparent); color: var(--text); font-weight: 650; }
#verlauf { flex: 1; overflow: auto; min-height: 120px; background: var(--pult-flaeche); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
#verlauf:empty { display: none; }
#verlauf-hinweis { background: var(--pult-flaeche); border: 1px dashed var(--line); border-radius: 10px; padding: 1rem; margin: 0; }
.pult .log li { padding: 0.25rem 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.pult .log time { margin-right: 6px; }
.meldungen { margin-top: 12px; }
.meldungen summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.meldungen .log { max-height: 26vh; overflow: auto; margin-top: 6px; }
button.klein { font-size: 0.8rem; padding: 0.15rem 0.6rem; }
#off { background: none !important; border: 0 !important; color: var(--muted); text-decoration: underline; margin-top: 8px; align-self: flex-start; }

/* ---- Dialoge ---- */
dialog { background: var(--pult-flaeche); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 420px; }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
dialog h2 { margin: 0 0 1rem; font-size: 1.15rem; }
dialog label { display: grid; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 0.85rem; }
dialog input, dialog select { background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 0.45rem 0.6rem; color: var(--text); font: inherit; }
dialog .primary { background: var(--lcd); color: var(--lcd-ink); border: 0; border-radius: 7px; padding: 0.5rem 1rem; font-weight: 650; cursor: pointer; }
dialog .quiet { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
dialog.suche { max-width: 820px; width: 92vw; }
dialog .filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
#such-ergebnis { max-height: 50vh; overflow: auto; margin-top: 12px; }

@media (max-width: 1000px) {
  .pult { grid-template-columns: 1fr; grid-template-areas: "kopf" "alarme" "gruppen" "mitte" "verlauf"; height: auto; }
  .kopf { grid-template-columns: 1fr; }
  .ziel-lcd { min-width: 0; }
  .kopf .person { justify-content: flex-start; }
}
