/* ============================================================
   ThinkShip — Enterprise Agentic OS — click-dummy design system
   Dark-mode-first, validated palette (see dataviz skill palette.md)
   ============================================================ */

:root {
  color-scheme: dark;

  /* chart / chrome surfaces (validated dark set) */
  --surface-1: #1a1a19;      /* card / chart surface */
  --page-plane: #0d0d0d;     /* page background */
  --surface-2: #212120;      /* slightly raised */
  --surface-3: #292927;      /* hover / raised more */
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  /* 2026-09-09 (axe-core-Audit): #898781 verfehlte AA (4.5:1) auf
     --surface-2/--surface-3 an mehreren Stellen (Meta-Zeilen, Tab-Buttons,
     BPMN-Chips) - aufgehellt, gilt jetzt überall (ein Token, keine
     Sonderfälle je Verwendungsstelle). */
  --text-muted: #a6a49c;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);
  --success-text: #0ca30c;

  /* categorical (fixed order — never cycle)
     2026-09-09 (axe-core-Audit): alle acht Farben werden auch als
     Avatar-Hintergrund mit weißer Initialen-Schrift verwendet (Organisation/
     Integrationen) - im ursprünglichen Ton verfehlten 7 von 8 dort AA
     (nur 3.1-3.9:1 statt 4.5:1). Abgedunkelt, bis Weiß darauf 4.5:1+
     erreicht - Farbidentität je Abteilung bleibt erkennbar erhalten,
     betrifft denselben Token überall (Dots/Tags/Avatare), kein zweites
     Farbfeld pro Eintrag in DEPARTMENTS/INTEGRATIONS nötig.
     --series-6 (it) blieb bereits ohne Änderung bei 4.95:1. */
  --series-1: #3275c7; /* blue    — sales */
  --series-2: #c35022; /* orange  — marketing */
  --series-3: #15855e; /* aqua    — finance */
  --series-4: #9f6900; /* yellow  — legal */
  --series-5: #c24a75; /* magenta — hr */
  --series-6: #008300; /* green   — it */
  --series-7: #736aba; /* violet  — ops */
  --series-8: #bd5454; /* red     — support */

  /* Gegenstück zu --series-N für Fließtext-Farbe auf dunklem Grund (BPMN-
     Diagramm-Labels/-Chips) - dieselbe Abdunklung, die --series-N als
     Avatar-Hintergrund erst AA-tauglich macht, macht die Farbe als TEXT auf
     --surface-2/--surface-3 zu dunkel (umgekehrte Anforderung). Aus dem
     ursprünglichen, nicht abgedunkelten Ton abgeleitet statt neu erfunden.
     Nur dort verwenden, wo die Abteilungsfarbe als Text erscheint, nicht als
     Hintergrund. */
  --series-1-text: #4d93e8;
  --series-2-text: #df7449;
  --series-3-text: #27a479;
  --series-4-text: #c98500;
  --series-5-text: #dc6d95;
  --series-6-text: #47a647;
  --series-7-text: #9085e9;
  --series-8-text: #e66a6a;

  /* sequential (blue ramp) */
  --seq-100: #cde2fb; --seq-150: #b7d3f6; --seq-200: #9ec5f4; --seq-250: #86b6ef;
  --seq-300: #6da7ec; --seq-350: #5598e7; --seq-400: #3987e5; --seq-450: #2a78d6;
  --seq-500: #256abf; --seq-550: #1c5cab; --seq-600: #184f95; --seq-650: #104281; --seq-700: #0d366b;

  /* status (fixed, reserved, never reused as series) */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  /* brand accent (product identity, layered over series-1/violet)
     2026-09-09 (axe-core-Audit): --brand-2 als Text auf --surface-2/
     --surface-3 (BPMN-Diagramm-Labels/-Chips) verfehlte AA (4.0-4.4:1) -
     aufgehellt auf 4.5:1+. Getrennt von --series-1 (das trotz gleichem
     Ursprungston aus anderem Grund - Avatar-Hintergrund - abgedunkelt
     wurde), da beide Token unterschiedliche Rollen haben. */
  --brand: #6f6ae8;
  --brand-2: #5fa3ee;
  --brand-gradient: linear-gradient(135deg, #6f6ae8 0%, #3987e5 55%, #199e70 120%);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-lift: 0 16px 50px rgba(0,0,0,0.45);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.icon.icon-sm { width: 12px; height: 12px; vertical-align: -1px; }
.icon.rotate180 { transform: rotate(180deg); }
.dept-icon .icon, .brand-mark .icon, .run-mini-icon .icon { width: 100%; height: 100%; }
.toast-icon .icon { width: 14px; height: 14px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-plane);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, rgba(111,106,232,0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(25,158,112,0.08), transparent 55%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: proportional-nums;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; }
::selection { background: rgba(111,106,232,0.35); }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333330; border-radius: 8px; border: 2px solid var(--page-plane); }
::-webkit-scrollbar-thumb:hover { background: #45453f; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #131312 0%, #0f0f0e 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 20px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(111,106,232,0.45);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: -2px; }

.nav-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  position: relative;
  user-select: none;
}
.nav-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--surface-3); color: var(--text-primary); }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: var(--brand-gradient);
}
.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--surface-3);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
}
.nav-badge.warn { background: rgba(250,178,25,0.16); color: var(--status-warning); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.heartbeat-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(12,163,12,0.08);
  border: 1px solid rgba(12,163,12,0.22);
  font-size: 11.5px;
  color: var(--text-secondary);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-good);
  box-shadow: 0 0 0 0 rgba(12,163,12,0.6);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(12,163,12,0.55); }
  70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); }
  100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); }
}
.heartbeat-num { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.status-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; margin-top: 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px; color: var(--text-muted);
  cursor: pointer; transition: background .12s, color .12s;
}
.status-link:hover { background: var(--surface-2); color: var(--text-secondary); }

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(19,19,18,0.6);
  backdrop-filter: blur(10px);
}
.tenant-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  position: relative;
}
.tenant-switch:hover { border-color: var(--border-strong); }
/* Barrierefreiheit: der eigentliche Klick-/Fokus-Ziel ist ein <button>
   innerhalb des optisch gestylten Wrappers - das Dropdown-Panel hängt als
   Geschwister-Element daneben, nicht als Kind (dessen Einträge sind selbst
   Buttons, verschachtelte interaktive Elemente in einem Button sind
   ungültiges HTML). */
.tenant-switch-trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer;
}
.tenant-switch-trigger:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tenant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.search-result-group { padding: 8px 14px 2px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; transition: background .12s; }
.search-result-item:hover { background: var(--surface-2); }
.search-result-item .icon { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-result-item .sr-title { font-size: 12.5px; color: var(--text-primary); font-weight: 600; }
.search-result-item .sr-sub { font-size: 11px; color: var(--text-muted); }
.topbar-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.topbar-search input {
  background: none; border: none; outline: none; color: var(--text-primary);
  font-size: 13px; width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-spacer { flex: 1; }
.lang-switch {
  display: flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); margin-right: 4px;
}
.lang-opt {
  border: none; background: none; cursor: pointer; padding: 5px 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--text-muted);
  border-radius: 5px; transition: background .15s, color .15s;
}
.lang-opt:hover { color: var(--text-secondary); }
.lang-opt.active { background: var(--brand-gradient); color: #fff; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-1);
  cursor: pointer; position: relative;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; border-radius: 20px;
  background: var(--status-critical); color: #fff;
  font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--page-plane);
  padding: 0 3px;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.user-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.avatar {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.user-chip-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.user-chip-role { font-size: 10.5px; color: var(--text-muted); line-height: 1.2; }

/* dropdowns */
.dropdown-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  z-index: 80;
  overflow: hidden;
  animation: pop-in .14s ease;
}
.dropdown-panel.left { right: auto; left: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-header {
  padding: 12px 14px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.dropdown-item {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  /* Einige Vorkommen sind jetzt <button> statt <div> (Barrierefreiheit -
     Tastatur-fokussierbare Einträge) - Reset des Browser-Default-Button-
     Aussehens, damit beide Varianten gleich aussehen. */
  display: block; width: 100%; text-align: left;
  background: none; font: inherit; color: inherit;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.dropdown-item .dd-title { color: var(--text-primary); margin-bottom: 2px; }
.dropdown-item .dd-time { color: var(--text-muted); font-size: 11px; }
.dropdown-item.unread .dd-title::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-2); margin-right: 7px;
}

/* ---------- Main ---------- */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 26px 30px 60px;
}
.view { display: none; animation: fade-in .2s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.view-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.view-subtitle { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.view-actions { display: flex; gap: 10px; }

/* ============================================================
   Primitives
   ============================================================ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title { font-size: 14.5px; font-weight: 700; margin: 0 0 2px; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-8 { grid-template-columns: repeat(8, 1fr); }
@media (max-width: 1300px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-8 { grid-template-columns: repeat(4,1fr);} }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 6px 20px rgba(111,106,232,0.35); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-2); }
.btn-danger { background: rgba(208,59,59,0.12); color: #ff8d8d; border-color: rgba(208,59,59,0.3); }
.btn-danger:hover { background: rgba(208,59,59,0.2); }
.btn-good { background: rgba(12,163,12,0.14); color: #4be04b; border-color: rgba(12,163,12,0.3); }
.btn-good:hover { background: rgba(12,163,12,0.22); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.good { background: rgba(12,163,12,0.14); color: #4be04b; }
.badge.good .badge-dot { background: var(--status-good); }
.badge.warning { background: rgba(250,178,25,0.14); color: #ffcc5c; }
.badge.warning .badge-dot { background: var(--status-warning); }
.badge.serious { background: rgba(236,131,90,0.16); color: #ff9d74; }
.badge.serious .badge-dot { background: var(--status-serious); }
.badge.critical { background: rgba(208,59,59,0.16); color: #ff6b6b; }
.badge.critical .badge-dot { background: var(--status-critical); }
.badge.neutral { background: var(--surface-3); color: var(--text-secondary); }
.badge.neutral .badge-dot { background: var(--text-muted); }
.badge.brand { background: rgba(111,106,232,0.16); color: #b3aefb; }
.badge.brand .badge-dot { background: var(--brand); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.tag .tag-dot { width: 7px; height: 7px; border-radius: 2px; }

.pill-toggle { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; border: 1px solid var(--border); }
.pill-toggle button {
  border: none; background: none; color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.pill-toggle button.active { background: var(--surface-3); color: var(--text-primary); }

hr.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- Table ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700; padding: 0 12px 10px; border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Stat tile (dataviz Tier1) ---------- */
.stat-tile { display: flex; flex-direction: column; gap: 10px; }
.stat-tile.stat-in { animation: stat-in .4s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--stat-delay, 0ms); }
@keyframes stat-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .stat-tile.stat-in { animation: none; opacity: 1; transform: none; }
}

/* Markiert kurz, was sich seit dem letzten Render erhöht hat (Badges,
   Zähler) - Nutzer-Vorgabe "markiert wird, was sich verändert hat".
   Eine Farbe (--brand) statt neuer Ad-hoc-Farbe, reine Ring-Animation,
   kein Layout-Sprung. */
.value-flash { animation: value-flash .9s ease-out; border-radius: inherit; }
@keyframes value-flash {
  0% { box-shadow: 0 0 0 0 rgba(111,106,232,.55); }
  100% { box-shadow: 0 0 0 7px rgba(111,106,232,0); }
}
@media (prefers-reduced-motion: reduce) {
  .value-flash { animation: none; }
}
.stat-tile .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.stat-tile .stat-value { font-size: 27px; font-weight: 700; letter-spacing: -0.01em; }
.stat-tile .stat-delta { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.stat-delta.up { color: var(--success-text); }
.stat-delta.down { color: #ff8d8d; }
.stat-delta.flat { color: var(--text-muted); }
.sparkline { width: 100%; height: 34px; display: block; }

/* ---------- Meter (dataviz Tier1, same-ramp tracks) ---------- */
.meter { margin-bottom: 14px; }
.meter:last-child { margin-bottom: 0; }
.meter-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.meter-head .name { color: var(--text-secondary); font-weight: 600; }
.meter-head .val { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 600; }
.meter-track { height: 8px; border-radius: 6px; background: var(--gridline); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 6px; background: var(--seq-400); transition: width .6s cubic-bezier(.3,.8,.3,1); }
.meter-fill.warn { background: var(--status-warning); }
.meter-fill.crit { background: var(--status-critical); }
.meter-fill.good { background: var(--status-good); }

/* ---------- Bar chart (Tier1, categorical) ---------- */
.barchart { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.barchart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.barchart .bar { width: 100%; max-width: 34px; border-radius: 5px 5px 3px 3px; transition: height .7s cubic-bezier(.3,.8,.3,1); position: relative; }
.barchart .bar-val { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.barchart .bar-label { font-size: 10.5px; color: var(--text-muted); margin-top: 8px; text-align: center; line-height: 1.3; }

/* ---------- Legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-secondary); }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; }

/* ============================================================
   Dashboard specifics
   ============================================================ */
.hero-cta {
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  background: radial-gradient(1100px 260px at 0% 0%, rgba(111,106,232,0.20), transparent 60%), var(--surface-1);
  border: 1px solid rgba(111,106,232,0.3);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 20px;
}
.hero-cta h2 { margin: 0 0 6px; font-size: 19px; }
.hero-cta p { margin: 0; color: var(--text-secondary); font-size: 13.5px; max-width: 480px; }

.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); animation: slide-in .3s ease; }
.activity-item:last-child { border-bottom: none; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.activity-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.run-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.run-mini:last-child { margin-bottom: 0; }
.run-mini:hover { border-color: var(--border-strong); background: var(--surface-2); }
.run-mini-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.run-mini-body { flex: 1; min-width: 0; }
.run-mini-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-mini-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }

/* ============================================================
   New Request view
   ============================================================ */
.request-box {
  border-radius: var(--radius-lg);
  padding: 4px;
  background: var(--brand-gradient);
  margin-bottom: 22px;
}
.request-box-inner { background: var(--surface-1); border-radius: 16px; padding: 24px; }
.request-box textarea {
  width: 100%; min-height: 96px; resize: vertical;
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 16px; line-height: 1.5; font-family: inherit;
}
.request-box textarea::placeholder { color: var(--text-muted); }
.request-box-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.request-hint { font-size: 11.5px; color: var(--text-muted); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  padding: 7px 13px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--surface-3); }
.chip .chip-dot { width: 7px; height: 7px; border-radius: 50%; }

.thinking-box { display: flex; align-items: center; gap: 12px; padding: 22px 4px; }
.thinking-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--brand-2);
  animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thinking-text { font-size: 13.5px; color: var(--text-secondary); }

.plan-card { animation: fade-in .3s ease; }
.plan-agent-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 10px; font-size: 12px;
}
.plan-agent-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.plan-stage-block { margin-bottom: 4px; }
.plan-stage-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.plan-stage-agents { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-muted); padding: 8px 0; font-size: 12px; }

/* ============================================================
   Run detail / Pipeline (DAG-lite)
   ============================================================ */
.run-header-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.run-elapsed { font-variant-numeric: tabular-nums; font-weight: 700; }

.pipeline {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto;
  padding: 6px 2px 18px;
}
.pipeline-stage {
  min-width: 240px; max-width: 300px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
}
.pipeline-stage-head {
  font-size: 12px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; padding: 0 2px;
}
.pipeline-stage-head .count { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.pipeline-stage-lead { font-size: 10px; color: var(--brand-2); margin: -6px 0 8px 2px; font-weight: 600; }
.pipeline-nodes {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px; min-height: 90px; max-height: 420px; overflow-y: auto;
}
.pipeline-nodes.mass { flex-direction: row; flex-wrap: wrap; }
.pipeline-nodes.mass .node { width: 40px; height: 40px; padding: 0; justify-content: center; }
.pipeline-nodes.mass .node .node-avatar { margin: 0; }
.pipeline-nodes.mass .node .node-body { display: none; }

.node {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .2s, background .2s;
}
.node.running { border-color: rgba(57,135,229,0.5); background: rgba(57,135,229,0.08); }
.node.done { border-color: rgba(12,163,12,0.35); }
.node.awaiting_approval { border-color: rgba(250,178,25,0.5); background: rgba(250,178,25,0.07); }
.node.failed { border-color: rgba(208,59,59,0.5); background: rgba(208,59,59,0.08); }
.node-avatar { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.node.running .node-avatar::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--series-1);
  border-top-color: transparent; animation: spin 1s linear infinite;
}
.node.done .node-avatar { box-shadow: 0 0 0 2px var(--status-good); }
.node.awaiting_approval .node-avatar { box-shadow: 0 0 0 2px var(--status-warning); }
.node.failed .node-avatar { box-shadow: 0 0 0 2px var(--status-critical); }
.node.queued .node-avatar { opacity: .55; }
.node-body { min-width: 0; flex: 1; }
.node-name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-action { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-status-icon { flex-shrink: 0; width: 14px; height: 14px; }

.pipeline-connector {
  width: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  color: var(--text-muted); margin-top: 30px;
}
.pipeline-connector svg { width: 22px; height: 22px; }
.pipeline-connector .flow-label { font-size: 9.5px; text-align: center; white-space: nowrap; }
.chevron-flow { display: flex; gap: 1px; }
.chevron-flow span { animation: chevron-pulse 1.4s infinite; opacity: .25; }
.chevron-flow span:nth-child(2) { animation-delay: .15s; }
.chevron-flow span:nth-child(3) { animation-delay: .3s; }
@keyframes chevron-pulse { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

.log-console {
  background: #000; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; font-family: "Cascadia Code", ui-monospace, Consolas, monospace; font-size: 11.5px;
  height: 260px; overflow-y: auto; line-height: 1.7;
}
.log-line { display: flex; gap: 9px; margin-bottom: 2px; animation: slide-in .2s ease; }
.log-time { color: #55554f; flex-shrink: 0; }
.log-tag { flex-shrink: 0; font-weight: 700; }
.log-tag.info { color: var(--brand-2); }
.log-tag.agent { color: var(--series-6); }
.log-tag.approval { color: var(--status-warning); }
.log-tag.delegate { color: var(--brand); }
.log-tag.system { color: var(--text-muted); }
.log-msg { color: #d6d5cd; }

.approval-interrupt {
  border: 1px solid rgba(250,178,25,0.4);
  background: rgba(250,178,25,0.06);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 16px 0;
  animation: fade-in .3s ease;
}
.approval-interrupt .ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.approval-interrupt .ai-icon { width: 30px; height: 30px; border-radius: 9px; background: rgba(250,178,25,0.18); display: flex; align-items: center; justify-content: center; color: var(--status-warning); flex-shrink: 0; }
.approval-interrupt .ai-title { font-weight: 700; font-size: 14px; }
.approval-interrupt .ai-context { font-size: 12.5px; color: var(--text-secondary); margin: 8px 0 14px; line-height: 1.5; }
.approval-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.deliverable-card {
  display: flex; gap: 16px; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
  background: linear-gradient(135deg, rgba(25,158,112,0.08), transparent 60%);
}
.deliverable-thumb {
  width: 64px; height: 82px; border-radius: 8px; background: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 8px; gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.deliverable-thumb .l { height: 4px; background: #dcdcdc; border-radius: 2px; }
.deliverable-thumb .l.w60 { width: 60%; }
.deliverable-thumb .l.w80 { width: 80%; }
.deliverable-thumb .l.accent { background: var(--brand-2); height: 6px; width: 40%; margin-bottom: 3px; }

/* ============================================================
   Organization view — leadership tree
   ============================================================ */
.org-tree { display: flex; flex-direction: column; align-items: center; padding: 22px 10px 6px; }
.org-root-wrap { display: flex; justify-content: center; }
.org-node {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 9px 14px; cursor: default;
}
.org-node.coordinator { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); cursor: default; }
.org-node.coordinator .avatar { color: #fff; }
.org-node-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.org-node-role { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.org-tree-children {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border-strong); position: relative;
}
.org-tree-children::before {
  content: ""; position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 1px; height: 22px; background: var(--border-strong);
}
.org-lead-chip {
  position: relative; display: flex; align-items: center; gap: 9px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 11px;
  padding: 8px 12px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.org-lead-chip:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.org-lead-chip::before {
  content: ""; position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 1px; height: 22px; background: var(--border-strong);
}
.org-lead-chip .avatar { width: 27px; height: 27px; font-size: 10.5px; color: #fff; }

/* ============================================================
   Organization view
   ============================================================ */
.dept-card {
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.dept-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.dept-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.dept-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.dept-icon svg { width: 19px; height: 19px; }
.icon-badge { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-badge .icon { width: 18px; height: 18px; }
.dept-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.dept-meta { font-size: 11.5px; color: var(--text-muted); }
.dept-stats-row { display: flex; gap: 16px; margin-top: 14px; }
.dept-stat { flex: 1; }
.dept-stat .n { font-size: 16px; font-weight: 700; }
.dept-stat .l { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.agent-row { display: flex; align-items: center; gap: 12px; }
.agent-name-cell { display: flex; align-items: center; gap: 10px; }
.model-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 7px; }
.model-badge .lock { width: 10px; height: 10px; color: var(--status-warning); }
.model-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.model-badge.local .dot { background: var(--series-6); }
.model-badge.cloud .dot { background: var(--series-1); }

.skill-tag-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-overlay.show { display: flex; animation: fade-in .15s ease; }
.modal-box {
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  width: 560px; max-width: 100%; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lift); animation: pop-in .18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-size: 13px; color: var(--text-primary); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--brand); }
.form-textarea { min-height: 76px; resize: vertical; }
.suggest-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-md); padding: 14px; background: var(--surface-2); margin-top: 14px; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-stack { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 12px 16px; font-size: 12.5px; box-shadow: var(--shadow-lift);
  animation: toast-in .25s ease; min-width: 260px;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast-icon { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: rgba(12,163,12,0.16); color: var(--status-good); }

/* ============================================================
   Misc
   ============================================================ */
.empty-note { color: var(--text-muted); font-size: 12.5px; padding: 20px 0; text-align: center; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .two-col { grid-template-columns: 1fr; } }
.risk-hoch { color: #ff6b6b; }
.risk-mittel { color: #ffcc5c; }
.risk-niedrig { color: #4be04b; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-0 { margin-bottom: 0; }

/* ============================================================
   Form-Generator (Editor für menschliche Aufgaben-Formulare)
   ============================================================ */
.wfn-field-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
  padding: 10px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border);
}
.wfn-field-row input[data-f-label] { flex: 1.4; }
.wfn-field-row select[data-f-type] { flex: 1; }
.wfn-field-row input[data-f-options] { flex: 1.4; }
.wfn-field-required { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   Review-Zyklus
   ============================================================ */
.cycle-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0 2px; padding: 6px 2px; }
.cycle-stage { flex: 1; min-width: 150px; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px 10px; }
.cycle-stage-icon { width: 42px; height: 42px; border-radius: 50%; background: rgba(111,106,232,0.14); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.cycle-stage-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.cycle-stage-desc { font-size: 11px; color: var(--text-muted); line-height: 1.45; }
.cycle-arrow { display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; width: 26px; justify-content: center; }
.cycle-arrow .icon { width: 16px; height: 16px; }
.cycle-loop {
  width: 100%; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11.5px; color: var(--brand-2); font-weight: 600; border-top: 1px dashed var(--border-strong); padding-top: 14px;
}
.quote-block-sm { border-left: 2px solid var(--brand); padding-left: 10px; font-size: 12.5px; color: var(--text-secondary); font-style: italic; line-height: 1.5; }

/* ============================================================
   Workflow-Diagramm (<ui-workflow-canvas> aus dem UI-Kit, vendor/ui-kit)
   ============================================================ */
.wf-diagram { margin: 14px 0 4px; }
.wf-canvas {
  display: block; height: 400px; min-height: 280px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2);
}
@media (max-width: 640px) { .wf-canvas { height: 380px; } }

/* ---------- Diagramme (UI-Kit-Komponenten, vendor/ui-kit) ---------- */
.chart-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card .card-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
