/* Layout: sticky Prototyp-Leiste oben, darunter je Variante eigenes Raster.
   Marke: R2 Consult (Wortmarke r2 Verlauf + consult light), Plus Jakarta Sans / Inter / JetBrains Mono. */
:root {
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --surface-3: #EEF2F7;
  --ink: #0D1117;
  --ink-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --line: #E2E8F0;
  --grid: #EBEFF5;
  --axis: #CBD5E1;
  --primary: #1B77E8;
  --primary-ink: #1563C4;
  --primary-wash: rgba(27,119,232,.10);
  --primary-soft: #DCEBFC;
  --accent: #7B3FBE;
  --accent-ink: #6A32A8;
  --accent-wash: rgba(123,63,190,.10);
  --s-muted: #C5D0DE;
  --good: #16A34A; --good-ink: #15803D; --good-wash: rgba(22,163,74,.12);
  --warn: #D97706; --warn-ink: #B45309; --warn-wash: rgba(217,119,6,.13);
  --bad: #DC2626; --bad-ink: #B91C1C; --bad-wash: rgba(220,38,38,.10);
  --neu: #A7B1BF;
  --seq-0: #F1F5FB; --seq-1: #D9E8FB; --seq-2: #B4D2F6; --seq-3: #86B6EF; --seq-4: #5598E7; --seq-5: #2A78D6; --seq-6: #1C5CAB; --seq-7: #0D366B;
  --seq-ink-dark: #FFFFFF;
  --grad: linear-gradient(135deg, #1B77E8 0%, #7B3FBE 100%);
  --shadow: 0 1px 2px rgba(13,17,23,.04), 0 6px 24px rgba(13,17,23,.05);
  --shadow-lg: 0 24px 64px rgba(13,17,23,.18);
  --scrim: rgba(13,17,23,.38);
  --radius: 20px;
  --radius-sm: 12px;
  --f-head: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E13; --surface: #151A23; --surface-2: #1A2030; --surface-3: #222A3A;
    --ink: #EDEEF1; --ink-2: #C5CAD4; --muted: #9BA0AD; --faint: #6B7385;
    --line: #262E3E; --grid: #1F2634; --axis: #364055;
    --primary: #2F8FF5; --primary-ink: #6BB0F8; --primary-wash: rgba(47,143,245,.16); --primary-soft: #1A2C47;
    --accent: #9B59D4; --accent-ink: #B98BE6; --accent-wash: rgba(155,89,212,.16);
    --s-muted: #3A4559;
    --good: #3FB950; --good-ink: #56D364; --good-wash: rgba(63,185,80,.16);
    --warn: #E3A008; --warn-ink: #F0B429; --warn-wash: rgba(227,160,8,.16);
    --bad: #F25555; --bad-ink: #FF7B7B; --bad-wash: rgba(242,85,85,.15);
    --neu: #5B6577;
    --seq-0: #171D29; --seq-1: #1A2840; --seq-2: #1D3658; --seq-3: #214A7A; --seq-4: #2961A3; --seq-5: #357DCF; --seq-6: #4F9AF0; --seq-7: #8CC0FA;
    --seq-ink-dark: #0B0E13;
    --grad: linear-gradient(135deg, #2F8FF5 0%, #9B59D4 100%);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
    --shadow-lg: 0 24px 64px rgba(0,0,0,.6);
    --scrim: rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0E13; --surface: #151A23; --surface-2: #1A2030; --surface-3: #222A3A;
  --ink: #EDEEF1; --ink-2: #C5CAD4; --muted: #9BA0AD; --faint: #6B7385;
  --line: #262E3E; --grid: #1F2634; --axis: #364055;
  --primary: #2F8FF5; --primary-ink: #6BB0F8; --primary-wash: rgba(47,143,245,.16); --primary-soft: #1A2C47;
  --accent: #9B59D4; --accent-ink: #B98BE6; --accent-wash: rgba(155,89,212,.16);
  --s-muted: #3A4559;
  --good: #3FB950; --good-ink: #56D364; --good-wash: rgba(63,185,80,.16);
  --warn: #E3A008; --warn-ink: #F0B429; --warn-wash: rgba(227,160,8,.16);
  --bad: #F25555; --bad-ink: #FF7B7B; --bad-wash: rgba(242,85,85,.15);
  --neu: #5B6577;
  --seq-0: #171D29; --seq-1: #1A2840; --seq-2: #1D3658; --seq-3: #214A7A; --seq-4: #2961A3; --seq-5: #357DCF; --seq-6: #4F9AF0; --seq-7: #8CC0FA;
  --seq-ink-dark: #0B0E13;
  --grad: linear-gradient(135deg, #2F8FF5 0%, #9B59D4 100%);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.6);
  --scrim: rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--f-head); margin: 0; text-wrap: balance; letter-spacing: -0.015em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Prototyp-Leiste ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1440px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark { font-family: 'Inter', sans-serif; font-size: 21px; line-height: 1; white-space: nowrap; }
.wordmark .r2 { font-weight: 900; letter-spacing: -0.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.wordmark .consult { font-weight: 300; letter-spacing: -0.02em; color: var(--ink); }
.brand-sep { width: 1px; height: 22px; background: var(--line); align-self: center; }
.brand-title { font-family: var(--f-head); font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-title span { font-weight: 500; color: var(--muted); }
.variants { display: flex; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: 999px; overflow-x: auto; max-width: 100%; scrollbar-width: none; margin-left: auto; }
.variants::-webkit-scrollbar { display: none; }
.variants button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 500; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.variants button b { font-weight: 700; color: var(--muted); margin-right: 6px; font-size: 11px; }
.variants button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(13,17,23,.12); }
.variants button[aria-selected="true"] b { color: var(--primary); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.pill-demo { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-wash); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--axis); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

/* ---------- Allgemeine Bausteine ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 20px 16px 64px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; min-width: 0; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .hint { font-size: 12px; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; line-height: 20px; }
.chip i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; font-style: normal; }
.chip.good { background: var(--good-wash); color: var(--good-ink); }
.chip.warn { background: var(--warn-wash); color: var(--warn-ink); }
.chip.bad { background: var(--bad-wash); color: var(--bad-ink); }
.chip.info { background: var(--primary-wash); color: var(--primary-ink); }
.chip.acc { background: var(--accent-wash); color: var(--accent-ink); }
.chip svg { width: 12px; height: 12px; flex: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(13,17,23,.1); }
.select { appearance: none; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748B' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; padding: 7px 32px 7px 12px; border-radius: 10px; font-size: 13px; max-width: 100%; }
.search { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 12px 7px 34px; font-size: 13px; width: 100%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 12px center; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--primary-ink); font-weight: 500; font-size: 13px; }
.linkbtn:hover { text-decoration: underline; }

/* API-Quellen (nur R2-Ansicht) */
body:not(.r2) .src, body:not(.r2) .internal { display: none !important; }
.src { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); align-items: center; }
.src .tag { overflow-wrap: anywhere; font-family: var(--f-mono); font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); line-height: 16px; }
.src .k { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; line-height: 16px; }
.k.api { background: var(--primary-wash); color: var(--primary-ink); }
.k.calc { background: var(--accent-wash); color: var(--accent-ink); }
.k.cfg { background: var(--warn-wash); color: var(--warn-ink); }
.k.own { background: var(--surface-3); color: var(--muted); }
.badge-int { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-wash); padding: 2px 6px; border-radius: 6px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi .lab { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .val { font-family: var(--f-body); font-size: 30px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.kpi .val small { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi .sub .chip { white-space: normal; line-height: 1.35; padding-block: 3px; }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--good-ink); } .delta.down { color: var(--bad-ink); } .delta.flat { color: var(--muted); }
.kpi .spark { margin-top: 6px; height: 28px; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.ax text, .lbl { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.ax line, .gridl { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.legend i.tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--accent); border-radius: 0; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 9px 12px; font-size: 12px; min-width: 140px; max-width: 280px; opacity: 0; transform: translateY(4px); transition: opacity .08s, transform .08s; }
.tip.on { opacity: 1; transform: none; }
.tip .t-h { font-weight: 600; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.tip .t-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .t-r b { font-size: 13px; font-variant-numeric: tabular-nums; }
.tip .t-r span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .t-r i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .t-n { color: var(--muted); margin-top: 4px; font-size: 11.5px; }
.hit { fill: transparent; cursor: pointer; }
.bar-hover { transition: opacity .1s; }
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 7px 10px; margin: 0 -10px; border-radius: 10px; border: 0; background: transparent; text-align: left; width: calc(100% + 20px); }
.hbar:hover { background: var(--surface-2); }
.hbar[aria-pressed="true"] { background: var(--primary-wash); }
.hbar .hl { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hl .en { display: block; font-family: var(--f-mono); font-size: 10.5px; color: var(--muted); font-weight: 400; }
.hbar .hv { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.hbar .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hbar .track b { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.rate { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; min-width: 44px; text-align: center; }
.rate.good { background: var(--good-wash); color: var(--good-ink); } .rate.warn { background: var(--warn-wash); color: var(--warn-ink); } .rate.bad { background: var(--bad-wash); color: var(--bad-ink); }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack b { display: block; height: 100%; min-width: 2px; }
.stack-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-top: 10px; }
.stack-legend div { display: flex; flex-direction: column; gap: 0; font-size: 12px; color: var(--muted); }
.stack-legend div strong { font-size: 18px; color: var(--ink); font-weight: 650; display: flex; align-items: center; gap: 7px; }
.stack-legend div strong i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Gesprächslisten */
.convs { display: flex; flex-direction: column; }
.conv { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 4px 14px; padding: 11px 12px; margin: 0 -12px; border-radius: 12px; border: 0; background: transparent; text-align: left; width: calc(100% + 24px); align-items: start; }
.conv + .conv { box-shadow: 0 -1px 0 var(--line); }
.conv:hover { background: var(--surface-2); box-shadow: none; }
.conv:hover + .conv { box-shadow: none; }
.conv .when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.35; padding-top: 1px; }
.conv .when b { display: block; color: var(--ink-2); font-weight: 600; }
.conv .what { min-width: 0; }
.conv .what .tt { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv .what .tt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .what .ss { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.conv .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv .chips { grid-column: 2 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sev { width: 3px; border-radius: 2px; align-self: stretch; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.pos { background: var(--primary); } .dot.neu { background: var(--neu); } .dot.neg { background: var(--bad); }

/* Drawer */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 91; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .22s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer.on { transform: none; }
.dr-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.dr-head h2 { font-size: 19px; line-height: 1.3; }
.dr-head .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px 12px; flex-wrap: wrap; }
.dr-close { margin-left: auto; border: 0; background: var(--surface-3); width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: var(--ink-2); }
.dr-body { overflow-y: auto; padding: 16px 22px 40px; display: flex; flex-direction: column; gap: 18px; }
.dr-sec h4 { font-family: var(--f-body); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.fact .fl { font-size: 11.5px; color: var(--muted); }
.fact .fv { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.alert { border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.alert.bad { background: var(--bad-wash); color: var(--bad-ink); }
.alert.warn { background: var(--warn-wash); color: var(--warn-ink); }
.alert.acc { background: var(--accent-wash); color: var(--accent-ink); }
.eval-row.internal { display: grid; }
.alert svg { flex: none; margin-top: 2px; }
.crit { display: flex; flex-direction: column; gap: 4px; }
.eval { display: flex; flex-direction: column; gap: 8px; }
.eval-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; font-size: 13px; }
.eval-row .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.eval-row .ic.good { background: var(--good-wash); color: var(--good-ink); } .eval-row .ic.bad { background: var(--bad-wash); color: var(--bad-ink); } .eval-row .ic.neu { background: var(--surface-3); color: var(--muted); }
.eval-row .en { font-weight: 600; }
.eval-row .ra { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; position: relative; }
.msg .who { display: flex; gap: 8px; align-items: baseline; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.msg .who span { font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; text-transform: none; }
.msg.user { align-self: flex-start; background: var(--surface-3); border-top-left-radius: 4px; }
.msg.agent { align-self: flex-end; background: var(--primary-wash); border-top-right-radius: 4px; }
.msg.agent .who { color: var(--primary-ink); justify-content: flex-end; }
.audio { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.audio .play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; opacity: .5; cursor: not-allowed; }
.audio .wave { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.audio .wave b { flex: 1; min-width: 2px; background: var(--axis); border-radius: 1px; }
.audio .al { font-size: 11.5px; color: var(--muted); }
pre.json { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-family: var(--f-mono); font-size: 11.5px; line-height: 1.55; overflow-x: auto; margin: 0; color: var(--ink-2); max-height: 420px; }
.followup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ========== A · Cockpit ========== */
.v-cockpit .head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.v-cockpit .head h1 { font-size: 26px; font-weight: 800; }
.v-cockpit .head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .lbl2 { font-size: 12px; color: var(--muted); margin-right: -4px; }
.grid-c { display: grid; gap: 12px; grid-template-columns: repeat(12, minmax(0, 1fr)); margin-top: 12px; }
.span-12 { grid-column: span 12; } .span-3 { grid-column: span 3; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.att-list { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.att { display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; gap: 10px; padding: 9px 8px 9px 0; border: 0; background: transparent; text-align: left; border-radius: 10px; width: 100%; }
.att:hover { background: var(--surface-2); }
.att .sev { border-radius: 2px; }
.att .sev.hoch { background: var(--bad); } .att .sev.mittel { background: var(--warn); } .att .sev.info { background: var(--primary); }
.att .at { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .as { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.att .aw { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tabs-s { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 10px; overflow-x: auto; }
.tabs-s button { border: 0; background: none; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-s button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--primary); }
.tabs-s button .n { font-size: 11px; background: var(--surface-3); border-radius: 999px; padding: 0 6px; margin-left: 4px; color: var(--ink-2); }
.heat-wrap { overflow-x: auto; }
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.table-tools .search { max-width: 320px; }
.more { margin-top: 10px; display: flex; justify-content: center; }
.empty { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ========== B · Monatsbericht ========== */
.v-report { --mw: 1040px; }
.rep { max-width: var(--mw); margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.rep-top { padding: 36px 48px 28px; position: relative; }
.rep-top::after { content: ''; position: absolute; left: 48px; right: 48px; bottom: 0; height: 3px; border-radius: 3px; background: var(--grad); }
.rep-top .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.rep-top h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; }
.rep-top h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rep-top .lead { font-size: 15px; color: var(--ink-2); margin-top: 10px; max-width: 62ch; }
.months { display: flex; gap: 4px; flex-wrap: wrap; }
.months button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.months button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 28px; }
.fig { padding: 4px 20px 4px 0; }
.fig + .fig { padding-left: 20px; border-left: 1px solid var(--line); }
.fig .fv { font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; }
.fig .fv small { font-size: 20px; color: var(--muted); font-weight: 500; }
.fig .fl { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.fig .fd { font-size: 12px; margin-top: 4px; }
.rep-sec { padding: 34px 48px; border-top: 1px solid var(--line); }
.rep-sec:first-of-type { border-top: 0; }
.rep-sec > .sh { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
.rep-sec .sh .side .no { font-family: var(--f-head); font-size: 13px; font-weight: 700; color: var(--primary-ink); }
.rep-sec .sh .side h2 { font-size: 21px; font-weight: 750; margin-top: 4px; line-height: 1.2; }
.rep-sec .sh .side p { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.rep-sec .body { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.insights li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; font-size: 15px; line-height: 1.55; max-width: 70ch; }
.insights li .ix { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-wash); color: var(--primary-ink); }
.insights li.warn .ix { background: var(--warn-wash); color: var(--warn-ink); }
.insights li.bad .ix { background: var(--bad-wash); color: var(--bad-ink); }
.insights li b { font-weight: 650; }
.prose { font-size: 14.5px; color: var(--ink-2); max-width: 68ch; margin: 0; }
.prose b { color: var(--ink); }
.ttable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ttable th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ttable td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ttable tr:last-child td { border-bottom: 0; }
.ttable td.r, .ttable th.r { text-align: right; }
.ttable .barcell { width: 32%; min-width: 120px; }
.ttable .minibar { height: 8px; border-radius: 4px; background: var(--primary); }
.tscroll { overflow-x: auto; }
.cards-b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cb { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.cb .ch { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.cb p { margin: 0; font-size: 13px; color: var(--ink-2); }
.cb .links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.cb.hoch { border-left: 4px solid var(--bad); } .cb.mittel { border-left: 4px solid var(--warn); } .cb.info { border-left: 4px solid var(--primary); }
.rep-foot { padding: 20px 48px 28px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); background: var(--surface-2); }
.two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }

/* ========== C · Themen-Explorer ========== */
.v-explorer .xbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.v-explorer .xbar .search { flex: 1 1 260px; max-width: 460px; }
.v-explorer .head-x { margin: 4px 0 14px; }
.v-explorer .head-x h1 { font-size: 26px; font-weight: 800; }
.v-explorer .head-x p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.xgrid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 12px; align-items: start; }
.xgrid2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-items: start; margin-top: 12px; }
.reader { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 66px); max-height: calc(100vh - 80px); overflow-y: auto; padding: 0; }
.reader .dr-head { position: sticky; top: 0; background: var(--surface); z-index: 1; border-radius: var(--radius) var(--radius) 0 0; }
.reader .dr-head .btn { margin-left: auto; flex: none; }
.conv[aria-current="true"] { background: var(--primary-wash); box-shadow: none; }
.conv[aria-current="true"] + .conv { box-shadow: none; }
.xpane { min-height: 200px; }
.map-wrap { position: relative; }
.map-wrap svg text { font-family: var(--f-body); }
.bub { cursor: pointer; transition: opacity .15s; }
.bub circle.b { fill: var(--primary); fill-opacity: .16; stroke: var(--primary); stroke-opacity: .45; stroke-width: 1; }
.bub.on circle.b { fill-opacity: .9; stroke-opacity: 1; }
.bub.dim { opacity: .28; }
.bub text.bl { fill: var(--ink); font-size: 12px; font-weight: 600; }
.bub text.bv { fill: var(--primary-ink); font-size: 13px; font-weight: 700; }
.bub.on text.bv { fill: #fff; }
.bub text.bn { fill: var(--muted); font-size: 11px; }
.bub.on text.bn { fill: var(--ink-2); }
.bub circle.sub { fill: var(--primary); fill-opacity: .55; }
.bub.hit-s circle.b { stroke: var(--accent); stroke-width: 2; stroke-opacity: 1; }
.xdet h2 { font-size: 20px; font-weight: 750; line-height: 1.2; }
.xdet .orig { font-family: var(--f-mono); font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.xdet .desc { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.mini-kpis div { background: var(--surface-2); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.mini-kpis .mv { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.mini-kpis .ml { font-size: 11.5px; color: var(--muted); }
.subs { display: flex; flex-direction: column; gap: 2px; }
.subrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; border: 0; background: transparent; text-align: left; width: calc(100% + 20px); }
.subrow:hover { background: var(--surface-2); }
.subrow[aria-pressed="true"] { background: var(--primary-wash); }
.subrow .sl { font-weight: 600; font-size: 13px; min-width: 0; }
.subrow .sl small { display: block; font-family: var(--f-mono); font-weight: 400; font-size: 10.5px; color: var(--muted); }
.subrow .sc { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.subrow .track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.subrow .track b { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.quotes { display: flex; flex-direction: column; gap: 8px; }
.quote { font-size: 13px; color: var(--ink-2); padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-wash); border-radius: 0 10px 10px 0; }
.lang-tag { font-family: var(--f-mono); font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.crumbs button { border: 0; background: none; padding: 0; color: var(--primary-ink); font-weight: 500; }
.hl-mark { background: var(--warn-wash); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ========== Schnittstelle ========== */
.v-api { max-width: 1100px; margin: 0 auto; }
.v-api .intro h1 { font-size: 28px; font-weight: 800; }
.v-api .intro p { color: var(--ink-2); font-size: 15px; max-width: 72ch; margin: 8px 0 0; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 22px 0 8px; align-items: stretch; }
.fnode { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px; position: relative; min-width: 0; }
.fnode + .fnode { margin-left: 28px; }
.fnode + .fnode::before { content: ''; position: absolute; left: -24px; top: 50%; width: 18px; height: 2px; background: var(--axis); }
.fnode + .fnode::after { content: ''; position: absolute; left: -10px; top: calc(50% - 4px); border-left: 6px solid var(--axis); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.fnode .fk { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fnode .ft { font-family: var(--f-head); font-weight: 700; font-size: 15px; margin-top: 2px; }
.fnode p { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 0; }
.fnode code { font-family: var(--f-mono); font-size: 11px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.fnode.hi { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-wash); }
.api-sec { margin-top: 26px; }
.api-sec > h2 { font-size: 19px; font-weight: 750; margin-bottom: 4px; }
.api-sec > p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; max-width: 72ch; }
.legend-k { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 14px; font-size: 12.5px; color: var(--ink-2); }
.legend-k span { display: inline-flex; align-items: center; gap: 6px; }
.legend-k .k { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; }
.maptable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.maptable th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.maptable td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.maptable tr.grp td { background: var(--surface-2); font-family: var(--f-head); font-weight: 700; font-size: 13px; color: var(--ink); padding-top: 12px; }
.maptable code { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.maptable .k { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; white-space: nowrap; display: inline-block; }
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cfg-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfg { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--surface); min-width: 0; }
.cfg .cn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cfg .cn code { font-family: var(--f-mono); font-weight: 600; font-size: 13px; }
.cfg .ty { font-size: 11px; color: var(--muted); font-family: var(--f-mono); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.cfg p { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.cfg blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--warn-wash); border-radius: 0 10px 10px 0; font-size: 12.5px; color: var(--ink); }
.todo { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.todo li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.todo li .ti { width: 22px; height: 22px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.todo li b { color: var(--ink); }

/* ---------- Responsiv ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
}
@media (max-width: 979px) {
  .xgrid, .xgrid2 { grid-template-columns: minmax(0, 1fr); }
  .reader { display: none; }
}
@media (max-width: 860px) {
  .rep-top, .rep-sec { padding-left: 22px; padding-right: 22px; }
  .rep-top::after { left: 22px; right: 22px; }
  .rep-foot { padding-left: 22px; padding-right: 22px; }
  .rep-sec > .sh { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .fig:nth-child(3) { padding-left: 0; border-left: 0; }
  .two, .cards-b, .cfg-grid, .cfg-grid.three { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .fnode + .fnode { margin-left: 0; }
  .fnode + .fnode::before { left: 50%; top: -18px; width: 2px; height: 14px; }
  .fnode + .fnode::after { left: calc(50% - 4px); top: -8px; border-top: 6px solid var(--axis); border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 0; }
  .brand-title { display: none; }
}
@media (max-width: 620px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .val { font-size: 25px; }
  .fig .fv { font-size: 32px; }
  .conv { grid-template-columns: minmax(0, 1fr) auto; }
  .conv .when { grid-column: 1 / -1; display: flex; gap: 8px; }
  .conv .when b { display: inline; }
  .conv .chips { grid-column: 1 / -1; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttable .barcell { display: none; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px 16px 18px; border-radius: 16px; }
  .dr-head, .dr-body { padding-left: 16px; padding-right: 16px; }
  .rep { border-radius: 18px; }
  .tb-right .switch span.long { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
