/* ── rettALARM – Alarmierungsportal ─────────────────────────────────────────
   Aufbau angelehnt an das Adminportal (Header + ein-/ausklappbare Sidebar),
   Farben aus dem rettHUB-Logo (Petrol/Tuerkis), Alarmrot als Akzent. */

:root {
  --ra-header-bg: #0f3b40;
  --ra-sidebar-bg: #174a50;
  --ra-sidebar-hover: #1f5a61;
  --ra-sidebar-active: #22a38a;
  --ra-accent: #1d9a82;
  --ra-accent-dark: #177f6b;
  --ra-alarm: #d7263d;
  --ra-page-bg: #f3f6f6;
  --ra-border: #dfe5e5;
  --ra-muted: #66737a;
}

body {
  padding-top: 56px;
  background: var(--ra-page-bg);
}

.btn-ra {
  background: var(--ra-accent);
  border-color: var(--ra-accent);
  color: #fff;
}
.btn-ra:hover, .btn-ra:focus { background: var(--ra-accent-dark); border-color: var(--ra-accent-dark); color: #fff; }
.btn-outline-ra { color: var(--ra-accent-dark); border-color: var(--ra-accent); }
.btn-outline-ra:hover { background: var(--ra-accent); color: #fff; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.ra-header {
  background-color: var(--ra-header-bg);
  color: #fff;
  height: 56px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.ra-logo {
  background: #fff;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  overflow: hidden;
}
.ra-logo img { width: 38px; height: 38px; object-fit: contain; }
.ra-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.ra-org {
  font-size: 0.9rem;
  font-weight: 300;
  opacity: 0.8;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.ra-user { font-size: 0.95rem; opacity: 0.95; }
/* Profilmenue (2026-11-23) */
.ra-user-btn { color: inherit; padding: .25rem .5rem; }
.ra-user-btn:hover, .ra-user-btn:focus { color: inherit; opacity: 1; }
#raUserMenu .active-app { font-weight: 600; pointer-events: none; }
.modal { z-index: 1150; }
.modal-backdrop { z-index: 1140; }

.ra-loading-bar {
  position: fixed;
  top: 56px;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--ra-sidebar-active);
  z-index: 1101;
  opacity: 0;
  transition: width 0.4s ease, opacity 0.3s;
}
.ra-loading-bar.active { width: 70%; opacity: 1; }
.ra-loading-bar.done { width: 100%; opacity: 0; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.ra-sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 240px;
  background-color: var(--ra-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width 0.3s;
  z-index: 1000;
}
.ra-sidebar.collapsed { width: 68px; }
.ra-sidebar .nav-items {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 8px;
}
.ra-sidebar .nav-link {
  color: #e8f3f2;
  display: flex;
  align-items: center;
  padding: 11px 22px;
  min-height: 46px;
  white-space: nowrap;
  border-left: 4px solid transparent;
  transition: background-color 0.2s;
}
.ra-sidebar .nav-link i { font-size: 1.25rem; margin-right: 12px; }
.ra-sidebar .nav-link:hover { background-color: var(--ra-sidebar-hover); color: #fff; }
.ra-sidebar .nav-link.active { background-color: var(--ra-sidebar-hover); border-left-color: var(--ra-sidebar-active); color: #fff; font-weight: 600; }
.ra-sidebar.collapsed .nav-link span { display: none; }
.ra-sidebar .toggle-btn { padding: 10px 16px; }

.content {
  margin-left: 240px;
  padding: 18px 22px 28px 18px;
  transition: margin-left 0.3s;
  min-width: 0;
}
body.sidebar-collapsed .content { margin-left: 68px; }

@media (max-width: 768px) {
  .ra-sidebar { width: 68px; }
  .ra-sidebar .nav-link span { display: none; }
  .content { margin-left: 68px; padding: 14px 12px 24px; }
  .ra-title { font-size: 1.1rem; }
}

/* ── Seitenbausteine ────────────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-title { font-size: 1.45rem; font-weight: 600; margin: 0; }
.ra-card {
  background: #fff;
  border: 1px solid var(--ra-border);
  border-radius: 10px;
  padding: 16px;
}
.ra-card h6 { font-weight: 600; margin-bottom: 12px; }
.text-muted-ra { color: var(--ra-muted); }

/* Kennzahl-Kacheln */
.tile {
  background: #fff;
  border: 1px solid var(--ra-border);
  border-radius: 10px;
  padding: 16px 18px;
  height: 100%;
  position: relative;
}
.tile .tile-label { color: var(--ra-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tile .tile-value { font-size: 2.2rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .tile-sub { color: var(--ra-muted); font-size: 0.85rem; }
.tile .tile-icon { position: absolute; right: 16px; top: 14px; font-size: 1.5rem; color: var(--ra-accent); opacity: 0.55; }
.tile.tile-alarm .tile-icon { color: var(--ra-alarm); }
a.tile-link { color: inherit; text-decoration: none; display: block; height: 100%; }
a.tile-link:hover .tile { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07); }

/* Balkendiagramm (Alarme je Tag) */
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-chart .bar { background: var(--ra-accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-chart .bar.zero { background: #e3eaea; }
.bar-chart .bar-col:hover .bar { background: var(--ra-accent-dark); }
.bar-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ra-muted); margin-top: 4px; }

.meter { height: 8px; background: #e7eded; border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; }

/* Farbpunkt/Badge einer Alarmschleife */
.loop-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }
.loop-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  padding: 1px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  margin: 1px 3px 1px 0;
  white-space: nowrap;
}
.chip {
  display: inline-block;
  background: #eef3f3;
  border: 1px solid #dde6e6;
  border-radius: 10px;
  padding: 0 7px;
  font-size: 0.76rem;
  margin: 1px 2px 1px 0;
  white-space: nowrap;
}

/* Tabellen */
.ra-table-wrap { background: #fff; border: 1px solid var(--ra-border); border-radius: 10px; overflow: auto; }
.ra-table { margin-bottom: 0; font-size: 0.9rem; }
.ra-table thead th {
  background: #f6f9f9;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  vertical-align: middle;
}
.ra-table th.sortable { cursor: pointer; user-select: none; }
.ra-table th.sortable:hover { background: #ecf2f2; }
.ra-table th .sort-ind { opacity: 0.35; font-size: 0.72rem; margin-left: 4px; }
.ra-table th.sorted .sort-ind { opacity: 1; }
.ra-table td { vertical-align: middle; }
.ra-table tbody tr.clickable { cursor: pointer; }
.ra-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ra-table tr.is-test td { color: #7a8589; font-style: italic; }
.table-scroll { max-height: calc(100vh - 290px); min-height: 240px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar .form-control, .toolbar .form-select { width: auto; }
.toolbar .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e5f4f1;
  border: 1px solid #bfe3db;
  color: #0f5b4d;
  border-radius: 14px;
  padding: 2px 4px 2px 10px;
  font-size: 0.82rem;
}
.filter-chip button { border: 0; background: transparent; color: inherit; padding: 0 4px; line-height: 1; }

/* Reiter der Alarmierungen */
.loop-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--ra-border); }
.loop-tabs .nav-link { white-space: nowrap; color: #34454a; display: flex; align-items: center; }
.loop-tabs .nav-link.active { font-weight: 600; }
.loop-tabs .count { font-size: 0.72rem; background: #e7eded; border-radius: 8px; padding: 0 6px; margin-left: 6px; color: #34454a; }

/* Alarmgruppen: zweispaltig */
.groups-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 992px) { .groups-layout { grid-template-columns: minmax(0, 1fr); } }
.group-list .list-group-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.group-list .list-group-item.active { background: #e5f4f1; color: #0f3b40; border-color: #bfe3db; font-weight: 600; }
.group-list .list-group-item .members { margin-left: auto; font-size: 0.78rem; color: var(--ra-muted); }
.group-list .list-group-item.inactive { opacity: 0.55; }
.empty-logo {
  background: #fff;
  border: 1px solid var(--ra-border);
  border-radius: 10px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ra-muted);
  text-align: center;
  padding: 24px;
}
.empty-logo img { width: 190px; max-width: 60%; opacity: 0.9; margin-bottom: 14px; }

/* Einstellungen */
/* Alarmschleifen als Tabelle, Details im Modal (2026-11-12, pages/einstellungen.js) */
.loop-table tbody tr[data-open] { cursor: pointer; }
.loop-table tbody tr.inactive > td { opacity: 0.65; }
.loop-table th { font-size: 0.8rem; font-weight: 600; color: var(--ra-muted, #6c757d); white-space: nowrap; }
.loop-table td:first-child, .loop-table th:first-child { padding-left: 16px; }
.loop-table td:last-child, .loop-table th:last-child { padding-right: 16px; }
.loop-desc { max-width: 340px; }
.loop-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; vertical-align: middle; }
.ch-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--ra-border); }
.ch-chip.on { background: #e8f6ef; border-color: #b6e2cb; color: #146c43; }
.ch-chip.off { background: #fff6e0; border-color: #f0d58c; color: #8a6100; }
.ch-chip.none { color: var(--ra-muted, #6c757d); border-style: dashed; }
.proc-icons { display: inline-flex; gap: 10px; font-size: 1.05rem; color: #495057; }
.proc-icons span { font-size: 0.85rem; display: inline-flex; gap: 3px; align-items: center; }
.dtab-count { font-size: 0.75rem; color: var(--ra-muted, #6c757d); }
.channel-box { border: 1px solid var(--ra-border); border-radius: 8px; padding: 12px; height: 100%; background: #fbfdfd; }
.channel-box.off { background: #f7f8f8; }
.channel-box .ch-title { font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.secret-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.secret-row .form-control { font-family: SFMono-Regular, Consolas, monospace; font-size: 0.8rem; }
.code-block {
  background: #0f2a2e;
  color: #d9f2ec;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 6px 0 12px;
}
.help-doc h5 { font-weight: 700; margin-top: 18px; }
.help-doc h6 { font-weight: 700; margin-top: 16px; }
.help-doc table { font-size: 0.86rem; }
.help-doc code { color: #0f5b4d; }

.dispatch-ok { color: #198754; }
.dispatch-error { color: var(--ra-alarm); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  padding-top: 0;
  background: linear-gradient(160deg, #0f3b40 0%, #174a50 55%, #1d6b62 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 28px;
}
.login-card img { width: 140px; height: auto; display: block; margin: 0 auto 6px; }
.login-card .login-title {
  text-align: center;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #0f3b40;
  margin-bottom: 20px;
}
.login-foot { font-size: 0.78rem; color: var(--ra-muted); text-align: center; margin: 14px 0 0; }

/* ── Personal: Auswahl links, Details rechts ───────────────────────────── */
.person-layout { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .person-layout { grid-template-columns: minmax(0, 1fr); } }
.person-list-card { padding: 12px; position: sticky; top: 72px; }
@media (max-width: 1100px) { .person-list-card { position: static; } }
.person-list-scroll { max-height: calc(100vh - 290px); min-height: 240px; overflow: auto; border: 1px solid var(--ra-border); border-radius: 8px; }
.person-list-scroll .ra-table td, .person-list-scroll .ra-table th { padding: 6px 8px; }
.ra-table tbody tr.row-selected td { background: #e5f4f1; }
.ra-table tbody tr.row-selected td:first-child { box-shadow: inset 4px 0 0 var(--ra-accent); }
.filter-count { position: absolute; top: -6px; right: -6px; background: var(--ra-alarm); color: #fff; border-radius: 8px; font-size: 0.65rem; padding: 0 5px; line-height: 1.4; }
.filter-count:empty { display: none; }
.person-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--ra-accent); color: #fff; font-weight: 700; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; text-transform: uppercase; flex-shrink: 0;
}
.loop-toggle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.loop-toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--ra-border); border-radius: 8px; padding: 7px 10px; background: #fbfdfd; margin: 0;
}
.loop-toggle.on { border-color: var(--loop-color); background: #f3faf8; box-shadow: inset 3px 0 0 var(--loop-color); }
.qr-box { display: inline-block; background: #fff; border: 1px solid var(--ra-border); border-radius: 10px; padding: 10px; min-width: 262px; min-height: 262px; }
.qr-box svg { display: block; }

/* ── InfoBox (Erklaerungen) ─────────────────────────────────────────────── */
.info-box { background: #eef7f5; border: 1px solid #c9e6df; border-left: 4px solid var(--ra-accent); border-radius: 8px; padding: 10px 14px; font-size: 0.88rem; }
.info-box summary { cursor: pointer; font-weight: 600; color: #0f3b40; }
.info-box ol, .info-box ul { padding-left: 1.2rem; }
.info-option { background: #fff; border: 1px solid var(--ra-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }

/* ── Rückmeldeseite (rueckmeldung.php) – mobil zuerst ──────────────────── */
.fb-body { padding-top: 0; background: var(--ra-page-bg); min-height: 100vh; }
.fb-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  background: var(--ra-header-bg); color: #fff;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.fb-header .ra-logo { width: 38px; height: 38px; margin-right: 0; }
.fb-header .ra-logo img { width: 34px; height: 34px; }
.fb-header-title { font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.fb-header-sub { font-size: 0.8rem; opacity: 0.8; }
.min-w-0 { min-width: 0; }
.fb-main { max-width: 640px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.fb-card { background: #fff; border: 1px solid var(--ra-border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.fb-alarm { border-left: 6px solid var(--loop-color); }
.fb-loop { background: var(--loop-color); color: #fff; font-weight: 700; font-size: 0.8rem; border-radius: 12px; padding: 2px 10px; }
.fb-time { font-size: 0.82rem; color: var(--ra-muted); }
.fb-keyword { font-size: 1.9rem; font-weight: 800; margin: 4px 0 0; color: #1d2327; line-height: 1.15; word-break: break-word; }
.fb-keyword-text { font-size: 1.05rem; font-weight: 600; color: #34454a; margin-top: 2px; }
.fb-address { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 1rem; }
.fb-address i { color: var(--ra-alarm); margin-top: 2px; }
.fb-message { margin-top: 8px; font-size: 0.92rem; background: #f6f9f9; border-radius: 8px; padding: 8px 10px; }
.fb-meta { font-size: 0.8rem; color: var(--ra-muted); align-self: center; }
.fb-section-title { font-weight: 700; font-size: 1rem; margin-bottom: 10px; color: #0f3b40; }

.fb-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fb-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 92px; padding: 12px 8px; border-radius: 14px;
  border: 2px solid var(--c); background: #fff; color: var(--c);
  font-weight: 700; font-size: 1.05rem; line-height: 1.15; text-align: center;
  transition: transform 0.08s, background-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.fb-btn i:first-child { font-size: 1.9rem; }
.fb-btn:active { transform: scale(0.97); }
.fb-btn.active { background: var(--c); color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); }
.fb-btn:disabled { opacity: 0.7; }
.fb-btn-check { position: absolute; top: 6px; right: 8px; font-size: 1.1rem; }
.fb-closed { background: #f3f6f6; border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; color: var(--ra-muted); }

.fb-live { font-size: 0.75rem; color: #198754; display: inline-flex; align-items: center; gap: 5px; }
.fb-live .fb-dot { width: 8px; height: 8px; border-radius: 50%; background: #198754; animation: fbPulse 1.6s infinite; }
.fb-live.off { color: var(--ra-muted); }
.fb-live.off .fb-dot { background: var(--ra-muted); animation: none; }
@keyframes fbPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.fb-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fb-count {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 20px; padding: 4px 11px; font-size: 0.85rem;
  background: #f3f6f6; border: 1px solid #dfe5e5; /* Rückfall fuer aeltere Browser ohne color-mix */
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
}
.fb-count strong { font-size: 1rem; }
.fb-count-open { --c: #6c757d; }

.fb-list { border-top: 1px solid var(--ra-border); }
.fb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid #eef2f2; }
.fb-row.me { background: #eef7f5; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.fb-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-me { font-size: 0.7rem; background: var(--ra-accent); color: #fff; border-radius: 8px; padding: 0 6px; margin-left: 4px; vertical-align: middle; }
.fb-pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border-radius: 20px; padding: 3px 10px; font-size: 0.82rem; font-weight: 600;
  background: var(--c); color: #fff;
}
.fb-pill-open { background: #eef1f2; color: #7a8589; font-weight: 500; }
.fb-row-time { font-size: 0.75rem; color: var(--ra-muted); text-align: right; min-width: 64px; line-height: 1.2; }
.fb-row-time span { font-size: 0.7rem; }
@media (max-width: 380px) {
  .fb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fb-row-time { grid-column: 2; }
}

/* Rückmeldestatus in den Einstellungen */
.fb-status-list { display: flex; flex-direction: column; gap: 4px; }
.fb-status-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #eef2f2; }
.fb-status-row.inactive .fb-pill { opacity: 0.5; }
.fb-icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
.fb-icon-picker button { border: 2px solid var(--ra-border); background: #fff; border-radius: 8px; height: 40px; font-size: 1.2rem; }
.fb-icon-picker button.sel { border-color: var(--ra-accent); background: #e5f4f1; color: var(--ra-accent-dark); }
