/* ──────────────────────────────────────────────────────────────────────────
   Radontec Kunden-Dashboard – Styles
   (1:1 von hub.css übernommen, damit Look&Feel identisch bleibt)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --red: #b70e0c;
  --red-dark: #8c0a09;
  --red-soft: #fef2f2;
  --red-tint: rgba(183, 14, 12, 0.10);

  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-soft: #f1f2f4;

  --text: #111827;
  --text-2: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;

  --green: #16a34a;
  --green-soft: #f0fdf4;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 2px 6px rgba(17, 24, 39, 0.05), 0 8px 24px -12px rgba(17, 24, 39, 0.12);

  --sidebar-w: 248px;
  --topbar-h: 64px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Figtree', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── App Layout ──────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand img { height: 24px; }
.sidebar-brand .divider { width: 1px; height: 18px; background: var(--border); }
.sidebar-brand .label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.sidebar-nav {
  flex: 1;
  padding: 18px 12px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 14px 14px 6px;
  margin-top: 4px;
}
.nav-section:first-child { margin-top: 0; padding-top: 6px; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin: 2px 0;
  position: relative;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.nav-item:hover {
  background: #f5f6f8;
  color: var(--text);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.12s;
}
.nav-item:hover svg { color: var(--text-2); }

.nav-item.active {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}
.nav-item.active svg { color: var(--red); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}

.nav-item.disabled {
  color: var(--muted-2);
  cursor: not-allowed;
}
.nav-item.disabled:hover { background: transparent; }
.nav-item.disabled svg { color: var(--muted-2); }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  background: #f3f4f6;
  color: var(--muted);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px 12px;
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.user-card-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1; min-width: 0;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  transition: background 0.12s;
}
.user-card-link:hover {
  background: #f5f6f8;
}
.user-card.is-active .user-card-link {
  background: var(--red-soft);
}
.user-card.is-active .user-meta .name { color: var(--red); }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.user-meta { line-height: 1.2; min-width: 0; }
.user-meta .name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-meta .role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  transition: color 0.12s, background 0.12s;
}
.logout-btn:hover { color: var(--red); background: var(--red-soft); }

/* ── Main / Topbar ───────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-sub { font-size: 13px; color: var(--muted); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 28px 32px; max-width: 100%; width: 100%; }

/* ── Page Header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-header .subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
}
.card-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-primary svg, .btn-secondary svg, .btn-ghost svg { width: 15px; height: 15px; }
.btn-primary:disabled, .btn-secondary:disabled, .btn-ghost:disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.btn-primary:disabled:hover { background: var(--red); }

/* ── Stat Tiles ──────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-tile .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat-tile .stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stat-tile .stat-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.stat-tile .stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-soft);
  color: var(--red);
}
.stat-tile .stat-icon svg { width: 18px; height: 18px; }

/* Anchor-Variante: Stat-Tiles als Filter-Links */
a.stat-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
a.stat-tile:hover {
  transform: translateY(-2px);
  border-color: #d1d5db;
  box-shadow: var(--shadow-md);
}
a.stat-tile.active {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 14, 12, 0.10), var(--shadow-md);
}
a.stat-tile.active .stat-label { color: var(--red); }
a.stat-tile .filter-hint {
  position: absolute;
  bottom: 10px; right: 14px;
  font-size: 10.5px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.12s;
}
a.stat-tile:hover .filter-hint { opacity: 1; }
a.stat-tile.active .filter-hint {
  opacity: 1;
  color: var(--red);
}

/* ── Module Tiles (Dashboard) ────────────────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 980px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .module-grid { grid-template-columns: 1fr; } }

.module-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.module-tile:hover {
  transform: translateY(-2px);
  border-color: #d1d5db;
  box-shadow: var(--shadow-md);
}
.module-tile.disabled {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}
.module-tile .tile-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
}
.module-tile .tile-icon svg { width: 22px; height: 22px; }
.module-tile h3 {
  font-size: 16px;
  font-weight: 600;
}
.module-tile p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.module-tile .arrow {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
}
.module-tile .arrow svg { width: 14px; height: 14px; }

.soon-pill {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
}

/* ── Forms / Inputs (Hub-weit) ───────────────────────────────────────── */
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: block;
  margin-bottom: 5px;
}
input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="search"], input[type="url"],
select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183, 14, 12, 0.12);
}

/* Select-Dropdown: eigener Chevron */
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 34px;
  cursor: pointer;
}

/* Number-Input: native Spinner ausblenden */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Date-Input: Calendar-Picker dezent stylen */
input[type="date"] {
  position: relative;
  font-variant-numeric: tabular-nums;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: opacity(0.55);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.12s, background 0.12s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: opacity(0.95);
  background: #f3f4f6;
}
input[type="date"]::-webkit-datetime-edit { padding: 0; }
input[type="date"]::-webkit-datetime-edit-fields-wrapper { padding: 0; }

textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

/* ── Tables (Hub-weit) ───────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
table { border-collapse: collapse; width: 100%; }
thead tr { border-bottom: 1px solid var(--border); background: #fafbfc; }
thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border-soft); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 11px 14px; vertical-align: middle; }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #111827;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  /* Muss über allen Modals + Backdrops liegen — sonst wird die Meldung
     durch den Modal-Blur unlesbar. */
  z-index: 9999;
  max-width: min(520px, calc(100vw - 48px));
}
#toast.show { opacity: 1; transform: translateY(0); }

/* Fehler-Toast: zentriert & prominenter. Unten rechts gehen Fehler leicht
   unter — Erfolge/Hinweise dürfen dort dezent bleiben, Fehler MÜSSEN
   auffallen. */
#toast.error {
  background: #dc2626;
  bottom: auto; right: auto;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  padding: 16px 24px;
  font-size: 14.5px;
  line-height: 1.45;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(220, 38, 38, 0.35), 0 2px 8px rgba(0,0,0,0.15);
}
#toast.error.show { transform: translate(-50%, -50%) scale(1); }

/* ── Badges / Pills ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #f3f4f6;
  color: var(--text-2);
}
.badge.muted { color: var(--muted); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  max-width: 480px;
  margin: 24px auto;
}
.empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.empty-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-card p { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* ── Status-Pill mit Dropdown (wiederverwendbar) ─────────────────────── */
.status-pill { position: relative; display: inline-block; }
.status-pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  transition: background 0.12s, border-color 0.12s;
}
.status-pill-btn.readonly { cursor: default; }
.status-pill-btn:not(.readonly):hover { background: #fafbfc; border-color: var(--muted-2); }
.status-pill-btn i { color: var(--muted-2); }
.status-pill.open .status-pill-btn { border-color: var(--text-2); background: #f9fafb; }

/* Status-Pill gesperrt (Gerät steckt in laufendem Mietvertrag) */
.status-pill.is-locked .status-pill-btn {
  background: #f8fafc; border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.85;
}
.status-pill.is-locked .status-pill-btn:hover {
  background: #f8fafc; border-color: var(--border);
}
.status-pill.is-locked .status-pill-btn i[data-lucide="lock"],
.status-pill.is-locked .status-pill-btn svg.lucide-lock {
  color: var(--muted-2);
}

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}
.dot-aktiv,
.dot-ongoing          { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.dot-ausser_betrieb,
.dot-pausiert         { background: #9ca3af; box-shadow: 0 0 0 3px rgba(156,163,175,0.18); }
.dot-lost,
.dot-ueberfaellig     { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.dot-verkauft         { background: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.dot-abgeschlossen    { background: #6b7280; box-shadow: 0 0 0 3px rgba(107,114,128,0.15); }

.status-aktiv          .status-dot,
.status-ongoing        .status-dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.status-ausser_betrieb .status-dot,
.status-pausiert       .status-dot { background: #9ca3af; box-shadow: 0 0 0 3px rgba(156,163,175,0.18); }
.status-lost           .status-dot,
.status-ueberfaellig   .status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.status-verkauft       .status-dot { background: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.status-abgeschlossen  .status-dot { background: #6b7280; box-shadow: 0 0 0 3px rgba(107,114,128,0.15); }

.status-menu {
  display: none;
  position: fixed;
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px -8px rgba(17,24,39,0.18);
  z-index: 1100;
  padding: 6px;
}
.status-pill.open .status-menu { display: block; }
.status-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  border: none; background: none;
  font: inherit; font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
}
.status-menu button:hover { background: #f3f4f6; }

/* ── Banner ──────────────────────────────────────────────────────────── */
.banner {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid;
}
.banner.success { background: var(--green-soft); border-color: #bbf7d0; color: #166534; }
.banner.error   { background: var(--red-soft);   border-color: #fecaca; color: #991b1b; }
.banner.info    { background: var(--blue-soft);  border-color: #bfdbfe; color: #1e40af; }

/* ── Hamburger Button + Mobile Backdrop ─────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  transition: background 0.12s;
}
.hamburger:hover { background: #f3f4f6; }
.hamburger svg { width: 22px; height: 22px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
}

.topbar-text { min-width: 0; }
.topbar-title, .topbar-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

/* Mid breakpoint: 4-col stats → 2-col */
@media (max-width: 1100px) {
  .content { padding: 24px 24px; }
}

/* Tablet down: Sidebar slides as overlay */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;   /* keine Spalte mehr für Sidebar */
  }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    max-width: 86vw;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    box-shadow: 0 0 30px rgba(17, 24, 39, 0.18);
  }

  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }
  body.sidebar-open { overflow: hidden; }

  .hamburger { display: inline-flex; }

  .topbar {
    padding: 0 16px;
    gap: 10px;
  }
  .topbar-title { font-size: 15px; }
  .topbar-sub { font-size: 12px; }

  .content { padding: 20px 16px; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stat-tile { padding: 14px 16px; }
  .stat-tile .stat-value { font-size: 24px; }
  .stat-tile .stat-icon { width: 28px; height: 28px; top: 12px; right: 12px; }
  .stat-tile .stat-icon svg { width: 16px; height: 16px; }

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

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header h1 { font-size: 20px; }

  .card { padding: 18px; }

  /* Tabellen scrollen horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 600px; }
}

/* Phone: stats werden 1-spaltig, kompaktere Topbar */
@media (max-width: 560px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 14px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar-text { flex: 1 1 auto; order: 1; min-width: 0; }
  .topbar-spacer { display: none; }
  .topbar-actions { order: 3; flex: 1 1 100%; }
  .topbar-actions .btn-primary,
  .topbar-actions .btn-secondary,
  .topbar-actions .btn-ghost { font-size: 12.5px; padding: 7px 10px; }
  .hamburger { order: 0; }
  .topbar-sub { display: none; }

  .content { padding: 16px 14px; }

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

  .page-header h1 { font-size: 18px; }

  /* Sub-Nav: horizontaler Scroll */
  .sub-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .sub-nav::-webkit-scrollbar { display: none; }
  .sub-nav-item { white-space: nowrap; flex-shrink: 0; padding: 10px 12px; }

  /* Filter-Bar: stacking */
  .filter-bar {
    gap: 8px;
  }
  .filter-bar select,
  .filter-bar .btn-secondary,
  .filter-bar .btn-ghost { width: 100%; }
  .search-input { width: 100%; max-width: none; min-width: 0; }

  /* Modal: vollflächig */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal {
    border-radius: 0;
    min-height: 100vh;
    max-width: 100%;
  }
  .modal-head { padding: 16px 18px 12px; }
  .modal-body { padding: 16px 18px 22px; }
  .form-row { grid-template-columns: 1fr; }
  .lookup-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .lookup-bar .btn-primary { width: 100%; justify-content: center; padding: 10px; }
  .kunde-preview { grid-template-columns: 1fr; }

  /* Banner: kompakter */
  .banner { padding: 9px 12px; font-size: 12.5px; }
}

/* Touch-friendly: minimum 40px Tap-Targets */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 11px 12px; }
  .btn-primary, .btn-secondary, .btn-ghost { min-height: 38px; }
  .icon-btn { min-width: 32px; min-height: 32px; justify-content: center; }
}

/* ── Floating Help-Button (sidewide) ───────────────────────────────── */
.help-fab {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 500;
}
.help-fab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(183, 14, 12, 0.45), 0 2px 6px rgba(17, 24, 39, 0.12);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.help-fab-btn:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px rgba(183, 14, 12, 0.55), 0 4px 8px rgba(17, 24, 39, 0.14);
}
.help-fab-btn i,
.help-fab-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.help-fab.open .help-fab-btn .help-fab-label { display: none; }
.help-fab.open .help-fab-btn i,
.help-fab.open .help-fab-btn svg { width: 20px; height: 20px; }

.help-fab-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px -10px rgba(17, 24, 39, 0.28), 0 2px 8px rgba(17, 24, 39, 0.08);
  padding: 18px 18px 14px;
  animation: help-fab-in 0.16s ease;
}
.help-fab-panel[hidden] { display: none; }
@keyframes help-fab-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.help-fab-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.help-fab-head h3 {
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.help-fab-close {
  background: none; border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.help-fab-close:hover { background: #f3f4f6; color: var(--text); }
.help-fab-close i,
.help-fab-close svg { width: 14px; height: 14px; stroke-width: 2; }

/* Status-Pill oben im Panel */
.help-fab-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.help-fab-status.is-offline {
  background: var(--amber-soft);
  border-color: #fde68a;
}
.help-fab-status strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.2;
}
.help-fab-status.is-offline strong { color: var(--amber); }
.help-fab-status small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Pulse-Dot */
.help-fab-pulse {
  position: relative;
  width: 12px; height: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-fab-pulse span {
  position: relative;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
  z-index: 2;
}
.help-fab-status.is-offline .help-fab-pulse span { background: var(--amber); }
.help-fab-pulse::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.6;
  animation: help-fab-pulse 1.8s ease-out infinite;
  z-index: 1;
}
.help-fab-status.is-offline .help-fab-pulse::before { background: var(--amber); }
@keyframes help-fab-pulse {
  0%   { transform: scale(0.5); opacity: 0.6; }
  80%  { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

.help-fab-intro {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 12px 0 14px;
}

.help-fab-list { display: flex; flex-direction: column; gap: 4px; }
.help-fab-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
}
.help-fab-item:hover { background: #fafbfc; }
/* Spezifischer als .help-fab-item span, sonst greift der Text-Style auch
   auf den Icon-Container und macht das SVG grau + verlinkt das Layout. */
.help-fab-item .help-fab-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0;
  margin: 0;
}
.help-fab-icon i,
.help-fab-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.help-fab-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.help-fab-item > div > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* Mobile: kompakter, kein "Hilfe"-Text */
@media (max-width: 600px) {
  .help-fab { bottom: 14px; right: 14px; }
  .help-fab-btn { padding: 12px; gap: 0; }
  .help-fab-label { display: none; }
  .help-fab-panel {
    width: calc(100vw - 28px);
    max-width: 360px;
    right: 0;
  }
}

/* ── Modal offen: Seiten-Scroll dahinter sperren ──────────────────
   Die Klasse setzt der globale Modal-Scroll-Lock in assets/js/dashboard.js, sobald irgendein
   Modal sichtbar ist. Den Ausgleich der Scrollbar-Breite übernimmt dort ein
   inline gesetztes padding-right, damit der Inhalt beim Sperren nicht
   seitlich springt. */
body.modal-open { overflow: hidden; }

/* ── User-Menü oben rechts + Rechtslinks unten links (seit 2026-09-24) ──
   Der eingeloggte User wandert aus der Sidebar in die Topbar, damit unten
   links Platz für Impressum/Datenschutz ist. */
.user-menu { position: relative; flex-shrink: 0; }
.user-menu-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px 5px 5px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; font: inherit; color: inherit; text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.user-menu-btn:hover,
.user-menu-btn[aria-expanded="true"] { background: #f5f6f8; border-color: var(--border); }
.user-menu.is-active .user-menu-btn { background: var(--red-soft); }
.user-menu .user-avatar { width: 32px; height: 32px; font-size: 12.5px; }
.user-menu .user-meta { display: flex; flex-direction: column; max-width: 180px; }
.user-menu .user-meta .name,
.user-menu .user-meta .role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-chevron { width: 15px !important; height: 15px !important; color: var(--muted); }

.user-menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
}
.user-menu-panel[hidden] { display: none; }
.user-menu-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}
.user-menu-head strong { font-size: 13px; font-weight: 600; color: var(--text); }
.user-menu-head span { font-size: 12px; color: var(--muted); word-break: break-all; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  font-size: 13.5px; color: var(--text-2); text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.user-menu-item i, .user-menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.user-menu-item:hover { background: #f5f6f8; color: var(--text); }
.user-menu-item[href="/logout.php"]:hover { background: var(--red-soft); color: var(--red); }
.user-menu-item[href="/logout.php"]:hover svg { color: var(--red); }

.sidebar-legal {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px;
  font-size: 12.5px; color: var(--muted-2);
}
.sidebar-legal a { color: var(--muted); text-decoration: none; }
.sidebar-legal a:hover, .sidebar-legal a.active { color: var(--red); }

/* Handy: nur Avatar, Menü rechts neben dem Titel */
@media (max-width: 560px) {
  .user-menu { order: 2; }
  .user-menu .user-meta, .user-menu-chevron { display: none; }
  .user-menu-btn { padding: 3px; }
}

/* ══ Gebäude (seit 2026-09-27) ═══════════════════════════════════════════
   Kachel, Ampel, Radon-Pfad, Nächster Schritt — Bausteine aus
   includes/building_ui.php. Entwurf: claude.ai/artifact/17dEQTGYuQMZLitgixzsNZ
   Ampel-Töne wie hub.radontec.de/includes/ampel.php. */
:root {
  --amp-gruen: #15803d; --amp-gruen-bg: #f0fdf4;
  --amp-orange: #ea580c; --amp-orange-bg: #fff7ed;
  --amp-rot: #b70e0c; --amp-rot-bg: #fef2f2;
  --amp-grau: #9ca3af; --amp-grau-bg: #f4f5f7;
}

/* Ampel-Feld */
.gb-amp { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; background: var(--amp-grau-bg); }
.gb-amp.is-gruen  { background: var(--amp-gruen-bg); }
.gb-amp.is-orange { background: var(--amp-orange-bg); }
.gb-amp.is-rot    { background: var(--amp-rot-bg); }
.gb-amp-dot { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(156,163,175,.18); }
.gb-amp-dot i { width: 15px; height: 15px; border-radius: 50%; background: var(--amp-grau); }
.gb-amp.is-gruen  .gb-amp-dot { background: rgba(21,128,61,.14); }  .gb-amp.is-gruen  .gb-amp-dot i { background: var(--amp-gruen); }
.gb-amp.is-orange .gb-amp-dot { background: rgba(234,88,12,.14); }  .gb-amp.is-orange .gb-amp-dot i { background: var(--amp-orange); }
.gb-amp.is-rot    .gb-amp-dot { background: rgba(183,14,12,.14); }  .gb-amp.is-rot    .gb-amp-dot i { background: var(--amp-rot); }
.gb-amp-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gb-amp-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums; }
.gb-amp-val small { font-size: 12.5px; font-weight: 600; color: #4b5563; letter-spacing: 0; }
.gb-amp-verdict { font-size: 13.5px; font-weight: 700; }
.gb-amp.is-rot .gb-amp-verdict { color: var(--amp-rot); }
.gb-amp.is-orange .gb-amp-verdict { color: #c2410c; }
.gb-amp.is-gruen .gb-amp-verdict { color: var(--amp-gruen); }
.gb-amp-src { font-size: 12px; color: #4b5563; line-height: 1.4; }
.gb-amp-title { font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--text); }
.gb-amp-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #c2410c; }
/* Einschätzung: Ring + gestrichelt, bewusst anders als ein Messwert */
.gb-amp-est { background: transparent !important; border: 1.5px dashed #fdba74; }
.gb-amp-est.is-gruen { border-color: #86efac; } .gb-amp-est.is-gruen .gb-amp-kicker { color: var(--amp-gruen); }
.gb-amp-est.is-rot { border-color: #fca5a5; } .gb-amp-est.is-rot .gb-amp-kicker { color: var(--amp-rot); }
.gb-amp-ring { width: 32px; height: 32px; margin: 0 3px; border-radius: 50%; border: 4px solid var(--amp-orange); flex-shrink: 0; box-sizing: border-box; }
.gb-amp-est.is-gruen .gb-amp-ring { border-color: var(--amp-gruen); }
.gb-amp-est.is-rot .gb-amp-ring { border-color: var(--amp-rot); }
.gb-amp-clock { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 1px solid var(--border); color: #4b5563; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gb-amp-progress { height: 5px; border-radius: 99px; background: var(--border); display: flex; margin: 3px 0 2px; }
.gb-amp-progress span { border-radius: 99px; background: #4b5563; }
/* groß (Detailseite) */
.gb-amp.is-gross { padding: 18px; gap: 16px; border-radius: 12px; }
.gb-amp.is-gross .gb-amp-dot { width: 56px; height: 56px; }
.gb-amp.is-gross .gb-amp-dot i { width: 22px; height: 22px; }
.gb-amp.is-gross .gb-amp-val { font-size: 40px; letter-spacing: -.03em; }
.gb-amp.is-gross .gb-amp-val small { font-size: 16px; }
.gb-amp.is-gross .gb-amp-ring { width: 52px; height: 52px; border-width: 5px; }
.gb-amp.is-gross .gb-amp-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.gb-amp.is-gross .gb-amp-src { font-size: 12.5px; }

/* Skala */
.gb-scale { display: flex; flex-direction: column; gap: 6px; }
.gb-scale-bar { position: relative; display: flex; height: 8px; border-radius: 99px; }
.gb-scale-bar span { height: 8px; }
.gb-scale-bar .s-g { width: 16.6%; background: var(--amp-gruen); border-radius: 99px 0 0 99px; }
.gb-scale-bar .s-o { width: 33.4%; background: var(--amp-orange); }
.gb-scale-bar .s-r { width: 50%; background: var(--amp-rot); border-radius: 0 99px 99px 0; }
.gb-scale.is-est .s-g, .gb-scale.is-est .s-r { opacity: .35; }
.gb-scale-mark { position: absolute; top: -4px; width: 3px; height: 16px; margin-left: -1px; border-radius: 2px; background: var(--text); }
.gb-scale-lbl { position: relative; height: 16px; font-size: 11.5px; color: var(--muted); }
.gb-scale-lbl span { position: absolute; }
.gb-scale-lbl span:nth-child(2), .gb-scale-lbl span:nth-child(3) { transform: translateX(-50%); }
.gb-scale-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #4b5563; }
.gb-scale-note span { width: 22px; height: 8px; border-radius: 99px; background: var(--amp-orange); flex-shrink: 0; }
.gb-scale-note span.is-gruen { background: var(--amp-gruen); } .gb-scale-note span.is-rot { background: var(--amp-rot); }

/* Pfad */
.gb-pfad-bar { display: flex; gap: 4px; }
.gb-pfad-bar span { flex: 1; height: 5px; border-radius: 99px; background: var(--border); }
.gb-pfad-bar span.is-done { background: var(--amp-gruen); }
.gb-pfad-bar span.is-skip { background: #bbf7d0; }
.gb-pfad-bar span.is-now { background: var(--red); }
.gb-pfad-lbl { font-size: 11.5px; color: var(--muted); }
.gb-pfad-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gb-pfad-list li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.gb-pfad-list li > div { display: flex; flex-direction: column; line-height: 1.35; }
.gb-pfad-list li > div > span:not(.gb-pfad-name), .gb-pfad-list li > div > a { font-size: 12px; color: var(--muted); }
.gb-pfad-list li > div > a { color: var(--red); text-decoration: none; }
.gb-pfad-name { font-size: 13.5px; font-weight: 600; color: #4b5563; }
.gb-pfad-mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #d1d5db; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.gb-pfad-list li.is-done .gb-pfad-mark { background: var(--amp-gruen); border-color: var(--amp-gruen); }
.gb-pfad-list li.is-done .gb-pfad-name { color: var(--text); }
.gb-pfad-list li.is-skip .gb-pfad-mark { border-style: dashed; }
.gb-pfad-list li.is-now .gb-pfad-mark { border-color: var(--red); background: var(--red-soft); }
.gb-pfad-list li.is-now .gb-pfad-mark i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.gb-pfad-list li.is-now .gb-pfad-name { color: var(--red); font-weight: 700; }

/* Nächster Schritt */
.gb-next { border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--border); }
.gb-next.is-akzent { background: var(--red); border-color: var(--red); color: #fff; }
.gb-next-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gb-next.is-akzent .gb-next-kicker { color: #fecaca; }
.gb-next h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.015em; line-height: 1.2; }
.gb-next p { margin: 0; font-size: 14px; line-height: 1.55; color: #4b5563; }
.gb-next.is-akzent p { color: #fde8e8; }
.gb-next-grow { flex: 1; }
.gb-next-ctas { display: flex; flex-direction: column; gap: 8px; }
.gb-next-ctas a { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 700; text-decoration: none; }
.gb-next-main { background: var(--red); color: #fff; }
.gb-next-main:hover { background: var(--red-dark); color: #fff; }
.gb-next-alt { justify-content: center !important; border: 1px solid var(--border); color: var(--text-2); font-weight: 600 !important; font-size: 13.5px !important; }
.gb-next.is-akzent .gb-next-main { background: #fff; color: var(--red); }
.gb-next.is-akzent .gb-next-main:hover { background: #fef2f2; color: var(--red); }
.gb-next.is-akzent .gb-next-alt { border-color: rgba(255,255,255,.45); color: #fff; }
.gb-next-preis { font-weight: 600; opacity: .8; }
.gb-next.is-akzent .gb-next-main .gb-next-preis { color: #4b5563; opacity: 1; }

/* Kachel */
.gb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1200px) { .gb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .gb-grid { grid-template-columns: 1fr; gap: 12px; } }
.gb-tile { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: 14px; color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.gb-tile:hover { border-color: #d1d5db; box-shadow: var(--shadow-md); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .gb-tile, .gb-tile:hover { transition: none; transform: none; } }
.gb-tile-head { padding: 16px 18px 12px; display: flex; flex-direction: column; gap: 3px; }
.gb-tile-title { display: flex; align-items: flex-start; gap: 8px; }
.gb-tile-title h2 { margin: 0; flex: 1; font-size: 16.5px; font-weight: 700; line-height: 1.25; }
.gb-tile-addr { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.gb-owner { font-size: 12px; color: var(--muted-2); }
.gb-shared { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--blue-soft); color: #1d4ed8; flex-shrink: 0; }
.gb-tile-amp { padding: 0 14px; }
.gb-tile-chips { padding: 12px 18px 0; display: flex; flex-wrap: wrap; gap: 6px; min-height: 22px; }
.gb-chip { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #f3f4f6; color: #374151; }
.gb-tile-pfad { padding: 10px 18px 0; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.gb-tile-next { margin-top: 14px; border-top: 1px solid var(--border-soft); padding: 11px 18px 13px; display: flex; flex-direction: column; gap: 1px; }
.gb-tile-next .k { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gb-tile-next .v { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text-2); }
.gb-tile-next .v.is-akzent { color: var(--red); }
.gb-tile-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 240px; padding: 24px; border: 1.5px dashed #d1d5db; border-radius: 14px; color: #4b5563; text-align: center; text-decoration: none; background: transparent; font: inherit; cursor: pointer; }
.gb-tile-add:hover { border-color: var(--red); }
.gb-tile-add .gb-add-icon { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--red); }
.gb-tile-add strong { font-size: 15px; color: var(--text-2); }
.gb-tile-add > span:last-child { font-size: 13px; line-height: 1.5; max-width: 240px; }

/* Liste (ab 6 Gebäuden) */
.gb-list tbody tr { cursor: pointer; }
.gb-list-name { font-weight: 600; color: var(--text); text-decoration: none; }
.gb-list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.gb-list-amp { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.gb-list-next { font-weight: 600; color: var(--text-2); }
.gb-list-next.is-akzent { color: var(--red); }
.gb-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--amp-grau); flex-shrink: 0; }
.gb-dot.is-gruen { background: var(--amp-gruen); } .gb-dot.is-orange { background: var(--amp-orange); } .gb-dot.is-rot { background: var(--amp-rot); }
.gb-dot.is-ring { background: transparent; border: 2.5px solid var(--amp-orange); box-sizing: border-box; }
.gb-dot.is-ring.is-gruen { border-color: var(--amp-gruen); } .gb-dot.is-ring.is-rot { border-color: var(--amp-rot); }

/* Seitenkopf mit Aktion */
.gb-pagehead { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.gb-pagehead > div { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.gb-pagehead h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.gb-pagehead .sub { font-size: 14px; color: var(--muted); }
@media (max-width: 560px) { .gb-pagehead h1 { font-size: 24px; } }

/* Modals (Gebäude bearbeiten/freigeben, Anlegen) — global, damit alle Seiten sie nutzen */
.gb-modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.48); backdrop-filter: blur(2px); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; }
.gb-modal-backdrop[hidden] { display: none; }
.gb-modal { background: #fff; border-radius: 16px; width: 100%; max-width: 600px; box-shadow: 0 24px 60px -12px rgba(17,24,39,.30); display: flex; flex-direction: column; }
.gb-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 14px; border-bottom: 1px solid var(--border); }
.gb-modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.gb-modal-close { width: 32px; height: 32px; border: none; background: none; border-radius: 6px; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gb-modal-close:hover { background: #f3f4f6; color: var(--text); }
.gb-modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.gb-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.gb-form-grid.is-adresse { grid-template-columns: 2fr 1fr 1.5fr; }
.gb-form-grid > div, .gb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gb-form-grid label, .gb-field label { font-size: 13px; font-weight: 500; }
.gb-form-sep { height: 1px; background: var(--border-soft); }
.gb-form-kicker { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.gb-form-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.gb-modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.gb-modal-actions > div { display: flex; gap: 10px; margin-left: auto; }
.gb-link-danger { background: none; border: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; padding: 0; }
.gb-link-danger:hover { color: var(--red); }
@media (max-width: 560px) {
  .gb-form-grid, .gb-form-grid.is-adresse { grid-template-columns: 1fr; }
  .gb-modal-backdrop { padding: 16px 10px; }
}

/* Hinweis unter Erklärseiten in Modulen ohne Daten (seit 2026-09-27) */
.ls-bestellt-hinweis { margin: 12px 2px 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── Datei-Viewer ─────────────────────────────────────────────────────
   Zeigt Anhänge, Bilder und Dokumente auf derselben Seite statt in einem
   neuen Tab. Eigene Klassennamen statt .modal/.modal-body: diese Namen sind
   in den Modulen jeweils anders belegt, der Viewer erbte sonst je Seite
   andere Maße. Die Wurzel endet auf "-modal-backdrop", damit der
   Scroll-Lock sie als Modal erkennt. */
.rt-viewer-modal-backdrop {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(17, 24, 39, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.rt-viewer-modal-backdrop[hidden] { display: none; }

.rt-viewer-box {
  background: #fff; border-radius: 12px;
  width: min(1100px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.rt-viewer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; border-bottom: 1px solid #e5e7eb;
}
.rt-viewer-title {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 600; color: #111827;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rt-viewer-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.rt-viewer-zaehler { font-size: 12px; color: #6b7280; margin-right: 4px; }

.rt-viewer-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
  color: #374151; cursor: pointer; text-decoration: none;
}
.rt-viewer-btn:hover { background: #f3f4f6; }
.rt-viewer-btn[hidden] { display: none; }
.rt-viewer-btn i, .rt-viewer-btn svg { width: 15px; height: 15px; }
.rt-viewer-close:hover { background: #fdecec; border-color: #b70e0c; color: #b70e0c; }

.rt-viewer-body {
  flex: 1; min-height: 0; display: flex;
  align-items: center; justify-content: center;
  background: #f6f7f9; padding: 12px;
}
/* Das Bild bekommt so viel Platz wie da ist, ohne den Rahmen zu sprengen. */
.rt-viewer-bild {
  max-width: 100%; max-height: calc(100vh - 160px);
  object-fit: contain; border-radius: 6px;
  background: #fff;
}
/* Das PDF braucht feste Höhe — ein iframe hat keine inhaltsabhängige. */
.rt-viewer-frame {
  width: 100%; height: calc(100vh - 160px);
  border: 0; border-radius: 6px; background: #fff;
}

.rt-viewer-hinweis {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 36px 24px; text-align: center; color: #6b7280;
}
.rt-viewer-hinweis i, .rt-viewer-hinweis svg { color: #9ca3af; }
.rt-viewer-hinweis-name { font-size: 13.5px; font-weight: 600; color: #111827; margin: 6px 0 0; }
.rt-viewer-hinweis-text { font-size: 12.5px; margin: 0 0 10px; }
.rt-viewer-hinweis-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: #b70e0c; color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 600;
}
.rt-viewer-hinweis-btn:hover { background: #8f0b09; }

/* Auf dem Tablet und am Telefon den ganzen Schirm nutzen — dort ist der
   Platz knapp und ein Rahmen ringsum kostet nur Fläche. */
@media (max-width: 768px) {
  .rt-viewer-modal-backdrop { padding: 0; }
  .rt-viewer-box { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .rt-viewer-bild  { max-height: calc(100vh - 110px); }
  .rt-viewer-frame { height: calc(100vh - 110px); }
}
