/* TruckSOS Admin — mobile-first, Design-Anlehnung an „The Kinetic Guardian":
   Inter, keine 1px-Solid-Borders (Flächenabstufungen statt Linien), Buttons
   min. 56px, Schatten blau getönt bei 4–6 %. Farb-Tokens spiegeln
   trucksos/lib/shared/ui/theme/app_colors.dart. */

:root {
  --brand-deep: #06619c;
  --brand-accent: #fdc003;
  --brand-tertiary: #1d4e89;
  --accent-ok: #2f9e6b;
  --accent-warn: #e8a33d;
  --accent-danger: #d64545;
  --surface-0: #ffffff;
  --surface-1: #f4f6f8;
  --surface-2: #e7ecf0;
  --baby-blue: #eef4fb;
  --text-strong: #0d1b2a;
  --text-muted: #75777c;
  --shadow: 0 4px 16px rgba(6, 97, 156, 0.06);
  --radius: 16px;
  --radius-small: 12px;
}

* { box-sizing: border-box; }

/* Das eingebaute [hidden]{display:none} des Browsers hat dieselbe Spezifität
   wie jede Klasse, die display setzt (.btn, .loading, .bulkbar …) — und
   Autoren-Regeln stechen die des Browsers. Ohne dieses !important blieben per
   hidden-Attribut versteckte Elemente (Spinner, „Mehr laden") sichtbar. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-1);
  color: var(--text-strong);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Kopfzeile ─────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand-deep);
  color: #fff;
  box-shadow: 0 2px 12px rgba(6, 97, 156, 0.25);
  transition: transform 0.25s ease;
}
/* Auf schmalen Screens gleitet die Leiste beim Runterscrollen weg (Klasse
   kommt aus admin.js) und beim ersten Hochscrollen zurück — wie die
   Adressleiste mobiler Browser. */
.topbar.slid-away { transform: translateY(-100%); }
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  letter-spacing: 0.2px;
}
.brand img { width: 34px; height: 34px; display: block; }
.brand b { color: var(--brand-accent); font-weight: 700; }
/* Hamburger-Menü oben rechts: EIN Knopf, darunter die aufklappende Karte mit
   Nutzer / Protokoll / Info / Profil. margin-left: auto drückt den Knopf
   immer an den rechten Rand. */
.menu { position: relative; margin-left: auto; }
.menu-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.main-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  max-width: 88vw;
  background: var(--surface-0);
  color: var(--text-strong);
  border-radius: var(--radius-small);
  box-shadow: 0 12px 32px rgba(6, 97, 156, 0.22);
  padding: 8px;
  z-index: 30;
  display: grid;
  gap: 2px;
}
.menu-item {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--text-strong);
  text-align: left;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 10px;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-1); }
.menu-item.active { background: var(--baby-blue); color: var(--brand-deep); font-weight: 600; }
/* Aufgeklappter Profil-Teil unter dem Punkt „Profil". */
.profile-body { padding: 10px 14px 12px; background: var(--surface-1); border-radius: 10px; }
.profile-label { display: block; font-size: 12px; color: var(--text-muted); }
/* Eigener Anzeige-Name (für die Zuweisungs-Auswahl statt der E-Mail). */
.profile-name-row { display: flex; gap: 8px; margin: 4px 0 12px; }
.profile-name-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: var(--surface-0);
  border-radius: var(--radius-small);
  padding: 0 12px;
  min-height: 44px;
  font: inherit;
  color: var(--text-strong);
  outline: 2px solid transparent;
}
.profile-name-row input:focus { outline-color: var(--brand-deep); }
.profile-name-row .btn { flex: none; }
.profile-email {
  display: block;
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
  margin: 2px 0 12px;
}
.profile-body .btn { width: 100%; }

/* ── Seitenraster ──────────────────────────────────────────────────────── */

.page {
  max-width: 760px;
  margin: 0 auto;
  /* Schmale Seitenränder: auf dem Handy zählt jede Spalte Breite für die
     E-Mail-Adressen in der Liste. --filter-panel-h und --bulkbar-h halten
     das Listenende frei, solange das Filter-Panel bzw. die Sammel-
     Aktionsleiste unten angedockt sind (beide misst admin.js). */
  padding: 16px 8px
    calc(96px + var(--filter-panel-h, 0px) + var(--bulkbar-h, 0px)
      + var(--action-sheet-h, 0px) + var(--composer-h, 0px));
}
.page-title { font-size: 20px; margin: 4px 0 12px; }
.view[hidden] { display: none; }

.card {
  background: var(--surface-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; margin: 0 0 12px; }

.hint { color: var(--text-muted); font-size: 14px; margin: 6px 0; }
.hint.center { text-align: center; }
.error {
  color: var(--accent-danger);
  background: rgba(214, 69, 69, 0.08);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  font-size: 14px;
  margin: 8px 0;
}
.error.banner { margin: 0 0 12px; }

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-card { max-width: 420px; margin: 10vh auto 0; }
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 24px;
  margin: 8px 0 8px;
}
.login-logo img { width: 64px; height: 64px; display: block; }
.login-logo b { color: var(--brand-accent); font-weight: 700; }
.login-card .hint { text-align: center; margin-bottom: 16px; }

.field { display: block; margin-bottom: 12px; }
.field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .search, select {
  width: 100%;
  border: 0;
  background: var(--surface-1);
  border-radius: var(--radius-small);
  padding: 0 14px;
  min-height: 52px;
  font: inherit;
  color: var(--text-strong);
  outline: 2px solid transparent;
}
.field input:focus, .search:focus, select:focus {
  outline-color: var(--brand-deep);
  background: var(--surface-0);
}

/* Passwortfeld mit Auge zum Ein-/Ausblenden. Der Knopf liegt IM Feld; das
   Eingabefeld bekommt rechts Platz, damit Text und Auge sich nicht kreuzen. */
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 56px; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--brand-deep); }

/* ── Buttons: min. 56px für Handschuh-Hände ────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius-small);
  min-height: 56px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text-strong);
}
.btn.primary { background: var(--brand-deep); color: #fff; }
.btn.danger { background: var(--accent-danger); color: #fff; }
.btn.warn { background: var(--accent-warn); color: var(--text-strong); }
.btn.ghost { background: transparent; color: var(--brand-deep); box-shadow: inset 0 0 0 2px var(--surface-2); }
.btn.small { min-height: 44px; width: auto; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* Klebt wie die Kopfzeile: bleibt beim Scrollen direkt unter der Leiste
   stehen und gleitet auf schmalen Screens gemeinsam mit ihr weg/zurück
   (Klasse slid-away kommt aus admin.js). --topbar-h misst admin.js, weil
   die Leiste auf schmalen Screens auf zwei Zeilen umbrechen kann. Der
   Seitenhintergrund als Füllung, damit die Liste nicht durchscheint. */
.backlink {
  border: 0;
  background: var(--surface-1);
  color: var(--brand-deep);
  font: inherit;
  font-weight: 600;
  padding: 8px 0;
  margin-bottom: 6px;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  position: sticky;
  top: var(--topbar-h, 64px);
  z-index: 15;
  transition: transform 0.25s ease;
}
.backlink.slid-away {
  transform: translateY(calc(-100% - var(--topbar-h, 64px)));
}

/* ── Filter + Liste ────────────────────────────────────────────────────── */

/* Die Filterkarte taucht oben in der Liste nicht mehr auf — sie lebt nur
   noch als schwebendes Panel hinter dem Filter-Knopf unten rechts. */
.filters { display: none; gap: 10px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Sortier-Auswahl + Richtungs-Knopf (↓/↑) nebeneinander. */
.sort-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.sort-dir {
  width: 52px;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--surface-1);
  color: var(--brand-deep);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

/* Schwebender Filter-Knopf (unten rechts). Bei sichtbarer Sammel-
   Aktionsleiste rückt er über sie hoch (--bulkbar-h misst admin.js),
   denn er ist der einzige Weg zu den Filtern. */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--bulkbar-h, 0px));
  z-index: 31;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--brand-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(6, 97, 156, 0.35);
}

/* Gelb heißt: mindestens ein Filter wirkt gerade (Klasse aus admin.js). */
.fab.active { background: var(--brand-accent); color: var(--text-strong); }

/* Das offene Filter-Panel dockt als Bodenblatt am unteren Rand an; der
   kräftige blaue Ring (bewusste Ausnahme von der „keine Rahmen"-Regel,
   User-Wunsch) hebt es von den Karten dahinter ab. Solange es offen ist,
   verschwindet der Filter-Knopf (Sibling-Regel unten) — geschlossen wird
   über das X oben rechts, einen Klick außerhalb oder Escape. */
.filters.floating {
  display: grid;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  margin: 0 auto;
  width: 100%;
  max-width: 760px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding-top: 52px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 0 0 2px var(--brand-deep), 0 -10px 36px rgba(6, 97, 156, 0.28);
}
#filters.floating ~ .fab { display: none; }

/* Das X gibt es nur im angedockten Zustand, oben rechts im Panel
   (padding-top des Panels hält die Ecke frei). */
.filter-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-strong);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.filters.floating .filter-close { display: flex; }

.list { display: grid; gap: 10px; }

.user-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--surface-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* Rechts bewusst am engsten, damit die Status-Kachel fast am Rand sitzt. */
  padding: 12px 6px 12px 12px;
  cursor: pointer;
}
.user-row.selected { background: var(--baby-blue); }
.user-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--brand-deep);
}
.user-main { min-width: 0; }
.user-email {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-sub {
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-side { text-align: right; }
/* In der Liste steht rechts nur der Anfangsbuchstabe des Zugangs-Zustands
   (U/P/T/A/E) als kleine Kachel — Hintergrund und Schrift in den Farben
   der Chips, aber minimaler Platz; die E-Mail links schneidet nicht ab.
   Voller Text im title; ausgeschrieben in der Detail-Ansicht. Das
   „bis …"-Datum steht links unter Name und Rolle (user-until). */
.status-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.status-letter.unlimited {
  background: linear-gradient(135deg, #bf953f 0%, #fcf6ba 45%, #d4a017 70%, #aa771c 100%);
  color: #4a3200;
}
.status-letter.premium {
  background: linear-gradient(165deg, #e7f6ee 0%, #b5e3ca 45%, #59bb8b 100%);
  color: #176644;
}
.status-letter.trial {
  background: linear-gradient(165deg, var(--baby-blue) 0%, #c4dbf2 45%, #7fadda 100%);
  color: var(--brand-deep);
}
.status-letter.expired {
  background: linear-gradient(165deg, #fdeeee 0%, #f5bcbc 45%, #e26a6a 100%);
  color: #8f1f1f;
}
.status-letter.revoked { background: rgba(13, 27, 42, 0.10); color: var(--text-strong); }

.chip {
  display: inline-block;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface-2);
  color: var(--text-strong);
  white-space: nowrap;
}
.chip.role { background: var(--baby-blue); color: var(--brand-tertiary); }
.chip.warn { background: rgba(232, 163, 61, 0.16); color: #9a6a1e; }
.chip.danger { background: rgba(214, 69, 69, 0.12); color: var(--accent-danger); }
/* Die fünf Zugangs-Zustände: Unbegrenzt gold (Vollfläche), Premium grün,
   Testphase blau, Abgelaufen rot, Entzogen dunkelgrau — jede Gruppe hat
   ihre eigene Farbe. */
/* Unbegrenzt: klassischer Metallic-Gold-Verlauf (dunkles Gold → heller
   Glanzstreifen → Bronze) — der diagonale Lichtband-Effekt macht das
   „Gold" aus, eine flache Farbe wirkt nur gelb. */
.chip.unlimited {
  background: linear-gradient(135deg, #bf953f 0%, #fcf6ba 45%, #d4a017 70%, #aa771c 100%);
  color: #4a3200;
}
/* Premium: heller Mint-Verlauf, der ins satte Grün ausläuft. */
.chip.premium {
  background: linear-gradient(165deg, #e7f6ee 0%, #b5e3ca 45%, #59bb8b 100%);
  color: #176644;
}
/* Testphase: Babyblau-Verlauf, der ins TruckSOS-Blau ausläuft. */
.chip.trial {
  background: linear-gradient(165deg, var(--baby-blue) 0%, #c4dbf2 45%, #7fadda 100%);
  color: var(--brand-deep);
}
/* Abgelaufen: heller Rosé-Verlauf, der ins Warnrot ausläuft. */
.chip.expired {
  background: linear-gradient(165deg, #fdeeee 0%, #f5bcbc 45%, #e26a6a 100%);
  color: #8f1f1f;
}
.chip.revoked { background: rgba(13, 27, 42, 0.10); color: var(--text-strong); }
/* Dritte Zeile links: Rollen-Chip, daneben das Datum (falls vorhanden). */
.user-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.user-until { font-size: 11px; color: var(--text-muted); }

/* ── Sammel-Aktionsleiste ──────────────────────────────────────────────── */

.bulkbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--surface-0);
  box-shadow: 0 -4px 20px rgba(6, 97, 156, 0.14);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.bulkbar[hidden] { display: none; }
/* Kopfzeile der Leiste: links der Zähler, rechts „Auswahl aufheben". */
.bulk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bulk-count { font-weight: 600; font-size: 14px; }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Detail ────────────────────────────────────────────────────────────── */

.detail-head { margin-bottom: 10px; position: relative; padding-right: 48px; }
.detail-email { font-size: 18px; font-weight: 700; word-break: break-all; }
.detail-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }

/* Das Bild-Icon oben rechts im Detail-Kopf öffnet die Profil-Ansicht. */
.profile-open-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--surface-1);
  color: var(--brand-deep);
  cursor: pointer;
}
.profile-open-btn:hover { background: var(--surface-2); }

/* ── Profil-Ansicht: das Konto, wie der Nutzer es sieht ────────────────────
   Medien liegen als Kacheln (.media-item) mit X-Knopf obenauf — dieselbe
   Bauform für Titelbild, Profilbild, Fahrer-Avatare und die Galerie-Raster. */
.media-item { position: relative; }
.media-item img, .media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-small);
  background: var(--surface-1);
  display: block;
}
.media-missing {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 12px;
}
.media-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent-danger);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(6, 97, 156, 0.28);
}

.profile-card { overflow: hidden; }
.profile-cover .media-item { aspect-ratio: 21 / 9; }
/* Die Karte hat eigenes Padding — das Cover soll trotzdem randlos wirken. */
.profile-cover { margin: -16px -16px 12px; }
.profile-cover .media-item img, .profile-cover .media-item video { border-radius: 0; }

.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-avatar { width: 72px; height: 72px; flex: none; }
.profile-avatar .media-item { width: 72px; height: 72px; }
.profile-avatar .media-item img { border-radius: 50%; }
.profile-avatar .media-item .media-x { top: -4px; right: -4px; }
.profile-avatar-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--text-muted);
}
.profile-avatar-empty.small { width: 48px; height: 48px; }
.profile-who { min-width: 0; }
.profile-sub { color: var(--text-muted); font-size: 13px; word-break: break-all; }
.profile-desc { margin: 12px 0 0; font-size: 14px; white-space: pre-wrap; }

.driver-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}
.driver-avatar { width: 48px; height: 48px; flex: none; }
.driver-avatar .media-item { width: 48px; height: 48px; }
.driver-avatar .media-item img { border-radius: 50%; }
.driver-avatar .media-item .media-x { top: -6px; right: -6px; width: 24px; height: 24px; }
.driver-name { font-weight: 600; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.media-grid .media-item { aspect-ratio: 4 / 3; }
.media-remove-all { margin-top: 12px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.kv > div {
  display: contents;
  font-size: 14px;
}
.kv dt { color: var(--text-muted); margin: 0; padding: 6px 0; }
.kv dd { margin: 0; padding: 6px 0; text-align: right; font-weight: 500; }

/* Die drei Gruppen-Knöpfe stehen frei zwischen den Karten und brauchen
   deren Abstand nach unten selbst; ab Tablet-Breite nebeneinander. */
.action-open-row { display: grid; gap: 8px; margin-bottom: 14px; }
/* Die Überschrift spannt in der Drei-Spalten-Ansicht über alle Spalten. */
.action-open-title { font-size: 16px; margin: 4px 0 2px; grid-column: 1 / -1; }
@media (min-width: 560px) {
  .action-open-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* Gruppe → Aktion → Ausführen; die Felder erben den .field-Stil. */
.action-combos .btn { width: 100%; margin-top: 4px; }

/* Der Hinweis-Satz, der bei Beobachter-Konten den Aktionen-Knopf ersetzt. */
.action-note { color: var(--text-muted); font-size: 14px; margin: 0 0 14px; }

/* Das Aktions-Menü dockt als Bodenblatt an — dieselbe Bauform wie das
   Filter-Panel (blauer Ring, X oben rechts im padding-top-Freiraum). Bei
   sieben Aktionen auf kleinen Handys scrollt das Blatt innen, statt über
   die Kopfzeile zu wachsen. */
.action-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 32;
  margin: 0 auto;
  width: 100%;
  max-width: 760px;
  background: var(--surface-0);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 44px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 0 0 2px var(--brand-deep), 0 -10px 36px rgba(6, 97, 156, 0.28);
  max-height: 80vh;
  overflow-y: auto;
}
.action-sheet .filter-close { display: flex; }
.sheet-title { font-size: 16px; margin: 0 0 12px; }
/* Info-Knopf links neben dem X (X sitzt bei right: 8px, 40px breit). */
.sheet-info-btn {
  position: absolute;
  top: 8px;
  right: 56px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--brand-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
/* Die aufklappbaren Erklärungen über den Aktions-Knöpfen. */
.sheet-info {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px;
  background: var(--baby-blue);
  border-radius: var(--radius-small);
  font-size: 13px;
}
.sheet-info p { margin: 0; }
.sheet-info b { color: var(--brand-deep); }
/* Im Blatt reichen kompakte Knöpfe — sieben Stück in voller 56px-Höhe
   fräßen auf dem Handy das halbe Bild. */
.action-sheet .btn { min-height: 44px; font-size: 14px; }

/* ── Protokoll ─────────────────────────────────────────────────────────── */

.log-list { display: grid; gap: 4px; }
.log-entry { padding: 10px 0; }
.log-entry + .log-entry { box-shadow: inset 0 2px 0 var(--surface-1); }
.log-line { font-size: 14px; }
.log-line b { font-weight: 600; }
.log-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.log-diff { font-size: 12px; color: var(--brand-tertiary); margin-top: 4px; }

/* ── Info: Standardwerte ───────────────────────────────────────────────── */

/* Anders als .kv (zweispaltig, Wert rechts) stehen die Werte hier UNTER der
   Beschriftung — sie sind ganze Sätze und würden rechtsbündig umbrechen. */
.info-kv { display: grid; gap: 0; margin: 0; }
.info-kv > div { padding: 8px 0; }
.info-kv > div + div { box-shadow: inset 0 2px 0 var(--surface-1); }
.info-kv dt { color: var(--text-muted); font-size: 13px; margin: 0; }
.info-kv dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }

/* Ein Block je Rolle (live aus trial_config): Rollen-Chip + Stand-Datum
   oben, darunter die Werte. */
.info-role { padding: 10px 0 2px; }
.info-role + .info-role { box-shadow: inset 0 2px 0 var(--surface-2); }
.info-role-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.info-updated { font-size: 12px; color: var(--text-muted); }

/* ── Dialog, Toast, Spinner ────────────────────────────────────────────── */

dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(6, 97, 156, 0.25);
  padding: 0;
  width: min(92vw, 440px);
}
dialog::backdrop { background: rgba(13, 27, 42, 0.45); }
/* Eingabefeld + Einheiten-Auswahl (Monate/Tage/Stunden) nebeneinander;
   ohne Einheiten füllt das Feld die ganze Breite. Die Regel braucht
   .field davor, weil ".field span" (die Feld-Beschriftungen) sonst
   gewinnt und die Zeile zum Block mit Beschriftungs-Schrift macht. */
.field .confirm-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-strong);
}
.confirm-input-row input { flex: 1; min-width: 0; }
.confirm-input-row select { flex: none; width: 130px; }
.dialog-body { padding: 20px; }
.dialog-body h2 { margin: 0 0 8px; font-size: 17px; }
.dialog-body p { margin: 0 0 12px; font-size: 14px; color: var(--text-muted); }
.dialog-buttons { display: grid; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--text-strong);
  color: #fff;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  max-width: 92vw;
}
.toast[hidden] { display: none; }

.loading { display: flex; justify-content: center; padding: 24px; }
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid var(--surface-2);
  border-top-color: var(--brand-accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Support-Portal ────────────────────────────────────────────────────────
   Ticketliste als Karten-Knöpfe, Verlauf als Chat-Blasen (Nutzer links,
   eigene Antworten rechts auf Brand-Blau), Antwortfeld mit drei Knöpfen. */

/* Roter Offen-Zähler am Menüpunkt „Support". */
.menu-badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent-danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* Suchfeld mit Lupe und feinem Rahmen — die Lupe liegt IM Feld, das
   Eingabefeld bekommt links Platz dafür. */
.search-wrap { position: relative; margin-bottom: 10px; }
.search-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap .search {
  padding-left: 44px;
  box-shadow: inset 0 0 0 1.5px rgba(6, 97, 156, 0.25);
}
/* Erste Zeile: die Status-Tabs (Ort). Zweite Zeile (.support-filters):
   „Meine" und der Sortierung-Knopf (Zusatzfilter) — getrennt, weil Tabs
   und Chips verschieden hoch sind und gemischt die Zeile zerreißen. */
.support-tabs {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.support-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
/* Auf dem grauen Seitengrund braucht der Chip eine sichtbare Kante —
   sein Standard-Grau ist derselbe Ton wie die Seite. */
.support-filters .chip-btn {
  background: var(--surface-0);
  box-shadow: inset 0 0 0 1.5px var(--surface-2);
}
.support-filters .chip-btn.active { background: var(--brand-deep); box-shadow: none; }
/* Der Sortierung-Knopf sitzt rechts in der Filter-Leiste; sein Menü
   klappt nach UNTEN auf (anders als das Senden-Menü im Composer — hier
   ist darunter Platz, darüber die Kopfzeile). */
.sort-wrap { position: relative; margin-left: auto; }
#support-sort-btn { display: flex; align-items: center; gap: 4px; }
/* Doppelklasse mit Bedacht: Die Basis-Regel .send-menu steht WEITER UNTEN
   in der Datei und setzt bottom — mit nur .sort-menu gewännen beide
   Anker (top UND bottom) und die Box würde auf Höhe null gequetscht,
   die Einträge liefen transparent über die Seite. */
.send-menu.sort-menu { bottom: auto; top: calc(100% + 8px); }
.sort-menu .send-option.active { color: var(--brand-deep); background: var(--baby-blue); }
.chip-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-1);
  color: var(--text-strong);
  cursor: pointer;
}
.chip-btn.active { background: var(--brand-deep); color: #fff; }

/* Tab-Stil wie in der App: Text, darunter je Tab ein Indikator — der
   aktive ein blauer Strich, die übrigen ein grauer Punkt (kein gefüllter
   Chip, der Ort erkennt sich an der Markierung darunter). */
.tab-btn {
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 2px;
  text-align: center;
}
.tab-btn.active { color: var(--brand-deep); }
.tab-btn::after {
  content: '';
  display: block;
  margin: 6px auto 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  transition: width 0.2s ease, background 0.2s ease;
}
.tab-btn.active::after { width: 26px; background: var(--brand-deep); }

/* minmax(0, 1fr): Ohne das darf die Spalte so breit werden wie ihr
   breitester Inhalt — eine lange Nachricht (Schnipsel steht auf nowrap)
   schöbe die Karten über den Bildschirmrand hinaus. */
.ticket-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ticket-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  font: inherit;
  cursor: pointer;
  background: var(--surface-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
/* Offen/beantwortet ohne Zuweisung: roter Ring — niemand kümmert sich. */
.ticket-row.unassigned {
  box-shadow: inset 0 0 0 2px rgba(214, 69, 69, 0.55), var(--shadow);
}
.ticket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
/* Höchstens zwei Zeilen Betreff, dann … — ein Roman gehört in den Verlauf. */
.ticket-subject {
  font-weight: 700;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.ticket-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; }
.ticket-user { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-snippet {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticket-time { margin-top: 4px; color: var(--text-muted); font-size: 12px; }

.ticket-thread { display: flex; flex-direction: column; gap: 10px; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
  max-width: 85%;
  border-radius: 16px 16px 16px 4px;
  background: var(--surface-1);
  padding: 10px 12px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.mine {
  background: var(--brand-deep);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.bubble img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
}
.bubble-meta { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.bubble.mine .bubble-meta { color: rgba(255, 255, 255, 0.75); }
.bubble-missing { color: var(--text-muted); }

/* Die Zuweisungs-Auswahl im Ticket-Kopf: dezent im Textmaß statt des
   52px-Formularfelds — der Pfeil des Browsers zeigt schon, dass es eine
   Auswahl ist; dazu nur ein feiner farbiger Rahmen. */
.assign-select {
  width: auto;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-deep);
  background: var(--surface-0);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1.5px rgba(6, 97, 156, 0.3);
}

/* Composer wie in der App: Bild-Knopf links, runde Eingabe, Senden-Kreis
   rechts. Der kleine Pfeil daneben klappt die Zusatz-Aktionen nach OBEN auf
   (die Karte klebt am unteren Rand — nach unten liefe das Menü aus dem
   Bild). Unten angeheftet wie das Aktions-Blatt (fixed, mittig, Seiten-
   breite); den Freiraum am Seitenende hält --composer-h frei, gemessen in
   admin.js, sonst verdeckte die Karte das Ende des Verlaufs. */
.composer-card {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  margin: 0 auto;
  width: 100%;
  max-width: 760px;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 24px rgba(6, 97, 156, 0.16);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
}
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer-icon {
  border: 0;
  background: none;
  color: var(--brand-deep);
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.composer-icon:hover { background: var(--baby-blue); }
.composer-input {
  flex: 1;
  min-width: 0;
  border: 0;
  resize: none;
  font: inherit;
  color: var(--text-strong);
  background: var(--surface-1);
  border-radius: 22px;
  padding: 11px 16px;
  min-height: 44px;
  max-height: 132px;
  outline: 2px solid transparent;
}
.composer-input:focus { outline-color: var(--brand-deep); background: var(--surface-0); }
.send-wrap { position: relative; display: flex; align-items: center; gap: 2px; flex: none; }
.composer-send {
  border: 0;
  background: var(--brand-deep);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.composer-send:disabled { opacity: 0.55; cursor: default; }
.composer-caret {
  border: 0;
  background: none;
  color: var(--brand-deep);
  width: 28px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
}
.composer-caret:hover { background: var(--baby-blue); }
.send-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 230px;
  background: var(--surface-0);
  border-radius: var(--radius-small);
  /* Feiner blauer Ring + kräftiger Schatten: Seite und Menü sind beide
     hell — ohne sichtbare Kante schwebte hier nur loser Text. */
  box-shadow: 0 0 0 1.5px rgba(6, 97, 156, 0.3),
              0 12px 32px rgba(6, 97, 156, 0.3);
  padding: 6px;
  z-index: 25;
  display: grid;
  gap: 2px;
}
.send-option {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--text-strong);
  text-align: left;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 10px;
  cursor: pointer;
}
.send-option:hover { background: var(--surface-1); }
.send-option.danger { color: var(--accent-danger); }

/* Eigene Combo-Boxen im Aktions-Blatt: Knopf im Formularfeld-Maß, das
   Menü klappt IN-FLOW darunter auf (position: static schlägt das
   absolute der Basis-Klasse) — absolut positioniert schnitte das
   overflow-y des Blatts die Liste ab. */
.combo-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--surface-1);
  padding: 0 14px;
  font: inherit;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}
.combo-btn svg { color: var(--text-muted); flex: none; }
.send-menu.combo-menu { position: static; margin-top: 6px; }

/* ── Standardwerte ändern ────────────────────────────────────────────────
   Der Warnhinweis steht IMMER über den Formularen: roter Innen-Ring statt
   1px-Rahmen (Kinetic Guardian), Text in voller Stärke — das ist keine
   Randnotiz. */
.config-warn {
  box-shadow: inset 0 0 0 2px rgba(214, 69, 69, 0.45), var(--shadow);
}
.config-warn p {
  margin: 0;
  font-size: 14px;
  color: var(--text-strong);
}
.config-role .hint { margin-top: 0; margin-bottom: 0; }
/* Deutlicher Rollen-Kopf: großer Name in Markenblau, Trennlinie darunter —
   die Karten sollen sich auf einen Blick auseinanderhalten lassen. */
.config-role-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  box-shadow: inset 0 -2px 0 var(--surface-2);
}
.config-role-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-deep);
}
#config-save { margin: 2px 0 14px; }

/* ── Ansicht: Mitteilungen ─────────────────────────────────────────────── */

/* Das Text-Feld des Formulars in derselben Machart wie die Eingaben —
   textarea steht nicht in der globalen .field-Regel. */
.field textarea {
  width: 100%;
  border: 0;
  background: var(--surface-1);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  font: inherit;
  color: var(--text-strong);
  outline: 2px solid transparent;
  resize: vertical;
}
.field textarea:focus { outline-color: var(--brand-deep); background: var(--surface-0); }
/* Datei-Feld: die 52px-Mindesthöhe zentriert den Dateinamen vertikal. */
.field input[type="file"] { padding-top: 13px; }

/* Überschrift und der dezente Neu-Knopf in einer Zeile. */
.notices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notices-head .page-title { margin: 4px 0 12px; }
#notice-new { flex: none; }
.notice-form-buttons {
  display: flex;
  gap: 10px;
}
.notice-form-buttons .btn { flex: 1; }
.notice-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.notice-head .notice-del { margin-left: auto; }
.notice-title { margin: 0 0 6px; font-size: 16px; }
/* Zeilenumbrüche aus der Textarea bleiben sichtbar. */
.notice-body {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-strong);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.notice-thumb {
  display: block;
  max-width: 320px;
  width: 100%;
  border-radius: var(--radius-small);
  margin-bottom: 10px;
}
