/* ===== SCHRIFT: Rubik ===== */
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

/* ===== CSS-VARIABLEN & THEMES ===== */
:root {
  --bg: #ffffff;
  --fg: #0b0d10;
  --muted: #6b7280;
  --card: rgba(255,255,255,.95); /* vorher .82 — Kacheln/Panels wirken
     jetzt fast deckend statt "durchsichtig", ein Hauch Hintergrund bleibt
     an Kanten/Ecken/Übergängen erhalten */
  --card-solid: #ffffff;
  --stroke: rgba(0,0,0,.08);
  --ring: rgba(255,59,48,.34);
  --shadow: 0 10px 24px rgba(0,0,0,.07);
  --corner: 22px;
  --glow: rgba(255,59,48,.35);
  --ok: #34c759;
  --err: #ff3b30;
  --overlay-from: rgba(255,255,255,.45);
  --overlay-to: rgba(255,255,255,.35);
  --bg-filter: blur(6px) saturate(.95) brightness(.98);
  --accent: #ff3b30;
  /* Feste Höhe für Chat- und Online-Kachel (nicht mehr per Hand ziehbar),
     skaliert leicht mit der Fensterhöhe, gedeckelt auf ca. Bildschirm-Größe. */
  --chat-tile-height: clamp(460px, 78vh, 720px);
}
html.dark {
  --bg: #13151a;
  --fg: #eef2f6;
  --muted: #8b92a0;
  --card: rgba(30,33,40,.97); /* vorher .88 — s. Kommentar bei :root */
  --card-solid: #1e2128;
  --stroke: rgba(255,255,255,.1);
  --ring: rgba(255,69,58,.45);
  --shadow: 0 14px 36px rgba(0,0,0,.35);
  --glow: rgba(255,69,58,.45);
  --overlay-from: rgba(10,12,14,.45);
  --overlay-to: rgba(10,12,14,.55);
  --bg-filter: blur(6px) saturate(.9) brightness(.55);
  --accent: #ff453a;
}

/* ===== RESET & BASIS ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }

/* Sanfter Dark/Light-Übergang — nur Farb-Properties, keine Layout-Properties */
html {
  transition: background-color 0.4s ease, color 0.4s ease;
}
body, .topbar, .tile, .card, .pause-panel, .tile-chat, .tile-online, .tile-wecker, .tile-notiz {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

/* ── Hintergrundbild mit Blur ── */
html {
  position: relative;
}
html::before {
  display: none;
}
html { transition: background-color .3s ease, color .3s ease; }

body {
  margin: 0;
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  transition: background 300ms ease, color 300ms ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* ===== HINTERGRUND ===== */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0;
  left: 200px; /* ab Sidebar-Rand */
  z-index: -2;
  background-image: url('bg_light.webp'); /* ~77% kleiner als das PNG, gleiche optische Qualität */
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  filter: var(--bg-filter);
  transition: filter 300ms ease;
}

/* Dark-Mode: eigenes Bild + Hintergrundfarbe füllt leere Bereiche */
html.dark body::before {
  background-image: url('bg_dark.webp'); /* ~76% kleiner als das PNG, gleiche optische Qualität */
  background-color: #ac1512;
}
body::after {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0;
  left: 200px; /* ab Sidebar-Rand */
  z-index: -1;
  background: linear-gradient(to bottom, var(--overlay-from), var(--overlay-to));
  mix-blend-mode: normal;
  transition: background 300ms ease;
}

/* ===== SIDEBAR LINKS ===== */
.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 18px 14px;
  background: var(--card);
  border-right: 1px solid rgba(0,0,0,.07);
  box-shadow: 2px 0 12px rgba(0,0,0,.06);
  z-index: 10;
  overflow-y: auto;
}
html.dark .topbar {
  border-right-color: rgba(255,255,255,.08);
  box-shadow: 2px 0 16px rgba(0,0,0,.3);
}

/* Topbar Logo */
.brand-logo-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
html.dark .brand-logo-row {
  border-bottom-color: rgba(255,255,255,.09);
}
.topbar-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Brand-Block: Titel + Buttons */
.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}
.brand {
  font-weight: 800;
  letter-spacing: .02em;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  width: 100%;
}
.brand-sub {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.brand-sub .btn {
  width: 100%;
  text-align: center;
  border-radius: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub .status {
  width: 100%;
  justify-content: center;
  border-radius: 10px;
}
.brand-sub .sync-status {
  justify-content: center;
  width: 100%;
}
.brand-sub .topbar-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

/* ===== NEUE SEITENLEISTEN-ELEMENTE ===== */

/* Rollenakzent nur am Profilblock */
.topbar { border-left: none; }

/* Profil-Block */
.sidebar-profile-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--role-accent, #6b7280);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--role-accent, #6b7280);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.sidebar-profile-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sidebar-username { font-weight: 700; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Primäre Aktionen */
.sidebar-actions-primary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}
.sidebar-actions-primary .btn { width: 100%; }

/* Einstellungsbereich */
.sidebar-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.sidebar-settings .btn { width: 100%; }

/* (Rollenbadge-Override entfernt – Werte in Hauptdefinition übernommen) */

/* Bildschirm-aktiv-Button grün wenn an */
#wake-btn[aria-pressed="true"] {
  border: 2px solid #16a34a !important;
  color: #16a34a !important;
  background: rgba(22,163,74,.08) !important;
}

/* Theme Segment */
.theme-segment {
  display: flex;
  width: 100%;
  border-radius: 10px;
  border: 1.5px solid var(--stroke);
  overflow: hidden;
}
.theme-seg-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s;
  color: var(--fg);
  opacity: 0.45;
}
.theme-seg-btn:hover { background: rgba(255,255,255,.07); opacity: 0.7; }
.theme-seg-btn.active { background: var(--accent); opacity: 1; }
html.dark .theme-seg-btn.active { background: rgba(255,255,255,.12); }

/* theme-btn (alt) verstecken falls noch vorhanden */
#theme-btn { display: none !important; }

/* Kleinere Button-Variante */
.btn-sm {
  padding: 7px 10px !important;
  font-size: 0.78rem !important;
  border-radius: 10px !important;
}

/* Datum/Uhrzeit oben rechts */
.right { display: none; }

.sidebar-datetime {
  text-align: center;
  width: 100%;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  margin-bottom: 10px;
  line-height: 1.2;
}
html.dark .sidebar-datetime {
  border-bottom-color: rgba(255,255,255,.09);
}
.datetime { text-align: center; line-height: 1.2; }
#time {
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
#date {
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== BUTTONS ===== */
.btn {
  border: 1.5px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.10);
  background: #ffffff;
  border-color: rgba(0,0,0,.22);
}
.btn[aria-pressed="true"] {
  border-color: rgba(52,199,89,.7);
  box-shadow: 0 10px 24px rgba(52,199,89,.22);
}
html.dark .btn {
  background: rgba(30,32,36,.85);
  border-color: rgba(255,255,255,.22);
  color: var(--fg);
}
html.dark .btn:hover {
  background: rgba(45,48,54,.95);
  border-color: rgba(255,255,255,.35);
}

/* ===== STATUS / LED ===== */
.status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1.5px solid rgba(0,0,0,.15);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  transition: background 300ms ease, border-color 300ms ease;
  font-size: 0.85rem;
}
/* (Alte .led / .led.on Basisklasse entfernt – ungenutzt.
   Status-LEDs nutzen .led-red/-green/-yellow weiter unten,
   die Sync-Anzeige nutzt .sync-led.) */
.status .label {
  font-weight: 600;
  color: var(--muted);
}
html.dark .status {
  background: rgba(30,32,36,.85);
  border-color: rgba(255,255,255,.18);
}

/* ===== MAIN LAYOUT ===== */
main {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px 40px 220px;
}
.grid-wrap { width: 100%; max-width: 1600px; }

/* ===== SUCHFELD ===== */
.search-wrapper {
  position: relative;
  max-width: 420px;
  margin: 0 0 12px auto;
  font-size: 0.9rem;
}

#menu-search {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--corner);
  border: 1.5px solid var(--stroke);
  background: rgba(255,255,255,.95);
  font-size: 0.9rem;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
  position: relative;
  z-index: 10;
  color: var(--fg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.6);
}
#menu-search::placeholder { color: var(--muted); }
#menu-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
  background: #ffffff;
}
html.dark #menu-search {
  background: rgba(40,44,52,.95);
  border-color: var(--stroke);
  color: var(--fg);
}
html.dark #menu-search:focus {
  background: rgba(45,49,58,1);
}

#search-results {
  position: absolute;
  top: 110%; right: 0; left: 0;
  background: rgba(255,255,255,.97);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  border: 1px solid rgba(0,0,0,.08);
  max-height: 450px;
  overflow-y: auto;
  padding: 4px;
  display: none;
  z-index: 20;
}
html.dark #search-results {
  background: rgba(30,33,40,.98);
  border-color: rgba(255,255,255,.1);
}

.search-result-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.88rem;
}
.search-result-item .primary { font-weight: 600; pointer-events: none; }
.search-result-item .secondary { font-size: 0.76rem; color: var(--muted); pointer-events: none; }
.search-result-item:hover { background: rgba(0,0,0,.04); }

html.dark .search-result-item { color: #eef2f6; }
html.dark .search-result-item .primary { color: #ffffff; }
html.dark .search-result-item .secondary { color: #c7cbd1; }
html.dark .search-result-item:hover { background: rgba(255,255,255,.08); }

/* aktive Zeile (Tastatur) */
.search-result-item.is-active {
  background: rgba(255,59,48,.12);
  box-shadow: inset 3px 0 0 var(--accent);
}
html.dark .search-result-item.is-active { background: rgba(255,69,58,.25); }
.search-result-item.is-active .primary { font-weight: 700; }

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(240px, 285px) minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
}

/* Linke Spalte (Dokument-Panel + Pausen-Panel) */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Rechte Spalte (Kachel-Grid + Kategorie-Kacheln) – eigener Block, damit
   eine lange Pausen-Liste links die Kategorie-Kacheln rechts nicht nach
   unten verschiebt (beide Spalten wachsen unabhängig voneinander). */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ===== OBERE ZEILE + CHAT-ZEILE =====
   Beide nutzen dieselbe .grid-Klasse (4 Spalten, gleiche Breakpoints) wie
   .category-grid darunter – dadurch bleiben die Spaltenkanten bei jeder
   Fensterbreite bündig. Jeder Block ist trotzdem nur EINE Grid-Zeile,
   darum kann (anders als beim alten span-4-Grid) nie eine Kachel über
   eine zu knapp berechnete Zeilenhöhe hinausragen und Darunterliegendes
   überlappen – jede Zeile sizt sich nur an ihrem eigenen Inhalt aus. */
.top-row .tile-notiz  { grid-column: span 2; }
.chat-row .tile-chat  { grid-column: span 2; }
.sharepoint-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch; /* füllt die Zeilenhöhe (= Chat/Online-Höhe) */
}
.sharepoint-stack .tile {
  flex: 1;
  min-height: 0;
  /* Basis .tile setzt align-self:start (für Grid-Zellen gedacht) – in
     diesem Flex-Column-Kontext steuert dieselbe Eigenschaft aber die
     Breite und ließ die Kachel auf ihre Textbreite schrumpfen. */
  align-self: stretch;
}

/* ===== KACHEL-GRID ===== */
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: start;
  align-content: start;
  justify-items: stretch;
}
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); } }
@media (max-width: 760px)  { .grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); } }
@media (max-width: 420px)  { .grid { grid-template-columns: repeat(1, minmax(200px, 1fr)); } }

/* ===== KACHELN ===== */
.tile {
  position: relative;
  display: grid; place-items: center;
  text-align: center;
  padding: clamp(14px, 2.5vw, 22px);
  border-radius: var(--corner);
  background: var(--card);
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
  text-decoration: none; color: inherit;
  font-weight: 700;
  letter-spacing: .01em;
  font-size: clamp(18px, 2.4vw, 22px);
  min-height: clamp(120px, 14vw, 150px);
  transition: transform .1s ease, box-shadow .1s ease;
  will-change: transform;
  align-self: start;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 16px 40px rgba(0,0,0,.12), inset 0 1px 0 var(--stroke);
  outline: none;
}
.tile::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--corner);
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: box-shadow .1s ease;
}
.tile:hover::after, .tile:focus-visible::after {
  box-shadow: 0 0 0 8px var(--glow);
}

.logo-box {
  width: clamp(52px, 6vw, 72px);
  height: clamp(52px, 6vw, 72px);
  border-radius: 10px;
  margin-bottom: .5em;
  background-image: url("rescuetrack.png");
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-position: left center;
  overflow: hidden;
}

/* ===== DROPDOWN-KACHELN ===== */
details.tile {
  display: block;
  padding: clamp(10px, 2vw, 16px);
  text-align: left;
  cursor: pointer;
  transition: box-shadow .2s ease, transform .15s ease;
}
details.tile:hover:not([open]) {
  transform: translateY(-2px);
}
details.tile[open] {
  background: rgba(255,255,255,.95);
  box-shadow:
    0 18px 44px rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.9),
    0 0 0 3px var(--ring);
}
html.dark details.tile[open] {
  background: rgba(30,32,36,.97);
  box-shadow:
    0 18px 44px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.12),
    0 0 0 3px var(--ring);
}

details > summary {
  list-style: none;
  outline: none;
  font-weight: 700;
  font-size: clamp(13px, 1.5vw, 15px);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  letter-spacing: .01em;
}
details > summary::-webkit-details-marker { display: none; }

.tile-icon {
  font-size: 1.3em;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
}

details > summary::after {
  content: "";
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
  transition: transform .2s ease, opacity .2s ease;
  opacity: .45;
  flex-shrink: 0;
}
details[open] > summary::after {
  transform: rotate(45deg) translateY(-2px);
  opacity: .8;
}

.dropdown {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease;
}
details[open] .dropdown {
  opacity: 1;
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 3px;
}

/* Scrollbar */
details[open] .dropdown::-webkit-scrollbar { width: 4px; }
details[open] .dropdown::-webkit-scrollbar-track { background: transparent; }
details[open] .dropdown::-webkit-scrollbar-thumb { background: var(--stroke); border-radius: 99px; }

.dropdown a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
  background: transparent;
  color: var(--fg);
  border-radius: 7px;
  padding: 5px 8px;
  transition: background .12s ease, color .12s ease, padding-left .12s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 2px solid transparent;
}
.dropdown a::before {
  content: "›";
  font-size: 0.9rem;
  opacity: .35;
  flex-shrink: 0;
  transition: opacity .12s ease, transform .12s ease;
}
.dropdown a:hover {
  background: rgba(0,0,0,.05);
  border-left-color: var(--accent);
  padding-left: 12px;
  color: var(--fg);
}
.dropdown a:hover::before {
  opacity: .8;
  transform: translateX(2px);
}
html.dark .dropdown a:hover {
  background: rgba(255,255,255,.07);
}

@media (prefers-reduced-motion: reduce) {
  .tile, .dropdown, details > summary::after { transition: none; }
}

/* ===== PAUSEN-PANEL ===== */
.pause-panel {
  background: var(--card);
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
  border-radius: var(--corner);
  padding: 8px 10px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
}
.pause-panel h2 {
  margin: 0 0 2px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  flex-shrink: 0;
}
.pause-panel h2 span { font-size: 1rem; }

.pause-meta {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
  flex-shrink: 0;
}
.pause-section {
  margin-top: 3px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pause-section h3 {
  margin: 1px 0 2px;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.pause-section h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--stroke);
}

.pause-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}
.pause-list li {
  padding: 3px 5px;
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 5px;
  background: rgba(255,255,255,.5);
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  border: 1px solid transparent;
}
html.dark .pause-list li { background: rgba(255,255,255,.04); }
/* Obere Zeile: Funkrufname + Dauer nebeneinander */
.pause-list li .pause-top {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.pause-list li .pause-id {
  font-weight: 700;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pause-list li .pause-duration {
  font-size: 0.63rem;
  font-weight: 600;
  color: rgba(172, 21, 18, 0.8);
  white-space: nowrap;
  flex-shrink: 0;
}
html.dark .pause-list li .pause-duration {
  color: rgba(248, 113, 113, 0.9);
}
/* Untere Zeile: Zeitfenster */
.pause-list li span.pause-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.63rem;
}
.pause-list li:hover { background: rgba(0,0,0,.04); }
html.dark .pause-list li:hover { background: rgba(255,255,255,.08); }

/* Aktuell laufende Pause */
.pause-list li.pause-active {
  background: rgba(16,185,129,.1);
  border-color: rgba(16,185,129,.3);
}
.pause-list li.pause-active .pause-id { color: #059669; }
html.dark .pause-list li.pause-active { background: rgba(16,185,129,.12); }
html.dark .pause-list li.pause-active .pause-id { color: #34d399; }

/* Markiert (abgehakt) */
.pause-list li.marked-in-pause {
  background: rgba(255,59,48,.07);
  border-color: rgba(255,59,48,.35);
}
.pause-list li.marked-in-pause .pause-id {
  text-decoration: line-through;
  opacity: 0.6;
}
html.dark .pause-list li.marked-in-pause {
  background: rgba(255,69,58,.1);
}

.pause-empty {
  padding: 4px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* Schichtende in <10 Min — blaue Umrandung mit Puls */
.pause-list li.shift-ending-soon {
  border-color: rgba(59,130,246,.7);
  background: rgba(59,130,246,.07);
  animation: shift-end-pulse 2s ease-in-out infinite;
}
html.dark .pause-list li.shift-ending-soon {
  border-color: rgba(96,165,250,.8);
  background: rgba(59,130,246,.12);
}
@keyframes shift-end-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
  50%       { box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
}

/* Kombination: markiert UND Schichtende bald → blau überschreibt rot */
.pause-list li.marked-in-pause.shift-ending-soon {
  border-color: rgba(59,130,246,.7);
  background: rgba(59,130,246,.1);
}
html.dark .pause-list li.marked-in-pause.shift-ending-soon {
  border-color: rgba(96,165,250,.8);
  background: rgba(59,130,246,.15);
}

/* FE-Indikator — kleiner blauer Punkt oben rechts, belegt keine Breite */
.shift-end-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  border: 1px solid rgba(255,255,255,.6);
  flex-shrink: 0;
}
html.dark .shift-end-badge {
  background: #60a5fa;
  border-color: rgba(0,0,0,.3);
}

/* ===== SPLASH-SCREEN ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.85), transparent 55%),
    radial-gradient(circle at bottom, rgba(255,59,48,.12), rgba(0,0,0,.4));
  transition: opacity .5s ease, transform .5s ease;
}
html.dark .splash {
  background:
    radial-gradient(circle at top, rgba(10,12,14,.9), transparent 55%),
    radial-gradient(circle at bottom, rgba(255,69,58,.2), rgba(0,0,0,.8));
}
.splash.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
}
.splash-card {
  background: rgba(255,255,255,.96);
  border-radius: 24px;
  padding: 24px 26px 22px;
  box-shadow: 0 22px 60px rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.9);
  min-width: 260px;
  max-width: 320px;
  text-align: center;
  animation: splashPop .45s ease-out;
}
html.dark .splash-card {
  background: rgba(20,22,26,.96);
  border-color: rgba(255,255,255,.16);
}

.splash-logo { font-size: 2rem; margin-bottom: 8px; }
.splash-title {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.splash-subtitle { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }

.splash-spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  margin: 0 auto;
  border: 3px solid rgba(0,0,0,.06);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes splashPop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== DOKUMENT-PANEL ===== */
.doc-panel {
  background: var(--card);
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
  border-radius: var(--corner);
  padding: 18px 18px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.doc-panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

/* Tabs: Upload / URL */
.doc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  background: rgba(0,0,0,.05);
  border-radius: 10px;
  padding: 3px;
}
html.dark .doc-tabs { background: rgba(255,255,255,.06); }

.doc-tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.doc-tab.active {
  background: rgba(255,255,255,.95);
  color: var(--fg);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
html.dark .doc-tab.active {
  background: rgba(50,52,58,.95);
  color: var(--fg);
}

/* Eingabe-Bereiche */
.doc-input-area { display: none; }
.doc-input-area.visible { display: block; }

/* Upload-Zone */
.doc-dropzone {
  border: 2px dashed rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
  position: relative;
  margin-bottom: 8px;
}
.doc-dropzone:hover, .doc-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(255,59,48,.04);
  color: var(--fg);
}
html.dark .doc-dropzone { border-color: rgba(255,255,255,.15); }
.doc-dropzone-disabled { opacity: 0.45; cursor: not-allowed; }
.doc-dropzone-disabled:hover { border-color: rgba(0,0,0,.15); background: none; color: var(--muted); }
html.dark .doc-dropzone-disabled:hover { border-color: rgba(255,255,255,.15); }
.doc-dropzone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

/* URL-Eingabe */
.doc-url-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.doc-url-input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.9);
  font-size: 0.8rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  color: var(--fg);
}
html.dark .doc-url-input {
  background: rgba(30,32,36,.9);
  border-color: rgba(255,255,255,.15);
  color: var(--fg);
}
.doc-url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}
.doc-url-input::placeholder { color: var(--muted); }

.doc-add-btn {
  padding: 7px 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .12s;
  white-space: nowrap;
}
.doc-add-btn:hover { opacity: .85; transform: translateY(-1px); }

/* Dokumentliste */
.doc-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.doc-list-empty {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 2px;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.7);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: background .15s ease, transform .12s ease;
}
html.dark .doc-item { background: rgba(30,32,36,.8); }

.doc-item:hover { background: rgba(255,255,255,.95); transform: translateY(-1px); }
html.dark .doc-item:hover { background: rgba(44,46,52,.9); }

.doc-item-icon { font-size: 1rem; flex-shrink: 0; }

.doc-item-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: var(--fg);
  text-decoration: none;
}
.doc-item-name:hover { color: var(--accent); }

.doc-item-del {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.doc-item-del:hover { color: var(--err); background: rgba(255,59,48,.08); }

/* PDF-Viewer Modal */
.pdf-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0,0,0,.55);
  align-items: center;
  justify-content: center;
}
.pdf-modal-overlay.open { display: flex; }

.pdf-modal {
  background: rgba(255,255,255,.98);
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(0,0,0,.35);
  width: clamp(320px, 90vw, 1100px);
  height: clamp(400px, 85vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html.dark .pdf-modal {
  background: rgba(20,22,26,.98);
  border: 1px solid rgba(255,255,255,.1);
}

.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  flex-shrink: 0;
}
html.dark .pdf-modal-header { border-color: rgba(255,255,255,.1); }

.pdf-modal-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.pdf-modal-close {
  border: none;
  background: rgba(0,0,0,.06);
  border-radius: 8px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.pdf-modal-close:hover { background: rgba(255,59,48,.15); color: var(--accent); }
html.dark .pdf-modal-close { background: rgba(255,255,255,.08); color: var(--fg); }

.pdf-modal iframe {
  flex: 1;
  border: none;
  width: 100%;
}

/* ===== QUICK-ICON-BUTTON ===== */
.quick-icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px; border: none;
  background: transparent; cursor: pointer;
  font-size: 1.3rem; opacity: 0.55;
  box-shadow: 0 4px 8px rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
  line-height: 1; text-decoration: none;
}
.quick-icon-btn:hover { opacity: 1; transform: scale(1.12); box-shadow: 0 8px 16px rgba(0,0,0,.32); }

/* ===== NOTIZ & WECKER KACHELN ===== */
.tile-notiz,
.tile-wecker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 13px 10px;
  cursor: default;
  overflow: hidden;
  min-width: 0;
}
.tile-notiz  { grid-column: span 2; }
.tile-wecker { grid-column: span 1 !important; }

.tile-notiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.92rem;
}

#notiz-text {
  width: 100%;
  min-height: 56px;
  max-height: 120px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.83rem;
  font-family: inherit;
  resize: vertical;
  background: rgba(255,255,255,.6);
  color: var(--fg);
  transition: border .15s, background .2s;
  line-height: 1.5;
}
html.dark #notiz-text {
  background: rgba(20,22,26,.5);
  border-color: rgba(255,255,255,.12);
  color: var(--fg);
}
#notiz-text:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,.9);
}
html.dark #notiz-text:focus { background: rgba(20,22,26,.85); }

/* ── Schichtübergabe Ticker ── */
.schicht-ticker-outer {
  border: 2px solid #dc2626;
  border-radius: 8px;
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.schicht-ticker-tag {
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 8px 10px;
  letter-spacing: .06em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.schicht-ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: schicht-dot-blink 1.2s ease infinite;
}
@keyframes schicht-dot-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .2; }
}
.schicht-ticker-scroll {
  overflow: hidden;
  flex: 1;
  padding: 8px 0;
}
.schicht-ticker-inner {
  display: flex;
  white-space: nowrap;
  animation: schicht-ticker-scroll 22s linear infinite;
}
.schicht-ticker-inner:hover { animation-play-state: paused; }
.schicht-ticker-text {
  font-size: 0.8rem;
  color: #7f1d1d;
  padding: 0 36px;
}
html.dark .schicht-ticker-text { color: #fecaca; }
@keyframes schicht-ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.schicht-ticker-edit {
  margin-top: 5px;
  background: none;
  border: none;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
  opacity: 0.7;
}
.schicht-ticker-edit:hover { opacity: 1; color: var(--accent); }

.notiz-saved-hint {
  font-size: 0.70rem;
  color: var(--muted);
  font-weight: 600;
  min-height: 14px;
}
.notiz-clear-btn {
  border: none;
  background: rgba(255,59,48,.08);
  color: var(--accent);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.notiz-clear-btn:hover { background: rgba(255,59,48,.18); }

/* ===== WECKER-PANEL ===== */
.wecker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wecker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,.5);
  border-radius: 10px;
  font-size: 0.84rem;
  border: 1px solid rgba(0,0,0,.06);
  transition: background .15s;
}
html.dark .wecker-item {
  background: rgba(30,32,36,.5);
  border-color: rgba(255,255,255,.07);
}
.wecker-item-time {
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
}
.wecker-item-label {
  flex: 1;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wecker-item-warn {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,149,0,.12);
  color: #a05000;
  flex-shrink: 0;
}
html.dark .wecker-item-warn { background: rgba(255,149,0,.18); color: #ffb84d; }

.wecker-item-del {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.wecker-item-del:hover { background: rgba(255,59,48,.12); color: var(--accent); }

/* Wecker ringt gerade */
.wecker-item.ringing {
  border-color: var(--accent);
  background: rgba(255,59,48,.07);
  animation: wecker-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes wecker-pulse {
  from { box-shadow: 0 0 0 0 rgba(255,59,48,.3); }
  to   { box-shadow: 0 0 0 8px rgba(255,59,48,.0); }
}

/* Zeile zum Hinzufügen */
.wecker-add-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wecker-time-input {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.84rem;
  font-family: inherit;
  background: rgba(255,255,255,.8);
  color: var(--fg);
  width: 96px;
}
html.dark .wecker-time-input {
  background: rgba(30,32,36,.8);
  border-color: rgba(255,255,255,.15);
  color: var(--fg);
}
.wecker-label-input {
  flex: 1;
  min-width: 100px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.84rem;
  font-family: inherit;
  background: rgba(255,255,255,.8);
  color: var(--fg);
}
html.dark .wecker-label-input {
  background: rgba(30,32,36,.8);
  border-color: rgba(255,255,255,.15);
  color: var(--fg);
}
.wecker-add-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.wecker-add-btn:hover { opacity: .85; }

/* Alarm-Overlay */
.wecker-alarm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,.75);
  align-items: center;
  justify-content: center;
}
.wecker-alarm-overlay.active { display: flex; }

.wecker-alarm-box {
  background: linear-gradient(145deg, #0f172a, #1a2744);
  border-radius: 28px;
  padding: 40px 52px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
  animation: alarm-pop .35s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid rgba(255,255,255,.08);
  min-width: 280px;
}
@keyframes alarm-pop {
  from { transform: scale(.75); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.wecker-alarm-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(16,185,129,.8);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: ring-pulse 1.2s ease infinite;
}
@keyframes ring-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  50%      { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}

.wecker-alarm-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #fff;
  letter-spacing: .01em;
}
.wecker-alarm-time {
  font-size: 0.85rem;
  color: rgba(255,255,255,.45);
  font-weight: 500;
  margin-bottom: 28px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.wecker-alarm-ok {
  border: 1px solid rgba(16,185,129,.5);
  background: rgba(16,185,129,.15);
  color: #10b981;
  border-radius: 999px;
  padding: 11px 36px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
  letter-spacing: .02em;
}
.wecker-alarm-ok:hover {
  background: #10b981;
  color: #fff;
}


/* ===== FUSSZEILE ===== */
.dashboard-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  padding: 6px 24px 6px 224px;
  font-size: 0.70rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  opacity: .9;
  user-select: none;
  background: var(--card);
  border-top: 1px solid rgba(0,0,0,.07);
}
html.dark .dashboard-footer {
  border-top-color: rgba(255,255,255,.08);
}
.dashboard-footer strong {
  font-weight: 700;
  color: var(--fg);
  opacity: .8;
}

/* ===== SYNC-STATUS ===== */
.sync-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px 0;
}
.sync-led {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #aaa;
  transition: background .3s, box-shadow .3s;
  flex-shrink: 0;
}
.sync-led.ok      { background: #34c759; box-shadow: 0 0 6px rgba(52,199,89,.7); }
.sync-led.error   { background: #ff3b30; box-shadow: 0 0 6px rgba(255,59,48,.7); }
.sync-led.syncing { background: #ff9500; box-shadow: 0 0 6px rgba(255,149,0,.7);
                    animation: sync-pulse .8s ease-in-out infinite alternate; }
#sync-label { display: none; }
@keyframes sync-pulse {
  from { opacity: .5; } to { opacity: 1; }
}

/* ===== CHAT-KACHEL ===== */
.tile-chat {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  cursor: default;
  height: var(--chat-tile-height);
  overflow: hidden;
}
/* Kein Hover-Effekt für Chat */
.tile-chat:hover {
  transform: none;
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
}
.tile-chat::after {
  display: none;
}

.chat-username-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(0,0,0,.05);
  border-radius: 999px;
  padding: 2px 10px;
}
html.dark .chat-username-badge {
  background: rgba(255,255,255,.08);
}

.chat-messages {
  flex: 1;
  /* Immer genau so breit wie die Chat-Kachel. Die Kachel erbt von .tile
     "place-items: center" — ohne das hier wurde der Nachrichtenbereich so
     breit wie sein längstes unteilbares Stück (z.B. ein langer Link) und
     saß zentriert: Nachrichten links UND rechts abgeschnitten. */
  align-self: stretch;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  scroll-behavior: smooth;
  background: transparent;
}

/* Scrollbar dezent */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
html.dark .chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 72%;
  animation: chat-in .2s ease;
}
@keyframes chat-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Eigene Nachrichten rechts */
.chat-msg.own {
  align-self: flex-end;
  align-items: flex-end;
  margin-left: auto;
}
.chat-msg.other {
  align-self: flex-start;
  align-items: flex-start;
  margin-right: auto;
}

.chat-msg-meta {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 6px;
}
html.dark .chat-msg-meta {
  filter: brightness(2.2) saturate(0.85);
}

/* Dark Mode: Chat-Namen immer hell lesbar */
html.dark .chat-msg-meta {
  filter: brightness(2.2) saturate(0.85);
}

.chat-msg-bubble {
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 0.84rem;
  line-height: 1.4;
  /* Vorher "word-break: break-word": erlaubte dem Browser, Wörter an JEDER
     Stelle ohne Bindestrich zu zerreißen, sobald die Blase schmaler wurde.
     Jetzt: Wörter bleiben ganz; lange Wörter (z.B. "Rettungswagenbesatzung")
     werden nur an Silbengrenzen mit Bindestrich getrennt (deutsches
     Trennwörterbuch des Browsers, <html lang="de">). Nur was sich gar nicht
     sinnvoll trennen lässt (z.B. "aaaaaaaa…"), wird als Notlösung umbrochen. */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 10 4 4; /* erst ab 10 Zeichen, mind. 4 vor/nach dem Strich */
  /* Darf schmaler werden als ihr längstes Wort — sonst schob eine lange
     Zeichenkette (Link, Pfad) die Blase über den Chat-Rand hinaus und der
     Rest war abgeschnitten */
  min-width: 0;
  max-width: 100%;
}
/* Überlange Zeichenketten ohne Leerzeichen (≥ 30 Zeichen, von app.js
   markiert): dürfen als Notlösung überall umbrechen, ohne Bindestrich */
.chat-longword {
  overflow-wrap: anywhere;
  hyphens: manual;
  -webkit-hyphens: manual;
}
/* Emoji-only Nachrichten: groß wie WhatsApp */
.chat-msg-bubble.gif-bubble {
  background: transparent !important;
  padding: 2px !important;
  box-shadow: none !important;
}
.chat-msg-bubble.emoji-only {
  font-size: 2.2rem;
  background: transparent !important;
  padding: 2px 4px;
  line-height: 1.2;
}
/* Emojis im gemischten Text etwas größer */
.chat-msg-bubble .emoji {
  font-size: 1.15em;
  vertical-align: -0.1em;
}
.chat-msg.own .chat-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.other .chat-msg-bubble {
  background: rgba(0,0,0,.07);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}
html.dark .chat-msg.other .chat-msg-bubble {
  background: rgba(255,255,255,.10);
}

/* Systemnachrichten (Anmeldung etc.) */
.chat-msg-system {
  text-align: center;
  font-size: 0.70rem;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 0;
  font-style: italic;
}

/* Eingabe */
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px 10px;
  background: transparent;
}
.chat-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-family: inherit;
  background: rgba(255,255,255,.7);
  color: var(--fg);
  outline: none;
  transition: border .15s, box-shadow .15s;
}
html.dark .chat-input {
  background: rgba(30,32,36,.7);
  border-color: rgba(255,255,255,.15);
  color: var(--fg);
}
.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}
.chat-send-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s, transform .1s;
  flex-shrink: 0;
}
.chat-send-btn:hover  { opacity: .85; }
.chat-send-btn:active { transform: scale(.92); }
.chat-send-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

/* ── Read Receipts ── */
.chat-read-receipts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  padding: 0 2px;
}
.chat-read-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  opacity: 0.85;
  flex-shrink: 0;
}
.chat-read-badge.is-me {
  background: var(--stroke);
  color: var(--text-muted);
  opacity: 0.6;
}

.emoji-trigger-btn {
  width: 32px; height: 32px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  opacity: 0.6; transition: opacity .15s, background .15s; padding: 0;
}
.emoji-trigger-btn:hover { opacity: 1; background: rgba(0,0,0,.06); }
html.dark .emoji-trigger-btn:hover { background: rgba(255,255,255,.1); }

.emoji-picker {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 300px; background: #ffffff; border: 1.5px solid var(--stroke);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  z-index: 9999; overflow: hidden;
  animation: emojiPop .15s cubic-bezier(.34,1.56,.64,1);
}
@keyframes emojiPop {
  from { transform: scale(.88) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
html.dark .emoji-picker { background: #1e2535; border-color: rgba(255,255,255,.1); box-shadow: 0 12px 40px rgba(0,0,0,.5); }

.emoji-picker-tabs { display: flex; padding: 8px 8px 0; gap: 4px; border-bottom: 1px solid var(--stroke); overflow-x: auto; }
.emoji-picker-tabs::-webkit-scrollbar { height: 0; }
.emoji-tab {
  border: none; background: none; font-size: 1.1rem; cursor: pointer;
  padding: 4px 8px 8px; border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent; opacity: 0.55;
  transition: opacity .1s; flex-shrink: 0;
}
.emoji-tab:hover { opacity: 0.85; background: rgba(0,0,0,.05); }
.emoji-tab.active { opacity: 1; border-bottom-color: var(--accent); }
html.dark .emoji-tab:hover { background: rgba(255,255,255,.08); }

.emoji-picker-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 1px; padding: 8px; max-height: 200px; overflow-y: auto;
}
.emoji-picker-grid::-webkit-scrollbar { width: 4px; }
.emoji-picker-grid::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
.emoji-btn {
  border: none; background: none; font-size: 1.35rem; cursor: pointer;
  padding: 4px; border-radius: 7px; line-height: 1;
  transition: background .1s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.emoji-btn:hover { background: rgba(0,0,0,.08); transform: scale(1.2); }
html.dark .emoji-btn:hover { background: rgba(255,255,255,.12); }

/* ===== LOGIN MODAL ===== */
.chat-login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,.6);
  align-items: center;
  justify-content: center;
}
.chat-login-overlay.active { display: flex; }

.chat-login-box {
  background: rgba(255,255,255,.97);
  border-radius: 28px;
  padding: 44px 52px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: alarm-pop .35s cubic-bezier(.34,1.56,.64,1);
  min-width: 320px;
}
html.dark .chat-login-box {
  background: rgba(18,20,24,.97);
  border: 1px solid rgba(255,255,255,.12);
}

.chat-login-icon  { font-size: 3rem; }
.chat-login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--fg);
}
.chat-login-sub {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}
.chat-login-input {
  width: 100%;
  border: 1.5px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255,255,255,.9);
  color: var(--fg);
  outline: none;
  text-align: center;
  margin-top: 4px;
  transition: border .15s, box-shadow .15s;
}
html.dark .chat-login-input {
  background: rgba(30,32,36,.9);
  border-color: rgba(255,255,255,.2);
  color: var(--fg);
}
.chat-login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.chat-login-btn {
  width: 100%;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 4px;
}
.chat-login-btn:hover { opacity: .88; }

/* ===== TOPBAR USER / LOGOUT ===== */
.topbar-user {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}
#topbar-username {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--fg);
  text-align: center;
}
#topbar-role-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-align: center;
}
.btn-logout {
  background: rgba(255,59,48,.10) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(255,59,48,.25) !important;
}
.btn-logout:hover {
  background: rgba(255,59,48,.22) !important;
}

.btn-admin {
  background: rgba(245,158,11,.12) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245,158,11,.3) !important;
}
.btn-admin:hover { background: rgba(245,158,11,.22) !important; }

/* ===== ADMIN PANEL ===== */
.admin-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.admin-overlay.active { opacity: 1; pointer-events: all; }
.admin-modal {
  background: var(--card);
  border-radius: 20px;
  width: min(860px, 96vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.4);
  border: 1px solid var(--stroke);
  overflow: hidden;
}
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--stroke);
  font-weight: 800; font-size: 15px;
}
.admin-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; padding: 4px 8px;
  border-radius: 8px; transition: background .1s;
}
.admin-close:hover { background: var(--hover); }


/* Rollen-Wechsel Dropdown */
.role-sw-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--fg);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, color .15s ease;
}
.role-sw-btn:hover {
  background: rgba(255,59,48,.08);
  color: var(--accent);
  transform: translateX(3px);
}
html.dark .role-sw-btn:hover {
  background: rgba(255,69,58,.12);
}
.role-sw-btn.active {
  background: rgba(255,59,48,.1);
  color: var(--accent);
  font-weight: 700;
}
html.dark .role-sw-btn.active {
  background: rgba(255,69,58,.15);
}

/* ===== DRAG & DROP EDIT MODE ===== */
.grid.edit-mode .tile,
.grid.edit-mode details.tile {
  cursor: move;
  transition: transform .2s, box-shadow .2s;
}

.grid.edit-mode .tile:hover,
.grid.edit-mode details.tile:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,.2), inset 0 1px 0 var(--stroke);
  z-index: 10;
}

.grid.edit-mode .tile[draggable="true"],
.grid.edit-mode details.tile[draggable="true"] {
  user-select: none;
}

/* Verhindere Klicks im Edit-Modus */
.grid.edit-mode .tile,
.grid.edit-mode details.tile {
  pointer-events: all;
}
.grid.edit-mode .tile > *,
.grid.edit-mode details.tile > * {
  pointer-events: none;
}



/* ── "Neue Nachrichten"-Sprungmarke ──
   Erscheint statt dem Auto-Scroll, wenn der Nutzer in der Historie
   hochgescrollt hat, damit neue Nachrichten ihn nicht nach unten reißen. */
.chat-jump-bottom-btn {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  z-index: 5;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  animation: chatJumpBtnIn .15s ease;
}
.chat-jump-bottom-btn:hover { filter: brightness(1.08); }
@keyframes chatJumpBtnIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Chat Header Padding */
.tile-chat .tile-notiz-header {
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
html.dark .tile-chat .tile-notiz-header {
  border-bottom-color: rgba(255,255,255,.08);
}

/* Kein Hover-Effekt für Notiz, Wecker, Zähler */
.tile-notiz:hover,
.tile-wecker:hover,
.tile-zaehler:hover {
  transform: none;
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
}
.tile-notiz::after,
.tile-wecker::after,
.tile-zaehler::after {
  display: none;
}

/* ===== ONLINE NUTZER KACHEL ===== */
.tile-online-users {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  cursor: default;
  min-height: 480px;
  max-height: 480px;
  overflow: hidden;
}
.tile-online-users:hover {
  transform: none;
  box-shadow: var(--shadow), inset 0 1px 0 var(--stroke);
}
.tile-online-users::after {
  display: none;
}
.tile-online-users .tile-notiz-header {
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
html.dark .tile-online-users .tile-notiz-header {
  border-bottom-color: rgba(255,255,255,.08);
}

.online-count {
  background: var(--ok);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 24px;
  text-align: center;
}

.online-users-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.online-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: rgba(0,0,0,.03);
  transition: background .15s;
}
html.dark .online-user-item {
  background: rgba(255,255,255,.04);
}
.online-user-item:hover {
  background: rgba(0,0,0,.06);
}
html.dark .online-user-item:hover {
  background: rgba(255,255,255,.08);
}

.online-user-name {
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.online-user-name::before {
  content: '🟢';
  font-size: 0.6rem;
}

.online-user-pm-btn {
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.8);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.online-user-pm-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}
html.dark .online-user-pm-btn {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: var(--fg);
}

/* Visuelles Signal für neue Nachrichten */

/* EINFACHE ONLINE KACHEL */
.tile-online {
  height: var(--chat-tile-height);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  align-self: start;
  overflow: hidden;
}
.tile-online:hover { transform: none; box-shadow: var(--shadow), inset 0 1px 0 var(--stroke); }
.tile-online::after { display: none; }
.tile-online .tile-notiz-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
html.dark .tile-online .tile-notiz-header { border-bottom-color: rgba(255,255,255,.08); }

.online-user {
  padding: 8px;
  margin: 4px 0;
  background: rgba(0,0,0,.03);
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
html.dark .online-user { background: rgba(255,255,255,.05); }
.online-user span::before {
  content: '🟢';
  margin-right: 6px;
  font-size: 0.6rem;
}
/* Dashboard offen, aber ≥5 Min keine Maus/Tastatur: ausgegraut, weißer
   statt grüner Punkt (nur vor dem Namen, nicht vor Rollen-Pill/Label) */
.online-user-away { opacity: .55; }
.online-user-away span::before { content: none; }
.online-user-away > span::before { content: '⚪'; }
.online-away-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.pm-btn {
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.8);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.pm-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}
html.dark .pm-btn {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: var(--fg);
}

/* X-Button zum Schließen von Kacheln */
.tile-close-btn {
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.8);
  color: #111;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.tile-close-btn:hover {
  background: #fee;
  border-color: #f00;
  color: #f00;
}
html.dark .tile-close-btn {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: var(--fg);
}
html.dark .tile-close-btn:hover {
  background: rgba(255,0,0,.2);
  border-color: #f00;
  color: #f00;
}

/* BENACHRICHTIGUNGS-EFFEKTE */
@keyframes flash-green {
  0%,100% { filter: brightness(1); }
  40%     { filter: brightness(1.15); }
  60%     { filter: brightness(1.08); }
}

.tile-chat.has-new-chat-message {
  animation: flash-green 0.9s ease 1;
}

/* Ungelesene PM Badge */
.pm-unread-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 800;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
  animation: badge-pulse 2s ease infinite;
}

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

/* Fahrzeug-Info Tooltip Dark Mode */
html.dark #vehicle-tooltip {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(255,255,255,.2);
  color: #fff;
}



/* Chat & Online Kachel: Header und Messages durchsichtig wie Kacheln */
.tile-chat .tile-notiz-header,
.tile-online .tile-notiz-header {
  background: transparent !important;
}

.chat-popout-btn {
  display: none !important;
}


/* Pauseninfo in Suchergebnissen */
.pause-info {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(0,0,0,.06);
  line-height: 1.5;
  max-height: none;
  overflow: visible;
  white-space: pre-line;
  word-wrap: break-word;
}

html.dark .pause-info {
  border-top-color: rgba(255,255,255,.08);
}
/* ===== ADMIN PANEL ===== */
.admin-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.admin-tab:hover { color: var(--fg); background: rgba(255,255,255,.04); }
.admin-tab.active { color: #ef4444; border-bottom-color: #ef4444; }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.admin-stat-card {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--fg); }
.admin-stat-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  margin-bottom: 6px;
}
.admin-user-row.banned { border-color: rgba(220,38,38,.3); background: rgba(220,38,38,.05); }
.admin-log-row {
  font-size: 0.78rem;
  padding: 6px 10px;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  gap: 12px;
  align-items: center;
}
.admin-log-row:last-child { border-bottom: none; }
.admin-log-ts { color: var(--muted); font-size: 0.7rem; min-width: 120px; }

/* ══ @MENTIONS ══ */
.chat-mention {
  background: rgba(59,130,246,.15);
  color: #60a5fa;
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 600;
}
.chat-mention.is-me {
  background: rgba(220,38,38,.2);
  color: #f87171;
  animation: mention-pulse 1.5s ease 3;
}
/* Chat-Links klickbar */
.chat-link {
  color: var(--accent, #3b82f6);
  text-decoration: underline;
  /* Links nur umbrechen, wenn sie wirklich nicht in die Zeile passen
     (vorher "break-all": auch dann mitten im Link zerrissen, wenn er in
     die nächste Zeile gepasst hätte) — und nie mit Silben-Bindestrich. */
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: manual;
  -webkit-hyphens: manual;
}
.chat-link:hover { opacity: .8; }

@keyframes mention-pulse {
  0%,100% { background: rgba(220,38,38,.2); }
  50%      { background: rgba(220,38,38,.45); }
}
.mention-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(220,38,38,.5);
}

/* ══ @-MENTION DROPDOWN ══
   var(--card-solid) statt var(--card): schwebt frei über Chat/Hintergrund,
   die normale Kachel-Transparenz macht es dort schwer lesbar. */
#mention-dropdown {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--card-solid);
  border: 1.5px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.83rem;
  transition: background .1s;
}
.mention-item:hover,
.mention-item.active {
  background: rgba(59,130,246,.12);
}
.mention-item-avatar { font-size: 1rem; flex-shrink: 0; }
.mention-item-name   { font-weight: 700; color: var(--fg); flex: 1; }
.mention-item-role   { font-size: 0.7rem; color: var(--muted); }

/* ══ NACHRICHT LÖSCHEN (DURCHGESTRICHEN) ══ */
.bubble-deleted {
  text-decoration: line-through;
  opacity: 0.45;
  font-style: italic;
  cursor: default !important;
}
.msg-deleted .chat-msg-meta {
  opacity: 0.4;
}
.ctx-item {
  padding: 10px 16px;
  font-size: 0.83rem;
  cursor: pointer;
  color: var(--fg);
  transition: background .12s;
}
.ctx-item:hover {
  background: rgba(220,38,38,.1);
  color: #ef4444;
}


/* ══ LED STATUS INDIKATOREN ══ */
.led {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}
.led-green  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.8);  }
.led-yellow { background: #eab308; box-shadow: 0 0 6px rgba(234,179,8,.8);  }
.led-red    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.8);  }

/* ══ PAUSEN-FILTER SWITCH ══ */
.pause-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.pause-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.pause-switch-track {
  position: absolute;
  inset: 0;
  background: var(--stroke);
  border-radius: 11px;
  transition: background .2s;
}
.pause-switch input:checked + .pause-switch-track {
  background: #16a34a;
}
.pause-switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
  pointer-events: none;
}
.pause-switch input:checked ~ .pause-switch-thumb {
  transform: translateX(18px);
}

/* ══ INAKTIVITÄTS-WARNUNG ══ */
#inactivity-warning {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220,38,38,.95);
  color: #fff;
  border-radius: 12px;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  white-space: nowrap;
}
#inactivity-warning button {
  background: #fff;
  color: #dc2626;
  border: none;
  border-radius: 7px;
  padding: 5px 14px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ══ DIENSTENDE COUNTDOWN ══ */
.tile-countdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  justify-content: center;
  overflow: hidden;
}
.countdown-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.countdown-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.countdown-header select {
  width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1.5px solid var(--stroke);
  background: var(--card);
  color: var(--fg);
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
}
.countdown-segment-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.countdown-display {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: .04em;
  line-height: 1.1;
  color: var(--fg);
  transition: color .3s;
}
.countdown-percent-label {
  text-align: right;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}
.countdown-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--stroke);
  border-radius: 99px;
  overflow: hidden;
}
.countdown-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: #3b82f6;
  transition: width .5s ease, background .3s;
  width: 0%;
}
.countdown-dienst-info {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
}
.countdown-seg-chip {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--stroke);
  color: var(--muted);
  font-weight: 600;
}
.countdown-seg-chip.active {
  background: rgba(59,130,246,.2);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,.3);
}

/* ══ COUNTDOWN ZEITSTRAHL ══ */
#countdown-timeline {
  position: relative;
  width: 100%;
  height: 20px;
  user-select: none;
}
#countdown-timeline-labels {
  position: relative;
  width: 100%;
  height: 14px;
  margin-top: 1px;
}
