/* ==============================================================================
   SecTepe.Comm - Unified Web UI
   Re-gebunden an das SecTepe-Markendesign (Coral/Schwarz/Weiß, Gugi + Inter).
   Tokens basieren auf colors_and_type.css (Design-System).
   ============================================================================== */

@import url("colors_and_type.css");

/* --- CSS Variables ---
   Alle Werte haengen an den Semantik-Tokens des Design-Systems (--sec-*),
   die colors_and_type.css unter [data-theme="dark"] umschaltet — ein eigener
   Dark-Block ist deshalb nicht mehr noetig. Linear-inspiriert: helle
   Sidebar, 1-px-Raender, Radien 6/8/12, Coral nur als Akzent. */
:root {
  --bg-primary: var(--sec-bg);
  --bg-secondary: var(--sec-surface);
  --bg-sidebar: var(--sec-sidebar-bg);
  --bg-sidebar-hover: var(--sec-hover);
  --bg-sidebar-active: var(--sec-selected);
  --bg-card: var(--sec-surface);
  --bg-card-hover: var(--sec-hover);

  --text-primary: var(--sec-fg);
  --text-secondary: var(--sec-fg-muted);
  --text-sidebar: var(--sec-sidebar-fg);
  --text-sidebar-active: var(--sec-fg);

  --accent-chat: var(--sec-coral-300);
  --accent-email: var(--sec-n-700);
  --accent-video: var(--sec-coral-500);
  --accent-remote: var(--sec-coral-600);
  --accent-primary: var(--sec-coral-300);

  --border-color: var(--sec-border);
  --shadow-sm: var(--sec-shadow-1);
  --shadow-md: var(--sec-shadow-2);
  --shadow-lg: var(--sec-shadow-3);

  --sidebar-width: var(--sec-sidebar-w);
  --sidebar-collapsed-width: 60px;
  /* Mobile-Shell (<= 768 px, js/mobile-shell.js): Leisten-Hoehen, Drawer-Breite. */
  --mobile-topbar-h: 52px;
  --mobile-nav-h: 58px;
  --mobile-drawer-w: min(320px, 86vw);
  --transition: var(--sec-dur-base) var(--sec-ease-out);
  --radius: var(--sec-radius-card);
  --radius-lg: var(--sec-radius-overlay);

  /* Modulfarben der Sidebar-Symbole (gedaempft; Kachel und Glyphe leiten
     sich per color-mix davon ab, siehe .nav-item > .nav-icon). */
  --nav-hue-blue: #4F7FD6;
  --nav-hue-teal: #2E9BB0;
  --nav-hue-green: #3D9A66;
  --nav-hue-amber: #C28A1F;
  --nav-hue-orange: #D77B3E;
  --nav-hue-red: #D2605B;
  --nav-hue-pink: #C95C93;
  --nav-hue-purple: #8B66D6;
  --nav-hue-indigo: #5E6AD2;
  --nav-hue-slate: #6B7280;
}

/* Dunkles Design: hellere Varianten derselben Modulfarben. */
[data-theme="dark"] {
  --nav-hue-blue: #8EB0F2;
  --nav-hue-teal: #6CC6D6;
  --nav-hue-green: #7CC79A;
  --nav-hue-amber: #E3B65C;
  --nav-hue-orange: #F0A273;
  --nav-hue-red: #F08F89;
  --nav-hue-pink: #E89BC0;
  --nav-hue-purple: #B79BF0;
  --nav-hue-indigo: #9BA3F0;
  --nav-hue-slate: #A3A9B5;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--sec-font-sans);
  font-size: var(--sec-fs-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
  overflow: hidden;
}

/* --- Scrollable nav area --- */
.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--sec-border) transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: var(--sec-border);
  border-radius: 2px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--sec-n-300);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  overflow: visible;
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.logo-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--sec-coral-300);
  color: var(--sec-black);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
}

.logo-icon img {
  width: 22px;
  height: 22px;
}

.logo-text {
  font-family: var(--sec-font-brand);
  font-size: 17px;
  font-weight: 400;
  color: var(--text-sidebar-active);
}

.logo-accent {
  /* Wortmarken-Akzent: coral-600 (--sec-link) statt der hellen Akzentfarbe —
     17 px Normaltext auf der Sidebar braucht 4,5:1 (axe/Lighthouse-Gate). */
  color: var(--sec-link);
}

/* White-Label: Bild-Logo statt Wortmarke (js/brand.js, BRAND_LOGO_URL). */
.logo-text .brand-logo-img {
  display: block;
  height: 24px;
  max-width: 160px;
  object-fit: contain;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  visibility: hidden;
}

/* --- Navigation --- */
.nav-section {
  padding: 8px 8px 10px;
}

/* Sichtbare Trennung der Gruppen (sidebar-layout.js rendert je Gruppe eine
   .nav-section; die erste ist ggf. "Favoriten"). */
.nav-section + .nav-section {
  border-top: 1px solid var(--sec-border-subtle);
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--sec-tracking-wide);
  color: var(--sec-fg-subtle);
  padding: 4px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
}

/* Gruppen-Kopf als Button (ein-/ausklappen, im Bearbeiten-Modus umbenennen). */
.nav-section-head {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
}

button.nav-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  /* >= 24 px Zielgroesse (Lighthouse/WCAG 2.5.8 target-size). */
  min-height: 26px;
  padding: 3px 6px;
  background: none;
  border: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--sec-radius-control);
}

button.nav-section-title:hover {
  color: var(--text-sidebar-active);
  background: var(--bg-sidebar-hover);
}

.nav-section-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-section-chevron {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  opacity: 0.6;
  transition: transform var(--transition);
}

.nav-section-star {
  display: inline-flex;
  color: var(--sec-warning);
}

.nav-section-star svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.nav-section.is-collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section.is-collapsed .nav-section-body {
  display: none;
}

.sidebar.collapsed .nav-section-head {
  display: none;
}

/* Zeile = Original-<a> + Favoriten-Stern (+ Drag-Griff im Bearbeiten-Modus). */
.nav-row {
  display: flex;
  align-items: center;
  position: relative;
}

.nav-row > .nav-item {
  flex: 1 1 auto;
  min-width: 0;
}

/* Zeilen ausgeblendeter Eintraege (Profil-Gating/nav-access) komplett weg —
   sonst gewinnt display:flex gegen das hidden-Attribut. */
.nav-row[hidden] {
  display: none;
}

.nav-fav-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: none;
  border-radius: var(--sec-radius-xs);
  color: var(--sec-fg-subtle);
  cursor: pointer;
}

.nav-fav-toggle svg {
  width: 13px;
  height: 13px;
}

.nav-row:hover > .nav-fav-toggle,
.nav-row:focus-within > .nav-fav-toggle,
.nav-fav-toggle.is-favorite,
.nav-editing .nav-fav-toggle {
  display: flex;
}

.nav-fav-toggle:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-fav-toggle.is-favorite {
  color: var(--sec-warning);
}

.nav-fav-toggle.is-favorite svg {
  fill: currentColor;
}

.nav-row:hover .nav-badge,
.nav-row:focus-within .nav-badge,
.nav-fav-toggle.is-favorite ~ .nav-badge,
.nav-editing .nav-row .nav-badge {
  margin-right: 24px;
}

.sidebar.collapsed .nav-fav-toggle {
  display: none !important;
}

/* Bearbeiten-Modus ("Menue anpassen") */
.nav-edit-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sec-border-subtle);
}

.nav-edit-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sidebar-active);
}

.nav-edit-hint {
  margin: 4px 0 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sec-fg-subtle);
  white-space: normal;
}

.nav-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-edit-btn {
  height: var(--sec-control-h-sm);
  padding: 0 8px;
  font: 500 12px/1 var(--sec-font-sans);
  border: 1px solid var(--sec-border);
  background: var(--sec-surface);
  color: var(--sec-fg);
  border-radius: var(--sec-radius-control);
  cursor: pointer;
}

.nav-edit-btn:hover {
  background: var(--bg-sidebar-hover);
}

.nav-edit-btn--primary,
.nav-edit-btn--primary:hover {
  background: var(--sec-fg);
  color: var(--sec-bg);
  border-color: var(--sec-fg);
}

.nav-section-actions {
  display: none;
  gap: 2px;
  flex: 0 0 auto;
}

.nav-editing .nav-section-actions {
  display: inline-flex;
}

.nav-group-action {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: none;
  color: var(--sec-fg-subtle);
  border-radius: var(--sec-radius-xs);
  cursor: pointer;
}

.nav-group-action svg {
  width: 12px;
  height: 12px;
}

.nav-group-action:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-section-rename {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 24px;
  margin: 2px 4px;
  padding: 0 6px;
  font: 500 12px var(--sec-font-sans);
  border: 1px solid var(--sec-ring);
  border-radius: var(--sec-radius-xs);
  background: var(--sec-surface);
  color: var(--sec-fg);
  letter-spacing: normal;
}

.nav-drag-handle {
  display: none;
  flex: 0 0 auto;
  width: 12px;
  margin-left: 2px;
  color: var(--sec-fg-subtle);
  opacity: 0.7;
}

.nav-drag-handle svg {
  display: block;
  width: 10px;
  height: 14px;
}

.nav-editing .nav-row[draggable="true"] .nav-drag-handle {
  display: block;
}

.nav-editing .nav-row[draggable="true"],
.nav-editing .nav-row[draggable="true"] .nav-item,
.nav-editing .nav-section-title[draggable="true"] {
  cursor: grab;
}

.nav-row.is-dragging,
.nav-section.is-dragging {
  opacity: 0.4;
}

.nav-drop-before {
  box-shadow: 0 -2px 0 0 var(--sec-accent);
}

.nav-drop-after {
  box-shadow: 0 2px 0 0 var(--sec-accent);
}

.nav-section.is-drop-target {
  background: var(--sec-selected);
  border-radius: var(--sec-radius-card);
}

.nav-section-empty {
  margin: 2px 2px 0;
  padding: 6px 10px;
  font-size: 11px;
  text-align: center;
  color: var(--sec-fg-subtle);
  border: 1px dashed var(--sec-border);
  border-radius: var(--sec-radius-control);
  white-space: normal;
}

.nav-customize-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 4px 8px 12px;
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  background: none;
  color: var(--sec-fg-subtle);
  font: 500 12px var(--sec-font-sans);
  border-radius: var(--sec-radius-control);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  position: relative;
}

.nav-customize-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar.collapsed .nav-customize-btn .nav-label {
  display: none;
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 3px 10px;
  border-radius: var(--sec-radius-control);
  color: var(--text-sidebar);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

/* Service-Status-Dot: kleiner Kreis fuer jedes nav-item, das eine externe URL
   hat. Zustaende: unknown (grau, default), up (gruen), down (rot). Wird per JS
   in index.html befuellt und alle 60s aktualisiert. Farben bewusst gedaempft
   (Grundton grau, "erreichbar" am ruhigsten), damit Stoerungen auffallen. */
.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sec-n-400) 60%, transparent);
  margin: 0;
  transition: background-color 200ms ease;
}
.status-dot.status-up   { background: color-mix(in srgb, var(--sec-success) 40%, var(--sec-fg-subtle)); }
.status-dot.status-down { background: color-mix(in srgb, var(--sec-danger) 65%, var(--sec-fg-subtle)); }

/* In der Sidebar sitzt der Dot an der unteren rechten Ecke der Symbol-Kachel
   (24px-Kachel ab padding-left 10px des nav-item) — auch eingeklappt. */
.nav-item > .status-dot {
  position: absolute;
  left: 28.5px;
  top: calc(50% + 6.5px);
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--bg-sidebar);
}

/* External-window indicator for nav-items that can't be iframed and
   are therefore routed through window.open().  Small ↗ glyph next to
   the label, dimmed so it doesn't compete with the active-highlight. */
.nav-item-external .nav-label::after,
.mobile-nav-item.nav-item-external::after {
  content: "↗";
  margin-left: 6px;
  font-size: 0.82em;
  opacity: 0.65;
  vertical-align: middle;
}
.sidebar.collapsed .nav-item-external .nav-label::after {
  content: "";
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  /* Akzent-Tint (--sec-selected, chained an die Coral-Rampe) mit
     Vordergrundfarbe — bleibt in beiden Themes AA-konform. */
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  opacity: 0.85;
}

/* Modul-Symbole: Linien-Glyphe auf blasser Kachel, eine gedaempfte Farbe je
   Modul (nav-hue-*). In Ruhe fast neutral, Farbe erst bei Hover/aktiv.
   Eintraege ohne nav-hue-* (z. B. von Register-Skripten injizierte Views)
   bekommen den neutralen Schieferton. */
.nav-item > .nav-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 4.5px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--nav-hue, var(--nav-hue-slate)) 4%, var(--sec-surface-alt));
  color: color-mix(in srgb, var(--nav-hue, var(--nav-hue-slate)) 35%, var(--sec-fg-muted));
  opacity: 1;
  transition: background-color var(--transition), color var(--transition);
}
.nav-item:hover > .nav-icon,
.nav-item.active > .nav-icon {
  background: color-mix(in srgb, var(--nav-hue, var(--nav-hue-slate)) 13%, transparent);
  color: var(--nav-hue, var(--nav-hue-slate));
}
.ico-fill { fill: currentColor; stroke: none; }
.nav-hue-blue { --nav-hue: var(--nav-hue-blue); }
.nav-hue-teal { --nav-hue: var(--nav-hue-teal); }
.nav-hue-green { --nav-hue: var(--nav-hue-green); }
.nav-hue-amber { --nav-hue: var(--nav-hue-amber); }
.nav-hue-orange { --nav-hue: var(--nav-hue-orange); }
.nav-hue-red { --nav-hue: var(--nav-hue-red); }
.nav-hue-pink { --nav-hue: var(--nav-hue-pink); }
.nav-hue-purple { --nav-hue: var(--nav-hue-purple); }
.nav-hue-indigo { --nav-hue: var(--nav-hue-indigo); }
.nav-hue-slate { --nav-hue: var(--nav-hue-slate); }

.nav-label {
  font-size: 13px;
  font-weight: 500;
}

/* Eingeklappt: Beschriftung nur noch fuer Screenreader (visually hidden)
   statt visibility:hidden - sonst sind alle Links namenlos. */
.sidebar.collapsed .nav-label {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.nav-badge {
  background: var(--sec-coral-500);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  min-width: 20px;
  text-align: center;
}

.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  margin: 0;
  padding: 1px 4px;
  font-size: 10px;
}

/* Tooltip for collapsed sidebar - auch bei Tastaturfokus */
.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .nav-item:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed-width) + 8px);
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 200;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* --- Intercom: Benutzer-Info-Widget --- */
.user-info-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-sidebar);
  overflow: hidden;
}

.user-info-widget .nav-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.75;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.sidebar.collapsed .user-name {
  display: none;
}

.sidebar-footer > .theme-toggle,
.sidebar-footer > .sidebar-collapse-btn {
  /* keep buttons in a row */
  flex-direction: row;
}

/* Row of buttons within footer */
.sidebar-footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sidebar.collapsed .sidebar-footer-buttons {
  display: none;
}

.theme-toggle,
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover,
.sidebar-collapse-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
.sun-icon { display: none; }
.moon-icon { display: block; }

.sidebar.collapsed .sidebar-collapse-btn {
  align-self: center;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
  overflow: visible;
}

/* --- Main Content --- */
.content {
  flex: 1;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transition: margin-left var(--transition);
}

/* --- Views --- */
.view {
  display: none;
  height: 100%;
}

.view.active {
  display: block;
}

/* --- Dashboard --- */
#view-dashboard {
  padding: 32px;
  overflow-y: auto;
}

.view-header {
  margin-bottom: 32px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
}

/* --- Dashboard Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.dashboard-card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}




.card-content h2.card-h {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sec-n-400);
}

.status-dot.online { background: var(--sec-success); }
.status-dot.offline { background: var(--sec-danger); }
.status-dot.checking { background: var(--sec-warning); animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  color: var(--text-secondary);
}

.card-action {
  font-size: 14px;
  font-weight: 600;
  /* coral-300 als Fließtext-Farbe auf Weiss bringt nur ~2.18:1 — zu wenig
     fuer WCAG 2.1 AA. Coral-700 ist die dunklere Marken-Variante und
     liefert ~11:1, ohne den Brand-Look zu verlieren. */
  color: var(--sec-coral-700);
  margin-top: auto;
}

/* --- Quick Actions --- */
.quick-actions {
  margin-bottom: 40px;
}

.quick-actions h2,
.system-info h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
}

.quick-action-btn:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  color: var(--accent-primary);
}

/* --- System Info --- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.info-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.info-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- iFrame Container --- */
.iframe-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-secondary);
}

.iframe-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-primary);
  z-index: 10;
  transition: opacity 0.3s ease;
}

.iframe-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.iframe-loading p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* --- Selection --- */
::selection {
  background: var(--sec-coral-100);
  color: var(--sec-fg);
}

/* ==============================================================================
   SecTepe.Comm - Native View Component Styles
   ============================================================================== */

/* --- Native View Container --- */
.native-view {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
}

/* --- Loading --- */
.sc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
  color: var(--text-secondary);
}

/* --- Empty State --- */
.sc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 12px;
  color: var(--text-secondary);
}

.sc-empty svg { opacity: 0.4; }

/* --- Error --- */
.sc-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--sec-danger) 8%, transparent);
  color: var(--sec-danger);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--sec-danger) 20%, transparent);
  margin: 8px 0;
}

/* --- Alert --- */





/* --- Badge --- */
.sc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.sc-badge--default { background: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.sc-badge--success { background: color-mix(in srgb, var(--sec-success) 10%, transparent); color: var(--sec-success); }
.sc-badge--warning { background: color-mix(in srgb, var(--sec-warning) 12%, transparent); color: var(--sec-warning); }
.sc-badge--danger { background: var(--sec-coral-50); color: var(--sec-danger); }
.sc-badge--info { background: var(--sec-coral-50); color: var(--sec-coral-700); }
.sc-badge--primary { background: var(--sec-coral-50); color: var(--accent-primary); }

/* --- Card --- */
.sc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sc-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sc-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sc-card__actions { display: flex; gap: 8px; }
.sc-card__body { padding: 20px; }

/* --- Stat Card --- */
.sc-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.sc-stat__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  opacity: 0.1;
}

.sc-stat__icon svg { width: 24px; height: 24px; opacity: 10; }
.sc-stat__content { display: flex; flex-direction: column; gap: 2px; }
.sc-stat__value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sc-stat__suffix { font-size: 16px; font-weight: 400; color: var(--text-secondary); margin-left: 2px; }
.sc-stat__label { font-size: 13px; color: var(--text-secondary); }
.sc-stat__trend { font-size: 12px; font-weight: 500; }
.sc-stat__trend--up { color: var(--sec-success); }
.sc-stat__trend--down { color: var(--sec-danger); }

.sc-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* --- Table --- */
.sc-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.sc-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.sc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.sc-table tbody tr:last-child td { border-bottom: none; }

.sc-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.sc-table__clickable { cursor: pointer; }

/* --- Pagination --- */
.sc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.sc-pagination__buttons { display: flex; align-items: center; gap: 8px; }
.sc-pagination__current { font-weight: 500; color: var(--text-primary); }

/* --- Tabs --- */
.sc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.sc-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.sc-tab:hover { color: var(--text-primary); }
.sc-tab--active { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.sc-tab__count { background: var(--bg-primary); padding: 1px 6px; border-radius: 10px; font-size: 11px; margin-left: 4px; }

/* --- Button (32 px, Radius 6, Inter 500 — wie .sec-btn) --- */
.sc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  height: var(--sec-control-h);
  padding: 0 12px;
  border-radius: var(--sec-radius-control);
  font-family: var(--sec-font-sans);
  font-size: var(--sec-fs-sm);
  font-weight: var(--sec-fw-medium);
  line-height: 1;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--sec-shadow-1);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}

.sc-btn:hover { background: var(--sec-surface-alt); }
.sc-btn:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--sec-shadow-focus); }
.sc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sc-btn--primary { background: var(--sec-fg); color: var(--sec-bg); border-color: var(--sec-fg); box-shadow: none; }
.sc-btn--primary:hover { background: color-mix(in srgb, var(--sec-fg) 86%, var(--sec-bg)); border-color: transparent; }
.sc-btn--accent { background: var(--sec-accent); color: var(--sec-fg-on-accent); border-color: var(--sec-accent); box-shadow: none; }
.sc-btn--accent:hover { background: var(--sec-accent-hover); border-color: var(--sec-accent-hover); }
.sc-btn--danger { background: var(--sec-coral-500); color: #fff; border-color: var(--sec-coral-500); }
.sc-btn--danger:hover { background: var(--sec-coral-600); border-color: var(--sec-coral-600); }
.sc-btn--success { background: var(--sec-success, #2E8B6B); color: #fff; border-color: var(--sec-success, #2E8B6B); }
.sc-btn--success:hover { filter: brightness(0.95); }
.sc-btn--sm { height: var(--sec-control-h-sm); padding: 0 8px; font-size: var(--sec-fs-xs); }
.sc-btn--lg { height: 40px; padding: 0 18px; font-size: var(--sec-fs-base); }

.sc-btn svg { width: 14px; height: 14px; }

/* --- Form Fields --- */
.sc-field {
  margin-bottom: 16px;
}

.sc-field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.sc-input {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--sec-control-h);
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--sec-radius-control);
  background: var(--sec-surface);
  color: var(--text-primary);
  font-size: var(--sec-fs-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sc-input::placeholder { color: var(--sec-fg-subtle); }

.sc-input:focus {
  border-color: var(--sec-ring);
  outline: none;
  box-shadow: var(--sec-shadow-focus-input);
}

.sc-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.sc-field__help { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* --- Modal --- */
.sc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.sc-modal-overlay--visible { display: flex; }

.sc-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.sc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sc-modal__header h3 { font-size: 18px; font-weight: 600; }

.sc-modal__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
}

.sc-modal__body { padding: 20px; overflow-y: auto; }
.sc-modal__footer { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; justify-content: flex-end; }

/* --- Progress Bar --- */
.sc-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.sc-progress__bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.sc-progress__label {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Charts --- */
.sc-chart-container {
  padding: 16px 0;
}

.sc-chart-container--donut {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.sc-chart__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.sc-chart__label {
  font-size: 11px;
  fill: var(--text-secondary);
}

.sc-chart__value {
  font-size: 11px;
  fill: var(--text-primary);
  font-weight: 500;
}

.sc-chart__center {
  font-size: 20px;
  font-weight: 700;
  fill: var(--text-primary);
}

.sc-chart__legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sc-chart__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Login --- */
.sc-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px;
}

.sc-login__card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.sc-login__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.sc-login__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.sc-login__form { display: flex; flex-direction: column; }
.sc-login__form .sc-btn { margin-top: 8px; justify-content: center; }
.sc-login__error { color: var(--sec-danger); font-size: 13px; margin-bottom: 8px; padding: 8px; background: var(--sec-coral-50); border-radius: var(--radius); }

/* --- View Header --- */
.sc-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.sc-view-header__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.sc-view-header__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sc-view-header__actions { display: flex; gap: 8px; }

/* --- Search Bar --- */
.sc-search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.sc-search .sc-input { max-width: 400px; }

/* --- Chat Layout --- */














/* --- Service Info Fallback --- */
.sc-service-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
  text-align: center;
}

.sc-service-fallback__icon svg { width: 64px; height: 64px; color: var(--text-secondary); opacity: 0.3; }
.sc-service-fallback__title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.sc-service-fallback__desc { font-size: 14px; color: var(--text-secondary); max-width: 500px; }
.sc-service-fallback .sc-btn { margin-top: 8px; }

/* --- Wiki Content --- */



/* --- Grid Layouts --- */
.sc-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.sc-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sc-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1024px) {
  .sc-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .native-view { padding: 16px; }
  .sc-grid-2, .sc-grid-3, .sc-grid-4 { grid-template-columns: 1fr; }
  .sc-view-header { flex-direction: column; align-items: flex-start; }
  .sc-stats-grid { grid-template-columns: 1fr; }
  .sc-chart-container--donut { flex-direction: column; }
}

/* =============================================================================
   Web UI v2 – Neue Komponenten (Benachrichtigungen, Suche, Favoriten, i18n)
   ============================================================================= */

/* --- Neue Accent-Farben fuer AI & Automatisierung (SecTepe-Brand) --- */
:root {
  --accent-ai: var(--sec-coral-500);
  --accent-automation: var(--sec-n-600);
  --accent-ats: var(--sec-coral-400);
}

/* --- Icon-Button (generisch) --- */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

/* Sprachumschalter: runde Flagge der aktiven Sprache (DE / UK). Welche Flagge
   sichtbar ist, entscheidet html[lang] (setzt applyI18n in app.js). Der feine
   Ring trennt die weissen Flaggenteile vom hellen Sidebar-Hintergrund. */
.lang-flag {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sec-fg) 16%, transparent);
}
.lang-flag svg {
  display: block;
  width: 100%;
  height: 100%;
}
html[lang="en"] .lang-flag-de,
html:not([lang="en"]) .lang-flag-gb {
  display: none;
}

/* --- Benachrichtigungs-Wrapper --- */
.notification-wrapper {
  position: relative;
}

.notification-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--sec-coral-500);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

/* --- App-Switcher (Waffle) & Konto-/Einstellungs-Panel (Säule A) --- */
.app-switcher-wrapper,
.settings-wrapper {
  position: relative;
}

/* Die Popover liegen `fixed` rechts neben der Sidebar-Unterkante: innerhalb
   der Sidebar (overflow:hidden, 240 px breit) wuerden sie abgeschnitten und
   den Inhalt nie ueberlappen. Die Sidebar hat keinen transform/filter, daher
   bezieht sich `fixed` auf den Viewport. Mobil (<=768 px) liegen sie als
   Bottom-Sheet ueber Drawer und Leisten (Mobile-Shell am Dateiende). */
.app-switcher-panel,
.settings-panel {
  position: fixed;
  bottom: 12px;
  left: calc(var(--sidebar-width) + 8px);
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  max-height: min(460px, calc(100vh - 24px));
  overflow: hidden;
}

.settings-panel {
  width: 280px;
}

.sidebar.collapsed .app-switcher-panel,
.sidebar.collapsed .settings-panel,
.sidebar.collapsed .notification-panel {
  left: calc(var(--sidebar-collapsed-width) + 8px);
}

.app-switcher-panel.open,
.settings-panel.open {
  display: flex;
}

.app-switcher-header,
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.app-switcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
}

.app-switcher-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  text-align: center;
  transition: background var(--transition);
}

.app-switcher-item:hover {
  background: var(--bg-primary);
}

.app-switcher-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

/* Ungelesen-Punkt je App im App-Switcher (P1.6 Phase 1). */
.app-switcher-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--sec-coral-600, #d6453d);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.app-switcher-label {
  line-height: 1.2;
  word-break: break-word;
}

.user-info-widget {
  cursor: pointer;
}

.settings-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.settings-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-email {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  transition: background var(--transition);
}

.settings-item:hover {
  background: var(--bg-primary);
}

.settings-item-danger {
  color: var(--sec-coral-600, #d6453d);
}

/* --- Benachrichtigungs-Panel --- */
.notification-panel {
  position: fixed;
  bottom: 12px;
  left: calc(var(--sidebar-width) + 8px);
  width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  max-height: min(400px, calc(100vh - 24px));
  overflow: hidden;
}

.notification-panel.open {
  display: flex;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.notifications-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius);
}

.notifications-clear-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }

/* Filter-Chip-Reihe ueber der Liste (P1.6 Phase 1) — nur bei mehr als einer
   Gruppe sichtbar (siehe renderNotificationFilters in app.js). */
.notification-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.notification-filter-chip {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background var(--transition), color var(--transition);
}

.notification-filter-chip:hover { color: var(--text-primary); }

.notification-filter-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.notification-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-item:last-child { border-bottom: none; }
.notification-item { position: relative; }
.notification-text { font-size: 13px; color: var(--text-primary); }
.notification-time { font-size: 11px; color: var(--text-secondary); }
.notification-empty { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
/* Mute-Button je Quelle: erscheint dezent beim Hover oben rechts. */
.notification-mute {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity 0.15s ease;
}
.notification-item:hover .notification-mute,
.notification-mute:focus { opacity: 0.7; }
.notification-mute:hover { opacity: 1; background: var(--bg-card-hover); }
/* Verwaltung stummgeschalteter Quellen am Panel-Ende. */
.notification-muted { padding: 8px 12px; border-top: 1px solid var(--border-color); }
.notification-muted-title { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; }
.muted-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.muted-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card-hover); border: 1px solid var(--border-color);
  color: var(--text-primary); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 4px 8px; border-radius: 999px;
}
.muted-chip:hover { border-color: var(--text-secondary); }
.muted-chip-x { font-size: 14px; color: var(--text-secondary); }
/* E-Mail-Digest-Frequenz am Panel-Ende. */
.notification-digest { padding: 8px 12px; border-top: 1px solid var(--border-color); }
.notification-digest-label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.notification-digest-select {
  background: var(--bg-card-hover); border: 1px solid var(--border-color);
  color: var(--text-primary); border-radius: 6px; padding: 2px 6px; font-size: 12px;
}
.notification-info .notification-text::before { content: 'ℹ '; }
.notification-warning .notification-text::before { content: '⚠ '; color: var(--sec-warning); }
.notification-error .notification-text::before { content: '✗ '; color: var(--sec-danger); }
.notification-success .notification-text::before { content: '✓ '; color: var(--sec-success); }

/* Anklickbare Eintraege (mit Entity) → Deep-Link in die Ziel-App. */
.notification-clickable { cursor: pointer; }
.notification-clickable:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.04));
}
.notification-clickable:focus-visible {
  background: var(--hover-bg, rgba(0, 0, 0, 0.04));
  outline: 2px solid var(--sec-ring);
  outline-offset: -2px;
}
/* Ungelesene Eintraege optisch hervorheben (Coral-Markierung links). */
.notification-unread { box-shadow: inset 3px 0 0 0 var(--sec-coral, #ff908b); }
.notification-unread .notification-text { font-weight: 600; }

/* --- Globale Suche Overlay --- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.search-overlay.open {
  display: flex;
}

.search-modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.search-icon { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
}

.search-input::placeholder { color: var(--text-secondary); }

.search-results {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item--active { background: var(--bg-card-hover); outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.search-no-results { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* --- Gespeicherte / zuletzt genutzte Suchen (Schritt 3) --- */
.search-saved-item, .search-recent-item { display: flex; align-items: center; gap: 8px; }
.search-saved-item .search-result-label,
.search-recent-item .search-result-label {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-saved-del {
  flex: 0 0 auto; background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0 6px; border-radius: 4px;
}
.search-saved-del:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.search-save-row .search-result-label { font-weight: 500; }

/* --- Palette-Aktionen (Roadmap 4.3): "Neue E-Mail", "Ticket anlegen", … --- */
.search-action-item { display: flex; align-items: center; gap: 10px; }
.search-action-item .search-result-label { flex: 1 1 auto; font-weight: 500; }
.search-action-type { grid-row: auto; flex: 0 0 auto; }

/* --- Favoriten-Bereich --- */
.favorites-section {
  margin-top: 32px;
}

.favorites-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.favorites-hint {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 0;
}

.favorite-btn.is-favorite {
  color: var(--sec-warning);
}

.favorite-btn.is-favorite svg {
  fill: var(--sec-warning);
  stroke: var(--sec-warning);
}

/* --- Admin-Bereich --- */
.admin-section {
  margin-top: 32px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--sec-coral-400);
  border-radius: var(--radius-lg);
}

.admin-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.admin-section-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}








/* --- Dashboard Card Farben fuer neue Dienste --- */


/* =============================================================================
   Dashboard v2 – Service-Tiles, Stat-Row, Schnellzugriff-Grid
   ============================================================================= */

/* --- Stat Row --- */
.dash-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.dash-stats-row .sc-stat-card {
  flex: 1 1 160px;
  min-width: 140px;
}

/* === Anstehende Besprechungen (Dashboard-Widget) ====================== */
.dash-meetings { margin-top: 1.25rem; }

.dash-meetings__card { padding: 4px 0; }

/* --- "Mein Tag" Top-Sektion: Heute / Dateien / Posteingang ---
   Reuses the existing .dash-meeting* list styles below; only the grid,
   the widget header and the empty/unread tweaks are new. */
.dash-today {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}
.dash-widget__head svg { color: var(--accent-primary); vertical-align: -3px; margin-right: 6px; }
.dash-widget__more {
  font-size: 0.8rem;
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.dash-widget__link { color: inherit; text-decoration: none; }
.dash-widget__link:hover { text-decoration: underline; }
.dash-widget__empty { margin: 0; padding: 14px 16px; color: var(--text-secondary); font-size: 0.86rem; }
.dash-mail--unread .dash-meeting__title { font-weight: 700; }
/* Whole Posteingang row is the click target (opens the message in the webmail). */
.dash-mail-item__link { display: block; }
.dash-mail-item__link:hover { text-decoration: none; }
.dash-mail-item { cursor: pointer; border-radius: 6px; }
.dash-mail-item:hover { background: var(--surface-hover, rgba(127, 127, 127, 0.10)); }

/* --- Activity-Timeline (Schritt 4) --- */
.dash-activity { margin-top: 1.25rem; }
.dash-activity__card { padding: 4px 0; }
.dash-activity__list { list-style: none; margin: 0; padding: 0; }
.dash-activity__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}
.dash-activity__item:last-child { border-bottom: none; }
.dash-activity__item.is-clickable { cursor: pointer; }
.dash-activity__item.is-clickable:hover { background: var(--bg-card-hover); }
.dash-activity__dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
}
.dash-activity__item--success .dash-activity__dot { background: var(--success, #2ecc71); }
.dash-activity__item--warning .dash-activity__dot { background: var(--warning, #f1c40f); }
.dash-activity__item--error   .dash-activity__dot { background: var(--danger, #e74c3c); }
.dash-activity__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-activity__title { color: var(--text-primary); font-size: 14px; }
.dash-activity__meta { color: var(--text-secondary); font-size: 12px; }

.dash-meetings__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-meeting {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--sec-n-100, #eee);
}
.dash-meeting:last-child { border-bottom: 0; }

.dash-meeting__time {
  flex: 0 0 auto;
  min-width: 88px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-primary, #2bbc8a);
}

.dash-meeting__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-meeting__title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-meeting__title svg { vertical-align: -2px; color: var(--accent-video, #6c5ce7); }
.dash-meeting__meta {
  font-size: 0.85em;
  color: var(--sec-n-500, #888);
}

.dash-meeting__join {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: var(--accent-video, #6c5ce7);
}
.dash-meeting__join:hover { filter: brightness(1.07); }

/* --- Gruppen-Label --- */
.dash-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin: 16px 0 8px;
}

/* --- Service Tile Grid --- */
.dash-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

/* --- Service Tile --- */
.dash-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 14px;
  padding-right: 28px;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.dash-tile:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
  border-color: var(--accent-primary);
}

/* Status-Akzent am linken Rand (von updateServiceTile gepflegt). */
.dash-tile--healthy   { border-left-color: var(--sec-success); }
.dash-tile--unhealthy { border-left-color: var(--sec-danger); }
.dash-tile--checking  { border-left-color: var(--border-color); }

/* Icon + Name in einer Kopfzeile. */
.dash-tile__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dash-tile__icon {
  flex-shrink: 0;
  color: var(--accent-primary);
}

.dash-tile__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Favoriten-Stern (oben rechts) + Open-in-Tab-Button. */
.dash-tile__fav {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  /* Stern dauerhaft klar sichtbar: die fruehere 0.45-Hover-Reveal-Variante
     war auf dem Handy (kein Hover) praktisch unsichtbar — Nutzer fanden den
     Favoriten-Stern nicht. Jetzt auf ALLEN Geraeten gut erkennbar. */
  opacity: 0.85;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}
.dash-tile__fav svg { width: 16px; height: 16px; }

.dash-tile:hover .dash-tile__fav { opacity: 1; }
.dash-tile__fav:hover { color: var(--accent-primary); opacity: 1; background: var(--bg-card-hover, rgba(127,127,127,0.15)); }
.dash-tile__fav.is-active { opacity: 1; color: var(--sec-warning, #f5b301); }
.dash-tile__fav.is-active svg { fill: currentColor; }

/* Touch-Geraete (kein Hover): Stern + Open-Button immer voll sichtbar. */
@media (hover: none), (pointer: coarse) {
  .dash-tile__fav { opacity: 0.95; }
  .dash-tile__open { opacity: 0.8; }
}

.dash-tile__open {
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}

.dash-tile:hover .dash-tile__open { opacity: 0.75; }
.dash-tile__open:hover { color: var(--accent-primary); opacity: 1; }

/* --- Filterleiste --- */
.dash-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
}

.dash-filter-group {
  display: flex;
  gap: 4px;
}

.dash-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.dash-filter-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.dash-filter-btn.is-active {
  /* accent-primary (coral-300 #FF908B) mit weissem Text erreicht nur ~2.18:1
     — WCAG 2.1 AA fordert 4.5:1 fuer Normaltext. coral-600 (#B83E39) liefert
     ~5.5:1 und folgt dem Muster von --bg-sidebar-active. */
  background: var(--sec-coral-600);
  border-color: var(--sec-coral-600);
  color: #fff;
}

.dash-filter-input {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
}

.dash-filter-input:focus { outline: none; border-color: var(--accent-primary); }

.dash-tile__status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-tile__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-tile__dot--online   { background: var(--sec-success); }
.dash-tile__dot--offline  { background: var(--sec-danger); }
.dash-tile__dot--checking {
  background: var(--border-color);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.dash-tile__status {
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-tile__badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sec-n-100);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 11px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Schnellzugriff Grid (Dashboard v2) --- */
.dash-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.dash-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
}

.dash-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.dash-action svg {
  flex-shrink: 0;
  color: var(--accent-primary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .dash-tile-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .dash-actions-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .dash-stats-row .sc-stat-card { flex: 1 1 120px; }
}

/* === Kontext-Panel (Phase 4 – Unified Entity Graph) === */
.sc-context-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--bg-card-hover);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 40;
}
.sc-context-panel.is-open {
  transform: translateX(0);
}
.sc-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bg-card-hover);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.sc-context-close {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.sc-context-close:hover {
  opacity: 1;
  background: var(--bg-card-hover);
}
.sc-context-state {
  padding: 12px 16px;
  color: var(--text-primary);
  opacity: 0.6;
  font-size: 12px;
}
/* Dokument-Repraesentationen (document-hub) — pro System eine Zeile mit
   Zustand; verlinkte Eintraege oeffnen die jeweilige Form in neuem Tab. */
.sc-context-reps {
  padding: 0 8px;
}
.sc-context-reps:empty {
  display: none;
}
.sc-context-reps-head {
  padding: 8px 8px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  color: var(--text-primary);
}
.sc-context-rep {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-primary);
}
.sc-context-rep.is-link {
  cursor: pointer;
}
.sc-context-rep.is-link:hover {
  background: var(--bg-card-hover);
}
.sc-context-rep-sys {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-context-rep-state {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-card-hover);
  opacity: 0.85;
  white-space: nowrap;
}
.sc-context-rep-state[data-state="failed"],
.sc-context-rep-state[data-state="quarantined"] {
  color: #b91c1c;
}
.sc-context-rep-state[data-state="completed"],
.sc-context-rep-state[data-state="signed"] {
  color: #15803d;
}

.sc-context-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 16px;
  overflow-y: auto;
  flex: 1;
}
.sc-context-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
}
.sc-context-item:hover {
  background: var(--bg-card-hover);
}
.sc-context-item-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-context-item-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.7;
}
.sc-context-type {
  background: var(--bg-card-hover);
  padding: 1px 6px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
}
.sc-context-relation {
  color: var(--accent-primary);
}

@media (max-width: 768px) {
  .sc-context-panel { width: 100%; }
}

/* === Globale Suche – Sektionen, Entity-Hits (Phase 5) === */
.search-section-header {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.5;
  cursor: default;
}
.search-section-header:hover {
  background: transparent !important;
}
.search-result-entity {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: start;
  padding: 8px 14px;
}
.search-result-type {
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.search-type-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.search-result-label {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-snippet {
  grid-column: 2;
  font-size: 12px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-snippet mark {
  background: var(--sec-coral-100);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* === Filter-Chips fuer Ctrl+K (P5b) === */
.search-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px 4px;
  border-top: 1px solid var(--border-color);
}
.search-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.search-filter-row:empty { display: none; }
.search-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.search-filter-chip[data-filter-source] {
  font-family: ui-monospace, monospace;
}
.search-filter-chip:hover { background: var(--bg-card-hover); }
.search-filter-chip.active {
  background: var(--brand, var(--sec-coral-300));
  color: #fff;
  border-color: var(--brand, var(--sec-coral-300));
}

/* Source-Badge zusaetzlich zum Type-Badge im Treffer. */
.search-result-source {
  grid-row: 1 / span 2;
  align-self: center;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-family: ui-monospace, monospace;
  text-transform: lowercase;
  margin-left: 4px;
}

/* Service-Treffer werden sekundaer unter den Inhalts-Treffern dargestellt. */
.search-section-secondary { opacity: 0.65; }
li.search-section-secondary.search-result-item { font-size: 12px; }

/* Loading-State (animierte Punkte) und Error-State (Retry) im Result-Frame. */
.search-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px;
  color: var(--text-secondary);
  font-size: 13px;
}
.search-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.4;
  animation: search-loading-pulse 1.2s infinite ease-in-out;
}
.search-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.search-loading-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes search-loading-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
.search-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
}
.search-retry-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.search-retry-btn:hover { background: var(--bg-card-hover); }

/* === Kontext-Panel AI-Button (Phase 6) === */
.sc-context-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sc-context-ai {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
}
.sc-context-ai:hover {
  filter: brightness(1.1);
}
.sc-context-ai svg {
  opacity: 0.9;
}

/* === KI-Admin-Assistent (admin-ai) =================================== */
.admin-ai .aai-head { margin-bottom: 16px; }
.admin-ai .aai-grid {
  display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 16px;
}
@media (max-width: 900px) {
  .admin-ai .aai-grid { grid-template-columns: 1fr; }
}
.admin-ai .aai-pane-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.admin-ai .aai-pane-head h2 { margin: 0; font-size: 16px; }
.admin-ai .aai-pane-head .aai-refresh { margin-left: auto; }
.admin-ai .aai-findings-pane,
.admin-ai .aai-chat-pane {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 16px;
}
.admin-ai .aai-empty, .admin-ai .aai-error { color: var(--text-secondary, var(--text-primary)); }
.admin-ai .aai-error { color: var(--sec-danger); }

.admin-ai .aai-finding {
  border-left: 3px solid var(--border-color);
  padding: 8px 12px; margin-bottom: 8px;
  background: var(--bg-card-hover);
  border-radius: 4px;
}
.admin-ai .aai-critical { border-left-color: var(--sec-danger); }
.admin-ai .aai-warning  { border-left-color: var(--sec-warning); }
.admin-ai .aai-info     { border-left-color: var(--sec-info); }
.admin-ai .aai-finding-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.admin-ai .aai-finding-body { font-size: 13px; line-height: 1.4; }

.admin-ai .aai-badge {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 6px;
  border-radius: 3px; background: var(--bg-card); border: 1px solid var(--border-color);
  color: var(--text-primary); letter-spacing: 0.04em;
}
.admin-ai .aai-sev {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 3px;
}
.admin-ai .aai-sev-critical { background: var(--sec-danger); color: #fff; }
.admin-ai .aai-sev-warning  { background: var(--sec-warning); color: #000; }
.admin-ai .aai-sev-info     { background: var(--sec-info); color: #fff; }

/* Korrelierte Findings-Gruppe (mehr als ein Mitglied). */
.admin-ai .aai-group {
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: 6px; padding: 8px; margin-bottom: 10px;
  background: var(--bg-card);
}
.admin-ai .aai-group.aai-critical { border-left-color: var(--sec-danger); }
.admin-ai .aai-group.aai-warning  { border-left-color: var(--sec-warning); }
.admin-ai .aai-group.aai-info     { border-left-color: var(--sec-info); }
.admin-ai .aai-group-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.admin-ai .aai-group-title { font-size: 13px; }
.admin-ai .aai-group-count {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  background: var(--bg-card-hover); border: 1px solid var(--border-color);
}
.admin-ai .aai-group-reason { flex-basis: 100%; font-size: 11px; }
.admin-ai .aai-group .aai-finding { background: var(--bg-card-hover); }

/* Konfidenz-Badge an der finalen Analyse-Antwort. */
.admin-ai .aai-confidence {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 3px; margin-bottom: 6px;
  border: 1px solid var(--border-color);
}
.admin-ai .aai-confidence-hoch    { background: var(--sec-success, #1a7f37); color: #fff; }
.admin-ai .aai-confidence-mittel  { background: var(--sec-warning); color: #000; }
.admin-ai .aai-confidence-niedrig { background: var(--sec-danger); color: #fff; }

.admin-ai .aai-thread {
  height: 360px; overflow-y: auto; padding: 8px;
  background: var(--bg-card-hover); border-radius: 6px; margin-bottom: 12px;
}
.admin-ai .aai-msg {
  margin-bottom: 8px; padding: 8px 10px; border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}
.admin-ai .aai-msg-user { background: var(--accent-primary); color: #000; align-self: flex-end; }
.admin-ai .aai-msg-assistant { background: var(--bg-card); border: 1px solid var(--border-color); }
.admin-ai .aai-typing { opacity: 0.6; }

.admin-ai .aai-tool {
  font-family: ui-monospace, monospace; font-size: 12px; opacity: 0.85;
  padding: 4px 8px; margin-bottom: 4px; background: transparent;
  border-left: 2px solid var(--accent-primary);
}
.admin-ai .aai-tool-name { font-weight: 600; }
.admin-ai .aai-tool-result {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; overflow-x: auto;
}
.admin-ai .aai-tool-result pre { margin: 4px 0 0; white-space: pre-wrap; }

.admin-ai .aai-form { display: flex; gap: 8px; }
.admin-ai .aai-form input {
  flex: 1; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary);
}

/* === Copilot (End-User-Assistent) =================================== */
.copilot .cop-head { margin-bottom: 16px; }
.copilot .cop-tabs { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.copilot .cop-tab {
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary); font-size: 13px;
}
.copilot .cop-tab-active {
  background: var(--accent-primary); color: #000; border-color: var(--accent-primary);
}
.copilot .cop-thread {
  height: 420px; overflow-y: auto; padding: 8px;
  background: var(--bg-card-hover); border-radius: 6px; margin-bottom: 12px;
}
.copilot .cop-msg {
  margin-bottom: 8px; padding: 8px 10px; border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}
.copilot .cop-msg-user { background: var(--accent-primary); color: #000; }
.copilot .cop-msg-assistant { background: var(--bg-card); border: 1px solid var(--border-color); }
.copilot .cop-typing { opacity: 0.6; }
.copilot .cop-error { color: var(--sec-danger); }
.copilot .cop-form { display: flex; gap: 8px; }
.copilot .cop-form input {
  flex: 1; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary);
}

/* === Copilot Nextcloud connect widget ================================= */
.copilot .cop-dav-host { margin: 10px 0; }
.copilot .cop-dav-widget {
  padding: 8px 10px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  font-size: 13px;
}
.copilot .cop-dav-ok { color: var(--sec-success, #2E8B6B); font-weight: 700; }
.copilot .cop-dav-form p { margin: 0 0 6px; }
.copilot .cop-dav-paste { display: flex; gap: 6px; }
.copilot .cop-dav-paste input {
  flex: 1; padding: 6px 8px; border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-hover); color: var(--text-primary);
}

/* === Copilot tool chips (inline tool_call/tool_result rendering) ====== */
.copilot .cop-tool {
  margin: 6px 0; padding: 8px 10px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  font-size: 13px;
}
.copilot .cop-tool-pending { border-left: 3px solid var(--sec-info, #4a90e2); }
.copilot .cop-tool-ok      { border-left: 3px solid var(--sec-success, #2E8B6B); }
.copilot .cop-tool-error   { border-left: 3px solid var(--sec-danger); }
.copilot .cop-tool-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.copilot .cop-tool-head code {
  background: var(--bg-card-hover); padding: 1px 6px; border-radius: 4px;
}
.copilot .cop-tool-spin { animation: cop-spin 1.5s linear infinite; display: inline-block; }
.copilot .cop-tool-mark { font-weight: 700; }
.copilot .cop-tool-toggle { margin-left: auto; }
.copilot .cop-sources { margin: 6px 0 0; padding-left: 20px; }
.copilot .cop-sources li { margin: 2px 0; }
.copilot .cop-source-snippet { font-size: 0.85em; opacity: 0.8; }
.copilot .cop-tool-args, .copilot .cop-tool-detail {
  margin: 6px 0 0; padding: 6px 8px; border-radius: 4px;
  background: var(--bg-card-hover); font-size: 11px;
  white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
}
@keyframes cop-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* === Copilot approval dialog (schemagetriebener Editor) ================ */
.copilot .cop-confirm h3 { margin: 0 0 12px; }
.copilot .cop-confirm .cop-field { display: block; margin: 10px 0; }
.copilot .cop-confirm .cop-field > input,
.copilot .cop-confirm .cop-field > textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 6px 8px; border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary);
  font-family: inherit; font-size: 13px; box-sizing: border-box;
}
.copilot .cop-confirm .cop-field > textarea { min-height: 120px; resize: vertical; }
/* Approval dialogs are wider than the generic admin-ai one — long text
   fields (mail body, ticket resolution) would feel cramped at 500px. */
#cop-confirm.aai-dialog,
#cop-appr-dialog.aai-dialog { max-width: 640px; width: 90vw; }

/* === Copilot: Bereichs- und Anbieter-Chips (MCP-Steuerungsebene, ADR 0021) === */
.copilot .cop-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px;
}
.copilot .cop-provider, .copilot .cop-families {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.copilot .cop-families-label { font-size: 12px; }
.copilot .cop-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; line-height: 1.2; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-color); font-family: inherit;
}
.copilot button.cop-chip { cursor: pointer; }
.copilot button.cop-chip:hover { background: var(--bg-card-hover); }
.copilot .cop-chip-selected { outline: 2px solid var(--accent-primary); outline-offset: -1px; }
.copilot .cop-chip-pinned { border-color: var(--accent-primary); font-weight: 700; }
.copilot .cop-chip-provider { color: var(--sec-success, #2E8B6B); border-color: var(--sec-success, #2E8B6B); }
.copilot .cop-chip-pinned-provider { font-weight: 700; }

/* === Copilot: Stufen-, Datenklassen- und Herkunfts-Badges ================ */
.copilot .cop-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.copilot .cop-badge {
  display: inline-block; font-size: 11px; line-height: 1.2; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em;
  background: var(--bg-card-hover); color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.copilot .cop-badge-t0 { color: var(--sec-success, #2E8B6B); border-color: var(--sec-success, #2E8B6B); }
.copilot .cop-badge-t1 { color: var(--sec-info, #4a90e2); border-color: var(--sec-info, #4a90e2); }
.copilot .cop-badge-t2 { color: var(--sec-warning); border-color: var(--sec-warning); }
.copilot .cop-badge-t3 { color: var(--sec-danger); border-color: var(--sec-danger); }
.copilot .cop-badge-vertraulich { color: var(--sec-warning); border-color: var(--sec-warning); }
.copilot .cop-badge-streng-vertraulich { color: var(--sec-danger); border-color: var(--sec-danger); }
.copilot .cop-badge-origin { font-weight: 400; opacity: 0.85; }

/* === Copilot: Warteschlange (Mandanten-Semaphor) und Werkzeug-Fehler ===== */
.copilot .cop-queued { font-style: italic; }
.copilot .cop-tool-fail { margin: 6px 0 0; font-size: 12px; }

/* === Copilot: schemagetriebener Freigabe-Editor, Phrase, Vorschau, Diff === */
.copilot .cop-confirm .cop-field-desc { display: block; font-size: 12px; margin-top: 2px; }
.copilot .cop-confirm .cop-field-check { display: flex; align-items: center; gap: 8px; }
.copilot .cop-confirm .cop-field-check > input { width: auto; margin: 0; }
.copilot .cop-confirm .cop-required { color: var(--sec-danger); }
.copilot .cop-confirm .cop-extra-args { margin: 10px 0; font-size: 12px; }
.copilot .cop-confirm .cop-extra-args pre,
.copilot .cop-confirm .cop-preview pre {
  margin: 6px 0 0; padding: 8px; border-radius: 4px;
  background: var(--bg-card-hover); font-size: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
}
.copilot .cop-confirm .cop-preview { margin: 10px 0; }
.copilot .cop-confirm .cop-diff { margin: 10px 0; font-size: 12px; }
.copilot .cop-confirm .cop-diff ul { margin: 4px 0 0; padding-left: 20px; }
.copilot .cop-confirm .cop-diff code { background: var(--bg-card-hover); padding: 1px 4px; border-radius: 3px; }
.copilot .cop-confirm .cop-phrase > input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}
.copilot .cop-confirm .cop-dialog-error { font-size: 12px; margin: 8px 0 0; }

/* === Copilot: Panel "Offene Freigaben" (dauerhafte Vorschlaege, Phase 4) == */
.copilot .cop-approvals {
  margin: 0 0 16px; padding: 12px 14px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border-color);
}
.copilot .cop-approvals[hidden] { display: none; }
.copilot .cop-appr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.copilot .cop-appr-head h2 { margin: 0; font-size: 16px; flex: 1; min-width: 160px; }
.copilot .cop-appr-count { font-size: 12px; font-weight: 400; color: var(--sec-warning); }
.copilot .cop-appr-done { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.copilot .cop-appr-intro { margin: 6px 0 0; font-size: 12px; }
.copilot .cop-appr-status { margin: 6px 0 0; font-size: 12px; min-height: 0; }
.copilot .cop-appr-status:empty { display: none; }
.copilot .cop-appr-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.copilot .cop-appr-row {
  margin: 6px 0; padding: 8px 10px; border-radius: 6px; font-size: 13px;
  background: var(--bg-card-hover); border: 1px solid var(--border-color);
  border-left: 3px solid var(--sec-warning);
}
.copilot .cop-appr-state-approved,
.copilot .cop-appr-state-executing { border-left-color: var(--sec-info, #4a90e2); }
.copilot .cop-appr-state-executed { border-left-color: var(--sec-success, #2E8B6B); }
.copilot .cop-appr-state-failed { border-left-color: var(--sec-danger); }
.copilot .cop-appr-state-rejected,
.copilot .cop-appr-state-expired,
.copilot .cop-appr-state-cancelled { border-left-color: var(--border-color); opacity: 0.8; }
.copilot .cop-appr-focus { outline: 2px solid var(--accent-primary); outline-offset: -1px; }
.copilot .cop-appr-row-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.copilot .cop-appr-row-head .cop-badge { margin: 0; }
.copilot .cop-appr-tool { background: var(--bg-card); padding: 1px 6px; border-radius: 4px; }
.copilot .cop-appr-state {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border-color);
}
.copilot .cop-appr-meta { margin: 4px 0 0; font-size: 12px; }
.copilot .cop-appr-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 0; }
.copilot .cop-appr-details { margin: 6px 0 0; font-size: 12px; }
.copilot .cop-appr-details summary { cursor: pointer; }
.copilot .cop-appr-details p { margin: 4px 0; }
.copilot .cop-appr-preview { margin: 4px 0; padding-left: 18px; }
.copilot .cop-appr-preview code,
.copilot .cop-appr-details code { background: var(--bg-card); padding: 1px 4px; border-radius: 3px; }
.copilot .cop-appr-args { max-height: 240px; overflow: auto; }
.copilot .cop-appr-result { margin: 6px 0 0; font-size: 12px; }
.copilot .cop-appr-result-error summary { color: var(--sec-danger); }
.copilot .cop-appr-empty, .copilot .cop-appr-hidden { padding: 6px 2px; font-size: 12px; }

/* === Copilot: Karte "Externe MCP-Clients verbinden" ===================== */
.copilot .cop-mcp-card {
  margin-top: 20px; padding: 14px 16px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border-color);
}
.copilot .cop-mcp-card h2 { margin: 0 0 8px; font-size: 16px; }
.copilot .cop-mcp-card p { margin: 0 0 8px; }
.copilot .cop-mcp-steps { margin: 8px 0; padding-left: 20px; }
.copilot .cop-mcp-steps li { margin: 4px 0; }
.copilot .cop-copy-field {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0;
}
.copilot .cop-copy-label { font-size: 12px; min-width: 120px; opacity: 0.85; }
.copilot .cop-copy-value {
  flex: 1; min-width: 0; padding: 4px 8px; border-radius: 4px;
  background: var(--bg-card-hover); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.aai-dialog {
  border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-card); color: var(--text-primary); max-width: 500px;
}
.aai-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.aai-confirm h3 { margin: 0 0 12px; }
.aai-confirm .aai-args {
  background: var(--bg-card-hover); border-radius: 4px; padding: 8px;
  font-size: 12px; white-space: pre-wrap; word-break: break-all;
}
.aai-confirm .aai-warn { color: var(--sec-warning); font-size: 12px; margin: 8px 0; }
.aai-confirm menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 12px 0 0; }

/* Severity-Filter-Leiste ueber der Findings-Liste */
.admin-ai .aai-summary {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.admin-ai .aai-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.admin-ai .aai-chip-n {
  font-weight: 700; font-size: 11px; opacity: 0.85;
}
.admin-ai .aai-chip-active { outline: 2px solid var(--accent-primary); outline-offset: -1px; }
.admin-ai .aai-chip-critical .aai-chip-n { color: var(--sec-danger); }
.admin-ai .aai-chip-warning .aai-chip-n { color: var(--sec-warning); }
.admin-ai .aai-chip-info .aai-chip-n { color: var(--sec-info); }

/* Findings: Aktionszeile + aufklappbare Rohdaten */
.admin-ai .aai-finding-actions {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
.admin-ai .aai-link {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 12px; color: var(--accent-primary); text-decoration: underline;
}
.admin-ai .aai-finding-details {
  margin: 8px 0 0; padding: 8px; font-size: 11px; line-height: 1.4;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 4px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  max-height: 240px; overflow-y: auto;
}
.admin-ai .aai-finding-details[hidden] { display: none; }

/* Marker fuer per-Klick gestartete Analyse-Anfragen im Chat */
.admin-ai .aai-analyze-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: 3px; margin-right: 4px;
  background: var(--accent-primary); color: #000;
}
.admin-ai .aai-msg-assistant strong { color: var(--text-primary); }
.admin-ai .aai-msg-assistant code {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--bg-card-hover); padding: 1px 4px; border-radius: 3px;
}

/* === Meine Geraete / Raumsysteme / Mein Desktop / Ressourcenbuchung ===
   Gemeinsame dev-*-Bausteine dieser nativen Views. Optik 1:1 nach
   @sectepe/design-system app-base.css (.card, .badge-*, .table, .input;
   Buttons nutzen sc-btn) - nur ueber --sec-*-Tokens, ohne die Komponenten-CSS zu laden
   (CSS-Budget, siehe scripts/sync-design-system.mjs). Feste Statusfarben
   haben unten ihre Dark-Overrides wie im Design-System. */
.dev-card {
  background: var(--sec-surface); color: var(--sec-fg);
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-card);
  padding: var(--sec-space-5); margin: 16px;
}
.dev-card h2 {
  margin: 0; font-family: var(--sec-font-display); font-size: var(--sec-fs-xl);
  font-weight: var(--sec-fw-semibold); letter-spacing: var(--sec-tracking-snug);
  line-height: var(--sec-lh-snug); color: var(--sec-fg);
}
.dev-card h3 {
  margin: var(--sec-space-6) 0 var(--sec-space-2); font-size: var(--sec-fs-base);
  font-weight: var(--sec-fw-semibold); color: var(--sec-fg);
}
.dev-sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.dev-sr-status {
  position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden;
}
.dev-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 4px;
}
.dev-toolbar { display: flex; gap: 12px; align-items: center; }
.dev-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: var(--sec-fs-sm); color: var(--sec-fg);
}
.dev-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--sec-fg); cursor: pointer; }
.dev-help { font-size: var(--sec-fs-sm); color: var(--sec-fg-muted); margin: 4px 0 16px; line-height: 1.5; }
.dev-help a { color: var(--sec-link); text-decoration: none; }
.dev-help a:hover { text-decoration: underline; }
.dev-help code, .dev-table code {
  font-family: var(--sec-font-mono); font-size: var(--sec-fs-xs);
  background: var(--sec-surface-alt); padding: 1px 5px; border-radius: var(--sec-radius-sm);
}
.dev-empty {
  border: 1px dashed var(--sec-border); border-radius: var(--sec-radius-card);
  padding: var(--sec-space-8) var(--sec-space-6); text-align: center;
}
.dev-empty-icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--sec-fg-muted); }
.dev-empty h3 { margin: 0 0 4px; font-size: var(--sec-fs-base); font-weight: var(--sec-fw-semibold); color: var(--sec-fg); }
.dev-empty p { max-width: 42ch; margin: 0 auto 16px; font-size: var(--sec-fs-sm); line-height: 1.6; color: var(--sec-fg-muted); }
/* Skeleton-Loader fuer das initiale Pagewide-Loading. */
@keyframes dev-skel-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.dev-skel {
  display: inline-block; height: 14px; border-radius: var(--sec-radius-sm);
  background: linear-gradient(90deg, var(--sec-surface-alt) 0%, var(--sec-border) 50%, var(--sec-surface-alt) 100%);
  background-size: 400px 100%;
  animation: dev-skel-shimmer 1.4s ease-in-out infinite;
}
.dev-skel-xs { width: 50px; }
.dev-skel-sm { width: 90px; }
.dev-skel-md { width: 140px; }
@media (prefers-reduced-motion: reduce) {
  .dev-skel { animation: none; }
}
/* = .sec-alert--warning */
.dev-error, .mydesk-assist {
  background: #FBF3E0; color: #8A6314; border: 1px solid #F0E1B8;
  border-radius: var(--sec-radius-card); padding: 10px 12px; margin: 8px 0;
  font-size: var(--sec-fs-sm);
}
.dev-error[hidden] { display: none; }
.dev-error ul { margin: 4px 0 0; padding-left: 18px; }
.dev-table-wrap { width: 100%; overflow-x: auto; }
.dev-table { width: 100%; border-collapse: collapse; font-size: var(--sec-fs-sm); }
.dev-table thead th {
  text-align: left; height: 34px; padding: 0 12px; white-space: nowrap;
  border-bottom: 1px solid var(--sec-border);
  font-size: var(--sec-fs-xs); font-weight: var(--sec-fw-medium); color: var(--sec-fg-subtle);
}
.dev-table tbody td {
  height: 36px; padding: 8px 12px; vertical-align: middle;
  border-bottom: 1px solid var(--sec-border);
}
.dev-table tbody tr:hover { background: var(--sec-hover); }
.dev-table tbody tr:last-child td { border-bottom: none; }
.dev-muted { color: var(--sec-fg-subtle); }
.dev-row-revoking td { opacity: 0.45; transition: opacity 200ms ease-out; }
/* = .badge .badge-pill + Statusvarianten */
.dev-badge {
  display: inline-flex; align-items: center; gap: 4px; line-height: 1; white-space: nowrap;
  font-size: var(--sec-fs-2xs); font-weight: var(--sec-fw-medium); padding: 3px 8px;
  border-radius: var(--sec-radius-pill); border: 1px solid var(--sec-border);
  background: var(--sec-surface-alt); color: var(--sec-fg-muted);
}
.dev-badge-corp, .mydesk-badge-wait { background: #EEF3FB; color: #284C7E; border-color: #CDDCF0; }
.dev-badge-byod { background: #FBF3E0; color: #8A6314; border-color: #F0E1B8; }
.dev-badge-active { background: #E7F3EE; color: #1F6B50; border-color: #C5E4D6; }
.dev-badge-revoked { background: var(--sec-coral-50); color: var(--sec-coral-700); border-color: var(--sec-coral-100); }

/* Formular-Raster im Muster .form-label/.input (Richtlinie der Nebenstellen, views/telephony-admin.js) */
.rooms-policy {
  display: grid; gap: 12px; align-items: end; margin: 8px 0 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.rooms-policy > label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: var(--sec-fs-xs); font-weight: var(--sec-fw-medium); color: var(--sec-fg-muted);
}
.rooms-policy fieldset {
  grid-column: 1 / -1; margin: 0; padding: 12px var(--sec-space-4);
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-card);
  display: flex; flex-wrap: wrap; gap: 8px 20px;
}
.rooms-policy legend { padding: 0 4px; font-size: var(--sec-fs-xs); font-weight: var(--sec-fw-medium); color: var(--sec-fg-muted); }
.rooms-policy fieldset .dev-help { flex-basis: 100%; margin: 4px 0 0; font-size: var(--sec-fs-xs); }
.rooms-policy > button { justify-self: start; }
.rooms-policy input:not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box; width: 100%; height: var(--sec-control-h); padding: 0 10px;
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-control);
  background: var(--sec-surface); color: var(--sec-fg);
  font-family: var(--sec-font-sans); font-size: var(--sec-fs-sm); font-weight: 400; line-height: 1.4;
  transition: border-color var(--sec-dur-fast) var(--sec-ease-out), box-shadow var(--sec-dur-fast) var(--sec-ease-out);
}
.rooms-policy input::placeholder { color: var(--sec-fg-subtle); }
.rooms-policy input:focus { outline: none; border-color: var(--sec-ring); box-shadow: var(--sec-shadow-focus-input); }
.dev-table td a { color: var(--sec-link); text-decoration: none; }
.dev-table td a:hover { text-decoration: underline; }

/* Geraeteverwaltung (views/device-admin.js): Filterleiste ueber der Tabelle */
.dadm .sc-tabs { margin: 0 0 12px; }
.dadm-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0 0 12px; }
.dadm-filters > label:not(.dev-toggle) {
  display: flex; flex-direction: column; gap: 4px;
  font-size: var(--sec-fs-xs); font-weight: var(--sec-fw-medium); color: var(--sec-fg-muted);
}
.dadm-filters input[type="search"], .dadm-filters select {
  box-sizing: border-box; height: var(--sec-control-h); padding: 0 10px; min-width: 220px;
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-control);
  background: var(--sec-surface); color: var(--sec-fg);
  font-family: var(--sec-font-sans); font-size: var(--sec-fs-sm); font-weight: 400;
}
.dadm-filters select { min-width: 160px; }
.dadm-filters input:focus, .dadm-filters select:focus { outline: none; border-color: var(--sec-ring); box-shadow: var(--sec-shadow-focus-input); }
.dadm .dev-error .dev-muted code { font-size: var(--sec-fs-xs); }

/* Mein Desktop (VDI-Selfservice, views/my-desktop.js) — baut auf .dev-card auf. */
.mydesk-card { max-width: 720px; }
.mydesk-lead { margin: 12px 0 8px; font-size: var(--sec-fs-base); line-height: 1.55; color: var(--sec-fg); }
.mydesk-lead code, .mydesk-host { font-family: var(--sec-font-mono); font-size: var(--sec-fs-xs); }
.mydesk-status { margin: 8px 0 16px; display: flex; align-items: center; gap: 10px; }
.mydesk-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.mydesk-open { display: inline-flex; }
.mydesk-badge-idle { background: var(--sec-surface-alt); color: var(--sec-fg-muted); }
/* Laufende Fernhilfe: dieselben Warnfarben wie .dev-error, der Nutzer soll es sehen. */
.mydesk-assist { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mydesk-alt { margin-top: 8px; }

/* Dark-Overrides fuer die fest getoenten Statusflaechen (wie components.css) */
[data-theme="dark"] .dev-error, [data-theme="dark"] .mydesk-assist, [data-theme="dark"] .dev-badge-byod {
  background: color-mix(in srgb, var(--sec-warning) 18%, transparent); color: #F0CF7A;
  border-color: color-mix(in srgb, var(--sec-warning) 35%, transparent);
}
[data-theme="dark"] .dev-badge-active {
  background: color-mix(in srgb, var(--sec-success) 18%, transparent); color: #8FD3B9;
  border-color: color-mix(in srgb, var(--sec-success) 35%, transparent);
}
[data-theme="dark"] .dev-badge-corp, [data-theme="dark"] .mydesk-badge-wait {
  background: color-mix(in srgb, var(--sec-info) 18%, transparent); color: #9CC1F2;
  border-color: color-mix(in srgb, var(--sec-info) 35%, transparent);
}
[data-theme="dark"] .dev-badge-revoked {
  background: color-mix(in srgb, var(--sec-coral-400) 18%, transparent); color: var(--sec-coral-200);
  border-color: color-mix(in srgb, var(--sec-coral-400) 35%, transparent);
}

/* ==============================================================================
   A11y: Skip-Link + Visually-Hidden + Toast/Live-Region
   ============================================================================== */

/* Bei Tab vom Body-Anfang sichtbar; sonst off-screen. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent-primary, #c2410c);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  transform: translateY(-150%);
  transition: transform 120ms ease;
}
.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--accent-primary, #c2410c);
  outline-offset: 2px;
}

/* Universelle visually-hidden-Klasse für Form-Labels, die nur Screen-Reader
   sehen sollen. Ergänzt das spezifische .dev-sr-only. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toast-Stack rechts unten. role="status" + aria-live="polite" wird vom
   toast.js-Modul am Container gesetzt. */
.sc-toast-region {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 40px));
}
.sc-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  background: #1f2937;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: sc-toast-in 160ms ease-out;
}
.sc-toast--info    { background: #1e40af; }
.sc-toast--success { background: #065f46; }
.sc-toast--warning { background: #92400e; }
.sc-toast--danger  { background: #991b1b; }

@keyframes sc-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sc-toast { animation: none; }
  .skip-link { transition: none; }
}

/* ==============================================================================
   Screen-Pop — eingehender Anruf.

   Oben rechts statt unten rechts wie die Toasts: es klingelt gerade, der
   Hinweis soll nicht mit fluechtigen Meldungen um dieselbe Ecke streiten.
   z-index ueber der Toast-Region, aus demselben Grund.
   ============================================================================== */
.sc-screen-pop-region {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(340px, calc(100vw - 40px));
}
.sc-screen-pop {
  position: relative;
  pointer-events: auto;
  padding: 14px 40px 14px 16px;
  border-radius: 8px;
  border-left: 4px solid #2563eb;
  background: #111827;
  color: #f9fafb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  animation: sc-screen-pop-in 180ms ease-out;
}
.sc-screen-pop__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93c5fd;
  margin-bottom: 2px;
}
.sc-screen-pop__name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  /* Ein langer Name darf das Fenster nicht sprengen und nicht den
     Schliessen-Knopf ueberdecken. */
  overflow-wrap: anywhere;
}
.sc-screen-pop__number {
  font-size: 14px;
  color: #d1d5db;
  overflow-wrap: anywhere;
}
.sc-screen-pop__company {
  font-size: 13px;
  color: #9ca3af;
  overflow-wrap: anywhere;
}
.sc-screen-pop__hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: #fcd34d;
}
.sc-screen-pop__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: #93c5fd;
}
.sc-screen-pop__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.sc-screen-pop__close:hover,
.sc-screen-pop__close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #f9fafb;
}

@keyframes sc-screen-pop-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sc-screen-pop { animation: none; }
}
/* Zustaende: im Gespraech gruen, verpasst rot; die Uhr/Dauer darunter. */
.sc-screen-pop[data-state="answered"] { border-left-color: #16a34a; }
.sc-screen-pop[data-state="missed"] { border-left-color: #dc2626; }
.sc-screen-pop[data-state="answered"] .sc-screen-pop__label { color: #86efac; }
.sc-screen-pop[data-state="missed"] .sc-screen-pop__label { color: #fca5a5; }
.sc-screen-pop__status {
  margin-top: 4px;
  font-size: 13px;
  color: #d1d5db;
  font-variant-numeric: tabular-nums;
}
.sc-screen-pop__status:empty { display: none; }
/* Nachbearbeitung nach dem Auflegen */
.sc-screen-pop__wrapup { margin-top: 10px; display: grid; gap: 6px; }
.sc-screen-pop__wrapup-label { font-size: 12px; color: #d1d5db; }
.sc-screen-pop__note {
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  resize: vertical;
  padding: 6px 8px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: #1f2937;
  color: #f9fafb;
  font: inherit;
  font-size: 13px;
}
.sc-screen-pop__note:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.sc-screen-pop__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-screen-pop__btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: transparent;
  color: #f9fafb;
  font-size: 12px;
  cursor: pointer;
}
.sc-screen-pop__btn:hover { background: rgba(255, 255, 255, 0.1); }
.sc-screen-pop__btn:focus-visible { background: rgba(255, 255, 255, 0.1); outline: 2px solid #fff; outline-offset: 2px; }
.sc-screen-pop__btn--primary { background: #2563eb; border-color: #2563eb; }
.sc-screen-pop__btn--primary:hover, .sc-screen-pop__btn--primary:focus-visible { background: #1d4ed8; }
.sc-screen-pop__btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sc-screen-pop__result { font-size: 12px; line-height: 1.35; color: #d1d5db; }
.sc-screen-pop__result:empty { display: none; }
.sc-screen-pop__result[data-kind="success"] { color: #86efac; }
.sc-screen-pop__result[data-kind="warning"] { color: #fcd34d; }
.sc-screen-pop__result[data-kind="error"] { color: #fca5a5; }
/* Softphone (js/softphone.js): Waehltastatur 3x4; sonst Screen-Pop-/tel-Klassen. */
.sp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 180px; }
.tel-softphone { margin-bottom: 12px; }

/* Telefon / Anrufliste (views/telephony.js) */
.tel { max-width: 960px; }
.tel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tel-title { margin: 0; font-size: var(--sec-fs-lg, 18px); }
.tel-tabs { margin-bottom: 12px; }
.tel-msg { font-size: var(--sec-fs-sm); color: var(--sec-danger); }
.tel-msg:empty { display: none; }
.tel-list { list-style: none; margin: 0; padding: 0; }
.tel-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-areas: "dir main facts" "dir actions actions" "dir editor editor" "dir msg msg";
  gap: 4px 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--sec-border);
}
.tel-row--current { background: var(--sec-hover); }
.tel-dir { grid-area: dir; font-size: 18px; line-height: 1.4; text-align: center; color: var(--sec-fg-muted); }
.tel-dir--missed { color: var(--sec-danger); }
.tel-main { grid-area: main; min-width: 0; }
.tel-name { font-weight: var(--sec-fw-medium); overflow-wrap: anywhere; }
.tel-row--missed .tel-name { color: var(--sec-danger); }
.tel-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--sec-fs-sm); color: var(--sec-fg-muted); }
.tel-link { color: var(--sec-link); text-decoration: none; }
.tel-link:hover { text-decoration: underline; }
.tel-note { margin-top: 4px; font-size: var(--sec-fs-sm); color: var(--sec-fg-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.tel-facts { grid-area: facts; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 4px 10px; font-size: var(--sec-fs-sm); color: var(--sec-fg-muted); font-variant-numeric: tabular-nums; }
.tel-new { padding: 1px 6px; border-radius: 10px; background: var(--sec-danger); color: #fff; font-size: var(--sec-fs-2xs, 11px); }
.tel-journal { font-size: var(--sec-fs-xs); }
.tel-journal--done { color: var(--sec-success); }
.tel-journal--failed { color: var(--sec-danger); }
.tel-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; }
.tel-editor { grid-area: editor; display: grid; gap: 6px; max-width: 560px; }
.tel-editor-label { font-size: var(--sec-fs-xs); color: var(--sec-fg-muted); }
.tel-editor-text {
  width: 100%; box-sizing: border-box; min-height: 72px; resize: vertical; padding: 6px 8px;
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-control, 6px);
  background: var(--sec-surface); color: var(--sec-fg); font: inherit; font-size: var(--sec-fs-sm);
}
.tel-editor-actions { display: flex; gap: 6px; }
.tel-row-msg { grid-area: msg; font-size: var(--sec-fs-xs); color: var(--sec-fg-muted); }
.tel-row-msg:empty { display: none; }
.tel-row-msg[data-kind="success"] { color: var(--sec-success); }
.tel-row-msg[data-kind="warning"] { color: var(--sec-warning); }
.tel-row-msg[data-kind="error"] { color: var(--sec-danger); }
.tel-empty { padding: 16px 4px; color: var(--sec-fg-muted); font-size: var(--sec-fs-sm); }
.tel-more { margin-top: 12px; }
/* Kollegen (Praesenz, "Monitor") und Personenauswahl der Nebenstellen; Badges = .dev-badge-* */
.tel-presence { margin-bottom: 16px; }
.tel-presence h3 { margin: 0; font-size: var(--sec-fs-sm); }
.tel-presence h4 { margin: 8px 0 4px; font-size: var(--sec-fs-xs); color: var(--sec-fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.tel-presence-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.tel-search { flex: 1 1 240px; max-width: 420px; }
.tel-presence ul, .tel-pick > div { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--sec-fs-sm); }
.tel-presence li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tel-person { padding: 4px 8px; border: 1px solid var(--sec-border); border-radius: 8px; }
.tel-person[data-state="dnd"], .tel-person[data-state="busy"] { border-color: var(--sec-danger); }
.tel-person-note { color: var(--sec-fg-muted); font-style: italic; overflow-wrap: anywhere; }
.tel-person-actions { display: inline-flex; gap: 4px; margin-left: 4px; }
.tel-person-fav--on { color: var(--sec-warning); }
.tel-presence-empty { font-size: var(--sec-fs-sm); }
.tel-search-results ul { margin-top: 4px; }
.tel-inline-msg { font-size: var(--sec-fs-xs); color: var(--sec-fg-muted); }
.tel-inline-msg:empty { display: none; }
.tel-inline-msg[data-kind="success"] { color: var(--sec-success); }
.tel-inline-msg[data-kind="error"] { color: var(--sec-danger); }
.tel-pick { grid-column: 1 / -1; }

/* Mein Status (Praesenz-Status mit Notiz und Ablauf, Anrufschutz) */
.tel-my { margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--sec-border); border-radius: 10px; background: var(--sec-bg-elevated, var(--sec-hover)); }
.tel-my h3 { margin: 0 0 6px; font-size: var(--sec-fs-sm); }
.tel-my-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: var(--sec-fs-sm); margin-bottom: 8px; }
.tel-my-note { font-style: italic; overflow-wrap: anywhere; }
.tel-my-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tel-my-note-input { flex: 1 1 220px; min-width: 160px; }

/* Werkzeuge der Anrufliste: Suche, Richtung, Export */
.tel-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tel-journal-search { min-width: 180px; }
@media (max-width: 640px) {
  .tel-row { grid-template-columns: 24px minmax(0, 1fr); grid-template-areas: "dir main" "dir facts" "dir actions" "dir editor" "dir msg"; }
  .tel-facts { justify-content: flex-start; }
}

/* ==============================================================================
   Welcome-Tour, Help-Modal, Support-Modal, Maintenance-Banner, Skeleton.
   Kein bg-Token-Override; nutzt vorhandene CSS-Variablen aus :root + dark-Theme.
   ============================================================================== */

/* --- Skeleton --- */
.sc-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 80px;
}
.sc-skeleton__row {
  display: flex;
  gap: 10px;
}
.sc-skeleton__bar {
  flex: 1;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bg-card-hover, #eee) 0%,
    var(--bg-secondary, #f6f6f6) 50%,
    var(--bg-card-hover, #eee) 100%
  );
  background-size: 200% 100%;
  animation: sc-skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes sc-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-skeleton__bar { animation: none; }
}

/* --- Error mit Retry --- */
.sc-error { align-items: flex-start; }
.sc-error__body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sc-error__code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.8;
}
.sc-error__msg { font-size: 14px; line-height: 1.4; }
.sc-error__actions { display: flex; gap: 8px; margin-top: 6px; }

/* --- Maintenance-Banner --- */
.sc-maintenance {
  position: relative;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}
.sc-maintenance--warning { background: #fef3c7; color: #78350f; }
.sc-maintenance--critical { background: #fee2e2; color: #7f1d1d; }
[data-theme="dark"] .sc-maintenance--warning { background: #4a3514; color: #fde68a; }
[data-theme="dark"] .sc-maintenance--critical { background: #4a1d1d; color: #fecaca; }
.sc-maintenance__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sc-maintenance__title { font-weight: 600; }
.sc-maintenance__when { opacity: 0.85; font-variant-numeric: tabular-nums; }
.sc-maintenance__dismiss {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.sc-maintenance__dismiss:hover { background: rgba(0, 0, 0, 0.08); }
.sc-maintenance__dismiss:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* --- Welcome-Tour Overlay --- */
.sc-welcome-overlay,
.sc-help-overlay,
.sc-support-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  padding: 16px;
}
.sc-welcome-overlay--visible,
.sc-help-overlay--visible,
.sc-support-overlay--visible {
  display: flex;
}
.sc-welcome,
.sc-help,
.sc-support {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sc-help { width: min(640px, 100%); }
.sc-welcome__head,
.sc-help__head,
.sc-support__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.sc-welcome__head h2,
.sc-help__head h2,
.sc-support__head h2 {
  flex: 1;
  font-size: 18px;
  margin: 0;
}
.sc-welcome__skip,
.sc-help__close,
.sc-support__close {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
}
.sc-help__close,
.sc-support__close { font-size: 22px; line-height: 1; }
.sc-welcome__skip:hover,
.sc-help__close:hover,
.sc-support__close:hover { background: var(--bg-card-hover); }
.sc-welcome__skip:focus-visible,
.sc-help__close:focus-visible,
.sc-support__close:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.sc-welcome__body { padding: 20px; min-height: 140px; }
.sc-welcome__step-title { font-size: 16px; margin-bottom: 8px; }
.sc-welcome__step-text { color: var(--text-secondary); line-height: 1.5; }
.sc-welcome__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}
.sc-welcome__dots { display: flex; gap: 6px; flex: 1; }
.sc-welcome__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background var(--transition);
}
.sc-welcome__dot--active { background: var(--accent-primary); }
.sc-welcome__nav { display: flex; gap: 8px; }

/* --- Help-Modal --- */
.sc-help__search { padding: 12px 20px; border-bottom: 1px solid var(--border-color); }
.sc-help__search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
}
.sc-help__list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}
.sc-help__item {
  padding: 12px;
  border-radius: var(--radius);
}
.sc-help__item + .sc-help__item { border-top: 1px solid var(--border-color); border-radius: 0; }
.sc-help__item-title { font-size: 14px; margin: 0 0 4px; }
.sc-help__item-body { color: var(--text-secondary); font-size: 13px; line-height: 1.5; margin: 0; }
.sc-help__item-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.sc-help__empty { padding: 24px; text-align: center; color: var(--text-secondary); }
.sc-help__foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* Marken-Links (Impressum/Datenschutz/AGB/Doku/Support, js/brand.js). */
.sc-help__links { display: flex; gap: 12px; flex-wrap: wrap; margin-right: auto; font-size: 12px; }
.sc-help__links[hidden] { display: none; }
.sc-help__links a { color: var(--text-secondary); text-decoration: underline; }
.sc-help__links a:hover { color: var(--accent-primary); }

/* --- Support-Modal --- */
.sc-support__intro { padding: 12px 20px 0; color: var(--text-secondary); font-size: 13px; }
.sc-support__form { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.sc-field--inline { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 0; }
.sc-support__actions { display: flex; gap: 8px; justify-content: flex-end; }
.sc-support__status { font-size: 13px; min-height: 18px; margin: 0; }
.sc-support__status--ok { color: #166534; }
.sc-support__status--err { color: #b91c1c; }
[data-theme="dark"] .sc-support__status--ok { color: #86efac; }
[data-theme="dark"] .sc-support__status--err { color: #fca5a5; }
.sc-support__mailto {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: underline;
  align-self: flex-start;
}

/* Nur neuer Button-Modifier — die Basis-`.sc-btn`-Stile leben weiter
   oben in dieser Datei und werden nicht ueberschrieben. */
.sc-btn--ghost { background: transparent; }
.sc-btn--ghost:hover { background: var(--bg-card-hover); }

/* Mobile adjustments */
@media (max-width: 600px) {
  .sc-welcome,
  .sc-help,
  .sc-support {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .sc-maintenance__inner { font-size: 12px; }
}

/* ===================================================================== */
/* Intranet-Portal (native View) — webui/src/js/views/portal.js          */
/* ===================================================================== */
/* Seitenaufbau: Kopf, Karten, KI-Assistent; Teams und Redaktion volle Breite.
   Einspaltig (mobil): Kopf -> Assistent -> Karten -> Teams -> Redaktion. */
.portal { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.portal > [data-team-modal-host]:empty { display: none; }
.portal__head h1 { margin: 0; font-size: var(--sec-fs-3xl, 28px); line-height: 1.2; color: var(--sec-fg); }
.portal__lead { margin: 4px 0 0; color: var(--sec-fg-muted); font-size: var(--sec-fs-md, 15px); }
@media (min-width: 1100px) {
  .portal { grid-template-columns: minmax(0, 1fr) 320px; }
  .portal__head, .portal__wide { grid-column: 1 / -1; }
  .portal__main { grid-column: 1; grid-row: 2; }
  .portal__assistant { grid-column: 2; grid-row: 2; position: sticky; top: 0; }
}

.portal-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
/* Ankuendigungen tragen Text -> doppelt breit, sobald zwei Spalten passen. */
@media (min-width: 720px) {
  .portal-grid > .portal-card[data-card="announce"] { grid-column: span 2; }
}
.portal-card {
  border: 1px solid var(--sec-border); border-radius: 12px;
  background: var(--sec-surface, var(--sec-bg)); padding: 16px 18px; min-width: 0;
  box-shadow: var(--sec-shadow-1);
}
.portal-card__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; margin: 0 0 10px;
}
.portal-card__head h3, .portal-card h3 { margin: 0; font-size: 16px; color: var(--sec-fg); }
.portal-card > header:not(.portal-card__head):not(.team-card__head) { margin: 0 0 10px; }
.portal-card ul { list-style: none; margin: 0; padding: 0; }
.portal-card li {
  padding: 8px 0; border-top: 1px solid var(--sec-border);
  overflow-wrap: anywhere;
}
.portal-card li:first-child { border-top: 0; padding-top: 0; }
.portal-card a { color: var(--sec-link); text-decoration: none; font-weight: 600; }
.portal-card a:hover { text-decoration: underline; }
.portal-card small { display: block; margin-top: 2px; color: var(--sec-fg-muted); font-size: 12px; }
.portal-card li.empty { color: var(--sec-fg-muted); font-style: italic; }
.portal-item__body {
  margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--sec-fg);
  white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
[data-ann-preview-card] .portal-item__body { -webkit-line-clamp: unset; line-clamp: unset; display: block; }

/* Badges: angepinnt / Status der Redaktion */
.portal-badge {
  display: inline-block; vertical-align: middle; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap;
  border: 1px solid var(--sec-border); color: var(--sec-fg-muted); background: var(--sec-n-100);
}
[data-theme="dark"] .portal-badge { background: var(--sec-surface-alt); }
[data-theme="dark"] .team-card__key, [data-theme="dark"] .team-form__suggest { color: var(--sec-coral-200); background: color-mix(in srgb, var(--sec-coral-500) 18%, transparent); border-color: var(--sec-coral-700); }
.portal-badge--pinned { color: var(--sec-coral-700); background: var(--sec-coral-50); border-color: var(--sec-coral-300); }
[data-theme="dark"] .portal-badge--pinned { color: var(--sec-coral-200); background: color-mix(in srgb, var(--sec-coral-500) 18%, transparent); border-color: var(--sec-coral-700); }
.portal-badge--active { color: var(--sec-success); background: color-mix(in srgb, var(--sec-success) 12%, transparent); border-color: color-mix(in srgb, var(--sec-success) 40%, transparent); }
.portal-badge--scheduled { color: var(--sec-info); background: color-mix(in srgb, var(--sec-info) 12%, transparent); border-color: color-mix(in srgb, var(--sec-info) 40%, transparent); }
.portal-badge--expired { color: var(--sec-fg-muted); }

/* Redaktion: Zeile = Titel/Status/Meta links, Aktionen rechts (mobil darunter) */
.portal-editorial__list { padding: 4px 18px; }
.portal-editorial__list li.portal-announcement { padding: 12px 0; }
.portal-editorial__list li.portal-announcement:first-child { padding-top: 12px; }
.portal-announcement { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.portal-announcement__main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; flex: 1 1 280px; }
.portal-announcement__title { font-weight: 600; color: var(--sec-fg); }
.portal-announcement__main small { flex-basis: 100%; }
.portal-announcement__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.portal-announcement[data-state="expired"] .portal-announcement__title { color: var(--sec-fg-muted); }
.portal-editorial .portal-teams__head .team-links select { width: auto; min-width: 140px; }
.sc-btn.portal-btn--danger { background: var(--sec-danger); border-color: var(--sec-danger); color: #fff; }

/* --- Teams (Team-Sites): Sektion ueber den Portal-Karten; Karten nutzen .portal-card --- */
.portal-teams { margin: 0 0 24px; }
.portal > .portal-teams { margin: 0; }
.portal-teams__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.portal-teams__head h2 { margin: 0; font-size: 18px; }
.portal-teams__notice, .team-card__desc, .team-members-results .empty { margin: 0; font-size: 13px; color: var(--sec-fg-muted); }
.portal-teams__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.team-card, .team-form { display: flex; flex-direction: column; gap: 10px; }
.team-card__head, .team-links, .team-members-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.team-card__head h3 { margin: 0; overflow-wrap: anywhere; }
.team-card__key, .team-card__private, .team-form__suggest, .team-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--sec-border); color: var(--sec-fg-muted);
}
.team-card__key, .team-form__suggest, .team-form__key { font-family: ui-monospace, monospace; font-weight: 700; }
.team-card__key, .team-form__suggest { background: var(--sec-coral-50); color: var(--sec-coral-700); border-color: var(--sec-coral-300); cursor: pointer; }
.team-card__notice, .team-form__error, .team-steps__error { margin: 0; font-size: 12px; color: var(--sec-danger); }
.team-steps { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.team-steps li { display: grid; grid-template-columns: 18px 1fr; column-gap: 6px; padding: 4px 0; border-top: 1px solid var(--sec-border); }
.team-steps li:first-child { border-top: 0; }
.team-steps__glyph { font-weight: 700; text-align: center; }
.team-steps li[data-status="ok"] .team-steps__glyph { color: var(--sec-success); }
.team-steps li[data-status="failed"] .team-steps__glyph, .team-steps li[data-status="failed"] .team-steps__label { color: var(--sec-danger); }
.team-steps li[data-status="skipped"], .team-steps li[data-status="pending"] { color: var(--sec-fg-muted); }
.team-steps__error { grid-column: 2; overflow-wrap: anywhere; }
.team-form__key { text-transform: uppercase; max-width: 160px; }
.team-form__check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.team-chip { padding: 2px 6px 2px 10px; color: var(--sec-fg); background: var(--sec-n-100); }
.team-chip button, .team-members-results button { cursor: pointer; border: 0; background: transparent; color: inherit; font: inherit; }
.team-members-results { list-style: none; margin: 4px 0 0; padding: 4px 0; max-height: 200px; overflow-y: auto; border: 1px solid var(--sec-border); border-radius: 8px; }
.team-members-results button { display: block; width: 100%; text-align: left; padding: 6px 10px; }
.team-members-results button:hover { background: var(--sec-bg-warm); }
.team-result__intro { margin: 0 0 12px; }

/* --- KI-Assistent <ai-sidebar> (js/components.js; im Intranet-Portal) --- */
.ai-sidebar {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--sec-border); border-radius: 12px; padding: 14px 16px;
  background: var(--sec-surface, var(--sec-bg)); box-shadow: var(--sec-shadow-1);
}
.ai-sidebar__header { font-weight: 600; font-size: 15px; color: var(--sec-fg); }
.ai-sidebar__header small { font-weight: 400; color: var(--sec-fg-muted); }
.ai-sidebar__messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.ai-sidebar__messages:empty { display: none; }
.ai-sidebar__msg { padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-sidebar__msg--user { align-self: flex-end; max-width: 90%; background: var(--sec-fg); color: var(--sec-bg); }
.ai-sidebar__msg--ai { align-self: flex-start; max-width: 100%; background: var(--sec-bg-warm); color: var(--sec-fg); border: 1px solid var(--sec-border); }
.ai-sidebar__form { display: flex; gap: 8px; }
.ai-sidebar__form input {
  flex: 1; min-width: 0; min-height: var(--sec-control-h, 34px); padding: 6px 10px; box-sizing: border-box;
  border: 1px solid var(--sec-border); border-radius: var(--sec-radius-control, 8px);
  background: var(--sec-bg); color: var(--sec-fg); font: inherit; font-size: 13px;
}
.ai-sidebar__form input:focus { outline: none; border-color: var(--sec-ring); box-shadow: var(--sec-shadow-focus-input); }
.ai-sidebar__form button {
  min-height: var(--sec-control-h, 34px); padding: 0 14px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--sec-fg); border-radius: var(--sec-radius-control, 8px); background: var(--sec-fg); color: var(--sec-bg);
}
.ai-sidebar__form button:hover { background: color-mix(in srgb, var(--sec-fg) 86%, var(--sec-bg)); }
.ai-sidebar__form button:focus-visible { outline: none; box-shadow: var(--sec-shadow-focus); }

/* === Unified Audit-Log (views/audit.js) === */
.audit .audit-intro { color: var(--text-muted, #666); margin: 0 0 12px; }
.audit .sc-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.audit .audit-status { margin: 8px 0; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.audit-table th, .audit-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, #e0e0e0); vertical-align: top; }
.audit-table th { position: sticky; top: 0; background: var(--bg-elevated, #fafafa); }
.audit-table code { font-size: 0.85em; }
.audit-table tr[data-severity="warning"] td:first-child { border-left: 3px solid #e0a800; }
.audit-table tr[data-severity="error"] td:first-child { border-left: 3px solid #c62828; }
.audit-table .audit-empty { text-align: center; color: var(--text-muted, #666); padding: 16px; }
.audit-target { color: var(--text-muted, #666); font-size: 0.85em; }
.audit-more { margin: 12px 0; }

/* === Legal Holds (views/ediscovery.js) === */
.ediscovery .lh-intro { color: var(--text-muted, #666); margin: 0 0 12px; }
.lh-list { list-style: none; padding: 0; margin: 0; }
.lh-item { border: 1px solid var(--border, #e0e0e0); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.lh-item[data-status="released"] { opacity: 0.7; }
.lh-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lh-status { font-size: 0.8em; padding: 1px 6px; border-radius: 4px; background: var(--bg-elevated, #f0f0f0); }
.lh-item[data-status="active"] .lh-status { background: #e0f2e9; color: #1b5e20; }
.lh-meta, .lh-snapshots { font-size: 0.9em; color: var(--text-muted, #666); margin-top: 4px; }
.lh-error { font-size: 0.85em; color: #c62828; margin-top: 4px; }
.lh-actions { margin-top: 8px; display: flex; gap: 8px; }
.lh-empty { color: var(--text-muted, #666); }

/* ==============================================================================
   Mobile-Shell (<= 768 px): Topbar, Navigations-Drawer, Bottom-Nav
   Gesteuert von js/mobile-shell.js (body.is-mobile, body.nav-open). Steht am
   Dateiende, damit die Mobil-Regeln Desktop-Regeln gleicher Spezifitaet
   (Popover, Toasts, Kontext-Panel) ueberschreiben.
   ============================================================================== */

/* Desktop: Mobil-Elemente aus dem Fluss. */
.mobile-topbar,
.mobile-nav,
.sidebar-backdrop,
.sidebar-close,
.search-close-btn {
  display: none;
}

/* --- Bottom-Nav: fuenf gleich breite Ziele, kein horizontales Scrollen --- */
.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 4px 4px env(safe-area-inset-bottom, 0px);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
}

.mobile-nav-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: var(--sec-radius-control);
  color: var(--text-sidebar);
  font: 500 11px/1.15 var(--sec-font-sans);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition), background-color var(--transition);
}

button.mobile-nav-item {
  background: none;
  border: 0;
  cursor: pointer;
}

.mobile-nav-item svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
}

.mobile-nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-nav-item:active,
.mobile-nav-item[aria-expanded="true"] {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.mobile-nav-item.active {
  color: var(--sec-link);
}

/* Aktiv-Markierung: kurzer Balken an der Oberkante der Leiste. */
.mobile-nav-item.active::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 0 0 3px 3px;
  background: var(--accent-primary);
}

/* ↗ fuer Ziele in neuem Tab: an der Beschriftung statt als eigenes Element. */
.mobile-nav-item.nav-item-external::after {
  content: none;
}

.mobile-nav-item.nav-item-external .mobile-nav-label::after {
  content: "↗";
  margin-left: 3px;
  font-size: 0.85em;
  opacity: 0.65;
}

/* Service-Status-Dot (index.html) sitzt an der Ecke des Symbols. */
.mobile-nav-item > .status-dot {
  position: absolute;
  top: 7px;
  left: calc(50% + 8px);
  width: 7px;
  height: 7px;
  margin: 0;
  border: 1.5px solid var(--bg-sidebar);
}

/* Touch-Geraete jeder Breite: Favoriten-Stern ohne Hover erreichbar. */
@media (hover: none) {
  .nav-fav-toggle {
    display: flex;
  }

  .nav-row .nav-badge {
    margin-right: 24px;
  }
}

@media (max-width: 768px) {
  /* --- Topbar --- */
  .mobile-topbar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(var(--mobile-topbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 6px 0;
    align-items: center;
    gap: 2px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-topbar-btn {
    position: relative;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--text-sidebar);
    border-radius: var(--sec-radius-control);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-topbar-btn svg {
    width: 22px;
    height: 22px;
  }

  .mobile-topbar-btn:active,
  .mobile-topbar-btn[aria-expanded="true"] {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
  }

  .mobile-topbar-btn .notification-badge {
    top: 6px;
    right: 6px;
  }

  .mobile-topbar-title {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
  }

  .mobile-topbar-logo {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--sec-coral-300);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-topbar-logo img {
    width: 20px;
    height: 20px;
  }

  .mobile-topbar-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-sidebar-active);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav {
    display: flex;
  }

  /* --- Inhalt zwischen den Leisten --- */
  .content {
    padding-top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  #view-dashboard {
    padding: 16px;
  }

  .view-header h1 {
    font-size: 22px;
  }

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

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* --- Sidebar als Off-Canvas-Drawer ---
     Position statt transform animieren: die Popover (Benachrichtigungen,
     Apps, Konto) liegen `fixed` IM Sidebar-DOM und muessen auch bei
     geschlossenem Drawer (Topbar-Glocke) am Viewport haengen — ein transform
     wuerde sie an die verschobene Sidebar binden. */
  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--mobile-drawer-w) - 16px);
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--mobile-drawer-w);
    min-width: var(--mobile-drawer-w);
    max-width: 100vw;
    z-index: 1100;
    overflow: hidden;
    visibility: hidden;
    border-right: 1px solid var(--border-color);
    transition: left var(--sec-dur-base) var(--sec-ease-out), visibility 0s linear var(--sec-dur-base);
  }

  body.nav-open .sidebar {
    left: 0;
    visibility: visible;
    box-shadow: var(--shadow-lg);
    transition-delay: 0s;
  }

  /* Popover bleiben bei geschlossenem Drawer nutzbar (Topbar-Glocke). */
  .notification-panel.open,
  .app-switcher-panel.open,
  .settings-panel.open {
    visibility: visible;
  }

  /* Der Drawer vererbt `visibility`; Nachfahren mit `transition: all`
     (nav-item, theme-toggle, ...) wuerden den Wechsel hidden -> visible selbst
     animieren und blieben im ersten Frame unsichtbar — dann schlaegt der
     Fokus auf den aktiven Eintrag beim Oeffnen fehl. Nur Farben/Formen
     animieren. */
  body.is-mobile .sidebar * {
    transition-property: background-color, color, border-color, opacity, transform, box-shadow;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--sec-dur-base) var(--sec-ease-out);
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 14px;
  }

  .sidebar-close {
    display: flex;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--text-sidebar);
    border-radius: var(--sec-radius-control);
    cursor: pointer;
  }

  .sidebar-close:active {
    background: var(--bg-sidebar-hover);
  }

  .sidebar-nav-scroll {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Touch-Ziele: hoehere Zeilen, groessere Knoepfe, Sterne immer sichtbar. */
  .nav-item {
    min-height: 42px;
    padding: 6px 10px;
  }

  .nav-label {
    font-size: 14px;
  }

  button.nav-section-title {
    min-height: 34px;
  }

  .nav-fav-toggle {
    display: flex;
    width: 32px;
    height: 32px;
  }

  .nav-row .nav-badge {
    margin-right: 30px;
  }

  .nav-customize-btn {
    min-height: 40px;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-footer {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* Acht Knoepfe in einer Reihe (Drawer-Breite 320 px) statt umbrechend. */
  .sidebar-footer-buttons {
    gap: 0;
    justify-content: space-between;
  }

  .sidebar-footer-buttons .icon-btn,
  .sidebar-footer-buttons .theme-toggle {
    width: 36px;
    height: 40px;
    padding: 0;
  }

  .user-info-widget {
    min-height: 44px;
  }

  /* --- Popover als Bottom-Sheets ueber Drawer und Leisten --- */
  .notification-panel,
  .app-switcher-panel,
  .settings-panel,
  .sidebar.collapsed .notification-panel,
  .sidebar.collapsed .app-switcher-panel,
  .sidebar.collapsed .settings-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
    max-height: min(70vh, calc(100dvh - var(--mobile-topbar-h) - var(--mobile-nav-h) - 32px));
    z-index: 1200;
  }

  .settings-item,
  .app-switcher-item {
    min-height: 44px;
  }

  /* --- Suche als Vollbild --- */
  .search-overlay {
    padding: 0;
    align-items: stretch;
  }

  .search-modal {
    max-width: none;
    height: 100%;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .search-input-wrapper {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
  }

  .search-close-btn {
    display: flex;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--text-secondary);
    border-radius: var(--sec-radius-control);
    cursor: pointer;
  }

  .search-close-btn svg {
    width: 20px;
    height: 20px;
  }

  .search-results {
    flex: 1 1 auto;
    max-height: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* --- Weitere fixe Elemente ueber bzw. zwischen den Leisten --- */
  .sc-context-panel {
    width: 100%;
    z-index: 1150;
  }

  .sc-toast-region {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    max-width: none;
  }

  .sc-screen-pop-region {
    top: calc(var(--mobile-topbar-h) + env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    max-width: none;
  }

  /* Cookie-Hinweis (js/matomo-consent.js, eigenes Inline-Stylesheet) ueber
     der Bottom-Nav statt darueber liegend. */
  body #matomo-consent-banner {
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }
}

@media (max-width: 480px) {
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop {
    transition: none;
  }
}


/* ==============================================================================
   Bestaetigungs-/Eingabedialog (js/components/dialog.js) - Ersatz fuer
   window.confirm/prompt: gestaltbar, Fokus bleibt im Dialog, Escape bricht ab.
   ============================================================================== */
.sc-dialog {
  border: 1px solid var(--sec-border);
  border-radius: var(--sec-radius-overlay, 12px);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  background: var(--sec-bg-elevated, var(--sec-bg));
  color: var(--sec-fg);
  box-shadow: var(--sec-shadow-3);
}
.sc-dialog::backdrop { background: rgba(12, 11, 11, 0.5); }
.sc-dialog__form { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 18px; }
.sc-dialog__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.sc-dialog__text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--sec-fg-muted); white-space: pre-line; }
.sc-dialog__label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.sc-dialog__input { width: 100%; }
.sc-dialog__hint { margin: -6px 0 0; }
.sc-dialog__hint--error { color: var(--sec-danger-fg, var(--sec-danger)); }

/* Inline-Feldfehler (components.js: C.fieldError / C.validateForm) */
.sc-field-error { margin: 4px 0 0; font-size: var(--sec-fs-sm, 13px); color: var(--sec-danger-fg, var(--sec-danger)); }
.sc-form [aria-invalid="true"], .sc-form [aria-invalid="true"]:focus-visible {
  border-color: var(--sec-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec-danger) 25%, transparent);
}
.sc-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Iframe-App antwortet nicht: Hinweis mit Neuladen / neuem Tab statt leerem Rahmen. */
.sc-iframe-fehler {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--sec-bg); z-index: 5;
}
.sc-iframe-fehler__karte {
  max-width: 420px; padding: 20px 22px; border: 1px solid var(--sec-border);
  border-radius: var(--sec-radius-card, 8px); background: var(--sec-surface); text-align: center;
}
.sc-iframe-fehler__karte h2 { margin: 0 0 8px; font-size: 16px; }
.sc-iframe-fehler__karte p { margin: 0 0 14px; font-size: 14px; color: var(--sec-fg-muted); }
.sc-iframe-fehler__aktionen { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
