/* NovaOps — Designsystem + responsive Shell (siehe DESIGN.md).
   Ops-Konsole: ruhig, präzise, Werkzeug. Ein Akzent, Mono für IDs, 4px-Raster,
   Satzschreibung, keine Verläufe/Glows, kein farbiger Card-Rand, keine Emoji-Nav. */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c232c;
  --surface-3: #222b36;
  --border: #2a323d;
  --border-strong: #3a4452;
  --fg: #e8edf2;
  --fg-dim: #9aa7b4;
  --fg-faint: #6b7785;
  --accent: #3d9aa1;
  --accent-fg: #0d1117;
  --accent-soft: #14323399;
  --ok: #4fae7a;
  --warn: #d6a850;
  --err: #d96a6a;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px; --s6:24px; --s8:32px;
  --sidebar: 248px;
  --mono: ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;
  --sans: system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html, body { overflow: hidden; overscroll-behavior: none; }   /* kein Body-Scroll, kein Rubber-Band */
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  touch-action: manipulation;                 /* kein Doppeltipp-Zoom */
  -webkit-tap-highlight-color: transparent;
}
/* Scrollbars ausblenden (App-Feeling), Scrollen bleibt möglich */
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.5rem; letter-spacing: -.02em; margin: 0; font-weight: 650; }
h2 { font-size: 1.1rem; letter-spacing: -.01em; margin: 0; font-weight: 600; }
h3 { font-size: .8rem; margin: 0; color: var(--fg-dim); font-weight: 600; }
.muted { color: var(--fg-dim); font-size: .9rem; }
.mono, code, .id { font-family: var(--mono); font-size: .82rem; color: var(--fg-dim); word-break: break-all; }
.hidden { display: none !important; }

/* ---------- Inputs / Buttons ---------- */
input, select, textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--fg);
  border-radius: var(--r-sm); padding: 11px 13px; font: inherit; width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
button {
  background: var(--accent); color: var(--accent-fg); border: 0; border-radius: var(--r-sm);
  padding: 10px 15px; font: inherit; font-weight: 600; cursor: pointer;
}
button.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--fg); font-weight: 500; }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.sm { padding: 6px 10px; font-size: .85rem; }
button:active { transform: translateY(1px); }
label { display: flex; flex-direction: column; gap: var(--s1); font-size: .85rem; color: var(--fg-dim); }
label.row-check { flex-direction: row; align-items: center; gap: var(--s2); }
label.row-check input { width: auto; }
.row { display: flex; gap: var(--s2); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.msg { min-height: 1.1em; font-size: .88rem; color: var(--fg-dim); margin: var(--s1) 0 0; }
.msg.err { color: var(--err); } .msg.ok { color: var(--ok); }

/* ---------- Auth (zentriert) ---------- */
.auth { height: var(--vvh, 100dvh); position: fixed; inset: 0; display: grid; place-items: center; padding: var(--s4); overflow-y: auto; }
.card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--s6); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: var(--s3);
}
#totp-qr { width: 196px; height: 196px; align-self: center; background: #fff; border-radius: var(--r-sm); padding: var(--s2); }

/* ---------- App-Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: var(--vvh, 100dvh);
  position: fixed; top: 0; left: 0; right: 0; }   /* ans sichtbare Viewport gepinnt (iOS-Tastatur) */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: var(--s4); gap: var(--s2);
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 1.15rem; padding: var(--s2) var(--s2) var(--s4); }
.brand .dot { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.navbtn {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  background: transparent; color: var(--fg-dim); border: 0; border-radius: var(--r-sm);
  padding: 10px 12px; font-weight: 500; font-size: .95rem; cursor: pointer; text-align: left;
}
.navbtn svg { width: 18px; height: 18px; flex: none; stroke: currentColor; }
.navbtn:hover { background: var(--surface-2); color: var(--fg); }
.navbtn.active { background: var(--accent-soft); color: var(--fg); }
.navbtn.active svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3);
  display: grid; place-items: center; font-size: .8rem; font-weight: 600; color: var(--fg-dim);
  overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content { padding: var(--s6); width: 100%; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 1100px) {
  .dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4); align-items: start; }
  .dash-grid .panel { margin-top: 0; }
}
.view-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: var(--s5); gap: var(--s3); }
.view-head .muted { margin-top: 2px; }

.topbar, .bottomnav { display: none; }

/* ---------- Panels / Cards ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s5); }
.panel + .panel { margin-top: var(--s4); }
.panel-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack > .panel + .panel { margin-top: 0; }  /* Stack regelt Abstand über gap */

.statgrid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: var(--s3); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); }
.stat .num { font-size: 1.9rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat .lbl { color: var(--fg-dim); font-size: .85rem; margin-top: 2px; }
.stat .num.accent { color: var(--accent); }
.stat .num.warn { color: var(--warn); } .stat .num.err { color: var(--err); }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s2); }
.list li {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: var(--s3) var(--s4); display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
}
.list li .sub { color: var(--fg-faint); font-size: .82rem; }
.empty { color: var(--fg-faint); font-size: .88rem; padding: var(--s2) 0; }

.pill { font-family: var(--mono); font-size: .68rem; color: var(--fg-dim); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.pill.todo{color:var(--fg-dim)} .pill.doing{color:var(--accent);border-color:var(--accent)}
.pill.review{color:var(--warn);border-color:var(--warn)} .pill.done{color:var(--ok);border-color:var(--ok)}
.pill.running{color:var(--accent)} .pill.failed{color:var(--err)} .pill.paused_at_gate{color:var(--warn)}
.tilelink { cursor: pointer; } .tilelink:hover { border-color: var(--border-strong); }

/* ---------- Board (Kanban) ---------- */
.board { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--s3); }
.col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s3); min-height: 120px; }
.col h3 { margin-bottom: var(--s2); display: flex; justify-content: space-between; }
.kcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); margin-bottom: var(--s2); }
.kcard .t { font-size: .9rem; }
.kcard .meta { display: flex; justify-content: space-between; align-items: center; margin-top: var(--s2); }

/* ---------- Chat ---------- */
.chatwrap { display: flex; flex-direction: column; height: 100%; }
.chat-log { min-height: 0; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s2); padding-right: var(--s1); }
.bubble { padding: var(--s2) var(--s3); border-radius: var(--r-md); max-width: 80%; font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.bubble.nova { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.sys { align-self: center; background: transparent; color: var(--fg-dim); font-size: .82rem; border: 1px dashed var(--border); }
.chat-input { display: flex; gap: var(--s2); margin-top: var(--s3); align-items: flex-end; }
.chat-input textarea { min-height: 42px; height: 42px; line-height: 1.4; resize: none; }
.chat-input button { height: 42px; flex: none; }
.cmdpop { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow); margin-top: var(--s2); max-height: 280px; overflow-y: auto; }
.cmdpop .ch { padding: 8px var(--s3); font-size: .72rem; color: var(--fg-faint); border-bottom: 1px solid var(--border); }
.cmd-item { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); cursor: pointer; }
.cmd-item.sel, .cmd-item:hover { background: var(--accent-soft); }
.cmd-item .c { font-family: var(--mono); font-size: .82rem; color: var(--accent); min-width: 116px; }
.cmd-item .d { color: var(--fg-dim); font-size: .85rem; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: var(--s4); z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s6); width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: var(--s3); max-height: 90vh; overflow:auto; }
.conn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); }
.conn-row textarea, .conn-row .full { grid-column: 1 / -1; }

/* Feld mit Info-Button + Hilfetext */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field .flabel { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--fg-dim); }
.info-btn { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent;
  color: var(--fg-dim); font-size: .7rem; line-height: 1; padding: 0; cursor: pointer; display: inline-grid; place-items: center; }
.info-btn:hover { border-color: var(--accent); color: var(--accent); }
.help { font-size: .78rem; color: var(--fg-faint); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 10px; margin-top: 2px; }
.help.hidden { display: none; }
.modal h3 { margin-top: var(--s2); }
.ops-frame { width: 100%; height: 68vh; border: 1px solid var(--border); border-radius: var(--r-sm); background: #000; }

.seg { display: flex; gap: var(--s1); flex-wrap: wrap; }
.seg button { background: var(--surface-2); color: var(--fg-dim); border: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--fg); border-color: var(--accent); }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 40; width: 80%; max-width: 300px; box-shadow: var(--shadow); }
  .sidebar.open { display: flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .topbar { display: none; }   /* kein Top-Menü auf Mobile — nur Bottom-Nav */
  .content { padding: var(--s4); padding-top: calc(env(safe-area-inset-top) + var(--s4)); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .board { grid-template-columns: 1fr; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 4px 4px max(2px, calc(env(safe-area-inset-bottom) - 8px));
  }
  .bottomnav button {
    flex: 1; background: transparent; color: var(--fg-faint); border: 0;
    display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: .6rem; font-weight: 500;
  }
  .bottomnav button svg { width: 20px; height: 20px; stroke: currentColor; }
  .chat-input { margin-bottom: var(--s2); }   /* Eingabe einen Tick höher über der Nav */
  html.kb .content { padding-bottom: var(--s3); }   /* Tastatur offen: Input direkt über Tastatur */
  html.kb .bottomnav { display: none; }              /* Nav bleibt hinter der Tastatur (unsichtbar) */
  .bottomnav button.active { color: var(--accent); }
  .statgrid { grid-template-columns: 1fr 1fr; }
}

/* ===================== P9: Theme, Komponenten ===================== */
[data-theme="light"] {
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #f0f3f7; --surface-3: #e6ebf1;
  --border: #d9e0e8; --border-strong: #c2ccd6; --fg: #182230; --fg-dim: #5a6675; --fg-faint: #8a96a4;
  --accent: #2c7a80; --accent-fg: #ffffff; --accent-soft: #d8ecee; --shadow: 0 8px 28px rgba(20,40,60,.12);
}
[data-density="compact"] { --s3: 8px; --s4: 12px; --s5: 14px; --s6: 16px; }
[data-density="compact"] .panel { padding: var(--s4); }
[data-density="compact"] .list li { padding: 8px 12px; }

/* Toasts */
#toasts { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 80; display: flex; flex-direction: column; gap: var(--s2); max-width: 360px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: var(--s3) var(--s4); box-shadow: var(--shadow); animation: toastin .18s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: var(--warn); }
.toast .tt { font-weight: 600; font-size: .9rem; } .toast .tb { color: var(--fg-dim); font-size: .85rem; margin-top: 2px; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 900px) { #toasts { left: var(--s4); right: var(--s4); top: calc(env(safe-area-inset-top) + 8px); bottom: auto; max-width: none; } }

/* Bottom-Sheet (mobiles „Mehr"-Menü) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-top: 1px solid var(--border-strong);
  border-radius: 16px 16px 0 0; padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow); animation: sheetup .2s ease; }
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet .handle { width: 38px; height: 4px; background: var(--border-strong); border-radius: 999px; margin: 4px auto var(--s3); }
.sheet .sheet-item { display: flex; align-items: center; gap: var(--s3); width: 100%; background: transparent;
  color: var(--fg); border: 0; border-radius: var(--r-sm); padding: 14px 12px; font-size: 1rem; font-weight: 500; text-align: left; }
.sheet .sheet-item svg { width: 20px; height: 20px; stroke: currentColor; flex: none; }
.sheet .sheet-item.active { background: var(--accent-soft); color: var(--fg); }
.sheet .sheet-item.active svg { color: var(--accent); }
.sheet .sheet-item.danger { color: var(--err); }

/* Command palette */
.cmdk-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.cmdk { width: 100%; max-width: 540px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.cmdk input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: var(--s4); font-size: 1rem; }
.cmdk-list { max-height: 320px; overflow-y: auto; }
.cmdk-item { padding: 10px var(--s4); display: flex; gap: var(--s3); align-items: center; cursor: pointer; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--accent-soft); }
.cmdk-item .k { margin-left: auto; } kbd { font-family: var(--mono); font-size: .72rem; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--fg-dim); }

/* Switch */
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px; transition: .15s; }
.switch .track::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--fg-dim); border-radius: 50%; transition: .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); background: #fff; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--border); }
.setrow:last-child { border-bottom: 0; }
.setrow .lbl-main { font-size: .92rem; } .setrow .lbl-sub { color: var(--fg-faint); font-size: .8rem; }

/* Limit-Balken */
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar > span.warn { background: var(--warn); } .bar > span.err { background: var(--err); }

/* Tabs (innerhalb Einstellungen) */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s4); flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--fg-dim); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; font-weight: 500; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--accent); }

/* Chat-Ausbau */
.chat-head { display: flex; align-items: center; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--border); margin-bottom: var(--s3); }
.dotpulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); }
.quick { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center;
  padding-bottom: var(--s3); margin-bottom: var(--s3); border-bottom: 1px solid var(--border); }
.quick .qlbl { font-size: .72rem; color: var(--fg-faint); margin-right: 2px; }
.quick button { background: var(--surface-2); color: var(--fg-dim); border: 1px solid var(--border); border-radius: 999px; font-weight: 500; font-size: .82rem; padding: 5px 12px; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.bubble { position: relative; padding-bottom: 18px; }
.bubble .ts { position: absolute; right: 10px; bottom: 5px; font-size: .64rem; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; color: inherit; opacity: .5; }
.bubble.me .ts { opacity: .6; }
.bubble code { background: rgba(0,0,0,.25); padding: 1px 5px; border-radius: 4px; }
.typing { align-self: flex-start; display: flex; align-items: center; gap: 8px; color: var(--fg-faint); font-size: .82rem; }
.td { display: inline-flex; gap: 4px; }
.td i { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); display: inline-block; animation: tdb 1.1s infinite ease-in-out; }
.td i:nth-child(2) { animation-delay: .15s; } .td i:nth-child(3) { animation-delay: .3s; }
@keyframes tdb { 0%, 70%, 100% { transform: translateY(0); opacity: .4; } 35% { transform: translateY(-5px); opacity: 1; } }

/* Skeleton */
.skel { background: linear-gradient(90deg,var(--surface-2),var(--surface-3),var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Crop */
.crop-stage { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: var(--r-sm); overflow: hidden; touch-action: none; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
.toolbar { display: flex; gap: var(--s2); align-items: center; }
.toolbar input[type=range] { flex: 1; }
.danger { color: var(--err); border-color: var(--err) !important; }
.searchbar { display: flex; gap: var(--s2); margin-bottom: var(--s4); }
input[type=file] { padding: 0; border: 0; color: var(--fg-dim); font-size: .85rem; }
input[type=file]::file-selector-button { background: var(--surface-2); color: var(--fg); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 12px; font: inherit; font-weight: 500; cursor: pointer; margin-right: var(--s2); }
input[type=file]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }
input[type=range] { accent-color: var(--accent); }

/* Abstand zwischen Feldern und Aktions-Buttons in den Einstellungs-Panels */
#settings-body .panel label + .row,
#settings-body .panel label + button,
#settings-body .panel input + button,
#settings-body .panel input + .row,
#settings-body .panel textarea + button { margin-top: var(--s3); }
#settings-body .panel label + label { margin-top: var(--s3); }

/* ===================== Dashboard / Projekt-Detail Politur ===================== */
.greet { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.greet .avatar { width: 44px; height: 44px; font-size: 1rem; }
.greet h1 { font-size: 1.5rem; }
.greet .muted { margin-top: 2px; }

.qa { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s5); }

.stat { position: relative; overflow: hidden; }
.stat .ico { position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; opacity: .3; stroke: currentColor; fill: none; }
.stat.accent .ico { color: var(--accent); opacity: .5; } .stat.warn .ico { color: var(--warn); opacity: .55; } .stat.err .ico { color: var(--err); opacity: .55; }
.stat .num { display: flex; align-items: baseline; gap: 6px; }
.stat .trend { font-size: .72rem; color: var(--fg-faint); }

.gate-item { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.gate-item .gi-text { min-width: 0; }
.gate-item .gi-text .t { font-weight: 600; font-size: .92rem; }
.gate-item .gi-text .s { color: var(--fg-dim); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-item .row { flex: none; }

.li-ico { display: inline-flex; width: 16px; height: 16px; margin-right: 8px; stroke: currentColor; fill: none; vertical-align: -3px; opacity: .6; }
.li-ico.ok { color: var(--ok); opacity: .9; } .li-ico.err { color: var(--err); opacity: .9; } .li-ico.q { color: var(--accent); }

/* Projekt-Header */
.phead { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s5); margin-bottom: var(--s4); }
.phead .top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); }
.phead h1 { font-size: 1.45rem; }
.pmeta { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 10px; color: var(--fg-dim); }
.badge.accent { color: var(--accent); border-color: var(--accent); }
.badge.on { color: var(--ok); border-color: var(--ok); } .badge.off { color: var(--fg-faint); }
.pstat { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: var(--s2); margin-top: var(--s4); }
.pstat .b { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; text-align: center; }
.pstat .b .n { font-size: 1.3rem; font-weight: 650; } .pstat .b .l { font-size: .72rem; color: var(--fg-dim); }

.kcard .who { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); display: inline-grid; place-items: center; font-size: .6rem; color: var(--fg-dim); }
@media (min-width: 1100px) { .pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); align-items: start; } .pgrid .panel { margin-top: 0; } }

/* Aktive Agenten (Chat-Leiste + Projekt) */
.agents { display: flex; gap: var(--s2); flex-wrap: wrap; }
.agent-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .78rem; cursor: pointer; }
.agent-chip .dotpulse { width: 7px; height: 7px; animation: pulse 1.6s infinite; }
.agent-chip.gate .dotpulse { background: var(--warn); }
.agent-chip.queued .dotpulse { background: var(--fg-faint); animation: none; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .35; } 100% { opacity: 1; } }
.chat-head { flex-wrap: wrap; }
.chat-agentbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--border); margin-bottom: var(--s2); min-height: 0; flex-wrap: wrap; }
.chat-agentbar .lbl { font-size: .72rem; color: var(--fg-faint); }

/* Log-Viewer / Plan */
.logbox { background: #0a0e14; border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); max-height: 60vh; overflow: auto; font-family: var(--mono); font-size: .78rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.logline { display: flex; gap: var(--s2); }
.logline .lt { color: var(--fg-faint); flex: none; }
.logline .tool { color: var(--accent); } .logline .err { color: var(--err); } .logline .gate { color: var(--warn); }
.plan { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); white-space: pre-wrap; font-size: .85rem; max-height: 360px; overflow: auto; }
