:root {
  color-scheme: light dark;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --accent: #0b7a4b;
  --accent-strong: #065c38;
  --accent-contrast: #ffffff;
  --accent-soft: #e5f4ec;
  --danger: #b3261e;
  --danger-contrast: #ffffff;
  --danger-soft: #fbeae9;
  --success: #1a7f37;
  --warning: #9a6700;
  --warning-soft: #fbf3e0;
  --info: #0860a8;
  --info-soft: #e8f1fa;
  --bg: #F4F6F8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #d5dbe2;
  --border-strong: #b6c0ca;
  --text: #1c232b;
  --text-muted: #5a6672;
  --text-subtle: #6b7785;
  --transition-fast: 120ms;
  --transition-med: 150ms;
  --font-sans: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #4cc38a;
    --accent-strong: #7dd9ab;
    --accent-contrast: #0b1117;
    --accent-soft: #143527;
    --danger: #ff7b72;
    --danger-soft: #3b1512;
    --success: #4cc38a;
    --warning: #e3b341;
    --warning-soft: #33260b;
    --info: #79c0ff;
    --info-soft: #10293d;
    --bg: #0b1117;
    --surface: #121a22;
    --surface-2: #18232d;
    --border: #273544;
    --border-strong: #3a4b5c;
    --text: #d7e0e7;
    --text-muted: #91a0ad;
    --text-subtle: #7a8a99;
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  --accent: #4cc38a;
  --accent-strong: #7dd9ab;
  --accent-contrast: #0b1117;
  --accent-soft: #143527;
  --danger: #ff7b72;
  --danger-soft: #3b1512;
  --success: #4cc38a;
  --warning: #e3b341;
  --warning-soft: #33260b;
  --info: #79c0ff;
  --info-soft: #10293d;
  --bg: #0b1117;
  --surface: #121a22;
  --surface-2: #18232d;
  --border: #273544;
  --border-strong: #3a4b5c;
  --text: #d7e0e7;
  --text-muted: #91a0ad;
  --text-subtle: #7a8a99;
  color-scheme: dark;
}

html[data-theme="light"] {
  --accent: #0b7a4b;
  --accent-strong: #065c38;
  --accent-contrast: #ffffff;
  --accent-soft: #e5f4ec;
  --danger: #b3261e;
  --danger-contrast: #ffffff;
  --danger-soft: #fbeae9;
  --success: #1a7f37;
  --warning: #9a6700;
  --warning-soft: #fbf3e0;
  --info: #0860a8;
  --info-soft: #e8f1fa;
  --bg: #F4F6F8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #d5dbe2;
  --border-strong: #b6c0ca;
  --text: #1c232b;
  --text-muted: #5a6672;
  --text-subtle: #6b7785;
  color-scheme: light;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1 { font-size: 1.35em; letter-spacing: -0.01em; }
h2 { font-size: 0.95em; font-weight: 500; color: var(--text-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9em;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--danger); color: var(--danger-contrast, #fff); }
.btn-danger:hover { filter: brightness(1.05); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

input[type=text],
input[type=password],
input[type=url],
input[type=email],
input[type=file],
select,
textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.92em;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition-fast);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=file] { padding: var(--sp-1) var(--sp-3); }

label { display: block; font-weight: 500; font-size: 0.9em; margin-bottom: var(--sp-1); }

.hint { font-size: 0.82em; color: var(--text-muted); margin-top: var(--sp-1); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.form-row { margin-bottom: var(--sp-4); }
.form-row--error input,
.form-row--error select,
.form-row--error textarea { border-color: var(--danger); }
.field-help { font-size: 0.82em; color: var(--text-muted); margin-top: var(--sp-1); }
.field-error { font-size: 0.82em; color: var(--danger); margin-top: var(--sp-1); }
.req { color: var(--danger); }

.checkbox-row { display: flex; align-items: center; gap: var(--sp-2); }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 400; }

.row-actions { display: flex; gap: var(--sp-2); align-items: center; white-space: nowrap; flex-wrap: nowrap; }

.error { background: var(--danger-soft); color: var(--danger); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); margin-bottom: var(--sp-4); font-size: 0.9em; border: 1px solid var(--border); }
.success { background: var(--accent-soft); color: var(--accent-strong); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); margin-bottom: var(--sp-4); font-size: 0.9em; border: 1px solid var(--border); }
.warn { background: var(--warning-soft); color: var(--warning); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); margin-bottom: var(--sp-4); font-size: 0.9em; border: 1px solid var(--border); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-weight: 500; font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.04em; }
th, td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); font-size: 0.92em; }
tbody tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------------------
   Volle Breite: die Card ist der einzige Rahmen. .table-wrap ist nur noch ein
   transparenter Scroll-Container (Ausweichmechanismus bei schmalen Viewports),
   keine zweite umrandete Box mehr.
--------------------------------------------------------------------------- */

/* Sticky Aktionsspalte: haelt die Aktionen im Sichtfenster, wenn die Tabelle
   breiter als die Card wird und horizontal scrollt. */
.table-actions-cell {
  position: sticky;
  right: 0;
  border-left: 1px solid var(--border);
}
td.table-actions-cell { background: var(--surface); }
th.table-actions-cell { background: var(--surface-2); }
tr.fleet-row:hover td.table-actions-cell { background: var(--surface-2); }

/* Overflow-Aktionsmenue (⋮): kollabiert Inline-Aktionsbuttons in ein
   kompaktes Menue. Das Panel wird per JS position:fixed ausgerichtet, damit
   es nicht vom Scroll-Container (.table-wrap) abgeschnitten wird. */
.action-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.action-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.action-menu__trigger:hover { background: var(--surface-2); color: var(--text); }
.action-menu__trigger[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }

.action-menu__panel {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  max-width: 280px;
  padding: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
}
.action-menu__panel[hidden] { display: none; }

.action-menu__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88em;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.action-menu__item:hover,
.action-menu__item:focus-visible { background: var(--surface-2); }
.action-menu__item--danger { color: var(--danger); }
.action-menu__item--danger:hover,
.action-menu__item--danger:focus-visible { background: var(--danger-soft); }

/* Trigger vs. Read-only: Trigger-Eintraege (starten eine neue Operation) werden
   im Aktionsmenue durch einen Akzentpunkt und einen eigenen Gruppen-Block
   (Trenner + Label) visuell von reinen Anzeige-/Verwaltungsaktionen getrennt. */
.action-menu__separator {
  height: 1px;
  margin: var(--sp-1) var(--sp-2);
  background: var(--border);
}
.action-menu__group-label {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}
.action-menu__item--trigger::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.empty-state { padding: var(--sp-8) var(--sp-6); text-align: center; color: var(--text-muted); font-size: 0.92em; }

.pill { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px var(--sp-2); border-radius: 999px; font-size: 0.78em; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.pill-neutral { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.pill-success { background: var(--accent-soft); color: var(--accent-strong); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-info { background: var(--info-soft); color: var(--info); }

.app-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--transition-med); background: linear-gradient(to right, var(--surface) 239px, var(--border) 239px, var(--border) 240px, transparent 240px); }
html.sidebar-collapsed .app-layout { grid-template-columns: 64px minmax(0, 1fr); background: linear-gradient(to right, var(--surface) 63px, var(--border) 63px, var(--border) 64px, transparent 64px); }
.app-sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: var(--sp-5) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-6); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; }
.app-brand { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2); }
.app-brand img { height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.app-brand .wordmark { font-weight: 700; font-size: 1.1em; letter-spacing: -0.02em; white-space: nowrap; }
.app-brand .subtitle { font-size: 0.76em; color: var(--text-subtle); white-space: nowrap; }
.app-nav { display: flex; flex-direction: column; gap: var(--sp-1); }
.app-nav a { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); color: var(--text-muted); font-size: 0.9em; font-weight: 500; white-space: nowrap; }
.app-nav a:hover { background: var(--surface-2); color: var(--text); }
.app-nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.app-nav .coming { font-size: 0.7em; color: var(--text-subtle); border: 1px solid var(--border); border-radius: 999px; padding: 0 var(--sp-1); }
.nav-group-label { font-size: 0.72em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); padding: var(--sp-3) var(--sp-3) var(--sp-1); margin-top: var(--sp-2); white-space: nowrap; overflow: hidden; }
.nav-group-label:first-child { margin-top: 0; }

/* Nav icons (stroke style, currentColor) */
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Sidebar toggle button */
.sidebar-toggle { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-muted); cursor: pointer; margin-top: auto; align-self: center; transition: transform var(--transition-med), color var(--transition-fast), border-color var(--transition-fast); }
.sidebar-toggle:hover { color: var(--text); border-color: var(--accent); }
.sidebar-toggle-icon { width: 16px; height: 16px; }
html.sidebar-collapsed .sidebar-toggle-icon { transform: rotate(180deg); }

/* Collapsed sidebar: hide labels, center icons, show tooltips */
html.sidebar-collapsed .app-sidebar { padding: var(--sp-5) var(--sp-2); align-items: center; }
html.sidebar-collapsed .app-brand { justify-content: center; }
html.sidebar-collapsed .app-brand .subtitle { display: none; }
html.sidebar-collapsed .app-brand .wordmark { font-size: 0; }
html.sidebar-collapsed .app-brand .wordmark::first-letter { font-size: 1.1em; }
html.sidebar-collapsed .app-nav a { justify-content: center; padding: var(--sp-2); }
html.sidebar-collapsed .nav-label { display: none; }
html.sidebar-collapsed .nav-group-label { text-align: center; font-size: 0; padding: var(--sp-2) 0 var(--sp-1); }
html.sidebar-collapsed .nav-group-label::after { content: '·'; font-size: 0.9em; color: var(--text-subtle); }

@media (prefers-reduced-motion: reduce) {
  .app-layout { transition: none; }
  .sidebar-toggle { transition: none; }
  .sidebar-toggle-icon { transition: none; }
}

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--sp-2) var(--sp-6); display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-4); min-height: 56px; }
.app-user { display: flex; align-items: center; gap: var(--sp-2); }
.app-user .name { font-weight: 500; font-size: 0.9em; }
.app-user .email { font-size: 0.78em; color: var(--text-muted); }
.theme-toggle { padding: var(--sp-1) var(--sp-2); font-size: 1.1em; line-height: 1; min-width: 36px; }
.theme-toggle-icon { display: inline-block; }

.app-content { padding: var(--sp-6); width: 100%; max-width: 1680px; margin: 0 auto; }
.app-footer { padding: var(--sp-3) var(--sp-6); font-size: 0.78em; color: var(--text-muted); font-family: var(--font-mono); border-top: 1px solid var(--border); margin-top: auto; text-align: center; }
.app-footer-sep { margin: 0 var(--sp-1); opacity: 0.5; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.page-header .subline { color: var(--text-muted); margin-top: var(--sp-1); max-width: 64ch; }
.page-header-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: var(--sp-6); }
.auth-card { position: relative; width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-8); }
.auth-theme-toggle { position: absolute; top: var(--sp-4); right: var(--sp-4); }
.auth-brand { display: flex; align-items: center; gap: var(--sp-2); justify-content: center; margin-bottom: var(--sp-6); }
.auth-brand img { height: 40px; width: auto; max-width: 200px; object-fit: contain; }
.auth-brand .wordmark { font-weight: 700; font-size: 1.3em; letter-spacing: -0.02em; }

.toast { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); margin-bottom: var(--sp-4); font-size: 0.9em; }
.toast-success { border-color: var(--accent); color: var(--accent-strong); }
.toast button { margin-left: auto; background: transparent; border: none; cursor: pointer; color: var(--text-muted); font-size: 1em; }

.dialog-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: var(--sp-4); }
.dialog-overlay[hidden] { display: none; }
.dialog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-6); max-width: 420px; width: 100%; }
.dialog h2 { color: var(--text); font-weight: 600; margin-bottom: var(--sp-2); }
.dialog .dialog-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-6); }

.skeleton { border-radius: var(--radius-sm); background: var(--surface-2); position: relative; overflow: hidden; }
.skeleton-row { height: 40px; margin-bottom: var(--sp-2); border-radius: var(--radius-md); }

.mobile-nav-toggle { display: none; }

@media (max-width: 768px) {
  .app-layout,
  html.sidebar-collapsed .app-layout { grid-template-columns: 1fr; background: none; }
  .app-sidebar,
  html.sidebar-collapsed .app-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: var(--sp-4) var(--sp-3); align-items: stretch; }
  html.sidebar-collapsed .app-brand { justify-content: flex-start; }
  html.sidebar-collapsed .app-brand .subtitle { display: inline; }
  html.sidebar-collapsed .app-brand .wordmark { font-size: 1.1em; }
  html.sidebar-collapsed .app-nav a { justify-content: flex-start; padding: var(--sp-2) var(--sp-3); }
  html.sidebar-collapsed .nav-label { display: inline; }
  html.sidebar-collapsed .nav-group-label { text-align: left; font-size: 0.72em; padding: var(--sp-3) var(--sp-3) var(--sp-1); }
  html.sidebar-collapsed .nav-group-label::after { content: none; }
  .app-content { padding: var(--sp-4); }

  /* Menü ist standardmaessig eingeklappt: Content sofort sichtbar statt
     einer Nav-Liste mit ~15 Eintraegen vor jeder Seite. */
  .sidebar-toggle { display: none; }
  .mobile-nav-toggle { display: flex; align-items: center; gap: var(--sp-2); width: 100%; margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-weight: 600; font-size: 0.92em; }
  .mobile-nav-toggle-icon { width: 18px; height: 18px; flex-shrink: 0; }
  .app-nav { display: none; margin-top: var(--sp-3); }
  .app-nav.mobile-open { display: flex; }
}

.logo-preview { max-height: 48px; max-width: 240px; border-radius: var(--radius-sm); margin: var(--sp-2) 0; display: block; }
.card-title { font-size: 1.05em; font-weight: 600; color: var(--text); margin-bottom: var(--sp-2); }
.subline { color: var(--text-muted); font-size: 0.92em; }

/* Fleet table: summary bar and clickable rows */
.filter-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.audit-filter-form { margin-bottom: var(--sp-3); }

.pagination { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); }
.pagination-info { font-size: 0.85em; color: var(--text-muted); }

.fleet-summary { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.fleet-summary-sep { color: var(--text-subtle); }
.fleet-summary-license { font-size: 0.88em; color: var(--text-muted); }
.fleet-row { cursor: pointer; transition: background-color var(--transition-fast); }
.fleet-row:hover { background: var(--surface-2); }

/* Detail page: key-value pairs */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4) var(--sp-6); }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-field { }
.detail-label { font-size: 0.82em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--sp-1); }
.detail-value { font-size: 0.95em; }
.detail-value code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-2); padding: 1px var(--sp-1); border-radius: var(--radius-sm); }
.detail-note { font-size: 0.85em; color: var(--text-muted); line-height: 1.5; padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-md); border: 1px solid var(--border); }
.detail-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }

/* Cockpit dashboard grid */
.cockpit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.cockpit-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .cockpit-grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cockpit-grid--4 { grid-template-columns: 1fr; } }
.cockpit-tile { display: flex; flex-direction: column; gap: var(--sp-2); }
.cockpit-tile--wide { grid-column: span 2; }
.cockpit-tile--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .cockpit-grid { grid-template-columns: 1fr; }
  .cockpit-tile--wide { grid-column: span 1; }
}
.cockpit-number { font-size: 2.4em; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--text); }
.cockpit-number--danger { color: var(--danger); }
.cockpit-number--warning { color: var(--warning); }
.cockpit-number--info { color: var(--info); }
.cockpit-number--success { color: var(--success); }
.cockpit-number--neutral { color: var(--text-muted); }
.cockpit-cap { font-size: 0.5em; font-weight: 400; color: var(--text-muted); }
.cockpit-unit { font-size: 0.35em; font-weight: 400; color: var(--text-muted); vertical-align: baseline; }
.cockpit-hint { font-size: 0.88em; color: var(--text-muted); }
.cockpit-hint--warn { color: var(--danger); }
.cockpit-warn { color: var(--danger); font-weight: 500; }
.cockpit-recovery { padding: var(--sp-3) var(--sp-5); }
.cockpit-recovery-inner { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; font-size: 0.9em; }
.cockpit-recovery-label { font-size: 0.78em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subtle); }
.cockpit-recovery-link { margin-left: auto; font-size: 0.88em; white-space: nowrap; }
.cockpit-strip { padding: var(--sp-3) var(--sp-5); }
.cockpit-strip-inner { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; font-size: 0.9em; }
.cockpit-strip-inner a { margin-left: auto; white-space: nowrap; }

/* Cockpit history section */
.cockpit-history { padding: var(--sp-6); }
.history-filter { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.history-filter-row { display: flex; flex-direction: column; gap: var(--sp-1); }
.history-filter-row label { font-size: 0.82em; font-weight: 500; color: var(--text-muted); margin-bottom: 0; }
.history-filter-row select { width: auto; min-width: 140px; padding: var(--sp-1) var(--sp-3); font-size: 0.88em; }
.history-export-btn { margin-left: auto; }

.table-controls { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.table-search-input { flex: 1; min-width: 160px; max-width: 320px; padding: var(--sp-1) var(--sp-3); font-size: 0.88em; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text); }
.table-search-input::placeholder { color: var(--text-muted); }
.table-filter-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: 0.88em; color: var(--text-secondary); cursor: pointer; user-select: none; white-space: nowrap; }
.table-filter-toggle input[type="checkbox"] { accent-color: var(--accent); }

.history-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-6); }
@media (max-width: 640px) { .history-kpis { grid-template-columns: 1fr; } }
.history-kpi { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-md); border: 1px solid var(--border); }
.history-kpi-label { font-size: 0.82em; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.history-kpi .cockpit-number { font-size: 1.8em; }

.history-chart-controls { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.history-toggle { font-size: 0.85em; padding: var(--sp-1) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); }
.history-toggle.active { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }

.history-chart { min-height: 180px; }
.history-chart--hidden { display: none; }

.history-bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-bottom: var(--sp-5); position: relative; }
.history-bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; height: 100%; }
.history-bar-stack { display: flex; flex-direction: column-reverse; align-items: stretch; width: 100%; height: 100%; justify-content: flex-start; }
.history-bar { min-height: 2px; border-radius: 2px 2px 0 0; transition: height var(--transition-fast); }
.history-bar--success { background: var(--success); }
.history-bar--failed { background: var(--danger); }
.history-bar--db { background: var(--accent); font-size: 0; overflow: hidden; }
.history-bar--db:nth-child(2n) { background: var(--info); }
.history-bar--db:nth-child(3n) { background: var(--warning); }
.history-bar-label { font-size: 0.68em; color: var(--text-subtle); margin-top: var(--sp-1); white-space: nowrap; }

/* X-Achsen-Labels ausdünnen: bei 30 Tagen jedes 4., bei 90 Tagen jedes 12. Label */
.history-bars--30 .history-bar-group:nth-child(4n+2) .history-bar-label,
.history-bars--30 .history-bar-group:nth-child(4n+3) .history-bar-label,
.history-bars--30 .history-bar-group:nth-child(4n+4) .history-bar-label,
.history-bars--30 .history-bar-group:nth-child(4n) .history-bar-label { visibility: hidden; }
.history-bars--90 .history-bar-group .history-bar-label { visibility: hidden; }
.history-bars--90 .history-bar-group:nth-child(12n+1) .history-bar-label { visibility: visible; }

.history-empty { padding: var(--sp-8) var(--sp-6); text-align: center; color: var(--text-muted); font-size: 0.92em; }

/* ---------------------------------------------------------------------------
   Run-Indikator (Sofort-Backup-Anfrage: pending/claimed/completed/failed)
   Die Puls-/Spinner-Animation ist rein CSS-gesteuert (kein JS-Zwang) und
   respektiert prefers-reduced-motion.
--------------------------------------------------------------------------- */
.run-indicator { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); }
.run-indicator[hidden] { display: none; }

.run-pill { gap: var(--sp-1); }

.run-dots { display: inline-flex; align-items: center; gap: 2px; }
.run-dots > span {
  width: 3px; height: 3px; border-radius: 50%;
  background: currentColor;
  animation: run-dot-pulse 1.2s ease-in-out infinite;
}
.run-dots > span:nth-child(2) { animation-delay: 0.2s; }
.run-dots > span:nth-child(3) { animation-delay: 0.4s; }

@keyframes run-dot-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-1px); }
}

.run-spin { display: inline-flex; animation: run-spin 0.9s linear infinite; }
@keyframes run-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .run-dots > span { animation: none; opacity: 0.6; }
  .run-spin { animation: none; }
}

.run-runtime { font-variant-numeric: tabular-nums; opacity: 0.85; }

.toast-danger { border-color: var(--danger); color: var(--danger); }

/* ---------------------------------------------------------------------------
   Status-Strip (Top-Leiste: 5 Statussymbole mit Ampelfarbe)
   Flex-Layout, bricht auf schmalen Viewports um. Icons sind nie alleiniger
   Informationstraeger — aria-label + Tooltip + Farbe.
--------------------------------------------------------------------------- */
.status-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-right: auto;
  flex-wrap: wrap;
}

.status-strip-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-md);
  font-size: 0.82em;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}

.status-strip-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.status-strip-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.status-strip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.status-strip-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
}

.status-strip-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 1ch;
}

/* Ampelfarben — Farbe nie alleiniger Informationstraeger */
.status-strip--green { color: var(--success); }
.status-strip--yellow { color: var(--warning); }
.status-strip--red { color: var(--danger); }
.status-strip--grey { color: var(--text-subtle); opacity: 0.6; }

/* Laufende Backups: animierte Punkte */
.status-strip-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: var(--sp-1);
}
.status-strip-dots > span {
  width: 3px; height: 3px; border-radius: 50%;
  background: currentColor;
  animation: run-dot-pulse 1.2s ease-in-out infinite;
}
.status-strip-dots > span:nth-child(2) { animation-delay: 0.2s; }
.status-strip-dots > span:nth-child(3) { animation-delay: 0.4s; }

/* Fehlgeschlagene Jobs: Warndreieck */
.status-strip--red .status-strip-icon--warn svg {
  fill: var(--danger);
  stroke: var(--danger);
}

/* Eingeklappte Seitenleiste: keine Aenderung am Strip (bleibt in Topbar) */

/* Schmaler Viewport: Strip kollabiert in eine Zeile mit Overflow-Scroll */
@media (max-width: 768px) {
  .status-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .status-strip::-webkit-scrollbar { display: none; }
  .app-topbar {
    flex-wrap: wrap;
    gap: var(--sp-2);
  }
  .app-user {
    order: 1;
  }
  .status-strip {
    order: 0;
    width: 100%;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-strip-dots > span { animation: none; opacity: 0.6; }
  .status-strip-item { transition: none; }
}

/* ---------------------------------------------------------------------------
   Instance- und Environment-Badges (Topbar, links neben Status-Strip)
--------------------------------------------------------------------------- */
.instance-badges {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: auto;
  flex-shrink: 0;
}

.instance-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: 0.82em;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.env-badge--produktion { background: #fce8e6; color: #a51d18; border-color: #e8b4b0; }
.env-badge--staging    { background: var(--warning-soft); color: var(--warning); border-color: var(--border); }
.env-badge--test       { background: var(--info-soft); color: var(--info); border-color: var(--border); }
.env-badge--demo       { background: var(--info-soft); color: var(--info); border-color: var(--border); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .env-badge--produktion { background: #3b1512; color: #ff7b72; border-color: #5c2420; }
}
html[data-theme="dark"] .env-badge--produktion { background: #3b1512; color: #ff7b72; border-color: #5c2420; }

/* ---------------------------------------------------------------------------
   Einstellungen-Gruppe (einklappbar, Zustand in localStorage)
--------------------------------------------------------------------------- */
.nav-group-collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.nav-group-chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

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

.nav-group-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-group-body[hidden] {
  display: none;
}

html.sidebar-collapsed .nav-group-chevron { display: none; }
html.sidebar-collapsed .nav-group-body[hidden] { display: flex; }

/* ---------------------------------------------------------------------------
   Login-Notice
--------------------------------------------------------------------------- */
.login-notice {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: 0.88em;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   Org-Name im Sidebar-Kopf (ellipsis bei langen Namen)
--------------------------------------------------------------------------- */
.app-brand .org-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ---------------------------------------------------------------------------
   Akzentfarben-Palette (Ueberschreibt --accent-Token je Auswahl)
   Jede Farbe hat Light+Dark-Varianten die WCAG AA auf surface erfuellen.
--------------------------------------------------------------------------- */
html[data-accent="blue"] {
  --accent: #0860a8; --accent-strong: #064d87; --accent-contrast: #ffffff; --accent-soft: #e8f1fa;
}
html[data-accent="blue"][data-theme="dark"],
@media (prefers-color-scheme: dark) { html[data-accent="blue"]:not([data-theme]) {
  --accent: #79c0ff; --accent-strong: #a5d6ff; --accent-contrast: #0b1117; --accent-soft: #10293d;
}}
html[data-accent="teal"] {
  --accent: #0d7377; --accent-strong: #095c5f; --accent-contrast: #ffffff; --accent-soft: #e0f5f5;
}
html[data-accent="teal"][data-theme="dark"] {
  --accent: #56d4d8; --accent-strong: #88e4e7; --accent-contrast: #0b1117; --accent-soft: #0c2e2f;
}
@media (prefers-color-scheme: dark) { html[data-accent="teal"]:not([data-theme]) {
  --accent: #56d4d8; --accent-strong: #88e4e7; --accent-contrast: #0b1117; --accent-soft: #0c2e2f;
}}
html[data-accent="violet"] {
  --accent: #6e40c9; --accent-strong: #553098; --accent-contrast: #ffffff; --accent-soft: #f0e8ff;
}
html[data-accent="violet"][data-theme="dark"] {
  --accent: #bc8cff; --accent-strong: #d2a8ff; --accent-contrast: #0b1117; --accent-soft: #1f0f3d;
}
@media (prefers-color-scheme: dark) { html[data-accent="violet"]:not([data-theme]) {
  --accent: #bc8cff; --accent-strong: #d2a8ff; --accent-contrast: #0b1117; --accent-soft: #1f0f3d;
}}
html[data-accent="amber"] {
  --accent: #9a6700; --accent-strong: #7a5200; --accent-contrast: #ffffff; --accent-soft: #fbf3e0;
}
html[data-accent="amber"][data-theme="dark"] {
  --accent: #e3b341; --accent-strong: #f0cc5b; --accent-contrast: #0b1117; --accent-soft: #33260b;
}
@media (prefers-color-scheme: dark) { html[data-accent="amber"]:not([data-theme]) {
  --accent: #e3b341; --accent-strong: #f0cc5b; --accent-contrast: #0b1117; --accent-soft: #33260b;
}}
html[data-accent="rose"] {
  --accent: #c2185b; --accent-strong: #9c1448; --accent-contrast: #ffffff; --accent-soft: #fce4ec;
}
html[data-accent="rose"][data-theme="dark"] {
  --accent: #f48fb1; --accent-strong: #f8bbd0; --accent-contrast: #0b1117; --accent-soft: #3b1525;
}
@media (prefers-color-scheme: dark) { html[data-accent="rose"]:not([data-theme]) {
  --accent: #f48fb1; --accent-strong: #f8bbd0; --accent-contrast: #0b1117; --accent-soft: #3b1525;
}}


/* PITR-Restore-Maske ----------------------------------------------------- */
.pitr-card .pitr-section-heading {
  font-size: 1em; font-weight: 600; margin: var(--sp-5) 0 var(--sp-2);
  padding-top: var(--sp-3); border-top: 1px solid var(--border);
}
.pitr-card .pitr-section-heading:first-of-type { border-top: none; padding-top: 0; }

.pitr-window-dl {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-1) var(--sp-3);
  margin: 0 0 var(--sp-2);
}
.pitr-window-dl dt { color: var(--text-muted); font-size: 0.88em; }
.pitr-window-dl dd { margin: 0; font-family: var(--font-mono); font-size: 0.88em; }

.pitr-window-empty {
  padding: var(--sp-3); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm, 4px); color: var(--text-muted);
}

.pitr-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }

.pitr-confirm {
  margin-top: var(--sp-4); padding: var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 4px);
}
.pitr-confirm h4 { margin: 0 0 var(--sp-2); font-size: 0.98em; }
.pitr-confirm p { margin: 0 0 var(--sp-2); font-size: 0.9em; color: var(--text-muted); }

.pitr-result {
  margin-top: var(--sp-4); padding: var(--sp-3);
  border-radius: var(--radius-sm, 4px); border: 1px solid var(--border);
  background: var(--surface-2);
}
.pitr-result pre { margin: 6px 0 0; font-size: 0.82em; }
.pitr-result-ok  { border-color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.pitr-result-err { border-color: var(--danger);  background: color-mix(in srgb, var(--danger)  10%, transparent); }

.pitr-form[aria-disabled="true"] { opacity: 0.65; pointer-events: none; }

/* --- Job-Steuerung (Cancel/Pause/Resume/Retry) --- */

.job-actions {
  /* Achtung: NIE display:flex auf ein <td> setzen — das loest die Zelle aus
     dem Tabellenfluss, erzeugt eigene Hoehe/Trennlinien und verrutscht die
     Buttons. Fuer die Zeilenanordnung ist ein innerer .row-actions-Wrapper
     zustaendig; hier nur Zeilenumbruch verhindern. */
  white-space: nowrap;
  vertical-align: middle;
}

.btn-sm {
  padding: 2px 8px;
  font-size: 0.78em;
  line-height: 1.6;
  border-radius: var(--radius-sm, 3px);
}

.row-cancelled {
  opacity: 0.6;
}

.row-paused {
  background: color-mix(in srgb, var(--warning, #f0ad4e) 6%, transparent);
}

.row-cancelled td,
.row-paused td {
  transition: opacity 0.3s, background 0.3s;
}

/* ---------------------------------------------------------------------------
   Round-Trip-Check (Storage-Ansicht, Phase 1)
   Nur Ergaenzungen — bestehende Pill-/Card-/Detail-Klassen bleiben unveraendert.
--------------------------------------------------------------------------- */
.check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.check-head .card-title { margin-bottom: 0; }
.check-head-status { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.check-time { font-size: 0.85em; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.check-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3) 0;
  padding: 0;
}

.check-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.stat-chip {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 140px;
}
.stat-label {
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}
.stat-value.mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* ---------------------------------------------------------------------------
   WAL-Kontinuitaetsring (WAL-Ring Widget)
   Kompaktes SVG-Widget, das die Segmentkette als Uhrzeigersinn-Ring rendert.
   Mint = Segment vorhanden, Rot = Luecke, Punkt = Basebackup, Raute = Drill.
--------------------------------------------------------------------------- */
.wal-ring-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.wal-ring {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
}
.wal-ring-legend {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: 0.78em;
  color: var(--text-muted);
}
.wal-ring-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.wal-ring-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.wal-ring-legend-dot--ok { background: var(--success); }
.wal-ring-legend-dot--gap { background: var(--danger); }
.wal-ring-legend-dot--bb { background: var(--success); }
.wal-ring-legend-dot--drill {
  background: var(--warning);
  border-radius: 0;
  transform: rotate(45deg);
  width: 7px;
  height: 7px;
}

/* PITR-Ring-Layout auf der Restore-Seite */
.pitr-ring-section { margin-bottom: var(--sp-4); }
.pitr-ring-layout {
  display: flex;
  gap: var(--sp-6);
  align-items: flex-start;
  flex-wrap: wrap;
}
.pitr-ring-svg {
  flex: 0 0 280px;
  max-width: 280px;
}
.pitr-ring-details { flex: 1; min-width: 200px; }
.pitr-ring-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-1) var(--sp-3);
  font-size: 0.88em;
}
.pitr-ring-dl dt {
  font-weight: 500;
  color: var(--text-muted);
}
.pitr-ring-dl dd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.pitr-section-heading {
  font-size: 0.92em;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-3);
}

/* Kompakter Ring im Cockpit-Dashboard */
.cockpit-wal-ring {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.cockpit-wal-ring .wal-ring-widget {
  flex: 0 0 auto;
}
.cockpit-wal-ring-info {
  flex: 1;
  min-width: 160px;
  font-size: 0.88em;
}
.cockpit-wal-ring-info dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-1) var(--sp-3);
}
.cockpit-wal-ring-info dt {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85em;
}
.cockpit-wal-ring-info dd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

@media (max-width: 640px) {
  .pitr-ring-layout { flex-direction: column; align-items: center; }
  .pitr-ring-svg { flex: 0 0 auto; }
}

/* Jobs paginierung */
.jobs-pagination { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) 0; margin-top: var(--sp-2); border-top: 1px solid var(--border); }
.jobs-pagination-info { font-size: 0.85em; color: var(--text-muted); }

/* ===========================================================================
   Cockpit (cp-) — Lage-Banner, Grid, Failure-/Event-/Health-Rows
   =========================================================================== */


/* Gemeinsames Seitenstatus-Banner (info/warn/danger/ok). Wiederverwendet von
   Cockpit und allen Admin-Seiten; ersetzt die alten cp-banner--red/green
   sowie die verstreuten .error/.success/.warn-Divs als Seitenstatus. */
.banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: 0.95em;
  font-weight: 500;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.banner--ok { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid var(--accent); }
.banner--danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.banner--warn { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.banner--info { background: var(--info-soft); color: var(--info); border: 1px solid var(--info); }
.banner-actions { display: flex; gap: var(--sp-2); margin-left: auto; }

/* Gemeinsamer Chip (Badge) — ersetzt cp-chip. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-3);
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip--warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.chip--info { background: var(--info-soft); color: var(--info); border-color: var(--info); }

.cp-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: var(--sp-6);
}
@media (max-width: 1279px) {
  .cp-grid { grid-template-columns: 1fr; }
}

/* Gemeinsames Sektions-Panel mit Titel — ersetzt cp-panel/cp-panel-title. */
.panel { display: flex; flex-direction: column; gap: 0; }
.panel-title {
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  padding: 0 0 var(--sp-3);
}

.cp-failure-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  margin-bottom: var(--sp-2);
  min-height: 40px;
  cursor: default;
  transition: background-color var(--transition-fast);
}
.cp-failure-row[data-href] { cursor: pointer; }
.cp-failure-row[data-href]:hover { background: color-mix(in srgb, var(--danger-soft) 80%, var(--danger) 20%); }
.cp-failure-bar { width: 3px; align-self: stretch; background: var(--danger); border-radius: 2px; flex-shrink: 0; }
.cp-failure-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cp-failure-main { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.cp-failure-object { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-failure-agent { font-size: 0.88em; color: var(--text-muted); }
.cp-failure-error {
  font-size: 0.85em;
  color: var(--danger);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
}
.cp-failure-meta { font-size: 0.78em; color: var(--text-subtle); display: flex; gap: var(--sp-1); }
.cp-failure-sep { opacity: 0.5; }
.cp-failure-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.cp-failure-action { font-size: 0.82em; padding: var(--sp-1) var(--sp-3); }

.cp-event-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  min-height: 40px;
  font-size: 0.9em;
}
.cp-event-row:last-child { border-bottom: none; }
.cp-event-time { font-size: 0.82em; color: var(--text-subtle); font-family: var(--font-mono); white-space: nowrap; flex-shrink: 0; min-width: 5ch; }
.cp-event-body { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.cp-event-object { font-weight: 500; color: var(--text); }
.cp-event-action { color: var(--text-muted); }
.cp-event-agent { font-size: 0.85em; color: var(--text-subtle); }

.cp-health-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  min-height: 40px;
  font-size: 0.88em;
}
.cp-health-row:last-child { border-bottom: none; }
.cp-health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cp-health-dot--red { background: var(--danger); }
.cp-health-dot--yellow { background: var(--warning); }
.cp-health-dot--green { background: var(--success); }
.cp-health-name { font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-health-meta { font-size: 0.85em; color: var(--text-muted); white-space: nowrap; }
.cp-health-sparkline { flex-shrink: 0; }

/* Scrollbars: schmal und an Theme-Tokens gebunden (Dark-Mode: kein helles Standard-Grau) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }
*::-webkit-scrollbar-button { display: none; }

/* ---------------------------------------------------------------------------
   UX-Umbau 2026-09-26: Tabellen (Datenbanken/Agents) — Klassen mit .tb- Prefix.
   Einheitliche Zeilenhoehe 40px, Fehlerzeilen mit rotem Balken links und
   getoentem Hintergrund, Sparkline als 14-Punkt-Reihe.
--------------------------------------------------------------------------- */

.tb-table th, .tb-table td { height: 40px; vertical-align: middle; }

/* Fehler-/Warnzeilen: 3px Balken links + getoenter Hintergrund. */
.tb-row--danger  { box-shadow: inset 3px 0 0 var(--danger); background: var(--danger-soft); }
.tb-row--warning { box-shadow: inset 3px 0 0 var(--warning); }
tbody tr.tb-row--danger:hover  { background: var(--danger-soft); }
tbody tr.tb-row--danger:hover td.table-actions-cell { background: var(--danger-soft); }
tbody tr.tb-row--warning:hover { background: var(--surface-2); }

/* Zustandsspalte: Pill + Fehler-/Detailzeile. */
.tb-status-cell { min-width: 150px; }
.tb-status-detail {
  margin-top: var(--sp-1);
  font-size: 0.78em;
  color: var(--text-muted);
  line-height: 1.35;
  max-width: 320px;
}

/* Name/Hostname: primaere Zeile + sekundaere Meta-Zeile. */
.tb-name { font-weight: 500; }
.tb-sub { font-size: 0.8em; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }
.tb-sub--danger { color: var(--danger); }

/* Hilfszellen. */
.tb-muted { color: var(--text-muted); }
.tb-nowrap { white-space: nowrap; }

/* Sparkline: 14 Punkte, Fehler rot, Erfolg gruen, sonst grau. */
.tb-spark-cell { min-width: 130px; }
.tb-spark { display: inline-flex; align-items: center; gap: 2px; }
.tb-spark-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
  display: inline-block;
}
.tb-spark-dot--failed  { background: var(--danger); }
.tb-spark-dot--success { background: var(--accent); }


/* System-Seite (sysinfo): aus system.html in die gemeinsamen Tokens
   ueberfuehrt. Keine Inline-<style>-Bloecke mehr in Templates. */
.sysinfo-grid{display:flex;flex-direction:column;gap:var(--sp-4)}
.sysinfo-section{border-top:1px solid var(--border);padding-top:var(--sp-3)}
.sysinfo-section:first-of-type{border-top:none;padding-top:0}
.sysinfo-heading{font-size:1.05rem;font-weight:600;margin:0 0 var(--sp-2)}
.sysinfo-dl{display:grid;grid-template-columns:minmax(140px,auto) 1fr;gap:var(--sp-1) var(--sp-3);margin:0}
.sysinfo-dl dt{font-weight:500;color:var(--text-muted);white-space:nowrap}
.sysinfo-dl dd{margin:0;word-break:break-word}
.sysinfo-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:var(--sp-3)}
.sysinfo-metric{display:flex;flex-direction:column;gap:var(--sp-1)}
.sysinfo-metric-label{font-weight:500;color:var(--text-muted);font-size:.875rem}
.sysinfo-metric-value{font-size:1rem;font-weight:600;font-variant-numeric:tabular-nums}
.sysinfo-sparkline{margin-top:var(--sp-1)}
.sysinfo-sparkline svg{width:100%;height:auto;display:block}
.sysinfo-disks{display:flex;flex-direction:column;gap:var(--sp-2)}
.sysinfo-disk{display:flex;flex-direction:column;gap:var(--sp-1)}
.sysinfo-disk-header{display:flex;justify-content:space-between;align-items:baseline;gap:var(--sp-2)}
.sysinfo-disk-usage{font-size:.875rem;color:var(--text-muted)}
.sysinfo-disk-bar{height:8px;background:var(--surface-2);border-radius:4px;overflow:hidden}
.sysinfo-disk-bar-fill{height:100%;background:var(--info);border-radius:4px;transition:width .3s}
.sysinfo-disk-free{font-size:.8rem;color:var(--text-subtle)}


/* Compliance-Seite (aus compliance.html in die gemeinsamen Tokens ueberfuehrt) */
/* Compliance-spezifische Layout-Regeln. */
.compliance-summary {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.compliance-summary__total {
  margin-left: auto;
  font-size: 0.88em;
  color: var(--text-muted);
}
.compliance-actions {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.compliance-table {
  width: 100%;
}
.compliance-table .compliance-target {
  text-align: right;
}
.compliance-table .compliance-actual {
  text-align: right;
}
.compliance-table .compliance-status {
  text-align: center;
}
.compliance-detail {
  margin-top: 2px;
  max-width: 24em;
}

/* Print-CSS: Seite für PDF-Export via Browser-Druck. */
@media print {
  .app-sidebar,
  .app-topbar,
  .app-footer,
  .compliance-actions,
  .table-actions-cell,
  .action-menu,
  .btn {
    display: none !important;
  }
  .app-layout {
    display: block !important;
  }
  .app-main {
    margin: 0 !important;
    padding: 0 !important;
  }
  .app-content {
    padding: 1em !important;
  }
  .card {
    break-inside: avoid;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .compliance-table {
    font-size: 9pt;
  }
  .compliance-table th,
  .compliance-table td {
    padding: 4px 6px !important;
    border-bottom: 1px solid #ccc !important;
  }
  .pill {
    border: 1px solid #999 !important;
    background: none !important;
    color: #000 !important;
    font-weight: 600;
  }
  body {
    background: white !important;
    color: black !important;
  }
  a { color: black !important; text-decoration: none !important; }
}


/* Aktivitaets-Seite (aus activity.html in die gemeinsamen Tokens ueberfuehrt) */
.activity-toolbar { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.activity-filters { display: flex; gap: var(--sp-3); flex-wrap: wrap; flex: 1; }
.activity-controls { display: flex; align-items: center; gap: var(--sp-3); }
.activity-count { font-size: 0.85em; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.activity-feed { display: flex; flex-direction: column; gap: var(--sp-2); }

.activity-event { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); transition: background-color var(--transition-fast); }
.activity-event:hover { background: var(--surface-2); }
.activity-event--queued { border-left: 3px solid var(--text-subtle); }
.activity-event--running { border-left: 3px solid var(--info); }
.activity-event--done { border-left: 3px solid var(--success); }
.activity-event--warn { border-left: 3px solid var(--warning); }
.activity-event--error { border-left: 3px solid var(--danger); }

.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-dot--queued { background: var(--text-subtle); }
.activity-dot--running { background: var(--info); animation: activity-pulse 1.5s ease-in-out infinite; }
.activity-dot--done { background: var(--success); }
.activity-dot--warn { background: var(--warning); }
.activity-dot--error { background: var(--danger); }

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

.activity-body { flex: 1; min-width: 0; }
.activity-header { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.activity-label { font-weight: 500; font-size: 0.92em; }
.activity-time { font-size: 0.78em; color: var(--text-muted); font-family: var(--font-mono); margin-left: auto; white-space: nowrap; }
.activity-detail { font-size: 0.85em; color: var(--text-muted); margin-top: var(--sp-1); word-break: break-word; }
.activity-source-badge { font-size: 0.72em; padding: 1px var(--sp-1); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-subtle); font-family: var(--font-mono); }

#activity-pause[aria-pressed="true"] { color: var(--warning); border-color: var(--warning); }
#activity-pause .pause-icon { display: inline-block; }
#activity-pause .play-icon { display: none; }
#activity-pause[aria-pressed="true"] .pause-icon { display: none; }
#activity-pause[aria-pressed="true"] .play-icon { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  .activity-dot--running { animation: none; }
  .activity-event { transition: none; }
}


/* Gemeinsame KPI-Tiles: Label ueber grosser Zahl, flexible Breite.
   Ersetzt die inline-styled Summary-Cards der Recoverability-Seite. */
.kpi-grid { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.kpi-tile { flex: 1; min-width: 12rem; padding: var(--sp-3); }
.kpi-label { font-size: 0.85em; color: var(--text-muted); }
.kpi-value { font-size: 1.5em; font-weight: 600; }
.kpi-value--success { color: var(--success); }
.kpi-value--danger { color: var(--danger); }
