:root {
  --red: #8b1a1a;
  --red-dark: #6b1212;
  --red-light: #b91c1c;
  --bg: #1a1a2e;
  --panel: #fff;
  --panel-soft: #f4f4f6;
  --text: #1f2937;
  --text-soft: #6b7280;
  --border: rgba(0, 0, 0, 0.08);
  --green: #16a34a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  --topbar-h: 56px;
  --panel-w: 300px;
}

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

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.hidden { display: none !important; }

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--red);
  color: #fff;
}

.btn:hover { background: var(--red-light); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-soft {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-primary { background: var(--green); }
.btn-primary:hover { background: #15803d; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-full { width: 100%; }
.btn-icon {
  appearance: none;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-soft);
}

.hint {
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* Auth / Login page */
.auth-body {
  overflow: auto;
  min-height: 100%;
}

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(139, 26, 26, 0.35), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(22, 163, 74, 0.12), transparent 50%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 16px;
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-logo {
  display: inline-block;
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.auth-header h1 {
  margin: 0 0 0.5rem;
  color: var(--red);
  font-size: 1.65rem;
}

.auth-lead {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.85rem;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-guest-link {
  text-align: center;
  text-decoration: none;
  display: block;
}

.auth-hint {
  text-align: center;
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.auth-logged-in {
  text-align: center;
}

.auth-logged-in .btn {
  margin-top: 0.65rem;
}

/* Setup */
.setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(26, 26, 46, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}

.setup-panel {
  width: min(720px, 100%);
  background: var(--panel);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.setup-panel h1 {
  margin: 0 0 0.35rem;
  color: var(--red);
}

.setup-lead {
  margin: 0 0 1rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.setup-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.setup-search-row input {
  flex: 1 1 180px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.setup-map {
  height: 280px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--border);
  background: #e5e7eb;
}

.setup-map .leaflet-container {
  height: 100%;
  width: 100%;
}

.setup-location {
  font-weight: 600;
  margin: 0;
}

.setup-auth-link {
  text-align: center;
  margin: 0.85rem 0 0;
}

.setup-auth-link a {
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
}

.setup-auth-link a:hover {
  text-decoration: underline;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 120px;
  overflow: auto;
}

.search-result {
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

.search-result:hover { background: var(--panel-soft); }
.search-result.is-picked {
  border-color: var(--green);
  background: #ecfdf5;
  font-weight: 600;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0.75rem;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 140px;
}

.brand-icon { font-size: 1.4rem; }

.topbar-sub {
  display: block;
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 400;
}

.topbar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
}

.topbar-stat {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  opacity: 0.9;
}

.topbar-stat strong {
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.account-sync-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #86efac;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.account-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.account-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  padding: 0.45rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}

.account-tab.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 600;
}

.topbar .btn-soft {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Layout — Karte vollflächig, Fenster schweben darüber (LS-Stil) */
.game-layout {
  position: fixed;
  inset: var(--topbar-h) 0 0;
}

.map-root {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.float-panel {
  position: fixed;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 220px;
}

.float-panel--float {
  max-width: min(520px, calc(100vw - 16px));
}

.float-panel--dock-left {
  border-radius: 0 10px 10px 0;
  border-left: none;
}

.float-panel--dock-right {
  border-radius: 10px 0 0 10px;
  border-right: none;
}

.float-panel--dock-bottom {
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  max-width: none;
}

.float-panel.is-dragging,
.float-panel.is-resizing {
  opacity: 0.97;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.float-panel-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 2;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, rgba(139, 26, 26, 0.35) 50%);
  border-radius: 0 0 8px 0;
}

.float-panel--dock-left .float-panel-resize,
.float-panel--dock-right .float-panel-resize {
  cursor: ew-resize;
  background: linear-gradient(135deg, transparent 40%, rgba(139, 26, 26, 0.35) 40%);
}

.float-panel--dock-bottom .float-panel-resize {
  cursor: ns-resize;
  background: linear-gradient(135deg, transparent 40%, rgba(139, 26, 26, 0.35) 40%);
}

.float-dock-guides {
  position: fixed;
  inset: 0;
  z-index: 450;
  pointer-events: none;
}

.float-dock-guides.hidden {
  display: none;
}

.float-dock-guide {
  position: absolute;
  background: rgba(22, 163, 74, 0.18);
  border: 2px dashed rgba(22, 163, 74, 0.55);
  opacity: 0;
  transition: opacity 0.12s;
}

.float-dock-guide.is-active {
  opacity: 1;
}

.float-dock-guide--left {
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: 48px;
}

.float-dock-guide--right {
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 48px;
}

.float-dock-guide--bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
}

.float-panel.is-dragging {
  opacity: 0.95;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.float-panel-drag {
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.float-panel.is-dragging .float-panel-drag {
  cursor: grabbing;
}

.float-panel-grip {
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1;
  margin-right: 0.35rem;
  opacity: 0.55;
}

.panel {
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.panel--right { border-right: none; border-left: 1px solid var(--border); }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  flex: 1;
}

.float-panel .panel-body,
.float-panel .radio-list {
  flex: 1;
  min-height: 0;
}

.float-panel .filter-bar {
  flex-shrink: 0;
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
}

.panel-empty {
  padding: 1rem 0.5rem;
  color: var(--text-soft);
  font-size: 0.85rem;
  text-align: center;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.filter-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.filter-btn.is-active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* Missions */
.mission-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  margin-bottom: 0.5rem;
  background: #fff;
}

.mission-card--selected {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(139, 26, 26, 0.15);
}

.mission-card-head {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.mission-icon { font-size: 1.4rem; }

.mission-reward {
  display: block;
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 600;
}

.mission-req,
.mission-ok {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.mission-ok { color: var(--green); font-weight: 600; }

.mission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.chip {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: var(--panel-soft);
  border-radius: 999px;
  font-size: 0.72rem;
  margin-right: 0.25rem;
}

/* Buildings */
.building-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.45rem;
}

.building-row-icon { font-size: 1.3rem; }

.building-row-body {
  flex: 1;
  min-width: 0;
}

.building-row-body strong {
  display: block;
  font-size: 0.85rem;
}

.building-row-meta {
  font-size: 0.72rem;
  color: var(--text-soft);
}

/* Building detail drawer */
.building-detail {
  position: fixed;
  top: calc(var(--topbar-h) + 0.5rem);
  right: 0.75rem;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: calc(100vh - var(--topbar-h) - 1rem);
  overflow: auto;
  z-index: 600;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.85rem;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-head h2 {
  margin: 0;
  font-size: 1rem;
}

.detail-type {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.detail-stats {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.detail-stats li {
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}

.detail-stats span {
  display: block;
  color: var(--text-soft);
}

.detail-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.detail-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.detail-tab.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.vehicle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.vehicle-table th,
.vehicle-table td {
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.fms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
}

.fms--2 { background: #dcfce7; color: #166534; }
.fms--1 { background: #dbeafe; color: #1e40af; }
.fms--7 { background: #fef3c7; color: #92400e; }

.extension-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.extension-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.extension-item p {
  margin: 0.2rem 0 0;
  color: var(--text-soft);
  font-size: 0.75rem;
}

.badge {
  background: #dcfce7;
  color: #166534;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.detail-upgrade {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.modal-card--wide { width: min(720px, 100%); }

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

.modal-head h2 { margin: 0; font-size: 1.05rem; }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.field input,
.field select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.field--check {
  flex-direction: row;
  align-items: center;
}

.build-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.build-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.build-type-card.is-picked { border-color: var(--red); background: #fef2f2; }
.build-type-card--disabled { opacity: 0.5; cursor: not-allowed; }

.build-type-icon { font-size: 1.6rem; }

.vehicle-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.vehicle-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
}

.vehicle-card-head { font-size: 0.95rem; }
.vehicle-card-sub { margin: 0.2rem 0; font-size: 0.75rem; color: var(--text-soft); }

.vehicle-stats {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.login-ladder {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-day {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.login-day--done { background: #dcfce7; }
.login-day--current { background: #fef9c3; border-color: #eab308; }
.login-day--locked { opacity: 0.65; }

.login-day-num { font-weight: 600; font-size: 0.85rem; }

/* Map markers */
.map-marker {
  background: none !important;
  border: none !important;
}

.map-marker-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.map-marker--mission .map-marker-emoji {
  animation: pulse 1.5s infinite;
}

.map-marker--moving .map-marker-emoji {
  /* Kein Bounce — Position wird per rAF interpoliert */
}

.map-marker--moving .vehicle-graphic-emoji,
.map-marker--moving .vehicle-graphic-img {
  /* Kein Wackeln während der Fahrt */
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 9000;
  background: #111827;
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: transform 0.25s ease;
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast--show { transform: translateX(-50%) translateY(0); }
.toast--success { background: #166534; }
.toast--error { background: #991b1b; }

/* Responsive */
@media (max-width: 900px) {
  :root { --panel-w: 240px; }

  .topbar-stats .topbar-stat:nth-child(n+3) { display: none; }
}

@media (max-width: 720px) {
  .building-detail {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
  }
}

.leaflet-control-attribution {
  font-size: 0.65rem;
}

/* Einsatzliste (LS-Stil) */
.mission-card-ls {
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #f8f8f8, #ececec);
}

.mission-card-ls-inner {
  display: flex;
  border-left: 5px solid #dc2626;
}

.mission-status--open .mission-card-ls-inner { border-left-color: #dc2626; }
.mission-status--enroute .mission-card-ls-inner { border-left-color: #eab308; }
.mission-status--working .mission-card-ls-inner { border-left-color: #16a34a; }

.mission-status--open .mission-alarm-btn { background: #fecaca; }
.mission-status--enroute .mission-alarm-btn { background: #fef08a; }
.mission-status--working .mission-alarm-btn { background: #bbf7d0; }

.mission-card-ls-icon--fire { filter: none; }
.mission-card-ls-icon--medical { filter: none; }
.mission-card-ls-icon--police { filter: none; }

.mission-alarm-btn {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border: none;
  background: #e5e7eb;
  padding: 0.5rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}

.mission-alarm-btn:hover { background: #d1d5db; }

.mission-card-ls-body {
  flex: 1;
  padding: 0.45rem 0.55rem 0.5rem;
  min-width: 0;
}

.mission-card-ls-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mission-card-ls-title strong {
  font-size: 0.85rem;
  color: #1d4ed8;
}

.mission-card-ls-address,
.mission-card-ls-patient {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: #1d4ed8;
  line-height: 1.35;
}

.mission-card-ls-patient {
  color: var(--text);
  font-weight: 600;
}

.mission-progress {
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.mission-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.mission-status--open .mission-progress-fill {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
}

.mission-status--enroute .mission-progress-fill {
  background: linear-gradient(90deg, #ca8a04, #eab308);
}

.mission-status--working .mission-progress-fill {
  background: linear-gradient(90deg, #15803d, #22c55e);
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 3px,
      rgba(255, 255, 255, 0.22) 3px,
      rgba(255, 255, 255, 0.22) 6px
    ),
    linear-gradient(90deg, #15803d, #22c55e);
}

/* Alarm-Modal */
.modal--alarm {
  padding: 0;
  align-items: stretch;
}

.alarm-shell {
  width: min(1100px, 100%);
  height: min(92vh, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0;
  overflow: hidden;
}

.alarm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #2d2d2d, #1a1a1a);
  color: #fff;
}

.alarm-breadcrumb {
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.7;
}

.alarm-header h2 {
  margin: 0.15rem 0;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.alarm-address {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.9;
}

.alarm-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alarm-reward {
  font-weight: 700;
  color: #86efac;
}

.btn-icon--light { color: #fff; }

.alarm-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  min-height: 0;
}

.alarm-side {
  padding: 0.75rem;
  border-right: 1px solid var(--border);
  overflow: auto;
  font-size: 0.82rem;
}

.alarm-side h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
}

.alarm-patient {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 0.55rem;
  margin-bottom: 0.5rem;
}

.alarm-patient-name {
  font-weight: 700;
  font-size: 1rem;
  margin: 0.25rem 0;
}

.alarm-req-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
}

.alarm-mission-info {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.alarm-info-block {
  background: #374151;
  color: #f9fafb;
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.78rem;
}

.alarm-info-title {
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #1f2937;
  border-bottom: 1px solid #4b5563;
}

.alarm-info-table {
  width: 100%;
  border-collapse: collapse;
}

.alarm-info-table th,
.alarm-info-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid #4b5563;
  text-align: left;
  vertical-align: top;
}

.alarm-info-table tr:last-child th,
.alarm-info-table tr:last-child td {
  border-bottom: none;
}

.alarm-info-table th {
  width: 55%;
  font-weight: 500;
  color: #d1d5db;
}

.alarm-info-table td {
  color: #fff;
  font-weight: 600;
}

.alarm-distance {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.dist-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  font-size: 0.68rem;
  cursor: pointer;
}

.dist-btn.is-active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.alarm-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.65rem;
}

.alarm-main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.alarm-main-head h3 { margin: 0; font-size: 0.95rem; }

.alarm-main-actions { display: flex; gap: 0.35rem; }

.alarm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.alarm-tab {
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  border-radius: 4px;
}

.alarm-tab.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.alarm-table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.alarm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.alarm-table th,
.alarm-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.alarm-table th {
  background: #f3f4f6;
  position: sticky;
  top: 0;
}

.alarm-table small {
  display: block;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.alarm-table .row--assigned { opacity: 0.55; }

.fms--3 { background: #fef9c3; color: #854d0e; }
.fms--4 { background: #fee2e2; color: #991b1b; }
.fms--8 { background: #e0e7ff; color: #3730a3; }

/* Karte — LS-Stil Marker */
.station-pin {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.station-pin--fire { background: #dc2626; }
.station-pin--medical { background: #16a34a; }
.station-pin--police { background: #1d4ed8; }
.station-pin--leitstelle { background: #4b5563; }

.mission-pin-wrap {
  position: relative;
  width: 32px;
  height: 36px;
}

.mission-pin-triangle {
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 24px solid #dc2626;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.mission-pin-wrap--open .mission-pin-triangle { border-bottom-color: #dc2626; }
.mission-pin-wrap--enroute .mission-pin-triangle { border-bottom-color: #eab308; }
.mission-pin-wrap--working .mission-pin-triangle { border-bottom-color: #16a34a; }

.mission-pin-wrap--fire .mission-pin-triangle { border-bottom-color: #dc2626; }
.mission-pin-wrap--medical .mission-pin-triangle { border-bottom-color: #ca8a04; }
.mission-pin-wrap--police .mission-pin-triangle { border-bottom-color: #2563eb; }

.mission-pin-icon {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  font-size: 0.8rem;
  line-height: 1;
  pointer-events: none;
}

.vehicle-pin-ls {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.vehicle-pin-ls-top {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.vehicle-fms-badge {
  font-size: 0.62rem;
  font-weight: 800;
  min-width: 1.1rem;
  text-align: center;
  padding: 0.05rem 0.2rem;
  border-radius: 2px;
  background: #fef08a;
  border: 1px solid #ca8a04;
  color: #713f12;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.fms-badge--1 { background: #dbeafe; border-color: #2563eb; color: #1e40af; }
.fms-badge--7 { background: #fef3c7; border-color: #d97706; color: #92400e; }
.fms-badge--4 { background: #fecaca; border-color: #dc2626; color: #991b1b; }
.fms-badge--8 { background: #e0e7ff; border-color: #4f46e5; color: #3730a3; }

.vehicle-graphic-emoji {
  display: block;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  user-select: none;
}

.vehicle-graphic-img {
  display: block;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}


.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0 0.75rem;
}

.settings-subhead {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.vehicle-graphics-grid {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}

.vehicle-graphics-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
}

.vehicle-graphics-preview {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.vehicle-graphics-preview-emoji {
  font-size: 2rem;
  line-height: 1;
}

.vehicle-graphics-preview-img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

.vehicle-graphics-body {
  flex: 1;
  min-width: 0;
}

.vehicle-graphics-body strong {
  display: block;
  font-size: 0.85rem;
}

.vehicle-graphics-body .field {
  margin-top: 0.35rem;
}

.vehicle-graphics-file-field input[type="file"] {
  font-size: 0.75rem;
}

.vehicle-graphics-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.vehicle-graphics-file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.vehicle-graphics-upload-btn {
  cursor: pointer;
  margin: 0;
}

.vehicle-graphics-file-name {
  font-size: 0.72rem;
}

.vehicle-pin-ls-label {
  margin-top: 1px;
  font-size: 0.58rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@keyframes vehicle-drive {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

.leaflet-tooltip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
}

@media (max-width: 800px) {
  .alarm-body { grid-template-columns: 1fr; }
  .alarm-side { border-right: none; border-bottom: 1px solid var(--border); max-height: 30vh; }
}

/* Funk-Fenster */
.radio-bar {
  max-height: min(40vh, 320px);
  border-top: 3px solid var(--red);
  box-shadow: var(--shadow);
}

.radio-bar--collapsed {
  max-height: none;
  overflow: hidden;
}

.radio-bar--collapsed .radio-list { display: none; }

.radio-bar-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
}

.radio-bar-head h2 {
  margin: 0;
  font-size: 0.85rem;
  flex: 1;
}

.radio-badge {
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.radio-list {
  flex: 1;
  overflow: auto;
  padding: 0.35rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.radio-msg {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.4rem 0.5rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: 0.78rem;
}

.radio-msg--read { opacity: 0.55; background: #f9fafb; border-color: var(--border); }

.radio-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  background: #991b1b;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.radio-status--fms1 { background: #1d4ed8; }
.radio-status--fms2 { background: #15803d; }
.radio-status--fms3 { background: #ca8a04; }
.radio-status--fms4 { background: #dc2626; }
.radio-status--fms5 { background: #991b1b; }
.radio-status--fms7 { background: #d97706; }
.radio-status--fms8 { background: #4338ca; }

.radio-vehicle {
  display: inline-block;
  background: #e5e7eb;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  margin-right: 0.35rem;
}

.radio-msg-body p { margin: 0.25rem 0; }

.link-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.75rem;
}

/* Einsatz-Eskalation & Fehlende Kräfte */
.mission-old-name {
  display: block;
  text-decoration: line-through;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 400;
}

.mission-card-ls--alert .mission-card-ls-inner {
  background: linear-gradient(180deg, #fff5f5, #fee2e2);
}

.mission-missing {
  margin-top: 0.35rem;
  padding: 0.35rem 0.45rem;
  background: #fce7f3;
  border: 1px solid #f9a8d4;
  border-radius: 6px;
  font-size: 0.68rem;
}

.mission-missing p { margin: 0.15rem 0; }

.mission-patient-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.72rem;
  margin-top: 0.2rem;
}

.mission-patient-req {
  background: #fce7f3;
  border: 1px solid #f9a8d4;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
}

.mission-timer {
  margin: 0.25rem 0 0;
  font-size: 0.68rem;
  color: var(--text-soft);
  text-align: right;
}

.mission-timer--active {
  color: #dc2626;
  font-weight: 600;
}

.alarm-personnel-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: #111;
}

.pers {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #fff;
}

.pers--fw { background: #dc2626; }
.pers--rd { background: #ca8a04; }
.pers--pol { background: #16a34a; }
.pers--thw { background: #2563eb; }

.alarm-missing {
  padding: 0.45rem 1rem;
  background: #fce7f3;
  border-bottom: 1px solid #f9a8d4;
  font-size: 0.8rem;
}

.alarm-missing p { margin: 0.15rem 0; }

.alarm-old-title {
  text-decoration: line-through;
  opacity: 0.65;
  font-size: 0.85em;
  margin-right: 0.35rem;
}

.alarm-timer {
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
}

.alarm-timer--active,
.mission-timer--active {
  color: #fca5a5;
}

.alarm-arrival {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fde68a;
}

.alarm-eta {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.alarm-eta-static {
  font-weight: 600;
}

.alarm-table--compact { font-size: 0.75rem; }

#btn-recall-all { margin-top: 0.5rem; width: 100%; }

/* Dienstgrade */
.topbar-stat--rank {
  cursor: pointer;
  min-width: 120px;
}

.topbar-stat--rank:hover { opacity: 0.9; }

.rank-mini-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}

.rank-mini-fill {
  height: 100%;
  background: #86efac;
  border-radius: 2px;
  width: 0;
  transition: width 0.4s ease;
}

.rank-summary {
  margin-bottom: 1rem;
}

.rank-summary h3 {
  margin: 0 0 0.35rem;
  color: var(--red);
}

.rank-bar {
  position: relative;
  height: 28px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin: 0.75rem 0 0.35rem;
}

.rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  transition: width 0.4s ease;
}

.rank-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #111;
}

.rank-bonus {
  margin: 0.25rem 0;
  font-size: 0.85rem;
}

.rank-table-wrap {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.rank-table th,
.rank-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.rank-table th {
  background: #f3f4f6;
  position: sticky;
  top: 0;
}

.rank-row--done td:first-child {
  color: #16a34a;
  font-weight: 600;
}

.rank-row--current {
  background: #dcfce7;
}

.rank-now {
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
}

.modal--settings {
  padding: 0;
}

.settings-shell {
  display: flex;
  flex-direction: column;
  width: min(720px, 96vw);
  max-height: 90vh;
  margin: auto;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #b91c1c;
  color: #fff;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.settings-tab {
  border: none;
  background: transparent;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: #374151;
  border-bottom: 2px solid transparent;
}

.settings-tab:hover {
  background: #e5e7eb;
}

.settings-tab.is-active {
  background: #fff;
  color: #b91c1c;
  font-weight: 600;
  border-bottom-color: #b91c1c;
}

.settings-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem 1.5rem;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: block;
}

.settings-panel h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 400;
  color: #374151;
}

.settings-panel h4 {
  margin: 0 0 0.5rem;
}

.settings-footer {
  padding: 0.75rem 1rem;
  background: #b91c1c;
  text-align: right;
}

.settings-range-table {
  width: 100%;
  margin-top: 0.75rem;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.settings-range-table th,
.settings-range-table td {
  padding: 0.4rem 0.5rem;
  border: 1px solid #e5e7eb;
  text-align: center;
}

.settings-range-table th:first-child,
.settings-range-table td:first-child {
  text-align: left;
}

.alarm-table--no-eta .alarm-col-eta .alarm-eta-static {
  display: none;
}

@media (max-width: 640px) {
  .settings-tab {
    flex: 1 1 45%;
    font-size: 0.72rem;
    padding: 0.45rem 0.35rem;
  }
}

/* Credits-Protokoll */
.topbar-stat--clickable {
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}

.topbar-stat--clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

.modal--credits {
  padding: 0;
  align-items: stretch;
}

.credits-shell {
  display: flex;
  flex-direction: column;
  width: min(960px, 100vw);
  height: min(88vh, 720px);
  margin: auto;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.credits-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: #b91c1c;
  color: #fff;
  flex-shrink: 0;
}

.credits-header-title {
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 4.5rem;
}

.credits-nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  flex-wrap: wrap;
}

.credits-nav-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-radius: 4px;
}

.credits-nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.credits-nav-btn.is-active {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.credits-body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.5rem 2rem;
}

.credits-page-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 400;
  color: #374151;
}

.credits-table-wrap {
  overflow: auto;
}

.credits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.credits-table th,
.credits-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.credits-table th {
  font-weight: 600;
  color: #374151;
  background: #fafafa;
}

.credits-amt--in {
  color: #6b8e23;
  font-weight: 600;
}

.credits-amt--out {
  color: #374151;
  font-weight: 600;
}

.credits-empty {
  color: var(--text-soft);
  margin: 2rem 0;
}

.credits-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: #4b5563;
}

.credits-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.credits-legend-dot--net { background: #93c5fd; }
.credits-legend-dot--expense { background: #f87171; }
.credits-legend-dot--income { background: #4ade80; }

.credits-chart {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  min-height: 220px;
  padding: 1rem 0 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.credits-chart-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 48px;
}

.credits-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  width: 100%;
  justify-content: center;
}

.credits-chart-bar {
  width: 14px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: height 0.2s;
}

.credits-chart-bar--net { background: #93c5fd; }
.credits-chart-bar--expense { background: #f87171; }
.credits-chart-bar--income { background: #4ade80; }

.credits-chart-label {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: #6b7280;
  text-align: center;
}

.credits-daily-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.credits-day-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.credits-day-label {
  font-weight: 600;
  min-width: 6.5rem;
  text-align: center;
}

.credits-day-btn:not(:disabled) {
  color: #15803d;
  font-weight: 700;
}

@media (max-width: 640px) {
  .credits-header {
    flex-wrap: wrap;
  }
  .credits-nav {
    order: 3;
    width: 100%;
  }
}

.modal--admin .admin-shell {
  width: min(960px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.admin-header h2 { margin: 0; color: #f8fafc; font-size: 1.1rem; }
.admin-header-actions { display: flex; gap: 0.5rem; align-items: center; }

.admin-login { padding: 1.5rem; max-width: 360px; }

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem 0;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.admin-tab {
  border: none;
  background: transparent;
  color: #94a3b8;
  padding: 0.55rem 0.85rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.82rem;
}

.admin-tab.is-active {
  background: #1e293b;
  color: #f8fafc;
  font-weight: 600;
}

.admin-body { padding: 1rem 1.25rem 1.25rem; overflow: auto; flex: 1; }
.admin-panel { display: none; }
.admin-panel.is-active { display: block; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.admin-table-wrap { overflow: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.admin-table th,
.admin-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #334155;
  text-align: left;
  vertical-align: middle;
}

.admin-table th { color: #94a3b8; font-weight: 600; }
.admin-row--off { opacity: 0.55; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.admin-btn-danger { color: #fca5a5 !important; }

.admin-toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle span {
  position: absolute;
  inset: 0;
  background: #475569;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.admin-toggle span::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.admin-toggle input:checked + span { background: #16a34a; }
.admin-toggle input:checked + span::before { transform: translateX(16px); }

.admin-editor {
  margin-top: 1rem;
  padding: 1rem;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #334155;
}

.admin-editor h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}

.admin-form .field span { color: #94a3b8; font-size: 0.72rem; }
.admin-form input,
.admin-form select {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

.admin-form-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.admin-phase { font-size: 0.72rem; font-weight: 600; }
.mission-status--working.admin-phase { color: #4ade80; }
.mission-status--enroute.admin-phase { color: #facc15; }
.mission-status--open.admin-phase { color: #f87171; }
.modal--admin .hint { color: #94a3b8; }
.modal--admin code { background: #0f172a; padding: 0.1rem 0.35rem; border-radius: 4px; }

.modal--admin-sub {
  z-index: 4100;
  background: rgba(0, 0, 0, 0.55);
}

.admin-confirm-card {
  position: relative;
  width: min(420px, 92vw);
  padding: 1.5rem 1.25rem 1.25rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  border: 1px solid #334155;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.admin-confirm-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.admin-confirm-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.admin-confirm-card h3 {
  margin: 0 0 0.5rem;
  color: #f8fafc;
  font-size: 1.05rem;
}

.admin-confirm-card p {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-confirm-detail {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: pre-line;
  margin-bottom: 1rem !important;
}

.admin-confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #b91c1c;
}

.admin-edit-shell {
  width: min(720px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #334155;
}

.admin-edit-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem;
}

.admin-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #0f172a;
  border-top: 1px solid #334155;
}

.admin-form-check {
  margin-top: 0.75rem;
  color: #cbd5e1;
}

.admin-api-dl {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.admin-api-dl dt {
  color: #94a3b8;
  margin: 0;
}

.admin-api-dl dd {
  margin: 0;
  color: #e2e8f0;
  word-break: break-all;
}

.admin-api-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.admin-api-key-mask {
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}

.admin-api-status {
  margin: 0.5rem 0;
}

.admin-api-status-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}

.admin-api-status-badge--ok {
  background: #14532d;
  color: #86efac;
}

.admin-api-status-badge--err {
  background: #450a0a;
  color: #fca5a5;
}

.admin-api-status-badge--unknown {
  background: #334155;
  color: #cbd5e1;
}

.admin-users-meta { margin-left: auto; }

.admin-user-dl {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}

.admin-user-dl dt {
  color: #94a3b8;
  margin: 0;
}

.admin-user-dl dd {
  margin: 0;
  color: #e2e8f0;
}

.admin-loading,
.admin-empty,
.admin-error {
  text-align: center;
  color: #94a3b8;
  padding: 1rem !important;
}

.admin-error { color: #fca5a5; }

.admin-user-detail-shell { max-width: 480px; }

.admin-status-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.admin-status-badge--on {
  background: #14532d;
  color: #86efac;
}

.admin-status-badge--off {
  background: #450a0a;
  color: #fca5a5;
}
