:root {
  --bg-1: #07151a;
  --bg-2: #0d2730;
  --panel: rgba(9, 29, 36, 0.86);
  --panel-strong: #0f323d;
  --text: #e6f3f7;
  --muted: #8cb7c4;
  --accent: #f2b134;
  --danger: #ff5f56;
  --ok: #58d68d;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 18% 12%, #154456 0%, transparent 34%),
              radial-gradient(circle at 87% 84%, #15373f 0%, transparent 32%),
              linear-gradient(140deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

h1, h2 {
  margin: 0;
  font-family: "Chakra Petch", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  font-size: clamp(1.6rem, 2.2vw, 2.4rem);
}

h2 {
  font-size: 1.1rem;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(140, 183, 196, 0.2);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

/* SimRESC-Wortmarke, exakt mittig im Grid-Mittelfeld -- unabhaengig davon,
   wie breit Titel links und Aktionen rechts sind. */
.topbar-logo {
  justify-self: center;
  height: 42px;
  width: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

/* Nur im Vollkarten-Modus sichtbar (dort ist der .topbar aus); schwebt dann
   mittig oben ueber der Karte, auf einer Hoehe mit den Aktions-Buttons. */
.overlay-logo {
  display: none;
}

body.overlay-focus-mode .overlay-logo {
  display: block;
  position: fixed;
  top: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  height: 46px;
  width: auto;
  z-index: 70;
  pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.6));
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
}

.topbar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-self: end;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 1rem;
}

.card {
  grid-column: span 4;
  background: var(--panel);
  border: 1px solid rgba(140, 183, 196, 0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  animation: fade-in 420ms ease both;
}

.card.wide {
  grid-column: span 8;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.row.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

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

input,
select,
textarea {
  border: 1px solid rgba(140, 183, 196, 0.25);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 10px;
  padding: 0.56rem 0.62rem;
}

textarea {
  resize: vertical;
}

.btn {
  border: none;
  background: var(--accent);
  color: #18232a;
  font-weight: 700;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn.secondary {
  background: #6cc3dd;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(140, 183, 196, 0.4);
  color: var(--text);
}

.badge,
.status-dot {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(140, 183, 196, 0.3);
  border-radius: 999px;
  color: var(--muted);
}

.badge.bridge-online  { color: #4caf7d; border-color: #4caf7d55; }
.badge.bridge-offline { color: var(--muted); border-color: rgba(140,183,196,0.3); }
.badge.bridge-error   { color: #e05c5c; border-color: #e05c5c55; }

.hint {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.fleet-water-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(108, 195, 221, 0.45);
  color: #8fe0f1;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.alarm-category-group {
  border: 1px solid rgba(140, 183, 196, 0.25);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.7rem;
}

.alarm-category-group legend {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0 0.3rem;
}

.alarm-check-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--text);
}

.alarm-check-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.alarm-resource-tabs {
  border: 1px solid rgba(140, 183, 196, 0.2);
  border-radius: 10px;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: rgba(0, 0, 0, 0.14);
}

.alarm-plan-hint {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(242, 177, 52, 0.22);
  background: rgba(242, 177, 52, 0.08);
  margin-bottom: 0.6rem;
}

.alarm-sequence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.alarm-sequence-chip {
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(108, 195, 221, 0.3);
  background: rgba(108, 195, 221, 0.1);
  color: var(--text);
  font-size: 0.8rem;
}

.alarm-multi-select {
  min-height: 9rem;
}

.alarm-tab-panel {
  margin-bottom: 0.6rem;
}

.btn.active-tab {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(242, 177, 52, 0.38);
}

body.overlay-focus-mode {
  overflow: hidden;
  background: linear-gradient(135deg, #03090f, #071821 52%, #0a2430);
}

body.overlay-focus-mode .topbar {
  display: none;
}

body.overlay-focus-mode .layout {
  display: block;
  padding: 0;
  height: 100vh;
}

body.overlay-focus-mode .layout > .card {
  display: none;
}

body.overlay-focus-mode #mapPanel {
  display: block;
}

body.overlay-focus-mode #mapPanel {
  position: fixed;
  inset: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
  z-index: 1;
}

body.overlay-focus-mode #mapPanel .card-head,
body.overlay-focus-mode #mapPanel .row {
  display: none;
}

body.overlay-focus-mode #dispatchLauncherBtn {
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 70;
  min-width: 220px;
  border: 1px solid rgba(108, 195, 221, 0.45);
  background: rgba(8, 30, 40, 0.92);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

body.overlay-focus-mode #dispatchLauncherBtn:hover {
  background: rgba(12, 40, 53, 0.95);
}

/* Launcher-Zeile: "Einsatz generieren" + "Laufende Einsätze" nebeneinander.
   Die Zeile ist jetzt der fixierte Container; der Button selbst nicht mehr. */
body.overlay-focus-mode .launcher-row {
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 70;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
body.overlay-focus-mode .launcher-row #dispatchLauncherBtn {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
}
body.overlay-focus-mode .launcher-row .btn {
  min-width: 200px;
  border: 1px solid rgba(108, 195, 221, 0.45);
  background: rgba(8, 30, 40, 0.92);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
body.overlay-focus-mode .launcher-row .btn:hover {
  background: rgba(12, 40, 53, 0.95);
}
#runningIncidentsBtn .badge {
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}

/* "Laufende Einsätze"-Panel (blendet unter der Launcher-Zeile ein) */
body.overlay-focus-mode #runningIncidentsPanel.running-incidents-panel {
  position: fixed;
  top: 3.6rem;
  left: 0.9rem;
  z-index: 69;
  width: min(360px, calc(100vw - 1.8rem));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
}
body.overlay-focus-mode #runningIncidentsPanel.is-hidden {
  display: none;
}
.running-incidents-panel .list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.running-incident-item {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(108, 195, 221, 0.2);
  border-radius: 8px;
  background: rgba(5, 20, 28, 0.5);
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.running-incident-item:hover {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(37, 99, 235, 0.5);
}
.running-incident-item .primary {
  font-weight: 700;
}
.running-incident-item .secondary {
  font-size: 0.78rem;
  opacity: 0.78;
}

/* Doppelklick-Popup "Einsatz hier erstellen" -- dunkles Blau statt des hellen
   Leaflet-Standards, passend zu den übrigen Panels. */
.map-create-incident-popup .leaflet-popup-content-wrapper {
  background: rgba(8, 30, 40, 0.97);
  color: var(--text);
  border: 1px solid rgba(108, 195, 221, 0.45);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.map-create-incident-popup .leaflet-popup-tip {
  background: rgba(8, 30, 40, 0.97);
  border: 1px solid rgba(108, 195, 221, 0.45);
  box-shadow: none;
}
.map-create-incident-popup .leaflet-popup-content {
  margin: 0;
}
.map-create-incident-popup a.leaflet-popup-close-button {
  color: rgba(255, 255, 255, 0.65);
}
.map-create-incident-popup a.leaflet-popup-close-button:hover {
  color: #fff;
}
.map-create-incident-btn {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font: 700 0.92rem/1.2 inherit;
  white-space: nowrap;
  cursor: pointer;
}
.map-create-incident-btn:hover {
  background: #1d4ed8;
}

/* Aufklappbarer Server-Einsatz-Kasten auf der Karte. Klick auf das Label
   klappt den Kasten nach unten auf (Fahrzeuge + "Einsatz öffnen"). */
.incident-box {
  position: relative;
  display: inline-block;
  background: rgba(8, 30, 40, 0.95);
  color: #fff;
  border: 1px solid rgba(108, 195, 221, 0.45);
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  font: 700 12px/15px system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
}
.incident-box-corner {
  position: absolute;
  top: 0;
  left: 0;
  border-top: 9px solid rgba(108, 195, 221, 0.9);
  border-right: 9px solid transparent;
  border-top-left-radius: 5px;
}
.incident-box-label {
  padding: 3px 10px 3px 12px;
  cursor: pointer;
}
/* Aufklapp-Bereich: per max-height animiert (0 -> auf). */
.incident-box-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.incident-box.expanded .incident-box-detail {
  max-height: 140px;
}
.incident-box-veh {
  padding: 5px 10px 3px 12px;
  font-weight: 600;
  font-size: 11px;
  opacity: 0.9;
  border-top: 1px solid rgba(108, 195, 221, 0.25);
}
.incident-box-actions {
  display: flex;
  gap: 6px;
  margin: 4px 8px 8px;
}
.incident-box-open,
.incident-box-close {
  flex: 1;
  padding: 5px 8px;
  border: none;
  border-radius: 6px;
  font: 700 11px/1.2 inherit;
  cursor: pointer;
  white-space: nowrap;
  color: #fff;
}
.incident-box-open { background: #2563eb; }
.incident-box-open:hover { background: #1d4ed8; }
.incident-box-close { background: rgba(220, 38, 38, 0.85); }
.incident-box-close:hover { background: #dc2626; }

/* Alarmierte Fahrzeuge im Bearbeiten-Modus (entfernbare Chips) */
.edit-assigned-vehicles {
  margin: 0.2rem 0 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.1);
}
.edit-assigned-vehicles.is-hidden { display: none; }
.edit-assigned-vehicles .edit-assigned-head { font-weight: 700; margin-bottom: 0.4rem; }
.edit-assigned-vehicles .assigned-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.assigned-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.3rem 0.2rem 0.6rem;
  background: rgba(8, 30, 40, 0.85);
  border: 1px solid rgba(108, 195, 221, 0.35);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.assigned-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}
.assigned-chip-remove:hover { background: #dc2626; }

body.overlay-focus-mode .map-style-tabs {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 40;
  margin: 0;
  padding: 0.48rem;
  border-radius: 12px;
  background: rgba(5, 20, 28, 0.62);
  border: 1px solid rgba(108, 195, 221, 0.24);
  backdrop-filter: blur(3px);
}

body.overlay-focus-mode #map {
  width: 100%;
  height: 100vh;
  margin: 0;
  border-radius: 0;
}

body.overlay-focus-mode #dispatchPanel {
  position: fixed;
  /* Startet UNTER der Menü-Zeile ("Einsatz generieren"/"Laufende Einsätze"),
     damit es diese nicht mehr überlappt. */
  top: 4rem;
  left: 1rem;
  z-index: 65;
  /* Breit genug, dass Katalog + zweispaltige Zeilen ohne seitliche Scrollbar
     und ohne Abschneiden hineinpassen (vorher 760px -> Inhalt lief über). */
  width: min(880px, calc(100vw - 2rem));
  max-height: calc(100vh - 5rem);
  overflow: hidden;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(6, 20, 28, 0.97), rgba(8, 26, 34, 0.95));
  border: 1px solid rgba(108, 195, 221, 0.26);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.5);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}

body.overlay-focus-mode #dispatchPanel .card-head {
  margin: 0 0 0.8rem;
}

body.overlay-focus-mode .dispatch-head-actions {
  margin: 0;
  gap: 0.45rem;
}

body.overlay-focus-mode .dispatch-panel-body {
  max-height: calc(100vh - 9rem);
  overflow-y: auto;
  /* overflow-y:auto zwingt overflow-x sonst automatisch auf auto -> seitliche
     Scrollbar. Explizit ausblenden; der Inhalt passt sich unten per min-width an. */
  overflow-x: hidden;
  padding-right: 0.2rem;
}

body.overlay-focus-mode .dispatch-incident-manager {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(108, 195, 221, 0.16);
}

body.overlay-focus-mode .dispatch-subhead {
  margin-bottom: 0.55rem;
}

body.overlay-focus-mode.dispatch-panel-hidden #dispatchPanel {
  display: none;
}

body.overlay-focus-mode.dispatch-panel-open #dispatchPanel,
body.overlay-focus-mode.dispatch-panel-minimized #dispatchPanel {
  display: block;
}

body.overlay-focus-mode.dispatch-panel-minimized #dispatchPanel {
  width: min(420px, calc(100vw - 2rem));
  max-height: none;
}

body.overlay-focus-mode.dispatch-panel-minimized .dispatch-panel-body {
  display: none;
}

body.overlay-focus-mode.dispatch-panel-minimized #dispatchPanel .card-head {
  margin-bottom: 0;
}

.list li.clickable-entry.is-selected {
  border-color: rgba(242, 177, 52, 0.75);
  background: rgba(242, 177, 52, 0.12);
}

@media (max-width: 980px) {
  body.overlay-focus-mode #dispatchLauncherBtn {
    top: 0.7rem;
    left: 0.7rem;
    right: 0.7rem;
    min-width: 0;
  }

  body.overlay-focus-mode #dispatchPanel {
    top: 3.8rem;
    left: 0.7rem;
    right: 0.7rem;
    width: auto;
    max-height: calc(100vh - 4.5rem);
  }

  body.overlay-focus-mode.dispatch-panel-minimized #dispatchPanel {
    width: auto;
  }
}

.leaflet-popup-content-wrapper {
  background: linear-gradient(180deg, #0a1d27 0%, #07161f 100%);
  color: var(--text);
  border: 1px solid rgba(108, 195, 221, 0.32);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  color: var(--text);
}

.leaflet-popup-tip {
  background: #07161f;
}

.leaflet-control-layers {
  background: #081722;
  color: var(--text);
  border: 1px solid rgba(108, 195, 221, 0.35);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
  opacity: 1;
  border-radius: 14px;
}

.leaflet-control-layers-expanded {
  padding: 0.55rem 0.65rem;
  min-width: 220px;
}

.leaflet-control-layers label {
  color: var(--text);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0;
}

.leaflet-control-layers-toggle {
  width: 42px;
  height: 42px;
  background-size: 22px 22px;
  background-position: center;
  background-repeat: no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d8ecf2' d='M4 7h16v2H4zm0 5h16v2H4zm0 5h16v2H4z'/%3E%3C/svg%3E");
}

.leaflet-control-layers-list {
  margin-top: 0.25rem;
}

.leaflet-control-layers-selector {
  accent-color: #6cc3dd;
}

.modal-dialog {
  border: none;
  padding: 0;
  background: transparent;
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: min(640px, calc(100vw - 1.5rem));
  width: min(640px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  color: var(--text);
  z-index: 1200;
}

.modal-dialog::backdrop {
  background: rgba(2, 10, 13, 0.76);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: linear-gradient(180deg, rgba(12, 38, 46, 0.98), rgba(7, 21, 26, 0.98));
  border: 1px solid rgba(140, 183, 196, 0.28);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
  padding: 1rem;
}

.modal-card .card-head {
  margin-bottom: 1rem;
}

.modal-card .alarm-resource-tabs {
  max-height: 260px;
  overflow: auto;
}

.modal-card .list {
  max-height: 180px;
}

.modal-card .row:last-child {
  margin-bottom: 0;
}

.modal-card .row.compact {
  align-items: center;
}

.modal-card .hint {
  margin: 0;
}

.keyword-catalog {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.keyword-catalog-col {
  border: 1px solid rgba(140, 183, 196, 0.22);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.7rem;
  min-height: 220px;
  /* Grid-Spalten dürfen unter ihre Inhaltsbreite schrumpfen, sonst läuft der
     Katalog über den Panel-Rand hinaus (seitliche Scrollbar). */
  min-width: 0;
}

.keyword-search-row {
  margin-bottom: 0.6rem;
}

.keyword-search-row label {
  width: 100%;
}

.keyword-favorite-head {
  margin-top: 0.7rem;
}

.keyword-favorite-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  min-height: 2rem;
}

.keyword-favorite-chip {
  border: 1px solid rgba(242, 177, 52, 0.5);
  background: rgba(242, 177, 52, 0.12);
  color: var(--text);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.keyword-favorite-chip:hover {
  filter: brightness(1.08);
}

.keyword-favorite-empty {
  color: var(--muted);
  font-size: 0.84rem;
  padding: 0.2rem 0;
}

.keyword-catalog-head {
  font-family: "Chakra Petch", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.8rem;
  margin-bottom: 0.55rem;
}

.keyword-group-list,
.keyword-detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keyword-group-btn,
.keyword-detail-btn {
  border: 1px solid rgba(140, 183, 196, 0.3);
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.keyword-group-btn {
  width: 100%;
}

.keyword-detail-btn {
  flex: 1 1 220px;
}

.keyword-detail-item {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}

.keyword-star-btn {
  flex: 0 0 auto;
  min-width: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(140, 183, 196, 0.3);
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  border-radius: 12px;
  cursor: pointer;
}

.keyword-star-btn.active {
  color: var(--accent);
  border-color: rgba(242, 177, 52, 0.7);
  background: rgba(242, 177, 52, 0.1);
}

.keyword-star-btn:hover {
  color: var(--accent);
}

.keyword-group-btn:hover,
.keyword-detail-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108, 195, 221, 0.75);
}

.keyword-group-btn.active,
.keyword-detail-btn.active {
  border-color: var(--accent);
  background: rgba(242, 177, 52, 0.12);
  box-shadow: inset 0 0 0 1px rgba(242, 177, 52, 0.3);
}

.keyword-btn-title {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.keyword-btn-meta {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--muted);
}

#map.map-pick-active {
  cursor: crosshair;
}

#map.map-pick-active .leaflet-container {
  cursor: crosshair;
}

.log,
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow: auto;
}

.log li,
.list li {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(140, 183, 196, 0.16);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
}

.list li.clickable-entry {
  cursor: pointer;
}

.list li.clickable-entry:hover,
.list li.clickable-entry:focus-visible {
  border-color: rgba(108, 195, 221, 0.7);
  background: rgba(108, 195, 221, 0.12);
  outline: none;
}

.primary {
  color: var(--text);
}

.secondary-line {
  color: var(--muted);
  font-size: 0.82rem;
}

.list-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.btn-small {
  background: rgba(108, 195, 221, 0.2);
  border: 1px solid rgba(108, 195, 221, 0.5);
  color: #6cc3dd;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: rgba(108, 195, 221, 0.4);
  border-color: #6cc3dd;
}

#map {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  margin-bottom: 0.7rem;
}

#map.map-theme-dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) saturate(0.7) brightness(0.82) contrast(1.08);
}

.map-style-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.map-style-tab {
  border: 1px solid rgba(140, 183, 196, 0.35);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.map-style-tab.active {
  border-color: rgba(242, 177, 52, 0.82);
  color: #ffe1a4;
  background: rgba(242, 177, 52, 0.16);
}

.map-style-tabs {
  display: none !important;
}

.pager-preview {
  margin-top: 0.6rem;
  border-radius: 12px;
  border: 1px dashed rgba(140, 183, 196, 0.4);
  padding: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.pager-classic .pager-preview {
  background: rgba(242, 177, 52, 0.2);
}

body.pager-nightops .pager-preview {
  background: rgba(108, 195, 221, 0.2);
}

body.pager-highcontrast .pager-preview {
  background: #ffffff;
  color: #000000;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .card,
  .card.wide {
    grid-column: span 6;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .topbar-logo {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 34px;
    justify-self: center;
    margin-top: 0.4rem;
  }

  .card,
  .card.wide {
    grid-column: span 12;
  }

  .row {
    grid-template-columns: 1fr;
  }
}

/* ── Anmelde-Sperre ─────────────────────────────────────────────────────
   Liegt ueber der gesamten Leitstelle, bis eine SimRESC-Anmeldung steht.
   Wichtig: die [hidden]-Regel muss NACH .login-overlay stehen und gleich
   spezifisch sein, sonst gewinnt das display:flex und der Dialog bliebe
   sichtbar, obwohl das hidden-Attribut gesetzt ist. */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 10, 18, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-overlay[hidden] {
  display: none;
}

.login-dialog {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px;
  border-radius: 14px;
  background: var(--card, #131a26);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.login-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

.login-dialog h2 {
  margin: 0;
  font-size: 1.4rem;
}

.login-hint {
  margin: 0 0 4px;
  font-size: 0.85rem;
  opacity: 0.75;
}

.login-dialog label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
}

.login-advanced summary {
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.7;
}

.login-advanced input {
  margin-top: 6px;
  width: 100%;
}

.login-error {
  margin: 0;
  font-size: 0.85rem;
  color: #fca5a5;
}

.login-error[hidden] {
  display: none;
}

.login-dialog .btn {
  margin-top: 4px;
  padding: 10px;
  font-size: 0.95rem;
}

/* Funkstatus 5 (Sprechwunsch) blinkt auf dem Fahrzeugmarker zwischen Rot und
   Dunkelgrau. Als Keyframe-Animation, weil der Marker sein HTML per divIcon
   erzeugt und dort keine Animation inline moeglich ist. */
@keyframes vehStatusBlink {
  0%, 49%   { background: #dc2626; }
  50%, 100% { background: #374151; }
}
.veh-status-blink {
  animation: vehStatusBlink 1s steps(1, end) infinite;
}
