/* =========================================================================
   Agent Control – Design-System
   Ruhig, modern, viel Weißraum. Ein Akzentton, klare Typografie.
   ========================================================================= */

:root {
  /* Lila – kräftiges Violett statt Blau, warmes Papier statt kühles Grau. */
  --bg: #efe9f1;
  --surface: #faf8fb;
  --surface-2: #f5f1f7;
  --surface-3: #ede6f0;
  --border: #d9cee0;
  --border-strong: #c3b2cc;
  --text: #1c1620;
  --text-2: #5f5468;
  --text-3: #857a8e;
  --accent: #5b3a7a;
  --accent-soft: #ece3f2;
  --accent-strong: #402959;
  --green: #3f7a3f;
  --green-soft: #e6f1e3;
  --amber: #a1650f;
  --amber-soft: #f6ecdb;
  --red: #a13a3a;
  --red-soft: #f5e3e1;
  --purple: #8a6a8a;

  --radius-s: 6px;
  --radius: 9px;
  --radius-l: 13px;
  --shadow-s: 0 1px 2px rgba(38, 22, 46, .06);
  --shadow: 0 2px 10px rgba(38, 22, 46, .07), 0 1px 2px rgba(38, 22, 46, .05);
  --shadow-l: 0 16px 44px rgba(38, 22, 46, .16);
  --font: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #17121e;
  --surface: #201828;
  --surface-2: #241c2d;
  --surface-3: #2c2236;
  --border: #3a2e46;
  --border-strong: #4a3b58;
  --text: #ece5f0;
  --text-2: #b7abc2;
  --text-3: #8a7d97;
  --accent: #a98fd4;
  --accent-soft: #2c2140;
  --accent-strong: #c3aee8;
  --green: #7dc47d;
  --green-soft: #1c2a1c;
  --amber: #e0ac52;
  --amber-soft: #302617;
  --red: #e08a8a;
  --red-soft: #331f1f;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 2px 10px rgba(0, 0, 0, .4);
  --shadow-l: 0 16px 48px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; font-family: var(--font-display); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ------------------------------------------------------------- Grundlayout */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* -------------------------------------------------------------- Masthead */
/* Redaktioneller Kopf statt Seitenleiste: Marke + Suche + Konto oben,
   darunter eine durchlaufende Zeile mit den Bereichen -- wie ein
   Zeitungskopf mit Rubrikenleiste, nicht wie eine Werkzeug-Seitenleiste. */

.masthead {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.masthead-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px 12px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow-s);
  flex: none;
}
.brand-text strong { display: block; font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; font-family: var(--font-display); }
.brand-text span { font-size: 11.5px; color: var(--text-3); }

.topnav {
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px; overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 7px; flex: none;
  padding: 10px 12px; margin-bottom: -1px;
  color: var(--text-2); cursor: pointer; user-select: none;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.ico { width: 17px; height: 17px; flex: none; }
.btn .ico, .icon-btn .ico { width: 15px; height: 15px; }
.nav-item .badge {
  font-size: 10.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 6px; border-radius: 20px;
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 9px 5px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border);
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 650; font-size: 11.5px; flex: none;
}
.user-chip .meta { min-width: 0; }
.user-chip .meta strong { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.user-chip .meta span { font-size: 10.5px; color: var(--text-3); }

/* ------------------------------------------------------------- Seiteninhalt */

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

.page-head { flex: none; padding: 22px 24px 4px; }
.page-head h1 { font-size: 22px; font-weight: 500; }
.page-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
/* Die Uebersicht traegt ihre eigene, groessere Schlagzeile im Inhalt --
   die generische Kopfzeile waere dort doppelt. */
.page-head.is-hidden { display: none; }

.search-box { position: relative; width: 280px; margin-left: auto; }
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text); font-size: 13px; font-family: var(--font);
}
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-l); max-height: 420px; overflow-y: auto; padding: 6px;
}
.search-results .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 10px 4px; font-weight: 650; }
.search-results .row { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.search-results .row:hover { background: var(--surface-3); }
.search-results .row small { color: var(--text-3); margin-left: auto; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  display: grid; place-items: center; flex: none;
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.view { flex: 1; overflow-y: auto; padding: 22px; }
.view.no-pad { padding: 0; overflow: hidden; }
.view-inner { max-width: 1360px; margin: 0 auto; }

/* --------------------------------------------------------------- Bausteine */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14.5px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px; }
.card-body.tight { padding: 8px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3, .grid.side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
  .grid.cols-2, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  /* Kein Menue-Umschalter mehr noetig: die Rubrikenzeile scrollt auf
     schmalen Fenstern seitlich, statt in einer Schublade zu verschwinden. */
  .masthead-row { padding: 12px 14px 10px; gap: 10px; }
  .brand-text { display: none; }
  .user-chip .meta { display: none; }
  .topnav { padding: 0 10px 2px; }
  .page-head { padding: 16px 14px 2px; }
  .search-box { width: auto; flex: 1 1 auto; margin-left: 0; }
  .search-box input { font-size: 16px; } /* verhindert Zoom beim Fokussieren auf iOS */
}

.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .delta { font-size: 12px; margin-top: 3px; color: var(--text-3); }
/* Gefuellte Kachel fuer die eine Zahl, die im Blick bleiben soll (z. B. Kosten heute) */
.stat.accent { background: var(--accent); border-color: var(--accent); }
.stat.accent .label, .stat.accent .delta { color: rgba(255, 255, 255, .78); }
.stat.accent .value, .stat.accent .value small { color: #fff; }

/* ------------------------------------------------------------------- Hero */
/* Redaktioneller Kopf der Uebersicht: eine Schlagzeile aus echten Zahlen
   statt einer weiteren Kachelreihe. */

.hero { padding: 6px 0 26px; max-width: 760px; }
.hero .eyebrow {
  display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px; font-weight: 600;
}
.hero h1 {
  font-size: 34px; font-weight: 400; line-height: 1.18; letter-spacing: -.01em;
  text-wrap: pretty; margin-bottom: 10px;
}
.hero p { font-size: 14px; line-height: 1.6; color: var(--text-2); max-width: 620px; }

/* ------------------------------------------------------------- Abnahme-Karten */

.review-card {
  display: flex; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
}
.review-card .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.review-card .title { font-size: 14.5px; font-weight: 600; }
.review-card .excerpt {
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.review-card .actions { display: flex; gap: 8px; margin-top: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pill.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill:hover { filter: brightness(.96); }

/* ----------------------------------------------------------------- Team-Liste */

.team-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.team-row:last-child { border-bottom: none; }
.team-row .name { font-size: 13px; font-weight: 600; }
.team-row .role { font-size: 11.5px; color: var(--text-3); }
.team-row .spacer { flex: 1; }

/* ---------------------------------------------------------------- Verlaufszeile */

.run-row {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; gap: 12px;
  align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 12.5px; cursor: pointer;
}
.run-row:last-child { border-bottom: none; }
.run-row:hover .run-agent { color: var(--accent); }
.run-row .run-time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.run-agent { font-weight: 500; transition: color .12s; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 550;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-family: var(--font); white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 999px; padding-left: 16px; padding-right: 16px; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 550;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.err { background: var(--red-soft); color: var(--red); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: var(--border-strong); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--green); }
.dot.err { background: var(--red); }
.dot.warn { background: var(--amber); }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 5px;
}
label.field > small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"],
input[type="time"], input[type="search"], input[type="email"], select, textarea {
  width: 100%; padding: 8px 11px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.switch-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; }
.switch-row .hint { color: var(--text-3); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 650; padding: 8px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--text-3);
}
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .6; }
.empty h3 { color: var(--text-2); margin-bottom: 4px; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-flex { display: flex; align-items: center; gap: 10px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spacer { flex: 1; }

.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar > i.warn { background: var(--amber); }
.bar > i.err { background: var(--red); }

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

.chat-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); height: 100%; min-height: 0; }
/* min-height: 0 verhindert, dass lange Inhalte die Spalten in die Hoehe treiben. */
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.chat-list-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.chat-items { overflow-y: auto; flex: 1; padding: 6px; }
.chat-item {
  padding: 10px 11px; border-radius: 10px; cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
}
.chat-item:hover { background: var(--surface-3); }
.chat-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.chat-item .title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.chat-item .title small { margin-left: auto; color: var(--text-3); font-weight: 400; font-size: 11px; }
.chat-item .preview { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.chat-item .avatars { display: flex; gap: 3px; margin-top: 6px; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-head {
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; gap: 12px; flex: none;
}
.messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 860px; }
.msg.own { flex-direction: row-reverse; margin-left: auto; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 14px; color: #fff;
}
.msg-body { min-width: 0; }
.msg-meta { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 7px; align-items: center; }
.msg.own .msg-meta { justify-content: flex-end; }
.bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px; padding: 11px 14px;
  white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-s);
}
.msg.own .bubble { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 12px 4px 12px 12px; }
.msg.system .bubble { background: transparent; border-style: dashed; color: var(--text-3); font-size: 12.5px; box-shadow: none; }
.bubble.error { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); background: var(--red-soft); color: var(--red); }
.bubble code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.msg.own .bubble code { background: rgba(255, 255, 255, .2); }
.bubble pre { background: var(--surface-3); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0 0; }
.msg-foot { font-size: 11px; color: var(--text-3); margin-top: 5px; display: flex; gap: 10px; }

/* Tatsaechliches Werkzeug-Protokoll unter einer Agentennachricht - macht eine
   erfundene Behauptung im Bubble-Text sofort ueberpruefbar, ohne ins Protokoll
   wechseln zu muessen. */
.tool-log { margin-top: 6px; font-size: 11.5px; }
.tool-log.empty { color: var(--amber); background: var(--amber-soft); border-radius: 8px; padding: 5px 9px; display: inline-block; }
.tool-log summary { cursor: pointer; color: var(--text-3); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.tool-log summary::-webkit-details-marker { display: none; }
.tool-log summary:hover { color: var(--text-2); }
.tool-log[open] summary { color: var(--text-2); margin-bottom: 5px; }
.tool-log-body { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-width: 520px; }
.tool-log-entry strong { display: block; font-size: 11.5px; color: var(--accent); margin-bottom: 2px; }
.tool-log-entry pre { margin: 2px 0 0; padding: 5px 7px; background: var(--surface-3); border-radius: 5px; font-size: 10.5px; white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow-y: auto; }

/* Auf breiten Fenstern bleibt rechts Platz, damit der Sprach-Knopf den Senden-Button nicht verdeckt. */
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 92px 14px 18px; flex: none; }
.composer-box {
  display: flex; gap: 10px; align-items: flex-end;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 8px 8px 12px;
  background: var(--surface-2);
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  border: none; background: transparent; padding: 4px 0; min-height: 24px; max-height: 190px;
  resize: none; font-size: 13.5px;
}
.composer textarea:focus { outline: none; box-shadow: none; }
.composer-hint { font-size: 11.5px; color: var(--text-3); margin-top: 7px; display: flex; gap: 12px; align-items: center; }

.mention-menu {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 8px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-l); padding: 5px; min-width: 240px; max-height: 250px; overflow-y: auto;
}
.mention-menu .row { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.mention-menu .row:hover, .mention-menu .row.sel { background: var(--accent-soft); }

.mobile-only { display: none !important; }

.typing { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Chat auf schmalen Fenstern: eine Spalte – entweder Liste oder Unterhaltung.
   Steht bewusst nach den Chat-Regeln, sonst wuerden diese es ueberschreiben. */
@media (max-width: 780px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-list { display: none; border-right: none; }
  .chat-layout.show-list .chat-list { display: flex; }
  .chat-layout.show-list .chat-main { display: none; }
  .mobile-only { display: inline-flex !important; }
  .composer { padding: 10px 12px 12px; }
  .composer-hint { display: none; }
  .messages { padding: 14px; }
  .msg { max-width: 100%; }
  .chat-head { padding: 10px 12px; }
}

/* ------------------------------------------------------------------ Agenten */

.agent-card { padding: 16px; display: flex; flex-direction: column; gap: 11px; }
.agent-top { display: flex; gap: 11px; align-items: flex-start; }
.agent-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-size: 18px; color: #fff; flex: none;
}
.agent-card h3 { font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.agent-card h3 .chip { flex: none; }
.agent-metrics { flex-wrap: wrap; }
.agent-card .desc {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.agent-metrics { display: flex; gap: 16px; padding-top: 11px; border-top: 1px solid var(--border); }
.agent-metrics div { font-size: 11.5px; color: var(--text-3); }
.agent-metrics strong { display: block; font-size: 14px; color: var(--text); font-weight: 620; }

.endpoint-line {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  background: var(--surface-3); padding: 6px 9px; border-radius: 7px;
  display: flex; gap: 7px; align-items: center; overflow: hidden;
}
.method-tag {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  background: var(--accent); color: #fff; letter-spacing: .04em; flex: none;
}

/* ----------------------------------------------------------------- Dateien */

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 13px; }
.file-tile {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 14px; cursor: pointer; position: relative; transition: border-color .12s, box-shadow .12s;
}
.file-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.file-ico {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 10px; letter-spacing: .02em;
}
.file-tile .name { font-size: 13px; font-weight: 550; word-break: break-word; line-height: 1.35; }
.file-tile .meta { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.file-tile .star { position: absolute; top: 10px; right: 10px; opacity: .35; }
.file-tile .star.on { opacity: 1; color: var(--amber); }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--text-3); background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.dropzone.hot { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.tree-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.tree-item:hover { background: var(--surface-3); }
.tree-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.tree-item .count { margin-left: auto; font-size: 11px; color: var(--text-3); }

/* ------------------------------------------------------------------ Modal */

/* Zentriert wird bewusst mit Flexbox, nicht mit "display: grid; place-items:
   center". Bei Grid haengt die Spaltenbreite vom Inhalt ab, waehrend das
   Fenster selbst "100%" dieser Spalte beanspruchte – ein Zirkelbezug, den
   manche Browser (u. a. Safari) zu 0 aufloesen. Sichtbar war dann nur der
   unscharfe Hintergrund. Im Flex-Container ist der Bezug eindeutig. */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 17, 21, .45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; overflow-y: auto;
  animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative;
  background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-l);
  width: 720px; max-width: 100%;
  max-height: 88vh;
  min-height: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--border); animation: rise .16s cubic-bezier(.2, .8, .3, 1);
}
/* dvh beruecksichtigt ein- und ausblendende Browserleisten auf Mobilgeraeten */
@supports (max-height: 88dvh) { .modal { max-height: 88dvh; } }
.modal.wide { width: 1020px; }
@keyframes rise { from { transform: translateY(10px) scale(.99); opacity: .6; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex: none; }
/* min-height: 0 ist noetig, damit der Inhalt scrollt statt das Fenster zu sprengen */
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); padding: 0 20px; }
.tab {
  padding: 10px 12px; font-size: 13px; font-weight: 550; color: var(--text-3);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; box-shadow: var(--shadow-l); padding: 11px 15px; font-size: 13px;
  min-width: 250px; max-width: 380px; animation: slide .18s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast strong { display: block; font-size: 13px; margin-bottom: 1px; }
.toast span { color: var(--text-2); font-size: 12.5px; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }

/* ----------------------------------------------------------- Sprachassistent */

.voice-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 45%, transparent);
  display: grid; place-items: center;
  transition: transform .14s, background .14s;
}
.voice-fab:hover { transform: scale(1.06); }
.voice-fab.listening { background: var(--red); box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 50%, transparent); animation: ring 1.5s infinite; }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 50%, transparent); }
  70% { box-shadow: 0 0 0 18px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.voice-panel {
  position: fixed; right: 24px; bottom: 90px; z-index: 90;
  width: 372px; max-height: 62vh; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-l); display: flex; flex-direction: column; overflow: hidden;
  animation: rise .16s cubic-bezier(.2, .8, .3, 1);
}
.voice-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 9px; }
.voice-log { padding: 14px 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 11px; }
.voice-entry .who { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.voice-entry .what { font-size: 13px; line-height: 1.5; }
.voice-entry.me .what { background: var(--accent-soft); color: var(--accent); padding: 8px 11px; border-radius: 10px; display: inline-block; }
.voice-entry.bot .what { background: var(--surface-3); padding: 8px 11px; border-radius: 10px; display: inline-block; }
.voice-foot { padding: 11px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.voice-wave { display: flex; gap: 3px; align-items: flex-end; height: 18px; }
.voice-wave i { width: 3px; background: var(--accent); border-radius: 2px; animation: wave .9s infinite ease-in-out; height: 6px; }
.voice-wave i:nth-child(2) { animation-delay: .1s; }
.voice-wave i:nth-child(3) { animation-delay: .2s; }
.voice-wave i:nth-child(4) { animation-delay: .3s; }
.voice-wave i:nth-child(5) { animation-delay: .4s; }
@keyframes wave { 0%, 100% { height: 5px; } 50% { height: 17px; } }

/* --------------------------------------------------------------- Diagramme */

.chart { width: 100%; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar-rect { fill: var(--accent); opacity: .85; rx: 3; }
.chart .bar-rect:hover { opacity: 1; }
.chart text { fill: var(--text-3); font-size: 10px; font-family: var(--font); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ------------------------------------------------------------------ Login */

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }
.login-side {
  background: linear-gradient(155deg, #2d2038 0%, #5b3a7a 55%, #8a6a9e 100%);
  color: #fff; padding: 54px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-side h2 { font-size: 27px; font-weight: 620; line-height: 1.3; letter-spacing: -.02em; }
.login-side p { opacity: .85; font-size: 14.5px; max-width: 400px; line-height: 1.6; }
.login-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 11px; }
.login-side li { display: flex; gap: 10px; align-items: center; font-size: 14px; opacity: .92; }
/* Flexbox statt Grid: bei "place-items: center" haengt die Spaltenbreite vom
   Inhalt ab, wodurch die 100%-Angabe der Karte ins Leere zeigt. */
.login-main { display: flex; align-items: center; justify-content: center; padding: 34px; background: var(--bg); }
.login-card { width: 390px; max-width: 100%; }
.login-card .brand { padding: 0 0 26px; }
.login-error {
  background: var(--red-soft); color: var(--red); padding: 9px 12px;
  border-radius: 9px; font-size: 13px; margin-bottom: 14px;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 7px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------- Aufgaben-Board */

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(178px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.board-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.board-col > header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.board-col > header .count {
  margin-left: auto;
  color: var(--text-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.board-col .stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px 11px;
  cursor: pointer;
  box-shadow: var(--shadow-s);
  transition: border-color .12s, transform .12s;
}

.task-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.task-card.prio-hoch { border-left-color: var(--red); }
.task-card.prio-mittel { border-left-color: var(--amber); }
.task-card.prio-niedrig { border-left-color: var(--border-strong); }
.task-card .title { font-weight: 550; line-height: 1.4; margin-bottom: 6px; }
.task-card .meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.task-card .due.late { color: var(--red); font-weight: 600; }
.task-card .due.soon { color: var(--amber); font-weight: 600; }

.task-agent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-3);
  border-radius: 20px;
  padding: 1px 8px 1px 4px;
  color: var(--text-2);
}

.progress-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.progress-track > i { display: block; height: 100%; background: var(--green); border-radius: 4px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 12px 18px;
  border-left: 2px solid var(--border);
  margin-left: 4px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -5px; top: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.timeline li.ok::before { background: var(--green); }
.timeline li.err::before { background: var(--red); }
.timeline li.warn::before { background: var(--amber); }

@media (max-width: 900px) {
  .board { grid-template-columns: repeat(5, 78vw); }
}

/* Sprachassistent auf schmalen Fenstern: der Knopf sitzt ueber dem
   Eingabefeld, damit er den Senden-Button nicht verdeckt.
   Steht am Dateiende, damit es die Grundregeln oben ueberschreibt. */
@media (max-width: 780px) {
  .voice-fab { bottom: 92px; right: 14px; width: 46px; height: 46px; }
  .voice-panel { right: 10px; left: 10px; width: auto; bottom: 148px; max-height: 55vh; }
}

/* Systemeinstellung "Bewegung reduzieren" respektieren */
@media (prefers-reduced-motion: reduce) {
  .overlay, .modal, .toast { animation: none !important; }
}
