:root {
      color-scheme: dark;
      --bg: #0d1117;
      --panel: #0f1318;
      --panel-2: #141a22;
      --console: #040608;
      --line: rgba(255,255,255,0.1);
      --text: #eef4fb;
      --muted: #8b9caa;
      --accent: #f7b500;
      --accent-2: #4fd1c5;
      --danger: #ff7878;
      --radius: 10px;
      --shadow: 0 20px 48px rgba(0,0,0,0.45);
      --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
      --app-vh: 100vh;
      --body-pad: 12px;
    }

    * { box-sizing: border-box; }
    @supports (height: 100dvh) {
      :root { --app-vh: 100dvh; }
    }
    html, body { margin: 0; height: 100%; overflow: hidden; font-family: "Segoe UI", system-ui, sans-serif; background: #06090d; color: var(--text); }
    body { padding: var(--body-pad); }
    .app-console { width: min(1100px, 100%); margin: 0 auto; display: flex; flex-direction: column; height: calc(var(--app-vh) - (var(--body-pad) * 2)); min-height: 0; }
    .console-topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 10px; padding: 6px 10px 6px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
    .console-diag { flex: 1 1 20rem; min-width: 0; max-width: 100%; display: flex; flex-wrap: nowrap; align-items: center; gap: 0 4px; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); line-height: 1.35; overflow: hidden; }
    .console-diag .header-mode, .console-diag .header-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
    .console-diag .pill { display: inline; background: none; border: 0; padding: 0; color: #9ae6b4; font-size: inherit; font-family: inherit; }
    .console-diag .pill.warn { color: #fbd38d; }
    .console-diag .sep { color: rgba(255,255,255,0.2); margin: 0 4px; -webkit-user-select: none; user-select: none; }
    .header-mode, .header-model { color: #cfe8f5; overflow-wrap: anywhere; }
    .console-topbar-actions { flex: 0 1 auto; min-width: 0; display: flex; align-items: flex-start; justify-content: flex-end; gap: 6px; }
    .version-badge { max-width: min(30rem, 100%); font-family: var(--mono); font-size: 0.64rem; padding: 3px 7px; border-radius: 4px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--muted); white-space: normal; overflow-wrap: anywhere; cursor: help; }
    .version-badge.fresh { color: #9ae6b4; border-color: rgba(154,230,180,0.25); }
    .version-badge.stale { color: #fbd38d; border-color: rgba(251,211,141,0.25); }
    .icon-btn { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--text); font-weight: 800; font-size: 0.9rem; cursor: pointer; }
    .icon-btn:hover { background: rgba(255,255,255,0.1); }
    .console-outer { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: #05070a; box-shadow: var(--shadow); }
    .console-surface { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--console); }
    .agent-strip {
      display: flex;
      flex-wrap: nowrap;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid rgba(255,255,255,0.06);
      padding: 4px 10px;
      background: #06090e;
      overflow: hidden;
      max-width: 100%;
    }
    .agent-strip #taskThreadTitle {
      display: none;
      flex: 1 1 auto;
      min-width: 0;
      font-size: 0.82rem;
      font-weight: 800;
      color: var(--text);
    }
    .agent-strip #agentStatusLine {
      flex: 1 1 auto;
      min-width: 0;
      min-height: 0;
      font-size: 0.78rem;
      color: var(--accent-2);
    }
    .agent-strip #agentRunsPanel {
      flex: 1 1 100%;
      min-width: 0;
      min-height: 0;
      font-size: 0.7rem;
      color: var(--muted);
    }
    .surface-switch {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px;
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 6px;
      background: rgba(255,255,255,0.035);
    }
    .surface-button {
      min-width: 58px;
      padding: 5px 8px;
      border-radius: 4px;
      color: var(--muted);
      background: transparent;
      font-size: 0.68rem;
      font-weight: 800;
    }
    .surface-button.active {
      color: #081013;
      background: var(--accent-2);
    }
    .agent-strip-actions {
      display: none;
      flex: 0 0 auto;
      align-items: center;
      gap: 6px;
    }
    .agent-strip-actions .secondary {
      font-size: 0.68rem;
      padding: 4px 8px;
    }
    .app-console.task-surface.agent-has-thread .agent-strip #taskThreadTitle,
    .app-console.cursor-surface .agent-strip #taskThreadTitle {
      display: block;
    }
    .app-console.task-surface.agent-has-thread .agent-strip #agentStatusLine,
    .app-console.task-surface.agent-has-thread .agent-strip #agentRunsPanel,
    .app-console.cursor-surface .agent-strip #agentStatusLine,
    .app-console.cursor-surface .agent-strip #agentRunsPanel {
      display: none;
    }
    .app-console.task-surface.agent-has-thread .agent-strip-actions,
    .app-console.cursor-surface .agent-strip-actions {
      display: flex;
    }
    .app-console.task-surface.agent-has-thread .task-thread-toolbar,
    .app-console.cursor-surface .task-thread-toolbar {
      display: none !important;
    }
    .app-console.task-surface:not(.agent-has-thread) .agent-strip #agentStatusLine:empty,
    .app-console.task-surface:not(.agent-has-thread) .agent-strip #agentRunsPanel:empty {
      display: none;
    }
    .one-line-ticker {
      display: block;
      overflow: hidden;
      min-width: 0;
      max-width: 100%;
      white-space: nowrap;
    }
    .one-line-ticker-inner {
      display: inline-block;
      white-space: nowrap;
      will-change: transform;
    }
    .one-line-ticker.is-ticker .one-line-ticker-inner {
      animation: one-line-ticker-scroll var(--ticker-duration, 14s) linear infinite;
      padding-right: 2.5rem;
    }
    @keyframes one-line-ticker-scroll {
      0%, 14% { transform: translateX(0); }
      86%, 100% { transform: translateX(var(--ticker-shift, -8rem)); }
    }
    @media (prefers-reduced-motion: reduce) {
      .one-line-ticker.is-ticker .one-line-ticker-inner {
        animation: none;
        text-overflow: ellipsis;
        max-width: 100%;
        overflow: hidden;
      }
    }
    .agent-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; }
    .thread-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
    .task-inbox { display: none; min-width: 0; border-right: 1px solid rgba(255,255,255,0.08); background: #080c11; overflow: hidden; }
    .app-console.task-surface .task-inbox:not(.cursor-inbox),
    .app-console.cursor-surface .cursor-inbox { display: flex; flex-direction: column; }
    .task-inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
    .task-inbox-tabs { display: flex; gap: 4px; padding: 6px 8px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
    .task-inbox-tab { flex: 1; border: 1px solid rgba(255,255,255,0.1); background: transparent; color: var(--muted); border-radius: 6px; padding: 4px 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer; }
    .task-inbox-tab.active { color: #e8f2ff; border-color: rgba(120,180,255,0.45); background: rgba(80,140,220,0.12); }
    .task-legacy-orphans { padding: 6px 10px; font-size: 0.72rem; border-bottom: 1px solid rgba(255,255,255,0.06); line-height: 1.35; }
    .task-legacy-orphans .linkish { border: none; background: none; color: #8ec5ff; cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }
    .task-inbox-title { font-size: 0.78rem; font-weight: 800; color: #dfe9f5; }
    .task-inbox-list { flex: 1; min-height: 0; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
    .task-inbox-list.compact { flex: 0 0 auto; max-height: 32%; }
    .task-inbox-section-label { padding: 8px 8px 2px; color: var(--muted); font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
    .cursor-mode-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
    .cursor-mode-button { border-radius: 4px; padding: 6px 4px; font-size: 0.68rem; color: var(--muted); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
    .cursor-mode-button.active { color: #081013; background: var(--accent-2); border-color: rgba(79,209,197,0.55); }
    .cursor-inbox-status { padding: 7px 8px; color: var(--muted); font-family: var(--mono); font-size: 0.66rem; border-bottom: 1px solid rgba(255,255,255,0.06); overflow-wrap: anywhere; }
    .task-card { width: 100%; text-align: left; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.035); color: var(--text); border-radius: 5px; padding: 7px 8px; }
    .task-card.active { border-color: rgba(79,209,197,0.45); background: rgba(79,209,197,0.08); }
    .task-card.attn { border-color: rgba(247,181,0,0.32); }
    .task-card-title { display: flex; justify-content: space-between; gap: 8px; font-size: 0.76rem; font-weight: 800; }
    .task-card-meta, .task-card-last { margin-top: 3px; font-size: 0.68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .task-card-badge { color: #ffd166; flex: 0 0 auto; }
    .task-thread-toolbar { display: none; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,0.06); background: #06090e; font-size: 0.72rem; color: var(--muted); }
    .app-console.task-surface .task-thread-toolbar { display: flex; }
    .task-thread-toolbar .thread-title { flex: 1; min-width: 0; color: var(--text); font-weight: 800; }
    .task-back-btn .mobile-back-label { display: none; }
    .task-back-btn .desktop-back-label { display: inline; }
    .overlay { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 16px; }
    .overlay.open { display: flex; }
    .overlay-backdrop { position: absolute; inset: 0; background: rgba(3,5,8,0.75); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
    .overlay-panel { position: relative; z-index: 1; width: min(500px, 100%); max-height: 86vh; overflow: auto; background: #111820; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
    .overlay-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 16px 18px 0; }
    .overlay-top h2 { margin: 0; font-size: 1.15rem; }
    .overlay-content { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
    .eyebrow { text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); font-size: 0.7rem; margin: 0 0 4px; }
    .overlay-section h3 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
    .muted, .hint, .status-line { color: var(--muted); }
    .status-line, #buildLine { font-family: var(--mono); font-size: 0.7rem; line-height: 1.35; }
    .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--text); font-size: 0.8rem; font-family: var(--mono); }
    .mode-toggle { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .mode-button { border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--muted); border-radius: 10px; }
    .mode-button.active { color: #0a0e12; background: linear-gradient(135deg, var(--accent-2), #99f6e4); }
    button, textarea, input, select { font: inherit; }
    button { border: 0; border-radius: 10px; padding: 9px 12px; cursor: pointer; font-weight: 600; }
    button.primary { color: #0a0e12; background: linear-gradient(135deg, var(--accent), #ffd166); }
    button.secondary { color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
    button.danger { color: #ffd9d9; background: rgba(255,120,120,0.12); border: 1px solid rgba(255,120,120,0.18); }
    .button-row { display: flex; gap: 8px; flex-wrap: wrap; }
    .report-button { width: auto; min-width: 70px; padding: 0 10px; font-size: 0.74rem; }
    .report-grid { display: grid; grid-template-columns: 1fr 160px; gap: 10px; }
    .report-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 0.74rem; }
    .report-grid .wide { grid-column: 1 / -1; }
    .report-consent { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
    .report-consent input { width: auto; margin-top: 2px; }
    .report-result { min-height: 1.2em; font-family: var(--mono); font-size: 0.72rem; color: var(--accent-2); overflow-wrap: anywhere; }
    .cursor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .cursor-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 0.74rem; }
    .cursor-grid .wide { grid-column: 1 / -1; }
    /* Inline-Stream im Chatverlauf: pro Agent-Turn ein kompakter Trace-Block
       zwischen der User-Anfrage und dem naechsten User-Eintrag. Der
       turn_done-Eintrag traegt die Agent-Antwort. */
    .message.stream { padding: 4px 8px; background: rgba(0,0,0,0.22); border-color: rgba(255,255,255,0.06); font-family: var(--mono); }
    .message.stream .stream-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0; color: var(--muted); margin-bottom: 3px; }
    .message.stream .stream-head .stream-title-wrap { display: inline-flex; align-items: center; min-width: 0; flex: 1; gap: 0; }
    .stream-head-tools { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
    .message.stream .stream-head .stream-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(79,209,197,0.7); animation: streamPulse 1.6s infinite; margin-right: 6px; display: inline-block; vertical-align: middle; }
    .message.stream.done .stream-head .stream-pulse { background: rgba(154,230,180,0.9); animation: none; box-shadow: none; }
    .message.stream.error .stream-head .stream-pulse { background: #ff9c9c; animation: none; }
    .message.stream .stream-actions { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
    .message.stream .stream-actions .secondary { padding: 3px 7px; border-radius: 4px; font-size: 0.64rem; text-transform: none; }
    @keyframes streamPulse { 0% { box-shadow: 0 0 0 0 rgba(79,209,197,0.6); } 70% { box-shadow: 0 0 0 10px rgba(79,209,197,0); } 100% { box-shadow: 0 0 0 0 rgba(79,209,197,0); } }
    .message.stream .stream-live { display: none; margin: 3px 0 5px; padding: 6px 7px; border: 1px solid rgba(79,209,197,0.14); border-radius: 3px; background: rgba(79,209,197,0.06); color: #e7fff9; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.82rem; line-height: 1.35; }
    .message.stream .stream-live:not(:empty) { display: block; }
    .message.stream .stream-body { display: flex; flex-direction: column; gap: 1px; font-size: 0.78rem; }
    .message.stream.stream-cursor-cli .stream-body {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      border-left: 2px solid rgba(79, 209, 197, 0.35);
      padding-left: 8px;
      margin-top: 4px;
    }
    .stream-entry.event-cursor-step.event-reasoning .text { color: #c7b9ff; font-style: italic; }
    .stream-entry.event-cursor-step.event-status .text { color: var(--muted); }
    .stream-entry { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; padding: 3px 0 5px; color: var(--text); }
    .stream-entry.stream-entry-has-copy {
      grid-template-columns: 18px minmax(0, 1fr) auto 2.35rem;
    }
    .stream-entry .stream-entry-copy {
      grid-column: 4;
      grid-row: 1;
      justify-self: end;
      align-self: start;
      min-width: 1.75rem;
      min-height: 1.55rem;
      padding: 1px 3px;
      font-size: 0.58rem;
    }
    .stream-entry.event-cursor-step.event-tool_call .kind,
    .stream-entry.event-cursor-step.event-tool_result .kind {
      white-space: normal;
      overflow-wrap: anywhere;
      line-height: 1.25;
      text-transform: none;
      font-size: 0.72rem;
      letter-spacing: 0;
      color: #e6f0ff;
    }
    .stream-entry .kind { grid-column: 2; grid-row: 1; color: var(--muted); text-transform: uppercase; letter-spacing: 0; font-size: 0.66rem; white-space: nowrap; }
    .stream-entry .time { grid-column: 3; grid-row: 1; color: var(--muted); font-size: 0.66rem; white-space: nowrap; justify-self: end; }
    .stream-entry .text { grid-column: 2 / -1; grid-row: 2; color: var(--text); overflow-wrap: anywhere; min-width: 0; padding-left: 0; }
    .stream-entry .icon { grid-column: 1; grid-row: 1 / span 2; text-align: center; }
    .rich-text { white-space: normal; overflow-wrap: anywhere; }
    .rich-text p { margin: 0 0 0.35rem; }
    .rich-text p:last-child { margin-bottom: 0; }
    .rich-text h1, .rich-text h2, .rich-text h3 { margin: 0.45rem 0 0.3rem; line-height: 1.2; font-size: 1rem; }
    .rich-text h2 { font-size: 0.95rem; }
    .rich-text h3 { font-size: 0.9rem; }
    .rich-text ul { margin: 0.2rem 0 0.45rem 1.2rem; padding: 0; }
    .rich-text li { margin: 0.12rem 0; }
    .rich-text blockquote { margin: 0.35rem 0; padding-left: 0.7rem; border-left: 2px solid rgba(255,255,255,0.16); color: #cdd9e5; }
    .rich-text code { padding: 0 0.25rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 3px; background: rgba(0,0,0,0.35); }
    .rich-text pre { margin: 0.35rem 0; padding: 0.55rem 0.65rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; background: #020509; overflow: auto; white-space: pre; max-width: 100%; }
    .rich-text pre code { padding: 0; border: 0; background: transparent; }
    .stream-entry.event-tool_call { color: #ffd166; }
    .stream-entry.event-tool_result { color: #9ae6b4; }
    .stream-entry.event-tool_result.ok-false { color: #ff9c9c; }
    .stream-entry.event-tool_result.tool-error,
    .stream-entry.event-tool_call.tool-error { color: #ff9c9c; border-left: 2px solid rgba(255, 120, 120, 0.45); padding-left: 0.35rem; }
    .stream-entry.event-stream_warning { color: #c9b458; opacity: 0.92; }
    .stream-entry.event-message { color: #cfe8ff; }
    .stream-entry.event-status { color: var(--muted); }
    .stream-entry.event-ack { color: var(--accent-2); }
    .stream-entry.event-token { color: #e7fff9; }
    .stream-entry.event-reasoning { color: #c7b9ff; }
    .stream-entry.event-model_attempt { color: #cfe8ff; }
    .stream-entry.event-model_attempt_failed { color: #ffb0b0; }
    .stream-entry.event-fallback { color: #ffd166; }
    .stream-entry.event-error { color: #ff9c9c; }
    .stream-entry.event-turn_started { color: var(--accent-2); }
    .stream-entry.event-final, .stream-entry.event-turn_done { color: #9ae6b4; font-size: 0.86rem; }
    .stream-entry.event-final .text, .stream-entry.event-turn_done .text { color: var(--text); }
    .stream-entry.event-cancelled { color: #ffd166; }
    .stream-entry.event-needs_input { color: #ffd166; }
    .messages { flex: 1; overflow: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
    .message.assistant, .message.system, .message.stream { align-self: flex-start; }
    .message.user { align-self: flex-end; }
    .message { max-width: min(820px, 94%); padding: 3px 9px 4px; border-radius: 2px; border: 1px solid rgba(255,255,255,0.08); white-space: pre-wrap; line-height: 1.35; font-size: 0.86rem; background: rgba(255,255,255,0.03); font-family: var(--mono); }
    .message.user { margin-left: auto; margin-right: 0; max-width: min(720px, 92%); font-size: 0.78rem; line-height: 1.3; padding: 3px 8px 4px; border-radius: 2px; background: #0d1218; border: 1px solid rgba(247,181,0,0.2); color: #e6edf5; }
    .message.user .message-head { text-transform: none; letter-spacing: 0.02em; font-size: 0.6rem; opacity: 0.9; }
    .message.assistant { margin-right: auto; background: #0a100e; border-color: rgba(79,209,197,0.18); }
    .message.system { align-self: center; max-width: 96%; color: #d4e8f5; padding: 2px 8px; font-size: 0.82rem; }
    .message-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0; line-height: 1.2; }
    .message-head-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
    .message-head .message-time { opacity: 0.95; }
    .message-copy-btn {
      box-sizing: border-box;
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 2.75rem;
      min-height: 1.75rem;
      padding: 4px 7px;
      margin: 0;
      border: 0;
      border-radius: 4px;
      background: transparent;
      color: var(--muted);
      font-size: 0.64rem;
      line-height: 1.15;
      font-family: var(--mono);
      text-transform: none;
      letter-spacing: 0;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .message-copy-btn svg {
      display: block;
      width: 0.92rem;
      height: 0.92rem;
      flex-shrink: 0;
    }
    .message-copy-btn:hover,
    .message-copy-btn:focus-visible {
      background: rgba(255,255,255,0.07);
      color: var(--text);
      outline: none;
    }
    .message-body { margin-top: 1px; }
    .trace-details { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); }
    .trace-details details { border: 1px solid rgba(255,255,255,0.08); border-radius: 3px; background: rgba(0,0,0,0.18); }
    .trace-details summary { cursor: pointer; padding: 4px 6px; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0; }
    .trace-details pre { margin: 0; padding: 6px; max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: rgba(0,0,0,0.28); color: #cdd9e5; font-size: 0.7rem; line-height: 1.35; }
    .trace-loading { margin-top: 4px; color: var(--muted); font-size: 0.68rem; font-family: var(--mono); }
    .message p { margin: 0; }
    .message + .message { margin-top: 0; }
    .attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
    .att-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 2px; border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.2); color: #a8bdd3; font-size: 0.7rem; line-height: 1.35; font-family: var(--mono); }
    .att-media { display: flex; flex-direction: column; gap: 4px; max-width: min(520px, 100%); padding: 6px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.2); }
    .att-media audio { width: 100%; min-width: 260px; max-width: 100%; }
    .composer { border-top: 1px solid rgba(255,255,255,0.1); padding: 10px 10px 12px; background: #06080c; }
    .composer-actions-sr { display: none !important; }
    .composer > label[for="promptInput"] { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); display: block; margin-bottom: 4px; }
    textarea, input, select { width: 100%; border-radius: 4px; border: 1px solid var(--line); background: #080c11; color: var(--text); padding: 10px 10px; outline: none; font-family: var(--mono); }
    textarea { resize: vertical; min-height: 100px; font-size: 0.8rem; }
    .composer-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
    .composer-btns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; justify-content: flex-start; }
    .composer-btns .primary { flex: 1; min-height: 2.5rem; }
    .composer-attach { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 6px; max-height: 5.5rem; overflow-y: auto; padding-right: 2px; }
    .att-preview { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 3px; background: rgba(0,0,0,0.45); min-width: 0; }
    .att-preview img { max-width: 104px; max-height: 3.2rem; object-fit: cover; display: block; border-radius: 2px; }
    .att-preview .att-meta { font-size: 0.58rem; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
    .att-preview .att-remove { position: absolute; top: -2px; right: -2px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 0.7rem; line-height: 1; background: rgba(60,0,0,0.9); color: #fff; border: 1px solid rgba(255,255,255,0.2); cursor: pointer; }
    .add-attach { width: 54px; height: 34px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; background: rgba(255,255,255,0.04); border: 1px dashed var(--line); color: var(--accent-2); font-size: 0.72rem; font-weight: 700; cursor: pointer; flex-shrink: 0; }
    .add-attach:hover { background: rgba(255,255,255,0.08); }
    .add-attach.recording { color: #fff; background: rgba(255,120,120,0.35); border-color: rgba(255,120,120,0.7); }
    .intent-chip { width: 54px; min-height: 34px; padding: 0 5px; border-radius: 4px; color: #e7fff9; border-color: rgba(79,209,197,0.25); font-size: 0.68rem; overflow-wrap: anywhere; line-height: 1.05; }
    .intent-chip.intent-cursor.intent-cursor-ask { color: #b8e8ff; border-color: rgba(120,190,255,0.45); background: rgba(40,90,160,0.2); }
    .intent-chip.intent-cursor.intent-cursor-plan { color: #ffe8b0; border-color: rgba(255,200,80,0.45); background: rgba(120,90,20,0.2); }
    .intent-chip.intent-cursor.intent-cursor-run { color: #c8ffd8; border-color: rgba(100,220,140,0.45); background: rgba(30,100,60,0.2); }
    .att-preview audio { width: 160px; max-width: 45vw; height: 32px; }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
    .composer-actions { margin-top: 8px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
    .empty-state { margin: auto; max-width: 560px; text-align: center; color: var(--muted); padding: 28px 22px; border: 1px dashed var(--line); border-radius: 22px; background: rgba(255,255,255,0.02); }
    .login-shell { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(4,8,12,0.74); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); z-index: 20; }
    .login-shell.visible { display: flex; }
    .login-card { width: min(460px, 100%); padding: 22px; border-radius: 24px; background: rgba(15,23,32,0.96); border: 1px solid var(--line); box-shadow: var(--shadow); }
    .login-card h2 { margin: 0 0 8px; font-size: 1.6rem; }
    .login-error { min-height: 1.25rem; color: #ffb0b0; margin-top: 10px; font-size: 0.92rem; }
    .ticket-fab-rail {
      position: fixed;
      left: 0;
      top: 50%;
      z-index: 35;
      transform: translateY(-50%);
      padding-left: max(0px, env(safe-area-inset-left, 0px));
      pointer-events: none;
    }
    .ticket-fab-rail .ticket-fab {
      pointer-events: auto;
    }
    .ticket-fab {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
      width: 30px;
      min-width: 30px;
      height: 92px;
      padding: 8px 4px;
      border-radius: 0 12px 12px 0;
      background: linear-gradient(180deg, #5b6ee8, #8b6fd6);
      color: #f4f0ff;
      border: 1px solid rgba(180, 160, 255, 0.45);
      border-left: 0;
      box-shadow: 4px 0 22px rgba(40, 24, 80, 0.45);
      font-weight: 800;
      cursor: pointer;
      -webkit-user-select: none;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
      overflow: hidden;
      transition: width 0.22s ease, min-width 0.22s ease, height 0.22s ease, padding 0.22s ease, border-radius 0.22s ease, box-shadow 0.22s ease;
    }
    .ticket-fab-collapsed {
      writing-mode: vertical-rl;
      text-orientation: mixed;
      font-size: 0.68rem;
      letter-spacing: 0.12em;
      line-height: 1;
    }
    .ticket-fab-expanded {
      display: none;
      white-space: nowrap;
      font-size: 0.82rem;
      letter-spacing: 0.02em;
    }
    .ticket-fab-rail.is-open .ticket-fab {
      width: auto;
      min-width: 92px;
      height: 40px;
      padding: 0 14px;
      border-radius: 0 999px 999px 0;
      border-left: 1px solid rgba(180, 160, 255, 0.45);
      box-shadow: 8px 0 24px rgba(40, 24, 80, 0.5);
    }
    .ticket-fab-rail.is-open .ticket-fab-collapsed { display: none; }
    .ticket-fab-rail.is-open .ticket-fab-expanded { display: inline; }
    .ticket-fab:hover { filter: brightness(1.08); }
    .ticket-fab:active { filter: brightness(0.96); }
    .ticket-fab:focus-visible { outline: 2px solid rgba(167, 139, 250, 0.9); outline-offset: 2px; }
    /* Agent-Modus: Master-Detail (Posteingang ODER Thread) unter Bootstrap lg */
    @media (max-width: 991.98px) {
      .app-console.task-surface .agent-workspace,
      .app-console.cursor-surface .agent-workspace { grid-template-columns: 1fr; }
      .app-console.agent-nav-inbox .agent-strip { display: none; }
      .app-console.agent-nav-inbox .thread-main { display: none !important; }
      .app-console.agent-nav-inbox .composer { display: none !important; }
      .app-console.agent-nav-inbox.task-surface .task-inbox:not(.cursor-inbox),
      .app-console.agent-nav-inbox.cursor-surface .cursor-inbox {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        max-height: none;
        border-right: 0;
        border-bottom: 0;
      }
      .app-console.agent-nav-thread .task-inbox { display: none !important; }
      .app-console.agent-nav-thread .agent-strip { padding: 4px 10px; }
      .app-console.agent-nav-thread .task-back-btn .mobile-back-label { display: inline; }
      .app-console.agent-nav-thread .task-back-btn .desktop-back-label { display: none; }
      .app-console.agent-nav-thread .task-back-btn { flex: 0 0 auto; white-space: nowrap; }
      .app-console.agent-nav-thread #refreshTasksButton { display: none; }
    }

    @media (max-width: 640px) {
      :root { --body-pad: 6px; }
      .console-topbar { align-items: stretch; }
      .console-diag { flex-basis: 100%; font-size: 0.6rem; }
      .console-topbar-actions { width: 100%; align-items: center; }
      .version-badge { flex: 1 1 auto; }
      .report-grid { grid-template-columns: 1fr; }
      .cursor-grid { grid-template-columns: 1fr; }
      .cursor-grid .wide { grid-column: auto; }
      .composer { padding: 8px 8px 10px; }
      .composer-grid { grid-template-columns: minmax(0, 1fr) 54px; gap: 6px; align-items: start; }
      textarea, input, select { font-size: 16px; }
      textarea { min-height: 86px; max-height: min(34vh, 190px); resize: none; line-height: 1.35; }
      .composer-btns { gap: 5px; }
      .add-attach { width: 50px; font-size: 0.68rem; }
      .composer-btns .primary { order: -1; min-height: 44px; padding-inline: 4px; font-size: 0.72rem; }
      .message { max-width: 100%; }
      .ticket-fab-rail.is-open .ticket-fab { min-width: 84px; }
    }

    /* Markdown + Mermaid (stream_render_markdown.js) */
    .markdown-body { font-family: "Segoe UI", system-ui, sans-serif; font-size: 0.88rem; line-height: 1.45; }
    .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 0.5rem 0 0.35rem; line-height: 1.25; font-weight: 700; }
    .markdown-body h1 { font-size: 1.15rem; }
    .markdown-body h2 { font-size: 1.05rem; }
    .markdown-body h3 { font-size: 0.98rem; }
    .markdown-body p { margin: 0.35rem 0; }
    .markdown-body ul, .markdown-body ol { margin: 0.35rem 0 0.45rem 1.25rem; padding: 0; }
    .markdown-body li { margin: 0.15rem 0; }
    .markdown-body li > ul, .markdown-body li > ol { margin-top: 0.2rem; }
    .markdown-body blockquote { margin: 0.4rem 0; padding: 0.2rem 0 0.2rem 0.75rem; border-left: 3px solid rgba(120,180,255,0.35); color: #cdd9e5; }
    .markdown-body hr { border: 0; border-top: 1px solid rgba(255,255,255,0.12); margin: 0.65rem 0; }
    .markdown-body table { border-collapse: collapse; width: 100%; max-width: 100%; margin: 0.45rem 0; font-size: 0.82rem; }
    .markdown-body th, .markdown-body td { border: 1px solid rgba(255,255,255,0.12); padding: 0.35rem 0.45rem; text-align: left; vertical-align: top; }
    .markdown-body th { background: rgba(0,0,0,0.35); color: #dbe8f5; }
    .markdown-body a { color: #8ec5ff; text-decoration: underline; text-underline-offset: 2px; }
    .markdown-body a:hover { color: #b8dfff; }
    .markdown-body .task-list-item { list-style: none; margin-left: -1rem; }
    .markdown-body .task-list-item input { margin-right: 0.35rem; vertical-align: middle; }
    .markdown-body pre { margin: 0.45rem 0; }
    .markdown-body code.hljs { font-size: 0.78rem; }
    .stream-tool-log .tool-log { margin: 0; max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.76rem; line-height: 1.35; }
    .modelhub-mermaid-wrap { margin: 0.5rem 0; padding: 6px; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; background: rgba(0,0,0,0.25); }
    .modelhub-mermaid-diagram { overflow-x: auto; }
    .modelhub-mermaid-error { margin-top: 6px; padding: 6px; border-radius: 4px; background: rgba(120,20,20,0.35); color: #ffc9c9; font-size: 0.78rem; white-space: pre-wrap; }
    .modelhub-mermaid-fallback { margin-top: 6px; font-size: 0.72rem; color: var(--muted); }
    .modelhub-mermaid-source { margin: 0.35rem 0 0; padding: 6px; background: rgba(0,0,0,0.4); border-radius: 4px; max-height: 12rem; overflow: auto; white-space: pre; font-size: 0.72rem; }

    /* Mobile / schmale Viewports: kein horizontaler Seiten-Overflow */
    .thread-main, .messages, .message-body, .markdown-body, .stream-body, .stream-entry .text {
      min-width: 0;
    }
    .messages { overflow-x: hidden; }
    .message-body, .markdown-body, .rich-text { overflow-wrap: anywhere; word-break: break-word; }
    .markdown-body pre, .markdown-body table { max-width: 100%; }
    .markdown-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .composer-grid { min-width: 0; }
    .composer-grid textarea { min-width: 0; max-width: 100%; }
