/* =========================================================================
   lgnu — Design-System (helles Theme, Feuerwehr-Palette). Mobile-first.
   Struktur an Hub angelehnt, chromatisch Feuerwehr Stadt Düren.
   ========================================================================= */

:root {
  /* Marke */
  --rot:        #E2001A;   /* Primär / Aktion (sparsam einsetzen) */
  --rot-dark:   #B60016;   /* Hover/aktiv */
  --grau:       #58585A;   /* Struktur / Neutral */
  --gold:       #F4B400;   /* Akzent (sehr sparsam) */
  --gruen:      #2E7D32;   /* Erfolg / abgeschlossen */

  /* Flächen & Text */
  --bg:         #F4F5F7;
  --surface:    #FFFFFF;
  --surface-2:  #FAFAFB;
  --text:       #1C1C1E;
  --muted:      #6B6B70;
  --border:     #E3E4E8;
  --border-strong: #CFD0D6;

  /* Tints (Badges, Ampel-Zustände, Hover) — zentral statt verstreute Literale */
  --tint-rot:      #FDE7E9;   /* Rollen-Badge / gesperrt / Fehlerfläche */
  --tint-grau:     #EEEEF0;   /* neutrale Badge */
  --tint-hover:    #F0F0F2;   /* Hover-Fläche */
  --tint-gruen:    #E6F4E8;   /* aktiv / abgeschlossen */
  --tint-gruen-bd: #C3E4C8;
  --tint-gold:     #FFF6DB;   /* in Bearbeitung / geschützt / kein Passwort */
  --tint-gold-bd:  #F3E3A6;

  /* Status-Pill-Vollfarben (Ticket-Detail + Inbox teilen sich diese) */
  --st-eingang:        #F6A6A6;
  --st-in_bearbeitung: #F7BE7C;
  --st-warten_extern:  #90C2F0;
  --st-abgeschlossen:  #8FDDA0;

  /* Maße */
  --header-h:   56px;
  --control-h:  44px;       /* handytaugliche Tap-Größe */
  --radius:     12px;
  --radius-sm:  8px;
  --content-max: 720px;
  --gap:        16px;

  --shadow:     0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: 40px;
}
body.no-scroll { overflow: hidden; }

a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }

/* =========================================================================
   GLOBALE HEADERZEILE  (Logo links · Burger rechts)
   ========================================================================= */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
  background: var(--surface);
  border-bottom: 3px solid var(--rot);
  z-index: 100;
}
.app-header__left  { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.app-header__right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.app-header__brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.app-header__brand:hover { text-decoration: none; }
.app-header__logo { height: 34px; width: auto; display: block; }
.app-header__unit { font-weight: 700; font-size: 15px; color: var(--grau); letter-spacing: .01em; white-space: nowrap; }
.app-header__sep  { color: var(--muted); flex: 0 0 auto; }
.app-header__page { font-size: 15px; color: var(--grau); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header__user { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--grau); font-weight: 600; font-size: 14px; max-width: 150px; }
.app-header__user:hover { text-decoration: none; }
.app-header__user-ic { flex: 0 0 auto; }
.app-header__user-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header__login { text-decoration: none; color: var(--rot); font-weight: 600; font-size: 14px; }
@media (max-width: 560px) {
  .app-header__unit, .app-header__sep { display: none; }
  .app-header__user { max-width: 108px; }
}
@media (max-width: 400px) {
  .app-header__user-nm { display: none; }
}
/* Header-Zustände (Dirty/Error) — signalisieren ungespeicherte Änderungen / Fehler */
.app-header--dirty { border-bottom-color: var(--gold); }
.app-header--error { animation: headerErrorPulse 1s ease-in-out infinite; }
@keyframes headerErrorPulse { 0%, 100% { border-bottom-color: var(--rot); } 50% { border-bottom-color: #FF7A88; } }

.burger {
  width: 44px; height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: none; border: none; cursor: pointer; padding: 0;
}
.burger span {
  display: block; width: 22px; height: 2.5px; border-radius: 2px;
  background: var(--grau); transition: transform .2s, opacity .2s;
}

/* Burger-Menü (Slide-in von rechts) */
.menu-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 110;
}
.menu-overlay.active { opacity: 1; pointer-events: auto; }
.menu {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(82vw, 320px);
  background: var(--surface);
  box-shadow: -8px 0 24px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s ease;
  z-index: 120; padding: 12px 12px 20px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.menu.open { transform: translateX(0); }
.menu__close {
  align-self: flex-end; flex: 0 0 auto;
  width: 40px; height: 40px; border: none; background: none;
  font-size: 22px; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm);
}
.menu__close:hover { background: var(--surface-2); }
.menu__item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; text-decoration: none;
}
.menu__item:hover { background: var(--surface-2); text-decoration: none; }
.menu__icon { font-size: 20px; width: 24px; text-align: center; }
.menu__group {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 12px 12px 4px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.menu__logout { margin: 0; }
.menu__item--btn { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }

/* Wartungsmodus — Burger-Toggle (Farbe wechselt mit Zustand) + Header-Indikator */
.menu__maint-form { margin: 0; }
.menu__maint { font-weight: 600; transition: background .15s, color .15s, opacity .15s; } /* wie die <a>-Einträge — .menu__item--btn font:inherit würde sonst auf 400 fallen */
.menu__maint.is-off:hover { background: var(--surface-2); }
.menu__maint.is-on {
  background: #FDEBEC; color: var(--rot-dark);
  box-shadow: inset 3px 0 0 var(--rot);
}
.menu__maint.is-on:hover { background: #FBDDE0; }
.app-header__maint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); /* horizontal mittig im Header */
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; line-height: 1;
  color: var(--rot-dark); background: #FDEBEC; border: 1px solid #F6C9CE;
  text-decoration: none; letter-spacing: .01em;
}
.app-header__maint-ic { font-size: 13px; line-height: 1; display: block; position: relative; top: -0.5px; }
.app-header__maint:hover { background: #FBDDE0; text-decoration: none; }
@media (max-width: 380px) { .app-header__maint { padding: 3px 7px; font-size: 11.5px; } }

/* =========================================================================
   LAYOUT + zentrale Page-Kopfzeile
   ========================================================================= */
.wrapper {
  padding-top: calc(var(--header-h) + 16px);
  padding-left: 16px; padding-right: 16px;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Page-Kopf: kleiner Zurück-Button links · Titel · Actions rechts */
.page-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 20px;
}
.page-kopf__actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.btn-icon {
  flex: 0 0 auto;
  width: var(--control-h); height: var(--control-h);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  color: var(--grau);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); text-decoration: none; cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); text-decoration: none; }
.btn-icon--placeholder { visibility: hidden; }
.btn-icon svg { display: block; }

/* Großer Footer-Zurück-Button — steckt bereits in .wrapper (max-width + Padding),
   daher hier KEINE zweite Begrenzung: Button exakt content-breit. */
.footer-back { margin-top: 32px; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 18px;
  font-size: 16px; font-weight: 600; line-height: 1;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-block { width: 100%; }
.btn svg { display: block; flex: 0 0 auto; }

.btn-primary   { background: var(--rot); color: #fff; }
.btn-primary:hover { background: var(--rot-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost     { background: transparent; color: var(--grau); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* =========================================================================
   CARDS
   ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: var(--gap);
}
.card__title { font-size: 17px; margin: 0 0 8px; }

/* =========================================================================
   FORMULAR-FELDER
   ========================================================================= */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--grau); }
.field-error { color: var(--rot); font-size: 13px; font-weight: 600; margin-top: 6px; }

.input, select.input, textarea.input {
  width: 100%; min-height: var(--control-h);
  padding: 10px 12px; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); appearance: none; -webkit-appearance: none;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus {
  outline: none; border-color: var(--rot);
  box-shadow: 0 0 0 3px rgba(226,0,26,.15);
}
.input::placeholder { color: #A6A7AD; }

/* Select: sichtbarer Chevron, damit als Dropdown erkennbar */
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%2358585A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}

/* =========================================================================
   FLASH
   ========================================================================= */
.flash {
  position: fixed; top: calc(var(--header-h) + 8px); left: 50%;
  transform: translateX(-50%);
  max-width: calc(var(--content-max) - 32px); width: calc(100% - 32px);
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow);
  border-left: 4px solid var(--grau); z-index: 200;
  animation: flashIn .25s ease forwards;
}
.flash.flash--out { animation: flashOut .22s ease forwards; }
@keyframes flashIn  { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes flashOut { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -10px); } }
.flash--success { border-left-color: var(--gruen); }
.flash--error   { border-left-color: var(--rot); }
.flash--warning { border-left-color: var(--gold); }
.flash--info    { border-left-color: var(--grau); }
.flash__text { font-size: 15px; }

/* =========================================================================
   STATUS-BADGES (Ticket-Status-Semantik) — Schrift IMMER schwarz (Lesbarkeit)
   ========================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.4;
  color: var(--text);
  border: 1px solid transparent;
}
.badge--eingang       { background: var(--tint-grau); }
.badge--bearbeitung   { background: var(--tint-gold); border-color: var(--tint-gold-bd); }
.badge--extern        { background: var(--tint-rot); border-color: #F6C3C9; }
.badge--abgeschlossen { background: var(--tint-gruen); border-color: var(--tint-gruen-bd); }

/* =========================================================================
   HERO (Startseite, nicht eingeloggt)
   ========================================================================= */
.hero { text-align: center; padding: 8px 0 4px; }
.hero__logo { max-width: 260px; width: 70%; height: auto; margin: 8px auto 20px; display: block; }
.hero__img {
  width: 100%; height: auto; border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 8px 0 24px;
}
.hero__title { font-size: 24px; margin-bottom: 6px; }
.hero__sub { color: var(--muted); margin: 0 auto 24px; max-width: 44ch; }
.hero__actions { display: flex; flex-direction: column; gap: 12px; max-width: 340px; margin: 0 auto; }
.hero__cta { display: flex; flex-direction: column; gap: 12px; }

/* Kleiner Muted-Text / Hinweis */
.muted { color: var(--muted); }
.note {
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--muted);
  font-size: 14px;
}

/* =========================================================================
   AUTH (Login / Registrieren / Profil)
   ========================================================================= */
.auth-card { max-width: 420px; margin: 8px auto; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; font-size: 15px; cursor: pointer; }
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--rot); flex: 0 0 auto; }
.auth-alt { text-align: center; margin: 16px 0 0; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 0; }

/* Live-Verfügbarkeit (Username/E-Mail): Status-Indikator rechts IM Feld.
   JS (user-availability-check.js) wrappt den Input dynamisch in
   <span class="avail-wrap">, darin sitzt der Indikator absolute. */
.avail-wrap { position: relative; display: flex; align-items: stretch; width: 100%; }
.avail-wrap > .input { padding-right: 36px; flex: 1; min-width: 0; }
.avail-indicator {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; line-height: 1; cursor: help;
}
.avail-indicator--ok    { color: var(--gruen); }
.avail-indicator--taken { color: var(--rot); }

/* =========================================================================
   CREW CONTROL
   ========================================================================= */
.badge--aktiv      { background: var(--tint-gruen); border-color: var(--tint-gruen-bd); }
.badge--gesperrt   { background: var(--tint-grau); }
.badge--geschuetzt { background: var(--tint-gold); border-color: var(--tint-gold-bd); }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check-item input { width: 20px; height: 20px; accent-color: var(--rot); flex: 0 0 auto; }
.check-item.is-disabled { opacity: .45; cursor: not-allowed; }

/* Crew Control — Akkordeon-Karten + Detail */
.hint { font-size: 12px; color: var(--muted); margin: 4px 0; }
/* Variante B — dunkleres Rot, gefüllt: klar von „Speichern" (helles Rot) abgesetzt. */
.btn-danger { background: var(--rot-dark); color: #fff; }
.btn-danger:hover { background: #8A0011; }

.create-box { display: none; }
.create-box.is-open { display: block; }
.setup-box { border-color: var(--tint-gruen-bd); background: #F2FBF4; }
.setup-row { display: flex; gap: 8px; align-items: center; }
.setup-row .input { flex: 1 1 auto; }
.setup-row .btn { flex: 0 0 auto; }

.crew-user { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 7px; box-shadow: var(--shadow); overflow: hidden; }
.crew-user.is-locked { border-color: #F6C3C9; }
.crew-user__header { display: flex; align-items: stretch; }
.crew-user__headmain {
  flex: 1 1 auto; min-width: 0; padding: 9px 12px; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; column-gap: 10px;
  grid-template-areas: "name dot" "meta meta" "badges badges";
}
.crew-user__name { grid-area: name; font-weight: 700; font-size: 15px; line-height: 1.25; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.crew-user__dot { grid-area: dot; display: flex; align-items: center; gap: 6px; justify-self: end; align-self: start; padding-top: 3px; }
.crew-user__metagroup { grid-area: meta; margin-top: 2px; }
.crew-user__badgegroup { grid-area: badges; margin-top: 7px; }
.crew-meta { font-size: 12px; color: var(--muted); word-break: break-word; line-height: 1.4; }
.crew-meta--sub { font-size: 11px; color: #9A9AA0; margin-top: 1px; }
.crew-user__badges { display: flex; flex-wrap: wrap; gap: 5px; }
.crew-user__status { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
/* Quali-Pills immer in eine eigene Zeile unter die Rollen (mobil wie desktop). */
.crew-badge-break { display: block; flex-basis: 100%; height: 0; }
/* Desktop: Badges als rechte Spalte neben der Meta (spart Höhe, wie Hub). */
@media (min-width: 641px) {
  .crew-user__headmain { grid-template-areas: "name dot" "meta badges"; }
  .crew-user__badgegroup { justify-self: end; margin-top: 0; display: flex; flex-direction: column; align-items: flex-end; max-width: 340px; }
  .crew-user__badges, .crew-user__status { justify-content: flex-end; }
}
/* Aufklapp-Knopf rechts an Karten/Einträgen (Crew + Audit teilen sich das). */
.crew-toggle, .audit-toggle { min-width: 40px; align-self: stretch; border: 0; border-left: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.crew-toggle:hover, .audit-toggle:hover { background: var(--tint-hover); }
/* Zentrales Chevron: ▼ rechts am Element, dreht 180° wenn das Eltern-Element
   offen ist. Gilt für Karten, Audit-Einträge, Filter-Buttons und die Legende. */
.chev { display: inline-block; transition: transform .18s ease; }
.crew-user.is-open .chev,
.audit-entry.is-open .chev,
.filter-btn.open .chev,
.multi-dropdown.open .chev,
.crew-legend[open] summary .chev { transform: rotate(180deg); }
.crew-user__body { display: none; padding: 0 12px 12px; border-top: 1px solid var(--border); }
.crew-user.is-open .crew-user__body { display: block; }
.crew-section-title { font-size: 14px; font-weight: 600; color: var(--grau); margin: 18px 0 8px; }
.crew-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.crew-actions form { margin: 0; }

.ubadge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; }
.ubadge--role { background: var(--tint-rot); }
.ubadge--qual { background: #ECEEF2; }
.ubadge--active { background: var(--tint-gruen); }
.ubadge--inactive { background: var(--tint-grau); }
.ubadge--locked { background: var(--tint-rot); }
.ubadge--nopw { background: var(--tint-gold); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.status-dot--online  { background: #22C55E; }
.status-dot--recent  { background: #EAB308; }
.status-dot--old     { background: #EF4444; }
.status-dot--veryold { background: #9CA3AF; }
.status-dot--never   { background: #D1D5DB; }
.status-dot--blocked { background: #374151; }

/* Such-/Filterleiste + aufklappbare Status-Legende */
.crew-filter { margin-bottom: 14px; }
.crew-filter > .input { margin-bottom: 8px; }
.crew-filter-actions { display: flex; gap: 8px; }
.crew-filter-actions .filter-btn { flex: 1 1 0; justify-content: center; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; color: var(--grau); cursor: pointer; }
.filter-btn:hover { background: var(--surface-2); }
.filter-btn.filters-active { border-color: var(--rot); color: var(--rot); }
/* .filter-btn nutzt das zentrale .chev (Rotation oben) */
.crew-filter-content { margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.crew-filter-title { font-size: 12px; font-weight: 600; color: var(--grau); margin: 10px 0 6px; }
.crew-filter-title:first-child { margin-top: 0; }
.crew-filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; user-select: none; }
.filter-pill input { display: none; }
.filter-pill:has(input:checked), .filter-pill.is-active { background: var(--tint-rot); border-color: var(--rot); color: var(--rot); }
.crew-summary { font-size: 13px; margin: 8px 0 0; }
.crew-empty { text-align: center; padding: 20px; font-size: 14px; }
.crew-legend { margin-top: 12px; }
.crew-legend summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--grau); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.crew-legend summary::-webkit-details-marker { display: none; }
.crew-legend summary .chev { color: var(--muted); }
.crew-legend__items { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* Allgemeine (nicht feldgebundene) Fehlerbox */
.alert { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.alert.error { background: var(--tint-rot); border: 1px solid #F5C2C7; color: #8A1C25; }

/* Benachrichtigungszentrale: Zeile + An/Aus-Schalter */
.notify-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.notify-item:last-child { border-bottom: none; padding-bottom: 0; }
.notify-item__main { flex: 1; min-width: 0; }
.notify-item__label { font-weight: 600; font-size: 15px; }
.notify-item__desc { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.notify-toggle { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; cursor: pointer; user-select: none; font-size: 13px; font-weight: 600; }
.notify-toggle span { padding: 6px 14px; color: var(--muted); transition: background .15s, color .15s; }
.notify-toggle[data-on="0"] .notify-half-off { background: var(--grau); color: #fff; }
.notify-toggle[data-on="1"] .notify-half-on { background: var(--rot); color: #fff; }
.notify-intro { font-size: 14px; margin: 0 0 14px; }
.notify-group__label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }

/* Audit-Log */
.crew-audit-link { text-decoration: none; font-size: 15px; margin-left: 2px; opacity: .8; }
.crew-audit-link:hover { opacity: 1; text-decoration: none; }
.audit-daterow { display: flex; flex-wrap: wrap; gap: 10px; }
.audit-daterow label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--grau); }
.audit-daterow .input { width: auto; }
.audit-entry { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.audit-entry__head { display: flex; align-items: stretch; }
.audit-entry__main { flex: 1 1 auto; min-width: 0; padding: 11px 14px; cursor: pointer; }
.audit-entry__time { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.audit-action { display: block; font-weight: 700; color: var(--rot); font-size: 14px; margin-top: 2px; }
.audit-entry__actors { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; margin-top: 4px; }
.audit-ip { color: var(--muted); font-weight: 400; }
.audit-target { font-weight: 600; }
.audit-arrow { color: var(--muted); margin: 0 2px; }
.audit-dim { color: var(--muted); }
/* .audit-toggle teilt sich die Regel mit .crew-toggle (siehe oben) */
.audit-entry:not(.is-open) .audit-entry__body { display: none; }
.audit-entry__body { padding: 8px 14px 12px; border-top: 1px solid var(--border); }
.audit-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row__key { color: var(--muted); font-weight: 600; }
.audit-row__val { min-width: 0; overflow-wrap: anywhere; }
.audit-tree-nest { margin: 2px 0 2px 2px; padding-left: 10px; border-left: 1px solid var(--border); }
.audit-tree-key { color: var(--muted); font-weight: 600; }
@media (max-width: 520px) { .audit-row { grid-template-columns: 1fr; gap: 2px; } }

/* Multi-Select-Dropdown (Aktionen, Quellen) */
.multi-dropdown { position: relative; }
.multi-dropdown-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; font-weight: 600; color: var(--grau); cursor: pointer; }
.multi-dropdown-toggle:hover { background: var(--surface-2); }
.multi-dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 950; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; box-shadow: 0 10px 24px rgba(0,0,0,.14); max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
.multi-dropdown-option { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.multi-dropdown-option:hover { background: var(--surface-2); }
.multi-dropdown-option input { margin: 0; accent-color: var(--rot); flex: 0 0 auto; }
.multi-dropdown-separator { height: 1px; margin: 4px 0; background: var(--border); }
.multi-dropdown-action { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); }
.multi-dropdown-action:hover { background: var(--surface-2); }
.audit-source-dropdown { width: auto; }
.audit-source-dropdown .multi-dropdown-toggle { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
.audit-source-dropdown .multi-dropdown-menu { min-width: 200px; left: auto; right: 0; }

.phone-action { text-decoration: none; font-size: 15px; }
.phone-action:hover { text-decoration: none; }

/* =========================================================================
   GRÖSSERE SCREENS (Desktop mitlaufend)
   ========================================================================= */
@media (min-width: 720px) {
  .app-header { padding: 0 20px; }
  .app-header__logo { height: 38px; }
  .hero__actions { display: inline-flex; max-width: none; }
  .hero__cta { flex-direction: row; justify-content: center; }
  .hero__cta .btn { min-width: 200px; }
}

/* =========================================================================
   TICKETS — MELDEN (login-freier QR-Intake, mobile-first, große Tap-Ziele)
   ========================================================================= */
.melden-intro { text-align: center; margin: 6px 0 20px; }
.melden-h1 { font-size: 22px; margin: 0 0 6px; color: var(--grau); }
.melden-sub { margin: 0; color: var(--muted); font-size: 15px; }
/* Subline: Desktop einzeilig (Segmente inline), mobil je Segment eine Zeile. */
@media (max-width: 560px) { .melden-sub__seg { display: block; } }

.melden-choice { display: grid; grid-auto-rows: 1fr; gap: 14px; max-width: 460px; margin: 0 auto; }
.melden-portal { max-width: 340px; margin: 18px auto 0; } /* so breit wie die Hero-Buttons (.hero__actions) */
.melden-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px; min-height: 44px;
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--rot);
  border-radius: var(--radius); text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .06s ease, box-shadow .12s ease, border-color .12s ease;
}
.melden-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.10); text-decoration: none; }
.melden-card:active { transform: translateY(1px); }
.melden-card__ic { font-size: 28px; line-height: 1; flex: 0 0 auto; }
.melden-card__body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; }
.melden-card__title { font-size: 17px; font-weight: 700; color: var(--grau); }
.melden-card__desc { font-size: 14px; color: var(--muted); line-height: 1.35; }
.melden-card__arrow { font-size: 26px; color: var(--rot); flex: 0 0 auto; font-weight: 700; }

/* --- Funnel-Formular + Stepper --- */
.melden-form { max-width: 460px; margin: 0 auto; }
.melden-form .field { margin: 0 0 14px; }
.melden-form label:not(.melden-confirm):not(.tk-upload__btn) { display: block; font-size: 14px; font-weight: 600; color: var(--grau); margin: 0 0 6px; }
.melden-form .input,
.melden-form select,
.melden-form textarea {
  width: 100%; min-height: 48px; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); box-sizing: border-box; font-family: inherit;
}
.melden-form textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
.melden-form .input:focus,
.melden-form select:focus,
.melden-form textarea:focus { outline: none; border-color: var(--rot); box-shadow: 0 0 0 3px var(--tint-rot); }

.melden-progress { margin: 0 0 18px; }
.melden-progress__label { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.melden-progress__track { height: 8px; background: var(--tint-grau); border-radius: 99px; overflow: hidden; }
.melden-progress__fill { height: 100%; width: 33%; background: var(--rot); border-radius: 99px; transition: width .25s ease; }

.melden-step { display: none; }
.melden-step.is-active { display: block; animation: meldenFade .2s ease; }
@keyframes meldenFade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.melden-step__title { font-size: 19px; font-weight: 700; color: var(--grau); margin: 0 0 14px; }

.melden-nav { display: flex; gap: 10px; margin-top: 18px; }
.melden-nav .btn { min-height: 48px; }
.melden-nav .btn--grow { flex: 1 1 auto; }
.melden-nav .btn--back { flex: 0 0 auto; min-width: 64px; }

.melden-review { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--tint-grau); padding: 4px 12px; margin: 0 0 16px; }
.melden-review__row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.melden-review__row:last-child { border-bottom: none; }
.melden-review__row span { color: var(--muted); flex: 0 0 auto; }
.melden-review__row b { color: var(--text); text-align: right; font-weight: 600; }

.melden-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 2px; font-size: 15px; cursor: pointer; color: var(--text); }
.melden-confirm input { width: 20px; height: 20px; margin-top: 1px; flex: 0 0 auto; }
.melden-confirm-email { margin: 10px 0 0; }
.melden-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.melden-form .input--invalid { border-color: var(--rot); box-shadow: 0 0 0 3px var(--tint-rot); }

/* Honeypot — für Menschen unsichtbar, Bots füllen es aus */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Danke/Quittung --- */
.melden-danke { max-width: 460px; margin: 8px auto 0; text-align: center; }
.melden-danke__ic { width: 72px; height: 72px; margin: 8px auto 16px; border-radius: 50%; background: var(--tint-gruen); color: #2e7d32; font-size: 38px; line-height: 72px; border: 1px solid var(--tint-gruen-bd); }
.melden-danke__title { font-size: 21px; color: var(--grau); margin: 0 0 10px; }
.melden-danke__nr { font-size: 16px; margin: 0 0 6px; }
.melden-danke__nr strong { color: var(--rot); letter-spacing: .02em; }
.melden-danke__actions { display: flex; gap: 10px; margin-top: 22px; }
.melden-danke__actions .btn { flex: 1 1 auto; min-height: 48px; }

/* =========================================================================
   TICKET-INBOX
   ========================================================================= */
.ticket-filter-row { display: flex; gap: 8px; margin-top: 8px; }
.ticket-filter-row .multi-dropdown { flex: 1 1 0; min-width: 0; margin: 0; }
/* Drei Dropdowns (Typ · Bereich · Status) müssen mobil nebeneinander passen → Label kürzen */
.ticket-filter-row .multi-dropdown-toggle { padding: 9px 10px; gap: 6px; }
.ticket-filter-row .multi-dropdown-toggle > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* …das aufgeklappte Menü aber NICHT auf die schmale Spaltenbreite klemmen, sonst
   werden lange Bereichsnamen abgeschnitten. Breiter machen; das letzte (Status)
   rechtsbündig, damit es nicht rechts aus dem Viewport läuft. */
.ticket-filter-row .multi-dropdown-menu { min-width: 210px; max-width: calc(100vw - 24px); }
.ticket-filter-row .multi-dropdown:last-child .multi-dropdown-menu { left: auto; right: 0; }
.ticket-filter-row .multi-dropdown-option span { white-space: nowrap; }
.ticket-filter-row--split { justify-content: space-between; }
.ticket-filter-row--split .filter-btn { flex: 0 0 auto; }

/* Ansicht-Umschalter (Page-Action) — kompakt wie .audit-source-dropdown */
.ticket-view-dropdown { width: auto; }
.ticket-view-dropdown .multi-dropdown-toggle { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
.ticket-view-dropdown .multi-dropdown-menu { min-width: 180px; left: auto; right: 0; }
.multi-dropdown-view { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); }
.multi-dropdown-view:hover { background: var(--surface-2); }

/* Status-Gruppen */
.ticket-group { margin-bottom: 4px; }
.ticket-group__title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.ticket-group__count { color: var(--border-strong); font-weight: 600; }

/* Karten */
.ticket-card { display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 14px; margin-bottom: 8px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: box-shadow .12s ease, border-color .12s ease; }
.ticket-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.09); text-decoration: none; }
.ticket-card__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket-card__row + .ticket-card__row { margin-top: 4px; }
/* Reihe 1: Typ-Pille (+ ggf. Warndreieck) links · Status rechts */
.ticket-card__typ-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ticket-card__warn { width: 15px; height: 15px; flex: 0 0 auto; display: block; }
.tk-warn { width: 1.05em; height: 1.05em; vertical-align: -0.16em; flex: 0 0 auto; }
.ticket-card__typ-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #1c1c1e; white-space: nowrap; flex: 0 0 auto; }
.ticket-card__typ-pill--schaden  { background: var(--tint-rot); }
.ticket-card__typ-pill--sonstige { background: var(--tint-grau); }
.ticket-card__nr { font-weight: 700; font-size: 13px; color: var(--grau); letter-spacing: .02em; white-space: nowrap; flex: 0 0 auto; }
/* Reihe 2: Ersteller links · 🌐 rechts (wenn öffentlich) */
.ticket-card__ersteller { font-size: 14px; font-weight: 400; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-card__status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1c1c1e; white-space: nowrap; flex: 0 0 auto; }
.ticket-card__status--eingang        { background: var(--st-eingang); }
.ticket-card__status--in_bearbeitung { background: var(--st-in_bearbeitung); }
.ticket-card__status--warten_extern  { background: var(--st-warten_extern); }
.ticket-card__status--abgeschlossen  { background: var(--st-abgeschlossen); }
/* Reihe 3: Anliegen-/Mitteilungs-Anfang (volle Breite) */
.ticket-card__snippet { font-size: 13px; font-weight: 600; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-card__public { font-size: 14px; flex: 0 0 auto; margin-left: auto; }
/* Reihe 4: Datum · Bearbeiter links · Nummer rechts */
.ticket-card__meta { font-size: 12px; color: var(--muted); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Dashboard (eingeloggte Startseite) ===== */
.dash-hello { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 0 14px; }
.dash-hello__title { font-size: 20px; font-weight: 800; color: var(--grau); margin: 0; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-hello__date { font-size: 13px; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
.dash-card { padding: 14px; }
.dash-card__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.dash-card__title--sub { margin-top: 16px; }

.dash-attn { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.dash-chip:hover { border-color: var(--border-strong); text-decoration: none; }
.dash-chip__icon { font-size: 15px; line-height: 1; }
.dash-chip__count { font-weight: 800; font-size: 15px; color: var(--rot); }
.dash-chip__label { color: var(--grau); }
.dash-chip--warn { background: var(--tint-gold); border-color: var(--tint-gold-bd); }
.dash-chip--warn .dash-chip__count { color: #1c1c1e; }
.dash-allclear { padding: 16px; font-size: 15px; font-weight: 600; color: var(--grau); text-align: center; }

.dash-event { padding: 9px 0; border-bottom: 1px solid var(--border); }
.dash-event:last-child { border-bottom: none; padding-bottom: 0; }
.dash-event:first-of-type { padding-top: 0; }
.dash-event__when { font-size: 12px; font-weight: 700; color: var(--rot); }
.dash-event__title { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 1px; }
.dash-event__loc { font-size: 13px; color: var(--muted); margin-top: 1px; }

.dash-wstatus { font-weight: 700; font-size: 15px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.dash-wstatus--open { background: var(--tint-gruen); color: #1c1c1e; }
.dash-wstatus--closed { background: var(--tint-rot); color: #1c1c1e; }
.dash-hours { margin-bottom: 10px; }
.dash-hours summary { cursor: pointer; font-size: 13px; color: var(--grau); font-weight: 600; padding: 4px 0; }
.dash-hours__tbl { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.dash-hours__tbl th { text-align: left; color: var(--grau); font-weight: 700; padding: 3px 10px 3px 0; white-space: nowrap; vertical-align: top; }
.dash-hours__tbl td { color: var(--muted); padding: 3px 0; }
.dash-phones { display: flex; flex-direction: column; gap: 6px; }
.dash-phone { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; color: var(--text); border: 1px solid transparent; }
.dash-phone:hover { border-color: var(--border-strong); text-decoration: none; }
.dash-phone__label { font-weight: 600; font-size: 14px; }
.dash-phone__nr { font-size: 14px; color: var(--rot); font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
.dash-phone--mvd { background: var(--tint-gold); }
.dash-phone--fuehrung { background: var(--tint-rot); }

.dash-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .dash-stats { grid-template-columns: repeat(4, 1fr); } }
.dash-stat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 6px; border-radius: var(--radius-sm); text-decoration: none; color: #1c1c1e; }
.dash-stat:hover { text-decoration: none; filter: brightness(.97); }
.dash-stat__num { font-size: 22px; font-weight: 800; line-height: 1; }
.dash-stat__label { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.15; }
.dash-stat--eingang { background: var(--st-eingang); }
.dash-stat--in_bearbeitung { background: var(--st-in_bearbeitung); }
.dash-stat--warten_extern { background: var(--st-warten_extern); }
.dash-stat--abgeschlossen { background: var(--st-abgeschlossen); }
.dash-einsatz__head { font-size: 13px; font-weight: 700; color: var(--grau); margin-bottom: 4px; }
.dash-einsatz__info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dash-einsatz__when { font-size: 13px; font-weight: 600; color: var(--grau); }
.dash-einsatz__stichwort { font-size: 15px; font-weight: 400; color: #1c1c1e; line-height: 1.25; }
.dash-einsatz__addr { font-size: 15px; font-weight: 400; color: #1c1c1e; line-height: 1.25; }

.dash-estats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 560px) { .dash-estats { grid-template-columns: repeat(4, 1fr); } }
.dash-estat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 6px; border-radius: var(--radius-sm); background: var(--tint-rot); }
.dash-estat__num { font-size: 20px; font-weight: 800; line-height: 1; color: #1c1c1e; }
.dash-estat__label { font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.15; color: var(--grau); }

.dash-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.dash-quick__btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--border); color: var(--grau); font-weight: 700; font-size: 16px; text-decoration: none; }
.dash-quick__btn:hover { border-color: var(--rot); color: var(--rot); text-decoration: none; }
.dash-quick__ico { font-size: 18px; line-height: 1; }

/* =========================================================================
   TICKET-DETAIL
   ========================================================================= */
.tk-detail { max-width: 100%; } /* volle Wrapper-Breite wie Audit/Inbox/Footer-Button */

.tk-head { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.tk-head__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tk-typ { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.tk-typ--schaden { background: var(--tint-rot); color: #1c1c1e; }
.tk-typ--sonstige { background: var(--tint-grau); color: #1c1c1e; }
.tk-head__versand { display: flex; gap: 8px; }
.tk-head__nr { font-weight: 700; font-size: 15px; color: var(--grau); letter-spacing: .02em; margin-left: auto; }
.tk-head__row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.tk-head__label { flex: 0 0 92px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tk-head__val { font-size: 14px; color: var(--text); }
.tk-head .tk-status-select { flex: 0 0 auto; width: auto; min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-sm { padding: 5px 12px; font-size: 13px; min-height: 0; }
.tk-head__row .btn-sm { margin-left: auto; }

.tk-freigabe { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.tk-freigabe .tk-head__versand { margin-left: auto; }
.tk-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tk-badge--wait { background: var(--tint-gold); color: #1c1c1e; }
.tk-badge--ok { background: var(--tint-gruen); color: #1c1c1e; }

/* Status als Pills (aktiv = vollfarbig · Rest ausgegraut · Schrift IMMER schwarz) */
.tk-statusbar { padding: 8px 0; border-top: 1px solid var(--border); }
.tk-statusbar .tk-head__label { display: block; margin-bottom: 8px; }
.tk-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (min-width: 620px) { .tk-pills { grid-template-columns: repeat(4, 1fr); } }
.tk-pill { border: 1px solid var(--border); background: var(--tint-grau); color: #1c1c1e; border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1.1; text-align: center; }
.tk-pill:hover { border-color: var(--border-strong); }
.tk-pills--ro .tk-pill, .tk-pills--ro .tk-pill:hover { cursor: default; border-color: var(--border); }
.tk-pill.is-active { border-color: transparent; }
.tk-pill--eingang.is-active        { background: var(--st-eingang); }
.tk-pill--in_bearbeitung.is-active { background: var(--st-in_bearbeitung); }
.tk-pill--warten_extern.is-active  { background: var(--st-warten_extern); }
.tk-pill--abgeschlossen.is-active  { background: var(--st-abgeschlossen); }

/* Drucken/Versenden Icon-Buttons (in der Kopfzeile, mittig) */
.tk-actionbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); font-size: 18px; line-height: 1; cursor: pointer; color: var(--text); text-decoration: none; }
.tk-actionbtn:hover, .tk-actionbtn:focus { background: var(--surface-2); text-decoration: none; }
.tk-actionbtn--print { width: auto; padding: 0 12px; }
.tk-actionbtn__sep { margin: 0 5px; color: var(--muted); font-size: 15px; }

/* --- Datei-Upload-Picker (Kommentar + Melden) --- */
.tk-upload { margin: 8px 0; }
.tk-upload__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-upload__drop { flex: 1 1 180px; height: var(--control-h); display: flex; align-items: center; justify-content: center; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0 14px; text-align: center; color: var(--muted); font-size: 14px; }
.tk-upload__drop.is-over { border-color: var(--rot); background: var(--tint-rot); color: var(--rot); }
.tk-upload__btn { position: relative; cursor: pointer; }
.tk-upload__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.tk-upload__list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tk-upload__item { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.tk-upload__itemname { flex: 1 1 auto; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-upload__itemedit { flex: 1 1 auto; min-width: 0; font-size: 14px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.tk-upload__act { flex: 0 0 auto; width: 32px; height: 32px; border: none; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; border-radius: var(--radius-sm); }
.tk-upload__act:hover { background: var(--surface-2); }
.tk-upload-progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.tk-upload-progress__bar { height: 100%; width: 0; background: var(--rot); transition: width .15s ease; }
/* 📷-Button + Drop-Zone: Default = Desktop-Layout (nur 📁 + Zone, KEIN 📷).
   Nur reine Touch-Geräte (Handy/Tablet, hover:none + pointer:coarse) zeigen den
   Kamera-Button und blenden die Zone aus — Touch-Laptops mit Maus NICHT (die
   `pointer:fine/coarse`-Abfrage war dort unzuverlässig). */
.tk-upload__btn--camera { display: none; }
@media (hover: none) and (pointer: coarse) {
  .tk-upload__btn--camera { display: inline-flex; }
  .tk-upload__drop { display: none; }
}
.melden-optional { color: var(--muted); font-weight: 400; font-size: 13px; }

/* --- Anhänge im Verlauf --- */
.tk-ventry__files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tk-file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: var(--text); font-size: 13px; max-width: 100%; }
.tk-file:hover { background: var(--surface-2); border-color: var(--border-strong); }
.tk-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.tk-file__size { color: var(--muted); font-size: 12px; }
.tk-file--img { flex-direction: column; align-items: flex-start; padding: 6px; gap: 4px; }
.tk-file--img img { max-width: 160px; max-height: 160px; border-radius: var(--radius-sm); display: block; }
.tk-file--img .tk-file__name { max-width: 160px; }
/* Freigeben-Button: dauerhaft unterm LGF-Bericht, linksbündig */
.tk-lgf-freigeben { margin-top: 12px; }
.tk-lgf-hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Typ-Badge als „Überführen"-Auslöser (Sonstige) */
.tk-typ--convert { font-family: inherit; cursor: pointer; border: 1px dashed transparent; }
.tk-typ--convert:hover { border-color: var(--rot); }

/* Zuweisen-Popup (Liste aller User, Klick = setzen) */
.tk-modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.tk-modal[hidden] { display: none; }
.tk-modal__box { background: #fff; border-radius: var(--radius); padding: 16px; width: 100%; max-width: 360px; max-height: 82vh; overflow-y: auto; }
.tk-modal__title { font-weight: 700; font-size: 16px; color: var(--grau); margin-bottom: 12px; }
.tk-userlist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tk-userpick { text-align: left; padding: 11px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: 15px; cursor: pointer; color: var(--text); }
.tk-userpick:hover { background: var(--surface-2); border-color: var(--border-strong); }
.tk-userpick--none { color: var(--muted); }

/* --- Versenden: Compose-Fenster --- */
.tk-modal__box--wide { max-width: 460px; }
.tk-versand__group { margin-bottom: 16px; }
.tk-versand__label { font-weight: 700; font-size: 13px; color: var(--grau); margin-bottom: 6px; }
.tk-versand__hint { margin: 0 0 8px; font-size: 13px; }
.tk-versand__sublabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 10px 0 2px; }
.tk-check--two { align-items: flex-start; }
.tk-check--two input[type="checkbox"] { margin-top: 2px; }
.tk-versand__rlabel { display: flex; flex-direction: column; line-height: 1.3; }
.tk-versand__remail { color: var(--muted); font-size: 13px; }
.tk-check { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 15px; cursor: pointer; color: var(--text); }
.tk-check input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--rot); cursor: pointer; }
.tk-versand__addrow { display: flex; gap: 8px; align-items: stretch; margin-top: 13px; }
.tk-versand__addrow .input { flex: 1 1 auto; min-width: 0; }
.tk-versand__addbtn { flex: 0 0 auto; white-space: nowrap; }
.tk-versand__chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.tk-versand__chips:empty { display: none; }
.tk-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; color: var(--text); }
.tk-chip__x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px; line-height: 1; padding: 2px 4px; border-radius: 999px; }
.tk-chip__x:hover { color: #fff; background: var(--rot); }
.tk-versand__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.tk-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.tk-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tk-toggle__track { position: relative; width: 44px; height: 24px; background: var(--border-strong); border-radius: 999px; transition: background .15s ease; flex: 0 0 auto; }
.tk-toggle__thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s ease; }
.tk-toggle input:checked + .tk-toggle__track { background: var(--rot); }
.tk-toggle input:checked + .tk-toggle__track .tk-toggle__thumb { transform: translateX(20px); }
.tk-toggle__side { font-size: 14px; font-weight: 600; color: var(--muted); }
.tk-toggle:not(.is-on) .tk-toggle__side--priv { color: var(--text); }
.tk-toggle.is-on .tk-toggle__side--pub { color: var(--rot); }

.tk-block { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.tk-block__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tk-block__title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.tk-edit-btn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); padding: 5px 9px; font-size: 15px; cursor: pointer; line-height: 1; }
.tk-edit-btn:hover { background: var(--surface-2); }

.tk-fields .field { margin-bottom: 10px; }
.tk-fields .field:last-child { margin-bottom: 0; }
.tk-fields label { display: block; font-size: 12px; font-weight: 600; color: var(--grau); margin: 0 0 4px; }
.tk-grid2 { display: flex; gap: 10px; }
.tk-grid2 .field { flex: 1 1 0; }
/* Ausgegraut & lesbar, wenn nicht im Bearbeiten-Modus */
.tk-block .input:disabled { background: var(--surface-2); color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; cursor: default; border-color: var(--border); }
.tk-block .input { min-height: 42px; font-size: 15px; }
.tk-block textarea.input { min-height: auto; }
.tk-block.editing .input:not(:disabled) { background: #fff; border-color: var(--border-strong); }
.tk-block__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.tk-block__actions .btn { min-height: 40px; }

.tk-verlauf { display: flex; flex-direction: column; gap: 10px; }
.tk-ventry { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; }
.tk-ventry--system { background: #fff; }
.tk-ventry__head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tk-ventry__who { font-size: 13px; color: var(--text); }
.tk-ventry--system .tk-ventry__who { color: var(--muted); }
.tk-ventry__when { font-size: 12px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.tk-ventry__del { margin: 0; }
.tk-ventry__delbtn { background: transparent; border: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px; opacity: .55; }
.tk-ventry__delbtn:hover { opacity: 1; }
.tk-file-wrap { position: relative; display: inline-flex; }
.tk-file-del { position: absolute; top: -6px; right: -6px; margin: 0; }
.tk-file-del__btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; color: var(--rot); font-size: 12px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); padding: 0; }
.tk-file-del__btn:hover { background: var(--rot); color: #fff; }

/* --- Lightbox für Bild-/Video-Anhänge (Bilder/Videos öffnen in-App statt neuem Tab) --- */
.tk-file-viewer { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 48px 24px 24px; overflow: auto; background: rgba(0,0,0,.85); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.tk-file-viewer[hidden] { display: none; }
.tk-file-viewer.open { opacity: 1; pointer-events: auto; }
.tk-file-viewer__box { position: relative; margin: auto; display: flex; }
.tk-file-viewer__img, .tk-file-viewer__video { display: block; max-width: 100%; max-height: calc(100dvh - 72px); border-radius: 8px; }
.tk-file-viewer__img { cursor: zoom-in; }
.tk-file-viewer.zoomed { align-items: flex-start; justify-content: flex-start; }
.tk-file-viewer.zoomed .tk-file-viewer__img { max-width: none; max-height: none; cursor: zoom-out; }
.tk-file-viewer__close { position: absolute; bottom: calc(100% + 4px); right: 0; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: none; border-radius: 8px; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.tk-file-viewer__close:hover { background: rgba(255,255,255,.26); }
.tk-ventry__text { font-size: 14px; color: var(--text); line-height: 1.4; word-break: break-word; }
.tk-ventry--system .tk-ventry__text { font-size: 13px; color: var(--grau); }

.tk-commentbox { margin-top: 14px; }
/* Höhere Spezifität als `.tk-block textarea.input { min-height:auto }`, sonst kollabiert das Feld. */
.tk-commentbox textarea.input { width: 100%; min-height: 84px; font-size: 15px; }
/* Nur der direkte Senden-Button bekommt Abstand — NICHT die Picker-Buttons (Labels im Row). */
.tk-commentbox > .btn { margin-top: 8px; }

/* =========================================================================
   NOW & NEXT (Changelog + Roadmap)
   ========================================================================= */
.btn-sm { padding: 6px 12px; font-size: 13px; }

.nn-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 3px; margin: 2px 0 16px; }
.nn-toggle__btn { border: 0; background: transparent; color: var(--grau); font-weight: 700; font-size: 14px; padding: 8px 18px; border-radius: 999px; cursor: pointer; }
.nn-toggle__btn.is-active { background: var(--rot); color: #fff; }

.nn-empty { padding: 22px 16px; text-align: center; color: var(--grau); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

.nn-entry { margin-bottom: 12px; }
.nn-entry__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.nn-entry__date { display: inline-block; background: var(--tint-rot); border: 1px solid var(--border); padding: 4px 11px; border-radius: 7px; font-size: 13px; font-weight: 800; color: #1c1c1e; white-space: nowrap; }
.nn-entry__author { font-size: 15px; font-weight: 700; color: var(--grau); }
.nn-entry__subject { font-size: 17px; font-weight: 800; line-height: 1.3; color: #1c1c1e; word-break: break-word; }
.nn-entry__text { margin-top: 8px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #1c1c1e; }
.nn-entry__text a { color: var(--rot); }

.nn-rm-group { margin-bottom: 22px; }
.nn-rm-group__title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--grau); margin: 0 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.nn-rm-item { position: relative; border-left: 4px solid var(--border-strong); margin-bottom: 8px; }
.nn-rm-item--in_arbeit { border-left-color: #F4B400; }
.nn-rm-item--geplant   { border-left-color: #90C2F0; }
.nn-rm-item--idee      { border-left-color: #B7A3E0; }
.nn-rm-headline { font-size: 16px; font-weight: 700; line-height: 1.3; color: #1c1c1e; word-break: break-word; }
.nn-rm-subline { margin-top: 4px; font-size: 14px; color: var(--grau); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.nn-rm-subline a { color: var(--rot); }
.nn-rm-item--has-target { padding-top: 18px; }
.nn-rm-item--has-target .nn-rm-headline { padding-right: 96px; }
.nn-rm-stoerer { position: absolute; top: -9px; right: 12px; z-index: 1; background: var(--gold); color: #1c1c1e; font-size: 11px; font-weight: 800; letter-spacing: .3px; padding: 4px 10px; border-radius: 7px; transform: rotate(-3deg); box-shadow: 0 2px 7px rgba(0,0,0,.18); white-space: nowrap; }

.nn-admin-actions { margin-top: 12px; display: flex; justify-content: flex-end; gap: 8px; }
.nn-admin-actions form { margin: 0; }

/* Now & Next — Create/Edit-Modal */
.nn-modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 24px 14px; overflow-y: auto; opacity: 0; transition: opacity .18s ease; }
.nn-modal-backdrop.is-open { opacity: 1; }
.nn-modal-backdrop[hidden] { display: none; }
.nn-modal { width: 100%; max-width: 520px; background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); margin: auto; transform: translateY(8px); transition: transform .18s ease; }
.nn-modal-backdrop.is-open .nn-modal { transform: none; }
.nn-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.nn-modal__title { font-size: 17px; font-weight: 800; color: #1c1c1e; }
.nn-modal__close { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--grau); cursor: pointer; padding: 4px 8px; }
.nn-modal__body { padding: 14px 18px; }
.nn-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* =========================================================================
   FEEDBACK — Formular
   ========================================================================= */
.fb-sender { font-size: 13px; color: var(--grau); margin: 0 0 16px; }
.fb-types { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-type { position: relative; display: inline-flex; align-items: center; padding: 8px 15px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; background: #fff; color: #1c1c1e; }
.fb-type input { position: absolute; opacity: 0; pointer-events: none; }
.fb-type:has(input:checked) { background: var(--rot); color: #fff; border-color: var(--rot); }
.fb-submit { margin-top: 6px; }

/* =========================================================================
   FEEDBACK-MESSAGES — Inbox (Akkordeon wie Audit-Log + Status-Streifen)
   ========================================================================= */
.fbx-view-dropdown { min-width: 120px; }
.fbx-view-dropdown .multi-dropdown-toggle { white-space: nowrap; }

.fbx-entry { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.fbx-entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
.fbx-entry--eingang::before        { background: var(--st-eingang); }
.fbx-entry--in_bearbeitung::before { background: var(--st-in_bearbeitung); }
.fbx-entry--erledigt::before       { background: var(--st-abgeschlossen); }
.fbx-entry--verworfen::before      { background: #b8b8bc; }
.fbx-entry__head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 12px 18px; cursor: pointer; }
.fbx-entry.has-extra .fbx-entry__head:hover { background: rgba(0,0,0,.02); }
.fbx-entry__main { flex: 1; min-width: 0; }
.fbx-entry__meta { font-size: 13px; color: var(--grau); font-weight: 600; }
.fbx-entry__subject { font-size: 16px; font-weight: 700; color: #1c1c1e; margin-top: 3px; word-break: break-word; }
.fbx-entry__reporter { font-size: 13px; color: var(--grau); margin-top: 3px; word-break: break-word; }
.fbx-entry__status { flex: 0 0 auto; }
.fbx-entry__status form { margin: 0; }
.fbx-entry__status select { min-width: 122px; height: 32px; padding: 3px 24px 3px 8px; font-size: 12px; }
.fbx-toggle { flex: 0 0 auto; align-self: stretch; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--grau); cursor: pointer; font-size: 13px; padding: 0 10px; margin: -12px -12px -12px 0; }
.fbx-toggle .chev { display: inline-block; transition: transform .18s ease; }
.fbx-entry.is-open .fbx-toggle .chev { transform: rotate(180deg); }
.fbx-entry__body { display: none; padding: 4px 14px 14px 18px; }
.fbx-entry.is-open .fbx-entry__body { display: block; }
.fbx-message { font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #1c1c1e; }
.fbx-message a { color: var(--rot); }
.fbx-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fbx-context { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--grau); line-height: 1.5; word-break: break-word; }
.fbx-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.fbx-actions form { margin: 0; }

/* Burger-Badge (Now & Next: ungesehene Changelog-Einträge) */
.menu__badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--rot); color: #fff; font-size: 11px; font-weight: 800; line-height: 1.4; text-align: center; margin-left: 4px; vertical-align: middle; }
