      :root {
        --navy: #f6f8ff;
        --blue: #2457d4;
        --blue-soft: rgba(36, 87, 212, 0.16);
        --aqua: #4a7aff;
        --blue-ui-bg: linear-gradient(180deg, var(--aqua) 0%, var(--blue) 100%);
        --blue-ui-bg-hover: linear-gradient(180deg, #5c8cff 0%, var(--blue) 100%);
        --blue-ui-border: rgba(74, 122, 255, 0.34);
        --blue-ui-shadow: 0 12px 28px rgba(36, 87, 212, 0.28);
        --category-filter-active-bg: var(--blue-ui-bg);
        --category-filter-active-border: var(--blue-ui-border);
        --accent-soft-bg: color-mix(in srgb, var(--blue) 10%, transparent);
        --accent-soft-bg-strong: color-mix(in srgb, var(--blue) 18%, transparent);
        --accent-focus-ring: color-mix(in srgb, var(--aqua) 70%, transparent);
        --brand-dot-active: var(--blue);
        --brand-dot-active-soft: rgba(36, 87, 212, 0.18);
        --brand-dot-disabled: #64748b;
        --smart-idea-bg: rgba(74, 122, 255, 0.14);
        --smart-idea-border: rgba(74, 122, 255, 0.36);
        --smart-idea-fill: var(--aqua);
        --smart-idea-stroke: #9eb9ff;
        --smart-idea-base: #c6d3ff;
        --mind-logo-gray-filter: grayscale(1) saturate(0) brightness(1.85);
        --mind-logo-gray-opacity: 0.68;
        --yellow: #f2c94c;
        --red: #ff6b61;
        --bg: #05070b;
        --surface: #0d1118;
        --surface-2: #111722;
        --surface-3: #172033;
        --border: rgba(255, 255, 255, 0.08);
        --border-md: rgba(255, 255, 255, 0.13);
        --muted: #9aa6bd;
        --text: #f7f9ff;
        --text-soft: #d8deee;
        --shadow-soft: 0 18px 48px rgba(5, 10, 20, 0.26);
        --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 34px rgba(5, 10, 20, 0.18);
        --radius-sm: 8px;
        --radius-md: 12px;
        --radius-lg: 14px;
        --sidebar-w: 268px;
        --font-body: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
        --font-head: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
        --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
        --scrollbar-size: 8px;
        --scrollbar-thumb: rgba(255, 255, 255, 0.22);
        --scrollbar-thumb-hover: rgba(255, 255, 255, 0.34);
        /* ISA-120: zentrale UI-Skalierungs-Tokens. Zusammen mit --sidebar-w,
           --radius-*, --font-* und --scrollbar-* die Stellschrauben der
           App-Shell. Werte = die bisher effektiven Endwerte der Kaskade
           (Basisschrift 13px, Header 58px, Lese-/Chatspalte 720px). px bewusst:
           CSS-px sind DPI-unabhängig, OS-Skalierung und Browser-Zoom skalieren
           sie bereits einheitlich auf allen Plattformen. */
        --font-size-base: 13px;
        --header-h: 58px;
        --content-max: 720px;
      }

      *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
      html, body { height: 100%; overflow: hidden; }
      body {
        font-family: var(--font-body);
        background: var(--bg);
        color: var(--text);
        display: flex;
        font-size: var(--font-size-base);
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
      }
      button, textarea, input, select { font-family: var(--font-body); }
      button { border: 0; background: none; cursor: pointer; }
      button:disabled,
      button[disabled] {
        cursor: not-allowed !important;
        opacity: 0.55;
        filter: grayscale(0.18);
        box-shadow: none !important;
      }

      /* ISA-119: OS-unabhängige Scrollbars. Ohne Custom-Styling rendert Windows
         in jedem Scroll-Container klassische ~15px-Scrollbars, macOS dagegen
         0px-Overlays — Contentbreiten und Layout weichen dadurch pro Plattform
         ab. Die Custom-Scrollbar rendert in Chromium/Safari überall identisch;
         spezifischere Bestandsregeln (Sidebar, Chat) behalten Vorrang. */
      ::-webkit-scrollbar { width: var(--scrollbar-size); height: var(--scrollbar-size); }
      ::-webkit-scrollbar-track { background: transparent; }
      ::-webkit-scrollbar-corner { background: transparent; }
      ::-webkit-scrollbar-thumb {
        background: var(--scrollbar-thumb);
        border-radius: 999px;
      }
      ::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

      #sidebar {
        width: var(--sidebar-w);
        min-width: var(--sidebar-w);
        height: 100vh;
        background: var(--surface);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        z-index: 20;
      }
      .sb-brand {
        padding: 22px 20px 18px;
        border-bottom: 1px solid rgba(255,255,255,0.07);
        display: flex;
        align-items: center;
        gap: 11px;
        cursor: pointer;
      }
      .sb-brand:focus-visible {
        outline: 2px solid var(--blue);
        outline-offset: -6px;
      }
      #brand-logo {
        width: 154px;
        height: 26px;
        object-fit: contain;
        object-position: left center;
        display: block;
        flex: 0 0 154px;
      }
      .sb-mark {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        background: var(--surface-2);
        border: 1px solid var(--border-md);
        display: grid;
        place-items: center;
        color: #fff;
        font-family: var(--font-head);
        font-size: 13px;
        font-weight: 700;
        overflow: hidden;
      }
      .sb-mark img {
        width: 24px;
        height: 24px;
        object-fit: contain;
      }
      .sb-mark[data-fallback]::after {
        content: attr(data-fallback);
        font-family: var(--font-mono);
        font-size: 11px;
        color: var(--aqua);
      }
      .sb-brand-name {
        font-family: var(--font-head);
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        letter-spacing: 0.2px;
        line-height: 1.15;
      }
      .sb-brand-claim {
        font-size: 10px;
        color: rgba(255,255,255,0.34);
        letter-spacing: 0.4px;
      }
      .sb-top { padding: 14px 14px 8px; }
      .btn-new-chat {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 10px 16px;
        background: var(--blue-ui-bg);
        border-radius: var(--radius-md);
        color: #fff;
        font-size: 13px;
        font-weight: 700;
      }
      .btn-new-chat:hover { background: var(--blue-ui-bg-hover); }
      .sb-nav { padding: 4px 10px; }
      .sb-nav-item {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border-radius: 10px;
        color: rgba(255,255,255,0.52);
        font-size: 13px;
        font-weight: 600;
        transition: all 0.15s;
        margin-bottom: 1px;
        text-align: left;
      }
      .sb-nav-item:hover { background: var(--accent-soft-bg); color: rgba(255,255,255,0.92); }
      .sb-nav-item.active { background: var(--accent-soft-bg-strong); color: #dfe8ff; }
      #ni-knowledge { gap: 7px; }
      #ni-agents .assistant-robot-icon {
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
      }
      .sb-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 16px; }
      .sb-section-label {
        font-size: 9.5px;
        font-weight: 800;
        color: rgba(255,255,255,0.27);
        letter-spacing: 1px;
        text-transform: uppercase;
        padding: 10px 22px 4px;
      }
      .sb-section-label.locked {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }
      .sb-section-label.locked svg {
        flex-shrink: 0;
        opacity: 0.72;
      }
      .sb-section-label.locked span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .sb-history { flex: 1; overflow-y: auto; padding: 0 10px; }
      .sb-history::-webkit-scrollbar { width: 0; }
      .sb-history-item {
        width: 100%;
        display: flex;
        position: relative;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border-radius: 9px;
        color: rgba(255,255,255,0.43);
        font-size: 12.5px;
        text-align: left;
        margin-bottom: 1px;
        overflow: hidden;
      }
      .sb-history-item > svg,
      .sb-history-icon {
        width: 12px;
        height: 12px;
        flex: 0 0 12px;
      }
      .sb-history-icon {
        display: block;
        color: currentColor;
      }
      .mind-history-icon {
        width: 14px;
        height: 14px;
        flex: 0 0 12px;
        background: var(--blue);
        -webkit-mask: url("mind_head_cutout.png") center / contain no-repeat;
        mask: url("mind_head_cutout.png") center / contain no-repeat;
      }
      .sb-nav-mind-icon {
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
        display: inline-block;
        background: currentColor;
        -webkit-mask: url("mind_head_cutout.png") center / contain no-repeat;
        mask: url("mind_head_cutout.png") center / contain no-repeat;
      }
      .sb-history-item.mind-active-chat:not(.assistant-thread) .mind-history-icon {
        background: var(--aqua);
        filter: drop-shadow(0 0 8px var(--accent-focus-ring));
      }
      .sb-history-item:hover, .sb-history-item.active { background: var(--accent-soft-bg); color: #dfe8ff; }
      .sb-history-item > span:not(.sb-history-icon):not(.sb-history-folder):not(.sb-history-actions) {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .sb-history-item.project-thread {
        --project-thread-color: var(--blue);
        padding-left: 18px;
      }
      .sb-history-item.project-thread::before {
        content: "";
        position: absolute;
        left: 8px;
        top: 9px;
        bottom: 9px;
        width: 3px;
        border-radius: 999px;
        background: var(--project-thread-color);
        box-shadow: 0 0 12px color-mix(in srgb, var(--project-thread-color) 44%, transparent);
        pointer-events: none;
      }
      .sb-history-item.assistant-thread {
        --assistant-thread-color: var(--blue);
        padding-left: 18px;
      }
      .sb-history-item.assistant-thread::before {
        content: "";
        position: absolute;
        left: 8px;
        top: 9px;
        bottom: 9px;
        width: 3px;
        border-radius: 999px;
        background: var(--assistant-thread-color);
        box-shadow: 0 0 12px color-mix(in srgb, var(--assistant-thread-color) 44%, transparent);
        pointer-events: none;
      }
      .sb-history-item.assistant-thread > svg,
      .sb-history-item.assistant-thread .sb-history-icon {
        color: var(--assistant-thread-color);
        filter: drop-shadow(0 0 7px color-mix(in srgb, var(--assistant-thread-color) 35%, transparent));
      }
      .sb-history-item.assistant-yellow { --assistant-thread-color: #f4c84a; }
      .sb-history-item.assistant-green { --assistant-thread-color: #40d27b; }
      .sb-history-item.assistant-blue { --assistant-thread-color: #4a7aff; }
      .sb-history-item.project-yellow { --project-thread-color: #f4c84a; }
      .sb-history-item.project-green { --project-thread-color: #40d27b; }
      .sb-history-item.project-blue { --project-thread-color: #4a7aff; }
      body.light .sb-history-item.assistant-yellow { --assistant-thread-color: #d99b00; }
      body.light .sb-history-item.assistant-green { --assistant-thread-color: #16a34a; }
      body.light .sb-history-item.assistant-blue { --assistant-thread-color: var(--blue); }
      body.light .sb-history-item.project-yellow { --project-thread-color: #d99b00; }
      body.light .sb-history-item.project-green { --project-thread-color: #16a34a; }
      body.light .sb-history-item.project-blue { --project-thread-color: var(--blue); }
      .sb-history-folder {
        display: none;
        margin-left: auto;
        max-width: 86px;
        padding: 2px 7px;
        border-radius: 999px;
        background: rgba(255,255,255,0.06);
        color: rgba(255,255,255,0.44);
        flex: 0 1 auto;
        font-size: 9.5px;
        font-weight: 800;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .sb-footer { padding: 10px 14px 16px; border-top: 1px solid rgba(255,255,255,0.07); }
      .sb-mobile-settings {
        display: none;
        margin-top: 6px;
      }
      .sb-user-row {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 11px;
        border-radius: 10px;
      }
      .sb-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--yellow);
        color: var(--navy);
        font-family: var(--font-head);
        font-size: 11.5px;
        font-weight: 800;
        display: grid;
        place-items: center;
      }
      .sb-user-name { color: #fff; font-weight: 700; font-size: 12.5px; }
      .sb-user-role { color: rgba(255,255,255,0.36); font-size: 10.5px; }
      .sb-settings-btn {
        margin-left: auto;
        width: 32px;
        height: 32px;
        min-width: 32px;
        padding: 0;
        border-radius: 7px;
        color: rgba(255,255,255,0.42);
      }

      #main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        overflow: hidden;
        position: relative;
        z-index: 1;
      }
      #topbar {
        height: var(--header-h);
        background: rgba(7, 7, 10, 0.92);
        border-bottom: 1px solid var(--border-md);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 22px;
        flex-shrink: 0;
        z-index: 15;
      }
      .model-selector-wrap { position: relative; }
      body:not(.chat-view-active) #topbar .model-selector-wrap {
        display: none;
      }
      .model-pill {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 7px 15px;
        border-radius: 10px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        font-size: 13px;
        font-weight: 700;
        color: var(--navy);
        font-family: var(--font-head);
        box-shadow: var(--shadow-card);
      }
      .model-pill.open, .model-pill:hover { border-color: var(--aqua); background: var(--accent-soft-bg-strong); }
      .model-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        min-width: 292px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        box-shadow: 0 22px 64px rgba(0,0,0,0.42);
        padding: 8px;
        z-index: 300;
      }
      .model-dropdown.open { display: block; }
      .tenant-selector-wrap {
        position: relative;
        min-width: 176px;
      }
      .tenant-pill {
        width: 100%;
        min-height: 34px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 9px;
        padding: 7px 11px;
        border-radius: 10px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        color: var(--text);
        box-shadow: var(--shadow-card);
        text-align: left;
      }
      .tenant-pill:hover,
      .tenant-pill.open {
        border-color: rgba(74,122,255,0.72);
        background: rgba(36,87,212,0.16);
      }
      .tenant-pill-main {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.1;
      }
      .tenant-pill-kicker {
        color: var(--muted);
        font-family: var(--font-mono);
        font-size: 9px;
        font-weight: 800;
        text-transform: uppercase;
      }
      .tenant-pill-label {
        overflow: hidden;
        color: var(--text);
        font-size: 12.5px;
        font-weight: 800;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .tenant-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        min-width: 280px;
        padding: 8px;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        box-shadow: 0 22px 64px rgba(0,0,0,0.42);
        z-index: 310;
      }
      .tenant-dropdown.open { display: block; }
      .tenant-option {
        width: 100%;
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 10px;
        border-radius: 9px;
        color: var(--text);
        text-align: left;
      }
      .tenant-option:hover { background: var(--bg); }
      .tenant-option.active { background: var(--accent-soft-bg-strong); }
      .tenant-option-dot {
        width: 8px;
        height: 8px;
        margin-top: 6px;
        border-radius: 50%;
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
        flex: 0 0 8px;
      }
      .tenant-option-name {
        display: block;
        font-size: 13px;
        font-weight: 800;
      }
      .tenant-option-meta,
      .tenant-note {
        display: block;
        color: var(--muted);
        font-size: 11px;
        line-height: 1.45;
      }
      .tenant-note {
        padding: 8px 10px 4px;
        border-top: 1px solid var(--border);
      }
      .model-smart-card {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 11px 13px;
        border-radius: var(--radius-md);
        background: var(--blue-soft);
        border: 1px solid rgba(24,98,255,0.2);
        text-align: left;
        margin-bottom: 8px;
      }
      .model-smart-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background: var(--blue);
        display: grid;
        place-items: center;
        color: #fff;
        font-weight: 800;
      }
      .model-smart-title { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--navy); }
      .model-smart-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }
      .model-group-label {
        font-size: 9.5px;
        font-weight: 800;
        color: var(--muted);
        letter-spacing: 1px;
        text-transform: uppercase;
        padding: 7px 12px 3px;
      }
      .model-option {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 9px;
        font-size: 13px;
        color: var(--text);
        font-weight: 600;
        text-align: left;
      }
      .model-option:hover { background: var(--bg); }
      .provider-dot {
        position: relative;
        isolation: isolate;
        overflow: hidden;
        width: 28px;
        height: 28px;
        display: inline-grid;
        place-items: center;
        flex: 0 0 28px;
        border: 1px solid rgba(255,255,255,0.20);
        border-radius: 10px;
        background: rgba(255,255,255,0.08);
        color: #fff;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 8px 18px rgba(15,23,42,0.10);
        font-family: var(--font-mono);
        font-size: 9.5px;
        font-weight: 850;
        line-height: 1;
        letter-spacing: 0;
      }
      .provider-dot::before {
        content: attr(data-label);
        position: relative;
        z-index: 2;
      }
      .provider-dot::after {
        content: "";
        position: absolute;
        z-index: 1;
        pointer-events: none;
      }
      .provider-dot.provider-openai {
        border-color: rgba(74,122,255,0.42);
        background: linear-gradient(135deg, #1f6fff, #6da0ff);
        color: #fff;
      }
      .provider-dot.provider-openai::after {
        inset: 6px;
        border: 1.5px solid rgba(255,255,255,0.55);
        border-left-color: rgba(255,255,255,0.12);
        border-radius: 50%;
        transform: rotate(-24deg);
      }
      .provider-dot.provider-anthropic {
        border-color: rgba(99,102,241,0.22);
        background: linear-gradient(135deg, #f8fafc, #cbd5e1);
        color: #22304a;
      }
      .provider-dot.provider-anthropic::after {
        inset: 5px 8px;
        border-top: 2px solid rgba(34,48,74,0.28);
        border-bottom: 2px solid rgba(34,48,74,0.18);
        transform: skewX(-10deg);
      }
      .provider-dot.provider-google {
        border-color: rgba(74,122,255,0.28);
        background: conic-gradient(from -35deg, #4285f4 0 28%, #34a853 28% 50%, #fbbc05 50% 72%, #ea4335 72% 100%);
        color: var(--blue);
      }
      .provider-dot.provider-google::after {
        inset: 4px;
        border-radius: 8px;
        background: rgba(255,255,255,0.94);
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.10);
      }
      .provider-dot.provider-local {
        border-color: rgba(20,184,166,0.36);
        background: linear-gradient(135deg, #0f766e, #5eead4);
        color: #fff;
      }
      .provider-dot.provider-local::after {
        inset: 6px;
        border: 1.5px solid rgba(255,255,255,0.45);
        border-radius: 8px;
      }
      /* ISA-29: Original-Marken-Icons als App-Icon-Chips. Kein ::after-Label. */
      .provider-dot.brand-chip::before,
      .provider-dot.brand-chip::after { content: none; }
      .provider-dot.brand-chip svg { display: block; }
      .provider-dot.brand-openai {
        background: #0f1115;
        border-color: rgba(255,255,255,0.22);
        color: #fff;
      }
      body.light .provider-dot.brand-openai {
        background: #111418;
        border-color: rgba(15,23,42,0.18);
      }
      .provider-dot.brand-anthropic {
        background: #d97757;
        border-color: rgba(217,119,87,0.55);
        color: #fff;
      }
      .provider-dot.brand-gemini {
        background: #fff;
        border-color: rgba(78,130,238,0.35);
        color: #4e82ee;
      }
      .provider-dot.brand-mistral {
        background: #fff;
        border-color: rgba(250,82,15,0.4);
        color: #fa520f;
      }
      /* ISA-32: Claude-App-Symbol (eigene Marke, Anthropic-Orange) */
      .provider-dot.brand-claude {
        background: #d97757;
        border-color: rgba(217,119,87,0.55);
        color: #fff;
      }
      .model-option.locked .provider-dot {
        border-color: rgba(100,116,139,0.28);
        background: linear-gradient(135deg, rgba(148,163,184,0.28), rgba(100,116,139,0.16));
        color: var(--txt3);
        box-shadow: none;
        opacity: 0.72 !important;
      }
      .topbar-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        flex: 0 0 auto;
        /* immer rechts verankert — auch wenn die Modellwahl links
           (nur im Chat sichtbar) ausgeblendet ist */
        margin-left: auto;
        min-width: 0;
      }
      .topbar-badge {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        background: var(--navy);
        border-radius: 20px;
        color: rgba(255,255,255,0.88);
        font-size: 11.5px;
        font-weight: 700;
      }
      .status-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
      }
      .status-dot.offline {
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
      }
      .status-dot.disabled,
      .status-dot[aria-disabled="true"] {
        background: var(--brand-dot-disabled);
        box-shadow: none;
      }
      .tenant-selector-wrap {
        position: relative;
        flex: 0 1 238px;
        min-width: 0;
        margin-left: 10px;
        margin-right: auto;
      }
      .tenant-selector-root {
        position: relative;
        flex: 0 1 238px;
        min-width: 0;
        margin-left: 10px;
        margin-right: auto;
      }
      .tenant-selector-root .tenant-selector-wrap {
        width: 100%;
        margin: 0;
      }
      .tenant-selector-wrap > summary,
      .tenant-selector-root > summary {
        list-style: none;
      }
      .tenant-selector-wrap > summary::-webkit-details-marker,
      .tenant-selector-root > summary::-webkit-details-marker {
        display: none;
      }
      .tenant-pill {
        width: 100%;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 6px 11px;
        border-radius: 12px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        color: var(--text);
        box-shadow: var(--shadow-card);
        cursor: pointer;
        user-select: none;
      }
      .tenant-pill:hover,
      .tenant-selector-wrap[open] .tenant-pill,
      .tenant-selector-root[open] .tenant-pill,
      .tenant-pill.open {
        border-color: var(--blue);
        background: rgba(36,87,212,0.16);
      }
      .tenant-status-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
        flex: 0 0 7px;
      }
      .tenant-pill-copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.12;
      }
      .tenant-pill-main {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.12;
      }
      .tenant-pill-kicker {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 800;
        letter-spacing: 0.4px;
        text-transform: uppercase;
      }
      .tenant-pill-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12.5px;
        font-weight: 800;
      }
      .tenant-pill-meta {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-top: 2px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
      }
      .tenant-pill-arrow {
        margin-left: auto;
        color: var(--blue);
        flex: 0 0 12px;
        transition: transform 0.18s;
      }
      .tenant-selector-wrap[open] .tenant-pill-arrow,
      .tenant-selector-root[open] .tenant-pill-arrow,
      .tenant-pill.open .tenant-pill-arrow {
        transform: rotate(180deg);
      }
      .tenant-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        width: min(280px, calc(100vw - 44px));
        padding: 8px;
        border-radius: var(--radius-lg);
        background: var(--surface);
        border: 1px solid var(--border-md);
        box-shadow: 0 22px 64px rgba(0,0,0,0.42);
        z-index: 300;
      }
      .tenant-dropdown.open {
        display: block;
      }
      .tenant-dropdown-title {
        padding: 5px 9px 7px;
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 800;
        letter-spacing: 1px;
        text-transform: uppercase;
      }
      .tenant-option {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 9px;
        min-width: 0;
        padding: 9px 10px;
        border-radius: 10px;
        color: var(--text);
        font-size: 12.5px;
        font-weight: 700;
        text-align: left;
      }
      .tenant-option:hover,
      .tenant-option.active {
        background: var(--blue-soft);
        color: var(--text);
      }
      .tenant-option-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
        flex: 0 0 7px;
      }
      .tenant-option-copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.15;
      }
      .tenant-option > span:last-child {
        min-width: 0;
        display: flex;
        flex-direction: column;
        line-height: 1.15;
      }
      .tenant-option-name,
      .tenant-option-meta {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .tenant-option-meta {
        margin-top: 2px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
      }
      .tenant-note {
        display: block;
        padding: 7px 9px 4px;
        color: var(--muted);
        font-size: 10px;
        line-height: 1.35;
      }

      #content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
      .view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
      .view.active { display: flex; }
      #view-chat { background: var(--bg); }
      #chat-scroll { flex: 1; overflow-y: auto; padding: 32px 0 20px; scroll-behavior: smooth; }
      #chat-scroll::-webkit-scrollbar, .page-scroll::-webkit-scrollbar { width: 3px; }
      #chat-scroll::-webkit-scrollbar-thumb, .page-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
      .chat-container {
        max-width: var(--content-max);
        min-height: 100%;
        margin: 0 auto;
        padding: 0 28px;
        display: flex;
        flex-direction: column;
      }
      #empty-state {
        margin-top: auto;
        margin-bottom: clamp(18px, 3vh, 42px);
        text-align: center;
        padding-top: 28px;
        padding-bottom: 18px;
      }
      .welcome-logo {
        display: inline-grid;
        place-items: center;
        width: 52px;
        height: 52px;
        border-radius: 14px;
        background: #0d0d12;
        border: 1px solid var(--border-md);
        color: #fff;
        font-family: var(--font-mono);
        font-weight: 800;
        margin-bottom: 12px;
        overflow: hidden;
      }
      .welcome-logo img { width: 32px; height: 32px; object-fit: contain; }
      .welcome-sphere-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 14px;
      }
      .ws-sphere { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }
      .ws-line { display: none; width: 32px; height: 1px; background: var(--navy); opacity: 0.16; }
      .welcome-title {
        font-family: var(--font-head);
        font-size: 28px;
        font-weight: 700;
        color: var(--navy);
      }
      .welcome-sub {
        font-size: 14px;
        color: var(--muted);
        max-width: 410px;
        margin: 0 auto 34px;
        line-height: 1.75;
      }
      .suggestions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        max-width: 520px;
        margin: 0 auto;
      }
      .suggestion-btn {
        padding: 15px 17px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        text-align: left;
        box-shadow: var(--shadow-card);
      }
      .suggestion-btn:hover {
        border-color: var(--blue);
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(7,19,61,0.1);
      }
      .sug-icon { color: var(--blue); margin-bottom: 9px; }
      .sug-title { display: block; font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--navy); }
      .sug-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
      #msg-list { display: flex; flex-direction: column; gap: 18px; }
      .msg-row { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
      .msg-row.user { flex-direction: row-reverse; }
      .msg-ai-avatar, .msg-user-avatar {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        flex-shrink: 0;
        margin-top: 2px;
      }
      .msg-ai-avatar { background: transparent; color: var(--blue); font-weight: 800; }
      .msg-ai-avatar img {
        width: 28px;
        height: 28px;
        display: block;
        object-fit: contain;
        filter: var(--mind-logo-gray-filter);
        opacity: var(--mind-logo-gray-opacity);
      }
      .msg-user-avatar { background: var(--yellow); color: var(--navy); font-weight: 800; font-size: 10.5px; }
      .msg-content { max-width: 74%; display: flex; flex-direction: column; }
      .msg-row.user .msg-content { align-items: flex-end; }
      .msg-bubble {
        padding: 13px 17px;
        border-radius: 6px 18px 18px 18px;
        font-size: 13.5px;
        line-height: 1.68;
        background: linear-gradient(180deg, rgba(36,87,212,0.16), rgba(36,87,212,0.08));
        border: 1px solid rgba(74,122,255,0.34);
        border-left: 3px solid var(--aqua);
        box-shadow: 0 10px 28px rgba(0,0,0,0.22);
        color: var(--text);
        overflow-wrap: anywhere;
        max-width: 100%;
      }
      /* ISA-118: Antwort-Typografie — kontrollierte Absatz-/Listenabstände statt
         Browser-Defaults; erste/letzte Blöcke bündig mit dem Bubble-Padding. */
      .msg-bubble p { margin: 0 0 10px; }
      .msg-bubble p:last-child { margin-bottom: 0; }
      .msg-bubble .msg-h:first-child { margin-top: 0; }
      .msg-bubble .msg-li-wrap:last-child { margin-bottom: 0; }
      #rag-answer p { margin: 0 0 9px; }
      #rag-answer p:last-child { margin-bottom: 0; }
      .msg-bubble.user {
        background: #14161e;
        border-color: rgba(255,255,255,0.10);
        border-left-width: 1px;
        box-shadow: none;
        border-radius: 18px 6px 18px 18px;
        color: var(--text);
        font-weight: 500;
      }
      .msg-row.agent .msg-bubble,
      .msg-row[data-role="agent"] .msg-bubble,
      .msg-bubble.agent {
        background: linear-gradient(180deg, rgba(34,197,94,0.12), rgba(13,13,18,0.96));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .typing-row.agent .typing-bubble,
      .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.11), rgba(13,13,18,0.95));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .msg-row.system .msg-bubble,
      .msg-row[data-role="system"] .msg-bubble,
      .msg-bubble.system {
        background: linear-gradient(180deg, rgba(242,201,76,0.10), rgba(13,13,18,0.96));
        border-color: rgba(242,201,76,0.24);
        border-left-color: rgba(242,201,76,0.70);
      }
      .msg-attachments {
        display: grid;
        gap: 8px;
        margin-top: 10px;
      }
      .msg-attachment {
        display: flex;
        align-items: center;
        gap: 9px;
        max-width: 100%;
        border: 1px solid rgba(74,122,255,0.26);
        border-radius: 10px;
        background: rgba(74,122,255,0.08);
        padding: 8px 10px;
      }
      .msg-attachment-icon {
        width: 24px;
        height: 24px;
        display: grid;
        place-items: center;
        flex: 0 0 24px;
        border-radius: 8px;
        background: rgba(74,122,255,0.14);
        color: var(--blue-l);
      }
      .msg-attachment-main {
        min-width: 0;
      }
      .msg-attachment-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 800;
        line-height: 1.25;
      }
      .msg-attachment-meta {
        color: var(--txt3);
        font-size: 11px;
        line-height: 1.35;
      }
      .msg-meta { font-size: 10.5px; color: #aeb9c9; margin-top: 5px; padding: 0 4px; }
      .msg-h { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 13px; margin: 12px 0 5px; }
      .msg-li-wrap { display: flex; flex-direction: column; gap: 5px; margin: 6px 0; }
      .msg-li { display: flex; gap: 9px; align-items: flex-start; }
      /* ISA-34: Indexierungsstatus-Chip im Projekt-Wissenspanel (Light + Dark) */
      .proj-doc-li { align-items: center; }
      .proj-doc-li-text { flex: 1 1 auto; min-width: 0; }
      .proj-doc-status {
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 999px;
        border: 1px solid transparent;
        white-space: nowrap;
      }
      .proj-doc-status.ready { color: #1a7f4b; background: rgba(34,197,94,0.14); border-color: rgba(34,197,94,0.30); }
      .proj-doc-status.processing { color: #b06a00; background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.32); }
      .proj-doc-status.error { color: #c0362c; background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.34); }
      .proj-doc-status.local { color: var(--txt3); background: rgba(148,163,184,0.16); border-color: rgba(148,163,184,0.30); }
      body:not(.light) .proj-doc-status.ready { color: #6ee7a8; }
      body:not(.light) .proj-doc-status.processing { color: #fbbf24; }
      body:not(.light) .proj-doc-status.error { color: #fca5a5; }
      .msg-li-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); margin-top: 8px; flex-shrink: 0; }
      .typing-row { display: flex; gap: 11px; align-items: center; }
      .typing-bubble {
        background: linear-gradient(180deg, rgba(36,87,212,0.14), rgba(36,87,212,0.07));
        border: 1px solid rgba(74,122,255,0.30);
        border-left: 3px solid var(--aqua);
        border-radius: 6px 18px 18px 18px;
        padding: 13px 18px;
        display: flex;
        gap: 5px;
        box-shadow: 0 10px 28px rgba(0,0,0,0.20);
      }
      .typing-row.agent .typing-bubble,
      .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.11), rgba(13,13,18,0.95));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .t-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: tdot 1.1s infinite; }
      .t-dot:nth-child(2) { animation-delay: 0.2s; }
      .t-dot:nth-child(3) { animation-delay: 0.4s; }
      @keyframes tdot { 0%,100% { transform: scale(0.7); opacity: 0.3; } 50% { transform: scale(1.1); opacity: 1; } }

      #input-area {
        background: var(--bg);
        border-top: 1px solid var(--border-md);
        padding: 16px 28px 20px;
        flex-shrink: 0;
      }
      .input-outer { max-width: var(--content-max); margin: 0 auto; }
      .input-box {
        background: var(--surface);
        border: 1.5px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 13px 14px;
        box-shadow: 0 10px 30px rgba(7,19,61,0.05);
        position: relative;
      }
      .input-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,98,255,0.08), 0 10px 30px rgba(7,19,61,0.06); }
      #msg-input {
        width: 100%;
        min-height: 22px;
        max-height: 140px;
        resize: none;
        overflow-y: auto;
        background: transparent;
        border: 0;
        outline: 0;
        font-size: 14px;
        color: var(--text);
        line-height: 1.65;
      }
      #msg-input::placeholder { color: #aeb9c9; }
      .input-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 10px;
      }
      .input-bar-left { display: flex; gap: 2px; align-items: center; min-width: 0; }
      .ibar-btn {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        display: grid;
        place-items: center;
        color: #9fadbf;
        flex-shrink: 0;
      }
      .ibar-btn:hover { background: var(--border); color: var(--blue); }
      .ibar-sep { width: 1px; height: 18px; background: var(--border-md); margin: 0 6px; }
      .ibar-model-tag { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 700; min-width: 0; }
      .ibar-model-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .composer-model-control {
        position: relative;
        display: flex;
        align-items: center;
        min-width: 0;
      }
      button.ibar-model-tag {
        border: 0;
        background: transparent;
        cursor: pointer;
      }
      button.ibar-model-tag:hover,
      button.ibar-model-tag.open {
        color: var(--blue);
        background: rgba(36,87,212,0.10);
      }
      .composer-model-popover {
        display: none;
        position: fixed;
        left: 16px;
        top: 16px;
        width: min(292px, calc(100vw - 42px));
        max-height: min(560px, calc(100vh - 190px));
        overflow-y: auto;
        padding: 8px;
        border-radius: var(--radius-lg);
        background: var(--surface);
        border: 1px solid var(--border-md);
        box-shadow: 0 22px 70px rgba(0,0,0,0.52);
        z-index: 80;
      }
      .composer-model-popover.open { display: block; }
      .composer-model-head {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
        padding: 10px 12px 14px;
        border-bottom: 1px solid var(--border);
      }
      .composer-model-head.model-smart-card {
        display: flex;
        grid-template-columns: none;
        gap: 11px;
        margin-bottom: 8px;
        padding: 11px 13px;
        border: 1px solid rgba(24,98,255,0.2);
      }
      .composer-model-head .model-smart-icon {
        flex: 0 0 36px;
      }
      .composer-smart-check {
        margin-left: auto;
      }
      .composer-model-title {
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
        line-height: 1.15;
      }
      .composer-model-sub {
        color: var(--muted);
        font-size: 11px;
        margin-top: 2px;
      }
      .composer-pro-pill,
      .model-region-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        white-space: nowrap;
      }
      .composer-pro-pill {
        gap: 4px;
        padding: 5px 9px;
        background: rgba(74,122,255,0.13);
        border: 1px solid rgba(74,122,255,0.22);
        color: var(--blue-l);
        font-size: 11px;
        font-weight: 800;
      }
      .composer-model-label {
        padding: 14px 14px 7px;
        border-top: 1px solid var(--border);
        color: var(--muted);
        font-size: 12px;
        font-weight: 750;
      }
      .composer-model-option {
        width: 100%;
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 11px 12px;
        border-radius: 12px;
        color: var(--text);
        font-size: 14px;
        font-weight: 760;
        text-align: left;
      }
      .composer-model-option:hover,
      .composer-model-option.selected {
        background: rgba(74,122,255,0.12);
        color: #f8faff;
      }
      .composer-model-popover .model-option {
        width: 100%;
      }
      .model-region-badge {
        width: 24px;
        height: 24px;
        border: 1px solid rgba(251,191,36,0.75);
        background: #003399;
        color: #ffd43b;
        font: 850 8px/1 var(--font-mono);
        letter-spacing: 0;
      }
      #send-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: var(--border-md);
        display: grid;
        place-items: center;
        flex-shrink: 0;
      }
      #send-btn.ready { background: var(--blue-ui-bg); box-shadow: var(--blue-ui-shadow); }
      .input-disclaimer { text-align: center; font-size: 10.5px; color: #b7c1d2; margin-top: 9px; }

      .page-scroll { flex: 1; overflow-y: auto; padding: 38px 42px; background: var(--bg); }
      .page-hd { margin-bottom: 6px; }
      .page-hd-row { display: flex; align-items: center; gap: 10px; }
      .ph-sphere { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
      .ph-line { display: none; width: 24px; height: 1px; background: var(--navy); opacity: 0.16; }
      .ph-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--navy); }
      .ph-sub { font-size: 13.5px; color: var(--muted); margin: 6px 0 28px; max-width: var(--content-max); }
      .ph-rule { height: 1px; background: var(--border); margin-bottom: 26px; }
      .pg-action-btn, .btn-primary {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        background: var(--blue-ui-bg);
        color: #fff;
        border-radius: var(--radius-md);
        font-size: 13px;
        font-weight: 700;
        box-shadow: var(--blue-ui-shadow);
      }
      .pg-action-btn:hover, .btn-primary:hover {
        background: var(--blue-ui-bg-hover);
      }
      .pg-action-btn { margin-bottom: 24px; }
      .btn-secondary, .btn-outline {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 9px 16px;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        background: var(--surface);
        color: var(--navy);
        font-size: 13px;
        font-weight: 700;
      }
      .inbox-readall-btn {
        gap: 5px;
      }
      .inbox-readall-btn svg {
        flex: 0 0 16px;
      }
      .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 13px; }
      #view-assistants .page-scroll { padding-bottom: 96px; }
      #view-assistants .card-grid { margin-bottom: 30px; }
      .pg-card {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 20px 22px;
        cursor: pointer;
        box-shadow: var(--shadow-card);
      }
      .pg-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(7,19,61,0.1); }
      .pg-card-ico {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: var(--blue-soft);
        display: grid;
        place-items: center;
        margin-bottom: 13px;
        color: var(--blue);
      }
      .pg-card-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
      .pg-card-sub { font-size: 12px; color: var(--muted); line-height: 1.55; }
      .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 3px 9px;
        border-radius: 20px;
        font-size: 10.5px;
        font-weight: 800;
      }
      .sb-active { background: rgba(74,222,128,0.15); color: #16834a; }
      .sb-progress { background: rgba(255,115,104,0.13); color: #c24134; }
      .sb-restricted { background: rgba(242,201,76,0.14); color: #d9a318; }
      .knowledge-breadcrumb {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
      }
      .knowledge-breadcrumb button {
        color: var(--text-soft);
        font-weight: 800;
      }
      .knowledge-breadcrumb span { color: var(--muted); }
      .knowledge-breadcrumb .current { color: var(--text); }
      .dept-intro {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 18px;
        align-items: end;
        margin-bottom: 18px;
      }
      .dept-intro-title {
        color: var(--text);
        font-family: var(--font-head);
        font-size: 18px;
        font-weight: 800;
      }
      .dept-intro-copy {
        max-width: var(--content-max);
        margin-top: 6px;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.65;
      }
      .dept-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 14px;
      }
      .dept-card {
        min-height: 230px;
        display: grid;
        gap: 13px;
        align-content: start;
        text-align: left;
        transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      .dept-card-top,
      .dept-hero-top,
      .doc-card-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
      }
      .dept-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        color: #fff;
        background: var(--blue-ui-bg);
        border: 1px solid rgba(255,255,255,0.12);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
        flex: 0 0 42px;
      }
      .dept-icon svg,
      .dept-lock svg { width: 20px; height: 20px; }
      .dept-lock {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        color: var(--muted);
        background: rgba(255,255,255,0.05);
        border: 1px solid var(--border);
        flex: 0 0 32px;
      }
      .dept-card-title {
        color: var(--text);
        font-size: 16px;
        font-weight: 800;
      }
      .dept-card-desc {
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.55;
      }
      .dept-meta {
        display: grid;
        gap: 7px;
        margin-top: 2px;
      }
      .dept-meta-row {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        color: var(--muted);
        font-size: 11.5px;
      }
      .dept-meta-row strong {
        color: var(--text-soft);
        font-weight: 800;
        text-align: right;
      }
      .dept-overview,
      .dept-locked-view {
        display: none;
      }
      .dept-overview.active,
      .dept-locked-view.active {
        display: block;
      }
      .dept-hero {
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: var(--radius-lg);
        padding: 22px;
        background:
          linear-gradient(135deg, rgba(74,122,255,0.14), rgba(13,13,18,0.78)),
          var(--surface);
        box-shadow: var(--shadow-card);
        margin-bottom: 16px;
      }
      .dept-hero-title {
        margin-top: 12px;
        color: var(--text);
        font-family: var(--font-head);
        font-size: 26px;
        font-weight: 800;
        line-height: 1.2;
      }
      .dept-hero-copy {
        max-width: 760px;
        margin-top: 8px;
        color: var(--text-soft);
        line-height: 1.65;
      }
      .dept-hero-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 18px;
      }
      .dept-hero-metrics {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 14px;
      }
      .dept-doc-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
        gap: 16px;
        align-items: start;
      }
      .dept-section-title {
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
        margin: 3px 0 10px;
      }
      .dept-doc-grid {
        display: grid;
        gap: 10px;
      }
      .doc-card {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 16px;
        box-shadow: var(--shadow-card);
      }
      .doc-card.locked {
        background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(13,13,18,0.92));
        border-color: rgba(242,201,76,0.22);
      }
      .doc-status-lock {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }
      .doc-title {
        color: var(--text);
        font-weight: 800;
        line-height: 1.35;
      }
      .doc-desc {
        margin-top: 8px;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.55;
      }
      .doc-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: 12px;
      }
      .doc-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 14px;
      }
      .dept-side-panel,
      .dept-context-note,
      .dept-action-status {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        box-shadow: var(--shadow-card);
      }
      .dept-side-panel {
        padding: 18px;
        position: sticky;
        top: 18px;
      }
      .dept-side-title {
        color: var(--text);
        font-size: 16px;
        font-weight: 800;
      }
      .dept-side-copy {
        margin-top: 8px;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.6;
      }
      .dept-side-panel .btn-primary,
      .dept-side-panel .btn-secondary {
        width: 100%;
        justify-content: center;
        margin-top: 14px;
      }
      .dept-context-note {
        margin-top: 12px;
        padding: 13px;
        color: var(--text-soft);
        font-size: 12px;
        line-height: 1.55;
        background: rgba(74,122,255,0.08);
        border-color: rgba(74,122,255,0.24);
      }
      .dept-action-status {
        display: none;
        margin-top: 14px;
        padding: 11px 12px;
        color: var(--text-soft);
        font-size: 12px;
        border-color: rgba(74,122,255,0.26);
      }
      .dept-action-status.show { display: block; }
      .dept-upload-note {
        margin-top: 10px;
        color: var(--txt3);
        font-size: 12px;
        line-height: 1.55;
      }
      .dept-upload-dropzone {
        display: grid;
        gap: 8px;
        place-items: center;
        min-height: 138px;
        padding: 18px;
        border: 1px dashed rgba(74,122,255,0.46);
        border-radius: 14px;
        background: rgba(74,122,255,0.08);
        color: var(--txt2);
        text-align: center;
        transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
      }
      .dept-upload-dropzone.is-dragover {
        border-color: rgba(74,222,128,0.72);
        background: rgba(74,222,128,0.10);
        color: var(--txt);
      }
      .dept-upload-dropzone strong {
        color: var(--txt);
        font-size: 14px;
      }
      .dept-upload-file {
        width: min(100%, 440px);
        min-height: 32px;
        padding: 8px 10px;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        color: var(--txt2);
        background: var(--surf2);
        font-size: 12px;
        overflow-wrap: anywhere;
      }
      .dept-upload-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
      }
      .dept-locked-card {
        max-width: 620px;
        margin: 18px auto 0;
        padding: 26px;
        text-align: center;
        background: var(--surface);
        border: 1px solid rgba(242,201,76,0.22);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-card);
      }
      .dept-locked-icon {
        width: 58px;
        height: 58px;
        border-radius: 16px;
        margin: 0 auto 16px;
        display: grid;
        place-items: center;
        color: #f2c94c;
        background: rgba(242,201,76,0.12);
        border: 1px solid rgba(242,201,76,0.24);
      }
      .dept-locked-icon svg { width: 25px; height: 25px; }
      .dept-locked-title {
        color: var(--text);
        font-size: 20px;
        font-weight: 800;
      }
      .dept-locked-copy {
        margin: 8px auto 18px;
        max-width: 480px;
        color: var(--muted);
        line-height: 1.65;
      }
      .settings-group, .form-section, .file-list, .assistant-config {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 22px;
        margin-bottom: 16px;
        box-shadow: var(--shadow-card);
      }
      .settings-row, .file-row, .folder-row, .uploaded-file {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
      }
      .settings-row:last-child, .file-row:last-child, .folder-row:last-child, .uploaded-file:last-child { border-bottom: 0; }
      .invite-status {
        color: var(--muted);
        font-size: 12px;
        min-height: 16px;
        margin-top: 10px;
      }
      .admin-panel-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 16px;
        margin-bottom: 18px;
      }
      .admin-panel-copy {
        color: var(--muted);
        font-size: 12.5px;
        max-width: 760px;
        line-height: 1.65;
      }
      .admin-panel-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }
      .admin-module-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 16px;
      }
      .admin-module-card {
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 13px;
        background: rgba(255,255,255,0.025);
      }
      .admin-module-icon {
        width: 30px;
        height: 30px;
        border-radius: 9px;
        display: grid;
        place-items: center;
        margin-bottom: 10px;
        background: var(--blue-soft);
        color: var(--aqua);
      }
      .admin-module-title {
        color: var(--text);
        font-weight: 800;
        font-size: 12.5px;
        margin-bottom: 3px;
      }
      .admin-module-sub {
        color: var(--muted);
        font-size: 11.5px;
        line-height: 1.5;
      }
      .admin-tenant-head {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        align-items: flex-start;
        margin: 18px 0 10px;
      }
      .admin-tenant-list {
        display: grid;
        gap: 10px;
        margin-bottom: 12px;
      }
      .admin-tenant-row {
        display: grid;
        grid-template-columns: minmax(160px, 1.2fr) minmax(90px, 0.65fr) minmax(110px, 0.75fr) minmax(95px, 0.65fr) minmax(120px, 0.8fr) auto;
        gap: 10px;
        align-items: center;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 12px;
        background: rgba(255,255,255,0.025);
      }
      .admin-tenant-row.is-current {
        border-color: rgba(74,122,255,0.38);
        background: rgba(74,122,255,0.06);
      }
      .admin-tenant-label {
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 3px;
      }
      .admin-tenant-value {
        color: var(--text);
        font-size: 12.5px;
        font-weight: 800;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .admin-tenant-note {
        border: 1px solid rgba(74,122,255,0.22);
        border-radius: var(--radius-md);
        padding: 12px;
        background: rgba(74,122,255,0.055);
        color: var(--muted);
        font-size: 12px;
        line-height: 1.6;
      }
      .admin-role-strip {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0 0 16px;
      }
      .admin-role-badge {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 6px 10px;
        background: rgba(255,255,255,0.035);
        color: var(--text-soft);
        font-size: 11.5px;
        font-weight: 800;
      }
      .admin-role-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--aqua);
      }
      .admin-user-list {
        display: grid;
        gap: 10px;
      }
      .admin-user-card {
        display: grid;
        grid-template-columns: minmax(190px, 1.05fr) minmax(190px, 1fr) auto;
        gap: 14px;
        align-items: center;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 14px;
        background: rgba(255,255,255,0.025);
        transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
      }
      .admin-user-card:hover {
        border-color: rgba(74,122,255,0.42);
        background: rgba(74,122,255,0.055);
        transform: translateY(-1px);
      }
      .admin-user-main {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }
      .admin-user-avatar {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        display: grid;
        place-items: center;
        flex: 0 0 38px;
        background: linear-gradient(180deg, rgba(74,122,255,0.22), rgba(36,87,212,0.10));
        border: 1px solid rgba(74,122,255,0.25);
        color: var(--text);
        font-family: var(--font-mono);
        font-size: 11px;
        font-weight: 800;
      }
      .admin-user-name {
        color: var(--text);
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .admin-user-meta {
        color: var(--muted);
        font-size: 11.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .admin-user-access {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
      }
      .admin-user-actions {
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
      }
      .admin-user-actions .btn-secondary {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
      }
      .admin-status-line {
        margin-top: 14px;
        min-height: 18px;
        color: var(--muted);
        font-size: 12px;
      }
      .chip.locked { background: rgba(255,255,255,0.07); color: var(--muted); }
      .settings-sec-label, .form-section-title, .file-list-label {
        font-family: var(--font-head);
        color: var(--navy);
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 8px;
      }
      .sr-label { font-weight: 800; color: var(--navy); }
      .sr-sub, .file-info, .folder-count { color: var(--muted); font-size: 12px; }
      .toggle {
        margin-left: auto;
        width: 52px;
        height: 32px;
        border-radius: 99px;
        background: #3a3a46;
        position: relative;
        flex-shrink: 0;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
        transition: background 0.18s ease, box-shadow 0.18s ease;
      }
      .toggle::after {
        content: "";
        position: absolute;
        width: 28px;
        height: 28px;
        left: 2px;
        top: 2px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 3px 10px rgba(0,0,0,0.32);
        transition: transform 0.18s ease;
      }
      .toggle.on { background: var(--blue); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 0 0 4px var(--accent-soft-bg); }
      .toggle.on::after { transform: translateX(20px); }
      .toggle:focus-visible { outline: 2px solid var(--accent-focus-ring); outline-offset: 3px; }
      .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
      .form-group { margin-bottom: 14px; }
      .form-label { display: block; color: var(--navy); font-weight: 800; font-size: 12px; margin-bottom: 6px; }
      .form-input, .form-select, .form-textarea {
        width: 100%;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        padding: 11px 12px;
        outline: 0;
        color: var(--text);
        background: #0b0c11;
      }
      .form-select {
        appearance: none;
        -webkit-appearance: none;
        padding-right: 42px;
        background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%238ca0c0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 16px 16px;
      }
      .form-textarea { resize: vertical; min-height: 120px; }
      .file-icon, .folder-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background: var(--blue-soft);
        display: grid;
        place-items: center;
        color: var(--blue);
        flex-shrink: 0;
      }
      .file-meta { flex: 1; min-width: 0; }
      .file-name { font-weight: 800; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .file-badge { font-size: 10px; font-weight: 800; color: var(--blue); background: var(--blue-soft); padding: 3px 7px; border-radius: 99px; }
      .running-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--brand-dot-active);
        box-shadow: 0 0 0 3px var(--brand-dot-active-soft);
        flex-shrink: 0;
      }
      #view-assistants .running-dot,
      #view-agents .running-dot {
        display: none !important;
      }
      #view-assistants .assistant-card-shell .assistant-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-width: 0; }
      #view-assistants .assistant-card-shell .assistant-header > div:nth-child(2) { min-width: 0; }
      #view-assistants .assistant-card-shell .assistant-header .pg-card-title,
      #view-assistants .assistant-card-shell .assistant-header .pg-card-sub {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      #view-assistants .assistant-card-main {
        display: block;
        width: 100%;
        text-align: left;
        color: inherit;
      }
      #view-assistants .assistant-card-shell {
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
        position: relative;
        isolation: isolate;
        overflow: hidden;
        min-height: 142px;
        padding: 20px 62px 20px 22px;
        border-color: rgba(var(--assistant-accent-rgb), 0.32);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.14), rgba(13,13,18,0.82) 44%),
          var(--surface);
        box-shadow: 0 16px 36px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.06);
        transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      #view-assistants .assistant-card-shell[data-assistant-color="yellow"] {
        --assistant-accent: #f4c84a;
        --assistant-accent-rgb: 244,200,74;
      }
      #view-assistants .assistant-card-shell[data-assistant-color="green"] {
        --assistant-accent: #40d27b;
        --assistant-accent-rgb: 64,210,123;
      }
      #view-assistants .assistant-card-shell[data-assistant-color="blue"] {
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
      }
      #view-assistants .assistant-card-shell::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 5px;
        background: var(--assistant-accent);
        box-shadow: 0 0 22px rgba(var(--assistant-accent-rgb), 0.42);
        pointer-events: none;
        z-index: 0;
      }
      #view-assistants .assistant-card-shell:hover,
      #view-assistants .assistant-card-shell:focus-within {
        border-color: rgba(var(--assistant-accent-rgb), 0.74);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.22), rgba(17,17,24,0.94) 46%),
          var(--surface-2);
        box-shadow: 0 22px 44px rgba(0,0,0,0.34), 0 0 0 1px rgba(var(--assistant-accent-rgb), 0.18);
        transform: translateY(-3px);
      }
      #view-assistants .assistant-card-shell:focus-within {
        outline: 2px solid rgba(var(--assistant-accent-rgb), 0.58);
        outline-offset: 3px;
      }
      #view-assistants .assistant-card-shell .assistant-avatar {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
        background: rgba(var(--assistant-accent-rgb), 0.2);
        border: 1px solid rgba(var(--assistant-accent-rgb), 0.54);
        color: var(--assistant-accent);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(var(--assistant-accent-rgb), 0.18);
      }
      #view-assistants .assistant-card-shell:hover .assistant-avatar,
      #view-assistants .assistant-card-shell:focus-within .assistant-avatar {
        background: rgba(var(--assistant-accent-rgb), 0.32);
        border-color: rgba(var(--assistant-accent-rgb), 0.82);
      }
      #view-assistants .assistant-card-shell .assistant-card-gear {
        position: absolute;
        right: 14px;
        bottom: 14px;
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        background: var(--surf2);
        color: var(--txt3);
        z-index: 3;
      }
      #view-assistants .assistant-card-shell .assistant-card-main-action {
        position: absolute;
        inset: 0;
        z-index: 1;
        border: 0;
        border-radius: inherit;
        background: transparent;
        color: transparent;
        font-size: 0;
        cursor: pointer;
      }
      #view-assistants .assistant-card-shell .assistant-card-main-action:focus-visible {
        outline: 2px solid rgba(var(--assistant-accent-rgb), 0.72);
        outline-offset: -4px;
      }
      #view-assistants .assistant-card-shell > :not(.assistant-card-main-action):not(.assistant-card-gear) {
        position: relative;
        z-index: 2;
        pointer-events: none;
      }
      #view-assistants .assistant-card-shell .assistant-card-gear svg {
        width: 16px;
        height: 16px;
        display: block;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      #view-assistants .assistant-card-shell .assistant-card-gear::before {
        content: none;
        display: none;
      }
      #view-assistants .assistant-card-shell .assistant-card-gear:hover,
      #view-assistants .assistant-card-shell .assistant-card-gear:focus-visible {
        border-color: var(--bdr);
        background: var(--surf);
        color: var(--txt);
      }
      #view-agents .assistant-card-shell {
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
        position: relative;
        isolation: isolate;
        overflow: hidden;
        min-height: 142px;
        padding: 20px 62px 20px 22px;
        border-color: rgba(var(--assistant-accent-rgb), 0.32);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.14), rgba(13,13,18,0.82) 44%),
          var(--surface);
        box-shadow: 0 16px 36px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.06);
        transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      #view-agents .assistant-card-shell[data-assistant-color="yellow"] {
        --assistant-accent: #f4c84a;
        --assistant-accent-rgb: 244,200,74;
      }
      #view-agents .assistant-card-shell[data-assistant-color="green"] {
        --assistant-accent: #40d27b;
        --assistant-accent-rgb: 64,210,123;
      }
      #view-agents .assistant-card-shell[data-assistant-color="blue"] {
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
      }
      #view-agents .assistant-card-shell::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 5px;
        background: var(--assistant-accent);
        box-shadow: 0 0 22px rgba(var(--assistant-accent-rgb), 0.42);
        pointer-events: none;
        z-index: 0;
      }
      #view-agents .assistant-card-shell:hover,
      #view-agents .assistant-card-shell:focus-within {
        border-color: rgba(var(--assistant-accent-rgb), 0.74);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.22), rgba(17,17,24,0.94) 46%),
          var(--surface-2);
        box-shadow: 0 22px 44px rgba(0,0,0,0.34), 0 0 0 1px rgba(var(--assistant-accent-rgb), 0.18);
        transform: translateY(-3px);
      }
      #view-agents .assistant-card-shell .assistant-avatar {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
        background: rgba(var(--assistant-accent-rgb), 0.2);
        border: 1px solid rgba(var(--assistant-accent-rgb), 0.54);
        color: var(--assistant-accent);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 18px rgba(var(--assistant-accent-rgb), 0.18);
      }
      #view-agents .assistant-card-shell:hover .assistant-avatar,
      #view-agents .assistant-card-shell:focus-within .assistant-avatar {
        background: rgba(var(--assistant-accent-rgb), 0.32);
        border-color: rgba(var(--assistant-accent-rgb), 0.82);
      }
      #view-agents .assistant-card-shell .assistant-header {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
        min-width: 0;
      }
      #view-agents .assistant-card-shell .assistant-header > div:nth-child(2) {
        min-width: 0;
      }
      #view-agents .assistant-card-shell .assistant-header .pg-card-title,
      #view-agents .assistant-card-shell .assistant-header .pg-card-sub {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      #view-agents .assistant-card-shell .assistant-card-main-action {
        position: absolute;
        inset: 0;
        z-index: 1;
        border: 0;
        border-radius: inherit;
        background: transparent;
        color: transparent;
        font-size: 0;
        cursor: pointer;
      }
      #view-agents .assistant-card-shell .assistant-card-main-action:focus-visible {
        outline: 2px solid rgba(var(--assistant-accent-rgb), 0.72);
        outline-offset: -4px;
      }
      #view-agents .assistant-card-shell > :not(.assistant-card-main-action):not(.assistant-card-gear) {
        position: relative;
        z-index: 2;
        pointer-events: none;
      }
      #view-agents .assistant-card-shell .assistant-card-gear {
        position: absolute;
        right: 14px;
        bottom: 14px;
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        z-index: 3;
        border: 1px solid var(--bdr2);
        background: var(--surf2);
        color: var(--txt3);
      }
      #view-agents .assistant-card-shell .assistant-card-gear svg {
        width: 16px;
        height: 16px;
        display: block;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      #view-agents .assistant-card-shell .assistant-card-gear:hover,
      #view-agents .assistant-card-shell .assistant-card-gear:focus-visible {
        border-color: var(--bdr);
        background: var(--surf);
        color: var(--txt);
      }
      .project-folder-card {
        position: relative;
        cursor: default;
        transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      .project-folder-card.drag-over,
      .project-folder-card.is-drag-over,
      .project-folder-card[data-drag-over="true"] {
        border-color: color-mix(in srgb, var(--aqua) 72%, transparent);
        background: linear-gradient(180deg, var(--accent-soft-bg-strong), var(--accent-soft-bg));
        box-shadow: 0 0 0 3px var(--accent-soft-bg-strong), var(--shadow-card);
        transform: translateY(-1px);
      }
      #ni-projects.is-drag-over {
        color: var(--blue-l);
        border-color: color-mix(in srgb, var(--aqua) 52%, transparent);
        background: var(--accent-soft-bg-strong);
        box-shadow: inset 0 0 0 1px var(--accent-soft-bg-strong);
      }
      .project-folder-card.drag-over::after,
      .project-folder-card.is-drag-over::after,
      .project-folder-card[data-drag-over="true"]::after {
        content: "";
        position: absolute;
        inset: 8px;
        border: 1px dashed rgba(158,185,255,0.62);
        border-radius: calc(var(--radius-lg) - 4px);
        pointer-events: none;
      }
      .project-chat-list {
        display: grid;
        gap: 8px;
        margin: 14px 0;
      }
      .project-chat-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(78px, auto);
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 9px 10px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: rgba(74,122,255,0.06);
        color: var(--text);
        text-align: left;
      }
      .project-chat-row span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .project-chat-row small {
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 800;
        min-width: 0;
        overflow: hidden;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .project-chat-row.assistant-thread {
        border-left-width: 4px;
      }
      .project-chat-row.assistant-yellow { border-left-color: #f4c84a; }
      .project-chat-row.assistant-green { border-left-color: #40d27b; }
      .project-chat-row.assistant-blue { border-left-color: #4a7aff; }
      .project-workspace-shell {
        display: grid;
        gap: 18px;
      }
      .project-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 18px;
        align-items: start;
        padding: 18px;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: linear-gradient(180deg, rgba(74,122,255,0.11), rgba(255,255,255,0.035));
        box-shadow: var(--shadow-card);
      }
      .project-hero h3 {
        margin: 0 0 8px;
        font-family: var(--font-head);
        font-size: 22px;
        color: var(--navy);
      }
      .project-hero p {
        margin: 0;
        color: var(--muted);
        line-height: 1.55;
        max-width: 760px;
      }
      .project-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-end;
      }
      .project-overview-shell {
        width: min(100%, 1280px);
        display: grid;
        gap: 26px;
      }
      .project-overview-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 24px;
        align-items: start;
      }
      .project-overview-title {
        margin: 0 0 10px;
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 40px;
        font-weight: 800;
        line-height: 1.05;
        letter-spacing: -0.01em;
      }
      .project-overview-sub {
        margin: 0;
        max-width: 760px;
        color: var(--txt2);
        font-size: 16px;
        line-height: 1.55;
      }
      .project-overview-toolbar {
        display: grid;
        grid-template-columns: minmax(0, auto) minmax(320px, 1fr);
        gap: 14px;
        align-items: center;
      }
      .project-filter-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
      }
      .project-filter-tab {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        padding: 0 14px;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        background: var(--surf);
        color: var(--txt2);
        font-weight: 600;
        cursor: pointer;
        transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
      }
      .project-filter-tab:not(.active):hover {
        border-color: color-mix(in srgb, var(--blue) 40%, transparent);
        background: var(--surf2);
        color: var(--txt);
      }
      .project-filter-tab.active {
        border-color: var(--category-filter-active-border);
        background: var(--category-filter-active-bg);
        color: #fff;
        box-shadow: none;
      }
      .project-filter-icon,
      .project-filter-icon svg {
        width: 17px;
        height: 17px;
        display: inline-grid;
        place-items: center;
      }
      .project-filter-count {
        min-width: 19px;
        height: 19px;
        padding: 0 6px;
        display: inline-grid;
        place-items: center;
        border-radius: 999px;
        background: rgba(100,116,139,0.10);
        color: currentColor;
        font-size: 11.5px;
        font-weight: 400;
        opacity: 0.85;
      }
      .project-filter-tab.active .project-filter-count {
        background: rgba(255,255,255,0.18);
        opacity: 1;
      }
      .project-search-wrap {
        justify-self: end;
        width: 100%;
        min-height: 42px;
        border: 1px solid var(--bdr2);
        border-radius: 11px;
        background: var(--surf);
        color: var(--txt3);
        padding: 0 14px;
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .project-toolbar-right {
        justify-self: end;
        display: grid;
        grid-template-columns: minmax(260px, 520px) auto;
        align-items: center;
        gap: 10px;
        width: min(100%, 690px);
      }
      .project-search-wrap svg {
        width: 18px;
        height: 18px;
        flex: 0 0 auto;
      }
      .project-search-input {
        width: 100%;
        min-height: 40px;
        border: 0;
        background: transparent;
        color: var(--txt);
        padding: 0;
        font: inherit;
        outline: 0;
      }
      .project-view-toggle {
        min-height: 42px;
        padding: 3px;
        border: 1px solid var(--bdr2);
        border-radius: 11px;
        background: var(--surf);
      }
      .project-view-toggle .library-icon-btn {
        width: 36px;
        height: 36px;
      }
      .project-view-toggle svg {
        width: 18px;
        height: 18px;
      }
      .project-overview-section {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 18px;
      }
      .project-overview-section h3 {
        margin: 0;
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 20px;
        font-weight: 800;
        letter-spacing: 0;
      }
      .project-overview-section p {
        margin: 5px 0 0;
        color: var(--txt3);
        font-size: 14px;
      }
      .project-overview-count {
        color: var(--txt3);
        font-size: 14px;
        white-space: nowrap;
      }
      .project-card-grid.list-mode {
        grid-template-columns: minmax(0, 1fr);
      }
      .project-card-grid.list-mode .project-workspace-card {
        min-height: 0;
      }
      .project-card-menu {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 30px;
        height: 30px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--txt3);
        display: grid;
        place-items: center;
        cursor: pointer;
        z-index: 2;
      }
      .project-card-menu svg {
        width: 18px;
        height: 18px;
      }
      .project-card-menu:hover {
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
      }
      .project-card-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        min-height: 26px;
        padding: 0 10px;
        border: 1px solid var(--bdr2);
        border-radius: 999px;
        background: var(--surf);
        color: var(--txt3);
        font-size: 12px;
        font-weight: 600;
      }
      .project-card-badge svg {
        width: 14px;
        height: 14px;
      }
      .project-overview-card-text {
        color: var(--txt2);
        font-size: 14px;
        line-height: 1.6;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }
      .project-card-divider {
        height: 1px;
        background: var(--bdr2);
        margin-top: 2px;
      }
      .project-overview-empty {
        display: none;
        min-height: 220px;
        place-items: center;
        border: 1px dashed var(--bdr2);
        border-radius: var(--radius-lg);
        color: var(--txt3);
        text-align: center;
      }
      .project-overview-empty.show {
        display: grid;
      }
      .project-card-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(280px, 1fr));
        gap: 18px;
        max-width: 820px;
      }
      .project-workspace-card .pg-card-title {
        color: var(--txt);
        font-size: 18px;
        font-weight: 700;
        line-height: 1.25;
      }
      .project-workspace-card {
        position: relative;
        min-width: 0;
        min-height: 200px;
        padding: 20px;
        border-radius: 14px;
      }
      .project-card-open {
        display: grid;
        gap: 14px;
        width: 100%;
        min-height: 160px;
        padding: 0;
        border: 0;
        background: transparent;
        color: inherit;
        text-align: left;
        cursor: pointer;
      }
      .project-folder-icon {
        width: 46px;
        height: 46px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(36,87,212,0.26);
        border-radius: 12px;
        background: rgba(36,87,212,0.10);
        color: var(--blue);
      }
      .project-folder-icon svg {
        width: 22px;
        height: 22px;
      }
      .project-folder-open-label {
        align-self: end;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        color: var(--muted);
        font-size: 11.5px;
        font-weight: 800;
      }
      .project-workspace-card:hover,
      .project-workspace-card:focus-visible {
        border-color: color-mix(in srgb, var(--aqua) 58%, transparent);
        box-shadow: 0 16px 38px rgba(20,40,90,0.18);
        transform: translateY(-1px);
        outline: none;
      }
      .project-workspace-card:focus-within {
        border-color: color-mix(in srgb, var(--aqua) 58%, transparent);
        box-shadow: 0 0 0 3px var(--accent-soft-bg), var(--shadow-card);
      }
      .project-card-top,
      .project-detail-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
      }
      .project-status-row,
      .project-meta-row,
      .project-context-chip-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
      }
      .project-status-row {
        margin: 12px 0 14px;
      }
      .project-meta-row {
        margin-top: 14px;
        justify-content: space-between;
        color: var(--txt3);
        font-size: 13px;
      }
      .project-meta-row span {
        display: inline-flex;
        align-items: center;
        gap: 7px;
      }
      .project-meta-row svg {
        width: 16px;
        height: 16px;
      }
      /* ISA-93: Prioritäts-Chip in Karten/Detail nicht umbrechen lassen. */
      .project-priority {
        white-space: nowrap;
      }
      /* ISA-93: neutraler Empty-State, wenn keine Priorität gesetzt ist.
         Bewusst nicht .chip.locked, das app-weit einen rötlichen Warn-Ton hat. */
      .project-priority.is-empty {
        display: inline-flex;
        align-items: center;
        padding: 4px 8px;
        border-radius: 99px;
        font-size: 10.5px;
        font-weight: 800;
        background: rgba(120, 132, 156, 0.16);
        color: var(--muted);
      }
      /* ISA-93: Termin + Priorität im Kopf der Projekt-Detailseite. */
      .project-space-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px 18px;
        margin-top: 12px;
      }
      .project-space-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--txt3);
        font-size: 13px;
      }
      .project-space-meta-item strong {
        color: var(--text);
        font-weight: 700;
      }
      .project-space-meta-item svg {
        width: 16px;
        height: 16px;
      }
      .project-hero-assistants {
        margin-top: 12px;
      }
      .project-hero-assistant-label {
        flex-basis: 100%;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--muted);
        box-shadow: none;
        font-size: 10.5px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
      }
      .project-metric {
        display: grid;
        gap: 3px;
        min-width: 82px;
        padding: 9px 10px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255,255,255,0.045);
      }
      .project-metric strong {
        color: var(--text);
        font-size: 14px;
      }
      .project-metric span {
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.04em;
      }
      .project-breadcrumb {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
      }
      .project-breadcrumb svg {
        width: 15px;
        height: 15px;
        flex: 0 0 auto;
      }
      .project-breadcrumb button {
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--blue-l);
        font: inherit;
        cursor: pointer;
      }
      .project-detail-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
        gap: 14px;
      }
      .project-panel {
        min-width: 0;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--surf2);
      }
      .project-panel-title {
        margin: 0 0 12px;
        color: var(--navy);
        font-family: var(--font-head);
        font-size: 14px;
        font-weight: 800;
      }
      .project-list {
        display: grid;
        gap: 9px;
        margin: 0;
        padding: 0;
        list-style: none;
      }
      .project-list li,
      .project-doc-row,
      .project-task-row {
        min-width: 0;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255,255,255,0.04);
      }
      .project-list strong,
      .project-doc-row strong,
      .project-task-row strong {
        display: block;
        color: var(--text);
        margin-bottom: 4px;
      }
      .project-list span,
      .project-doc-row span,
      .project-task-row span {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.45;
      }
      .project-doc-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: center;
      }
      .project-doc-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
      }
      .project-doc-row.is-selected {
        border-color: rgba(74,122,255,0.48);
        background: rgba(74,122,255,0.10);
      }
      .project-doc-meta,
      .project-source-chip-row {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: 8px;
      }
      .project-doc-toggle {
        white-space: nowrap;
      }
      .project-rag-gate {
        display: grid;
        gap: 12px;
        padding: 15px;
        border: 1px solid rgba(74,122,255,0.26);
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(74,122,255,0.10), rgba(255,255,255,0.035));
      }
      .project-rag-gate-head {
        display: flex;
        align-items: flex-start;
        gap: 12px;
      }
      .project-rag-lock {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        flex: 0 0 36px;
        color: var(--blue-l);
        background: rgba(74,122,255,0.14);
        border: 1px solid rgba(74,122,255,0.24);
      }
      .project-rag-gate strong {
        display: block;
        color: var(--text);
        font-family: var(--font-head);
        font-size: 13.5px;
        margin-bottom: 3px;
      }
      .project-rag-gate p {
        margin: 0;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.45;
      }
      .project-rag-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 9px;
      }
      .project-rag-actions > button {
        justify-content: center;
      }
      .project-task-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: center;
      }
      .project-task-row.is-done {
        border-color: rgba(64,210,123,0.35);
        background: rgba(64,210,123,0.08);
      }
      .project-status-text {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.45;
      }
      .assistant-chat-bar.project-mode {
        border-color: rgba(var(--assistant-accent-rgb), 0.4);
        box-shadow: 0 0 0 1px rgba(var(--assistant-accent-rgb), 0.12), var(--shadow-card);
      }
      .assistant-avatar {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        color: #fff;
        font-weight: 800;
        background: linear-gradient(135deg, var(--blue), var(--aqua));
      }
      .assistant-avatar .assistant-robot {
        width: 66%;
        height: 66%;
        display: block;
      }
      /* ISA-12: grosser, farbdifferenzierter Roboter-Avatar im Assistenten-Chat */
      .assistant-chat-avatar {
        flex: 0 0 56px;
        width: 56px;
        height: 56px;
        border-radius: 16px;
        display: grid;
        place-items: center;
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
        color: var(--assistant-accent);
        background: rgba(var(--assistant-accent-rgb), 0.16);
        border: 1px solid rgba(var(--assistant-accent-rgb), 0.5);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 24px rgba(var(--assistant-accent-rgb), 0.22);
      }
      .assistant-chat-avatar[data-assistant-color="yellow"] { --assistant-accent: #f4c84a; --assistant-accent-rgb: 244,200,74; }
      .assistant-chat-avatar[data-assistant-color="green"] { --assistant-accent: #40d27b; --assistant-accent-rgb: 64,210,123; }
      .assistant-chat-avatar[data-assistant-color="blue"] { --assistant-accent: #4a7aff; --assistant-accent-rgb: 74,122,255; }
      .assistant-chat-avatar .assistant-robot { width: 70%; height: 70%; display: block; }
      .assistant-chat-bar {
        --assistant-accent: #4a7aff;
        --assistant-accent-rgb: 74,122,255;
        display: none;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
        max-width: 820px;
        margin: 0 auto 18px;
        padding: 18px 18px 18px 22px;
        position: relative;
        isolation: isolate;
        overflow: hidden;
        border: 1px solid rgba(var(--assistant-accent-rgb), 0.32);
        border-radius: var(--radius-md);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.14), rgba(13,13,18,0.82) 44%),
          var(--surface);
        color: var(--text);
        box-shadow: 0 16px 36px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.06);
      }
      .assistant-chat-bar[data-assistant-color="yellow"] { --assistant-accent: #f4c84a; --assistant-accent-rgb: 244,200,74; }
      .assistant-chat-bar[data-assistant-color="green"] { --assistant-accent: #40d27b; --assistant-accent-rgb: 64,210,123; }
      .assistant-chat-bar[data-assistant-color="blue"] { --assistant-accent: #4a7aff; --assistant-accent-rgb: 74,122,255; }
      .assistant-chat-bar::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 5px;
        background: var(--assistant-accent);
        box-shadow: 0 0 22px rgba(var(--assistant-accent-rgb), 0.42);
        pointer-events: none;
        z-index: 0;
      }
      .assistant-chat-bar.show { display: flex; }
      .assistant-chat-bar > * {
        position: relative;
        z-index: 1;
      }
      .assistant-chat-main {
        min-width: 0;
        flex: 1 1 420px;
      }
      .assistant-chat-title { font-weight: 800; color: var(--text); }
      .assistant-chat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
      .assistant-chat-bar #assistant-workspace-open-btn,
      .assistant-chat-bar .department-back-chat {
        min-height: 38px;
        padding: 0 16px;
        border-color: rgba(var(--assistant-accent-rgb), 0.28);
        background: rgba(var(--assistant-accent-rgb), 0.08);
        color: var(--assistant-accent);
        box-shadow: none;
      }
      .assistant-chat-bar #assistant-workspace-open-btn:hover,
      .assistant-chat-bar #assistant-workspace-open-btn:focus-visible,
      .assistant-chat-bar .department-back-chat:hover,
      .assistant-chat-bar .department-back-chat:focus-visible {
        border-color: rgba(var(--assistant-accent-rgb), 0.58);
        background: rgba(var(--assistant-accent-rgb), 0.16);
        color: var(--assistant-accent);
      }
      .chat-context-badge,
      .input-context-note {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        width: fit-content;
        max-width: 100%;
        border: 1px solid rgba(74,122,255,0.26);
        border-radius: 999px;
        background: rgba(74,122,255,0.08);
        color: var(--text-soft);
        font-size: 11.5px;
        font-weight: 800;
      }
      .chat-context-badge {
        margin-bottom: 12px;
        padding: 7px 10px;
      }
      .input-context-note {
        margin: 0 0 9px 2px;
        padding: 6px 10px;
      }
      .chat-context-badge::before,
      .input-context-note::before {
        content: "";
        width: 6px;
        height: 6px;
        flex: 0 0 auto;
        border-radius: 50%;
        background: var(--aqua);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.15);
      }
      .sb-history-item.assistant-knowledge-thread .sb-history-folder {
        display: inline-flex;
        align-items: center;
        max-width: 118px;
        border-color: rgba(74,122,255,0.24);
        background: rgba(74,122,255,0.11);
        color: var(--blue-l);
      }
      body.light .sb-history-item.assistant-knowledge-thread .sb-history-folder {
        border-color: rgba(36,87,212,0.22);
        background: rgba(36,87,212,0.08);
        color: var(--blue);
      }
      .department-assistant-context {
        display: none;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
      }
      .department-assistant-context.show,
      .department-question-chips.show { display: flex; }
      .department-question-chips {
        display: none;
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 8px;
      }
      .department-question-chip {
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: 999px;
        background: rgba(74,122,255,0.10);
        color: var(--text-soft);
        padding: 7px 10px;
        font-size: 12px;
        font-weight: 800;
        transition: all 0.16s;
      }
      .department-question-chip:hover {
        border-color: rgba(74,122,255,0.55);
        background: rgba(74,122,255,0.18);
        color: #fff;
      }
      .department-back-chat { display: none; }
      .department-back-chat.show { display: inline-flex; }
      .assistant-workspace-shell { max-width: 1040px; margin: 0 auto; }
      #view-assistant-workspace .page-scroll {
        background: #fff;
      }
      #view-assistant-workspace .assistant-workspace-shell {
        max-width: 980px;
      }
      #view-assistant-workspace .page-hd {
        margin-bottom: 20px;
      }
      #view-assistant-workspace .page-hd-row {
        align-items: flex-start;
      }
      #view-assistant-workspace .ph-sphere,
      #view-assistant-workspace .ph-line {
        display: none;
      }
      #view-assistant-workspace .ph-title {
        margin: 0;
        color: var(--text);
        font-size: 34px;
        font-weight: 560;
        letter-spacing: 0;
        line-height: 1.08;
      }
      #view-assistant-workspace .ph-sub {
        max-width: 700px;
        margin: 12px 0 0;
        color: var(--muted);
        font-size: 15px;
        font-weight: 360;
        line-height: 1.55;
      }
      .assistant-workspace-top {
        position: sticky;
        top: 0;
        z-index: 70;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        margin: 0 0 18px;
        padding: 12px;
        border: 1px solid var(--border-md);
        border-radius: 14px;
        background: rgba(255,255,255,0.96);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      .assistant-back {
        color: var(--muted);
        font-weight: 700;
        margin-right: auto;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 0 4px;
      }
      .assistant-editor {
        background: #fff;
        border: 1px solid var(--border-md);
        border-radius: 18px;
        padding: 24px;
        box-shadow: 0 16px 38px rgba(15,23,42,0.08);
      }
      .assistant-editor .form-label {
        color: var(--text);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        margin-top: 16px;
      }
      .assistant-editor .form-input,
      .assistant-editor .form-select,
      .assistant-editor .form-textarea {
        min-height: 52px;
        border-color: #d8e3f6;
        border-radius: 14px;
        background: #fff;
        color: var(--text);
        font-size: 15px;
        font-weight: 420;
      }
      .assistant-editor .form-input:focus,
      .assistant-editor .form-select:focus,
      .assistant-editor .form-textarea:focus {
        border-color: rgba(36,87,212,0.62);
        box-shadow: 0 0 0 4px rgba(36,87,212,0.12);
      }
      .assistant-editor textarea.form-textarea {
        min-height: 220px;
        line-height: 1.55;
      }
      #view-assistant-workspace .agent-card-box,
      #view-assistant-workspace .assistant-config {
        border: 1px solid var(--border-md);
        border-radius: 16px;
        background: #fff;
        box-shadow: none;
      }
      #view-assistant-workspace .agent-card-box {
        padding: 18px;
      }
      #view-assistant-workspace .form-section-title,
      #view-assistant-workspace .settings-sec-label {
        color: var(--text);
        font-weight: 700;
      }
      #view-assistant-workspace .agent-section-hint,
      #view-assistant-workspace .sr-sub {
        color: var(--muted);
        font-weight: 360;
      }
      #view-assistant-workspace .assistant-workspace-top .btn-primary,
      #view-assistant-workspace .assistant-workspace-top .btn-outline {
        min-height: 42px;
        border-radius: 12px;
        padding: 0 20px;
        font-size: 13px;
        font-weight: 700;
      }
      #view-assistant-workspace .assistant-workspace-top .btn-primary {
        background: var(--blue-ui-bg);
        box-shadow: 0 12px 24px rgba(36,87,212,0.22);
      }
      #view-assistant-workspace .assistant-workspace-top .btn-outline {
        background: #fff;
        color: var(--text);
        border-color: var(--border-md);
        box-shadow: none;
      }
      #view-assistant-workspace .assistant-workspace-top .btn-outline:hover {
        border-color: rgba(255,45,55,0.36);
        background: rgba(255,45,55,0.06);
        color: #d92d3a;
      }
      /* Dark-Theme: der Editor war oben light-only gestylt (hartes #fff) und
         wurde im Dunkelmodus weiß-auf-weiß unlesbar. */
      body:not(.light) #view-assistant-workspace .page-scroll {
        background: var(--bg);
      }
      body:not(.light) .assistant-workspace-top {
        background: var(--surface-2);
        box-shadow: 0 14px 34px rgba(0,0,0,0.35);
      }
      body:not(.light) .assistant-editor {
        background: var(--surface);
        box-shadow: var(--shadow-card);
      }
      body:not(.light) .assistant-editor .form-input,
      body:not(.light) .assistant-editor .form-select,
      body:not(.light) .assistant-editor .form-textarea {
        background: var(--surface-2);
        border-color: var(--border-md);
      }
      body:not(.light) #view-assistant-workspace .agent-card-box,
      body:not(.light) #view-assistant-workspace .assistant-config {
        background: var(--surface);
      }
      body:not(.light) #view-assistant-workspace .assistant-workspace-top .btn-outline {
        background: var(--surface-3);
        color: var(--text);
      }
      .assistant-doc-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin-top: 10px;
      }
      .assistant-doc-empty {
        margin: 4px 0 12px;
        color: var(--muted);
        font-size: 13px;
      }
      .assistant-doc-list {
        display: grid;
        gap: 8px;
        margin: 10px 0 12px;
      }
      .assistant-doc-chip {
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 48px;
        border: 1px solid rgba(36, 87, 212, 0.16);
        border-radius: 12px;
        background: rgba(36, 87, 212, 0.05);
        padding: 9px 10px 9px 12px;
      }
      .assistant-doc-chip-main {
        min-width: 0;
        flex: 1 1 auto;
      }
      .assistant-doc-chip-title {
        overflow: hidden;
        color: var(--text);
        font-size: 13.5px;
        font-weight: 650;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .assistant-doc-chip-meta {
        margin-top: 3px;
        overflow: hidden;
        color: var(--muted);
        font-size: 11.5px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .assistant-doc-index {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 5px;
        color: var(--muted);
        font-size: 11.5px;
        font-weight: 700;
      }
      .assistant-doc-index > span {
        width: 7px;
        height: 7px;
        flex: 0 0 7px;
        border-radius: 999px;
        background: currentColor;
      }
      .assistant-doc-index-ready { color: #15803d; }
      .assistant-doc-index-processing { color: var(--blue); }
      .assistant-doc-index-processing > span { animation: assistant-index-pulse 1.2s ease-in-out infinite; }
      .assistant-doc-index-error { color: #c2413b; }
      .assistant-doc-error {
        margin-top: 4px;
        color: #c2413b;
        font-size: 11px;
        line-height: 1.35;
      }
      .assistant-doc-actions {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 6px;
      }
      .assistant-doc-retry {
        min-height: 30px;
        border: 1px solid rgba(194, 65, 59, 0.28);
        border-radius: 9px;
        background: rgba(194, 65, 59, 0.08);
        color: #b73a35;
        padding: 5px 9px;
        font: inherit;
        font-size: 11.5px;
        font-weight: 750;
        cursor: pointer;
      }
      .assistant-doc-retry:hover,
      .assistant-doc-retry:focus-visible {
        border-color: rgba(194, 65, 59, 0.46);
        background: rgba(194, 65, 59, 0.14);
        outline: 0;
      }
      @keyframes assistant-index-pulse {
        0%, 100% { opacity: 0.35; transform: scale(0.85); }
        50% { opacity: 1; transform: scale(1); }
      }
      .assistant-doc-remove {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(36, 87, 212, 0.18);
        border-radius: 9px;
        background: rgba(36, 87, 212, 0.08);
        color: var(--blue);
        font: inherit;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
      }
      .assistant-doc-remove:hover,
      .assistant-doc-remove:focus-visible {
        border-color: rgba(36, 87, 212, 0.42);
        background: rgba(36, 87, 212, 0.14);
        outline: 0;
      }
      .dept-breadcrumb {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 7px;
        margin-bottom: 16px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
      }
      .dept-breadcrumb button {
        color: var(--text-soft);
        font-weight: 900;
      }
      .dept-breadcrumb button:hover { color: var(--blue-l); }
      .department-hero {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: linear-gradient(135deg, rgba(74,122,255,0.14), rgba(13,13,18,0.96));
        padding: 20px;
        box-shadow: var(--shadow-card);
        margin-bottom: 16px;
      }
      .department-hero-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        margin-bottom: 12px;
      }
      .department-hero h3 {
        color: var(--text);
        font-family: var(--font-head);
        font-size: 24px;
        line-height: 1.15;
      }
      .department-hero p {
        max-width: var(--content-max);
        color: var(--muted);
      }
      .department-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 16px;
      }
      .department-doc-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
        gap: 16px;
        align-items: start;
      }
      .department-doc-grid {
        display: grid;
        gap: 10px;
      }
      .department-doc-card {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        padding: 14px;
        box-shadow: var(--shadow-card);
      }
      .department-doc-card.is-locked {
        opacity: 0.72;
        background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(74,122,255,0.05));
      }
      .department-doc-top {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: flex-start;
      }
      .department-doc-title {
        color: var(--text);
        font-weight: 900;
        line-height: 1.25;
      }
      .department-doc-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin: 10px 0;
      }
      .department-side-panel,
      .department-locked-panel {
        border: 1px solid rgba(74,122,255,0.24);
        border-radius: var(--radius-lg);
        background: rgba(74,122,255,0.08);
        padding: 16px;
        box-shadow: var(--shadow-card);
      }
      .department-side-panel strong,
      .department-locked-panel strong {
        display: block;
        color: var(--text);
        font-size: 16px;
        line-height: 1.25;
        margin-bottom: 8px;
      }
      .department-side-panel p,
      .department-locked-panel p {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.5;
        margin-bottom: 12px;
      }
      .department-lock-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        color: #fff;
        background: linear-gradient(135deg, var(--blue), var(--aqua));
        margin-bottom: 12px;
      }
      .department-card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 14px;
      }
      .department-card {
        min-height: 178px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }
      .department-card-head {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: flex-start;
      }
      .department-card-icon {
        width: 40px;
        height: 40px;
        border-radius: 11px;
        display: grid;
        place-items: center;
        background: rgba(74,122,255,0.13);
        border: 1px solid rgba(74,122,255,0.24);
        color: var(--blue-l);
        font-weight: 900;
      }
      .department-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: auto;
      }
      .settings-profile {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 18px;
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        margin-bottom: 16px;
      }
      .settings-profile-av {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: var(--yellow);
        color: var(--navy);
        font-weight: 800;
      }
      .settings-name { font-family: var(--font-head); color: var(--navy); font-weight: 700; }
      .settings-role { color: var(--muted); font-size: 12px; }
      #view-settings {
        background: var(--bg);
      }
      body.settings-page-active #sidebar,
      body.settings-page-active #topbar,
      body.settings-page-active #mobile-bottom-nav,
      body.settings-page-active #mobile-drawer-backdrop {
        display: none !important;
      }
      body.settings-page-active #content {
        width: 100vw;
        flex: 1 1 100vw;
      }
      /* ISA-107: Einstellungen nutzen dieselbe CI wie die normale App-Navigation.
         Canvas = App-#main-Fade (kein separater blauer Verlauf mehr), Menü = opake
         Sidebar-Fläche mit gleichem Rahmen/Schatten, Breadcrumb = Topbar-Optik. */
      .settings-app-shell {
        flex: 1;
        min-height: 0;
        display: grid;
        grid-template-columns: 248px minmax(0, 1fr);
        background: linear-gradient(180deg, #161d2e 0%, #0e1320 60%, #0b0f18 100%);
        overflow: hidden;
      }
      .settings-menu {
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 18px 10px;
        border-right: 1px solid rgba(255,255,255,0.10);
        background: linear-gradient(180deg, #11151d 0%, #090c12 48%, #07090e 100%);
        box-shadow: 18px 0 46px rgba(0,0,0,0.28);
        overflow-y: auto;
      }
      .settings-menu-account {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) 28px;
        align-items: center;
        gap: 9px;
        padding: 0 8px 8px;
      }
      .settings-menu-avatar,
      .settings-account-avatar {
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        background: rgba(74,122,255,0.13);
        color: var(--aqua);
        border: 1px solid rgba(74,122,255,0.22);
        font-weight: 900;
      }
      .settings-menu-avatar {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 12px;
      }
      .settings-menu-copy {
        min-width: 0;
        line-height: 1.25;
      }
      .settings-menu-name {
        color: var(--text);
        font-size: 13px;
        font-weight: 800;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .settings-menu-role {
        color: var(--muted);
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .settings-icon-btn {
        width: 30px;
        height: 30px;
        display: inline-grid;
        place-items: center;
        border-radius: 8px;
        color: var(--muted);
        border: 1px solid transparent;
      }
      .settings-icon-btn:hover,
      .settings-icon-btn:focus-visible {
        color: var(--text);
        background: rgba(74,122,255,0.10);
        border-color: rgba(74,122,255,0.22);
        outline: 0;
      }
      .settings-back-btn {
        min-height: 38px;
        display: flex;
        align-items: center;
        gap: 9px;
        margin: 2px 4px 10px;
        padding: 9px 11px;
        border-radius: 10px;
        border: 1px solid rgba(142,164,210,0.20);
        background: rgba(17,23,34,0.72);
        color: var(--text);
        font-size: 13px;
        font-weight: 750;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
      }
      .settings-back-btn:hover {
        border-color: rgba(74,122,255,0.48);
        background: rgba(74,122,255,0.18);
        color: #fff;
      }
      .settings-menu-group {
        display: grid;
        gap: 1px;
      }
      .settings-menu-label {
        padding: 10px 10px 5px;
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 800;
        letter-spacing: 0.2px;
      }
      .settings-menu-item {
        width: 100%;
        min-height: 36px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
        border-radius: 9px;
        color: var(--text-soft);
        font-size: 13px;
        font-weight: 700;
        text-align: left;
      }
      .settings-menu-item svg {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        color: var(--txt3);
      }
      .settings-menu-item:hover {
        background: var(--accent-soft-bg);
        color: var(--text);
      }
      /* ISA-107: aktiver State wie .sb-nav-item.active in der normalen Navigation. */
      .settings-menu-item.active {
        background: var(--accent-soft-bg-strong);
        color: var(--blue-l);
      }
      .settings-menu-spacer {
        flex: 1;
        min-height: 24px;
        border-bottom: 1px solid var(--border);
      }
      .settings-footer-link {
        color: var(--text-soft);
      }
      .settings-version {
        margin-left: auto;
        color: var(--muted);
        font-family: var(--font-mono);
        font-size: 11px;
        font-weight: 600;
      }
      .settings-beta {
        border-radius: 999px;
        padding: 3px 7px;
        background: rgba(242,201,76,0.14);
        color: #f59e0b;
        font-size: 10px;
        font-weight: 900;
      }
      .settings-main {
        min-width: 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: transparent;
      }
      /* ISA-30: gleiche Marken- und Topbar-Anker wie in der App */
      .settings-brand {
        /* ISA-96: Logo deckungsgleich mit #brand-logo der App-Sidebar (14px/21.5px
           im Viewport), damit die Logo-Zurücknavigation keinen sichtbaren
           Versatz erzeugt. Menü-Inset (1px + 10px) + Padding ergeben die Zielposition. */
        margin-top: -6.5px;
        padding: 0 10px 14px 3px;
        cursor: pointer;
      }
      .settings-brand img {
        height: 26px;
        display: block;
      }
      .settings-breadcrumb-actions {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        gap: 8px;
      }
      .settings-breadcrumb {
        min-height: var(--header-h);
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 24px;
        border-bottom: 1px solid rgba(255,255,255,0.09);
        background:
          linear-gradient(180deg, rgba(17,23,34,0.98), rgba(13,17,24,0.98)),
          var(--surface);
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 700;
      }
      .settings-breadcrumb strong {
        color: var(--text);
      }
      .settings-breadcrumb-gear {
        flex: 0 0 17px;
        color: var(--muted);
      }
      .settings-breadcrumb-sep {
        width: 1px;
        height: 26px;
        background: var(--border-md);
      }
      .settings-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 32px min(6vw, 78px) 72px;
      }
      .settings-section {
        display: none;
        max-width: 1040px;
        margin: 0 auto;
      }
      .settings-section.active {
        display: block;
      }
      .settings-page-title {
        margin-top: 16px;
        color: var(--text);
        /* ISA-55: Header-Typografie an das globale Seitenmuster angleichen
           (library-page-title: font-head, 32px, normale Stärke) — Settings
           war der letzte Bereich mit abweichendem 26px/850-Titel. */
        font-family: var(--font-head);
        font-size: 32px;
        line-height: 0.96;
        letter-spacing: 0;
        font-weight: 500;
      }
      .settings-page-copy {
        margin-top: 8px;
        color: var(--muted);
        font-size: 14.5px;
        line-height: 1.55;
      }
      .settings-account-card,
      .settings-form-card,
      .settings-usage-card {
        margin-top: 26px;
        border: 1px solid rgba(142,164,210,0.18);
        border-radius: 12px;
        background: rgba(13,17,24,0.82);
        box-shadow: var(--shadow-card);
        overflow: hidden;
      }
      .settings-account-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 24px 28px;
        border-bottom: 1px solid var(--border);
      }
      .settings-account-user {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 14px;
      }
      .settings-account-avatar {
        width: 58px;
        height: 58px;
        border-radius: 14px;
      }
      .settings-account-name {
        color: var(--text);
        font-size: 17px;
        font-weight: 900;
      }
      .settings-account-email {
        color: var(--muted);
        font-size: 14px;
      }
      .settings-verified {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 9px 13px;
        border-radius: 10px;
        border: 1px solid rgba(34,197,94,0.34);
        background: rgba(34,197,94,0.10);
        color: #5fd59a;
        font-weight: 900;
        white-space: nowrap;
      }
      .settings-account-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
        padding: 22px 28px 24px;
      }
      .settings-account-stats span {
        display: block;
        color: var(--muted);
        font-size: 13px;
      }
      .settings-account-stats strong {
        display: block;
        margin-top: 3px;
        color: var(--text);
        font-size: 15px;
      }
      .settings-form-card {
        padding: 28px;
      }
      .settings-form-card.compact {
        display: grid;
        gap: 4px;
      }
      .settings-card-title-row {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        margin-bottom: 26px;
      }
      .settings-card-icon {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border-radius: 11px;
        background: rgba(255,255,255,0.06);
        color: var(--muted);
        border: 1px solid var(--border);
      }
      .settings-card-title-row h3 {
        color: var(--text);
        font-size: 17px;
        font-weight: 900;
        line-height: 1.2;
      }
      .settings-card-title-row p {
        margin-top: 5px;
        color: var(--muted);
        font-size: 14px;
      }
      .settings-form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 20px;
      }
      .settings-field {
        display: grid;
        gap: 7px;
      }
      .settings-field span {
        color: var(--text);
        font-size: 13px;
        font-weight: 900;
      }
      .settings-field input,
      .settings-field select {
        width: 100%;
        min-height: 48px;
        border-radius: 10px;
        border: 1px solid var(--border-md);
        background: var(--surface-2);
        color: var(--text);
        padding: 0 14px;
        font-size: 14px;
        font-weight: 700;
      }
      .settings-field input:focus,
      .settings-field select:focus {
        outline: 0;
        border-color: rgba(74,122,255,0.58);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.12);
      }
      .settings-actions-row {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 22px;
      }
      .settings-toggle-row {
        min-height: 66px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
      }
      .settings-toggle-row:last-child {
        border-bottom: 0;
      }
      .settings-toggle-row strong {
        display: block;
        color: var(--text);
        font-size: 14px;
      }
      .settings-toggle-row small {
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-top: 2px;
      }
      .settings-toggle-row input {
        width: 20px;
        height: 20px;
        accent-color: var(--blue);
      }
      .settings-usage-card {
        padding: 0;
      }
      .settings-usage-head {
        width: 100%;
        min-height: 62px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 18px 22px;
        color: var(--text);
        font-size: 18px;
        font-weight: 900;
      }
      .settings-usage-head span {
        display: inline-flex;
        align-items: center;
        gap: 12px;
      }
      .settings-usage-body {
        display: grid;
        gap: 14px;
        padding: 0 22px 22px 56px;
      }
      .settings-usage-body.collapsed {
        display: none;
      }
      .settings-usage-body > div,
      .settings-learn-btn {
        min-height: 34px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        color: var(--text);
        font-size: 15px;
      }
      .settings-usage-body span {
        color: var(--text-soft);
      }
      .settings-usage-body strong {
        color: var(--text);
        font-size: 16px;
      }
      .settings-learn-btn {
        justify-content: flex-start;
        width: fit-content;
        padding: 0;
        color: var(--text);
        font-weight: 900;
      }
      .settings-learn-btn:hover {
        color: var(--aqua);
      }
      .settings-usage-card.is-collapsed .settings-usage-chevron {
        transform: rotate(-90deg);
      }
      .settings-info-grid,
      .settings-kpi-grid,
      .settings-money-grid,
      .settings-usage-breakdown {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
      }
      .settings-info-tile,
      .settings-kpi,
      .settings-money-grid > div {
        min-width: 0;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(255,255,255,0.035);
        padding: 16px;
      }
      .settings-info-tile span,
      .settings-kpi span,
      .settings-money-grid span,
      .settings-usage-breakdown span {
        display: block;
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 750;
      }
      .settings-info-tile strong,
      .settings-kpi strong,
      .settings-money-grid strong,
      .settings-usage-breakdown strong {
        display: block;
        margin-top: 6px;
        color: var(--text);
        font-size: 16px;
        line-height: 1.25;
      }
      /* ISA-85: Zahlungen — Rechnungsliste, Zahlungsmethode, Checkout, PDF-Viewer */
      .billing-invoice-list {
        display: grid;
        gap: 8px;
      }
      .billing-invoice-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 14px;
        border: 1px solid var(--bdr);
        border-radius: 12px;
        background: var(--surf);
        color: var(--txt);
        text-align: left;
        cursor: pointer;
        transition: border-color .16s ease, background .16s ease;
      }
      .billing-invoice-row:hover,
      .billing-invoice-row:focus-visible {
        border-color: var(--blue);
        background: rgba(74,122,255,0.08);
        outline: 0;
      }
      .billing-invoice-row:disabled {
        cursor: default;
        opacity: .72;
      }
      .billing-invoice-row:disabled:hover {
        border-color: var(--bdr);
        background: var(--surf);
      }
      .billing-inline-error {
        padding: 11px 13px;
        border: 1px solid rgba(245, 101, 101, .42);
        border-radius: 10px;
        background: rgba(245, 101, 101, .1);
        color: var(--danger, #f56565);
        font-size: 13px;
      }
      .billing-invoice-icon {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        flex: 0 0 auto;
      }
      .billing-invoice-main {
        display: grid;
        gap: 2px;
        min-width: 0;
        flex: 1 1 auto;
      }
      .billing-invoice-main strong { font-size: 13.5px; }
      .billing-invoice-main span { font-size: 12px; color: var(--txt3); }
      .billing-invoice-amount {
        font-weight: 700;
        font-size: 13px;
        white-space: nowrap;
      }
      .billing-pm-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px;
        border: 1px solid var(--bdr);
        border-radius: 12px;
        background: var(--surf);
      }
      .billing-pm-brand {
        padding: 6px 10px;
        border-radius: 8px;
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        font-weight: 800;
        font-size: 12px;
        white-space: nowrap;
      }
      .billing-pm-main {
        display: grid;
        gap: 2px;
        flex: 1 1 auto;
        min-width: 0;
      }
      .billing-pm-main span { font-size: 12px; color: var(--txt3); }
      .billing-pm-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
      }
      .billing-checkout-summary {
        display: grid;
        gap: 10px;
        padding: 14px;
        border: 1px solid var(--bdr);
        border-radius: 12px;
        background: var(--surf);
        margin-bottom: 4px;
      }
      .billing-checkout-row {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        font-size: 13.5px;
      }
      .billing-checkout-note {
        font-size: 12px;
        color: var(--txt3);
        margin-top: 8px;
      }
      /* ISA-79: Kopfzeile der Quellenansicht — Zurück-Button + Original-PDF-Absprung */
      .source-viewer-topline {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
      }
      .billing-pdf-meta {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        font-size: 13px;
        color: var(--txt3);
      }
      .billing-pdf-viewer {
        display: grid;
        gap: 12px;
        max-height: 62vh;
        overflow: auto;
        padding: 4px;
      }
      /* ISA-111: Canvas-Größe setzt der Renderer als Inline-Style passend zur
         gerenderten Auflösung — kein CSS-Hochskalieren (width:100%) mehr. */
      .billing-pdf-viewer canvas {
        display: block;
        border: 1px solid var(--bdr);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 8px 22px rgba(0,0,0,0.08);
      }
      .pdf-viewer-pages {
        display: grid;
        gap: 12px;
        justify-items: center;
        width: max-content;
        min-width: 100%;
      }
      /* ISA-118: Wrapper je Seite trägt die Zitat-Markierung als Overlay. */
      .pdf-page { position: relative; width: max-content; }
      .pdf-quote-hit {
        position: absolute;
        background: rgba(255, 213, 79, 0.5);
        border-radius: 2px;
        pointer-events: none;
        mix-blend-mode: multiply;
      }
      .pdf-viewer-toolbar {
        position: sticky;
        top: 0;
        z-index: 2;
        justify-self: center;
        display: flex;
        align-items: center;
        gap: 8px;
        width: max-content;
        padding: 5px 7px;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        background: var(--surf);
        box-shadow: 0 6px 16px rgba(0,0,0,0.10);
      }
      .pdf-zoom-btn {
        min-width: 28px;
        height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 8px;
        border: 1px solid var(--bdr2);
        border-radius: 8px;
        background: var(--surf);
        color: var(--txt3);
        font: inherit;
        font-size: 14px;
        font-weight: 650;
        line-height: 1;
        cursor: pointer;
      }
      .pdf-zoom-btn:hover:not(:disabled),
      .pdf-zoom-btn:focus-visible {
        border-color: rgba(74,122,255,0.38);
        background: rgba(74,122,255,0.10);
        color: var(--blue);
      }
      .pdf-zoom-btn:disabled { opacity: .45; cursor: default; }
      .pdf-zoom-fit { font-size: 12.5px; }
      .pdf-zoom-level {
        min-width: 46px;
        text-align: center;
        font-family: var(--font-head);
        font-size: 12px;
        font-weight: 800;
        color: var(--txt2);
      }
      .settings-kpi strong {
        font-size: 34px;
        letter-spacing: 0;
      }
      .settings-kpi small {
        display: block;
        margin-top: 7px;
        color: var(--muted);
        font-size: 12px;
      }
      .settings-password-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
      }
      .settings-password-meter {
        height: 8px;
        margin-top: 20px;
        overflow: hidden;
        border-radius: 999px;
        background: rgba(142,164,210,0.16);
      }
      .settings-password-meter span {
        display: block;
        width: 0;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, var(--aqua), var(--blue));
        transition: width 0.18s ease;
      }
      .settings-check-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 22px;
        margin-top: 14px;
        color: var(--muted);
        font-size: 12.5px;
      }
      .settings-check-list span::before {
        content: "×";
        margin-right: 7px;
      }
      .settings-check-list span.ok { color: #4ade80; }
      .settings-check-list span.ok::before { content: "✓"; }
      body.light .settings-check-list span.ok { color: #16a34a; }
      .settings-inline-action {
        margin-top: 22px;
      }
      .settings-split-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 22px;
      }
      .settings-split-row.no-pad {
        padding: 0;
      }
      .settings-split-row h3,
      .settings-empty-panel h3,
      .settings-form-card > h3 {
        color: var(--text);
        font-size: 18px;
        font-weight: 900;
      }
      .settings-split-row p,
      .settings-empty-panel p {
        margin-top: 6px;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.5;
      }
      .settings-muted-status {
        display: inline-flex;
        margin-top: 18px;
        color: var(--muted);
        font-weight: 800;
      }
      .settings-notification-card {
        padding: 0;
        overflow: hidden;
      }
      .settings-notification-head,
      .settings-notification-row {
        display: grid;
        grid-template-columns: minmax(220px, 1fr) 110px 110px 90px;
        align-items: center;
        gap: 16px;
        min-height: 58px;
        padding: 0 24px;
        border-bottom: 1px solid var(--border);
      }
      .settings-notification-head {
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 850;
        text-transform: none;
      }
      .settings-notification-row {
        color: var(--text);
        font-size: 14px;
      }
      .settings-notification-row input {
        justify-self: center;
        width: 18px;
        height: 18px;
        accent-color: var(--aqua);
      }
      .settings-notification-group {
        display: inline-flex;
        align-items: center;
        width: fit-content;
        margin: 14px 24px 10px;
        min-height: 28px;
        padding: 4px 12px;
        border: 1px solid rgba(242,201,76,0.46);
        border-radius: 999px;
        color: #f6b44b;
        font-size: 12px;
        font-weight: 900;
      }
      .settings-notification-group.blue {
        border-color: rgba(74,122,255,0.46);
        color: #8fb0ff;
      }
      .settings-notification-group.green {
        border-color: rgba(34,197,94,0.42);
        color: #5fd59a;
      }
      .settings-notification-group.muted {
        border-color: var(--border-md);
        color: var(--muted);
      }
      .settings-plan-line,
      .settings-plan-box,
      .settings-pay-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
      }
      .settings-plan-line span,
      .settings-plan-line strong {
        color: var(--text);
        font-size: 24px;
        font-weight: 900;
      }
      .settings-meter-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        color: var(--text);
        font-size: 16px;
      }
      .settings-wide-meter {
        height: 20px;
        margin-top: 18px;
        overflow: hidden;
        border-radius: 999px;
        background: rgba(142,164,210,0.14);
      }
      .settings-wide-meter span {
        display: block;
        min-width: 12px;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, var(--aqua), var(--blue));
      }
      .settings-usage-breakdown {
        margin-top: 18px;
      }
      .settings-color-row {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
      }
      .settings-color-row button {
        position: relative;
        width: 48px;
        height: 48px;
        border-radius: 13px;
        border: 2px solid rgba(255,255,255,0.14);
        background: var(--swatch);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 10px 22px rgba(0,0,0,0.16);
        cursor: pointer;
      }
      .settings-color-row button:hover,
      .settings-color-row button:focus-visible {
        outline: 0;
        transform: translateY(-1px);
        box-shadow: 0 0 0 4px rgba(74,122,255,0.14), 0 14px 26px rgba(0,0,0,0.20);
      }
      .settings-color-row button.active {
        box-shadow: 0 0 0 3px var(--surf), 0 0 0 5px var(--swatch), 0 14px 26px rgba(0,0,0,0.20);
      }
      .settings-color-row button.active::after {
        content: "✓";
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        color: #fff;
        font-size: 19px;
        font-weight: 800;
        text-shadow: 0 1px 4px rgba(0,0,0,0.45);
      }
      body.light .settings-color-row button.active {
        box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--swatch), 0 14px 26px rgba(15,23,42,0.16);
      }
      .settings-danger-card {
        margin-top: 26px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        border: 1px solid rgba(239,68,68,0.42);
        border-radius: 12px;
        background: rgba(239,68,68,0.06);
        padding: 24px 28px;
      }
      .settings-danger-card h3 {
        color: #ff8f8f;
        font-size: 18px;
        font-weight: 900;
      }
      .settings-danger-card p {
        margin-top: 6px;
        color: var(--muted);
        font-size: 14px;
      }
      .settings-danger-card button {
        min-height: 42px;
        padding: 0 16px;
        border-radius: 10px;
        background: #dc2626;
        color: #fff;
        font-weight: 900;
      }
      /* ISA-50: Rechnungsadress-Anzeige + destruktiver Button */
      .btn-danger {
        min-height: 42px;
        padding: 0 16px;
        border-radius: 10px;
        border: 1px solid transparent;
        background: #dc2626;
        color: #fff;
        font-weight: 900;
        cursor: pointer;
      }
      .btn-danger:hover,
      .btn-danger:focus-visible {
        background: #c11f1f;
        outline: 0;
      }
      .billing-address-display {
        display: grid;
        gap: 3px;
        margin-bottom: 16px;
        color: var(--text);
        font-size: 14.5px;
      }
      .billing-address-line {
        line-height: 1.45;
      }
      .billing-address-line:first-child {
        font-weight: 900;
      }
      .billing-address-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
      }
      .settings-model-feature,
      .settings-model-row {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(255,255,255,0.035);
        padding: 16px 18px;
      }
      .settings-model-feature {
        margin-bottom: 14px;
        border-color: rgba(20,184,166,0.45);
        background: rgba(20,184,166,0.08);
      }
      .settings-model-feature.locked {
        border-color: var(--border);
        background: rgba(255,255,255,0.03);
      }
      .settings-model-logo {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border-radius: 12px;
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        font-weight: 950;
      }
      .settings-model-logo.smart,
      .settings-model-logo.local {
        color: var(--aqua);
        background: rgba(20,184,166,0.14);
      }
      .settings-model-logo.anthropic {
        color: #d89a74;
        background: rgba(216,154,116,0.14);
      }
      .settings-model-logo.google {
        color: #6ea8ff;
        background: rgba(110,168,255,0.14);
      }
      .settings-model-feature strong,
      .settings-model-row strong {
        color: var(--text);
        font-size: 15.5px;
        font-weight: 900;
      }
      .settings-model-feature p,
      .settings-model-row p {
        margin-top: 3px;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.45;
      }
      .settings-model-search {
        min-height: 46px;
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 20px 0 14px;
        border: 1px solid var(--border-md);
        border-radius: 12px;
        background: var(--surface-2);
        color: var(--muted);
        padding: 0 14px;
      }
      .settings-model-search input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--text);
        font-size: 14px;
      }
      .settings-model-list {
        display: grid;
        gap: 12px;
      }
      .settings-model-tags {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 7px;
      }
      .settings-model-tags span {
        min-height: 24px;
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        background: rgba(74,122,255,0.11);
        color: var(--blue-l);
        padding: 4px 9px;
        font-size: 11.5px;
        font-weight: 900;
      }
      .settings-model-tags span.ok {
        background: rgba(34,197,94,0.12);
        color: #5fd59a;
      }
      .settings-switch {
        width: 48px;
        height: 28px;
        border-radius: 999px;
        background: rgba(142,164,210,0.18);
        border: 1px solid var(--border);
        padding: 3px;
        cursor: pointer;
        transition: background 0.15s ease, border-color 0.15s ease;
      }
      .settings-switch span {
        display: block;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.18);
        transition: transform 0.15s ease;
      }
      /* ISA-49: funktionaler An-Zustand fuer Toggle-Pillen (z. B. Benachrichtigungen) */
      .settings-switch.on {
        background: var(--blue);
        border-color: var(--blue);
      }
      .settings-switch.on span {
        transform: translateX(20px);
      }
      .settings-switch:focus-visible {
        outline: 2px solid var(--blue);
        outline-offset: 2px;
      }
      /* ISA-49: Detail-Kategorien ausgrauen, wenn Benachrichtigungen pausiert sind */
      .settings-notify-detail.is-off {
        opacity: 0.5;
        pointer-events: none;
      }
      .settings-empty-panel {
        display: grid;
        gap: 18px;
      }
      .settings-empty-box {
        min-height: 178px;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 10px;
        border: 1px dashed var(--border-md);
        border-radius: 12px;
        background: rgba(255,255,255,0.025);
        color: var(--muted);
        text-align: center;
        padding: 28px;
      }
      .settings-empty-box strong {
        color: var(--text);
        font-size: 16px;
      }
      .settings-empty-box span {
        max-width: 680px;
        line-height: 1.5;
      }
      .settings-plan-box {
        margin-top: 16px;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 18px;
        background: rgba(255,255,255,0.035);
      }
      .settings-plan-box strong,
      .settings-plan-box span {
        display: block;
      }
      .settings-plan-box strong {
        color: var(--text);
        font-size: 18px;
        font-weight: 900;
      }
      .settings-plan-box span {
        margin-top: 4px;
        color: var(--muted);
      }
      .settings-pay-row {
        margin-top: 18px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(255,255,255,0.03);
        padding: 18px;
      }
      .settings-status-snapshot {
        margin-top: 22px;
        color: var(--muted);
        font-size: 13px;
      }
      .settings-inner-label {
        margin-top: 24px;
      }
      /* ISA-107: Light-CI der Einstellungen = normale App-Navigation
         (Sidebar #f4f8ff, Canvas #eef4ff, Topbar-Fläche halbtransparent weiß). */
      body.light .settings-menu {
        background: #f4f8ff;
        border-color: #d6dfef;
        box-shadow: none;
      }
      body.light #view-settings,
      body.light .settings-app-shell {
        background: #eef4ff;
      }
      body.light .settings-main {
        background: transparent;
      }
      body.light .settings-breadcrumb {
        background: rgba(248,251,255,0.92);
        border-bottom-color: #d6dfef;
      }
      body.light .settings-account-card,
      body.light .settings-form-card,
      body.light .settings-usage-card {
        background: #fff;
        border-color: #dfe7f5;
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .settings-info-tile,
      body.light .settings-kpi,
      body.light .settings-money-grid > div,
      body.light .settings-model-feature,
      body.light .settings-model-row,
      body.light .settings-plan-box,
      body.light .settings-pay-row,
      body.light .settings-empty-box {
        background: #fbfdff;
        border-color: #dfe7f5;
      }
      body.light .settings-danger-card {
        background: #fffafa;
      }
      body.light .settings-account-head {
        border-bottom-color: #dfe7f5;
      }
      body.light .settings-back-btn {
        background: #fff;
        border-color: #dfe7f5;
        color: var(--text);
        box-shadow: 0 8px 18px rgba(15,23,42,0.06);
      }
      body.light .settings-back-btn:hover,
      body.light .settings-back-btn:focus-visible {
        background: #f7faff;
        border-color: rgba(36,87,212,0.36);
        color: var(--blue);
        outline: 0;
      }
      body.light .settings-card-icon {
        background: #f1f5f9;
      }
      body.light .settings-verified {
        color: #12805c;
        background: #ecfdf5;
      }
      body.light .settings-field input,
      body.light .settings-field select {
        background: #fff;
      }
      @media (max-width: 1180px) {
        .settings-app-shell {
          grid-template-columns: 224px minmax(0, 1fr);
        }
        .settings-content {
          padding: 28px 24px 68px;
        }
        .settings-account-stats {
          grid-template-columns: 1fr;
        }
        .settings-form-grid,
        .settings-info-grid,
        .settings-password-grid,
        .settings-kpi-grid,
        .settings-money-grid,
        .settings-usage-breakdown {
          grid-template-columns: 1fr;
        }
        .settings-notification-head,
        .settings-notification-row {
          grid-template-columns: minmax(180px, 1fr) 74px 74px 56px;
        }
        .settings-model-feature,
        .settings-model-row {
          grid-template-columns: 42px minmax(0, 1fr);
        }
        .settings-model-feature > .chip,
        .settings-model-feature > .settings-switch,
        .settings-model-row > .settings-model-tags,
        .settings-model-row > .settings-switch {
          grid-column: 2;
          justify-self: start;
        }
      }
      @media (max-width: 760px) {
        body.settings-page-active {
          overflow: hidden;
        }
        .settings-app-shell {
          display: flex;
          flex-direction: column;
          min-height: 100dvh;
          overflow: hidden;
          padding-bottom: 0;
        }
        .settings-menu {
          flex: 0 0 auto;
          max-height: 46dvh;
          border-right: 0;
          border-bottom: 1px solid rgba(142,164,210,0.18);
          padding: 14px 14px 12px;
          background: rgba(13,17,24,0.86);
        }
        .settings-menu-account {
          grid-template-columns: 34px minmax(0, 1fr) 28px;
          padding: 0 4px 8px;
        }
        .settings-menu-avatar {
          width: 34px;
          height: 34px;
        }
        .settings-back-btn {
          margin: 2px 0 8px;
          min-height: 36px;
          padding: 8px 10px;
        }
        .settings-menu-group {
          grid-template-columns: 1fr;
        }
        .settings-menu-label {
          padding: 8px 4px 4px;
        }
        .settings-menu-item {
          min-height: 34px;
          padding: 7px 9px;
          font-size: 12.5px;
        }
        .settings-menu-spacer {
          display: none;
        }
        .settings-main {
          flex: 1 1 auto;
          min-height: 0;
          overflow: hidden;
        }
        .settings-breadcrumb {
          padding-left: 14px;
          padding-right: 14px;
        }
        .settings-content {
          overflow-y: auto;
          padding: 22px 14px 32px;
        }
        .settings-page-title {
          font-size: 22px;
        }
        .settings-page-copy {
          font-size: 13.5px;
        }
        .settings-account-head {
          align-items: flex-start;
          flex-direction: column;
        }
        .settings-verified {
          width: 100%;
          justify-content: center;
        }
        .settings-form-card,
        .settings-danger-card {
          padding: 20px;
        }
        .settings-split-row,
        .settings-plan-line,
        .settings-plan-box,
        .settings-pay-row,
        .settings-danger-card {
          align-items: stretch;
          flex-direction: column;
        }
        .settings-notification-head {
          display: none;
        }
        .settings-notification-row {
          grid-template-columns: minmax(0, 1fr) 46px 46px 46px;
          gap: 8px;
          padding: 12px 16px;
          font-size: 13px;
        }
        .settings-notification-row::before {
          content: "App  Mail  Aus";
          grid-column: 2 / 5;
          grid-row: 1;
          color: var(--muted);
          font-size: 10px;
          word-spacing: 12px;
        }
        .settings-notification-row span {
          grid-row: 1 / span 2;
          align-self: center;
        }
        .settings-notification-row input {
          grid-row: 2;
        }
        .settings-model-tags {
          justify-content: flex-start;
        }
        .settings-empty-box {
          min-height: 150px;
          padding: 22px 16px;
        }
        .settings-kpi strong {
          font-size: 28px;
        }
        body.light .settings-menu {
          background: #fff;
          border-bottom-color: #dfe7f5;
        }
        .settings-actions-row {
          flex-direction: column;
        }
        .settings-actions-row .btn-primary,
        .settings-actions-row .btn-secondary {
          width: 100%;
          justify-content: center;
        }
        .settings-usage-body {
          padding-left: 22px;
        }
      }
      .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
      .metric-card { background: var(--surface); border: 1px solid var(--border-md); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-card); }
      .metric-value { font-family: var(--font-head); color: var(--navy); font-size: 24px; font-weight: 800; line-height: 1; }
      .metric-label { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
      .split-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 16px; align-items: start; }
      .analysis-box, .decision-card, .task-card, .insight-panel {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 18px;
        box-shadow: var(--shadow-card);
      }
      .analysis-result { margin-top: 14px; display: none; }
      .analysis-result.show { display: block; }
      .analysis-result .settings-row {
        align-items: center;
        gap: 16px;
      }
      .analysis-result .settings-row > div:first-child {
        min-width: 0;
      }
      .confidence-ring {
        width: 58px;
        height: 58px;
        min-width: 58px;
        flex: 0 0 58px;
        aspect-ratio: 1;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: conic-gradient(var(--blue) 0 86%, var(--blue-soft) 86% 100%);
        color: var(--navy);
        font-weight: 900;
        font-family: var(--font-head);
      }
      .decision-lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
      .decision-lane { background: rgba(255,255,255,0.58); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-height: 220px; }
      .lane-title { font-family: var(--font-head); font-size: 12px; color: var(--navy); font-weight: 800; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
      .decision-card { margin-bottom: 10px; padding: 14px; }
      .decision-meta, .task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
      .chip { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-size: 10.5px; font-weight: 800; }
      .chip.warn { background: rgba(255,115,104,0.13); color: #c24134; }
      .chip.ok { background: rgba(74,222,128,0.15); color: #16834a; }
      .chip.source-chip {
        gap: 5px;
        max-width: 100%;
        border: 1px solid transparent;
        white-space: nowrap;
      }
      button.chip.source-chip {
        cursor: pointer;
      }
      button.chip.source-chip:hover,
      .chip.source-chip.selected {
        border-color: rgba(74,122,255,0.42);
        background: rgba(74,122,255,0.18);
        color: var(--aqua);
      }
      .task-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
      .task-card.done { opacity: 0.6; }
      .library-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 18px;
      }
      .library-actions > button {
        min-width: 192px;
        min-height: 44px;
        justify-content: center;
        margin-bottom: 0;
      }
      .library-actions > .btn-secondary {
        padding: 10px 20px;
        font-size: 13px;
        font-weight: 700;
        border-radius: var(--radius-md);
      }
      .prompt-search {
        min-height: 44px;
        background: var(--surf);
        border-color: var(--bdr2);
        color: var(--txt);
      }
      .pg-card.is-hidden { display: none; }
      /* ISA-43: Prompts spiegeln die gruppierte Skills-Bibliothek – der Grid ist
         der Accordion-Wrapper (wie .skills-groups), Karten liegen in skill-group-Bodies. */
      #prompt-card-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        align-items: stretch;
      }
      /* ISA-43: Prompt-Gruppen nutzen die skill-group-Optik; overflow muss aber
         sichtbar bleiben, damit das Karten-Kontextmenue (Dropdown) nicht an der
         Gruppen-Grenze abgeschnitten wird (Skills-Rows hatten kein Dropdown). */
      .skill-group.prompt-group { overflow: visible; }
      .skill-group.prompt-group-empty { display: none; }
      /* ISA-43 Fail-Safe (20260624b): Sollte – aus welchem Grund auch immer
         (alter Cache, abgebrochenes Re-Grouping, Race vor JS, grid.prepend beim
         Erstellen) – #prompt-card-grid direkte .pg-card-Kinder enthalten statt
         der gruppierten .skill-group-Box, faellt der Grid SELBST auf die
         Skills-Group-Box-Optik zurueck: Rahmen, Radius, Hintergrund, volle
         Breite und ein echter, sichtbarer "Offiziell"-Header
         (.prompt-grid-fallback-head). So entstehen nie wieder lose Einzelkarten
         mit Abstand ausserhalb einer Box. Im Normalfall (Karten liegen in der
         Gruppen-Box) greift :has(> .pg-card) nicht – kein doppelter Rahmen. */
      #prompt-card-grid > .prompt-grid-fallback-head { display: none; }
      #prompt-card-grid:has(> .pg-card:not(#prompt-search-empty)) {
        border: 1px solid var(--bdr2);
        border-radius: 18px;
        background: var(--surf);
        overflow: hidden;
        gap: 0;
      }
      #prompt-card-grid:has(> .pg-card:not(#prompt-search-empty)) > .prompt-grid-fallback-head {
        display: flex;
        width: 100%;
        min-height: 58px;
        align-items: center;
        gap: 12px;
        padding: 0 18px;
        border-bottom: 1px solid var(--bdr2);
        color: var(--txt);
        font-weight: 850;
        text-align: left;
      }
      #prompt-card-grid > .prompt-grid-fallback-head .skill-group-count { margin-left: auto; }
      #prompt-card-grid:has(> .pg-card:not(#prompt-search-empty)) > .pg-card {
        margin: 12px 14px 0;
      }
      #prompt-card-grid:has(> .pg-card:not(#prompt-search-empty)) > .pg-card:last-child {
        margin-bottom: 14px;
      }
      #prompt-card-grid .prompt-template-card {
        position: relative;
        min-height: 0;
        display: grid;
        grid-template-columns: 62px minmax(0, 1fr) auto;
        gap: 16px;
        align-items: center;
        padding: 16px;
        border: 1px solid var(--bdr2);
        border-radius: 16px;
        background: var(--surf2);
        cursor: pointer;
        overflow: visible;
        transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      #prompt-card-grid .prompt-template-card:hover,
      #prompt-card-grid .prompt-template-card:focus-visible {
        border-color: rgba(74,122,255,0.46);
        transform: translateY(-1px);
        box-shadow: 0 14px 34px rgba(36,87,212,0.12);
        outline: 0;
      }
      .prompt-row-main { min-width: 0; }
      /* ISA-39: Karte mit offenem Kontextmenue ueber die Nachbarkarten heben, damit
         das Dropdown nicht teilweise unter der naechsten Karte liegt. */
      #prompt-card-grid .prompt-template-card.prompt-menu-open {
        z-index: 60;
      }
      .prompt-card-top {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr);
        align-items: flex-start;
        gap: 12px;
      }
      .prompt-card-doc-icon {
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        border-radius: 13px;
        display: grid;
        place-items: center;
        background: var(--blue-soft);
        color: var(--blue);
      }
      .prompt-card-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
      }
      .prompt-card-topic-pill {
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        padding: 2px 11px;
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: 999px;
        background: rgba(74,122,255,0.08);
        color: var(--blue-l);
        font-size: 12px;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
      }
      .prompt-card-menu-wrap {
        grid-column: 3;
      }
      .prompt-card-icon-btn {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: transparent;
        color: var(--txt3);
        cursor: pointer;
        transition: background .16s ease, color .16s ease;
      }
      .prompt-card-icon-btn:hover,
      .prompt-card-icon-btn:focus-visible {
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        outline: 0;
      }
      .prompt-card-body {
        min-height: 104px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 10px;
      }
      #prompt-card-grid .prompt-template-card .pg-card-title {
        margin: 0;
        color: var(--txt);
        font-size: 19px;
        font-weight: 900;
        line-height: 1.25;
      }
      #prompt-card-grid .prompt-template-card .pg-card-sub {
        margin: 6px 0 10px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: var(--txt2);
        font-size: 15px;
        font-weight: 400;
        line-height: 1.45;
      }
      .prompt-card-footer {
        margin-top: auto;
        padding-top: 14px;
        border-top: 1px solid var(--border-md);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: nowrap;
      }
      .prompt-card-meta {
        min-width: 0;
        display: grid;
        gap: 5px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.2;
      }
      .prompt-card-meta span {
        display: inline-flex;
        align-items: center;
        gap: 7px;
      }
      .prompt-card-meta .prompt-card-topic-pill {
        justify-self: start;
        max-width: min(132px, 100%);
        min-height: auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
      }
      .prompt-use-btn {
        min-height: 38px;
        border: 0;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 16px;
        background: var(--blue);
        color: #fff;
        font-size: 13.5px;
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        box-shadow: 0 8px 18px rgba(36,87,212,0.22);
        transition: background .16s ease, box-shadow .16s ease;
      }
      .prompt-use-btn span {
        min-width: 0;
        white-space: nowrap;
      }
      .prompt-use-btn svg {
        width: 16px;
        height: 16px;
        stroke-width: 2;
      }
      .prompt-use-btn:hover,
      .prompt-use-btn:focus-visible {
        background: var(--aqua);
        box-shadow: 0 10px 22px rgba(36,87,212,0.28);
        outline: 0;
      }
      .prompt-card-menu-wrap {
        position: relative;
        min-width: 0;
      }
      .prompt-card-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 140;
        width: 206px;
        padding: 10px 0;
        border: 1px solid var(--border-md);
        border-radius: 16px;
        background: var(--surface);
        box-shadow: 0 18px 34px rgba(15,23,42,0.18);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-4px);
        transition: opacity .16s ease, transform .16s ease;
      }
      .prompt-card-menu-wrap.open .prompt-card-menu {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
      }
      .prompt-card-menu button {
        width: 100%;
        min-height: 46px;
        border: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 18px;
        background: transparent;
        color: var(--txt);
        font: inherit;
        font-size: 15px;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
      }
      .prompt-card-menu button:hover,
      .prompt-card-menu button:focus-visible {
        background: rgba(7,19,61,0.06);
      }
      .prompt-card-menu button.danger {
        margin-top: 8px;
        border-top: 1px solid var(--border-md);
        color: #ff2d37;
      }
      /* ISA-43: schmale Breiten – Aktionen unter die Zeile umbrechen */
      @media (max-width: 680px) {
        #prompt-card-grid .prompt-template-card {
          grid-template-columns: 50px minmax(0, 1fr);
          row-gap: 12px;
        }
        #prompt-card-grid .prompt-template-card .prompt-card-actions {
          grid-column: 1 / -1;
          justify-content: flex-end;
          flex-wrap: wrap;
        }
      }
      .prompt-editor-scroll {
        padding: 0;
        background: var(--surface);
      }
      .prompt-editor-topbar {
        position: sticky;
        top: 0;
        z-index: 80;
        min-height: 66px;
        display: flex;
        align-items: center;
        gap: 18px;
        padding: 0 36px;
        border-bottom: 1px solid var(--border-md);
        background: var(--surface);
        box-shadow: 0 10px 24px rgba(15,23,42,0.04);
        color: var(--muted);
      }
      .prompt-editor-back {
        width: 42px;
        height: 42px;
        border: 0;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: transparent;
        color: var(--text);
        cursor: pointer;
      }
      .prompt-editor-back:hover,
      .prompt-editor-back:focus-visible {
        background: rgba(7,19,61,0.06);
      }
      .prompt-editor-sep {
        width: 1px;
        height: 34px;
        background: var(--border-md);
      }
      .prompt-editor-crumb {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
        font-weight: 500;
      }
      .prompt-editor-crumb strong {
        min-width: 0;
        max-width: 280px;
        color: var(--text);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .prompt-editor-actions {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 16px;
      }
      .prompt-editor-save-state {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #41c463;
        font-size: 14px;
        font-weight: 500;
      }
      .prompt-editor-save-btn {
        border: 0;
        cursor: pointer;
        background: var(--blue-ui-bg);
        box-shadow: 0 12px 26px rgba(36, 87, 212, 0.26);
      }
      .prompt-editor-save-state.is-saving {
        color: var(--muted);
      }
      .prompt-editor-dot {
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: currentColor;
      }
      .prompt-editor-layout {
        min-height: calc(100vh - 66px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
      }
      .prompt-editor-main {
        min-width: 0;
        padding: 66px 56px 38px;
        border-right: 1px solid var(--border-md);
      }
      .prompt-editor-title-input {
        width: 100%;
        border: 1px solid var(--border-md);
        border-radius: 14px;
        padding: 12px 16px;
        background: rgba(255,255,255,0.72);
        color: var(--text);
        font-family: var(--font-head);
        font-size: 26px;
        font-weight: 650;
        line-height: 1.2;
        outline: none;
      }
      .prompt-editor-title-input:focus {
        border-color: rgba(36, 87, 212, 0.62);
        box-shadow: 0 0 0 4px rgba(36, 87, 212, 0.14);
      }
      .prompt-editor-category {
        appearance: none;
        -webkit-appearance: none;
        width: auto;
        min-width: 196px;
        min-height: 40px;
        margin-top: 22px;
        padding: 0 36px 0 14px;
        border: 1px solid rgba(36, 87, 212, 0.16);
        border-radius: 12px;
        background-color: rgba(36, 87, 212, 0.08);
        background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%232457d4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 16px 16px;
        color: var(--blue);
        font-size: 14px;
        font-weight: 600;
        outline: 0;
        cursor: pointer;
      }
      .prompt-editor-category:hover {
        border-color: rgba(36, 87, 212, 0.30);
        background-color: rgba(36, 87, 212, 0.12);
      }
      .prompt-editor-category:focus,
      .prompt-editor-category:focus-visible {
        border-color: rgba(36, 87, 212, 0.62);
        box-shadow: 0 0 0 4px rgba(36, 87, 212, 0.14);
      }
      .prompt-editor-description {
        width: 100%;
        min-height: 76px;
        margin-top: 20px;
        border: 1px solid var(--border-md);
        border-radius: 14px;
        padding: 12px 16px;
        resize: vertical;
        background: rgba(255,255,255,0.72);
        color: var(--txt2);
        font: inherit;
        font-size: 15px;
        line-height: 1.5;
        outline: none;
      }
      .prompt-editor-description:focus {
        border-color: rgba(36, 87, 212, 0.62);
        box-shadow: 0 0 0 4px rgba(36, 87, 212, 0.14);
      }
      .prompt-editor-description::placeholder,
      .prompt-editor-textarea::placeholder {
        color: rgba(17,24,39,0.34);
      }
      .prompt-editor-divider {
        height: 1px;
        margin: 14px 0 34px;
        background: var(--border-md);
      }
      .prompt-editor-field-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 14px;
      }
      .prompt-editor-field-head label {
        color: var(--text);
        font-size: 17px;
        font-weight: 650;
      }
      .prompt-editor-field-head button {
        border: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: transparent;
        color: var(--muted);
        font-size: 14px;
        font-weight: 550;
        cursor: pointer;
      }
      .prompt-editor-field-head button span {
        font-family: var(--font-mono);
        color: var(--text);
      }
      .prompt-editor-textarea {
        width: 100%;
        min-height: 430px;
        border: 1.5px solid rgba(36, 87, 212, 0.32);
        border-radius: 16px;
        padding: 24px;
        resize: vertical;
        background: rgba(255,255,255,0.72);
        color: var(--text);
        font-family: var(--font-mono);
        font-size: 16px;
        line-height: 1.65;
        outline: none;
      }
      .prompt-editor-textarea:focus {
        border-color: rgba(36, 87, 212, 0.70);
        box-shadow: 0 0 0 4px rgba(36, 87, 212, 0.14);
      }
      .prompt-editor-foot {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 12px;
        color: rgba(17,24,39,0.42);
        font-size: 13px;
      }
      .prompt-editor-side {
        min-width: 0;
        padding: 54px 32px 38px;
        background: var(--surface);
      }
      .prompt-editor-side-title {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 22px;
        color: var(--text);
        font-size: 18px;
        font-weight: 650;
      }
      .prompt-editor-side-title span {
        width: 18px;
        height: 18px;
        border: 1px solid var(--muted);
        border-radius: 999px;
        display: grid;
        place-items: center;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
      }
      .prompt-variable-box {
        min-height: 356px;
        border: 1px dashed var(--border-md);
        border-radius: 18px;
        padding: 18px;
      }
      .prompt-variable-empty {
        height: 100%;
        min-height: 318px;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 16px;
        text-align: center;
        color: rgba(17,24,39,0.42);
      }
      .prompt-variable-empty div {
        font-family: var(--font-mono);
        font-size: 38px;
        font-weight: 700;
      }
      .prompt-variable-empty p {
        max-width: 250px;
        margin: 0;
        font-size: 15px;
        line-height: 1.45;
      }
      .prompt-variable-empty code,
      .prompt-variable-row code,
      .prompt-predefined-menu code {
        border-radius: 7px;
        padding: 3px 7px;
        background: rgba(7,19,61,0.06);
        color: var(--text);
        font-family: var(--font-mono);
      }
      .prompt-variable-list {
        display: grid;
        gap: 10px;
      }
      .prompt-variable-row {
        min-height: 54px;
        border: 1px solid var(--border-md);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 12px;
        background: rgba(255,255,255,0.66);
        color: var(--muted);
        cursor: pointer;
      }
      body:not(.light) .prompt-editor-scroll {
        background:
          radial-gradient(circle at 22% 0%, rgba(36, 87, 212, 0.14), transparent 36%),
          var(--bg);
        color: var(--text);
      }
      body:not(.light) .prompt-editor-topbar {
        border-bottom-color: rgba(148, 163, 184, 0.18);
        background: rgba(13, 17, 24, 0.94);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
      }
      body:not(.light) .prompt-editor-back:hover,
      body:not(.light) .prompt-editor-back:focus-visible {
        background: rgba(148, 163, 184, 0.10);
      }
      body:not(.light) .prompt-editor-main {
        border-right-color: rgba(148, 163, 184, 0.16);
      }
      body:not(.light) .prompt-editor-category {
        border-color: rgba(74, 122, 255, 0.26);
        background-color: rgba(74, 122, 255, 0.12);
        color: var(--blue-l);
      }
      body:not(.light) .prompt-editor-title-input,
      body:not(.light) .prompt-editor-description {
        border-color: rgba(148, 163, 184, 0.20);
        background: rgba(17, 23, 34, 0.44);
      }
      body:not(.light) .prompt-editor-title-input {
        color: var(--text);
      }
      body:not(.light) .prompt-editor-description {
        color: var(--text-soft);
      }
      body:not(.light) .prompt-editor-title-input:focus,
      body:not(.light) .prompt-editor-description:focus {
        border-color: rgba(74, 122, 255, 0.62);
        box-shadow: 0 0 0 4px rgba(74, 122, 255, 0.14);
      }
      body:not(.light) .prompt-editor-description::placeholder,
      body:not(.light) .prompt-editor-textarea::placeholder {
        color: rgba(216, 222, 238, 0.42);
      }
      body:not(.light) .prompt-editor-divider {
        background: rgba(148, 163, 184, 0.18);
      }
      body:not(.light) .prompt-editor-field-head button {
        color: var(--text-soft);
      }
      body:not(.light) .prompt-editor-field-head button span {
        color: #8fb0ff;
      }
      body:not(.light) .prompt-editor-textarea {
        border-color: rgba(74, 122, 255, 0.42);
        background: linear-gradient(180deg, rgba(17, 23, 34, 0.96), rgba(13, 17, 24, 0.98));
        color: var(--text);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 40px rgba(0, 0, 0, 0.20);
      }
      body:not(.light) .prompt-editor-textarea:focus {
        border-color: rgba(74, 122, 255, 0.72);
        box-shadow: 0 0 0 4px rgba(74, 122, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
      }
      body:not(.light) .prompt-editor-foot {
        color: rgba(216, 222, 238, 0.52);
      }
      body:not(.light) .prompt-editor-side {
        background: rgba(13, 17, 24, 0.86);
      }
      body:not(.light) .prompt-variable-box {
        border-color: rgba(148, 163, 184, 0.24);
        background: rgba(17, 23, 34, 0.44);
      }
      body:not(.light) .prompt-variable-empty {
        color: rgba(216, 222, 238, 0.52);
      }
      body:not(.light) .prompt-variable-empty code,
      body:not(.light) .prompt-variable-row code,
      body:not(.light) .prompt-predefined-menu code {
        background: rgba(148, 163, 184, 0.12);
        color: var(--text);
      }
      body:not(.light) .prompt-variable-row {
        border-color: rgba(148, 163, 184, 0.18);
        background: rgba(17, 23, 34, 0.78);
        color: var(--text-soft);
      }
      /* ISA-81: eigene Prompt-Variablen — Formular + Liste in der Variablen-Sidebar */
      .prompt-custom-vars {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid var(--border-md);
      }
      .prompt-custom-vars h3 {
        margin: 0 0 4px;
        font-size: 14px;
      }
      .prompt-custom-vars > p {
        margin: 0 0 12px;
        font-size: 12.5px;
        color: var(--txt3);
      }
      .prompt-custom-var-form {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
      }
      .prompt-custom-var-form .form-input {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 38px;
      }
      .prompt-custom-var-form .btn-primary {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0 14px;
      }
      .prompt-custom-var-list {
        display: grid;
        gap: 8px;
      }
      .prompt-custom-var-row {
        display: flex;
        align-items: stretch;
        gap: 6px;
      }
      .prompt-custom-var-row .prompt-variable-row {
        flex: 1 1 auto;
        min-width: 0;
      }
      .prompt-custom-var-delete {
        flex: 0 0 auto;
        width: 34px;
        border: 1px solid var(--bdr);
        border-radius: 10px;
        background: transparent;
        color: var(--txt3);
        display: grid;
        place-items: center;
        cursor: pointer;
        transition: color .15s ease, border-color .15s ease;
      }
      .prompt-custom-var-delete:hover,
      .prompt-custom-var-delete:focus-visible {
        color: #e5484d;
        border-color: rgba(229, 72, 77, 0.4);
        outline: 0;
      }
      .prompt-custom-var-empty {
        margin: 0;
        font-size: 12.5px;
        color: var(--txt3);
      }
      .prompt-predefined {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid var(--border-md);
      }
      .prompt-predefined h3 {
        margin: 0 0 8px;
        color: var(--text);
        font-size: 18px;
        font-weight: 650;
      }
      .prompt-predefined p {
        margin: 0 0 18px;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.45;
      }
      .prompt-predefined-wrap {
        position: relative;
      }
      .prompt-predefined-trigger {
        width: 100%;
        min-height: 48px;
        border: 1px solid var(--border-md);
        border-radius: 12px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 14px;
        background: var(--surface);
        color: var(--text);
        font-size: 14px;
        font-weight: 650;
        cursor: pointer;
      }
      .prompt-predefined-trigger span {
        min-width: 0;
        flex: 1;
        text-align: left;
      }
      .prompt-predefined-menu {
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 10px);
        z-index: 180;
        max-height: min(520px, 70vh);
        overflow: auto;
        border: 1px solid var(--border-md);
        border-radius: 16px;
        background: var(--surface);
        box-shadow: 0 18px 36px rgba(15,23,42,0.18);
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity .16s ease, transform .16s ease;
      }
      .prompt-predefined-wrap.open .prompt-predefined-menu {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
      }
      .prompt-predefined-group {
        padding: 16px 18px;
      }
      .prompt-predefined-group + .prompt-predefined-group {
        border-top: 1px solid var(--border-md);
      }
      .prompt-predefined-group-title {
        display: flex;
        align-items: center;
        gap: 9px;
        margin-bottom: 12px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
        letter-spacing: .04em;
      }
      .prompt-predefined-menu button {
        width: 100%;
        border: 0;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        padding: 10px 0;
        background: transparent;
        color: var(--text);
        text-align: left;
        cursor: pointer;
      }
      .prompt-predefined-menu button strong,
      .prompt-predefined-menu button small {
        display: block;
      }
      .prompt-predefined-menu button strong {
        font-size: 14px;
        font-weight: 650;
      }
      .prompt-predefined-menu button small {
        margin-top: 4px;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.4;
      }
      @media (max-width: 900px) {
        .prompt-editor-scroll {
          padding-bottom: 86px;
        }
        .prompt-editor-topbar {
          padding: 0 18px;
          gap: 12px;
        }
        .prompt-editor-save-state {
          display: none;
        }
        .prompt-editor-layout {
          grid-template-columns: 1fr;
        }
        .prompt-editor-main {
          padding: 42px 22px 26px;
          border-right: 0;
        }
        .prompt-editor-title-input {
          font-size: 23px;
        }
        .prompt-editor-side {
          padding: 24px 22px 32px;
          border-top: 1px solid var(--border-md);
        }
        .prompt-editor-textarea {
          min-height: 360px;
        }
      }
      .library-page-scroll {
        max-width: 1180px;
      }
      .library-panel {
        display: grid;
        gap: 22px;
      }
      .library-panel[hidden] {
        display: none;
      }
      .library-page-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 18px;
        align-items: start;
      }
      .library-kicker {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--txt3);
        font-size: 12.5px;
        font-weight: 800;
        margin-bottom: 18px;
      }
      .library-kicker strong {
        color: var(--txt);
      }
      .library-page-title {
        margin: 0 0 14px;
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 32px;
        line-height: 0.96;
        letter-spacing: 0;
      }
      .library-page-sub {
        max-width: 820px;
        margin: 0;
        color: var(--txt2);
        font-size: 18px;
        line-height: 1.55;
      }
      .library-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
      }
      .library-toolbar.skills-toolbar {
        justify-content: start;
      }
      .library-select,
      .library-search {
        min-height: 46px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        color: var(--txt);
        padding: 0 15px;
        font: inherit;
        font-weight: 650;
      }
      .library-search {
        font-weight: 500;
        flex: 1 1 260px;
      }
      .library-select {
        flex: 0 1 190px;
      }
      .library-native-select {
        display: none;
      }
      .library-dropdown {
        position: relative;
        flex: 0 1 210px;
        min-width: 190px;
        z-index: 20;
      }
      .library-dropdown.open {
        z-index: 80;
      }
      .library-dropdown-trigger {
        width: 100%;
        min-height: 46px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        color: var(--txt);
        padding: 0 42px 0 15px;
        font: inherit;
        font-weight: 650;
        text-align: left;
        cursor: pointer;
        position: relative;
        transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
      }
      .library-dropdown-trigger::after {
        content: "";
        position: absolute;
        right: 15px;
        top: 50%;
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-65%) rotate(45deg);
        opacity: .75;
        transition: transform .18s ease;
      }
      .library-dropdown.open .library-dropdown-trigger {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
      }
      .library-dropdown.open .library-dropdown-trigger::after {
        transform: translateY(-35%) rotate(225deg);
      }
      .library-dropdown-menu {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        width: max(100%, 260px);
        max-height: min(390px, 58vh);
        overflow: auto;
        display: none;
        padding: 8px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: var(--shadow-soft);
      }
      .library-dropdown.open .library-dropdown-menu {
        display: grid;
        gap: 2px;
      }
      .library-dropdown-option {
        width: 100%;
        min-height: 42px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--txt);
        padding: 0 12px 0 38px;
        font: inherit;
        font-size: 15px;
        font-weight: 560;
        text-align: left;
        cursor: pointer;
        position: relative;
      }
      .library-dropdown-option::before {
        content: "";
        position: absolute;
        left: 13px;
        top: 50%;
        width: 12px;
        height: 7px;
        border-left: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-70%) rotate(-45deg);
        opacity: 0;
      }
      .library-dropdown-option.active {
        background: var(--surf2);
      }
      .library-dropdown-option.active::before {
        opacity: 1;
      }
      .library-dropdown-option:hover,
      .library-dropdown-option:focus-visible {
        background: color-mix(in srgb, var(--blue) 14%, var(--surf2));
        outline: 0;
      }
      .library-view-toggle {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 4px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
      }
      .library-view-toggle button {
        width: 36px;
        height: 34px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--txt3);
        display: grid;
        place-items: center;
        cursor: pointer;
      }
      .library-view-toggle button.active,
      .library-view-toggle button:hover {
        background: var(--surf2);
        color: var(--blue-l);
      }
      .library-section-head {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 16px;
      }
      .library-section-title {
        margin: 0;
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 26px;
        letter-spacing: 0;
      }
      .library-section-sub {
        margin: 6px 0 0;
        color: var(--txt3);
        font-size: 15px;
        line-height: 1.45;
      }
      .library-count {
        color: var(--txt3);
        font-size: 15px;
        white-space: nowrap;
      }
      .library-section-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        flex-wrap: wrap;
      }
      .library-section-actions .btn-secondary {
        min-height: 42px;
        padding: 0 16px;
        border-radius: 14px;
        font-weight: 850;
      }
      .library-empty-state {
        min-height: 280px;
        display: grid;
        place-items: center;
        text-align: center;
        padding: 32px;
        border: 1px dashed var(--bdr2);
        border-radius: 18px;
        background: rgba(255,255,255,0.03);
      }
      .library-empty-icon {
        width: 54px;
        height: 54px;
        margin: 0 auto 16px;
        border-radius: 16px;
        display: grid;
        place-items: center;
        background: var(--surf2);
        color: var(--txt3);
      }
      .library-empty-title {
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 20px;
        font-weight: 850;
        margin-bottom: 8px;
      }
      .library-empty-sub {
        max-width: 420px;
        color: var(--txt3);
        line-height: 1.55;
      }

      /* Wiederverwendbare Lade-/Empty-/Fehler-Zustaende */
      @keyframes iso-spin {
        to { transform: rotate(360deg); }
      }
      .iso-spinner {
        animation: iso-spin 0.8s linear infinite;
        color: var(--blue);
      }
      .btn-spinner {
        display: inline-flex;
        align-items: center;
        margin-right: 8px;
        vertical-align: middle;
      }
      .btn-spinner .iso-spinner {
        color: currentColor;
      }
      button.is-loading {
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      .state-block {
        min-height: 220px;
        display: grid;
        place-items: center;
        text-align: center;
        gap: 14px;
        padding: 32px;
        border: 1px dashed var(--bdr2);
        border-radius: 18px;
        background: rgba(255,255,255,0.03);
      }
      .state-block .state-icon {
        width: 54px;
        height: 54px;
        border-radius: 16px;
        display: grid;
        place-items: center;
        background: var(--surf2);
        color: var(--txt3);
      }
      .state-block .state-title {
        color: var(--txt);
        font-family: var(--font-head);
        font-size: 18px;
        font-weight: 850;
      }
      .state-block .state-sub {
        max-width: 440px;
        color: var(--txt3);
        line-height: 1.55;
      }
      .state-block .state-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
      }
      .state-block.state-error {
        border-color: rgba(255,107,97,0.45);
        background: rgba(255,107,97,0.06);
      }
      .state-block.state-error .state-icon {
        background: rgba(255,107,97,0.14);
        color: var(--red);
      }
      .state-block.state-loading .state-icon {
        background: transparent;
        color: var(--blue);
      }
      .official-template-section {
        padding-top: 6px;
      }
      #prompt-card-grid.list-mode {
        grid-template-columns: 1fr;
      }
      #prompt-card-grid.list-mode .pg-card {
        display: grid;
        grid-template-columns: 58px minmax(0, 1fr) auto;
        align-items: center;
        gap: 14px;
      }
      .skills-groups {
        display: grid;
        gap: 14px;
      }
      .skill-group {
        border: 1px solid var(--bdr2);
        border-radius: 18px;
        background: var(--surf);
        overflow: hidden;
      }
      .skill-group-head {
        width: 100%;
        min-height: 58px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 18px;
        border: 0;
        border-bottom: 1px solid var(--bdr2);
        background: transparent;
        color: var(--txt);
        font: inherit;
        font-weight: 850;
        text-align: left;
        cursor: pointer;
      }
      .skill-group-count {
        margin-left: auto;
        min-width: 34px;
        height: 28px;
        display: inline-grid;
        place-items: center;
        border-radius: 999px;
        background: var(--surf2);
        color: var(--txt3);
        font-size: 13px;
      }
      .skill-group-body {
        display: grid;
        gap: 12px;
        padding: 14px;
      }
      .skill-group.collapsed .skill-group-body {
        display: none;
      }
      .skill-group.collapsed .skill-chevron {
        transform: rotate(-90deg);
      }
      .skill-chevron {
        transition: transform 0.15s ease;
      }
      .skill-row {
        display: grid;
        grid-template-columns: 62px minmax(0, 1fr) auto;
        gap: 16px;
        align-items: center;
        padding: 16px;
        border: 1px solid var(--bdr2);
        border-radius: 16px;
        background: var(--surf2);
        cursor: pointer;
        transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
      }
      .skill-row:hover,
      .skill-row:focus-visible {
        border-color: rgba(74,122,255,0.46);
        box-shadow: 0 14px 34px rgba(36,87,212,0.12);
        outline: 0;
        transform: translateY(-1px);
      }
      .skill-row.is-hidden {
        display: none;
      }
      .skill-create-wrap {
        position: relative;
        display: inline-flex;
        justify-content: flex-end;
      }
      .skill-create-main {
        background: var(--blue);
        box-shadow: 0 12px 26px rgba(36, 87, 212, 0.26);
      }
      .skill-create-main:hover {
        background: var(--aqua);
      }
      .skill-create-menu {
        position: absolute;
        right: 0;
        top: calc(100% + 10px);
        min-width: 220px;
        display: none;
        padding: 10px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: var(--shadow-soft);
        z-index: 90;
      }
      .skill-create-wrap.open .skill-create-menu {
        display: grid;
        gap: 2px;
      }
      .skill-create-menu button {
        min-height: 40px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--txt);
        padding: 0 12px;
        display: flex;
        align-items: center;
        gap: 12px;
        font: inherit;
        font-size: 13px;
        font-weight: 460;
        text-align: left;
        cursor: pointer;
      }
      .skill-create-menu button:hover,
      .skill-create-menu button:focus-visible {
        background: var(--surf2);
        outline: 0;
      }
      .skill-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
        display: grid;
        place-items: center;
        background: rgba(74,122,255,0.13);
        color: var(--blue-l);
      }
      .skill-title-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 7px;
      }
      .skill-title {
        color: var(--txt);
        font-size: 19px;
        font-weight: 900;
      }
      .skill-desc {
        color: var(--txt2);
        font-size: 15px;
        line-height: 1.45;
        margin-bottom: 10px;
      }
      .skill-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        color: var(--txt3);
        font-size: 13px;
      }
      .skill-meta span,
      .skill-actions {
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }
      .skill-actions {
        gap: 8px;
      }
      /* ISA-68: primärer "Verwenden"-Button in IsarMind-Blau — gleiche
         Button-Logik wie der Verwenden-Button der Prompt-Bibliothek. */
      .skill-use-btn {
        min-height: 38px;
        padding: 0 16px;
        border: 0;
        border-radius: 12px;
        background: var(--blue);
        color: #fff;
        font-size: 12.5px;
        font-weight: 800;
        white-space: nowrap;
        cursor: pointer;
        transition: background .16s ease;
      }
      .skill-use-btn:hover,
      .skill-use-btn:focus-visible {
        background: var(--aqua);
        outline: 0;
      }
      .skill-view-btn {
        min-height: 38px;
        padding: 0 14px;
        border: 0;
        border-radius: 12px;
        background: var(--surf);
        color: var(--txt);
        font-weight: 800;
        cursor: pointer;
      }
      .skill-icon-btn {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: var(--txt3);
        display: grid;
        place-items: center;
        cursor: pointer;
      }
      .skill-view-btn:hover,
      .skill-icon-btn:hover {
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
      }
      .skill-modal-form {
        display: grid;
        gap: 16px;
        padding-top: 2px;
      }
      .skill-modal-field {
        display: grid;
        gap: 8px;
      }
      .skill-modal-field label {
        color: var(--txt);
        font-size: 13px;
        font-weight: 560;
      }
      .skill-modal-field label .required {
        color: #ff2d45;
      }
      .skill-modal-input,
      .skill-modal-select,
      .skill-modal-textarea {
        width: 100%;
        min-height: 50px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        color: var(--txt);
        padding: 0 14px;
        font: inherit;
        font-size: 13px;
        font-weight: 380;
        outline: 0;
      }
      .skill-modal-input:focus,
      .skill-modal-select:focus,
      .skill-modal-textarea:focus {
        border-color: var(--aqua);
        box-shadow: 0 0 0 3px rgba(74, 122, 255, 0.16);
      }
      .skill-modal-textarea {
        min-height: 116px;
        padding: 13px 14px;
        resize: vertical;
        line-height: 1.5;
      }
      .skill-modal-count {
        color: var(--txt3);
        font-size: 11px;
        font-weight: 360;
      }
      .skill-color-row {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
      }
      .skill-color-swatch {
        width: 38px;
        height: 38px;
        border: 3px solid transparent;
        border-radius: 13px;
        display: grid;
        place-items: center;
        color: #fff;
        font-weight: 700;
        cursor: pointer;
      }
      .skill-color-swatch.active {
        border-color: var(--txt2);
        box-shadow: 0 0 0 2px var(--surf), 0 0 0 4px var(--txt3);
      }
      .skill-editor-shell {
        height: 100%;
        min-height: 0;
        display: grid;
        grid-template-rows: auto 1fr;
        background: var(--surf);
        color: var(--txt);
      }
      .skill-editor-top {
        position: sticky;
        top: 0;
        z-index: 90;
        min-height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 12px 24px;
        border-bottom: 1px solid var(--bdr2);
        background: var(--surf);
        box-shadow: 0 10px 24px rgba(15,23,42,0.04);
      }
      .skill-editor-breadcrumb {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        color: var(--txt3);
        font-size: 12px;
      }
      .skill-editor-back {
        border: 0;
        background: transparent;
        color: var(--txt3);
        font: inherit;
        font-size: 13px;
        cursor: pointer;
      }
      .skill-editor-title-input {
        width: min(260px, 42vw);
        min-height: 42px;
        border: 1px solid var(--bdr2);
        border-radius: 13px;
        background: var(--surf2);
        color: var(--txt);
        padding: 0 13px;
        font: inherit;
        font-size: 14px;
        font-weight: 500;
      }
      .skill-editor-actions {
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .skill-editor-actions .btn-primary {
        background: var(--blue-ui-bg);
        box-shadow: 0 12px 26px rgba(36, 87, 212, 0.26);
      }
      .skill-editor-actions .btn-primary.is-saved {
        background: linear-gradient(180deg, #2f6df6 0%, #1f4fbe 100%);
      }
      .skill-editor-grid {
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
      }
      .skill-editor-left,
      .skill-ai-panel {
        min-height: 0;
        overflow: auto;
      }
      .skill-editor-tabs {
        min-height: 62px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 24px;
        border-bottom: 1px solid var(--bdr2);
      }
      .skill-editor-tab {
        min-height: 38px;
        border: 1px solid var(--bdr2);
        border-radius: 12px;
        background: var(--surf);
        color: var(--txt2);
        padding: 0 14px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font: inherit;
        font-size: 12.5px;
        font-weight: 500;
        cursor: pointer;
      }
      .skill-editor-tab.active {
        background: var(--blue-ui-bg);
        border-color: var(--blue);
        box-shadow: 0 10px 22px rgba(36, 87, 212, 0.20);
        color: white;
      }
      .skill-editor-form {
        display: grid;
        gap: 28px;
        padding: 28px 24px 40px;
      }
      .skill-editor-section {
        display: grid;
        gap: 12px;
      }
      .skill-editor-section h3,
      .skill-ai-title {
        color: var(--txt);
        font-size: 14px;
        font-weight: 560;
        margin: 0;
      }
      .skill-editor-section p {
        color: var(--txt3);
        font-size: 12px;
        font-weight: 360;
        margin: 0;
      }
      .skill-editor-textarea,
      .skill-editor-description {
        width: 100%;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf2);
        color: var(--txt);
        padding: 14px;
        font: inherit;
        font-size: 13px;
        font-weight: 360;
        line-height: 1.55;
        resize: vertical;
      }
      .skill-editor-description {
        min-height: 80px;
      }
      .skill-editor-textarea {
        min-height: 320px;
      }
      .skill-settings-stack {
        width: 100%;
        max-width: 780px;
        display: grid;
        gap: 22px;
      }
      .skill-settings-card {
        border: 1px solid var(--bdr2);
        border-radius: 18px;
        background: var(--surf);
        padding: 24px;
        display: grid;
        gap: 18px;
      }
      .skill-settings-card h3 {
        color: var(--txt);
        font-size: 20px;
        font-weight: 650;
        margin: 0;
      }
      .skill-settings-card p {
        color: var(--txt3);
        font-size: 14px;
        font-weight: 360;
        line-height: 1.45;
        margin: 0;
      }
      .skill-settings-label {
        color: var(--txt);
        font-size: 14px;
        font-weight: 650;
        margin-bottom: -6px;
      }
      .skill-settings-select {
        width: 100%;
        min-height: 52px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf2);
        color: var(--txt);
        padding: 0 16px;
        font: inherit;
        font-size: 15px;
        font-weight: 560;
      }
      .skill-settings-row,
      .skill-settings-inner-row,
      .skill-share-row,
      .skill-danger-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 18px;
      }
      .skill-switch {
        width: 58px;
        height: 32px;
        border: 0;
        border-radius: 999px;
        background: rgba(17, 24, 39, 0.14);
        padding: 3px;
        display: flex;
        justify-content: flex-start;
        cursor: pointer;
        transition: background 0.18s ease, box-shadow 0.18s ease;
      }
      .skill-switch span {
        width: 26px;
        height: 26px;
        border-radius: 999px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
        transition: transform 0.18s ease;
      }
      .skill-switch.active {
        background: var(--blue);
        justify-content: flex-end;
        box-shadow: 0 10px 18px rgba(47, 109, 246, 0.24);
      }
      .skill-share-row {
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf2);
        padding: 14px 16px;
      }
      .skill-share-row strong,
      .skill-danger-row strong {
        display: block;
        color: var(--txt);
        font-size: 15px;
        font-weight: 650;
      }
      .skill-share-row span,
      .skill-danger-row span {
        display: block;
        color: var(--txt3);
        font-size: 13px;
        line-height: 1.4;
        margin-top: 4px;
      }
      .skill-share-btn,
      .skill-delete-btn {
        min-height: 44px;
        border-radius: 14px;
        padding: 0 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font: inherit;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
      }
      .skill-share-btn {
        border: 1px solid var(--bdr2);
        background: var(--surf);
        color: var(--txt);
      }
      .skill-danger-zone {
        border-color: rgba(239, 0, 17, 0.34);
        background: color-mix(in srgb, var(--surf) 94%, rgba(239, 0, 17, 0.08));
      }
      .skill-danger-zone h3 {
        color: #ef0011;
      }
      .skill-delete-btn {
        border: 0;
        background: #ef0011;
        color: #fff;
        box-shadow: 0 12px 22px rgba(239, 0, 17, 0.22);
      }
      @media (max-width: 700px) {
        .skill-settings-stack {
          max-width: none;
          gap: 16px;
        }
        .skill-settings-card {
          padding: 18px;
        }
        .skill-settings-row,
        .skill-settings-inner-row,
        .skill-share-row,
        .skill-danger-row {
          grid-template-columns: 1fr;
        }
        .skill-switch,
        .skill-share-btn,
        .skill-delete-btn {
          justify-self: start;
        }
      }
      .skill-ai-panel {
        display: grid;
        grid-template-rows: auto 1fr auto;
        background: var(--surf);
      }
      .skill-ai-head {
        min-height: 62px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 22px;
        border-bottom: 1px solid var(--bdr2);
      }
      .skill-ai-empty {
        display: grid;
        place-items: center;
        color: var(--txt3);
        font-size: 13px;
        font-weight: 360;
        text-align: center;
        padding: 24px;
      }
      .skill-ai-composer {
        margin: 18px 22px 22px;
        border: 1px solid var(--bdr2);
        border-radius: 16px;
        overflow: hidden;
        background: var(--surf2);
      }
      .skill-ai-composer textarea {
        width: 100%;
        min-height: 76px;
        border: 0;
        background: transparent;
        color: var(--txt);
        padding: 16px;
        resize: none;
        font: inherit;
        font-size: 13px;
        outline: 0;
      }
      .skill-ai-compose-foot {
        min-height: 46px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        border-top: 1px solid var(--bdr2);
        padding: 0 10px 0 14px;
        color: var(--txt3);
        font-size: 12px;
      }
      .skill-ai-send {
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 10px;
        display: grid;
        place-items: center;
        background: var(--blue-ui-bg);
        color: white;
        box-shadow: 0 10px 22px rgba(36, 87, 212, 0.24);
        cursor: pointer;
      }
      @media (max-width: 900px) {
        .library-page-head,
        .skill-row,
        #prompt-card-grid.list-mode .pg-card {
          grid-template-columns: 1fr;
        }
        .library-toolbar > *,
        .library-select,
        .library-dropdown {
          flex: 1 1 100%;
        }
        #library-prompts-panel .library-toolbar {
          display: grid;
          grid-template-columns: minmax(112px, 1.35fr) minmax(94px, 1fr) minmax(88px, 0.95fr) minmax(96px, 1fr) auto;
          gap: 6px;
          align-items: center;
          overflow-x: auto;
          scrollbar-width: none;
        }
        #library-prompts-panel .library-toolbar::-webkit-scrollbar {
          display: none;
        }
        #library-prompts-panel .library-toolbar > *,
        #library-prompts-panel .library-select,
        #library-prompts-panel .library-dropdown {
          flex: initial;
          min-width: 0;
          width: 100%;
        }
        #library-prompts-panel .library-search,
        #library-prompts-panel .library-dropdown-trigger,
        #library-prompts-panel .library-select {
          min-height: 40px;
          border-radius: 12px;
          padding-left: 10px;
          font-size: 12px;
          font-weight: 600;
        }
        #library-prompts-panel .library-search {
          padding-right: 10px;
        }
        #library-prompts-panel .library-dropdown-trigger {
          padding-right: 26px;
        }
        #library-prompts-panel .library-dropdown-trigger::after {
          right: 10px;
          width: 7px;
          height: 7px;
        }
        #library-prompts-panel .library-dropdown-label {
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        #library-prompts-panel .library-view-toggle {
          min-width: 76px;
          padding: 3px;
          border-radius: 12px;
          justify-content: center;
        }
        #library-prompts-panel .library-view-toggle button {
          width: 32px;
          height: 32px;
          border-radius: 9px;
        }
        .library-page-title {
          font-size: 42px;
        }
        .skill-actions {
          justify-content: flex-start;
        }
      }
      @media (max-width: 480px) {
        #library-prompts-panel .library-toolbar {
          grid-template-columns: 132px 112px 104px 112px 76px;
        }
      }
      .context-return {
        display: none;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 12px;
        margin: 0 auto 22px;
        max-width: 820px;
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: var(--radius-md);
        background: rgba(74,122,255,0.10);
        color: var(--text-soft);
        font-size: 12.5px;
      }
      .context-return.show { display: flex; }
      .manage-list { display: grid; gap: 10px; }
      .manage-item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border: 1px solid var(--bdr2);
        border-radius: 12px;
        background: var(--surf2);
      }
      .manage-item-title { font-weight: 800; color: var(--txt); }
      .manage-item-sub { color: var(--txt3); font-size: 12.5px; line-height: 1.45; margin-top: 3px; }
      .manage-item-actions { display: flex; gap: 8px; }
      .source-score { height: 7px; background: var(--blue-soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
      .source-score span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--aqua)); border-radius: 99px; }
      .rag-console {
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
        gap: 16px;
        align-items: start;
        margin-bottom: 18px;
      }
      .rag-query-panel, .rag-answer-panel, .rag-source-card {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 20px;
        box-shadow: var(--shadow-card);
      }
      .rag-answer-panel { min-height: 248px; }
      .rag-textarea { min-height: 118px; }
      .rag-status-line {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-top: 12px;
      }
      .rag-answer {
        color: var(--text);
        line-height: 1.7;
        margin: 10px 0 14px;
      }
      .citation-list { display: grid; gap: 10px; }
      .citation-card {
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 12px;
        background: linear-gradient(180deg, #fff, #f8fbff);
      }
      .citation-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
      }
      .citation-title {
        font-family: var(--font-head);
        font-size: 12px;
        font-weight: 800;
        color: var(--navy);
      }
      .citation-quote {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.55;
      }
      .rag-source-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 12px;
        margin-top: 18px;
      }
      .rag-source-card { padding: 18px; }
      .rag-source-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin: 10px 0;
      }
      .mind-model-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 14px;
      }
      .mind-model-chip {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        background: var(--surface);
        padding: 12px;
      }
      .mind-model-chip span {
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .12em;
        color: var(--muted);
        font-weight: 800;
        margin-bottom: 5px;
      }
      .mind-model-chip strong {
        color: var(--text);
        font-family: var(--font-head);
      }
      .mind-section-title {
        font-family: var(--font-head);
        color: var(--text);
        font-weight: 800;
        font-size: 20px;
        margin: 22px 0 12px;
      }
      .mind-dept-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
      }
      .mind-dept-card {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        padding: 16px;
        min-height: 120px;
      }
      .mind-dept-card strong {
        display: block;
        color: var(--text);
        margin: 8px 0 6px;
      }
      .mind-dept-card span {
        display: block;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.45;
      }
      .mind-status-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: -8px 0 16px;
      }
      .mind-status-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: 1px solid var(--border-md);
        border-radius: 999px;
        background: var(--surface);
        color: var(--muted);
        padding: 7px 10px;
        font-size: 12px;
        font-weight: 700;
      }
      .mind-status-pill strong {
        color: var(--text);
        font-weight: 900;
      }
      .mind-primary-panel {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        padding: 18px;
        box-shadow: var(--shadow-card);
        margin-bottom: 16px;
      }
      .mind-primary-panel .rag-console {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        margin-bottom: 0;
      }
      .mind-primary-panel .rag-query-panel,
      .mind-primary-panel .rag-answer-panel,
      .mind-primary-panel .upload-dropzone,
      .mind-source-strip .rag-source-card {
        box-shadow: none;
      }
      .mind-primary-panel .rag-query-panel {
        padding: 18px;
      }
      .mind-primary-panel .rag-answer-panel {
        min-height: 180px;
        display: flex;
        flex-direction: column;
      }
      .mind-primary-panel .rag-textarea {
        min-height: 92px;
      }
      .mind-primary-panel .rag-answer {
        flex: 1;
        font-size: 15px;
      }
      .mind-primary-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(230px, 0.72fr);
        gap: 12px;
        align-items: stretch;
        margin-bottom: 12px;
      }
      .mind-query-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
        gap: 10px;
        margin-top: 12px;
      }
      .mind-upload-card {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        padding: 18px;
        display: grid;
        gap: 12px;
      }
      .mind-upload-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
      }
      .mind-upload-head .mind-section-title {
        margin: 0;
        font-size: 18px;
      }
      .mind-upload-fields {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
      }
      #rag-doc-content {
        min-height: 64px;
      }
      .mind-quick-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-top: 12px;
      }
      .mind-source-panel {
        grid-column: 1 / -1;
      }
      .mind-info-panel {
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        background: var(--surface);
        padding: 16px;
      }
      .mind-info-panel .mind-section-title {
        margin: 0 0 12px;
        font-size: 18px;
      }
      .mind-compact-list {
        display: grid;
        gap: 8px;
      }
      .mind-compact-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 10px;
      }
      .mind-compact-row strong {
        color: var(--text);
      }
      .mind-compact-row span {
        color: var(--muted);
        font-size: 12px;
        overflow-wrap: anywhere;
      }
      .mind-sources-list {
        display: grid;
        gap: 8px;
      }
      .mind-sources-list .rag-source-card {
        padding: 12px;
      }
      .mind-sources-list .rag-source-card button {
        display: none;
      }
      .mind-sources-list .pg-card-sub {
        font-size: 12px;
        line-height: 1.45;
      }
      .mind-source-strip {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 10px;
        margin-top: 12px;
      }
      .rag-ingest-grid {
        display: grid;
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        gap: 12px;
      }
      .upload-dropzone {
        border: 1.5px dashed rgba(24,98,255,0.28);
        border-radius: var(--radius-lg);
        background: linear-gradient(180deg, rgba(234,240,255,0.65), #fff);
        padding: 14px;
        display: grid;
        gap: 10px;
      }
      .upload-dropzone strong { color: var(--navy); font-family: var(--font-head); }
      .upload-status {
        margin-top: 12px;
        display: grid;
        gap: 8px;
      }
      .upload-item {
        display: grid;
        gap: 8px;
        padding: 10px 12px;
        border-radius: var(--radius-md);
        background: var(--blue-soft);
        color: var(--navy);
        font-size: 12px;
        font-weight: 700;
      }
      .upload-item-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
      }
      .upload-item-name,
      .upload-item-status {
        min-width: 0;
        overflow-wrap: anywhere;
      }
      .upload-item-status {
        text-align: right;
        flex-shrink: 0;
      }
      .upload-transcript {
        border-top: 1px solid rgba(74,122,255,0.18);
        padding-top: 8px;
        color: var(--muted);
        font-weight: 500;
        line-height: 1.5;
      }
      .audio-panel {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 20px;
        box-shadow: var(--shadow-card);
      }
      .audio-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0;
      }
      .audio-meter {
        height: 8px;
        border-radius: 99px;
        background: var(--blue-soft);
        overflow: hidden;
        margin: 10px 0;
      }
      .audio-meter span {
        display: block;
        height: 100%;
        width: 24%;
        background: linear-gradient(90deg, var(--red), var(--yellow), var(--aqua));
        border-radius: 99px;
        transition: width 0.2s;
      }
      .audio-transcript {
        background: #f8fbff;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 12px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.55;
        margin-top: 10px;
      }
      .pitch-hero {
        border-radius: 28px;
        padding: 34px;
        background:
          linear-gradient(135deg, #07070a 0%, #0d0d12 52%, #2457d4 100%);
        color: #fff;
        margin-bottom: 18px;
        position: relative;
        overflow: hidden;
      }
      .pitch-hero::after {
        content: "";
        position: absolute;
        right: -70px;
        top: -90px;
        width: 240px;
        height: 240px;
        border-radius: 50%;
        background: transparent;
      }
      .pitch-title { font-family: var(--font-head); font-size: 34px; font-weight: 800; max-width: 680px; line-height: 1.15; position: relative; z-index: 1; }
      .pitch-sub { color: rgba(255,255,255,0.72); max-width: 680px; margin-top: 12px; position: relative; z-index: 1; }
      .pitch-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; position: relative; z-index: 1; }
      .pitch-action-light { background: #fff; color: var(--navy); }
      .pitch-readiness {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 12px;
        margin-bottom: 18px;
      }
      .readiness-card {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 18px;
        box-shadow: var(--shadow-card);
      }
      .readiness-value { font-family: var(--font-head); font-size: 24px; color: var(--navy); font-weight: 800; }
      .readiness-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
      .pitch-script {
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-radius: var(--radius-lg);
        padding: 22px;
        box-shadow: var(--shadow-card);
        white-space: pre-wrap;
        color: var(--text);
        line-height: 1.7;
      }
      .pitch-status {
        margin-top: 12px;
        padding: 11px 12px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-md);
        background: #fff;
        color: var(--navy);
        font-size: 12px;
      }
      .pitch-status.ok {
        border-color: rgba(22, 131, 74, 0.35);
        background: rgba(74, 222, 128, 0.12);
      }
      .pitch-status.warn {
        border-color: rgba(194, 65, 52, 0.32);
        background: rgba(255, 115, 104, 0.12);
      }
      .audit-list { display: grid; gap: 8px; }
      .audit-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; }

      .sb-brand-name,
      .model-pill,
      .model-smart-title,
      .welcome-title,
      .sug-title,
      .msg-h,
      .ph-title,
      .pg-card-title,
      .settings-sec-label,
      .form-section-title,
      .file-list-label,
      .sr-label,
      .form-label,
      .file-name,
      .settings-name,
      .metric-value,
      .lane-title,
      .citation-title,
      .upload-dropzone strong,
      .readiness-value {
        color: var(--text);
      }
      .model-smart-sub,
      .welcome-sub,
      .sug-sub,
      .pg-card-sub,
      .sr-sub,
      .file-info,
      .folder-count,
      .metric-label,
      .citation-quote,
      .settings-role,
      .input-disclaimer,
      .rag-answer {
        color: var(--muted);
      }
      .btn-new-chat,
      .pg-action-btn,
      .btn-primary,
      #send-btn.ready {
        background: var(--blue-ui-bg);
        color: #fff;
        box-shadow: var(--blue-ui-shadow);
      }
      .btn-secondary,
      .btn-outline,
      .topbar-badge,
      .model-option,
      .suggestion-btn,
      .pg-card,
      .settings-group,
      .form-section,
      .file-list,
      .assistant-config,
      .settings-profile,
      .metric-card,
      .analysis-box,
      .decision-card,
      .task-card,
      .insight-panel,
      .rag-query-panel,
      .rag-answer-panel,
      .rag-source-card,
      .audio-panel,
      .readiness-card,
      .pitch-script {
        background: var(--surface);
        border-color: var(--border-md);
        color: var(--text);
      }
      .suggestion-btn:hover,
      .pg-card:hover,
      .btn-secondary:hover,
      .btn-outline:hover,
      .model-option:hover,
      .ibar-btn:hover {
        border-color: rgba(74, 122, 255, 0.72);
        background: #12131a;
      }
      .model-smart-card,
      .upload-item,
      .file-badge,
      .chip,
      .source-score,
      .audio-meter,
      .msg-ai-avatar {
        background: rgba(36, 87, 212, 0.16);
        color: #8faaff;
      }
      .chip.ok,
      .sb-active {
        background: rgba(74, 222, 128, 0.12);
        color: #7ee787;
      }
      .chip.warn,
      .sb-progress {
        background: rgba(255, 107, 97, 0.13);
        color: #ff938b;
      }
      .decision-lane,
      .citation-card,
      .audio-transcript,
      .pitch-status,
      .upload-dropzone {
        background: #0a0b10;
        border-color: var(--border);
        color: var(--text-soft);
      }
      .msg-bubble,
      .typing-bubble,
      .input-box {
        background: #0d0d12;
        border-color: var(--border-md);
        color: var(--text);
      }
      .msg-bubble,
      .typing-bubble {
        background: linear-gradient(180deg, rgba(36,87,212,0.16), rgba(13,13,18,0.96));
        border-color: rgba(74,122,255,0.34);
        border-left-color: var(--aqua);
      }
      .msg-bubble.user {
        background: #14161e;
        border-color: rgba(255,255,255,0.11);
        border-left-color: rgba(255,255,255,0.11);
        color: #edf1ff;
      }
      .msg-row.agent .msg-bubble,
      .msg-row[data-role="agent"] .msg-bubble,
      .msg-bubble.agent {
        background: linear-gradient(180deg, rgba(34,197,94,0.12), rgba(13,13,18,0.96));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .typing-row.agent .typing-bubble,
      .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.11), rgba(13,13,18,0.95));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .msg-row.system .msg-bubble,
      .msg-row[data-role="system"] .msg-bubble,
      .msg-bubble.system {
        background: linear-gradient(180deg, rgba(242,201,76,0.10), rgba(13,13,18,0.96));
        border-color: rgba(242,201,76,0.24);
        border-left-color: rgba(242,201,76,0.70);
      }
      .form-input,
      .form-select,
      .form-textarea,
      #msg-input {
        color: var(--text);
        caret-color: #4a7aff;
      }
      .form-input,
      .form-select,
      .form-textarea {
        border-color: var(--border-md);
      }
      .form-input:focus,
      .form-select:focus,
      .form-textarea:focus {
        border-color: #4a7aff;
        box-shadow: 0 0 0 3px rgba(36, 87, 212, 0.18);
      }
      .msg-user-avatar,
      .sb-avatar,
      .settings-profile-av {
        background: var(--blue);
        color: #fff;
      }
      .pg-card-ico,
      .file-icon,
      .folder-icon,
      .assistant-avatar {
        background: #12131a;
        border: 1px solid var(--border-md);
        color: #4a7aff;
      }
      .confidence-ring {
        background: conic-gradient(#4a7aff 0 86%, #171925 86% 100%);
        color: var(--text);
      }
      .pitch-hero {
        border-radius: 16px;
        border: 1px solid rgba(74, 122, 255, 0.28);
        background:
          linear-gradient(135deg, rgba(36, 87, 212, 0.24), rgba(13, 13, 18, 0.96) 48%, rgba(74, 122, 255, 0.18)),
          #0d0d12;
      }
      .pitch-hero::after {
        background: url("logo_dark.png") center / contain no-repeat;
        opacity: 0.12;
        border-radius: 0;
      }
      .pitch-action-light {
        background: #f6f8ff;
        color: #07070a;
      }
      .topbar-badge {
        border: 1px solid var(--border-md);
        border-radius: 10px;
      }
      .model-group-label,
      .sb-section-label,
      .ibar-model-tag {
        font-family: var(--font-mono);
      }
      .model-lock-heading {
        width: 100%;
        border-radius: 8px;
        cursor: pointer;
        text-align: left;
      }
      .model-lock-heading:hover {
        background: rgba(74,122,255,0.10);
        color: var(--blue-l);
      }

      /* Standard handoff first viewport */
      :root {
        --surf: #0d1118;
        --surf2: #111722;
        --surf3: #172033;
        --bdr: rgba(255,255,255,0.08);
        --bdr2: rgba(255,255,255,0.13);
        --blue-l: #4a7aff;
        --bdim: rgba(74,122,255,0.12);
        --txt: #f8faff;
        --txt2: #e7edf8;
        --txt3: #bdc8db;
        --green: #22c55e;

        /* Semantische Design-Tokens (shadcn-Vokabular, zeigen auf bestehende Werte) */
        --card: var(--surface);
        --card-foreground: var(--text);
        --foreground: var(--text);
        --muted-foreground: var(--muted);
        --primary: var(--blue);
        --primary-foreground: #ffffff;
        --accent: var(--aqua);
        --success: var(--green);
        --destructive: var(--red);
        --ring: rgba(74, 122, 255, 0.45);
      }
      body { color: var(--txt); font-size: var(--font-size-base); }
      body::before {
        content: "";
        position: fixed;
        inset: 0;
        background: transparent;
        pointer-events: none;
        z-index: 0;
      }
      #sidebar {
        background: var(--surf);
        border-right-color: var(--bdr2);
        position: relative;
      }
      .sb-brand {
        padding: 20px 22px 18px;
        border-bottom-color: rgba(255,255,255,0.06);
      }
      .sb-top { padding: 8px 12px 6px; }
      .btn-new-chat {
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        transition: background 0.15s, transform 0.1s;
      }
      .btn-new-chat:hover { background: var(--blue-l); }
      .btn-new-chat:active { transform: scale(0.98); }
      /* Chatliste bekommt eine eigene, flexibel wachsende Scroll-Region:
         Navigation oben und Util-Links unten bleiben stehen, die Chats sind
         dadurch auch auf kleinen Bildschirmen immer sichtbar/scrollbar. */
      .sb-scroll-area { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
      /* ISA-51: Alle Hauptreiter bleiben ohne Scrollen sichtbar. Die obere
         Navigation behaelt ihre natuerliche Hoehe (flex 0 0 auto, kein
         Eigen-Scroll) und hat Vorrang; bei knapper Hoehe schrumpft zuerst die
         Chatliste und wird dort scrollbar. */
      .sb-scroll-area > .sb-nav:first-child { flex: 0 0 auto; }
      .sb-scroll-area > .sb-nav:first-child::-webkit-scrollbar { width: 0; }
      .sb-chats-region { flex: 1 1 0; min-height: 0; overflow-y: auto; }
      .sb-chats-region::-webkit-scrollbar { width: 0; }
      .sb-utilnav { flex: 0 0 auto; }

      .sb-nav { padding: 2px 8px; }
      .sb-nav-item {
        padding: 7px 10px;
        color: rgba(255,255,255,0.90);
        font-size: 14px;
        font-weight: 600;
      }
      .sb-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
      .sb-nav-item.active { background: var(--accent-soft-bg-strong); color: var(--blue-l); }
      .sb-nav-item svg { flex-shrink: 0; opacity: 0.95; }
      .sb-library-group {
        display: grid;
        gap: 2px;
      }
      .sb-library-parent span {
        flex: 1;
        min-width: 0;
        text-align: left;
      }
      .sb-library-chevron {
        margin-left: auto;
        transition: transform 0.15s ease;
      }
      .sb-library-parent[aria-expanded="true"] .sb-library-chevron {
        transform: rotate(180deg);
      }
      .sb-library-subnav {
        display: grid;
        gap: 2px;
        margin: 0 0 4px 28px;
        padding: 2px 0 2px 10px;
        border-left: 1px solid rgba(255,255,255,0.10);
      }
      .sb-library-subnav.collapsed {
        display: none;
      }
      .sb-library-subitem {
        min-height: 30px;
        padding: 5px 10px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--txt3);
        font: inherit;
        font-size: 13px;
        font-weight: 650;
        text-align: left;
        cursor: pointer;
      }
      .sb-library-subitem:hover,
      .sb-library-subitem.active {
        background: rgba(255,255,255,0.07);
        color: var(--txt);
      }
      body.light .sb-library-subnav {
        border-left-color: rgba(27,42,74,0.13);
      }
      body.light .sb-library-subitem:hover,
      body.light .sb-library-subitem.active {
        background: var(--accent-soft-bg);
        color: var(--blue);
      }
      .sb-divider { background: rgba(255,255,255,0.05); margin: 4px 6px; }
      .sb-section-label {
        font-size: 11px;
        font-weight: 700;
        color: rgba(255,255,255,0.65);
        padding: 5px 12px 2px;
      }
      .sb-section-label.locked {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }
      .sb-section-label.locked svg {
        flex-shrink: 0;
        opacity: 0.72;
      }
      .sb-section-label.locked span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .sb-history-item {
        padding: 8px 12px;
        color: rgba(255,255,255,0.90);
        font-size: 13.5px;
        font-weight: 500;
        border: 1px solid transparent;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .sb-history-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
      .sb-history-item.active { background: var(--accent-soft-bg); border-color: color-mix(in srgb, var(--blue) 25%, transparent); color: var(--blue-l); }
      .sb-footer { border-top-color: rgba(255,255,255,0.06); }
      .sb-user-row { cursor: pointer; transition: background 0.15s; }
      .sb-user-row:hover { background: rgba(255,255,255,0.05); }
      .sb-avatar, .settings-profile-av, .msg-user-avatar { background: var(--blue); color: #fff; }
      .sb-user-meta { flex: 1; overflow: hidden; }
      .sb-user-name { color: var(--txt); font-size: 13.5px; }
      .sb-user-role { color: var(--txt3); font-size: 12px; }
      .sb-settings-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        min-width: 32px;
        padding: 0;
        border-radius: 9px;
        color: var(--txt2);
        transition: background 0.15s;
      }
      .sb-settings-btn:hover { background: rgba(255,255,255,0.08); }
      .sb-nav-item.locked {
        opacity: 0.42;
        cursor: pointer;
        align-items: flex-start;
      }
      .sb-nav-item.locked > svg:first-child { margin-top: 2px; }
      .sb-nav-item.locked:hover {
        opacity: 0.68;
        background: rgba(255,255,255,0.04);
        color: rgba(255,255,255,0.90);
      }
      .sb-nav-item.creator-unlocked {
        opacity: 1;
        color: var(--txt);
      }
      .sb-nav-item.creator-unlocked .sb-tier-badge {
        background: rgba(74,222,128,0.13);
        color: #4ade80;
      }
      .sb-lock-toggle {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: currentColor;
        display: grid;
        place-items: center;
        flex-shrink: 0;
        opacity: 0.85;
        margin: -8px -6px -2px 0;
        cursor: pointer;
      }
      .sb-lock-toggle:hover {
        background: rgba(74,122,255,0.16);
        color: var(--blue-l);
        opacity: 1;
      }
      .sb-lock-ico { display: block; }
      .sb-nav-locked-label { flex: 1; min-width: 0; line-height: 1.25; word-break: break-word; }
      .sb-tier-badge {
        font-family: var(--font-mono);
        font-size: 9px;
        font-weight: 500;
        padding: 2px 6px;
        border-radius: 4px;
        flex-shrink: 0;
        letter-spacing: 0.3px;
      }
      .sb-tier-badge.business,
      .sb-tier-badge.pro,
      .sb-tier-badge.max { background: rgba(74,122,255,0.15); color: var(--blue-l); }
      .sb-subnav {
        margin: 4px 0 6px 30px;
        border-left: 1px solid rgba(255,255,255,0.08);
        padding-left: 10px;
      }
      .sb-subnav-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--txt3);
        cursor: pointer;
        font-size: 11.5px;
        font-weight: 650;
        padding: 6px 8px;
        text-align: left;
      }
      .sb-subnav-toggle:hover {
        background: rgba(255,255,255,0.05);
        color: var(--txt);
      }
      .sb-subnav-toggle svg {
        transition: transform 0.15s;
      }
      .sb-subnav-toggle[aria-expanded="true"] svg {
        transform: rotate(90deg);
      }
      .sb-subnav-panel {
        display: none;
        padding: 3px 0 2px;
      }
      .sb-subnav-panel.open {
        display: block;
      }
      .sb-subnav-label {
        margin: 7px 0 4px;
        padding: 0 8px;
        color: var(--txt3);
        font-family: var(--font-mono);
        font-size: 9.5px;
        font-weight: 650;
        letter-spacing: 0.3px;
        text-transform: uppercase;
      }
      .sb-subnav-label:first-child { margin-top: 2px; }
      .sb-nav-item.subitem {
        border-radius: 8px;
        font-size: 12.5px;
        margin-bottom: 1px;
        padding: 7px 8px 7px 10px;
      }
      .sb-nav-item.subitem svg {
        height: 13px;
        width: 13px;
      }
      .sb-lock-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 32px;
        gap: 4px;
        align-items: stretch;
      }
      .sb-lock-row .sb-nav-item {
        margin-bottom: 0;
      }
      .sb-lock-row .sb-lock-toggle {
        align-self: start;
        margin: 0;
      }
      .usage-meter {
        padding: 10px 11px 12px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        margin-bottom: 4px;
      }
      .usage-meter-top {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-bottom: 6px;
      }
      .usage-meter-label,
      .usage-meter-upgrade,
      .usage-meta { font-family: var(--font-mono); }
      .usage-meter-label {
        font-size: 9.5px;
        font-weight: 500;
        color: var(--txt3);
        text-transform: uppercase;
        letter-spacing: 0.8px;
      }
      .usage-meter-upgrade {
        font-size: 9px;
        color: var(--blue-l);
        text-decoration: none;
        opacity: 0.8;
        transition: opacity 0.15s;
      }
      .usage-meter-upgrade:hover { opacity: 1; }
      .usage-bar {
        height: 3px;
        background: var(--surf3);
        border-radius: 2px;
        overflow: hidden;
        margin-bottom: 5px;
      }
      .usage-bar-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--blue), var(--blue-l));
        border-radius: 2px;
      }
      .usage-meta { font-size: 10px; color: var(--txt3); }
      #topbar {
        height: var(--header-h);
        background: var(--bg);
        border-bottom-color: var(--bdr2);
        position: relative;
      }
      .model-pill {
        gap: 9px;
        padding: 7px 16px 7px 8px;
        border-radius: 22px;
        background: var(--surf2);
        border: 1.5px solid var(--bdr2);
        font-size: 15px;
        color: var(--txt);
        transition: all 0.15s;
      }
      .model-pill-logo {
        width: 26px;
        height: 26px;
        border-radius: 7px;
        overflow: hidden;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .smart-bulb-icon {
        border: 1px solid var(--smart-idea-border);
        border-radius: 999px;
        background: var(--smart-idea-bg);
        color: var(--smart-idea-fill);
        box-shadow: none;
      }
      .smart-bulb-icon svg {
        display: block;
        overflow: visible;
        filter: none;
      }
      .smart-bulb-glass { fill: var(--smart-idea-fill); stroke: var(--smart-idea-stroke); }
      .smart-bulb-light { fill: var(--smart-idea-fill); stroke: var(--smart-idea-stroke); }
      .smart-bulb-base { stroke: var(--smart-idea-base); }
      .model-pill-logo.smart-bulb-icon svg {
        width: 17px;
        height: 17px;
      }
      .model-pill-logo.smart-bulb-icon {
        width: 24px;
        height: 24px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: var(--txt3);
      }
      .model-pill-logo.smart-bulb-icon .smart-bulb-light {
        fill: none;
        stroke: currentColor;
      }
      .model-pill-logo.smart-bulb-icon .smart-bulb-base { stroke: currentColor; }
      .model-pill:hover .model-pill-logo.smart-bulb-icon,
      .model-pill.open .model-pill-logo.smart-bulb-icon {
        color: var(--blue-l);
      }
      .model-smart-icon.smart-bulb-icon {
        border: 0;
        background: transparent;
        color: var(--txt3);
        padding: 0;
      }
      .model-smart-icon.smart-bulb-icon svg {
        width: 18px;
        height: 18px;
      }
      .model-smart-icon.smart-bulb-icon .smart-bulb-light {
        fill: none;
        stroke: currentColor;
      }
      .model-smart-icon.smart-bulb-icon .smart-bulb-base { stroke: currentColor; }
      .model-smart-card:hover .model-smart-icon.smart-bulb-icon,
      .model-smart-card:focus-visible .model-smart-icon.smart-bulb-icon {
        color: var(--blue-l);
      }
      .model-pill:hover,
      .model-pill.open {
        border-color: var(--blue-l);
        background: var(--surf3);
      }
      .model-pill-arrow { color: var(--blue-l); transition: transform 0.2s; }
      .model-pill.open .model-pill-arrow { transform: rotate(180deg); }
      .model-dropdown {
        background: var(--surf);
        border-color: var(--bdr2);
        box-shadow: 0 16px 48px rgba(0,0,0,0.6);
        min-width: 290px;
      }
      .model-smart-card {
        background: linear-gradient(135deg, var(--surf2), var(--surf3));
        border-color: var(--bdr2);
      }
      .model-smart-title,
      .model-option,
      .page-hd .ph-title,
      .pg-card-title { color: var(--txt); }
      .model-smart-sub,
      .pg-card-sub,
      .sr-sub { color: var(--txt2); }
      .model-smart-check {
        margin-left: auto;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--blue);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
      }
      .model-sep { height: 1px; background: var(--bdr2); margin: 4px 2px; }
      .model-option:hover { background: var(--surf3); }
      .model-option.selected { background: var(--bdim); color: var(--blue-l); }
      .model-option.locked {
        opacity: 0.46;
        cursor: pointer;
      }
      .model-option.locked:hover {
        opacity: 0.72;
        background: rgba(74,122,255,0.10);
        color: var(--txt);
      }
      .model-locked-icon { color: var(--txt3); margin-right: 2px; flex-shrink: 0; }
      .model-option-right { margin-left: auto; }
      .check-icon { opacity: 0; }
      .model-option.selected .check-icon { opacity: 1; }
      .tenant-pill,
      .tenant-dropdown {
        background: var(--surf2);
        border-color: var(--bdr2);
        color: var(--txt);
      }
      .tenant-pill:hover,
      .tenant-selector-wrap[open] .tenant-pill,
      .tenant-selector-root[open] .tenant-pill,
      .tenant-pill.open {
        border-color: var(--blue-l);
        background: var(--surf3);
      }
      .tenant-pill-meta,
      .tenant-pill-kicker,
      .tenant-dropdown-title,
      .tenant-option-meta,
      .tenant-note {
        color: var(--txt2);
      }
      .tenant-pill-arrow {
        color: var(--blue-l);
      }
      .tenant-dropdown {
        background: var(--surf);
        box-shadow: 0 16px 48px rgba(0,0,0,0.6);
      }
      .tenant-option {
        color: var(--txt);
      }
      .tenant-option:hover,
      .tenant-option.active {
        background: var(--bdim);
        color: var(--blue-l);
      }
      .topbar-badge {
        background: var(--surf2);
        border-radius: 20px;
        border-color: var(--bdr2);
        color: var(--txt2);
        font-weight: 600;
      }
      .topbar-badge:hover { background: var(--surf3); }
      .status-dot { background: var(--brand-dot-active); }
      .theme-toggle-btn,
      .topbar-icon-btn {
        width: 44px;
        height: 34px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--surf2);
        border: 1px solid var(--bdr2);
        color: var(--txt2);
        transition: all 0.15s;
        flex: 0 0 44px;
      }
      .theme-toggle-btn:hover { background: var(--surf3); color: var(--txt); border-color: var(--bdr2); }
      .topbar-icon-btn:hover { background: var(--surf3); color: var(--blue-l); border-color: var(--blue-l); }
      .square-icon-btn {
        width: 44px;
        height: 34px;
        padding: 0;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 44px;
      }
      .chat-container,
      .input-outer { max-width: var(--content-max); }
      #empty-state { padding-top: 28px; }
      .welcome-logo { display: none; }
      .ws-sphere { background: var(--blue-l); }
      .ws-line { height: 0.5px; background: rgba(255,255,255,0.12); opacity: 1; }
      .welcome-title {
        font-size: 27px;
        color: var(--txt);
        letter-spacing: 0;
      }
      .welcome-sub {
        color: var(--txt2);
        max-width: 400px;
        margin-bottom: 36px;
        font-weight: 300;
      }
      .suggestions { max-width: 500px; }
      .suggestion-btn {
        background: var(--surf);
        border-color: var(--bdr2);
        border-radius: var(--radius-md);
        transition: all 0.18s;
      }
      .suggestion-btn:hover {
        border-color: var(--blue-l);
        background: var(--surf2);
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
      }
      .sug-icon,
      .msg-h,
      .msg-bubble b,
      .msg-bubble strong { color: var(--blue-l); }
      .sug-title,
      .msg-bubble { color: var(--txt); }
      .sug-sub,
      .msg-meta { color: var(--txt2); }
      .msg-ai-avatar {
        background: none;
        border: 0;
        overflow: hidden;
        padding: 0;
        position: relative;
      }
      .msg-ai-avatar.mind-active img { opacity: 0 !important; }
      .msg-ai-avatar.mind-active::after {
        content: "";
        position: absolute;
        inset: 1px;
        display: block;
        background: linear-gradient(135deg, var(--blue-l), var(--blue));
        -webkit-mask: url("mind_head_cutout.png") center / contain no-repeat;
        mask: url("mind_head_cutout.png") center / contain no-repeat;
        filter: drop-shadow(0 0 6px var(--accent-focus-ring));
        pointer-events: none;
      }
      body.light .msg-ai-avatar {
        width: 34px;
        height: 34px;
        border: 1px solid color-mix(in srgb, var(--blue) 20%, transparent);
        background: linear-gradient(180deg, rgba(255,255,255,0.96), var(--accent-soft-bg));
        box-shadow: 0 8px 18px color-mix(in srgb, var(--blue) 14%, transparent), inset 0 1px 0 rgba(255,255,255,0.86);
      }
      body.light .msg-ai-avatar.mind-active {
        width: 30px;
        height: 30px;
        border: 0;
        background: none;
        box-shadow: none;
      }
      body.light .msg-ai-avatar img {
        width: 29px;
        height: 29px;
        filter: grayscale(1) saturate(0) brightness(0.30) contrast(2.25);
        opacity: 0.96;
      }
      .msg-bubble,
      .typing-bubble {
        border-radius: 6px 14px 14px 14px;
        background: linear-gradient(180deg, rgba(36,87,212,0.16), rgba(13,13,18,0.96));
        border-color: rgba(74,122,255,0.34);
        border-left-color: var(--blue-l);
        color: var(--txt);
      }
      .msg-bubble.user {
        background: #14161e;
        border-color: rgba(255,255,255,0.11);
        border-left-color: rgba(255,255,255,0.11);
        border-radius: 14px 6px 14px 14px;
        color: var(--txt);
        font-weight: 500;
      }
      .msg-row.agent .msg-bubble,
      .msg-row[data-role="agent"] .msg-bubble,
      .msg-bubble.agent {
        background: linear-gradient(180deg, rgba(34,197,94,0.12), rgba(13,13,18,0.96));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .typing-row.agent .typing-bubble,
      .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.11), rgba(13,13,18,0.95));
        border-color: rgba(34,197,94,0.24);
        border-left-color: rgba(34,197,94,0.72);
      }
      .msg-row.system .msg-bubble,
      .msg-row[data-role="system"] .msg-bubble,
      .msg-bubble.system {
        background: linear-gradient(180deg, rgba(242,201,76,0.10), rgba(13,13,18,0.96));
        border-color: rgba(242,201,76,0.24);
        border-left-color: rgba(242,201,76,0.70);
      }
      .msg-li-dot,
      .t-dot { background: var(--blue-l); }
      #input-area {
        background: var(--bg);
        border-top-color: var(--bdr2);
      }
      .input-box {
        background: var(--surf);
        border: 1.5px solid rgba(74,122,255,0.45);
        border-radius: var(--radius-lg);
        box-shadow: none;
      }
      .composer-attachments {
        display: none;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 8px;
        padding: 0 14px 10px;
      }
      .composer-attachments.has-items {
        display: grid;
      }
      /* ISA-36: Quellenkontext-Chip im Composer (IsarMind-Blau, light/dark-sicher) */
      .composer-source-context {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 0 14px 10px;
        padding: 7px 8px 7px 12px;
        border: 1px solid rgba(74,122,255,0.30);
        border-radius: 999px;
        background: rgba(74,122,255,0.08);
        color: var(--blue-l);
        font-size: 12px;
        font-weight: 700;
        max-width: calc(100% - 28px);
      }
      .composer-source-context[hidden] {
        display: none;
      }
      .composer-source-icon {
        display: inline-flex;
        flex: 0 0 auto;
      }
      .composer-source-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .composer-source-label strong {
        font-weight: 800;
      }
      .composer-source-trust {
        flex: 0 0 auto;
        padding: 2px 8px;
        border-radius: 999px;
        background: rgba(74,122,255,0.16);
        font-size: 11px;
        font-weight: 800;
      }
      .composer-source-clear {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: inherit;
        cursor: pointer;
        opacity: 0.75;
      }
      .composer-source-clear:hover {
        opacity: 1;
        background: rgba(74,122,255,0.16);
      }
      .composer-voice-capture {
        display: grid;
        grid-template-columns: auto minmax(96px, 1fr) auto;
        align-items: center;
        gap: 12px;
        min-height: 44px;
        margin: 0 14px 10px;
        padding: 8px 8px 8px 12px;
        border: 1px solid rgba(74,122,255,0.30);
        border-radius: 14px;
        background: rgba(74,122,255,0.08);
      }
      .composer-voice-capture[hidden] {
        display: none;
      }
      .composer-voice-left {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--blue-l);
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
      }
      .composer-voice-dot {
        width: 8px;
        height: 8px;
        flex: 0 0 8px;
        border-radius: 999px;
        background: #22c55e;
        box-shadow: 0 0 0 4px rgba(34,197,94,0.16);
      }
      .composer-voice-label {
        overflow: hidden;
        max-width: 132px;
        text-overflow: ellipsis;
      }
      .composer-voice-wave {
        height: 28px;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        overflow: hidden;
        border-radius: 999px;
        background: rgba(74,122,255,0.08);
        padding: 0 10px;
      }
      .composer-voice-wave span {
        width: 3px;
        height: 7px;
        flex: 0 0 3px;
        border-radius: 999px;
        background: currentColor;
        color: var(--blue-l);
        opacity: 0.72;
        transform-origin: center;
        animation: composer-wave-pulse 0.92s ease-in-out infinite;
      }
      .composer-voice-wave span:nth-child(2n) { animation-delay: -0.18s; }
      .composer-voice-wave span:nth-child(3n) { animation-delay: -0.34s; }
      .composer-voice-wave span:nth-child(4n) { animation-delay: -0.52s; }
      .composer-voice-wave span:nth-child(5n) { animation-delay: -0.68s; }
      @keyframes composer-wave-pulse {
        0%, 100% { transform: scaleY(0.46); opacity: 0.46; }
        45% { transform: scaleY(2.35); opacity: 0.95; }
      }
      .composer-voice-stop {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(36,87,212,0.28);
        border-radius: 11px;
        background: var(--blue);
        color: #fff;
        cursor: pointer;
        box-shadow: 0 10px 20px rgba(36,87,212,0.20);
      }
      .composer-voice-stop:hover,
      .composer-voice-stop:focus-visible {
        background: var(--blue-l);
        outline: 0;
      }
      .composer-attachment-chip {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 9px;
        border: 1px solid rgba(74,122,255,0.30);
        border-radius: 12px;
        background: rgba(74,122,255,0.08);
        padding: 8px 9px;
      }
      .composer-attachment-icon {
        width: 26px;
        height: 26px;
        display: grid;
        place-items: center;
        flex: 0 0 26px;
        border-radius: 9px;
        background: rgba(74,122,255,0.14);
        color: var(--blue-l);
      }
      .composer-attachment-text {
        min-width: 0;
        flex: 1;
      }
      .composer-attachment-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--txt);
        font-size: 12px;
        font-weight: 800;
        line-height: 1.25;
      }
      .composer-attachment-meta {
        color: var(--txt3);
        font-size: 10.5px;
        line-height: 1.25;
      }
      .composer-attachment-actions {
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 0 0 auto;
      }
      .composer-attachment-knowledge,
      .composer-attachment-knowledge-state {
        min-height: 26px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 9px;
        border-radius: 8px;
        font-size: 10.5px;
        font-weight: 750;
        white-space: nowrap;
      }
      .composer-attachment-knowledge {
        border: 1px solid rgba(36,87,212,0.34);
        background: rgba(36,87,212,0.10);
        color: var(--blue-l);
        cursor: pointer;
      }
      .composer-attachment-knowledge:hover,
      .composer-attachment-knowledge:focus-visible {
        border-color: rgba(36,87,212,0.58);
        background: rgba(36,87,212,0.18);
        outline: 0;
      }
      .composer-attachment-knowledge:disabled {
        cursor: wait;
        opacity: 0.72;
      }
      .composer-attachment-knowledge-state {
        border: 1px solid rgba(29,161,116,0.30);
        background: rgba(29,161,116,0.10);
        color: var(--green);
      }
      .composer-attachment-remove {
        width: 24px;
        height: 24px;
        display: grid;
        place-items: center;
        flex: 0 0 24px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--txt3);
        cursor: pointer;
      }
      .composer-attachment-remove:hover,
      .composer-attachment-remove:focus-visible {
        background: rgba(255,255,255,0.08);
        color: var(--txt);
        outline: 0;
      }
      .input-box:focus-within {
        border-color: var(--blue-l);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.12);
      }
      .input-outer { position: relative; }
      .composer-status-toast,
      .mind-context-toast {
        position: absolute;
        left: 50%;
        bottom: 78px;
        max-width: calc(100vw - 32px);
        overflow: hidden;
        text-overflow: ellipsis;
        transform: translate(-50%, 6px);
        opacity: 0;
        pointer-events: none;
        z-index: 8;
        padding: 7px 10px;
        border-radius: 999px;
        border: 1px solid rgba(74,122,255,0.34);
        background: rgba(13,17,28,0.94);
        color: var(--txt);
        font-size: 11.5px;
        font-weight: 800;
        box-shadow: 0 10px 30px rgba(0,0,0,0.35);
        transition: opacity 0.18s ease, transform 0.18s ease;
        white-space: nowrap;
      }
      .composer-status-toast.show,
      .mind-context-toast.show {
        opacity: 1;
        transform: translate(-50%, 0);
      }
      #msg-input {
        font-size: 15px;
        font-weight: 500;
        color: var(--txt);
        font-family: var(--font-body);
      }
      #msg-input::placeholder { color: var(--txt3); }
      .ibar-btn { color: var(--txt3); }
      .ibar-btn:hover { background: var(--bdr2); color: var(--blue-l); }
      .ibar-btn.recording {
        background: rgba(74,122,255,0.17);
        color: var(--blue-l);
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.34), 0 0 14px rgba(74,122,255,0.20);
      }
      .ibar-btn.recording svg rect {
        fill: currentColor;
      }
      .ibar-mind-btn {
        padding: 0;
        position: relative;
      }
      .ibar-mind-btn img {
        display: block;
        height: 18px;
        width: 18px;
        filter: var(--mind-logo-gray-filter);
        opacity: var(--mind-logo-gray-opacity);
        object-fit: contain;
      }
      .ibar-mind-btn:hover,
      .ibar-mind-btn.active {
        background: rgba(74,122,255,0.10);
        color: var(--blue-l);
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.28);
      }
      .ibar-mind-btn:hover img,
      .ibar-mind-btn.active img {
        opacity: 0 !important;
      }
      .ibar-mind-btn:hover::after,
      .ibar-mind-btn.active::after {
        content: "";
        display: block;
        position: absolute;
        left: 50%;
        top: 50%;
        width: 18px;
        height: 18px;
        transform: translate(-50%, -50%);
        background: linear-gradient(135deg, var(--blue-l), var(--blue));
        -webkit-mask: url("mind_head_cutout.png") center / contain no-repeat;
        mask: url("mind_head_cutout.png") center / contain no-repeat;
        filter: drop-shadow(0 0 4px var(--accent-focus-ring));
        pointer-events: none;
      }
      .ibar-sep { background: var(--bdr2); }
      .ibar-model-tag {
        padding: 4px 10px;
        border-radius: 20px;
        font-size: 12.5px;
        color: var(--txt3);
        font-weight: 700;
      }
      .ibar-model-tag .smart-bulb-mark {
        width: 15px;
        height: 15px;
        flex: 0 0 15px;
      }
      .ibar-model-tag .smart-bulb-light {
        fill: none;
        stroke: currentColor;
      }
      .ibar-model-tag .smart-bulb-base { stroke: currentColor; }
      /* ISA-32: aktives Modell-Logo (Brand-Chip) im Topbar-Pill und im Eingabeleisten-Tag */
      .model-pill-logo.model-pill-brand {
        width: 24px;
        height: 24px;
        border: 0;
        background: transparent;
      }
      .model-pill-logo .provider-dot {
        width: 24px;
        height: 24px;
        flex: 0 0 24px;
        border-radius: 6px;
        box-shadow: none;
      }
      .model-pill-logo .provider-dot svg { width: 15px; height: 15px; }
      .ibar-model-icon { display: inline-flex; align-items: center; justify-content: center; }
      .ibar-model-tag .provider-dot {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
        border-radius: 5px;
        box-shadow: none;
      }
      .ibar-model-tag .provider-dot svg { width: 12px; height: 12px; }
      #send-btn { background: var(--bdr2); }
      #send-btn.ready { background: var(--blue-ui-bg); box-shadow: var(--blue-ui-shadow); }
      #send-btn.ready:hover { background: var(--blue-ui-bg-hover); }
      .input-disclaimer { color: var(--txt3); }

      body:not(.light) #sidebar {
        background: #080b11;
      }
      body:not(.light) #topbar,
      body:not(.light) #input-area,
      body:not(.light) #view-chat,
      body:not(.light) .page-scroll {
        background: var(--surface);
      }
      body:not(.light) .sb-brand,
      body:not(.light) .sb-footer,
      body:not(.light) #topbar,
      body:not(.light) #input-area {
        border-color: var(--bdr2);
      }
      body:not(.light) .sb-nav-item,
      body:not(.light) .sb-history-item,
      body:not(.light) .sb-user-role,
      body:not(.light) .usage-meta,
      body:not(.light) .model-smart-sub,
      body:not(.light) .project-status-text,
      body:not(.light) .project-doc-meta,
      body:not(.light) .project-source-chip-row,
      body:not(.light) .assistant-chat-sub {
        color: var(--txt3);
      }
      body:not(.light) .sb-user-name,
      body:not(.light) .assistant-chat-title,
      body:not(.light) .project-panel-title,
      body:not(.light) .project-list strong,
      body:not(.light) .project-doc-row strong,
      body:not(.light) .project-task-row strong {
        color: var(--txt);
      }
      body:not(.light) .decision-lane,
      body:not(.light) .citation-card,
      body:not(.light) .audio-transcript,
      body:not(.light) .pitch-status,
      body:not(.light) .upload-dropzone {
        background: #1a2231;
        color: var(--txt2);
      }
      body:not(.light) .msg-bubble,
      body:not(.light) .typing-bubble {
        background: linear-gradient(180deg, rgba(74,122,255,0.18), rgba(23,30,43,0.98));
        border-color: rgba(119,148,255,0.34);
        color: var(--txt);
      }
      body:not(.light) .msg-bubble.user {
        background: #222b3d;
        border-color: rgba(255,255,255,0.16);
        border-left-color: rgba(255,255,255,0.16);
      }
      body:not(.light) .msg-row.agent .msg-bubble,
      body:not(.light) .msg-row[data-role="agent"] .msg-bubble,
      body:not(.light) .msg-bubble.agent,
      body:not(.light) .typing-row.agent .typing-bubble,
      body:not(.light) .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.14), rgba(23,30,43,0.98));
      }
      body:not(.light) .msg-row.system .msg-bubble,
      body:not(.light) .msg-row[data-role="system"] .msg-bubble,
      body:not(.light) .msg-bubble.system {
        background: linear-gradient(180deg, rgba(242,201,76,0.14), rgba(23,30,43,0.98));
      }
      body:not(.light) .knowledge-hero-card,
      body:not(.light) .dept-overview-hero,
      body:not(.light) .locked-access-card,
      body:not(.light) .admin-panel,
      body:not(.light) .document-card,
      body:not(.light) .chat-entry-card {
        background: linear-gradient(180deg, rgba(31,39,56,0.98), rgba(23,30,43,0.98));
      }
      body:not(.light) #app-modal-overlay,
      body:not(.light) #lock-modal-overlay {
        background: rgba(11,17,29,0.52);
      }
      body:not(.light) .app-modal,
      body:not(.light) .lock-modal {
        background: var(--surf);
        box-shadow: 0 28px 72px rgba(4,8,18,0.36);
      }
      body:not(.light) #auth-shell {
        background:
          linear-gradient(180deg, #121826 0%, #111723 100%);
      }
      body:not(.light) .auth-card {
        background: rgba(23,30,43,0.96);
        box-shadow: 0 28px 72px rgba(4,8,18,0.34);
      }
      body:not(.light) .auth-field input,
      body:not(.light) .upload-dropzone {
        background: #1a2231;
        color: var(--txt);
      }
      body:not(.light) .knowledge-hero,
      body:not(.light) .department-hero,
      body:not(.light) .locked-access-view,
      body:not(.light) .admin-panel-hero {
        background:
          linear-gradient(135deg, rgba(74,122,255,0.18), rgba(29,38,54,0.94) 42%, rgba(17,23,35,0.98)),
          var(--surf);
      }
      body:not(.light) .document-card.locked,
      body:not(.light) .document-card.is-locked,
      body:not(.light) .knowledge-document-card.locked,
      body:not(.light) .knowledge-document-card.is-locked,
      body:not(.light) .document-card.locked-doc,
      body:not(.light) .department-context-row.is-locked,
      body:not(.light) .model-option.locked,
      body:not(.light) .sb-nav-item.locked {
        opacity: 0.86;
      }
      body:not(.light) .model-option.locked:hover,
      body:not(.light) .sb-nav-item.locked:hover {
        opacity: 0.94;
      }

      body.light {
        --bg: #f4f7ff;
        --surface: #ffffff;
        --surface-2: #f7f9ff;
        --surface-3: #edf2ff;
        --text: #111827;
        --text-soft: #24304a;
        --muted: #6b7280;
        --border: #e5e9f5;
        --border-md: #d8dfef;
        --navy: #0b1020;
        --surf: #ffffff;
        --surf2: #f7f9ff;
        --surf3: #edf2ff;
        --txt: #0f172a;
        --txt2: #475569;
        --txt3: #64748b;
        --bdr2: #d8dfef;
        --bdim: rgba(36,87,212,0.08);
        --brand-dot-active: var(--blue);
        --brand-dot-active-soft: rgba(36,87,212,0.16);
        --brand-dot-disabled: #94a3b8;
        --smart-idea-bg: rgba(36,87,212,0.10);
        --smart-idea-border: rgba(36,87,212,0.30);
        --smart-idea-fill: var(--blue);
        --smart-idea-stroke: #1744ad;
        --smart-idea-base: #24304a;
        --mind-logo-gray-filter: grayscale(1) saturate(0) brightness(0.45) contrast(1.65);
        --mind-logo-gray-opacity: 0.82;
        --scrollbar-thumb: rgba(15, 23, 42, 0.26);
        --scrollbar-thumb-hover: rgba(15, 23, 42, 0.4);
        color: var(--text);
      }
      body.light #sidebar,
      body.light #topbar,
      body.light #input-area,
      body.light #view-chat,
      body.light .page-scroll {
        background: var(--bg);
      }
      body.light #sidebar,
      body.light #topbar,
      body.light #input-area {
        border-color: var(--border-md);
      }
      body.light .sb-brand,
      body.light .sb-footer {
        border-color: var(--border-md);
      }
      body.light .sb-nav-item,
      body.light .sb-history-item,
      body.light .sb-user-name,
      body.light .sb-user-role {
        color: var(--text-soft);
      }
      body.light .sb-nav-item:hover,
      body.light .sb-history-item:hover,
      body.light .sb-nav-item.active,
      body.light .sb-history-item.active {
        background: rgba(36,87,212,0.08);
        color: var(--blue);
      }
      body.light .sb-section-label,
      body.light .usage-meter-label,
      body.light .usage-meta {
        color: var(--muted);
      }
      body.light .model-pill,
      body.light .model-dropdown,
      body.light .composer-model-popover,
      body.light .tenant-pill,
      body.light .tenant-dropdown,
      body.light .topbar-badge,
      body.light .theme-toggle-btn,
      body.light .suggestion-btn,
      body.light .pg-card,
      body.light .settings-group,
      body.light .settings-profile,
      body.light .metric-card,
      body.light .analysis-box,
      body.light .decision-card,
      body.light .task-card,
      body.light .insight-panel,
      body.light .rag-query-panel,
      body.light .rag-answer-panel,
      body.light .rag-source-card,
      body.light .mind-upload-card,
      body.light .mind-info-panel,
      body.light .audio-panel,
      body.light .readiness-card,
      body.light .pitch-script,
      body.light .input-box,
      body.light .lock-modal,
      body.light .app-modal {
        background: var(--surface);
        border-color: var(--border-md);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .welcome-title,
      body.light .ph-title,
      body.light .pg-card-title,
      body.light .settings-sec-label,
      body.light .sr-label,
      body.light .form-label,
      body.light .settings-name,
      body.light .modal-title,
      body.light .plan-name {
        color: var(--text);
      }
      body.light .welcome-sub,
      body.light .pg-card-sub,
      body.light .sr-sub,
      body.light .settings-role,
      body.light .input-disclaimer,
      body.light .modal-sub,
      body.light .plan-copy {
        color: var(--muted);
      }
      body.light .pg-card-ico {
        background: #edf4ff;
        border-color: rgba(36,87,212,0.20);
        color: var(--blue);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
      }
      body.light .project-folder-icon {
        background: #eef5ff;
        border-color: rgba(36,87,212,0.22);
        color: var(--blue);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
      }
      body.light .project-folder-open-label {
        color: #64748b;
      }
      body.light .decision-lane,
      body.light .citation-card,
      body.light .audio-transcript,
      body.light .upload-dropzone {
        background: #f8fbff;
        border-color: var(--border);
        color: var(--text-soft);
      }
      body.light .form-input,
      body.light .form-select,
      body.light .form-textarea,
      body.light #msg-input {
        background: #fff;
        color: var(--text);
        border-color: var(--border-md);
      }
      body.light .msg-bubble,
      body.light .typing-bubble {
        background: linear-gradient(180deg, rgba(36,87,212,0.10), #fff);
        color: var(--text);
        border-color: rgba(36,87,212,0.24);
        border-left-color: var(--blue);
      }
      body.light .msg-bubble.user {
        background: #f8fafc;
        border-color: #d8dfef;
        border-left-color: #d8dfef;
        color: var(--text);
      }
      body.light .msg-row.agent .msg-bubble,
      body.light .msg-row[data-role="agent"] .msg-bubble,
      body.light .msg-bubble.agent {
        background: linear-gradient(180deg, rgba(34,197,94,0.09), #fff);
        border-color: rgba(22,163,74,0.22);
        border-left-color: rgba(22,163,74,0.68);
      }
      body.light .typing-row.agent .typing-bubble,
      body.light .typing-row[data-role="agent"] .typing-bubble {
        background: linear-gradient(180deg, rgba(34,197,94,0.08), #fff);
        border-color: rgba(22,163,74,0.22);
        border-left-color: rgba(22,163,74,0.68);
      }
      body.light .msg-row.system .msg-bubble,
      body.light .msg-row[data-role="system"] .msg-bubble,
      body.light .msg-bubble.system {
        background: linear-gradient(180deg, rgba(217,119,6,0.08), #fff);
        border-color: rgba(217,119,6,0.22);
        border-left-color: rgba(217,119,6,0.64);
      }
      body.light .toggle {
        background: #d1d7e5;
      }
      body.light .toggle.on {
        background: var(--blue);
      }
      body.light .suggestion-btn:hover,
      body.light .pg-card:hover,
      body.light .btn-secondary:hover,
      body.light .btn-outline:hover,
      body.light .model-option:hover,
      body.light .tenant-pill:hover,
      body.light .tenant-selector-wrap[open] .tenant-pill,
      body.light .tenant-selector-root[open] .tenant-pill,
      body.light .tenant-pill.open,
      body.light .tenant-option:hover,
      body.light .tenant-option.active,
      body.light .ibar-btn:hover,
      body.light .topbar-badge:hover,
      body.light .theme-toggle-btn:hover {
        background: #eef4ff;
        border-color: rgba(36,87,212,0.36);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .theme-toggle-btn:hover {
        background: #e7ebf1;
        border-color: #c8d0dd;
        color: #334155;
      }
      body.light .assistant-editor {
        background: #ffffff;
        border-color: var(--border-md);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .assistant-chat-bar {
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.12), rgba(255,255,255,0.96) 46%),
          var(--surface);
        border-color: rgba(var(--assistant-accent-rgb), 0.3);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.1), inset 0 1px 0 rgba(255,255,255,0.72);
      }
      body.light #view-assistants .assistant-card-shell {
        border-color: rgba(var(--assistant-accent-rgb), 0.3);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.12), rgba(255,255,255,0.96) 46%),
          var(--surface);
        box-shadow: 0 14px 34px rgba(15,23,42,0.1), inset 0 1px 0 rgba(255,255,255,0.72);
      }
      body.light #view-assistants .assistant-card-shell:hover,
      body.light #view-assistants .assistant-card-shell:focus-within {
        border-color: rgba(var(--assistant-accent-rgb), 0.68);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.18), rgba(255,255,255,0.98) 46%),
          var(--surface-2);
        box-shadow: 0 18px 38px rgba(15,23,42,0.14), 0 0 0 1px rgba(var(--assistant-accent-rgb), 0.16);
      }
      body.light #view-assistants .assistant-card-shell .assistant-avatar {
        background: rgba(var(--assistant-accent-rgb), 0.16);
        color: var(--assistant-accent);
      }
      body.light #view-agents .assistant-card-shell {
        border-color: rgba(var(--assistant-accent-rgb), 0.3);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.12), rgba(255,255,255,0.96) 46%),
          var(--surface);
        box-shadow: 0 14px 34px rgba(15,23,42,0.1), inset 0 1px 0 rgba(255,255,255,0.72);
      }
      body.light #view-agents .assistant-card-shell:hover,
      body.light #view-agents .assistant-card-shell:focus-within {
        border-color: rgba(var(--assistant-accent-rgb), 0.68);
        background:
          linear-gradient(135deg, rgba(var(--assistant-accent-rgb), 0.18), rgba(255,255,255,0.98) 46%),
          var(--surface-2);
        box-shadow: 0 18px 38px rgba(15,23,42,0.14), 0 0 0 1px rgba(var(--assistant-accent-rgb), 0.16);
      }
      body.light #view-agents .assistant-card-shell .assistant-avatar {
        background: rgba(var(--assistant-accent-rgb), 0.16);
        color: var(--assistant-accent);
      }

      /* Reference-aligned workspace backgrounds */
      body:not(.light) {
        --bg: #111827;
        --surface: #111827;
        --surface-2: #172033;
        --surface-3: #1d2941;
        --surf: #101724;
        --surf2: #172033;
        --surf3: #1d2941;
        --bdr: rgba(142, 164, 210, 0.12);
        --bdr2: rgba(142, 164, 210, 0.20);
        --txt: #f7faff;
        --txt2: #d9e2f4;
        --txt3: #a8b5cc;
        background: #111827;
      }
      body:not(.light)::before {
        background:
          linear-gradient(180deg, #1d2944 0%, #141d30 55%, #0e1320 100%);
      }
      body:not(.light) #sidebar {
        background: #101722;
        border-right-color: rgba(142,164,210,0.22);
      }
      body:not(.light) .sb-brand,
      body:not(.light) .sb-footer,
      body:not(.light) .usage-meter {
        background: #101722;
        border-color: rgba(142,164,210,0.18);
      }
      body:not(.light) #topbar {
        background: #111827;
        border-bottom-color: rgba(142,164,210,0.20);
      }
      body:not(.light) #view-chat {
        background: #17233a;
      }
      body:not(.light) .page-scroll {
        background: #17233a;
      }
      body:not(.light) #chat-scroll {
        background: transparent;
      }
      body:not(.light) #input-area {
        background: #111827;
        border-top-color: rgba(142,164,210,0.22);
      }
      body:not(.light) .suggestion-btn {
        background: rgba(23,32,51,0.72);
        border-color: rgba(142,164,210,0.28);
      }
      body:not(.light) .input-box {
        background: rgba(17,24,39,0.96);
        border-color: rgba(74,122,255,0.58);
      }
      body:not(.light) .model-pill,
      body:not(.light) .tenant-pill,
      body:not(.light) .topbar-badge,
      body:not(.light) .theme-toggle-btn,
      body:not(.light) .topbar-icon-btn {
        background: rgba(23,32,51,0.92);
        border-color: rgba(142,164,210,0.24);
      }
      body:not(.light) .model-dropdown,
      body:not(.light) .composer-model-popover,
      body:not(.light) .tenant-dropdown {
        background: #111827;
        border-color: rgba(142,164,210,0.24);
      }
      body.light {
        --bg: #eef4ff;
        --surface: #ffffff;
        --surface-2: #f7faff;
        --surface-3: #e7efff;
        --surf: #ffffff;
        --surf2: #f8fbff;
        --surf3: #eaf2ff;
        --bdr: #dfe7f5;
        --bdr2: #cfd9ec;
        background: #eef4ff;
      }
      body.light::before {
        background:
          linear-gradient(180deg, #eef4ff 0%, #f3f7ff 56%, #eef4ff 100%);
      }
      body.light #sidebar {
        background: #f4f8ff;
        border-right-color: #d6dfef;
      }
      body.light .sb-brand,
      body.light .sb-footer,
      body.light .usage-meter {
        background: #f4f8ff;
        border-color: #d6dfef;
      }
      body.light #topbar {
        background: rgba(248,251,255,0.92);
        border-bottom-color: #d6dfef;
      }
      body.light #view-chat,
      body.light .page-scroll {
        background:
          linear-gradient(180deg, #eef4ff 0%, #f3f7ff 100%);
      }
      body.light #chat-scroll {
        background: transparent;
      }
      body.light #input-area {
        background: #eef4ff;
        border-top-color: #d6dfef;
      }
      body.light .suggestion-btn,
      body.light .input-box {
        background: rgba(255,255,255,0.88);
        border-color: #cbd7ee;
      }
      body.light .model-pill,
      body.light .tenant-pill,
      body.light .topbar-badge,
      body.light .theme-toggle-btn,
      body.light .topbar-icon-btn {
        background: rgba(255,255,255,0.92);
        border-color: #cbd7ee;
      }
      body.light .composer-model-popover {
        background: rgba(255,255,255,0.96);
        border-color: #cbd7ee;
        box-shadow: 0 18px 48px rgba(15,23,42,0.18);
      }

      /* Fine enterprise typography pass */
      body {
        font-size: var(--font-size-base);
        font-weight: 400;
        line-height: 1.48;
      }
      button,
      input,
      textarea,
      select {
        font-weight: 500;
      }
      .sb-brand-name {
        font-size: 14px;
        font-weight: 650;
      }
      .sb-brand-claim,
      .tenant-pill-kicker,
      .model-group-label,
      .usage-meter-label,
      .usage-meter-upgrade,
      .sb-section-label {
        font-size: 9px;
        font-weight: 500;
      }
      .btn-new-chat,
      .sb-nav-item,
      .sb-library-subitem {
        font-size: 12.5px;
        font-weight: 520;
      }
      .sb-nav-item {
        padding-top: 6px;
        padding-bottom: 6px;
      }
      .sb-history-item {
        font-size: 12px;
        font-weight: 430;
      }
      .sb-user-name {
        font-size: 12.5px;
        font-weight: 600;
      }
      .sb-user-role,
      .usage-meta {
        font-size: 10.5px;
        font-weight: 400;
      }
      .model-pill {
        font-size: 13px;
        font-weight: 550;
      }
      .model-smart-title,
      .model-option,
      .tenant-pill-label,
      .tenant-option-title {
        font-size: 12.5px;
        font-weight: 560;
      }
      .model-smart-sub,
      .tenant-pill-meta,
      .tenant-option-meta,
      .topbar-badge {
        font-size: 10.5px;
        font-weight: 450;
      }
      .welcome-title {
        font-size: 24px;
        font-weight: 520;
        line-height: 1.2;
      }
      .welcome-sub,
      .input-disclaimer {
        font-size: 10.5px;
        font-weight: 350;
      }
      .suggestion-btn {
        padding: 16px 18px;
      }
      .sug-title {
        font-size: 12.5px;
        font-weight: 560;
      }
      .sug-sub {
        font-size: 11px;
        font-weight: 400;
      }
      #msg-input {
        font-size: 13.5px;
        font-weight: 400;
      }
      .ibar-model-tag {
        font-size: 11.5px;
        font-weight: 560;
      }
      .msg-bubble,
      .typing-bubble {
        font-size: 12.5px;
        font-weight: 400;
      }
      .msg-h,
      .msg-bubble b,
      .msg-bubble strong {
        font-weight: 600;
      }
      .ph-title {
        font-size: 19px;
        font-weight: 560;
      }
      .ph-sub {
        font-size: 12.5px;
        font-weight: 400;
      }
      .library-page-title {
        font-size: 32px;
        font-weight: 520;
        line-height: 1.04;
      }
      .project-overview-title {
        font-size: 56px;
        font-weight: 420;
        line-height: 1.02;
      }
      .library-page-sub {
        font-size: 14px;
        font-weight: 380;
        line-height: 1.52;
      }
      .library-kicker,
      .knowledge-breadcrumb,
      .breadcrumb,
      .breadcrumbs {
        font-size: 11px;
        font-weight: 500;
      }
      .library-search,
      .library-select,
      .library-dropdown-trigger {
        min-height: 40px;
        font-size: 13px;
        font-weight: 500;
      }
      .library-dropdown-option {
        min-height: 36px;
        font-size: 13px;
        font-weight: 430;
      }
      .library-section-title,
      .knowledge-hero-title,
      .department-hero-title,
      .admin-panel-title {
        font-size: 24px;
        font-weight: 560;
      }
      .library-section-sub,
      .library-count,
      .project-overview-sub,
      .knowledge-hero-copy,
      .department-hero-copy,
      .admin-panel-copy {
        font-size: 12.5px;
        font-weight: 400;
      }
      .pg-card,
      .skill-row,
      .department-card,
      .knowledge-department-card,
      .document-card,
      .admin-user-card,
      .admin-user-row,
      .project-card,
      .project-detail-card,
      .settings-group,
      .form-section {
        font-size: 12.5px;
      }
      .pg-card-title,
      .dept-intro-title,
      .dept-card-title,
      .department-title,
      .dept-title,
      .document-title,
      .assistant-entry-title,
      .admin-user-name,
      .project-card-title,
      .project-title,
      .settings-name,
      .manage-item-title {
        font-size: 14px;
        font-weight: 580;
        line-height: 1.28;
      }
      .pg-card-sub,
      .dept-card-desc,
      .department-description,
      .dept-description,
      .document-description,
      .assistant-entry-card,
      .department-context-note,
      .manage-item-sub,
      .form-hint,
      .settings-role {
        font-size: 11.5px;
        font-weight: 380;
        line-height: 1.48;
      }
      .pg-action-btn,
      .btn-primary,
      .btn-secondary,
      .btn-outline,
      .skill-view-btn,
      .form-input,
      .form-select,
      .form-textarea {
        font-size: 12.5px;
        font-weight: 500;
      }
      .chip,
      .status-badge,
      .knowledge-badge,
      .access-badge,
      .role-badge,
      .document-status,
      .user-status,
      .file-badge {
        font-size: 10px;
        font-weight: 600;
      }
      .skill-group-head {
        font-size: 14px;
        font-weight: 560;
      }
      .skill-title {
        font-size: 14px;
        font-weight: 560;
      }
      .skill-desc {
        font-size: 11.5px;
        font-weight: 380;
        line-height: 1.48;
      }
      .skill-meta {
        font-size: 10.5px;
        font-weight: 400;
      }
      .modal-title {
        font-size: 18px;
        font-weight: 560;
      }
      .modal-sub,
      .lock-modal-sub {
        font-size: 12.5px;
        font-weight: 380;
      }

      #lock-modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 1000;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(4px);
      }
      #lock-modal-overlay.open { display: flex; }
      .lock-modal {
        background: var(--surf);
        border: 1px solid var(--bdr2);
        border-radius: 18px;
        padding: 32px 28px 24px;
        max-width: 360px;
        width: 100%;
        box-shadow: 0 24px 64px rgba(0,0,0,0.5);
        text-align: center;
      }
      .lock-modal-icon {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: rgba(74,122,255,0.12);
        border: 1px solid rgba(74,122,255,0.25);
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 16px;
        color: var(--blue-l);
      }
      .lock-modal-title {
        font-size: 17px;
        font-weight: 700;
        color: var(--txt);
        margin-bottom: 8px;
      }
      .lock-modal-sub {
        font-size: 13.5px;
        color: var(--txt3);
        line-height: 1.65;
        margin-bottom: 22px;
      }
      .lock-modal-actions { display: flex; gap: 10px; justify-content: center; }
      .lock-modal-upgrade,
      .lock-modal-close {
        padding: 9px 18px;
        border-radius: var(--radius-md);
        font-size: 13.5px;
        font-weight: 700;
      }
      .lock-modal-upgrade {
        background: var(--blue);
        color: #fff;
        box-shadow: 0 4px 14px rgba(36,87,212,0.4);
      }
      .lock-modal-close {
        background: var(--surf2);
        color: var(--txt);
        border: 1px solid var(--bdr2);
      }
      #app-modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1100;
        align-items: center;
        justify-content: center;
        padding: 22px;
        background: rgba(0,0,0,0.58);
        backdrop-filter: blur(5px);
      }
      #app-modal-overlay.open { display: flex; }
      .app-modal {
        width: min(860px, 100%);
        max-height: min(86vh, 760px);
        overflow-y: auto;
        background: var(--surf);
        border: 1px solid var(--bdr2);
        border-radius: 18px;
        box-shadow: 0 28px 80px rgba(0,0,0,0.48);
        padding: 24px;
        color: var(--txt);
      }
      .modal-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 18px;
      }
      .modal-title { font-size: 22px; font-weight: 800; color: var(--txt); }
      .modal-sub { color: var(--txt3); line-height: 1.55; margin-top: 4px; }
      .modal-close {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        font-size: 0;
        line-height: 0;
        font-weight: 600;
        color: var(--txt2);
        border: 1px solid var(--bdr2);
        background: var(--surf2);
        flex-shrink: 0;
        cursor: pointer;
      }
      .modal-close span {
        display: block;
        font-size: 32px;
        line-height: 1;
        transform: translateY(-2px);
      }
      .modal-close:hover {
        color: var(--txt);
        border-color: rgba(74,122,255,0.46);
        background: rgba(74,122,255,0.14);
      }
      .modal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
      .confirm-card {
        border: 1px solid rgba(74,122,255,0.22);
        border-radius: 14px;
        background: var(--surf2);
        padding: 16px;
        color: var(--txt2);
        line-height: 1.55;
      }
      .confirm-title {
        color: var(--txt);
        font-weight: 800;
        margin-bottom: 6px;
      }
      .btn-danger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 9px 16px;
        border-radius: var(--radius-md);
        font-size: 13px;
        font-weight: 700;
        background: linear-gradient(180deg, #ff766e 0%, #c24134 100%);
        border: 0;
        color: #fff;
        box-shadow: 0 12px 28px rgba(194,65,52,0.22);
      }
      .plan-card {
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf2);
        padding: 18px;
        display: grid;
        gap: 10px;
      }
      .plan-card.featured {
        border-color: rgba(74,122,255,0.72);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.12);
      }
      .plan-name { font-size: 17px; font-weight: 800; color: var(--txt); }
      .plan-price { font-size: 28px; font-weight: 900; color: var(--blue-l); }
      .plan-copy, .plan-list { color: var(--txt3); font-size: 13px; line-height: 1.55; }
      .plan-list { display: grid; gap: 6px; padding-left: 0; list-style: none; }
      .billing-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
      .billing-toggle { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surf2); border: 1px solid var(--bdr2); }
      .billing-toggle button { padding: 8px 14px; border-radius: 999px; color: var(--txt3); font-weight: 800; }
      .billing-toggle button.active { background: var(--blue-ui-bg); color: #fff; }
      .modal-form { display: grid; gap: 12px; }
      .modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
      .checkout-status { margin-top: 12px; color: var(--txt3); font-size: 13px; }
      @media (max-width: 760px) {
        .modal-grid { grid-template-columns: 1fr; }
        .app-modal { padding: 18px; }
        .dept-upload-grid { grid-template-columns: 1fr; }
      }
      .sr-only-meta {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        white-space: nowrap;
        border: 0;
      }

      /* Auth-State-Maschine: NUR "authenticated" zeigt die App; jeder andere
         Zustand (checking | anonymous | recovery — und auch unbekannte Werte,
         die z.B. veraltete gecachte Hotfix-Scripts setzen koennten) zeigt die
         Login-Shell und versteckt das App-Chrome komplett. Einzige Quelle der
         Wahrheit ist body[data-auth-state]; JS setzt zusaetzlich hidden/inert. */
      body:not([data-auth-state="authenticated"]) {
        display: block;
        overflow: hidden auto;
      }
      body:not([data-auth-state="authenticated"]) #sidebar,
      body:not([data-auth-state="authenticated"]) #main,
      body:not([data-auth-state="authenticated"]) #lock-modal-overlay,
      body:not([data-auth-state="authenticated"]) #app-modal-overlay,
      body:not([data-auth-state="authenticated"]) #mobile-bottom-nav,
      body:not([data-auth-state="authenticated"]) #mobile-drawer-backdrop {
        display: none !important;
        pointer-events: none !important;
      }
      body[data-auth-state="authenticated"] {
        display: flex;
        overflow: hidden;
      }
      body[data-auth-state="authenticated"] #sidebar,
      body[data-auth-state="authenticated"] #main {
        pointer-events: auto;
      }
      body[data-auth-state="authenticated"] #auth-shell,
      #auth-shell[hidden] {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
      }
      #auth-shell {
        /* Ueber den body::before-Deko-Gradienten (position:fixed, z-index:0)
           heben — sonst uebermalt der Vollbild-Verlauf die komplette
           Login-Card ("nur Hintergrund" auf neuen Geraeten). */
        position: relative;
        z-index: 1;
        min-height: 100dvh;
        width: 100%;
        display: grid;
        place-items: center;
        padding: 28px 18px;
        background:
          linear-gradient(180deg, #07070a 0%, #0d0d12 100%);
        color: var(--txt);
      }
      .auth-card {
        width: min(430px, 100%);
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-lg);
        background: rgba(13,13,18,0.94);
        box-shadow: 0 28px 80px rgba(0,0,0,0.52);
        padding: 28px;
      }
      .auth-logo {
        height: auto;
        width: min(230px, 72%);
        display: block;
        margin-bottom: 26px;
      }
      .auth-eyebrow {
        color: var(--blue-l);
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        margin-bottom: 8px;
      }
      .auth-title {
        font-size: 25px;
        line-height: 1.2;
        font-weight: 800;
        color: var(--txt);
      }
      .auth-subtitle {
        color: var(--txt3);
        margin: 9px 0 22px;
        line-height: 1.65;
      }
      .auth-invite-note {
        display: none;
        margin-bottom: 16px;
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: var(--radius-md);
        background: rgba(74,122,255,0.10);
        color: var(--txt2);
        padding: 10px 12px;
        font-size: 13px;
      }
      .auth-invite-note.show { display: block; }
      .auth-mode-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-bottom: 18px;
        padding: 4px;
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-md);
        background: var(--surf2);
      }
      .auth-mode-tab {
        min-height: 38px;
        border-radius: 8px;
        color: var(--txt3);
        font-weight: 800;
      }
      .auth-mode-tab.active {
        background: var(--blue);
        color: #fff;
      }
      .auth-form { display: grid; gap: 14px; }
      .auth-field[hidden],
      .auth-mode-tabs[hidden],
      .auth-forgot-row[hidden] {
        display: none !important;
      }
      .auth-field { display: grid; gap: 7px; }
      .auth-field label {
        color: var(--txt2);
        font-size: 12px;
        font-weight: 800;
      }
      .auth-field input {
        width: 100%;
        min-height: 46px;
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-md);
        background: #0a0b10;
        color: var(--txt);
        padding: 12px 13px;
        outline: 0;
      }
      .auth-field input:focus {
        border-color: var(--blue-l);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.15);
      }
      .auth-actions {
        display: grid;
        gap: 10px;
        margin-top: 4px;
      }
      .auth-forgot-row {
        display: flex;
        justify-content: flex-end;
        margin-top: -4px;
      }
      .auth-link {
        width: fit-content;
        color: var(--blue-l);
        font-size: 13px;
        font-weight: 800;
        text-align: right;
        text-decoration: none;
      }
      .auth-link:hover {
        color: #b9c9ff;
        text-decoration: underline;
      }
      .auth-link[disabled] {
        cursor: not-allowed;
        opacity: 0.62;
        text-decoration: none;
      }
      .auth-submit,
      .auth-secondary {
        min-height: 46px;
        border-radius: var(--radius-md);
        font-weight: 800;
      }
      .auth-submit {
        background: var(--blue-ui-bg);
        color: #fff;
        box-shadow: 0 12px 28px rgba(36,87,212,0.28);
      }
      .auth-submit[disabled],
      .auth-secondary[disabled] {
        cursor: not-allowed;
        opacity: 0.62;
      }
      .auth-secondary {
        border: 1px solid var(--bdr2);
        background: var(--surf2);
        color: var(--txt2);
      }
      .auth-status {
        min-height: 20px;
        color: var(--txt3);
        font-size: 13px;
        line-height: 1.55;
        margin-top: 12px;
      }
      .auth-status.error { color: #ff938b; }
      .auth-status.success { color: #7ee787; }
      .auth-meta {
        margin-top: 20px;
        padding-top: 16px;
        border-top: 1px solid var(--bdr2);
        color: var(--txt3);
        font-family: var(--font-mono);
        font-size: 11px;
      }
      body.light #auth-shell {
        background:
          linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
        color: var(--text);
      }
      body.light .auth-card {
        border-color: rgba(36,87,212,0.16);
        background: rgba(255,255,255,0.94);
        box-shadow: 0 28px 80px rgba(36,87,212,0.14), 0 1px 0 rgba(255,255,255,0.78) inset;
      }
      body.light .auth-logo {
        content: url("logo_light.png");
      }
      body.light .auth-eyebrow,
      body.light .auth-link {
        color: var(--blue);
      }
      body.light .auth-title {
        color: var(--text);
      }
      body.light .auth-subtitle,
      body.light .auth-status,
      body.light .auth-meta {
        color: var(--muted);
      }
      body.light .auth-invite-note {
        border-color: rgba(36,87,212,0.18);
        background: rgba(36,87,212,0.08);
        color: var(--text-soft);
      }
      body.light .auth-mode-tabs {
        border-color: var(--border-md);
        background: #edf3ff;
      }
      body.light .auth-mode-tab {
        color: var(--muted);
      }
      body.light .auth-mode-tab.active {
        background: var(--blue);
        color: #fff;
        box-shadow: 0 10px 24px rgba(36,87,212,0.22);
      }
      body.light .auth-field label {
        color: var(--text-soft);
      }
      body.light .auth-field input {
        border-color: var(--border-md);
        background: #ffffff;
        color: var(--text);
        box-shadow: 0 1px 0 rgba(15,23,42,0.02);
      }
      body.light .auth-field input:focus {
        border-color: rgba(36,87,212,0.58);
        box-shadow: 0 0 0 3px rgba(36,87,212,0.13);
      }
      body.light .auth-field input::placeholder {
        color: #94a3b8;
      }
      body.light .auth-secondary {
        border-color: var(--border-md);
        background: #f7f9ff;
        color: var(--text-soft);
      }
      body.light .auth-secondary:hover {
        border-color: rgba(36,87,212,0.34);
        background: #eef4ff;
        color: var(--blue);
      }
      body.light .auth-link:hover {
        color: #1744ad;
      }
      body.light .auth-status.error { color: #b42318; }
      body.light .auth-status.success { color: #15803d; }
      .logout-btn {
        width: 76px;
        min-width: 76px;
        height: 34px;
        padding: 0 11px;
        border-radius: 10px;
        border: 1px solid var(--bdr2);
        background: var(--surf2);
        color: var(--txt2);
        font-size: 12px;
        font-weight: 800;
      }
      .logout-btn:hover {
        border-color: rgba(255,107,97,0.48);
        color: #ff938b;
        background: rgba(255,107,97,0.10);
      }

      /* Protected knowledge and admin visual system */
      .knowledge-shell,
      .department-shell,
      .department-overview-shell,
      .department-assistant-shell,
      .admin-panel {
        width: 100%;
        max-width: 1180px;
        margin: 0 auto;
        min-width: 0;
      }
      .knowledge-breadcrumb,
      .breadcrumb,
      .breadcrumbs {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 7px;
        margin: 0 0 18px;
        color: var(--txt3);
        font-family: var(--font-mono);
        font-size: 11px;
        line-height: 1.4;
      }
      .knowledge-breadcrumb a,
      .knowledge-breadcrumb button,
      .breadcrumb a,
      .breadcrumb button,
      .breadcrumbs a,
      .breadcrumbs button {
        color: var(--txt2);
        font: inherit;
        font-weight: 700;
      }
      .knowledge-breadcrumb a:hover,
      .knowledge-breadcrumb button:hover,
      .breadcrumb a:hover,
      .breadcrumb button:hover,
      .breadcrumbs a:hover,
      .breadcrumbs button:hover {
        color: var(--blue-l);
      }
      .knowledge-breadcrumb .current,
      .breadcrumb .current,
      .breadcrumbs .current {
        color: var(--txt);
        font-weight: 800;
      }
      .knowledge-hero,
      .department-hero,
      .locked-access-view,
      .admin-panel-hero {
        position: relative;
        overflow: hidden;
        border: 1px solid rgba(74,122,255,0.22);
        border-radius: 16px;
        background:
          linear-gradient(135deg, rgba(74,122,255,0.16), rgba(13,13,18,0.94) 42%, rgba(8,10,18,0.98)),
          var(--surf);
        box-shadow: var(--shadow-card);
      }
      .knowledge-hero,
      .department-hero,
      .admin-panel-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
        gap: 18px;
        padding: 24px;
        margin-bottom: 18px;
      }
      .knowledge-hero-title,
      .department-hero-title,
      .admin-panel-title {
        color: var(--txt);
        font-size: 28px;
        font-weight: 850;
        line-height: 1.1;
      }
      .knowledge-hero-copy,
      .department-hero-copy,
      .admin-panel-copy {
        max-width: 760px;
        margin-top: 8px;
        color: var(--txt2);
        line-height: 1.65;
      }
      .knowledge-hero-actions,
      .department-hero-actions,
      .admin-panel-actions,
      .department-actions,
      .document-actions,
      .admin-user-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        min-width: 0;
      }
      .department-grid,
      .departments-grid,
      .knowledge-department-grid,
      #view-departments .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
        gap: 14px;
        width: 100%;
        min-width: 0;
      }
      .department-card,
      .knowledge-department-card,
      #view-departments .pg-card {
        position: relative;
        min-height: 202px;
        display: flex;
        flex-direction: column;
        gap: 13px;
        padding: 18px;
        overflow: hidden;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background:
          linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
          var(--surf);
        box-shadow: var(--shadow-card);
        transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
      }
      .department-card:hover,
      .department-card:focus-visible,
      .knowledge-department-card:hover,
      .knowledge-department-card:focus-visible,
      #view-departments .pg-card:hover,
      #view-departments .pg-card:focus-visible {
        border-color: rgba(74,122,255,0.66);
        background:
          linear-gradient(180deg, rgba(74,122,255,0.08), rgba(255,255,255,0)),
          var(--surf2);
        box-shadow: 0 16px 42px rgba(0,0,0,0.34);
        transform: translateY(-2px);
      }
      .department-card.locked,
      .department-card.is-locked,
      .department-card[data-status="locked"],
      .knowledge-department-card.locked,
      .knowledge-department-card.is-locked,
      .knowledge-department-card[data-status="locked"] {
        cursor: pointer;
        border-color: rgba(255,255,255,0.10);
        background:
          linear-gradient(180deg, rgba(255,107,97,0.08), rgba(255,255,255,0)),
          var(--surf);
      }
      .department-card.restricted,
      .department-card.is-restricted,
      .department-card[data-status="restricted"],
      .knowledge-department-card.restricted,
      .knowledge-department-card.is-restricted,
      .knowledge-department-card[data-status="restricted"] {
        border-color: rgba(242,201,76,0.28);
        background:
          linear-gradient(180deg, rgba(242,201,76,0.065), rgba(255,255,255,0)),
          var(--surf);
      }
      .department-card-top,
      .department-card-header,
      .department-meta-row,
      .document-card-top,
      .document-meta-row,
      .admin-user-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
      }
      .department-icon,
      .dept-icon,
      .document-icon,
      .locked-icon,
      .admin-user-avatar {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: 12px;
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        display: grid;
        place-items: center;
        font-weight: 900;
      }
      .department-lock,
      .lock-indicator,
      .document-lock {
        display: inline-grid;
        place-items: center;
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
        border: 1px solid rgba(255,255,255,0.12);
        border-radius: 10px;
        background: rgba(0,0,0,0.22);
        color: var(--txt3);
      }
      .department-title,
      .dept-title,
      .document-title,
      .admin-user-name {
        min-width: 0;
        color: var(--txt);
        font-weight: 850;
        line-height: 1.25;
        overflow-wrap: anywhere;
      }
      .department-title,
      .dept-title { font-size: 17px; }
      .department-description,
      .dept-description,
      .document-description,
      .admin-user-email {
        color: var(--txt2);
        font-size: 13px;
        line-height: 1.55;
        overflow-wrap: anywhere;
      }
      .department-meta,
      .dept-meta,
      .document-meta,
      .admin-user-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        color: var(--txt3);
        font-size: 11.5px;
        margin-top: auto;
        min-width: 0;
      }
      .knowledge-badge,
      .access-badge,
      .role-badge,
      .status-badge,
      .document-status,
      .user-status {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        max-width: 100%;
        min-height: 24px;
        padding: 4px 9px;
        border-radius: 999px;
        border: 1px solid transparent;
        font-size: 10.5px;
        font-weight: 850;
        line-height: 1.2;
        white-space: nowrap;
      }
      .access-badge.unlocked,
      .access-badge.free,
      .status-badge.unlocked,
      .status-badge.free,
      .user-status.active,
      .document-status.approved {
        border-color: rgba(74,222,128,0.24);
        background: rgba(74,222,128,0.12);
        color: #7ee787;
      }
      .access-badge.restricted,
      .status-badge.restricted,
      .document-status.review,
      .user-status.invited {
        border-color: rgba(242,201,76,0.25);
        background: rgba(242,201,76,0.12);
        color: #f4d673;
      }
      .access-badge.locked,
      .status-badge.locked,
      .document-status.locked,
      .user-status.blocked {
        border-color: rgba(255,107,97,0.26);
        background: rgba(255,107,97,0.12);
        color: #ff938b;
      }
      .role-badge.admin { background: rgba(74,122,255,0.18); color: #9fb6ff; border-color: rgba(74,122,255,0.32); }
      .role-badge.manager { background: rgba(34,197,94,0.12); color: #7ee787; border-color: rgba(34,197,94,0.24); }
      .role-badge.employee,
      .role-badge.mitarbeiter { background: rgba(255,255,255,0.07); color: var(--txt2); border-color: rgba(255,255,255,0.10); }
      .role-badge.guest,
      .role-badge.external { background: rgba(242,201,76,0.12); color: #f4d673; border-color: rgba(242,201,76,0.24); }
      .department-overview-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(280px, 0.36fr);
        gap: 16px;
        align-items: start;
        min-width: 0;
      }
      .knowledge-documents,
      .document-grid,
      .documents-grid {
        display: grid;
        gap: 12px;
        min-width: 0;
      }
      .document-card,
      .knowledge-document-card {
        position: relative;
        display: grid;
        gap: 10px;
        min-width: 0;
        padding: 16px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: var(--shadow-card);
        transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
      }
      .document-card:hover,
      .knowledge-document-card:hover {
        border-color: rgba(74,122,255,0.48);
        background: var(--surf2);
        transform: translateY(-1px);
      }
      .document-card.locked,
      .document-card.is-locked,
      .knowledge-document-card.locked,
      .knowledge-document-card.is-locked {
        opacity: 0.72;
        border-style: dashed;
      }
      .document-type,
      .document-owner,
      .document-updated {
        color: var(--txt3);
        font-size: 11.5px;
        font-weight: 700;
      }
      .assistant-entry-card,
      .department-context-note {
        border: 1px solid rgba(74,122,255,0.26);
        border-radius: 14px;
        background: rgba(74,122,255,0.10);
        padding: 16px;
        color: var(--txt2);
        box-shadow: var(--shadow-card);
      }
      .assistant-entry-card {
        position: sticky;
        top: 12px;
        display: grid;
        gap: 12px;
      }
      .assistant-entry-title {
        color: var(--txt);
        font-size: 17px;
        font-weight: 850;
        line-height: 1.25;
      }
      .department-context-note {
        margin-top: 12px;
        font-size: 13px;
        line-height: 1.55;
      }
      .assistant-context-bar,
      .department-assistant-context {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 16px;
        padding: 12px 14px;
        border: 1px solid rgba(74,122,255,0.28);
        border-radius: 14px;
        background: rgba(74,122,255,0.10);
        color: var(--txt2);
      }
      .assistant-chip-row,
      .example-question-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0 0;
      }
      .assistant-chip,
      .example-question-chip {
        min-height: 34px;
        padding: 7px 11px;
        border: 1px solid rgba(74,122,255,0.30);
        border-radius: 999px;
        background: rgba(74,122,255,0.10);
        color: var(--txt2);
        font-size: 12px;
        font-weight: 800;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
      }
      .assistant-chip:hover,
      .example-question-chip:hover {
        border-color: rgba(74,122,255,0.66);
        background: rgba(74,122,255,0.18);
        color: var(--txt);
      }
      .locked-access-view {
        display: grid;
        place-items: center;
        min-height: 430px;
        padding: 34px 24px;
        text-align: center;
      }
      .locked-access-inner {
        width: min(520px, 100%);
        display: grid;
        justify-items: center;
        gap: 12px;
      }
      .locked-access-view .locked-icon {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-radius: 18px;
        color: #ffb0aa;
        background: rgba(255,107,97,0.12);
        border-color: rgba(255,107,97,0.24);
      }
      .locked-title {
        color: var(--txt);
        font-size: 23px;
        font-weight: 850;
        line-height: 1.2;
      }
      .locked-copy {
        color: var(--txt2);
        line-height: 1.65;
      }
      .access-request-state {
        min-height: 20px;
        color: #7ee787;
        font-size: 12px;
        font-weight: 800;
      }
      .admin-panel {
        display: grid;
        gap: 16px;
      }
      .admin-section-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
      }
      .admin-section-card {
        min-width: 0;
        padding: 14px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: var(--shadow-card);
      }
      .admin-section-card strong {
        display: block;
        color: var(--txt);
        margin-bottom: 4px;
      }
      .admin-section-card span {
        display: block;
        color: var(--txt2);
        font-size: 12px;
        line-height: 1.5;
      }
      .admin-users,
      .admin-user-list {
        display: grid;
        gap: 10px;
        min-width: 0;
      }
      .admin-user-card,
      .admin-user-row {
        display: grid;
        grid-template-columns: minmax(220px, 1.1fr) minmax(110px, 0.45fr) minmax(180px, 0.9fr) minmax(95px, 0.35fr) auto;
        align-items: center;
        gap: 12px;
        min-width: 0;
        padding: 13px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: var(--shadow-card);
      }
      .admin-user-card:hover,
      .admin-user-row:hover {
        border-color: rgba(74,122,255,0.38);
        background: var(--surf2);
      }
      .admin-user-identity {
        display: flex;
        align-items: center;
        gap: 11px;
        min-width: 0;
      }
      .admin-access-badges,
      .access-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
      }
      .admin-user-actions .btn-secondary,
      .admin-user-actions .btn-outline,
      .department-actions .btn-secondary,
      .department-actions .btn-outline,
      .document-actions .btn-secondary,
      .document-actions .btn-outline {
        min-height: 34px;
        padding: 7px 11px;
        white-space: nowrap;
      }
      .app-toast,
      .app-toast,
      .toast {
        position: fixed;
        right: 22px;
        bottom: 22px;
        z-index: 1200;
        max-width: min(380px, calc(100vw - 32px));
        padding: 11px 13px;
        border: 1px solid rgba(74,122,255,0.34);
        border-radius: 13px;
        background: rgba(13,17,28,0.96);
        color: var(--txt);
        box-shadow: 0 18px 50px rgba(0,0,0,0.38);
        font-size: 13px;
        font-weight: 750;
        line-height: 1.45;
        overflow-wrap: anywhere;
      }
      .app-toast:not(.show),
      .app-toast:not(.show),
      .toast:not(.show) {
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
      }
      .app-toast.show,
      .app-toast.show,
      .toast.show {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 0.18s ease, transform 0.18s ease;
      }

      /* Typisierte Toast-Benachrichtigungen (oben mittig, sonner-Stil) */
      .toast-stack {
        position: fixed;
        top: 18px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1600;
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: min(420px, calc(100vw - 32px));
        pointer-events: none;
      }
      .toast-card {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
        border-radius: var(--radius-md);
        background: rgba(13, 17, 28, 0.97);
        border: 1px solid var(--border-md);
        border-left: 3px solid var(--aqua);
        color: var(--text);
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
        font-size: 13px;
        font-weight: 650;
        line-height: 1.45;
        pointer-events: auto;
        cursor: pointer;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.2s ease, transform 0.2s ease;
        overflow-wrap: anywhere;
      }
      .toast-card.show {
        opacity: 1;
        transform: translateY(0);
      }
      .toast-card.hide {
        opacity: 0;
        transform: translateY(-8px);
      }
      .toast-card .toast-ico {
        flex: 0 0 auto;
        width: 18px;
        height: 18px;
        margin-top: 1px;
      }
      .toast-card.toast-success {
        border-left-color: #40d27b;
      }
      .toast-card.toast-success .toast-ico {
        color: #40d27b;
      }
      .toast-card.toast-error {
        border-left-color: var(--red);
      }
      .toast-card.toast-error .toast-ico {
        color: var(--red);
      }
      .toast-card.toast-info {
        border-left-color: var(--aqua);
      }
      .toast-card.toast-info .toast-ico {
        color: var(--aqua);
      }
      body.light .toast-card {
        background: #ffffff;
        border-color: var(--border-md);
        color: var(--text);
        box-shadow: 0 14px 38px rgba(15, 23, 42, 0.16);
      }
      @media (max-width: 640px) {
        .toast-stack {
          top: 10px;
          width: calc(100vw - 20px);
        }
      }

      /* ISA-54: klarer Hinweis, wenn nach einem Deploy eine neuere Build-ID live ist. */
      .app-update-banner {
        position: fixed;
        left: 50%;
        bottom: 20px;
        transform: translate(-50%, 12px);
        z-index: 2147483646;
        display: flex;
        align-items: center;
        gap: 14px;
        max-width: calc(100vw - 32px);
        padding: 12px 14px 12px 16px;
        border-radius: var(--radius-md);
        background: var(--surface);
        border: 1px solid var(--border-md);
        border-left: 3px solid var(--blue);
        color: var(--text);
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
        font-size: 13px;
        font-weight: 650;
        line-height: 1.4;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
      }
      .app-update-banner.show {
        opacity: 1;
        transform: translate(-50%, 0);
        pointer-events: auto;
      }
      .app-update-banner .app-update-msg {
        overflow-wrap: anywhere;
      }
      .app-update-banner .app-update-reload {
        flex: 0 0 auto;
        appearance: none;
        border: 0;
        border-radius: 8px;
        padding: 8px 14px;
        font-size: 13px;
        font-weight: 700;
        background: var(--blue);
        color: #fff;
        cursor: pointer;
      }
      .app-update-banner .app-update-reload:hover {
        filter: brightness(1.05);
      }
      body.light .app-update-banner {
        box-shadow: 0 14px 38px rgba(15, 23, 42, 0.18);
      }

      body.light .knowledge-hero,
      body.light .department-hero,
      body.light .locked-access-view,
      body.light .admin-panel-hero,
      body.light .department-card,
      body.light .knowledge-department-card,
      body.light .document-card,
      body.light .knowledge-document-card,
      body.light .assistant-entry-card,
      body.light .department-context-note,
      body.light .assistant-context-bar,
      body.light .department-assistant-context,
      body.light .admin-section-card,
      body.light .admin-user-card,
      body.light .admin-user-row {
        background: var(--surface);
        border-color: var(--border-md);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .department-card:hover,
      body.light .knowledge-department-card:hover,
      body.light .document-card:hover,
      body.light .knowledge-document-card:hover,
      body.light .admin-user-card:hover,
      body.light .admin-user-row:hover {
        background: #eef4ff;
        border-color: rgba(36,87,212,0.36);
      }
      body.light .knowledge-hero-title,
      body.light .department-hero-title,
      body.light .admin-panel-title,
      body.light .department-title,
      body.light .dept-title,
      body.light .document-title,
      body.light .admin-user-name,
      body.light .assistant-entry-title,
      body.light .locked-title,
      body.light .admin-section-card strong {
        color: var(--text);
      }
      body.light .knowledge-hero-copy,
      body.light .department-hero-copy,
      body.light .admin-panel-copy,
      body.light .department-description,
      body.light .dept-description,
      body.light .document-description,
      body.light .admin-user-email,
      body.light .locked-copy,
      body.light .admin-section-card span {
        color: var(--muted);
      }
      body.light .app-toast,
      body.light .app-toast,
      body.light .toast {
        background: rgba(255,255,255,0.96);
        color: var(--text);
        border-color: rgba(36,87,212,0.24);
        box-shadow: 0 18px 48px rgba(15,23,42,0.16);
      }

      @media (max-width: 980px) {
        .knowledge-hero,
        .department-hero,
        .admin-panel-hero,
        .department-overview-grid {
          grid-template-columns: 1fr;
        }
        .assistant-entry-card {
          position: static;
        }
        .admin-section-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .admin-tenant-row {
          grid-template-columns: minmax(0, 1fr);
          align-items: start;
        }
        .admin-user-card,
        .admin-user-row {
          grid-template-columns: minmax(0, 1fr);
          align-items: start;
        }
        .admin-user-actions {
          justify-content: flex-start;
        }
      }

      @media (max-width: 640px) {
        .knowledge-hero,
        .department-hero,
        .admin-panel-hero,
        .locked-access-view {
          padding: 18px;
          border-radius: 14px;
        }
        .department-grid,
        .departments-grid,
        .knowledge-department-grid,
        #view-departments .card-grid,
        .admin-section-grid {
          grid-template-columns: 1fr;
        }
        .department-card,
        .knowledge-department-card,
        #view-departments .pg-card {
          min-height: 0;
          padding: 16px;
        }
        .department-card-top,
        .department-card-header,
        .document-card-top,
        .admin-user-top,
        .assistant-context-bar,
        .department-assistant-context {
          align-items: flex-start;
          flex-direction: column;
        }
        .knowledge-hero-actions,
        .department-hero-actions,
        .admin-panel-actions,
        .department-actions,
        .document-actions,
        .admin-user-actions {
          width: 100%;
          justify-content: stretch;
        }
        .knowledge-hero-actions > button,
        .department-hero-actions > button,
        .admin-panel-actions > button,
        .department-actions > button,
        .document-actions > button,
        .admin-user-actions > button {
          flex: 1 1 100%;
          justify-content: center;
        }
        .app-toast,
        .app-toast,
        .toast {
          right: 16px;
          bottom: 16px;
          left: 16px;
          max-width: none;
        }
      }

      .sb-history-item {
        display: grid;
        grid-template-columns: 14px minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        width: 100%;
      }
      .sb-history-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 26px 26px 26px;
        align-items: center;
        gap: 3px;
      }
      .sb-history-row.is-pinned .sb-history-item {
        border-color: rgba(74,122,255,0.38);
        background: rgba(74,122,255,0.10);
        color: #fff;
      }
      .sb-history-item > svg,
      .sb-history-icon {
        grid-column: 1;
      }
      .sb-history-item > span:not(.sb-history-icon):not(.sb-history-folder):not(.sb-history-actions) {
        grid-column: 2;
        min-width: 0;
      }
      .sb-history-folder,
      .sb-history-actions {
        grid-column: 3;
        justify-self: end;
      }
      .sb-history-actions {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        margin-left: 4px;
        opacity: 0.82;
        transition: opacity 0.15s ease;
      }
      .sb-history-item:hover .sb-history-actions,
      .sb-history-item:focus-visible .sb-history-actions,
      .sb-history-item.active .sb-history-actions {
        opacity: 1;
      }
      .sb-history-action {
        width: 24px;
        height: 24px;
        border-radius: 7px;
        display: grid;
        place-items: center;
        color: var(--txt3);
        font-size: 0;
      }
      .sb-history-action svg {
        width: 13px;
        height: 13px;
        pointer-events: none;
      }
      .sb-history-action:hover {
        background: rgba(74,122,255,0.14);
        color: var(--blue-l);
      }
      .sb-history-item.is-pinned [data-history-action="pin"],
      .sb-history-action.is-pinned {
        background: rgba(74,122,255,0.18);
        color: var(--blue-l);
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.34);
      }
      .sb-history-action.danger:hover {
        background: rgba(255,96,96,0.12);
        color: #ff9a9a;
      }
      .sb-history-pin,
      .sb-history-delete {
        width: 26px;
        height: 26px;
        border: 1px solid transparent;
        border-radius: 8px;
        display: grid;
        place-items: center;
        color: var(--txt3);
        background: transparent;
        cursor: pointer;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
      }
      .sb-history-pin svg,
      .sb-history-delete svg {
        width: 13px;
        height: 13px;
        pointer-events: none;
      }
      .sb-history-pin:hover,
      .sb-history-pin:focus-visible,
      .sb-history-row.is-pinned .sb-history-pin {
        background: rgba(74,122,255,0.16);
        border-color: rgba(74,122,255,0.30);
        color: var(--blue-l);
      }
      .sb-history-row.is-pinned .sb-history-pin {
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.20);
      }
      body.light .sb-history-row.is-pinned .sb-history-item {
        border-color: rgba(36,87,212,0.24);
        background: linear-gradient(180deg, rgba(36,87,212,0.08), rgba(36,87,212,0.04));
        color: var(--blue);
        box-shadow: inset 3px 0 0 rgba(36,87,212,0.46);
      }
      body.light .sb-history-row.is-pinned .sb-history-pin {
        background: rgba(36,87,212,0.10);
        border-color: rgba(36,87,212,0.22);
        color: var(--blue);
        box-shadow: inset 0 0 0 1px rgba(36,87,212,0.10);
      }
      .sb-history-delete:hover,
      .sb-history-delete:focus-visible {
        background: rgba(255,96,96,0.12);
        border-color: rgba(255,96,96,0.24);
        color: #ff9a9a;
      }
      /* ISA-48: Teilen-Aktion in der Chat-Zeile (gleicher Stil wie Pin). */
      .sb-history-share {
        width: 26px;
        height: 26px;
        border: 1px solid transparent;
        border-radius: 8px;
        display: grid;
        place-items: center;
        color: var(--txt3);
        background: transparent;
        cursor: pointer;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
      }
      .sb-history-share svg {
        width: 13px;
        height: 13px;
        pointer-events: none;
      }
      .sb-history-share:hover,
      .sb-history-share:focus-visible,
      .sb-history-share.is-shared {
        background: rgba(74,122,255,0.16);
        border-color: rgba(74,122,255,0.30);
        color: var(--blue-l);
      }
      .sb-history-share.is-shared {
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.20);
      }
      body.light .sb-history-share.is-shared {
        background: rgba(36,87,212,0.10);
        border-color: rgba(36,87,212,0.22);
        color: var(--blue);
      }
      /* ISA-48: Teilen-Dialog + schreibgeschützte Ansicht eines geteilten Chats. */
      .chat-share-visibility {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        background: var(--surface);
      }
      .chat-share-visibility-text { flex: 1; min-width: 0; }
      .chat-share-visibility-text strong { display: block; font-size: 14px; color: var(--txt); }
      .chat-share-visibility-text span { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--txt3); }
      .chat-share-visibility .toggle { margin-left: 0; }
      .chat-share-state-row {
        margin-top: 12px;
        font-size: 13px;
        color: var(--txt3);
        display: flex;
        align-items: center;
        gap: 8px;
      }
      .chat-share-state {
        display: inline-flex;
        align-items: center;
        padding: 3px 10px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 700;
        color: var(--txt3);
        background: rgba(127,127,140,0.16);
        box-shadow: inset 0 0 0 1px rgba(127,127,140,0.22);
      }
      .chat-share-state.is-on {
        color: var(--blue-l);
        background: rgba(74,122,255,0.16);
        box-shadow: inset 0 0 0 1px rgba(74,122,255,0.30);
      }
      body.light .chat-share-state.is-on { color: var(--blue); }
      .chat-share-link-label {
        display: block;
        margin: 16px 0 6px;
        font-size: 13px;
        font-weight: 700;
        color: var(--txt);
      }
      .chat-share-link-row { display: flex; gap: 8px; align-items: center; }
      .chat-share-link {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-md);
        background: var(--bg);
        color: var(--txt);
        font-size: 13px;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      }
      .chat-share-link:focus { outline: 2px solid var(--accent-focus-ring); outline-offset: 1px; }
      .chat-share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
      .chat-share-revoke { color: #d8584f; }
      body:not(.light) .chat-share-revoke { color: #ff9a9a; }
      .chat-share-note {
        margin-top: 14px;
        font-size: 12px;
        line-height: 1.5;
        color: var(--txt3);
      }
      .shared-chat-banner {
        font-size: 12.5px;
        color: var(--txt3);
        background: rgba(74,122,255,0.10);
        border: 1px solid rgba(74,122,255,0.22);
        border-radius: var(--radius-md);
        padding: 9px 12px;
        margin-bottom: 14px;
      }
      .shared-chat-viewer {
        max-height: 52vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 4px 2px;
      }
      .shared-chat-avatar {
        background: rgba(127,127,140,0.22);
        box-shadow: inset 0 0 0 1px rgba(127,127,140,0.28);
      }
      .mind-context-toast {
        left: 74px;
        bottom: 48px;
        transform: translateY(6px);
      }
      .mind-context-toast.show {
        transform: translateY(0);
      }
      .theme-toggle-btn {
        position: relative;
        width: 44px;
        height: 34px;
        border-radius: 10px;
        padding: 0;
        justify-content: center;
        overflow: hidden;
      }
      .theme-toggle-btn::before {
        display: none;
      }
      .theme-slider-track {
        position: relative;
        width: 34px;
        height: 22px;
        border-radius: 999px;
        background: rgba(255,255,255,0.08);
        display: block;
      }
      .theme-slider-knob {
        position: absolute;
        left: 2px;
        top: 2px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--txt);
        box-shadow: 0 2px 8px rgba(0,0,0,0.28);
        transition: transform 0.18s ease, background 0.18s ease;
        z-index: 1;
      }
      .theme-slider-icon {
        position: absolute;
        z-index: 2;
        width: 13px;
        height: 13px;
        left: 4.5px;
        top: 4.5px;
        color: var(--surf);
        pointer-events: none;
      }
      body.light .theme-toggle-btn {
        /* Gleiche Flaeche wie der Logout-Button daneben, sonst verschwimmen
           Button, Track und Knopf zu einem grauen Klumpen. */
        background: rgba(255,255,255,0.92);
        border-color: #cbd7ee;
      }
      body.light .theme-slider-track {
        background: #dbe2ee;
      }
      body.light .theme-slider-knob {
        transform: translateX(12px);
        background: #64748b;
        box-shadow: 0 1px 3px rgba(15,23,42,0.32);
      }
      body.light .theme-slider-icon {
        color: #fff;
        left: 16.5px;
      }
      body.light .smart-bulb-icon {
        background: var(--smart-idea-bg);
        border-color: var(--smart-idea-border);
        color: var(--smart-idea-fill);
      }
      body.light .mind-context-toast {
        background: rgba(255,255,255,0.96);
        color: var(--text);
        border-color: rgba(36,87,212,0.24);
      }
      body.light .ibar-mind-btn img {
        filter: var(--mind-logo-gray-filter);
        opacity: var(--mind-logo-gray-opacity);
      }
      body.light .ibar-mind-btn.active img {
        opacity: 0 !important;
      }

      .app-toast {
        position: fixed;
        right: 22px;
        bottom: 22px;
        max-width: min(420px, calc(100vw - 32px));
        z-index: 1400;
        padding: 12px 14px;
        border: 1px solid rgba(74,122,255,0.38);
        border-radius: var(--radius-md);
        background: rgba(13,17,28,0.96);
        color: var(--txt);
        box-shadow: 0 18px 54px rgba(0,0,0,0.42);
        font-size: 13px;
        font-weight: 800;
        line-height: 1.45;
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity 0.18s ease, transform 0.18s ease;
      }
      .app-toast.show {
        opacity: 1;
        transform: translateY(0);
      }
      .knowledge-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
        gap: 16px;
        align-items: stretch;
        margin-bottom: 18px;
      }
      .knowledge-hero-card,
      .dept-overview-hero,
      .locked-access-card,
      .admin-panel,
      .document-card,
      .chat-entry-card {
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-lg);
        background: linear-gradient(180deg, rgba(18,19,26,0.98), rgba(13,13,18,0.98));
        box-shadow: var(--shadow-card);
      }
      .knowledge-hero-card {
        padding: 24px;
      }
      .knowledge-hero-title,
      .dept-overview-title,
      .locked-access-title,
      .admin-panel-title {
        color: var(--txt);
        font-size: 24px;
        line-height: 1.2;
        font-weight: 900;
      }
      .knowledge-hero-copy,
      .dept-overview-copy,
      .locked-access-copy,
      .admin-panel-copy {
        color: var(--txt3);
        margin-top: 9px;
        line-height: 1.65;
      }
      .knowledge-hero-side {
        padding: 18px;
        display: grid;
        gap: 10px;
      }
      .breadcrumb {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 7px;
        margin-bottom: 14px;
        color: var(--txt3);
        font-family: var(--font-mono);
        font-size: 11px;
      }
      .breadcrumb button {
        color: var(--blue-l);
        font-family: var(--font-mono);
        font-size: 11px;
        font-weight: 800;
      }
      .dept-card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
        gap: 14px;
      }
      .dept-card {
        position: relative;
        min-height: 214px;
        display: grid;
        align-content: start;
        gap: 12px;
      }
      .dept-card-top,
      .dept-overview-top,
      .document-card-top,
      .admin-user-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
      }
      .dept-icon {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border-radius: 12px;
        border: 1px solid rgba(74,122,255,0.28);
        background: rgba(74,122,255,0.12);
        color: var(--blue-l);
        font-weight: 900;
      }
      .dept-card-title {
        color: var(--txt);
        font-size: 17px;
        font-weight: 900;
        margin-top: 2px;
      }
      .dept-card-copy {
        color: var(--txt2);
        font-size: 13px;
        line-height: 1.55;
      }
      .dept-meta-row,
      .doc-meta-row,
      .admin-badge-row,
      .dept-context-row {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        align-items: center;
      }
      .dept-lock-mark {
        color: #ff938b;
        display: inline-grid;
        place-items: center;
      }
      .dept-status-free {
        background: rgba(74,222,128,0.12);
        color: #7ee787;
      }
      .dept-status-restricted {
        background: rgba(242,201,76,0.13);
        color: #f2c94c;
      }
      .dept-status-locked {
        background: rgba(255,107,97,0.13);
        color: #ff938b;
      }
      .dept-overview-hero {
        padding: 24px;
        margin-bottom: 18px;
      }
      .dept-overview-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 18px;
      }
      .dept-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 0.38fr);
        gap: 16px;
        align-items: start;
      }
      .document-grid {
        display: grid;
        gap: 12px;
      }
      .document-card {
        padding: 16px;
      }
      .document-card.locked-doc {
        opacity: 0.72;
      }
      .document-title {
        color: var(--txt);
        font-weight: 900;
        font-size: 15px;
      }
      .document-copy {
        color: var(--txt2);
        font-size: 12.5px;
        line-height: 1.55;
        margin-top: 8px;
      }
      .document-actions {
        margin-top: 12px;
        display: flex;
        justify-content: flex-end;
      }
      .chat-entry-card {
        padding: 18px;
        position: sticky;
        top: 16px;
      }
      .chat-entry-title {
        color: var(--txt);
        font-size: 18px;
        font-weight: 900;
        margin-bottom: 7px;
      }
      .context-note {
        margin-top: 14px;
        padding: 12px;
        border: 1px solid rgba(74,122,255,0.24);
        border-radius: var(--radius-md);
        background: rgba(74,122,255,0.08);
        color: var(--txt2);
        font-size: 12.5px;
        line-height: 1.55;
      }
      .locked-access-wrap {
        min-height: calc(100dvh - 170px);
        display: grid;
        place-items: center;
      }
      .locked-access-card {
        width: min(560px, 100%);
        padding: 30px;
        text-align: center;
      }
      .locked-access-icon {
        width: 58px;
        height: 58px;
        display: grid;
        place-items: center;
        margin: 0 auto 16px;
        border-radius: 18px;
        border: 1px solid rgba(255,107,97,0.28);
        background: rgba(255,107,97,0.10);
        color: #ff938b;
      }
      .assistant-chat-bar.department-mode,
      .assistant-chat-bar.project-mode {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        max-width: 900px;
      }
      .assistant-chat-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: 8px;
      }
      .department-context-panel {
        grid-column: 1 / -1;
        display: none;
        margin-top: 12px;
        padding: 12px;
        border: 1px solid rgba(74,122,255,0.24);
        border-radius: var(--radius-md);
        background: rgba(13,13,18,0.34);
      }
      .department-context-panel.show { display: block; }
      .department-context-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 10px;
      }
      .department-context-title {
        color: var(--text);
        font-size: 12px;
        font-weight: 900;
        letter-spacing: 0.04em;
        text-transform: uppercase;
      }
      .department-context-count {
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
      }
      .department-context-list {
        display: grid;
        gap: 7px;
      }
      .department-context-row {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 9px;
        align-items: center;
        width: 100%;
        padding: 9px 10px;
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 10px;
        background: rgba(255,255,255,0.035);
        color: var(--text-soft);
        text-align: left;
      }
      .department-context-row input {
        width: 16px;
        height: 16px;
        accent-color: var(--blue);
      }
      .department-context-row.is-active:hover {
        border-color: rgba(74,122,255,0.42);
        background: rgba(74,122,255,0.11);
      }
      .department-context-row.is-locked {
        cursor: pointer;
        opacity: 0.72;
      }
      .department-context-row.is-locked input { pointer-events: none; }
      .department-context-row.is-locked:hover {
        border-color: rgba(255,107,97,0.28);
        background: rgba(255,107,97,0.07);
      }
      .department-context-doc-title {
        display: block;
        overflow: hidden;
        color: var(--text);
        font-size: 13px;
        font-weight: 900;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .department-context-doc-meta {
        display: block;
        margin-top: 2px;
        color: var(--muted);
        font-size: 11.5px;
      }
      .department-used-doc-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
      }
      .assistant-chip-row {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
      }
      .assistant-chip-row button {
        padding: 7px 10px;
        border: 1px solid rgba(74,122,255,0.30);
        border-radius: 999px;
        background: rgba(74,122,255,0.09);
        color: var(--txt2);
        font-size: 12px;
        font-weight: 800;
      }
      .assistant-chip-row button:hover {
        border-color: rgba(74,122,255,0.64);
        color: var(--blue-l);
        background: rgba(74,122,255,0.15);
      }
      .admin-panel {
        padding: 22px;
        margin-bottom: 16px;
      }
      .admin-panel-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        margin-bottom: 16px;
      }
      .admin-control-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 10px;
        margin-bottom: 16px;
      }
      .admin-control-card {
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-md);
        background: var(--surf2);
        padding: 13px;
      }
      .admin-control-card strong {
        color: var(--txt);
        display: block;
        margin-bottom: 4px;
      }
      .admin-user-list {
        display: grid;
        gap: 10px;
      }
      .admin-user-card {
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-md);
        background: var(--surf2);
        padding: 14px;
      }
      #view-settings .admin-user-card {
        grid-template-columns: minmax(190px, 1.05fr) minmax(190px, 1fr) auto;
      }
      #view-settings .admin-user-actions {
        margin-top: 0;
      }
      .admin-user-name {
        color: var(--txt);
        font-weight: 900;
      }
      .admin-user-email {
        color: var(--txt3);
        font-size: 12px;
        margin-top: 2px;
      }
      .admin-user-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
        margin-top: 12px;
      }
      .admin-status-line {
        min-height: 18px;
        margin-top: 12px;
        color: var(--txt3);
        font-size: 12.5px;
      }
      body.light .app-toast,
      body.light .knowledge-hero-card,
      body.light .dept-overview-hero,
      body.light .locked-access-card,
      body.light .admin-panel,
      body.light .document-card,
      body.light .chat-entry-card,
      body.light .admin-control-card,
      body.light .admin-tenant-row,
      body.light .admin-user-card {
        background: var(--surface);
        border-color: var(--border-md);
        color: var(--text);
        box-shadow: 0 14px 34px rgba(15,23,42,0.08);
      }
      body.light .knowledge-hero-title,
      body.light .dept-overview-title,
      body.light .locked-access-title,
      body.light .admin-panel-title,
      body.light .dept-card-title,
      body.light .document-title,
      body.light .chat-entry-title,
      body.light .admin-tenant-value,
      body.light .admin-user-name,
      body.light .admin-control-card strong {
        color: var(--text);
      }
      body.light .knowledge-hero-copy,
      body.light .dept-overview-copy,
      body.light .locked-access-copy,
      body.light .admin-panel-copy,
      body.light .dept-card-copy,
      body.light .document-copy,
      body.light .context-note,
      body.light .admin-tenant-label,
      body.light .admin-tenant-note,
      body.light .admin-status-line {
        color: var(--muted);
      }
      @media (max-width: 900px) {
        .knowledge-hero,
        .dept-layout,
        .assistant-chat-bar.department-mode,
        .assistant-chat-bar.project-mode,
        .project-overview-head,
        .project-overview-toolbar,
        .project-hero,
        .project-detail-grid {
          grid-template-columns: 1fr;
        }
        .project-overview-title {
          font-size: 42px;
        }
        .project-toolbar-right {
          justify-self: stretch;
          grid-template-columns: minmax(0, 1fr) auto;
          width: 100%;
        }
        .project-search-wrap {
          justify-self: stretch;
          width: 100%;
        }
        .project-overview-section {
          align-items: flex-start;
          flex-direction: column;
        }
        .project-card-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .project-actions {
          justify-content: flex-start;
        }
        .chat-entry-card {
          position: static;
        }
        .admin-panel-head {
          display: grid;
        }
      }
      @media (max-width: 700px) {
        .project-toolbar-right {
          grid-template-columns: 1fr;
        }
        .project-view-toggle {
          justify-self: start;
        }
        .project-card-grid {
          grid-template-columns: 1fr;
        }
      }
      @media (max-width: 520px) {
        body { display: block; overflow: hidden; }
        #sidebar { width: 100%; min-width: 0; height: auto; }
        .sb-scroll-area, .sb-footer { display: none; }
        #main { height: calc(100dvh - 126px); min-height: 0; overflow: hidden; }
        #content, .view { min-height: 0; overflow: hidden; }
        #view-chat { height: 100%; min-height: 0; }
        #chat-scroll { min-height: 0; padding-top: 18px; }
        #empty-state { padding-top: 24px; }
        .project-card-grid {
          grid-template-columns: 1fr;
        }
        .project-hero,
        .project-panel {
          padding: 14px;
        }
        .project-task-row {
          grid-template-columns: 1fr;
        }
        .project-actions > button,
        #view-projects .btn-primary,
        #view-projects .btn-secondary {
          width: 100%;
          justify-content: center;
        }
        #input-area { padding: 12px 14px 16px; }
        .input-box { padding: 11px 12px; }
        .input-bar { gap: 8px; }
        .input-bar-left { flex: 1; }
        .ibar-btn { width: 44px; height: 44px; }
        #send-btn { width: 44px; height: 44px; }
        .ibar-sep { margin: 0 4px; }
        .ibar-model-tag { display: none; }
        .ibar-model-tag span { max-width: 130px; }
        .page-scroll { padding: 28px 18px; overflow-y: auto; }
        .dept-intro { grid-template-columns: 1fr; align-items: start; }
        .dept-grid { grid-template-columns: 1fr; }
        .dept-hero { padding: 18px; }
        .dept-hero-title { font-size: 22px; }
        .dept-hero-actions .btn-primary,
        .dept-hero-actions .btn-secondary,
        .dept-locked-card .btn-primary,
        .dept-locked-card .btn-secondary { width: 100%; justify-content: center; }
        .settings-profile { flex-wrap: wrap; align-items: flex-start; }
        .settings-profile .btn-outline { width: 100%; justify-content: center; }
        .admin-tenant-head,
        .admin-panel-head,
        .admin-tenant-row,
        .admin-user-card {
          grid-template-columns: 1fr;
        }
        .admin-tenant-head {
          display: grid;
        }
        .admin-panel-actions,
        .admin-user-actions {
          justify-content: stretch;
        }
        .admin-panel-actions .btn-secondary,
        .admin-panel-actions .btn-primary,
        .admin-tenant-head .btn-primary,
        .admin-user-actions .btn-secondary {
          width: 100%;
          justify-content: center;
        }
        .admin-module-grid {
          grid-template-columns: 1fr;
        }
        .sb-footer { display: block; padding-bottom: 12px; }
        .sb-footer .usage-box,
        .sb-footer .sb-avatar,
        .sb-footer .sb-user-meta,
        .sb-footer .sb-settings-btn { display: none; }
        .sb-mobile-settings { display: block; }
        .sb-mobile-settings .square-icon-btn { width: 100%; justify-content: center; gap: 8px; color: var(--txt2); }
        .suggestions, .form-row { grid-template-columns: 1fr; }
        .split-grid, .decision-lanes, .rag-console, .rag-ingest-grid, .mind-model-strip, .mind-quick-grid, .mind-primary-panel .rag-console { grid-template-columns: 1fr; }
        #view-assistants .assistant-card-shell {
          min-height: 132px;
          padding: 18px 58px 18px 18px;
        }
        #view-assistants .assistant-card-shell .assistant-avatar {
          width: 36px;
          height: 36px;
          flex-basis: 36px;
        }
        #view-assistants .assistant-card-shell .assistant-card-gear { width: 34px; height: 34px; top: auto; right: 12px; bottom: 12px; }
        #view-assistants .assistant-card-shell .assistant-card-gear svg { width: 16px; height: 16px; }
        .project-doc-row {
          grid-template-columns: minmax(0, 1fr);
          align-items: stretch;
        }
        .project-doc-actions {
          justify-content: stretch;
        }
        .project-doc-actions > button {
          flex: 1 1 132px;
          justify-content: center;
        }
        .project-rag-gate-head {
          align-items: stretch;
        }
        .project-rag-actions > button {
          flex: 1 1 150px;
        }
        .project-chat-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
        .project-chat-row small { text-align: left; }
        .sb-history-folder { max-width: 112px; }
        .mind-context-toast { left: 22px; bottom: 62px; }
        .app-toast { right: 14px; bottom: 14px; }
        .knowledge-hero-card,
        .dept-overview-hero,
        .locked-access-card,
        .admin-panel {
          padding: 18px;
        }
        .dept-card-grid { grid-template-columns: 1fr; }
        .admin-user-actions { justify-content: stretch; }
        .admin-user-actions button { flex: 1 1 160px; justify-content: center; }
        .topbar-right {
          display: flex;
          margin-left: auto;
        }
        .topbar-right .topbar-badge,
        .topbar-right .theme-toggle-btn,
        .topbar-right .topbar-icon-btn {
          display: none;
        }
        .chat-container, .input-outer { max-width: none; }
      }
      @media (max-width: 760px) {
        .tenant-selector-root,
        .tenant-selector-wrap {
          flex: 1 1 180px;
          max-width: 238px;
          margin-left: 0;
        }
        .tenant-dropdown {
          left: auto;
          right: 0;
          width: min(280px, calc(100vw - 28px));
        }
        .tenant-pill-meta {
          display: none;
        }
        .tenant-pill-kicker {
          display: none;
        }
      }
      @media (max-height: 640px) {
        #auth-shell {
          align-items: start;
          overflow-y: auto;
        }
        .auth-card {
          padding: 22px;
        }
        .auth-logo {
          margin-bottom: 16px;
        }
        .auth-subtitle {
          margin-bottom: 16px;
        }
      }
      @media (max-width: 900px) {
        .mind-primary-grid,
        .mind-upload-fields,
        .mind-query-actions,
        .dept-doc-layout {
          grid-template-columns: 1fr;
        }
        .dept-side-panel {
          position: static;
        }
        .mind-quick-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .mind-primary-panel {
          padding: 12px;
        }
        .mind-primary-panel .rag-query-panel,
        .mind-primary-panel .rag-answer-panel,
        .mind-upload-card,
        .mind-info-panel {
          padding: 14px;
        }
        .mind-primary-panel .rag-textarea {
          min-height: 76px;
        }
        .mind-status-bar {
          margin-bottom: 12px;
        }
      }
      @media (max-width: 420px) {
        .ibar-model-tag span { max-width: 88px; }
        .mind-quick-grid { grid-template-columns: 1fr; }
      }

      /* Agent 1/7: upload modal, context, document chips and mobile UI guardrails */
      #app-modal-overlay,
      #lock-modal-overlay {
        overscroll-behavior: contain;
      }
      .app-modal,
      .lock-modal {
        border-radius: var(--radius-lg);
        background:
          linear-gradient(180deg, rgba(23,25,37,0.98), rgba(13,13,18,0.98)),
          var(--surface);
        border-color: rgba(255,255,255,0.14);
        box-shadow: 0 28px 84px rgba(0,0,0,0.54), inset 0 1px 0 rgba(255,255,255,0.05);
      }
      .modal-head {
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
      }
      .modal-title {
        line-height: 1.18;
        letter-spacing: 0;
      }
      .modal-sub {
        max-width: 68ch;
        font-size: 13.5px;
      }
      .modal-form .form-input,
      .modal-form .form-textarea,
      .mind-upload-card .form-input,
      .mind-upload-card .form-textarea {
        width: 100%;
        min-width: 0;
      }
      .mind-upload-card {
        align-content: start;
        background:
          linear-gradient(180deg, rgba(74,122,255,0.06), rgba(255,255,255,0)),
          var(--surface);
      }
      .mind-upload-head {
        min-width: 0;
      }
      .mind-upload-head .mind-section-title {
        min-width: 0;
        overflow-wrap: anywhere;
      }
      .upload-dropzone {
        position: relative;
        min-width: 0;
        min-height: 128px;
        align-content: center;
        justify-items: start;
        padding: 18px;
        border-width: 1.5px;
        border-color: rgba(74,122,255,0.42);
        background:
          linear-gradient(180deg, rgba(74,122,255,0.12), rgba(74,122,255,0.035)),
          #0a0b10;
        color: var(--text-soft);
        transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
      }
      .upload-dropzone:hover,
      .upload-dropzone:focus-within,
      .upload-dropzone.active,
      .upload-dropzone.is-active,
      .upload-dropzone.drag-over,
      .upload-dropzone.is-drag-over,
      .upload-dropzone[data-active="true"],
      .upload-dropzone[data-drag-over="true"] {
        border-color: rgba(143,170,255,0.88);
        background:
          linear-gradient(180deg, rgba(74,122,255,0.22), rgba(74,122,255,0.08)),
          #0d111c;
        box-shadow: 0 0 0 3px rgba(74,122,255,0.14), 0 18px 38px rgba(0,0,0,0.24);
        transform: translateY(-1px);
      }
      .upload-dropzone::after {
        content: "";
        position: absolute;
        inset: 8px;
        pointer-events: none;
        border: 1px solid transparent;
        border-radius: calc(var(--radius-lg) - 4px);
        transition: border-color 0.18s ease;
      }
      .upload-dropzone:hover::after,
      .upload-dropzone:focus-within::after,
      .upload-dropzone.active::after,
      .upload-dropzone.is-active::after,
      .upload-dropzone.drag-over::after,
      .upload-dropzone.is-drag-over::after,
      .upload-dropzone[data-active="true"]::after,
      .upload-dropzone[data-drag-over="true"]::after {
        border-color: rgba(255,255,255,0.10);
      }
      .upload-dropzone strong {
        color: var(--text);
        line-height: 1.25;
      }
      .upload-dropzone .sr-sub {
        max-width: 100%;
        color: var(--muted);
        line-height: 1.45;
        overflow-wrap: anywhere;
      }
      .upload-dropzone .btn-secondary {
        justify-self: stretch;
        width: 100%;
        justify-content: center;
      }
      .upload-status {
        min-width: 0;
      }
      .upload-item {
        border: 1px solid rgba(74,122,255,0.22);
        background: rgba(74,122,255,0.12);
        color: var(--text-soft);
      }
      .upload-item-name {
        color: var(--text);
      }
      .tenant-selector-wrap,
      .tenant-selector-root,
      .tenant-pill,
      .tenant-dropdown,
      .chat-context-badge,
      .input-context-note,
      .assistant-context-bar,
      .department-assistant-context,
      .dept-context-note,
      .context-note,
      .department-context-note {
        min-width: 0;
        max-width: 100%;
      }
      .tenant-dropdown {
        overflow-x: hidden;
      }
      .tenant-option,
      .tenant-pill {
        min-width: 0;
      }
      .tenant-option-copy,
      .tenant-pill-copy,
      .tenant-note,
      .chat-context-badge,
      .input-context-note,
      .dept-context-note,
      .context-note,
      .department-context-note {
        overflow-wrap: anywhere;
        word-break: break-word;
      }
      .chat-context-badge,
      .input-context-note,
      .assistant-context-bar,
      .department-assistant-context,
      .dept-context-note,
      .context-note,
      .department-context-note {
        border-color: rgba(74,122,255,0.28);
        background: rgba(74,122,255,0.09);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
      }
      .chip,
      .document-status,
      .knowledge-badge,
      .access-badge,
      .status-badge,
      .role-badge {
        min-width: 0;
        max-width: 100%;
        min-height: 24px;
        align-items: center;
        line-height: 1.2;
        white-space: normal;
      }
      .document-card.locked,
      .document-card.is-locked,
      .document-card.locked-doc,
      .knowledge-document-card.locked,
      .knowledge-document-card.is-locked {
        opacity: 1;
        border-style: solid;
        border-color: rgba(255,107,97,0.28);
        background:
          linear-gradient(180deg, rgba(255,107,97,0.105), rgba(255,255,255,0)),
          var(--surface);
      }
      .document-card.locked::before,
      .document-card.is-locked::before,
      .document-card.locked-doc::before,
      .knowledge-document-card.locked::before,
      .knowledge-document-card.is-locked::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        border-radius: inherit;
        background: repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 10px);
        opacity: 0.48;
      }
      .document-card.locked .document-title,
      .document-card.is-locked .document-title,
      .document-card.locked-doc .document-title,
      .knowledge-document-card.locked .document-title,
      .knowledge-document-card.is-locked .document-title {
        color: var(--text-soft);
      }
      .document-card.locked .chip,
      .document-card.is-locked .chip,
      .document-card.locked-doc .chip,
      .knowledge-document-card.locked .chip,
      .knowledge-document-card.is-locked .chip,
      .chip.locked {
        border: 1px solid rgba(255,107,97,0.22);
        background: rgba(255,107,97,0.10);
        color: #ffb3ad;
      }
      @media (max-width: 760px) {
        html,
        body {
          overflow-x: hidden;
        }
        #app-modal-overlay,
        #lock-modal-overlay {
          width: 100vw;
          max-width: 100vw;
          padding: 12px;
        }
        .app-modal,
        .lock-modal {
          width: min(100%, calc(100vw - 24px));
          max-width: calc(100vw - 24px);
          border-radius: var(--radius-md);
          padding: 16px;
          overflow-x: hidden;
        }
        .modal-head {
          gap: 10px;
          margin-bottom: 14px;
        }
        .modal-title {
          font-size: 19px;
        }
        .modal-sub {
          font-size: 13px;
        }
        .upload-dropzone {
          min-height: 116px;
          padding: 16px;
        }
        .tenant-dropdown {
          max-width: calc(100vw - 24px);
        }
        .document-card-top,
        .dept-card-top,
        .dept-overview-top {
          min-width: 0;
        }
      }
      @media (max-width: 520px) {
        .mind-upload-card,
        .rag-query-panel,
        .rag-answer-panel,
        .mind-info-panel,
        .document-card,
        .knowledge-document-card,
        .dept-card {
          border-radius: var(--radius-md);
        }
        .upload-dropzone .btn-secondary,
        .mind-upload-card > .btn-secondary,
        .mind-query-actions > button {
          width: 100%;
          justify-content: center;
        }
        .chip,
        .document-status,
        .knowledge-badge,
        .access-badge,
        .status-badge,
        .role-badge {
          font-size: 10px;
        }
      }

      /* Finish-up responsive safeguards */
      .settings-row > div:first-child,
      .admin-user-main > div:last-child,
      .doc-card-top > div:first-child {
        min-width: 0;
      }
      .doc-title,
      .doc-desc,
      .admin-module-title,
      .admin-module-sub {
        overflow-wrap: anywhere;
      }
      @media (max-width: 900px) {
        #view-settings .admin-user-card {
          grid-template-columns: 1fr;
          align-items: start;
        }
        #view-settings .admin-user-actions {
          justify-content: flex-start;
        }
      }
      @media (max-width: 520px) {
        body[data-auth-state="authenticated"] {
          display: flex;
          flex-direction: column;
          height: 100dvh;
          overflow: hidden;
        }
        body[data-auth-state="authenticated"] #sidebar {
          flex: 0 0 auto;
        }
        body[data-auth-state="authenticated"] #main {
          flex: 1 1 auto;
          height: auto;
          min-height: 0;
        }
        #sidebar .sb-scroll-area {
          display: block !important;
          flex: 0 0 auto;
          overflow: visible;
        }
        #sidebar .sb-scroll-area .sb-chats-region,
        #sidebar .sb-scroll-area .history-pinned-section,
        #sidebar .sb-scroll-area .sb-nav[data-history-group],
        #sidebar .sb-scroll-area .sb-divider,
        #sidebar .sb-scroll-area .sb-section-label,
        #sidebar .sb-scroll-area .sb-subnav {
          display: none;
        }
        #sidebar .sb-scroll-area > .sb-nav {
          padding: 0 12px 8px;
        }
        #sidebar .sb-scroll-area > .sb-nav:first-child {
          display: flex;
          gap: 6px;
          overflow-x: auto;
          padding: 0 12px 8px;
          scrollbar-width: none;
        }
        #sidebar .sb-scroll-area > .sb-nav:first-child::-webkit-scrollbar {
          display: none;
        }
        #sidebar .sb-scroll-area > .sb-nav:first-child .sb-nav-item {
          flex: 0 0 auto;
          width: auto;
          min-height: 34px;
          padding: 7px 10px;
          white-space: nowrap;
        }
        #sidebar .sb-lock-row {
          max-width: 100%;
        }
        #sidebar .sb-lock-row .sb-nav-item {
          min-height: 36px;
        }
        .sb-footer .usage-meter,
        .sb-footer .sb-user-row {
          display: none;
        }
        #topbar {
          padding: 0 14px;
          gap: 8px;
        }
        .model-selector-wrap {
          min-width: 0;
          flex: 1 1 auto;
        }
        .model-pill {
          max-width: 100%;
        }
        #model-pill-label {
          min-width: 0;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .model-dropdown {
          min-width: 0;
          width: min(290px, calc(100vw - 28px));
        }
        .welcome-sphere-wrap {
          flex-wrap: wrap;
        }
        .welcome-title {
          flex: 1 1 100%;
          font-size: 24px;
          line-height: 1.2;
        }
        .doc-card-top,
        .dept-hero-top {
          flex-direction: column;
        }
        .doc-status-lock {
          justify-content: flex-start;
        }
      }

      /* Agent 7/7: overflow and dead-button guardrails */
      .department-assistant-context,
      #department-question-chips {
        display: none;
      }
      .department-assistant-context.show,
      #department-question-chips.show {
        display: flex;
      }
      #main,
      #content,
      .view,
      #chat-scroll,
      .chat-container,
      .page-scroll,
      .input-outer,
      .input-box,
      .modal-head,
      .modal-form,
      .modal-grid,
      .modal-actions,
      .lock-modal-actions,
      .manage-list,
      .manage-item,
      .card-grid,
      .department-grid,
      .departments-grid,
      .knowledge-department-grid,
      .dept-grid,
      .dept-card-grid,
      .document-grid,
      .documents-grid,
      .knowledge-documents,
      .admin-section-grid,
      .admin-module-grid,
      .admin-user-card,
      .admin-user-row,
      .pg-card,
      .dept-card,
      .document-card,
      .knowledge-document-card,
      .assistant-entry-card,
      .admin-section-card,
      .admin-module-card,
      .rag-source-card,
      .readiness-card,
      .project-chat-row {
        min-width: 0;
      }
      #chat-scroll,
      .page-scroll,
      .app-modal,
      .lock-modal {
        max-width: 100%;
      }
      .msg-content,
      .typing-row,
      .typing-bubble,
      .msg-li,
      .msg-li-wrap {
        min-width: 0;
        max-width: 100%;
      }
      .msg-bubble,
      .typing-bubble,
      .pg-card,
      .pg-card-title,
      .pg-card-sub,
      .dept-card-title,
      .dept-card-desc,
      .department-title,
      .department-description,
      .document-title,
      .document-description,
      .admin-section-card strong,
      .admin-section-card span,
      .admin-module-title,
      .admin-module-sub,
      .manage-item-title,
      .manage-item-sub,
      .modal-title,
      .modal-sub,
      .plan-name,
      .plan-copy,
      .plan-list,
      .confirm-card,
      .checkout-status,
      .sb-brand-name,
      .sb-brand-claim,
      .sb-user-name,
      .sb-user-role,
      .sb-nav-item,
      .sb-section-label,
      .sb-history-item,
      .chip,
      .status-badge,
      .knowledge-badge,
      .access-badge,
      .role-badge,
      .user-status,
      .project-chat-row span,
      .project-chat-row small {
        overflow-wrap: anywhere;
        word-break: break-word;
      }
      .sb-brand,
      .sb-user-row,
      .sb-nav-item,
      .sb-history-item,
      .project-chat-row,
      .model-pill,
      .model-option,
      .model-smart-card,
      .tenant-pill,
      .tenant-option,
      .tenant-selector-root,
      .topbar-right,
      .input-bar,
      .input-bar-left,
      .department-card-top,
      .department-card-header,
      .document-card-top,
      .doc-card-top,
      .admin-user-main,
      .admin-user-identity,
      .admin-user-actions,
      .modal-actions,
      .lock-modal-actions,
      .manage-item-actions,
      .pitch-actions {
        min-width: 0;
      }
      .sb-brand > div,
      .sb-user-meta,
      .model-option > div,
      .model-smart-card > div:last-child,
      .tenant-pill-copy,
      .tenant-pill-main,
      .tenant-option-copy,
      .tenant-option > span:last-child,
      .department-card-top > div,
      .department-card-header > div,
      .document-card-top > div,
      .doc-card-top > div,
      .admin-user-main > div,
      .admin-user-identity > div,
      .modal-head > div,
      .manage-item > div:first-child {
        min-width: 0;
      }
      .modal-actions > button,
      .lock-modal-actions > button,
      .manage-item-actions > button,
      .admin-user-actions > button,
      .department-actions > button,
      .document-actions > button,
      .dept-hero-actions > button,
      .knowledge-hero-actions > button,
      .pitch-actions > button {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
      }
      .modal-actions,
      .lock-modal-actions,
      .manage-item-actions,
      .admin-user-actions {
        row-gap: 8px;
      }
      .chip,
      .status-badge,
      .knowledge-badge,
      .access-badge,
      .role-badge,
      .user-status,
      .model-pill,
      #model-pill-label,
      .tenant-selector-wrap,
      .tenant-selector-root,
      .tenant-pill-label,
      .tenant-option-name,
      .sb-history-item > span:not(.sb-history-icon):not(.sb-history-folder):not(.sb-history-actions),
      .sb-section-label.locked span,
      .sb-user-name,
      .sb-user-role {
        max-width: 100%;
      }
      @media (max-width: 760px) {
        #app-modal-overlay,
        #lock-modal-overlay {
          padding: 14px;
          align-items: flex-start;
          overflow-y: auto;
        }
        .app-modal,
        .lock-modal {
          width: 100%;
          max-height: none;
          margin: auto 0;
        }
        .manage-item {
          grid-template-columns: 1fr;
        }
        .modal-head {
          flex-wrap: wrap;
        }
        .modal-close {
          margin-left: auto;
        }
        .manage-item-actions,
        .modal-actions,
        .lock-modal-actions {
          width: 100%;
          justify-content: stretch;
        }
        .manage-item-actions > button,
        .modal-actions > button,
        .lock-modal-actions > button {
          flex: 1 1 160px;
          justify-content: center;
        }
      }
      @media (max-width: 520px) {
        html,
        body {
          max-width: 100%;
        }
        #topbar,
        #input-area,
        .chat-container,
        .page-scroll {
          max-width: 100vw;
        }
        .msg-content {
          max-width: calc(100% - 41px);
        }
        .tenant-selector-root,
        .tenant-selector-wrap {
          flex-basis: 42px;
          max-width: 46px;
          margin-left: 0;
          margin-right: 0;
        }
        .tenant-pill {
          width: 42px;
          height: 34px;
          justify-content: center;
          padding: 0;
        }
        .tenant-pill-copy,
        .tenant-pill-main,
        .tenant-pill-arrow {
          display: none;
        }
        .msg-bubble {
          padding: 12px 14px;
        }
        .typing-bubble {
          flex: 1 1 auto;
        }
        .modal-actions > button,
        .lock-modal-actions > button,
        .manage-item-actions > button,
        .admin-user-actions > button,
        .department-actions > button,
        .document-actions > button,
        .dept-hero-actions > button,
        .knowledge-hero-actions > button {
          flex-basis: 100%;
          width: 100%;
        }
        .card-grid,
        .department-grid,
        .departments-grid,
        .knowledge-department-grid,
        .dept-grid,
        .dept-card-grid,
        .document-grid,
        .documents-grid,
        .knowledge-documents,
        .admin-section-grid,
        .admin-module-grid {
          grid-template-columns: minmax(0, 1fr);
        }
      }

      /* Enterprise dashboard shell refinement */
      body:not(.light) {
        background: #05070b;
      }
      /* ISA-106: App-Shell füllt den Viewport bündig. Header/Content schließen
         ohne Inset-Lücken direkt an Sidebar und Viewport-Ränder an (kein
         schwebender Karten-Inset mehr). Der vertikale Fade bleibt auf den Flächen
         erhalten; nur die Topbar-Unterkante trennt Header und Content. */
      body:not(.light) #main {
        padding: 0;
        /* Lighter dark canvas with a soft vertical fade toward the near-black
           base, instead of a flat near-black background. */
        background: linear-gradient(180deg, #161d2e 0%, #0e1320 60%, #0b0f18 100%);
      }
      body:not(.light) #topbar {
        height: var(--header-h);
        background:
          linear-gradient(180deg, rgba(17,23,34,0.98), rgba(13,17,24,0.98)),
          var(--surface);
        border: 0;
        border-bottom: 1px solid rgba(255,255,255,0.09);
        border-radius: 0;
      }
      body:not(.light) #content {
        background:
          linear-gradient(180deg, rgba(17,23,34,0.96), rgba(8,11,17,0.985)),
          var(--surface);
        border: 0;
        border-radius: 0;
        overflow: hidden;
      }
      body:not(.light) #view-chat,
      body:not(.light) #input-area,
      body:not(.light) .page-scroll {
        background: transparent;
      }
      body:not(.light) #sidebar {
        background:
          linear-gradient(180deg, #11151d 0%, #090c12 48%, #07090e 100%);
        border-right-color: rgba(255,255,255,0.10);
        box-shadow: 18px 0 46px rgba(0,0,0,0.28);
      }
      body:not(.light) .sb-brand {
        min-height: 68px;
        padding: 14px 14px 12px;
        gap: 10px;
      }
      .sb-workspace-avatar {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        background: linear-gradient(180deg, rgba(74,122,255,0.24), rgba(36,87,212,0.16)), #141b29;
        border: 1px solid rgba(74,122,255,0.34);
        color: #dce6ff;
        font: 800 11px/1 var(--font-mono);
        letter-spacing: 0.2px;
      }
      .sb-workspace-copy {
        min-width: 0;
        flex: 1;
      }
      .sb-workspace-chevron {
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
        color: var(--muted);
      }
      body:not(.light) .sb-brand-name {
        font-size: 13.5px;
        letter-spacing: 0;
      }
      body:not(.light) .sb-brand-claim {
        margin-top: 1px;
        color: rgba(255,255,255,0.52);
        font-size: 11px;
        letter-spacing: 0;
        text-transform: none;
      }
      /* ISA-25: das "Neuer Chat"-Blau ist im Dark Mode der Referenzton fuer
         ALLE blau gefuellten Flaechen (Tabs, Primaer-Buttons, Send-Button). */
      body:not(.light) {
        --blue-ui-bg: linear-gradient(180deg, #2e8cff, #1f6fe5);
        --blue-ui-bg-hover: linear-gradient(180deg, #3f97ff, #2e7bef);
        --category-filter-active-bg: linear-gradient(180deg, #2e8cff, #1f6fe5);
        --category-filter-active-border: rgba(74, 122, 255, 0.34);
      }
      body:not(.light) .btn-new-chat {
        background: var(--blue-ui-bg);
        border: 1px solid var(--blue-ui-border);
        border-radius: 8px;
        box-shadow: var(--blue-ui-shadow);
      }
      body:not(.light) .btn-new-chat:hover {
        background: var(--blue-ui-bg-hover);
      }
      body:not(.light) .sb-nav {
        padding: 3px 9px;
      }
      body:not(.light) .sb-nav-item,
      body:not(.light) .sb-history-item {
        min-height: 34px;
        border-radius: 8px;
        border: 1px solid transparent;
        color: rgba(231,237,248,0.84);
        font-size: 13.5px;
        font-weight: 650;
        letter-spacing: 0;
      }
      body:not(.light) .sb-nav-item:hover,
      body:not(.light) .sb-history-item:hover {
        background: rgba(74,122,255,0.10);
        border-color: rgba(74,122,255,0.18);
        color: #f8faff;
      }
      body:not(.light) .sb-nav-item.active,
      body:not(.light) .sb-history-item.active {
        background: rgba(36,87,212,0.20);
        border-color: rgba(74,122,255,0.42);
        color: #dfe8ff;
        box-shadow: inset 3px 0 0 #4a7aff;
      }
      body:not(.light) .sb-section-label {
        margin-top: 8px;
        padding: 7px 13px 4px;
        color: rgba(255,255,255,0.58);
        font: 700 11px/1.2 var(--font-body);
        letter-spacing: 0;
        text-transform: none;
      }
      body:not(.light) .sb-divider {
        margin: 7px 12px;
        background: rgba(255,255,255,0.075);
      }
      body:not(.light) .sb-history-item {
        padding: 7px 10px;
        font-weight: 600;
      }
      body:not(.light) .sb-history-folder {
        display: inline-flex;
        max-width: 86px;
        border-color: rgba(74,122,255,0.18);
        background: rgba(74,122,255,0.08);
        color: rgba(220,230,255,0.68);
      }
      body:not(.light) .sb-footer {
        border-top-color: rgba(255,255,255,0.08);
        background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.035));
      }

      /* Final compact typography override */
      body {
        font-size: var(--font-size-base);
        font-weight: 400;
        line-height: 1.48;
      }
      body:not(.light) .sb-nav-item,
      body:not(.light) .sb-history-item,
      .sb-nav-item,
      .sb-history-item {
        min-height: 30px;
        font-size: 12px;
        font-weight: 500;
      }
      body:not(.light) .sb-section-label,
      .sb-section-label {
        font-size: 9.5px;
        font-weight: 500;
      }
      .btn-new-chat,
      body:not(.light) .btn-new-chat {
        font-size: 12.5px;
        font-weight: 550;
      }
      .model-pill,
      body.light .model-pill,
      body:not(.light) .model-pill {
        font-size: 12.5px;
        font-weight: 550;
      }
      .topbar-badge,
      .tenant-pill-label,
      .tenant-option-title,
      .model-option,
      .model-smart-title {
        font-size: 12px;
        font-weight: 520;
      }
      .tenant-pill-kicker,
      .tenant-pill-meta,
      .tenant-option-meta,
      .model-smart-sub {
        font-size: 10px;
        font-weight: 400;
      }
      .welcome-title,
      body.light .welcome-title {
        font-size: 22px;
        font-weight: 520;
      }
      .welcome-sub,
      .input-disclaimer {
        font-size: 10.5px;
        font-weight: 350;
      }
      .sug-title,
      .pg-card-title,
      .project-card-title,
      .project-title,
      .department-title,
      .dept-title,
      .document-title,
      .settings-name,
      .manage-item-title {
        font-size: 13px;
        font-weight: 560;
        line-height: 1.28;
      }
      .sug-sub,
      .pg-card-sub,
      .project-card-sub,
      .department-description,
      .dept-description,
      .document-description,
      .settings-role,
      .manage-item-sub {
        font-size: 11.5px;
        font-weight: 380;
        line-height: 1.48;
      }
      .msg-bubble,
      .typing-bubble,
      #msg-input {
        font-size: 12.5px;
        font-weight: 400;
      }
      .ibar-model-tag {
        font-size: 11px;
        font-weight: 520;
      }
      .ph-title,
      .modal-title,
      .lock-modal-title {
        font-size: 18px;
        font-weight: 560;
      }
      .ph-sub,
      .modal-sub,
      .lock-modal-sub {
        font-size: 12px;
        font-weight: 380;
      }
      .library-page-title {
        font-size: 26px;
        font-weight: 420;
        letter-spacing: 0;
      }
      .library-page-sub {
        font-size: 13px;
        font-weight: 380;
      }
      .library-section-title,
      .knowledge-hero-title,
      .department-hero-title,
      .admin-panel-title {
        font-size: 20px;
        font-weight: 560;
      }
      .library-section-sub,
      .library-count,
      .project-overview-sub,
      .knowledge-hero-copy,
      .department-hero-copy,
      .admin-panel-copy {
        font-size: 12px;
        font-weight: 380;
      }
      .library-search,
      .library-dropdown-trigger,
      .library-dropdown-option,
      .form-input,
      .form-select,
      .form-textarea,
      .pg-action-btn,
      .btn-primary,
      .btn-secondary,
      .btn-outline {
        font-size: 12px;
        font-weight: 500;
      }
      .skill-group-head,
      .skill-title {
        font-size: 13.5px;
        font-weight: 560;
      }
      .skill-desc {
        font-size: 11.5px;
        font-weight: 380;
      }
      .skill-meta,
      .department-meta,
      .dept-meta,
      .document-meta,
      .admin-user-meta {
        font-size: 10.5px;
        font-weight: 400;
      }
      .chip,
      .status-badge,
      .knowledge-badge,
      .access-badge,
      .role-badge,
      .document-status,
      .user-status,
      .file-badge {
        font-size: 9.5px;
        font-weight: 600;
      }

      /* Final lightweight typography normalization */
      .welcome-title,
      body.light .welcome-title,
      .library-page-title,
      .ph-title,
      .pitch-title {
        font-weight: 400;
      }
      .library-section-title,
      .knowledge-hero-title,
      .department-hero-title,
      .admin-panel-title,
      .dept-hero-title,
      .dept-locked-title,
      .metric-value,
      .readiness-value {
        font-weight: 420;
      }
      .pg-card-title,
      .skill-title,
      .skill-group-head,
      .sug-title,
      .dept-intro-title,
      .dept-card-title,
      .department-title,
      .dept-title,
      .document-title,
      .doc-title,
      .settings-name,
      .manage-item-title,
      .admin-module-title,
      .admin-user-name,
      .admin-tenant-value,
      .assistant-chat-title,
      .modal-title,
      .lock-modal-title {
        font-weight: 500;
      }
      .sb-brand-name,
      .btn-new-chat,
      .sb-nav-item,
      .sb-library-subitem,
      .pg-action-btn,
      .btn-primary,
      .btn-secondary,
      .btn-outline,
      .skill-view-btn,
      .library-dropdown-trigger,
      .library-search,
      .library-select,
      .model-pill,
      .topbar-badge,
      .tenant-pill-label,
      .model-option,
      .model-smart-title {
        font-weight: 460;
      }
      /* ISA-33: Ein Theme-Wechsel darf nur Farben aendern, keine Box-Metriken.
         Die gepflegte Dark-Mode-Schicht setzt kompaktere Paddings/Border, die
         im Light-Mode fehlten -> Header, Sidebar und Buttons sprangen beim
         Umschalten. Light-Mode hier an dieselben Box-Metriken angleichen. */
      body.light .sb-brand { min-height: 68px; padding: 14px 14px 12px; gap: 10px; }
      body.light .sb-nav { padding: 3px 9px; }
      body.light .sb-nav-item,
      body.light .sb-history-item { border: 1px solid transparent; font-weight: 500; }
      body.light .btn-new-chat { border: 1px solid transparent; font-weight: 550; }
      body.light .sb-section-label { margin-top: 8px; padding: 7px 13px 4px; }
      body.light .sb-divider { margin: 7px 12px; }
      body.light .sb-history-item { padding: 7px 10px; }
      /* ISA-106: Bündige Shell wie im Dark Mode (kein Inset/gerahmte Karten mehr),
         damit Topbar/Content flächenbündig an Sidebar und Viewport anschließen.
         Fixe Topbar-Höhe bleibt, damit der Theme-Wechsel nicht die Höhe ändert. */
      body.light #main { padding: 0; }
      body.light #topbar {
        height: var(--header-h);
        border: 0;
        border-bottom: 1px solid var(--bdr2);
        border-radius: 0;
      }
      body.light #content {
        border: 0;
        border-radius: 0;
        overflow: hidden;
      }
      .library-page-sub,
      .library-section-sub,
      .pg-card-sub,
      .skill-desc,
      .skill-meta,
      .welcome-sub,
      .sug-sub,
      .modal-sub,
      .lock-modal-sub,
      .settings-role,
      .manage-item-sub,
      .admin-panel-copy,
      .department-description,
      .document-description {
        font-weight: 360;
      }

      /* ISA-43: Prompts als einspaltige Zeilenliste (Skills-Optik) */
      #library-prompts-panel #prompt-card-grid {
        grid-template-columns: 1fr;
      }
      #library-prompts-panel #prompt-card-grid .pg-card.is-hidden {
        display: none !important;
      }
      #library-prompts-panel #prompt-card-grid .prompt-template-card .pg-card-title {
        font-size: 13.5px;
        font-weight: 500;
        line-height: 1.48;
      }
      #library-prompts-panel #prompt-card-grid .prompt-template-card .pg-card-sub {
        display: block;
        margin: 0 0 10px;
        color: var(--txt2);
        font-size: 11.5px;
        font-weight: 360;
        line-height: 1.48;
        overflow: visible;
        -webkit-line-clamp: unset;
        -webkit-box-orient: initial;
      }
      #library-prompts-panel #prompt-card-grid .skill-meta .prompt-card-topic-pill {
        min-height: auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
      }
      #library-prompts-panel #prompt-card-grid .skill-meta svg {
        width: 14px;
        height: 14px;
      }
      /* ISA-68: Verwenden-Button im Grid in IsarMind-Blau — identisch zum
         neuen .skill-use-btn der Skills-Zeilen (gleiche Button-Logik). */
      #library-prompts-panel #prompt-card-grid .prompt-use-btn {
        min-height: 38px;
        padding: 0 16px;
        border: 0;
        border-radius: 12px;
        background: var(--blue);
        color: #fff;
        font-size: 12.5px;
        font-weight: 800;
        box-shadow: none;
      }
      #library-prompts-panel #prompt-card-grid .prompt-use-btn:hover,
      #library-prompts-panel #prompt-card-grid .prompt-use-btn:focus-visible {
        background: var(--aqua);
        color: #fff;
        box-shadow: none;
      }
      body:not(.light) .prompt-card-menu {
        background: var(--surf);
        border-color: var(--bdr2);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
      }
      body:not(.light) .prompt-card-menu button:hover,
      body:not(.light) .prompt-card-menu button:focus-visible {
        background: var(--surf2);
      }

      /* ============================================================
         MOBILE APP LAYER — responsive shell, off-canvas drawer,
         bottom-tab navigation, hamburger. Desktop is unchanged: the
         mobile chrome is hidden until the <=900px breakpoint.
         ============================================================ */
      #mobile-menu-btn,
      #mobile-bottom-nav,
      #mobile-drawer-backdrop { display: none; }

      #mobile-menu-btn {
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border: 1px solid var(--border-md);
        border-radius: var(--radius-sm);
        background: var(--surface-2);
        color: var(--text);
        cursor: pointer;
        flex-shrink: 0;
      }
      #mobile-menu-btn:active { background: var(--surface-3); }

      #mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(2, 4, 8, 0.6);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        z-index: 990;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
      }

      #mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(76px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(12, 20, 34, 0.98);
        border-top: 1px solid rgba(148, 163, 184, 0.18);
        box-shadow: 0 -18px 42px rgba(2, 6, 23, 0.38);
        -webkit-backdrop-filter: blur(18px);
        backdrop-filter: blur(18px);
        z-index: 980;
        flex-direction: row;
        align-items: stretch;
      }
      .mobile-tab {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        background: none;
        border: 0;
        color: rgba(213, 222, 239, 0.7);
        font-family: var(--font-body);
        font-size: 13px;
        font-weight: 760;
        letter-spacing: 0;
        cursor: pointer;
        min-width: 0;
        height: 76px;
        padding: 8px 4px 10px;
        transition: color 0.18s ease, background 0.18s ease;
      }
      .mobile-tab svg {
        width: 29px;
        height: 29px;
        stroke: currentColor;
        stroke-width: 1.9;
        fill: none;
        flex-shrink: 0;
      }
      .mobile-tab span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .mobile-tab:hover,
      .mobile-tab:focus-visible {
        color: rgba(245, 248, 255, 0.92);
        background: rgba(148, 163, 184, 0.08);
        outline: none;
      }
      .mobile-tab.active {
        color: var(--blue);
        background: linear-gradient(180deg, var(--accent-soft-bg), transparent);
      }
      body.light #mobile-bottom-nav {
        background: rgba(255, 255, 255, 0.96);
        border-top-color: rgba(148, 163, 184, 0.28);
        box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.13);
      }
      body.light .mobile-tab { color: rgba(71, 85, 105, 0.78); }
      body.light .mobile-tab:hover,
      body.light .mobile-tab:focus-visible { color: var(--text); background: var(--accent-soft-bg); }
      body.light .mobile-tab.active { color: var(--blue); }

      @media (display-mode: standalone) {
        #mobile-bottom-nav { display: flex; }
        #main {
          padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        }
      }

      @media (max-width: 900px) {
        #mobile-menu-btn { display: inline-flex; }
        #mobile-bottom-nav { display: flex; }
        #mobile-drawer-backdrop { display: block; }
        body.mobile-drawer-open #mobile-drawer-backdrop { opacity: 1; visibility: visible; }

        /* Sidebar becomes an off-canvas drawer */
        #sidebar {
          position: fixed;
          top: 0;
          left: 0;
          height: 100dvh;
          width: min(86vw, 320px);
          min-width: 0;
          transform: translateX(-100%);
          transition: transform 0.28s ease;
          z-index: 991;
          box-shadow: 0 0 48px rgba(0, 0, 0, 0.5);
          padding-top: env(safe-area-inset-top, 0px);
        }
        body.mobile-drawer-open #sidebar { transform: translateX(0); }

        /* Main spans full width; reserve space for the bottom nav */
        #main {
          width: 100%;
          min-width: 0;
          padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        }
        body:not(.light) #main {
          padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        }

        #topbar {
          padding: 0 12px;
          gap: 10px;
          padding-top: env(safe-area-inset-top, 0px);
          height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
        }

        /* Composer fits the narrow viewport */
        #input-area { padding: 12px 12px 14px; }
        .input-outer { max-width: 100%; }

        /* Kill horizontal overflow: let the flex chain shrink below content size */
        #content, .view, #chat-scroll, .chat-container, .page-scroll, #msg-list { min-width: 0; }
        .view, #chat-scroll, .page-scroll { overflow-x: hidden; }

        /* Chat empty-state fits a phone: narrower gutters, single-column cards */
        .chat-container { padding: 0 14px; }
        .welcome-title { font-size: 22px; overflow-wrap: anywhere; }
        .welcome-sub { max-width: 100%; }
        .suggestions { grid-template-columns: 1fr; max-width: 100%; }
      }

      @media (max-width: 480px) {
        .mobile-tab { font-size: 12px; }
        .mobile-tab svg { width: 27px; height: 27px; }
      }

      /* === Quellen-Viewer (RAG citations) === */
      .citation-card-clickable { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease; }
      .citation-card-clickable:hover {
        border-color: rgba(74,122,255,0.55);
        box-shadow: 0 8px 22px rgba(74,122,255,0.16);
        transform: translateY(-1px);
      }
      .citation-card-clickable:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
      .citation-open-hint {
        display: inline-flex; align-items: center; gap: 5px;
        margin-top: 8px; font-size: 11px; font-weight: 700;
        color: var(--blue); font-family: var(--font-head);
      }
      .source-viewer-body { display: grid; gap: 12px; }
      .source-viewer-back {
        min-height: 34px;
        margin: 0 0 14px;
        padding: 0 12px 0 10px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        width: max-content;
        max-width: 100%;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        background: var(--surf);
        color: var(--txt3);
        font: inherit;
        font-size: 13.5px;
        font-weight: 650;
        cursor: pointer;
      }
      .source-viewer-back:hover,
      .source-viewer-back:focus-visible {
        border-color: rgba(74,122,255,0.38);
        background: rgba(74,122,255,0.10);
        color: var(--blue);
      }
      .source-viewer-loading, .source-viewer-note { color: var(--txt3); font-size: 13px; line-height: 1.55; }
      .source-viewer-meta { display: flex; flex-wrap: wrap; gap: 8px; }
      .source-chunk-list { display: grid; gap: 10px; }
      .source-chunk {
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        padding: 14px;
        background: var(--surf2);
      }
      .source-chunk-active {
        border-color: rgba(74,122,255,0.7);
        background: rgba(74,122,255,0.10);
        box-shadow: 0 0 0 2px rgba(74,122,255,0.16);
      }
      .source-chunk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
      .source-chunk-id { font-family: var(--font-head); font-size: 11.5px; font-weight: 800; color: var(--txt2); }
      .source-chunk-pages { font-size: 11px; color: var(--txt3); }
      .source-chunk-badge {
        margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .04em;
        text-transform: uppercase; color: var(--blue); background: rgba(74,122,255,0.16);
        padding: 3px 8px; border-radius: 999px;
      }
      .source-chunk-text { color: var(--txt2); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }

      /* ISA-98: Original-Dokument-Vorschau im Quellen-Viewer */
      .source-viewer-filename { font-size: 12px; color: var(--txt3); }
      .source-doc-preview {
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        padding: 20px 22px;
        background: var(--surf2);
        color: var(--txt2);
        font-size: 14px;
        line-height: 1.65;
        max-height: 62vh;
        overflow-y: auto;
      }
      .source-doc-preview h1, .source-doc-preview h2, .source-doc-preview h3,
      .source-doc-preview h4, .source-doc-preview h5, .source-doc-preview h6 {
        font-family: var(--font-head); color: var(--txt1); line-height: 1.25;
        margin: 18px 0 8px; font-weight: 650;
      }
      .source-doc-preview h1 { font-size: 22px; }
      .source-doc-preview h2 { font-size: 19px; }
      .source-doc-preview h3 { font-size: 16px; }
      .source-doc-preview h1:first-child, .source-doc-preview h2:first-child,
      .source-doc-preview h3:first-child, .source-doc-preview > :first-child { margin-top: 0; }
      .source-doc-preview p { margin: 0 0 11px; }
      .source-doc-preview ul, .source-doc-preview ol { margin: 0 0 11px; padding-left: 22px; }
      .source-doc-preview li { margin: 3px 0; }
      .source-doc-preview a { color: var(--blue); text-decoration: underline; }
      .source-doc-preview blockquote {
        margin: 0 0 11px; padding: 6px 14px; border-left: 3px solid var(--bdr1);
        color: var(--txt3);
      }
      .source-doc-preview code {
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
        background: var(--surf3, rgba(127,127,127,0.12)); padding: 1px 5px; border-radius: 6px;
      }
      .source-doc-code {
        background: var(--surf3, rgba(127,127,127,0.12)); border-radius: 10px;
        padding: 12px 14px; overflow-x: auto; margin: 0 0 11px;
      }
      .source-doc-code code { background: none; padding: 0; }
      /* ISA-115: Plain-Text kommt jetzt als gesetzte Absätze (<p>/<br>) aus dem
         geteilten Preview-Renderer — kein pre-wrap-Rohdump mehr. */
      .source-doc-plain { font-size: 13.5px; line-height: 1.6; }
      .source-doc-plain p { margin: 0 0 11px; }
      .source-doc-plain p:last-child { margin-bottom: 0; }
      /* ISA-115: Tabellen scrollen in beide Richtungen in eigener Fläche,
         der Kopf bleibt dabei sichtbar (Sticky Header). */
      .source-doc-tablewrap { overflow: auto; max-height: 46vh; margin: 0 0 11px; }
      .source-doc-table th { position: sticky; top: 0; z-index: 1; }
      .source-doc-table { border-collapse: collapse; width: 100%; font-size: 13px; }
      .source-doc-table th, .source-doc-table td {
        border: 1px solid var(--bdr2); padding: 7px 10px; text-align: left; vertical-align: top;
      }
      .source-doc-table th { background: var(--surf3, rgba(127,127,127,0.10)); font-weight: 650; color: var(--txt1); }
      .source-doc-preview mark.source-hit {
        background: rgba(74,122,255,0.28); color: inherit;
        border-radius: 4px; padding: 1px 2px; box-shadow: 0 0 0 2px rgba(74,122,255,0.20);
      }
      .source-doc-note { margin-bottom: 10px; }

      /* === Streaming-Chat (progressive reveal) === */
      .msg-bubble.streaming { white-space: pre-wrap; }
      .msg-bubble.streaming::after {
        content: "";
        display: inline-block;
        width: 7px; height: 15px;
        margin-left: 2px;
        vertical-align: text-bottom;
        background: var(--blue);
        border-radius: 1px;
        animation: isar-caret 1s steps(1) infinite;
      }
      @keyframes isar-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
      .msg-meta { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
      .msg-stop-btn {
        font-family: var(--font-head);
        font-size: 10.5px; font-weight: 700;
        color: var(--txt2);
        border: 1px solid var(--bdr2);
        background: var(--surf2);
        border-radius: 999px;
        padding: 2px 10px;
        cursor: pointer;
        transition: border-color .15s ease, color .15s ease, background .15s ease;
      }
      .msg-stop-btn:hover { color: var(--txt); border-color: color-mix(in srgb, var(--aqua) 50%, transparent); background: var(--accent-soft-bg); }
      .msg-speech-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 24px;
        padding: 3px 10px 3px 8px;
        border: 1px solid var(--bdr2);
        border-radius: 999px;
        background: color-mix(in srgb, var(--surf2) 86%, transparent);
        color: var(--txt2);
        font-family: var(--font-head);
        font-size: 10.5px;
        font-weight: 800;
        line-height: 1;
        cursor: pointer;
        transition: color .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
      }
      .msg-speech-btn:hover {
        color: var(--txt);
        border-color: rgba(74,122,255,0.54);
        background: rgba(74,122,255,0.13);
      }
      .msg-speech-btn.speaking {
        color: #dfe8ff;
        border-color: rgba(74,122,255,0.66);
        background: rgba(36,87,212,0.24);
        box-shadow: 0 0 0 3px rgba(74,122,255,0.09);
      }
      .msg-speech-wave {
        width: 14px;
        height: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 2px;
      }
      .msg-speech-wave span {
        width: 2px;
        height: 6px;
        border-radius: 99px;
        background: currentColor;
        opacity: .78;
      }
      .msg-speech-btn.speaking .msg-speech-wave span {
        animation: speech-wave .82s ease-in-out infinite;
      }
      .msg-speech-btn.speaking .msg-speech-wave span:nth-child(2) { animation-delay: .12s; }
      .msg-speech-btn.speaking .msg-speech-wave span:nth-child(3) { animation-delay: .24s; }
      @keyframes speech-wave {
        0%, 100% { height: 5px; opacity: .55; }
        50% { height: 12px; opacity: 1; }
      }
      body.light .msg-speech-btn {
        background: #f8fafc;
        border-color: #d8dfef;
        color: #5f6f86;
      }
      body.light .msg-speech-btn:hover,
      body.light .msg-speech-btn.speaking {
        color: var(--blue);
        border-color: rgba(36,87,212,0.34);
        background: rgba(36,87,212,0.10);
      }

      /* === Globale Suche (Cmd+K) === */
      #cmdk-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1200;
        padding: 12vh 18px 18px;
        justify-content: center;
        align-items: flex-start;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(5px);
      }
      #cmdk-overlay.open { display: flex; }
      .cmdk-panel {
        width: min(620px, 100%);
        max-height: 64vh;
        display: flex;
        flex-direction: column;
        background: var(--surf);
        border: 1px solid var(--bdr2);
        border-radius: 16px;
        box-shadow: 0 28px 80px rgba(0,0,0,0.5);
        overflow: hidden;
      }
      .cmdk-input-row {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 16px;
        border-bottom: 1px solid var(--bdr2);
        color: var(--txt3);
      }
      #cmdk-input {
        flex: 1;
        border: 0;
        background: transparent;
        color: var(--txt);
        font-size: 15px;
        font-family: var(--font-head);
        outline: none;
      }
      .cmdk-esc {
        font-size: 10px; font-weight: 700; letter-spacing: .05em;
        color: var(--txt3); border: 1px solid var(--bdr2);
        border-radius: 6px; padding: 2px 6px;
      }
      .cmdk-results { overflow-y: auto; padding: 6px; }
      .cmdk-group-label {
        font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
        text-transform: uppercase; color: var(--txt3);
        padding: 10px 10px 4px;
      }
      .cmdk-row {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        width: 100%; text-align: left;
        padding: 9px 10px; border-radius: 10px;
        background: transparent; border: 0; cursor: pointer;
        color: var(--txt2);
      }
      .cmdk-row.active { background: var(--accent-soft-bg); color: var(--txt); }
      .cmdk-row-label { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .cmdk-row-group { font-size: 10.5px; font-weight: 700; color: var(--txt3); flex-shrink: 0; }
      .cmdk-empty { padding: 28px 12px; text-align: center; color: var(--txt3); font-size: 13px; }
      .cmdk-foot {
        display: flex; gap: 16px; flex-wrap: wrap;
        padding: 10px 16px; border-top: 1px solid var(--bdr2);
        font-size: 11px; color: var(--txt3);
      }
      .cmdk-foot kbd {
        font-family: var(--font-head); font-size: 10px;
        border: 1px solid var(--bdr2); border-radius: 5px;
        padding: 1px 5px; margin-right: 3px; color: var(--txt2);
      }

      /* === Agenten-Ausführung (Step-Log) === */
      .agent-run { display: grid; gap: 12px; }
      .agent-run-head {
        display: flex; align-items: center; gap: 8px;
        font-family: var(--font-head); font-size: 13.5px; color: var(--txt);
      }
      .agent-run-state {
        font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
        color: var(--blue); background: var(--accent-soft-bg-strong);
        padding: 3px 8px; border-radius: 999px;
      }
      .agent-run-head.done .agent-run-state { color: #16834a; background: rgba(74,222,128,0.18); }
      .agent-steps { display: grid; gap: 8px; }
      .agent-step { display: flex; align-items: flex-start; gap: 10px; }
      .agent-step-ico {
        flex-shrink: 0; width: 22px; height: 22px;
        display: flex; align-items: center; justify-content: center;
        border-radius: 999px; border: 1px solid var(--bdr2);
        color: var(--txt3); margin-top: 1px;
      }
      .agent-step-ico .agent-step-check { display: none; }
      .agent-step--running .agent-step-ico { color: var(--blue); border-color: color-mix(in srgb, var(--aqua) 50%, transparent); }
      .agent-step--running .agent-step-spin { animation: isar-spin .8s linear infinite; }
      .agent-step--done .agent-step-ico { color: #16834a; border-color: rgba(74,222,128,0.5); background: rgba(74,222,128,0.12); }
      .agent-step--done .agent-step-spin { display: none; }
      .agent-step--done .agent-step-check { display: block; }
      .agent-step--pending { opacity: 0.6; }
      @keyframes isar-spin { to { transform: rotate(360deg); } }
      .agent-step-label { font-size: 13px; font-weight: 600; color: var(--txt); line-height: 1.4; }
      .agent-step-detail { font-size: 12px; color: var(--txt3); line-height: 1.5; margin-top: 2px; }
      .agent-step-detail:empty { display: none; }
      .agent-result-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
      .agent-result-sources:empty { display: none; }
      .agent-result-sources-label {
        width: 100%; font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
        text-transform: uppercase; color: var(--txt3); margin-bottom: 1px;
      }
      .agent-source-chip {
        font-size: 11.5px; font-weight: 600;
        color: var(--blue); background: var(--accent-soft-bg);
        border: 1px solid color-mix(in srgb, var(--aqua) 28%, transparent); border-radius: 999px;
        padding: 4px 11px; cursor: pointer;
        transition: background .15s ease, border-color .15s ease;
      }
      .agent-source-chip:hover { background: var(--accent-soft-bg-strong); border-color: color-mix(in srgb, var(--aqua) 50%, transparent); }

      /* === Einheitliche, kompakte Überschriften-Skala: Projekte + Prompts + Skills ===
         Steht bewusst am Dateiende: überschreibt per Quell-Reihenfolge die
         verstreuten älteren Title-Deklarationen. Ziel: kleinere Seitentitel
         (wie zuvor) und NICHT fett gedruckte Sektionstitel. */
      .project-overview-title,
      .library-page-title,
      .settings-page-title { /* ISA-55: Settings in die kanonische Titel-Skala aufnehmen */
        font-size: 30px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: 0;
        margin: 0 0 10px;
      }
      .settings-page-title { margin-top: 16px; } /* ISA-55: Abstand zum Breadcrumb erhalten */
      .library-page-sub {
        font-size: 14px;
        font-weight: 400;
        line-height: 1.55;
        max-width: 760px;
      }
      .project-overview-section h3,
      .library-section-title {
        font-size: 18px;
        font-weight: 500;
        letter-spacing: 0;
      }
      .library-section-sub,
      .library-count {
        font-size: 14px;
        font-weight: 400;
      }

      /* "Eigen"-Chip nicht unter das absolute ⋮-Menü laufen lassen:
         rechts im Karten-Top-Row Platz für den Menü-Button reservieren. */
      .project-workspace-card .project-card-top {
        padding-right: 34px;
      }

      /* Projekt-Karten-Schrift an die Bibliothek-Karten angleichen
         (Bibliothek: .pg-card-title 14px/700, .pg-card-sub 12px). */
      .project-workspace-card .pg-card-title {
        font-size: 14px;
        font-weight: 700;
        line-height: 1.3;
      }
      .project-overview-card-text {
        font-size: 12px;
        line-height: 1.55;
      }

      /* Karten-Kontextmenü (⋮): Bearbeiten / Teilen / Löschen */
      .project-card-context-menu {
        position: fixed;
        z-index: 1300;
        min-width: 210px;
        padding: 6px;
        background: var(--surf);
        border: 1px solid var(--bdr2);
        border-radius: 12px;
        box-shadow: 0 18px 44px rgba(5,10,20,0.28);
        display: grid;
        gap: 2px;
      }
      .pcm-item {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 9px 10px;
        border: 0;
        background: transparent;
        border-radius: 8px;
        cursor: pointer;
        color: var(--txt);
        font: inherit;
        font-size: 14px;
        font-weight: 500;
        text-align: left;
      }
      .pcm-item svg {
        width: 17px;
        height: 17px;
        flex: 0 0 auto;
        color: var(--txt3);
      }
      .pcm-item:hover {
        background: var(--surf2);
      }
      .pcm-divider {
        height: 1px;
        background: var(--bdr2);
        margin: 4px 2px;
      }
      .pcm-danger { color: var(--red); }
      .pcm-danger svg { color: var(--red); }
      .pcm-danger:hover { background: rgba(255,107,97,0.10); }

      /* Teilen-Modal: Link-Zeile (Input + Kopieren-Button) */
      .share-link-row {
        display: flex;
        gap: 8px;
        align-items: center;
      }
      .share-link-row .form-input {
        flex: 1;
        min-width: 0;
      }
      .share-link-row .btn-secondary {
        flex: 0 0 auto;
      }

      /* Projektkarten: 3 pro Reihe (responsiv), etwas kompakter */
      .project-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
        max-width: none;
      }
      .project-card-grid.list-mode {
        grid-template-columns: minmax(0, 1fr);
      }
      .project-workspace-card {
        min-height: 178px;
        padding: 18px;
      }

      /* Toolbar: Suchfeld flext, View-Umschalter umschließt nur seine Icons
         (sonst zieht der auto-Track den Toggle auf den Restplatz auf). */
      .project-toolbar-right {
        grid-template-columns: minmax(0, 1fr) auto;
      }
      .project-view-toggle {
        justify-self: end;
        width: max-content;
        display: inline-flex;
        align-items: center;
      }

      /* === "Änderungen werden übernommen…" Fortschritts-Modal (Bearbeiten) === */
      .pep-modal { text-align: center; display: grid; gap: 22px; padding: 6px 4px 2px; }
      .pep-title { font-family: var(--font-head); font-size: 24px; font-weight: 700; color: var(--txt); }
      .pep-steps { display: grid; gap: 18px; justify-items: start; width: 100%; max-width: 460px; margin: 6px auto; }
      .pep-step { display: flex; align-items: center; gap: 14px; }
      .pep-ico {
        position: relative;
        width: 38px; height: 38px;
        flex: 0 0 auto;
        border-radius: 50%;
        display: grid; place-items: center;
        background: rgba(100,116,139,0.12);
        color: var(--txt3);
      }
      .pep-ico svg { width: 18px; height: 18px; }
      .pep-ico .pep-spinner, .pep-ico .pep-check { display: none; position: absolute; }
      .pep-step.pep-active .pep-ico,
      .pep-step.pep-done .pep-ico { background: var(--blue-soft); color: var(--blue); }
      .pep-step.pep-active .pep-base { display: none; }
      .pep-step.pep-active .pep-spinner { display: block; animation: isar-spin 0.8s linear infinite; }
      .pep-step.pep-done .pep-base { display: none; }
      .pep-step.pep-done .pep-check { display: block; }
      .pep-label { font-size: 17px; color: var(--txt3); }
      .pep-step.pep-active .pep-label { color: var(--blue); font-weight: 700; }
      .pep-step.pep-done .pep-label { color: var(--blue); }
      .pep-dots { display: flex; gap: 9px; justify-content: center; }
      .pep-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(100,116,139,0.28); transition: background 0.2s ease; }
      .pep-dot.active { background: var(--blue); }
      .pep-counter { color: var(--txt3); font-size: 14px; }
      .pep-cancel { color: var(--txt3); font-size: 15px; background: transparent; border: 0; cursor: pointer; padding: 4px; }
      .pep-cancel:hover { color: var(--txt); }

      /* === Teilen-Modal: Auswahl-Karten (Privat / Mit Team teilen) === */
      .share-options { display: grid; gap: 12px; }
      .share-option {
        display: flex; align-items: center; gap: 16px;
        width: 100%; text-align: left;
        padding: 18px; border-radius: 16px;
        border: 1.5px solid var(--bdr2); background: var(--surf);
        cursor: pointer; color: var(--txt);
        transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
      }
      .share-option:not(.active):hover { border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
      .share-option.active {
        border-color: var(--blue);
        background: var(--blue-soft);
        box-shadow: inset 0 0 0 1px var(--blue);
      }
      .share-option-ico {
        width: 56px; height: 56px; flex: 0 0 auto;
        border-radius: 14px; display: grid; place-items: center;
        background: var(--surf2); color: var(--txt2);
      }
      .share-option.active .share-option-ico { background: var(--surf); color: var(--blue); }
      .share-option-ico svg { width: 26px; height: 26px; }
      .share-option-text { display: grid; gap: 3px; flex: 1; min-width: 0; }
      .share-option-title { font-family: var(--font-head); font-size: 19px; font-weight: 700; color: var(--txt); }
      .share-option-sub { font-size: 14px; color: var(--txt3); line-height: 1.4; }
      .share-option-check { flex: 0 0 auto; color: var(--blue); opacity: 0; transition: opacity .15s ease; }
      .share-option.active .share-option-check { opacity: 1; }
      .share-option-check svg { width: 26px; height: 26px; }
      /* ISA-90: Team-Auswahl beim Teilen eines Projektordners */
      .share-team-block { display: grid; gap: 8px; margin-top: 14px; }
      .share-team-hint { font-size: 13px; color: var(--txt3); line-height: 1.4; margin: 0; }
      .share-team-hint.is-error { color: var(--red); }

      /* === Projektordner-Detailansicht (chat-zentriert) === */
      .project-space {
        width: min(100%, 920px);
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 18px;
        min-height: calc(100vh - 170px);
      }
      /* ISA-11: Projektchats links/primaer, Unternehmenswissen rechts/sekundaer */
      .project-space.project-space-split {
        width: min(100%, 1280px);
        display: grid;
        grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.8fr);
        gap: 22px;
        align-items: start;
      }
      .project-space-main {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 18px;
        min-height: calc(100vh - 170px);
      }
      .project-space-side { min-width: 0; }
      /* ISA-91: Unternehmenswissen als Sektion im Hauptbereich (statt rechter Kasten). */
      .project-knowledge-main {
        margin-top: 4px;
      }
      .project-space-chats-bar {
        display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
      }
      /* ISA-91: "+ Wissen hinzufügen" sitzt rechts neben "+ Chat hinzufügen";
         die Suche behält den flexiblen Raum links. */
      .project-space-chats-bar .project-space-search { flex: 1 1 260px; }
      .project-space-add-knowledge { flex: 0 0 auto; min-height: 38px; }
      .project-space-chats-bar .project-space-search { flex: 1 1 220px; width: auto; }
      .project-space-add {
        flex: 0 0 auto; min-height: 42px; padding: 0 18px;
        font-family: var(--font-head); font-weight: 700; font-size: 14px;
        border-radius: 12px;
      }
      @media (max-width: 980px) {
        .project-space.project-space-split { grid-template-columns: 1fr; width: min(100%, 920px); }
        .project-space-main { min-height: 0; }
      }
      .project-space-head { display: grid; gap: 8px; }
      .project-space-title { margin: 0; font-family: var(--font-head); font-size: 30px; font-weight: 700; color: var(--txt); }
      .project-space-sub { margin: 0; max-width: 760px; color: var(--txt3); font-size: 15px; line-height: 1.6; }
      .project-space-search {
        display: flex; align-items: center; gap: 10px;
        width: min(100%, 360px); min-height: 42px; padding: 0 14px;
        border: 1px solid var(--bdr2); border-radius: 12px;
        background: var(--surf); color: var(--txt3);
      }
      .project-space-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
      .project-space-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--txt); font: inherit; outline: 0; }
      .project-space-chats { flex: 1; display: grid; gap: 8px; align-content: start; }
      .project-space-chats.is-empty { place-items: center; place-content: center; }
      .project-space-empty { display: grid; justify-items: center; gap: 12px; color: var(--txt3); font-size: 15px; }
      .project-space-empty-ico { width: 40px; height: 40px; opacity: 0.85; }
      /* ISA-44: Dokument-Auswahl aus dem Wissensspeicher (Picker im Projekt) */
      .project-doc-pick-search {
        display: flex; align-items: center; gap: 10px;
        min-height: 42px; padding: 0 14px; margin-bottom: 12px;
        border: 1px solid var(--bdr2); border-radius: 12px;
        background: var(--surf); color: var(--txt3);
      }
      .project-doc-pick-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
      .project-doc-pick-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--txt); font: inherit; outline: 0; }
      .project-doc-pick-list { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; }
      .project-doc-pick-row {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
        width: 100%; padding: 11px 13px; border-radius: 12px;
        border: 1px solid var(--border); background: rgba(74,122,255,0.06);
        color: var(--text); text-align: left; cursor: pointer;
      }
      .project-doc-pick-row:hover,
      .project-doc-pick-row:focus-visible { border-color: rgba(74,122,255,0.5); background: rgba(74,122,255,0.1); outline: 0; }
      .project-doc-pick-row.is-added { opacity: 0.6; }
      .project-doc-pick-info { min-width: 0; display: grid; gap: 5px; }
      .project-doc-pick-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--text); }
      .project-doc-pick-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
      .project-doc-pick-chip { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--txt3); }
      .project-doc-pick-trust { color: var(--blue); font-weight: 800; }
      .project-doc-pick-action { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: var(--blue); white-space: nowrap; }
      .project-doc-pick-row.is-added .project-doc-pick-action { color: var(--muted); }
      .project-doc-pick-empty { padding: 18px; text-align: center; color: var(--txt3); font-size: 13px; }

      /* === Bereiche unterhalb Projekte an Bibliothek/Projekte angleichen === */
      .ph-title {
        font-size: 30px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: 0;
        color: var(--txt);
      }
      .ph-sub {
        font-size: 14px;
        font-weight: 400;
        line-height: 1.55;
        max-width: 760px;
      }
      .knowledge-hero-title,
      .department-hero-title,
      .admin-panel-title {
        font-size: 18px;
        font-weight: 500;
      }

      /* Chat-Startbildschirm ("Hey Tammo…") etwas höher positionieren */
      #empty-state {
        margin-top: clamp(20px, 8vh, 88px);
        margin-bottom: auto;
      }


      /* ===== Agenten-Bereich (Übersicht + Neuer Agent) ===== */
      #view-agents .page-scroll { padding-bottom: 96px; }
      .agents-overview-shell { margin: 0 auto; }
      .agents-new-btn {
        flex-shrink: 0;
        white-space: nowrap;
        background: var(--blue-ui-bg);
        border: 1px solid var(--blue-ui-border);
        box-shadow: var(--blue-ui-shadow);
      }
      .agents-new-btn:hover { background: var(--blue-ui-bg-hover); }

      .agents-tabs { display: flex; flex-wrap: wrap; gap: 10px; }
      .agents-tab {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        padding: 0 14px;
        border: 1px solid var(--bdr2);
        border-radius: 10px;
        background: var(--surf);
        color: var(--txt2);
        font-weight: 600;
      }
      .agents-tab:not(.active):hover { border-color: color-mix(in srgb, var(--blue) 40%, transparent); background: var(--surf2); color: var(--txt); }
      .agents-toolbar-right {
        justify-self: end;
        display: grid;
        grid-template-columns: minmax(260px, 520px) auto;
        align-items: center;
        gap: 10px;
        width: min(100%, 690px);
      }
      .agents-search {
        justify-self: end;
        width: 100%;
        min-height: 42px;
        border: 1px solid var(--bdr2);
        border-radius: 11px;
        background: var(--surf);
        color: var(--txt3);
        padding: 0 14px;
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .agents-search svg { width: 18px; height: 18px; flex: 0 0 auto; color: currentColor; pointer-events: none; }
      .agents-search input {
        width: 100%;
        min-height: 40px;
        border: 0;
        background: transparent;
        color: var(--txt);
        padding: 0;
        font: inherit;
        outline: 0;
      }
      .agents-layout-toggle {
        min-height: 42px;
        padding: 3px;
        border: 1px solid var(--bdr2);
        border-radius: 11px;
        background: var(--surf);
      }
      .agents-layout-btn { width: 36px; height: 36px; }
      .agents-layout-btn svg { width: 18px; height: 18px; }

      .agents-section-hd { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 0; }
      .agents-count { color: var(--txt3); font-size: 14px; white-space: nowrap; }

      .agents-grid.agents-grid { margin-bottom: 28px; }
      .agents-grid.list-view { grid-template-columns: minmax(0, 720px); }
      .agent-card { display: block; }
      .agent-card-open { min-height: 142px; }
      .agent-avatar {
        font-family: var(--font-head);
        font-size: 15px;
        font-weight: 800;
      }
      .agent-badge { flex-shrink: 0; }
      .agent-badge-official,
      .agent-badge-mine { color: var(--txt3); }
      .agent-card-sub { margin-top: 4px; }

      .agents-empty {
        gap: 14px;
        margin-bottom: 28px;
      }
      .agents-empty:not([hidden]) { display: grid; }
      .agents-empty strong { color: var(--txt); font-weight: 600; }
      .agents-empty span { color: var(--txt3); }
      .agents-empty .btn-primary { margin-top: 6px; }

      /* ----- Neuer Agent: Formular ----- */
      .agent-create-hd {
        position: sticky;
        top: 0;
        z-index: 80;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        margin: -38px -42px 14px;
        padding: 38px 42px 18px;
        border-bottom: 1px solid var(--border);
        background: var(--bg);
        box-shadow: 0 12px 26px rgba(15,23,42,0.04);
      }
      #agents-create-panel > .ph-rule { display: none; }
      .agent-create-crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
      .agent-crumb-link { border: 0; background: transparent; color: var(--blue); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }
      .agent-crumb-link:hover { text-decoration: underline; }
      .agent-crumb-sep { opacity: 0.5; }
      .agent-create-actions { display: inline-flex; gap: 10px; flex-shrink: 0; }
      .agent-form-section { margin-bottom: 18px; }
      .agent-card-box { border: 1px solid var(--border-md); border-radius: var(--radius-lg); background: var(--surface); padding: 18px 20px; }
      .agent-section-hint { font-size: 12px; color: var(--muted); margin: 4px 0 14px; }
      .agent-counter { text-align: right; font-size: 11px; color: var(--muted); margin-top: 5px; }

      .agent-template-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
      .agent-template-chip {
        display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 99px;
        border: 1px solid var(--border-md); background: var(--surface-2); color: var(--navy);
        font-size: 12.5px; font-weight: 700; cursor: pointer;
      }
      .agent-template-chip svg { color: var(--blue); }
      .agent-template-chip:hover, .agent-template-chip.selected { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
      .agent-template-list { display: flex; flex-direction: column; gap: 2px; }
      .agent-template-item {
        display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px; border-radius: var(--radius-md);
        cursor: pointer; border: 1px solid transparent; transition: background 0.14s ease, border-color 0.14s ease;
      }
      .agent-template-item:hover { background: var(--surface-2); }
      .agent-template-item.selected { border-color: var(--blue); background: var(--blue-soft); }
      .agent-template-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
      .agent-template-name { font-weight: 800; color: var(--navy); font-size: 13px; }
      .agent-template-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px; }

      .agent-model-field { position: relative; }
      .agent-model-select {
        width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
        border: 1px solid var(--border-md); border-radius: var(--radius-md); background: #0b0c11;
        color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
      }
      body.light .agent-model-select { background: var(--surface); }
      .agent-model-select:hover { border-color: var(--blue); }
      .agent-model-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex-shrink: 0; }
      .agent-model-label { flex: 1; min-width: 0; color: var(--text); }
      .agent-model-label.placeholder { color: var(--muted); }
      .agent-model-chevron { color: var(--muted); flex-shrink: 0; transition: transform 0.16s ease; }
      .agent-model-select[aria-expanded="true"] .agent-model-chevron { transform: rotate(180deg); }
      .agent-model-menu {
        position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
        background: var(--surface); border: 1px solid var(--border-md); border-radius: var(--radius-md);
        box-shadow: var(--shadow-soft); padding: 6px; max-height: 280px; overflow-y: auto;
      }
      .agent-model-item {
        display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0;
        background: transparent; border-radius: 8px; cursor: pointer; color: var(--navy); font: inherit; font-size: 13px; text-align: left;
      }
      .agent-model-item:hover { background: var(--surface-2); }
      .agent-model-item.selected { background: var(--blue-soft); }
      .agent-model-item .agent-model-dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--aqua)); flex-shrink: 0; }
      /* ISA-47: echte Marken-Logos im Agenten-Modellpicker (Menü + Trigger). */
      .agent-model-item .agent-model-brand { display: inline-flex; flex-shrink: 0; }
      .agent-model-item .agent-model-brand .provider-dot { width: 22px; height: 22px; flex-basis: 22px; border-radius: 7px; }
      .agent-model-item .agent-model-brand .provider-dot svg { width: 13px; height: 13px; }
      .agent-model-ico:has(.provider-dot) { background: transparent; }
      .agent-model-ico .provider-dot { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; }
      .agent-model-ico .provider-dot svg { width: 15px; height: 15px; }
      .agent-model-name { flex: 1; font-weight: 700; }
      .agent-model-starter { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 800; }
      .agent-model-divider { height: 1px; background: var(--border); margin: 5px 4px; }

      .agent-creativity-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
      .agent-creativity-num { width: 64px; text-align: center; padding: 8px 8px; border: 1px solid var(--border-md); border-radius: var(--radius-sm); background: #0b0c11; color: var(--text); font: inherit; font-size: 13px; outline: 0; flex-shrink: 0; }
      body.light .agent-creativity-num { background: var(--surface); }
      .agent-creativity-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; margin: 16px 0 8px; background: linear-gradient(90deg, var(--blue) 0%, var(--blue) 70%, var(--border-md) 70%, var(--border-md) 100%); cursor: pointer; }
      .agent-creativity-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); box-shadow: 0 2px 6px rgba(5,10,20,0.3); cursor: pointer; }
      .agent-creativity-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); cursor: pointer; }
      .agent-creativity-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

      @media (max-width: 640px) {
        .agents-hd-row { flex-direction: column; }
        .agents-toolbar { flex-direction: column; align-items: stretch; }
        .agents-toolbar-right { justify-content: space-between; }
        .agents-search input { width: 100%; max-width: none; }
        .agent-create-hd {
          flex-direction: column;
          margin: -28px -18px 18px;
          padding: 28px 18px 16px;
        }
        .agents-grid.list-view .agent-card { flex-direction: column; align-items: stretch; }
        .agents-grid.list-view .agent-card .agent-card-desc { margin-left: 0; max-width: none; text-align: left; }
      }

      /* ===== Wissen: Dokumenten-Toolbar ===== */
      .knowledge-docs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
      .knowledge-docs-head .mind-section-title { margin: 0; }
      .kn-toolbar { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
      .kn-field { position: relative; }
      .kn-tool-btn {
        display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
        border: 1px solid var(--border-md); border-radius: var(--radius-md);
        background: var(--surface); color: var(--navy); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
      }
      .kn-tool-btn svg:first-child { color: var(--muted); }
      .kn-tool-btn:hover { border-color: var(--blue); }
      .kn-tool-btn .kn-chev { color: var(--muted); transition: transform 0.16s ease; }
      .kn-tool-btn[aria-expanded="true"] .kn-chev { transform: rotate(180deg); }
      .kn-dir-btn {
        display: grid; place-items: center; width: 36px; height: 36px;
        border: 1px solid var(--border-md); border-radius: var(--radius-md);
        background: var(--surface); color: var(--muted); cursor: pointer;
      }
      .kn-dir-btn:hover { border-color: var(--blue); color: var(--navy); }
      .kn-dir-btn.desc svg { transform: scaleY(-1); }
      .kn-count {
        display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px;
        border: 1px solid var(--border-md); border-radius: var(--radius-md);
        background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 800;
      }
      .kn-menu {
        position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 180px;
        background: var(--surface); border: 1px solid var(--border-md); border-radius: var(--radius-md);
        box-shadow: var(--shadow-soft); padding: 6px; max-height: 280px; overflow-y: auto;
      }
      .kn-menu-item {
        display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 8px; border: 0;
        background: transparent; border-radius: 8px; cursor: pointer; color: var(--navy); font: inherit; font-size: 13px; text-align: left;
      }
      .kn-menu-item:hover { background: var(--surface-2); }
      .kn-menu-item.active { color: var(--blue); }
      .kn-menu-item .kn-check { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--blue); visibility: hidden; flex-shrink: 0; }
      .kn-menu-item.active .kn-check { visibility: visible; }
      .kn-menu-item .kn-menu-ico { display: inline-flex; color: var(--muted); flex-shrink: 0; }
      .kn-menu-item.active .kn-menu-ico { color: var(--blue); }
      .kn-doc-meta { font-size: 11.5px; color: var(--muted); margin: 4px 0 8px; }
      .kn-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--border-md); border-radius: var(--radius-md); }
      @media (min-width: 720px) {
        .mind-source-panel .mind-sources-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      }
      /* Ranking: Rang-Badge + Relevanz-Balken */
      .kn-rank {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 22px; height: 22px; padding: 0 6px; margin-right: 8px;
        border-radius: 99px; background: var(--blue-soft); color: var(--blue);
        font-size: 11px; font-weight: 800; vertical-align: middle;
      }
      .kn-rank.top { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(36,87,212,0.32); }
      .kn-rankrow { display: flex; align-items: center; gap: 9px; margin: 8px 0 10px; }
      .kn-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--border-md); overflow: hidden; }
      .kn-bar-fill { height: 100%; border-radius: 99px; background: var(--blue); transition: width 0.3s ease; }
      .kn-bar-fill.ok { background: #22c55e; }
      .kn-bar-fill.warn { background: var(--yellow); }
      .kn-bar-val { font-size: 11px; font-weight: 800; color: var(--navy); min-width: 36px; text-align: right; }

      /* ===== Verfeinerungen: Tab-Zähler, schlankes Ranking, mehr Weißraum ===== */
      .agents-tab-count {
        min-width: 19px;
        height: 19px;
        padding: 0 6px;
        display: inline-grid;
        place-items: center;
        margin-left: 0;
        border-radius: 999px;
        background: rgba(100,116,139,0.10);
        color: currentColor;
        font-size: 11.5px;
        font-weight: 400;
        line-height: 1;
        opacity: 0.85;
      }
      .agents-tab.active .agents-tab-count { background: rgba(255,255,255,0.18); color: currentColor; opacity: 1; }
      .agents-grid { gap: 16px; }
      .agents-toolbar { margin: 26px 0 22px; }
      .agents-section-hd { margin-bottom: 18px; }

      /* schlankes Quellen-Ranking: Prozent-Zahl statt Balken */
      .kn-doc-titlerow { display: flex; align-items: center; gap: 9px; }
      .kn-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .kn-pct { font-size: 13px; font-weight: 800; color: var(--blue); flex-shrink: 0; }
      .kn-pct.ok { color: #16a34a; }
      body:not(.light) .kn-pct.ok { color: #37d07f; }
      .kn-pct.warn { color: #b9800a; }
      body:not(.light) .kn-pct.warn { color: #e0b53e; }
      .mind-source-panel .rag-source-card { padding: 16px 18px; }
      .mind-source-panel .mind-sources-list { gap: 12px; }
      .mind-sources-list .rag-source-card .kn-doc-del { display: inline-grid; }
      .kn-doc-del {
        place-items: center; width: 30px; height: 30px; flex-shrink: 0;
        border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
      }
      .kn-doc-del:hover { background: rgba(255,107,97,0.13); color: var(--red); }

      /* ===== Wissen: Team-Ablage / Drive ===== */
      .knowledge-drive-scroll {
        padding: 20px 14px 14px;
        background: #eef4ff;
      }
      /* ISA-35: Wissen ohne abweichende Karten-Umrandung — bündig und rahmenlos
         wie Prompts/Skills/Projekte/Assistenten, die direkt auf dem Seiten-
         hintergrund sitzen. */
      .knowledge-drive-shell {
        min-height: calc(100dvh - 96px);
        background: transparent;
        color: #111;
        border: 0;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
      }

      /* ISA-109: Im Aufnahme-Modus bleibt die Seiten-Grundstruktur (Hero mit
         Breadcrumb/Titel/Subtitle + Tab-Bar) erhalten — so entsteht beim Reiter-
         wechsel KEIN Layout-Shift. Nur die dateibezogenen Steuerelemente und die
         Drive-Liste werden ausgeblendet; der Aufnahme-Assistent tritt an die Stelle
         des Inhalts (beginnt bündig dort, wo sonst der Section-Head/die Liste sitzt). */
      .knowledge-drive-shell.intake-mode .knowledge-drive-search,
      .knowledge-drive-shell.intake-mode .knowledge-new-wrap,
      .knowledge-drive-shell.intake-mode .kn-field,
      .knowledge-drive-shell.intake-mode .knowledge-dir-btn,
      .knowledge-drive-shell.intake-mode .knowledge-view-toggle,
      .knowledge-drive-shell.intake-mode .knowledge-drive-stats,
      .knowledge-drive-shell.intake-mode .knowledge-drive-section-head,
      .knowledge-drive-shell.intake-mode #rag-sources,
      .knowledge-drive-shell.intake-mode #kn-docs-empty { display: none !important; }
      .knowledge-intake {
        display: grid; gap: 18px; width: min(100%, 820px); margin: 6px auto 0;
      }
      /* ISA-99/103-Fix: das hidden-Attribut muss die display-Klasse schlagen,
         sonst blutet das Aufnahme-Panel in die normale Drive-Ansicht durch
         (gleiches Muster wie ISA-59). */
      .knowledge-intake[hidden] { display: none !important; }
      /* ISA-105: Wissensaufnahme als geführter Chat-Assistent (primärer Einstieg) */
      .intake-assistant {
        height: clamp(470px, calc(100dvh - 330px), 610px);
        min-height: 470px; overflow: hidden; display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
        border: 1px solid var(--bdr2); border-radius: 18px; background: var(--surf2);
        box-shadow: 0 18px 48px rgba(5, 10, 20, 0.16);
      }
      .intake-assistant-head {
        display: flex; gap: 11px; align-items: center;
        padding: 12px 16px; border-bottom: 1px solid var(--bdr2);
        background: color-mix(in srgb, var(--blue) 7%, var(--surf2));
      }
      .intake-assistant-avatar {
        flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px;
        display: grid; place-items: center; color: #fff; background: var(--blue-ui-bg);
        box-shadow: 0 7px 18px rgba(36, 87, 212, 0.24);
      }
      .intake-assistant-headtext h2 {
        font-family: var(--font-head); font-size: 15px; font-weight: 800;
        line-height: 1.25; margin: 0 0 2px; color: var(--txt1);
      }
      .intake-assistant-headtext p { margin: 0; color: var(--txt3); font-size: 11.5px; line-height: 1.35; }
      .intake-assistant-presence { color: #2ea066; font-weight: 700; }
      .intake-assistant-presence > span {
        display: inline-block; width: 6px; height: 6px; margin-right: 5px;
        border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(46,160,102,0.12);
      }

      .intake-assistant-feed {
        display: flex; flex-direction: column; gap: 12px; min-height: 0;
        padding: 18px 18px 22px; overflow-y: auto; overscroll-behavior: contain;
        background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 3%, transparent), transparent 40%);
        scrollbar-gutter: stable;
      }
      .intake-msg { display: flex; gap: 9px; align-items: flex-start; max-width: 80%; }
      .intake-msg-user { margin-left: auto; flex-direction: row-reverse; }
      .intake-msg-avatar {
        flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
        display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 13px;
      }
      .intake-msg-bubble {
        padding: 11px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.55;
        color: var(--txt2); background: var(--surf3, rgba(127,127,127,0.10)); border: 1px solid var(--bdr2);
      }
      .intake-msg-assistant .intake-msg-bubble { border-top-left-radius: 5px; }
      .intake-msg-user .intake-msg-bubble { background: var(--blue); color: #fff; border: 0; border-top-right-radius: 5px; }
      .intake-msg-bubble strong { color: inherit; font-weight: 700; }
      .intake-msg-doc { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }

      .intake-assistant-quick {
        display: flex; align-items: center; gap: 11px; min-width: 0;
        padding: 9px 14px 8px; border-top: 1px solid var(--bdr2);
        background: color-mix(in srgb, var(--surf3) 62%, var(--surf2));
      }
      .intake-assistant-quick-label {
        flex: 0 0 auto; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
        letter-spacing: .08em; text-transform: uppercase; color: var(--txt3);
      }
      .intake-assistant-quick-list {
        display: flex; gap: 7px; min-width: 0; overflow-x: auto; padding: 2px;
        scrollbar-width: none;
      }
      .intake-assistant-quick-list::-webkit-scrollbar { display: none; }
      .intake-quick-reply {
        flex: 0 0 auto; padding: 6px 11px; border-radius: 999px;
        border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--bdr2));
        background: var(--surf2); color: var(--txt2); font-size: 11.5px; font-weight: 650;
        white-space: nowrap; transition: border-color .15s ease, color .15s ease, background .15s ease;
      }
      .intake-quick-reply:hover {
        border-color: var(--blue); color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--surf2));
      }
      .intake-quick-reply:focus-visible {
        outline: 2px solid var(--accent-focus-ring); outline-offset: 2px;
      }

      .intake-assistant-composer {
        display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 8px;
        padding: 10px 12px 12px; background: var(--surf1, var(--surf2));
      }
      .intake-assistant-upload,
      .intake-assistant-send {
        width: 40px; height: 40px; display: grid; place-items: center;
        border-radius: 12px; color: var(--txt2); border: 1px solid var(--bdr2);
        background: var(--surf2); transition: border-color .15s ease, color .15s ease, transform .05s ease;
      }
      .intake-assistant-upload:hover { border-color: var(--blue); color: var(--blue); }
      .intake-assistant-send { color: #fff; border-color: transparent; background: var(--blue-ui-bg); }
      .intake-assistant-upload:active,
      .intake-assistant-send:active { transform: translateY(1px); }
      .intake-assistant-upload:focus-visible,
      .intake-assistant-send:focus-visible,
      .intake-assistant-input:focus-visible {
        outline: 2px solid var(--accent-focus-ring); outline-offset: 2px;
      }
      .intake-assistant-input {
        width: 100%; height: 40px; min-width: 0; padding: 0 13px;
        border: 1px solid var(--bdr2); border-radius: 12px; outline: none;
        color: var(--txt1); background: var(--surf2); font-size: 13px;
      }
      .intake-assistant-input::placeholder { color: var(--txt3); }

      @media (max-width: 560px) {
        .knowledge-intake { width: 100%; }
        .intake-assistant { height: min(580px, calc(100dvh - 250px)); min-height: 500px; border-radius: 15px; }
        .intake-assistant-head { padding: 11px 13px; }
        .intake-assistant-feed { padding: 15px 12px 18px; }
        .intake-msg { max-width: 92%; }
        .intake-assistant-quick { display: grid; gap: 5px; padding: 8px 10px 7px; }
        .intake-assistant-composer { padding: 9px 10px 10px; }
      }

      .intake-list { display: grid; gap: 12px; }

      .intake-card {
        border: 1px solid var(--bdr2); border-radius: 16px; background: var(--surf2);
        padding: 16px 18px; display: grid; gap: 12px;
      }
      .intake-tone-ok { border-color: rgba(46,160,102,0.5); }
      .intake-tone-warn { border-color: rgba(214,158,46,0.5); }
      .intake-tone-done { border-color: rgba(74,122,255,0.5); background: rgba(74,122,255,0.05); }
      .intake-card-main { display: flex; align-items: flex-start; gap: 13px; }
      .intake-card-icon {
        flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
        display: grid; place-items: center; color: var(--txt2);
        background: var(--surf3, rgba(127,127,127,0.10));
      }
      .intake-card-body { flex: 1 1 auto; min-width: 0; }
      .intake-card-title { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--txt1); }
      .intake-card-meta { font-size: 12px; color: var(--txt3); margin: 2px 0 8px; }
      .intake-card-status { flex: 0 0 auto; }

      .intake-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; }
      .intake-step { color: var(--txt3); }
      .intake-step.done { color: var(--txt2); }
      .intake-step.current { color: var(--blue); font-weight: 700; }
      .intake-step-sep { color: var(--bdr1); }

      .intake-pill {
        display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
        font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
        background: var(--surf3, rgba(127,127,127,0.12)); color: var(--txt2);
      }
      .intake-pill-busy { color: var(--blue); background: rgba(74,122,255,0.12); }
      .intake-pill-warn { color: #b8860b; background: rgba(214,158,46,0.16); }
      .intake-pill-ok { color: #1f8a52; background: rgba(46,160,102,0.16); }
      .intake-pill-done { color: var(--blue); background: rgba(74,122,255,0.16); }

      .intake-spinner {
        width: 12px; height: 12px; border-radius: 50%;
        border: 2px solid rgba(74,122,255,0.35); border-top-color: var(--blue);
        animation: intake-spin .8s linear infinite;
      }
      @keyframes intake-spin { to { transform: rotate(360deg); } }

      /* ISA-102: Prüf-Workspace (Original-Viewer + Bewertungspanel) */
      .intake-review {
        display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start;
      }
      .intake-review-doc {
        border: 1px solid var(--bdr2); border-radius: 14px; background: var(--surf2);
        max-height: 64vh; overflow-y: auto; padding: 4px;
      }
      .intake-review-doc .billing-pdf-viewer { padding: 8px; }
      .intake-review-text { padding: 18px 20px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: var(--txt2); }
      /* Gerenderter Markdown/Tabellen-Preview füllt den Review-Container ohne
         doppelten Rahmen/Scroll (der äußere .intake-review-doc scrollt bereits). */
      .intake-review-preview { border: 0; border-radius: 0; background: transparent; max-height: none; overflow: visible; }
      .intake-review-panel {
        border: 1px solid var(--bdr2); border-radius: 14px; background: var(--surf2);
        padding: 16px 18px; display: grid; gap: 13px; position: sticky; top: 0;
      }
      .intake-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
      .intake-review-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
      .intake-review-open { font-size: 12px; color: #b8860b; font-weight: 600; }
      .intake-review-fields { display: grid; gap: 10px; }
      .intake-review-summary { font-size: 12.5px; }
      .intake-review-summary > span { font-weight: 700; color: var(--txt3); text-transform: uppercase; letter-spacing: .03em; font-size: 11px; }
      .intake-review-summary p { margin: 4px 0 0; color: var(--txt2); line-height: 1.55; }
      .intake-review-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--txt3); }
      .intake-verdict-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
      .intake-verdict {
        font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 10px; cursor: pointer;
        border: 1px solid var(--bdr1); background: var(--surf1, var(--surf2)); color: var(--txt2);
      }
      .intake-verdict:hover { border-color: var(--blue); }
      .intake-verdict.selected.intake-verdict-ok { background: rgba(46,160,102,0.16); border-color: rgba(46,160,102,0.6); color: #1f8a52; }
      .intake-verdict.selected.intake-verdict-warn { background: rgba(214,158,46,0.16); border-color: rgba(214,158,46,0.6); color: #b8860b; }
      .intake-verdict.selected.intake-verdict-muted { background: var(--surf3, rgba(127,127,127,0.14)); border-color: var(--bdr1); color: var(--txt1); }
      .intake-review-actions { border-top: 1px solid var(--bdr2); padding-top: 12px; }
      .intake-review-actions .btn-primary { width: 100%; }
      @media (max-width: 760px) {
        .intake-review { grid-template-columns: 1fr; }
        .intake-review-panel { position: static; }
      }

      /* ISA-101: KI-Rückfragen (geführtes Gespräch) */
      .intake-questions {
        border-top: 1px solid var(--bdr2); padding-top: 13px; display: grid; gap: 12px;
        background: rgba(74,122,255,0.04); margin: 0 -18px; padding: 14px 18px;
      }
      .intake-questions-head {
        display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; color: var(--txt1);
      }
      .intake-assistant-badge {
        display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
        background: var(--blue); color: #fff; font-size: 12px;
      }
      .intake-question { display: grid; gap: 7px; }
      .intake-question-text { font-size: 13.5px; color: var(--txt2); line-height: 1.5; }
      .intake-question-answers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
      .intake-answer-chip {
        font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px; cursor: pointer;
        border: 1px solid var(--bdr1); background: var(--surf1, var(--surf2)); color: var(--txt2);
        transition: all .12s ease;
      }
      .intake-answer-chip:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
      .intake-answer-chip.selected { background: var(--blue); border-color: var(--blue); color: #fff; }
      /* ISA-116: beantwortete Chat-Fragen sperren ihre Chips; die gewählte Antwort
         bleibt markiert. */
      .intake-answer-chip:disabled { cursor: default; opacity: .55; }
      .intake-answer-chip.selected:disabled { opacity: 1; }
      /* ISA-116: Karte zeigt nur noch die sekundäre Rückfragen-Zusammenfassung. */
      .intake-questions-summary {
        display: flex; align-items: center; gap: 8px;
        font-size: 13px; color: var(--txt2);
      }
      /* ISA-116: Frage-Bubbles im Assistenten-Chat */
      .intake-msg-question .intake-msg-bubble { display: grid; gap: 8px; max-width: 100%; }
      .intake-chat-question-doc {
        font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--txt3);
      }
      .intake-answer-skip {
        font-size: 12px; color: var(--txt3); background: none; border: 0; cursor: pointer; text-decoration: underline;
      }
      .intake-answer-skip:hover { color: var(--txt1); }
      .intake-answer-required { font-size: 11px; color: var(--txt3); font-style: italic; }
      .intake-answer-state { font-size: 12px; font-weight: 600; color: #1f8a52; }
      .intake-answer-state.muted { color: var(--txt3); font-weight: 400; }

      /* ISA-100: editierbarer Analyse-Block */
      .intake-analysis {
        border-top: 1px solid var(--bdr2); padding-top: 13px; display: grid; gap: 11px;
      }
      .intake-analysis-head { display: flex; align-items: center; gap: 10px; }
      .intake-analysis-title { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--txt3); }
      .intake-conf {
        font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
      }
      .intake-conf-ok { color: #1f8a52; background: rgba(46,160,102,0.14); }
      .intake-conf-warn { color: #b8860b; background: rgba(214,158,46,0.16); }
      .intake-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
      .intake-field { display: grid; gap: 4px; font-size: 12px; color: var(--txt3); }
      .intake-field-wide { display: grid; }
      .intake-field > span { font-weight: 600; }
      .intake-field-input {
        width: 100%; box-sizing: border-box; font-size: 13px; color: var(--txt1);
        background: var(--surf1, var(--surf2)); border: 1px solid var(--bdr1);
        border-radius: 10px; padding: 8px 10px; font-family: inherit;
      }
      .intake-field-input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,122,255,0.16); }
      .intake-summary { resize: vertical; min-height: 44px; line-height: 1.5; }
      .intake-field-open .intake-field-input { border-color: rgba(214,158,46,0.7); background: rgba(214,158,46,0.06); }
      .intake-sensitivity { font-size: 12.5px; color: #b8860b; font-weight: 600; }

      .intake-card-foot {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        flex-wrap: wrap; border-top: 1px solid var(--bdr2); padding-top: 11px;
      }
      .intake-card-hint { font-size: 12.5px; color: var(--txt3); }
      .intake-card-actions { display: flex; align-items: center; gap: 8px; }
      .intake-card-actions .btn-primary, .intake-card-actions .btn-secondary { padding: 7px 14px; font-size: 13px; }
      .intake-approved-badge { font-size: 12.5px; font-weight: 650; color: #1f8a52; }
      .intake-remove {
        background: none; border: 0; color: var(--txt3); font-size: 12.5px; cursor: pointer;
        padding: 4px 6px; border-radius: 8px;
      }
      .intake-remove:hover { color: var(--txt1); background: var(--surf3, rgba(127,127,127,0.10)); }
      .knowledge-drive-hero {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 22px;
        /* Kopfhoehe wie bei den anderen Unterkategorien (Assistenten/Projekte):
           dort sitzt der Kicker ~38px unter der Oberkante, nicht 55px. */
        padding: 20px 40px 22px;
      }
      .knowledge-drive-breadcrumb {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 18px;
        color: var(--txt3);
        font-size: 11px;
        font-weight: 500;
        line-height: 1.48;
      }
      .knowledge-drive-breadcrumb svg {
        width: 15px;
        height: 15px;
        flex: 0 0 15px;
        color: currentColor;
      }
      .knowledge-drive-breadcrumb-logo {
        width: 16px;
        height: 16px;
        flex: 0 0 16px;
        display: inline-block;
        background: currentColor;
        -webkit-mask: url("mind_head_cutout.png") center / contain no-repeat;
        mask: url("mind_head_cutout.png") center / contain no-repeat;
      }
      /* ISA: Kicker "Wissen /" wie bei Assistenten/Projekte grau (statt schwarz). */
      .knowledge-drive-breadcrumb strong {
        color: var(--txt3);
        font-weight: 500;
      }
      .knowledge-drive-hero h2 {
        margin: 0;
        color: #050505;
        font-size: 32px;
        line-height: 1.08;
        font-weight: 780;
        letter-spacing: 0;
      }
      .knowledge-drive-hero p {
        margin: 10px 0 0;
        color: #6b7280;
        font-size: 15px;
        line-height: 1.35;
      }
      .knowledge-drive-stats {
        display: flex;
        align-items: center;
        gap: 14px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }
      .knowledge-drive-stats span {
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        padding: 0 13px;
        border: 1px solid #dfe7f5;
        border-radius: 12px;
        background: #fff;
        color: #6b7280;
        font-size: 14px;
        font-weight: 520;
        white-space: nowrap;
      }
      .knowledge-drive-stats svg { color: #6b7280; }
      .knowledge-drive-stats strong { font-weight: 520; }
      .knowledge-drive-toolbar {
        margin: 0 40px 30px;
        min-height: 78px;
        display: grid;
        grid-template-columns: minmax(150px, 194px) minmax(220px, 1fr) minmax(150px, 190px) 46px minmax(134px, 168px) 120px;
        gap: 10px;
        align-items: center;
        padding: 16px;
        border: 1px solid #dfe7f5;
        border-radius: 12px;
        background: #fff;
      }
      .knowledge-new-wrap,
      .kn-field { position: relative; }
      /* ISA-35: Read-only Bereiche (Mit mir geteilt / Wissensspeicher) zeigen
         keinen "Neu"-Button. Ohne ihn fehlt im Grid die erste Spalte — daher
         als flexibles Layout, das über alle Breiten sauber umbricht. */
      .knowledge-drive-toolbar.kn-readonly {
        display: flex;
        flex-wrap: wrap;
      }
      .knowledge-drive-toolbar.kn-readonly > * { flex: 0 0 auto; }
      .knowledge-drive-toolbar.kn-readonly .kn-scope-tabs { flex-basis: 100%; }
      .knowledge-drive-toolbar.kn-readonly .knowledge-new-wrap { display: none; }
      .knowledge-drive-toolbar.kn-readonly .knowledge-drive-search {
        flex: 1 1 240px;
        min-width: 200px;
      }
      .knowledge-drive-toolbar.kn-readonly .knowledge-view-toggle { margin-left: auto; }
      .knowledge-new-btn,
      .knowledge-control-btn,
      .knowledge-upload-cta {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        border: 1px solid #dfe7f5;
        border-radius: 14px;
        background: #fff;
        color: #1f1f1f;
        font: inherit;
        font-size: 14px;
        font-weight: 560;
        letter-spacing: 0;
        cursor: pointer;
      }
      .knowledge-new-btn {
        /* ISA-35: Button füllt seine Grid-Spalte statt fixer 194px — sonst läuft
           er bei schmaleren Spalten (≤1180px) über und überlappt die Suchleiste. */
        width: 100%;
        background: var(--blue-ui-bg);
        border-color: var(--blue-ui-border);
        color: #fff;
        box-shadow: var(--blue-ui-shadow);
      }
      .knowledge-new-btn:hover,
      .knowledge-upload-cta:hover { background: var(--blue-ui-bg-hover); }
      .knowledge-control-btn {
        width: 100%;
        padding: 0 13px;
        white-space: nowrap;
      }
      .knowledge-control-btn span { white-space: nowrap; }
      .knowledge-control-btn:hover {
        border-color: color-mix(in srgb, var(--aqua) 28%, #cfd9ec);
        background: var(--accent-soft-bg);
      }
      .knowledge-drive-search {
        min-width: 0;
        min-height: 38px;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 0 20px;
        border: 1px solid #dfe7f5;
        border-radius: 12px;
        color: #6b7280;
        background: #fff;
      }
      .knowledge-drive-search input {
        width: 100%;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: #202020;
        font: inherit;
        font-size: 14px;
      }
      .knowledge-drive-search input::placeholder { color: #6b7280; }
      .knowledge-dir-btn { width: 46px; padding: 0; }
      .knowledge-dir-btn.desc svg { transform: rotate(180deg); }
      .knowledge-view-toggle {
        min-height: 42px;
        width: max-content;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 3px;
        padding: 3px;
        border: 1px solid #dfe7f5;
        border-radius: 14px;
        background: #fff;
      }
      .knowledge-view-toggle button {
        width: 38px;
        height: 36px;
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #6b7280;
        cursor: pointer;
        transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
      }
      .knowledge-view-toggle button svg {
        width: 20px;
        height: 20px;
      }
      .knowledge-view-toggle button.active {
        background: var(--accent-soft-bg);
        color: var(--blue);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 8%, transparent);
      }
      .knowledge-view-toggle button:focus-visible {
        outline: 2px solid var(--accent-focus-ring);
        outline-offset: 2px;
      }
      .knowledge-new-menu,
      .knowledge-sort-menu,
      .knowledge-page-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 60;
        min-width: 238px;
        padding: 10px;
        border: 1px solid #dfe7f5;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
      }
      .knowledge-new-menu { left: 0; right: auto; }
      .knowledge-new-menu button,
      .knowledge-drive-shell .kn-menu-item {
        min-height: 44px;
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 10px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #222;
        text-align: left;
        font: inherit;
        font-size: 13.5px;
        cursor: pointer;
      }
      .knowledge-new-menu button:hover,
      .knowledge-drive-shell .kn-menu-item:hover { background: #f7faff; }
      .knowledge-drive-shell .kn-menu-item.active { color: #111; }
      .knowledge-drive-shell .kn-menu-item .kn-check {
        width: 22px;
        height: 22px;
        color: #111;
      }
      .knowledge-drive-section-head {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 18px;
        margin: 0 40px;
        padding-bottom: 24px;
        border-bottom: 1px solid #dfe7f5;
      }
      .knowledge-folder-head-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 14px;
      }
      .knowledge-folder-title {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        color: #151515;
        font-size: 15px;
        font-weight: 760;
      }
      .knowledge-folder-back {
        min-height: 34px;
        margin: 0;
        padding: 0 12px 0 10px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        border: 1px solid #dfe7f5;
        border-radius: 10px;
        background: #fff;
        color: #64748b;
        font: inherit;
        font-size: 13.5px;
        font-weight: 650;
        cursor: pointer;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
      }
      .knowledge-folder-back[hidden] { display: none; }
      .knowledge-folder-back:hover,
      .knowledge-folder-back:focus-visible {
        border-color: color-mix(in srgb, var(--aqua) 28%, transparent);
        background: var(--accent-soft-bg);
        color: var(--blue);
      }
      .knowledge-drive-section-head p {
        margin: 10px 0 0;
        color: #6b7280;
        font-size: 15px;
      }
      .knowledge-drive-section-head > span {
        color: #6b7280;
        font-size: 15px;
        white-space: nowrap;
      }
      .knowledge-drive-table {
        margin: 28px 40px 40px;
        display: grid;
        gap: 10px;
      }
      .knowledge-drive-table.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
      }
      .knowledge-drive-item {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) minmax(360px, auto) auto;
        align-items: center;
        gap: 16px;
        min-height: 52px;
        padding: 14px 16px;
        border: 1px solid #dfe7f5;
        border-radius: 14px;
        background: #fff;
      }
      .knowledge-drive-item:hover {
        border-color: color-mix(in srgb, var(--aqua) 28%, #dfe7f5);
        background: var(--accent-soft-bg);
      }
      .knowledge-folder-item {
        width: 100%;
        text-align: left;
        cursor: pointer;
        font: inherit;
      }
      .knowledge-folder-item .knowledge-file-title {
        color: color-mix(in srgb, var(--blue) 58%, #0f172a);
      }
      .knowledge-folder-icon {
        color: var(--blue);
        background: var(--accent-soft-bg);
      }
      /* ISA-35: "Öffnen" als gefüllter IsarMind-Blau-Button (statt weiß),
         konsistent mit dem primären "Neu"/"Verwenden"-Button. */
      .knowledge-open-folder {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        padding: 0 14px;
        border: 1px solid var(--blue-ui-border);
        border-radius: 10px;
        background: var(--blue-ui-bg);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        box-shadow: var(--blue-ui-shadow);
      }
      .knowledge-folder-item:hover .knowledge-open-folder {
        background: var(--blue-ui-bg-hover);
      }
      .knowledge-drive-table.grid-view .knowledge-drive-item {
        grid-template-columns: 1fr;
        align-items: start;
        min-height: 210px;
      }
      .knowledge-file-icon {
        width: 48px;
        height: 48px;
        display: grid;
        place-items: center;
        border: 1px solid #dfe7f5;
        border-radius: 14px;
        color: #6b7280;
        background: #f7faff;
      }
      .knowledge-file-main { min-width: 0; }
      .knowledge-file-title {
        display: flex;
        align-items: center;
        min-width: 0;
        gap: 8px;
        color: #161616;
        font-size: 13.5px;
        font-weight: 740;
      }
      .knowledge-file-title > span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .knowledge-file-sub {
        margin-top: 5px;
        color: #6b7280;
        font-size: 14px;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .knowledge-file-meta {
        display: grid;
        grid-template-columns: 120px 120px 90px 54px;
        gap: 12px;
        align-items: center;
        color: #6b7280;
        font-size: 14px;
        white-space: nowrap;
      }
      .knowledge-drive-table.grid-view .knowledge-file-meta {
        grid-template-columns: 1fr 1fr;
        white-space: normal;
      }
      .knowledge-file-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
      }
      .knowledge-file-ask {
        min-height: 36px;
        padding: 0 12px;
        border: 1px solid #dfe7f5;
        border-radius: 10px;
        background: #fff;
        color: #222;
        font: inherit;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
      }
      .knowledge-file-ask:hover { background: #f7faff; }
      /* display:grid wuerde das hidden-Attribut uebersteuern — der leere
         Zustand stand sonst sichtbar UNTER der gefuellten Dokumentliste. */
      .knowledge-drive-empty[hidden] {
        display: none !important;
      }
      .knowledge-drive-empty {
        min-height: 610px;
        margin: 28px 40px 40px;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 22px;
        border: 1px dashed #dfe7f5;
        border-radius: 16px;
        background: #fff;
        text-align: center;
      }
      .knowledge-empty-icon {
        width: 76px;
        height: 52px;
        display: grid;
        place-items: center;
        border-radius: 18px;
        color: #6b7280;
        background: #fff;
      }
      .knowledge-drive-empty h3 {
        margin: 0;
        color: #111;
        font-size: 14px;
        font-weight: 760;
      }
      .knowledge-drive-empty p {
        max-width: 640px;
        margin: 0;
        color: #6b7280;
        font-size: 15px;
        line-height: 1.55;
      }
      .knowledge-upload-cta {
        min-height: 46px;
        padding: 0 28px;
        background: var(--blue-ui-bg);
        border-color: var(--blue-ui-border);
        color: #fff;
      }
      /* ISA-59: hidden-Attribut (Rechte-Logik, z. B. "Mit mir geteilt") muss die
         display-Regel der Klasse schlagen — sonst bleibt die Upload-CTA sichtbar. */
      .knowledge-upload-cta[hidden] { display: none; }
      .knowledge-upload-status {
        margin: 0 40px 36px;
      }
      .knowledge-rag-hidden { display: none; }
      body:not(.light) .knowledge-drive-scroll {
        background:
          radial-gradient(circle at 18% 0%, rgba(36,87,212,0.18), transparent 34%),
          linear-gradient(180deg, #081120 0%, var(--bg) 52%, #060912 100%);
      }
      body:not(.light) .knowledge-drive-shell {
        background: transparent;
        color: var(--txt);
        border: 0;
        box-shadow: none;
      }
      body:not(.light) .knowledge-drive-hero h2,
      body:not(.light) .knowledge-folder-title,
      body:not(.light) .knowledge-drive-empty h3,
      body:not(.light) .knowledge-file-title {
        color: var(--txt);
      }
      body:not(.light) .knowledge-drive-breadcrumb {
        color: var(--txt3);
      }
      body:not(.light) .knowledge-drive-hero p,
      body:not(.light) .knowledge-drive-section-head p,
      body:not(.light) .knowledge-drive-section-head > span,
      body:not(.light) .knowledge-drive-empty p,
      body:not(.light) .knowledge-file-sub,
      body:not(.light) .knowledge-file-meta {
        color: var(--txt3);
      }
      body:not(.light) .knowledge-drive-stats span,
      body:not(.light) .knowledge-control-btn,
      body:not(.light) .knowledge-folder-back,
      body:not(.light) .knowledge-drive-search,
      body:not(.light) .knowledge-view-toggle,
      body:not(.light) .knowledge-drive-item,
      body:not(.light) .knowledge-drive-empty {
        background: rgba(17,23,34,0.82);
        border-color: var(--bdr2);
        color: var(--txt2);
      }
      body:not(.light) .knowledge-drive-stats svg,
      body:not(.light) .knowledge-drive-search,
      body:not(.light) .knowledge-view-toggle button {
        color: var(--txt3);
      }
      body:not(.light) .knowledge-drive-toolbar {
        background: rgba(13,17,24,0.72);
        border-color: var(--bdr2);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
      }
      body:not(.light) .knowledge-control-btn:hover,
      body:not(.light) .knowledge-folder-back:hover,
      body:not(.light) .knowledge-folder-back:focus-visible,
      body:not(.light) .knowledge-drive-item:hover,
      body:not(.light) .knowledge-file-ask:hover {
        background: var(--accent-soft-bg);
        border-color: color-mix(in srgb, var(--aqua) 42%, transparent);
        color: var(--txt);
      }
      body:not(.light) .knowledge-drive-search input {
        color: var(--txt);
      }
      body:not(.light) .knowledge-drive-search input::placeholder {
        color: var(--txt3);
      }
      body:not(.light) .knowledge-view-toggle button.active {
        background: var(--accent-soft-bg-strong);
        color: var(--blue);
      }
      body:not(.light) .knowledge-new-menu,
      body:not(.light) .knowledge-sort-menu,
      body:not(.light) .knowledge-page-menu {
        background: var(--surf);
        border-color: var(--bdr2);
        box-shadow: 0 18px 48px rgba(0,0,0,0.38);
      }
      body:not(.light) .knowledge-new-menu button,
      body:not(.light) .knowledge-drive-shell .kn-menu-item {
        color: var(--txt2);
      }
      body:not(.light) .knowledge-new-menu button:hover,
      body:not(.light) .knowledge-drive-shell .kn-menu-item:hover {
        background: var(--surf2);
        color: var(--txt);
      }
      body:not(.light) .knowledge-drive-shell .kn-menu-item.active,
      body:not(.light) .knowledge-drive-shell .kn-menu-item .kn-check {
        color: var(--blue);
      }
      body:not(.light) .knowledge-drive-section-head {
        border-bottom-color: var(--bdr2);
      }
      body:not(.light) .knowledge-file-icon,
      body:not(.light) .knowledge-empty-icon {
        background: rgba(36,87,212,0.16);
        border-color: rgba(74,122,255,0.30);
        color: var(--blue);
      }
      body:not(.light) .knowledge-file-ask {
        background: rgba(17,23,34,0.84);
        border-color: var(--bdr2);
        color: var(--txt2);
      }
      @media (max-width: 1500px) {
        .knowledge-drive-toolbar {
          grid-template-columns: minmax(150px, 194px) minmax(220px, 1fr) minmax(150px, 190px) minmax(134px, 168px) 120px;
        }
        .knowledge-dir-btn { display: none; }
      }
      @media (max-width: 1180px) {
        .knowledge-drive-toolbar {
          grid-template-columns: minmax(150px, 180px) minmax(220px, 1fr) minmax(150px, 190px);
        }
        .knowledge-drive-item {
          grid-template-columns: 48px minmax(0, 1fr) auto;
        }
        .knowledge-file-meta {
          grid-column: 2 / -1;
          grid-row: 2;
          grid-template-columns: repeat(4, max-content);
        }
      }
      @media (max-width: 900px) {
        .knowledge-drive-scroll { padding: 0; }
        .knowledge-drive-shell {
          min-height: 100dvh;
          border-radius: 0;
          border-left: 0;
          border-right: 0;
        }
        .knowledge-drive-hero,
        .knowledge-drive-section-head {
          padding-left: 18px;
          padding-right: 18px;
        }
        .knowledge-drive-hero {
          padding-top: 22px;
          padding-bottom: 18px;
          align-items: start;
          flex-direction: column;
          gap: 16px;
        }
        .knowledge-drive-hero h2 { font-size: 23px; }
        .knowledge-drive-breadcrumb {
          margin-bottom: 16px;
        }
        .knowledge-drive-hero p,
        .knowledge-drive-section-head p,
        .knowledge-drive-empty p { font-size: 15px; }
        .knowledge-drive-hero p { margin-top: 10px; }
        .knowledge-drive-stats {
          width: 100%;
          justify-content: stretch;
          gap: 10px;
        }
        .knowledge-drive-stats span {
          flex: 1 1 150px;
          min-height: 42px;
          justify-content: center;
          border-radius: 12px;
          font-size: 15px;
          padding: 0 12px;
        }
        .knowledge-drive-toolbar {
          margin: 0 18px 20px;
          grid-template-columns: 1fr;
          min-height: 0;
          gap: 10px;
          padding: 12px;
        }
        .knowledge-new-btn { width: 100%; }
        .knowledge-new-btn,
        .knowledge-control-btn,
        .knowledge-drive-search {
          min-height: 48px;
          border-radius: 12px;
          font-size: 16px;
        }
        .knowledge-drive-search input {
          font-size: 16px;
        }
        .knowledge-view-toggle {
          min-height: 44px;
          justify-self: end;
          padding: 3px;
          border-radius: 14px;
        }
        .knowledge-view-toggle button {
          width: 38px;
          height: 36px;
          border-radius: 10px;
        }
        .knowledge-drive-section-head { margin: 0 18px; }
        .knowledge-folder-title {
          font-size: 15px;
        }
        .knowledge-drive-section-head > span {
          font-size: 16px;
        }
        .knowledge-drive-table,
        .knowledge-drive-empty {
          margin-left: 18px;
          margin-right: 18px;
        }
        .knowledge-drive-table {
          margin-top: 18px;
        }
        .knowledge-drive-empty {
          min-height: 380px;
          gap: 14px;
        }
        .knowledge-drive-empty h3 {
          font-size: 15px;
        }
        .knowledge-upload-cta {
          min-height: 50px;
          padding: 0 18px;
          font-size: 16px;
        }
        .knowledge-drive-item {
          grid-template-columns: 44px minmax(0, 1fr);
          min-height: 46px;
          padding: 12px;
          gap: 12px;
          border-radius: 12px;
        }
        .knowledge-file-icon {
          width: 40px;
          height: 40px;
          border-radius: 12px;
        }
        .knowledge-file-title {
          font-size: 15.5px;
        }
        .knowledge-file-sub,
        .knowledge-file-meta,
        .knowledge-file-ask {
          font-size: 12.5px;
        }
        .knowledge-file-actions,
        .knowledge-file-meta {
          grid-column: 1 / -1;
        }
        .knowledge-file-meta {
          grid-template-columns: repeat(2, minmax(0, max-content));
        }
      }
      @media (min-width: 521px) and (max-width: 900px) {
        .knowledge-drive-toolbar {
          grid-template-columns: minmax(150px, 170px) minmax(0, 1fr) 112px;
        }
        .knowledge-new-wrap {
          grid-column: 1;
        }
        .knowledge-drive-search {
          grid-column: 2 / 4;
        }
        .knowledge-drive-toolbar > .kn-field:nth-of-type(1) {
          grid-column: 1;
        }
        .knowledge-drive-toolbar > .kn-field:nth-of-type(2) {
          grid-column: 2;
        }
        .knowledge-view-toggle {
          grid-column: 3;
          justify-self: end;
          width: max-content;
        }
        .knowledge-drive-item {
          grid-template-columns: 40px minmax(0, 1fr) auto;
        }
        .knowledge-file-actions {
          grid-column: 3;
          grid-row: 1;
        }
        .knowledge-file-meta {
          grid-column: 2 / -1;
          grid-row: 2;
          grid-template-columns: repeat(4, max-content);
          gap: 10px;
        }
      }
      @media (max-width: 520px) {
        .knowledge-drive-toolbar {
          grid-template-columns: 1fr;
        }
        .knowledge-new-wrap,
        .knowledge-drive-search,
        .knowledge-drive-toolbar > .kn-field,
        .knowledge-view-toggle {
          grid-column: auto;
        }
      .knowledge-view-toggle {
          width: max-content;
          justify-self: end;
        }
      }

      /* ===== Fixes: blauer Hintergrund-Fade nur fuer den neuen Chat + Projekte-Untertitel größer ===== */
      body.light #view-chat {
        background: linear-gradient(180deg, #d8e6ff 0%, #ebf2ff 34%, #f3f7ff 100%);
      }
      body.light .view:not(#view-chat) .page-scroll {
        background: #fff;
      }
      body.light::before {
        background: linear-gradient(180deg, #d3e2ff 0%, #e9f1ff 48%, #f3f7ff 100%);
      }
      .project-overview-sub { font-size: 15px; font-weight: 400; line-height: 1.55; }

      /* ===== Wissen + Agenten: Optik an Bibliothek (Prompts/Skills) angleichen =====
         Buttons & Schrift auf die finale, leichte Bibliotheks-Skala bringen.
         Bewusst am Dateiende: gewinnt per Quell-Reihenfolge über die aelteren
         knowledge-drive-/agents-Deklarationen. */

      /* Wissen - Schrift: spiegelt .library-page-title / -sub / -section-title */
      .knowledge-drive-hero h2 {
        font-family: var(--font-head);
        font-size: 30px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: 0;
      }
      .knowledge-drive-hero p {
        font-size: 14px;
        font-weight: 400;
        line-height: 1.55;
        color: var(--txt2);
      }
      .knowledge-folder-title,
      .knowledge-drive-empty h3 {
        font-family: var(--font-head);
        font-size: 18px;
        font-weight: 500;
        letter-spacing: 0;
      }
      body:not(.light) .knowledge-drive-hero p { color: var(--txt2); }
      .knowledge-drive-section-head p,
      .knowledge-drive-section-head > span,
      .knowledge-drive-empty p {
        font-size: 14px;
        font-weight: 400;
      }
      /* Wissen - Primaer-Buttons: spiegelt .pg-action-btn / .btn-primary (final) */
      .knowledge-new-btn,
      .knowledge-upload-cta {
        background: var(--blue-ui-bg);
        border-color: transparent;
        box-shadow: var(--blue-ui-shadow);
        border-radius: var(--radius-md);
        gap: 8px;
        font-size: 12px;
        font-weight: 460;
      }
      .knowledge-new-btn:hover,
      .knowledge-upload-cta:hover { background: var(--blue-ui-bg-hover); }

      /* Wissen - Toolbar-Controls: spiegelt .library-search / -select / -view-toggle */
      .knowledge-control-btn,
      .knowledge-drive-search {
        min-height: 40px;
        border-radius: 14px;
        font-size: 13px;
        font-weight: 460;
      }
      .knowledge-drive-search input { font-size: 13px; }
      .knowledge-search-status,
      .knowledge-search-summary {
        grid-column: 1 / -1;
        width: 100%;
        padding: 11px 14px;
        border: 1px solid var(--bdr);
        border-radius: 12px;
        background: var(--surf);
        color: var(--txt2);
        font-size: 12.5px;
      }
      .knowledge-search-status { display: flex; align-items: center; gap: 9px; }
      .knowledge-search-status.error {
        border-color: rgba(245, 101, 101, .4);
        background: rgba(245, 101, 101, .09);
        color: var(--danger, #f56565);
      }
      .knowledge-search-spinner {
        width: 14px;
        height: 14px;
        border: 2px solid var(--bdr);
        border-top-color: var(--blue);
        border-radius: 50%;
        animation: kn-search-spin .75s linear infinite;
      }
      @keyframes kn-search-spin { to { transform: rotate(360deg); } }
      .knowledge-search-match {
        display: inline-flex;
        margin-right: 7px;
        padding: 2px 6px;
        border-radius: 999px;
        background: rgba(74,122,255,.12);
        color: var(--blue-l);
        font-size: 10.5px;
        font-weight: 700;
        white-space: nowrap;
      }
      .knowledge-view-toggle { width: max-content; border-radius: 14px; justify-content: flex-start; gap: 3px; }
      .knowledge-view-toggle button { width: 38px; height: 36px; border-radius: 10px; }

      /* Agenten-Ansicht nutzt bewusst KEINE eigenen Header-/Leisten-Overrides:
         Kicker, Titel, Sub und die Leiste (Tabs/Suche/Toggle) rendern ueber die
         geteilten Projekt-/Agenten-Basis-Klassen exakt wie die Projekte-Ansicht
         -> einheitliche Schriftgroessen (am Dateiende auf die Prompts/Bibliothek-
            Skala gebracht: Kicker 11px/500, Titel 30px/500, Sub 14px). */

      /* ===== ISA-15: Sidebar-Footer / Kontingent / Profil ===== */
      /* Kontingent lesbarer (hoeherer Kontrast in BEIDEN Themes; 3 Klassen schlagen body.light .usage-meta) */
      .sb-footer .usage-meta { font-size: 11px; letter-spacing: 0.2px; }
      body.light .sb-footer .usage-meta { color: var(--txt2); }
      body:not(.light) .sb-footer .usage-meta { color: var(--txt2); }
      /* Profilzeile als Ganzes klickbar -> Account/Einstellungen */
      .sb-user-row { cursor: pointer; }
      .sb-user-row:hover { background: rgba(74, 122, 255, 0.10); }
      .sb-user-row:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

      .sb-util-item[onclick*="settings"] > svg:first-child,
      .sb-settings-btn > svg,
      .sb-mobile-settings .square-icon-btn[onclick*="settings"] > svg {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        color: currentColor;
        opacity: 1;
        fill: none;
        stroke: currentColor !important;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      .sb-settings-btn,
      .sb-mobile-settings .square-icon-btn[onclick*="settings"] {
        color: var(--txt2);
      }
      .sb-settings-btn:hover,
      .sb-settings-btn:focus-visible,
      .sb-mobile-settings .square-icon-btn[onclick*="settings"]:hover,
      .sb-mobile-settings .square-icon-btn[onclick*="settings"]:focus-visible {
        color: var(--blue);
      }
      body:not(.light) .sb-settings-btn,
      body:not(.light) .sb-mobile-settings .square-icon-btn[onclick*="settings"] {
        color: rgba(255,255,255,0.78);
      }
      body:not(.light) .sb-settings-btn:hover,
      body:not(.light) .sb-settings-btn:focus-visible,
      body:not(.light) .sb-mobile-settings .square-icon-btn[onclick*="settings"]:hover,
      body:not(.light) .sb-mobile-settings .square-icon-btn[onclick*="settings"]:focus-visible {
        color: #dfe8ff;
      }

      .sb-history-item.assistant-thread:hover,
      .sb-history-item.assistant-thread.active {
        background: color-mix(in srgb, var(--assistant-thread-color) 14%, transparent);
        border-color: color-mix(in srgb, var(--assistant-thread-color) 32%, transparent);
        color: var(--txt);
      }
      body.light .sb-history-item.assistant-thread:hover,
      body.light .sb-history-item.assistant-thread.active {
        background: color-mix(in srgb, var(--assistant-thread-color) 11%, transparent);
        border-color: color-mix(in srgb, var(--assistant-thread-color) 28%, transparent);
        color: var(--text);
      }

      .sb-history-item.assistant-thread {
        grid-template-columns: 24px minmax(0, 1fr);
        gap: 9px;
        padding-left: 10px;
      }
      .sb-history-item.assistant-thread::before {
        content: none;
        display: none;
      }
      .sb-history-item.assistant-thread .assistant-robot-icon {
        width: 20px;
        height: 20px;
        box-sizing: border-box;
        padding: 3px;
        border: 1px solid color-mix(in srgb, var(--assistant-thread-color) 34%, transparent);
        border-radius: 8px;
        color: var(--assistant-thread-color);
        background: color-mix(in srgb, var(--assistant-thread-color) 13%, transparent);
        filter: none;
      }
      body.light .sb-history-item.assistant-thread .assistant-robot-icon {
        border-color: color-mix(in srgb, var(--assistant-thread-color) 28%, #dbe6ff);
        background: color-mix(in srgb, var(--assistant-thread-color) 10%, #fff);
      }
      .sb-history-item.assistant-thread:hover .assistant-robot-icon,
      .sb-history-item.assistant-thread.active .assistant-robot-icon {
        border-color: color-mix(in srgb, var(--assistant-thread-color) 48%, transparent);
        background: color-mix(in srgb, var(--assistant-thread-color) 18%, transparent);
      }
      body.light .sb-history-item.assistant-thread:hover .assistant-robot-icon,
      body.light .sb-history-item.assistant-thread.active .assistant-robot-icon {
        border-color: color-mix(in srgb, var(--assistant-thread-color) 42%, #c8d8ff);
        background: color-mix(in srgb, var(--assistant-thread-color) 14%, #fff);
      }

      /* ===== ISA-13: Ehrlicher Empty/Error-State fuer Assistenten ohne Backend ===== */
      .assistant-unavailable { border: 1px solid var(--bdr2); border-radius: var(--radius-md); padding: 14px 16px; background: var(--surf2); color: var(--txt2); }
      .assistant-unavailable .msg-h { color: var(--txt); }

      /* ===== Header-Skala vereinheitlichen: Projekte + Agenten auf die
         Prompts/Bibliothek-Werte bringen. Titel ist bereits identisch (30px/500);
         Kicker und Sub waren groesser/fetter und werden hier angeglichen. ===== */
      .project-overview-shell {
        width: min(100%, 1180px);
        gap: 22px;
      }
      .project-overview-head {
        gap: 18px;
      }
      .project-overview-toolbar {
        gap: 10px;
      }
      .project-overview-kicker {
        margin-bottom: 18px;
        font-size: 11px;
        font-weight: 500;
        color: var(--txt3); /* ISA-55: gleiche Oberkategorie-Farbe wie .library-kicker */
      }
      .project-overview-sub { font-size: 14px; }                       /* = .library-page-sub (14px) */

      /* ===== Inbox (Benachrichtigungs-Center) im isarmind-CI =====
         Reuse: .library-page-head/-title/-sub, .btn-secondary,
         .project-filter-tabs/-tab (blaue statt teal Tabs), .library-section-head/-count,
         .library-empty-state (Empty-State). Eigen: Topbar-Kicker + Body-Layout. */
      .inbox-body {
        width: 100%;
        max-width: 1180px;
        margin: 0 auto;
        padding: 34px 40px 56px;
        display: grid;
        gap: 22px;
      }
      /* Topbar-Kicker, ueber CI-Tokens themed (Light + Dark; Klassen existierten nicht). */
      .inbox-topbar {
        height: 56px;
        display: flex;
        align-items: center;
        gap: 18px;
        padding: 0 40px;
        border-bottom: 1px solid var(--bdr2);
        background: var(--surf);
      }
      .inbox-chrome-btn {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: var(--txt2);
        cursor: pointer;
      }
      .inbox-chrome-btn:hover { background: var(--surf2); color: var(--txt); }
      .inbox-top-sep { width: 1px; height: 24px; background: var(--bdr2); }
      .inbox-top-title {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--txt3);
        font-size: 11px;
        font-weight: 500;
        line-height: 1.48;
      }
      .inbox-top-title svg {
        width: 15px;
        height: 15px;
        flex: 0 0 15px;
        color: currentColor;
      }
      /* Zaehler-Ziffer nicht fett (matcht 'Einträge'); Empty-State nutzt .library-empty-state */
      .library-count strong { font-weight: inherit; }
      #inbox-empty[hidden] { display: none; }

      /* ===== ISA-56: Inbox-Items (Light + Dark ueber CI-Tokens) ===== */
      .inbox-list { display: flex; flex-direction: column; gap: 10px; }
      .inbox-item {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        text-align: left;
        padding: 14px 16px;
        border: 1px solid var(--bdr2);
        border-radius: var(--radius-md, 12px);
        background: var(--surf);
        color: var(--txt);
        cursor: pointer;
        transition: background .15s ease, border-color .15s ease, transform .04s ease;
      }
      .inbox-item:hover { background: var(--surf2); border-color: var(--blue); }
      .inbox-item:active { transform: translateY(1px); }
      .inbox-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
      .inbox-item-dot {
        width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
        background: var(--blue);
      }
      .inbox-item.read .inbox-item-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--bdr2); }
      .inbox-item-icon {
        width: 34px; height: 34px; flex: 0 0 34px;
        display: grid; place-items: center;
        border-radius: 9px; background: var(--surf2); color: var(--txt2);
      }
      .inbox-item-icon svg { width: 17px; height: 17px; }
      .inbox-item.unread .inbox-item-icon { color: var(--blue); }
      .inbox-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
      .inbox-item-title {
        font-size: 14px; font-weight: 600; color: var(--txt);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      }
      .inbox-item.read .inbox-item-title { font-weight: 500; color: var(--txt2); }
      .inbox-item-sub {
        font-size: 12.5px; color: var(--txt3); line-height: 1.45;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      }
      .inbox-item-meta {
        flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
      }
      .inbox-item-cat {
        font-size: 11px; font-weight: 600; color: var(--txt2);
        padding: 2px 8px; border-radius: 999px;
        background: var(--surf2); border: 1px solid var(--bdr2);
      }
      .inbox-item-time { font-size: 11px; color: var(--txt3); white-space: nowrap; }

      @media (max-width: 760px) {
        .inbox-body { padding: 24px 18px 40px; }
        .inbox-topbar { padding: 0 18px; }
        .inbox-item-cat { display: none; }
      }

      /* ===== Wissen: Status-Badge (In Arbeit/Bereit) + Datei-Aktionsmenue ("...") ===== */
      .knowledge-file-meta { grid-template-columns: 120px 120px 90px minmax(96px, auto); }
      .kn-status {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        font-size: 13.5px;
        font-weight: 650;
        white-space: nowrap;
      }
      .kn-status svg { flex: 0 0 auto; }
      /* ISA-117: Retry-Status ist klickbar (erneute Indexierung), bleibt aber
         optisch ein Status-Chip in der Fehlerfarbe. */
      button.kn-status-retry {
        border: 0;
        background: transparent;
        padding: 0;
        font: inherit;
        font-size: 13.5px;
        font-weight: 650;
        cursor: pointer;
      }
      button.kn-status-retry:hover,
      button.kn-status-retry:focus-visible { text-decoration: underline; }
      .kn-status-ready { color: #16a34a; }
      body:not(.light) .kn-status-ready { color: #37d07f; }
      .kn-status-processing { color: var(--blue); }
      body:not(.light) .kn-status-processing { color: #6f9bff; }
      .kn-status-error { color: #dc2626; }
      body:not(.light) .kn-status-error { color: #ff6b6b; }
      /* ISA-103: geprüftes Wissen / veralteter Review-Status */
      .kn-status-verified { color: var(--blue); }
      body:not(.light) .kn-status-verified { color: #6f9bff; }
      .kn-status-outdated { color: #b8860b; }
      body:not(.light) .kn-status-outdated { color: #e0b34d; }
      /* ISA-103: geprüfte Quelle in der Chat-Quellenanzeige markieren */
      .agent-source-chip-verified {
        border-color: rgba(74,122,255,0.5);
        background: rgba(74,122,255,0.10);
      }
      .agent-source-verified-badge {
        display: inline-flex; align-items: center; color: var(--blue); margin-right: 5px;
      }
      .agent-source-chip { display: inline-flex; align-items: center; }
      .kn-spin {
        width: 14px;
        height: 14px;
        flex: 0 0 auto;
        border-radius: 50%;
        border: 2px solid rgba(36, 87, 212, 0.25);
        border-top-color: currentColor;
        animation: kn-spin 0.7s linear infinite;
      }
      @keyframes kn-spin { to { transform: rotate(360deg); } }
      .kn-row-menu-wrap { position: relative; display: inline-flex; }
      .kn-row-menu-btn {
        width: 32px;
        height: 32px;
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--txt3);
        cursor: pointer;
      }
      .kn-row-menu-btn:hover,
      .kn-row-menu-btn[aria-expanded="true"] { background: var(--surf2); color: var(--txt); }
      .kn-row-menu {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        z-index: 60;
        min-width: 200px;
        padding: 8px;
        display: grid;
        gap: 2px;
        border: 1px solid var(--bdr2);
        border-radius: 14px;
        background: var(--surf);
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
      }
      .kn-row-menu.kn-row-menu-up {
        top: auto;
        bottom: calc(100% + 6px);
      }
      .kn-row-menu[hidden] { display: none; }
      .kn-row-menu button {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 40px;
        padding: 8px 10px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--txt);
        font: inherit;
        font-size: 13.5px;
        text-align: left;
        cursor: pointer;
      }
      .kn-row-menu button:hover { background: var(--surf2); }
      .kn-row-menu button svg { flex: 0 0 auto; color: var(--txt3); }
      .kn-row-menu-danger { color: #dc2626; }
      .kn-row-menu-danger svg { color: #dc2626; }
      .kn-row-menu-danger:hover { background: rgba(220, 38, 38, 0.10); }

      /* ===== Sidebar: Chat-Filter (Eigene/Geteilt) + Footer-Nav + Abrechnung (isarmind-CI) ===== */
      .sb-chatfilter { display: flex; align-items: center; gap: 8px; padding: 4px 10px 10px; }
      .sb-chatfilter-tabs { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,0.06); }
      .sb-chatfilter-tab { min-height: 30px; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,0.55); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
      .sb-chatfilter-tab.active { background: var(--accent-soft-bg-strong); color: #fff; }
      .sb-chatfilter-search { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,0.65); cursor: pointer; }
      .sb-chatfilter-search:hover { background: rgba(255,255,255,0.10); color: #fff; }
      .sb-chatfilter-input { margin: 0 10px 8px; min-height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,0.14); border-radius: 9px; background: rgba(255,255,255,0.06); color: #fff; font: inherit; font-size: 13px; }
      .sb-chat-empty { padding: 18px 12px; text-align: center; color: rgba(255,255,255,0.45); font-size: 13px; }
      .sb-utilnav { margin-top: auto; padding: 6px 8px 3px; display: grid; gap: 1px; border-top: 1px solid rgba(255,255,255,0.08); }
      .sb-util-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: rgba(255,255,255,0.82); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; }
      .sb-util-item:hover { background: var(--accent-soft-bg); color: rgba(255,255,255,0.96); }
      .sb-util-item > svg:first-child { flex: 0 0 auto; color: rgba(255,255,255,0.6); }
      .sb-util-item > span:first-of-type { flex: 1 1 auto; }
      .sb-util-chev { flex: 0 0 auto; color: rgba(255,255,255,0.4); }
      .sb-util-ver { font-size: 11.5px; font-weight: 500; color: rgba(255,255,255,0.4); }
      .sb-util-beta { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 999px; background: rgba(244,200,74,0.18); color: #f4c84a; }
      body.light .sb-chatfilter-tabs { background: var(--accent-soft-bg); }
      body.light .sb-chatfilter-tab { color: var(--text-soft); }
      body.light .sb-chatfilter-tab.active { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(15,23,42,0.10); }
      body.light .sb-chatfilter-search { color: var(--text-soft); }
      body.light .sb-chatfilter-search:hover { background: var(--accent-soft-bg); color: var(--blue); }
      body.light .sb-chatfilter-input { border-color: #d6dfef; background: #fff; color: var(--txt); }
      body.light .sb-chat-empty { color: var(--muted); }
      body.light .sb-utilnav { border-top-color: #d6dfef; }
      body.light .sb-util-item { color: var(--text-soft); }
      body.light .sb-util-item:hover { background: var(--accent-soft-bg); color: var(--blue); }
      body.light .sb-util-item > svg:first-child { color: var(--muted); }
      body.light .sb-util-chev,
      body.light .sb-util-ver { color: var(--muted); }
      body.light .sb-util-beta { background: rgba(217,155,0,0.16); color: #b9800a; }
      .billing-card { border: 1px solid var(--border-md); border-radius: var(--radius-lg); background: var(--surface); padding: 22px 24px; margin-bottom: 18px; }
      .billing-card-hd { margin-bottom: 16px; }
      .billing-card-hd h3 { margin: 0 0 4px; font-family: var(--font-head); font-size: 18px; font-weight: 600; color: var(--txt); }
      .billing-card-hd p { margin: 0; font-size: 14px; color: var(--txt3); }
      .billing-cta { margin-top: 16px; margin-bottom: 0; }

      body.light .library-empty-state { background: rgba(36,87,212,0.03); }

      /* Sidebar "Aktuelle Nutzung" als ausklappbares Akkordeon (statt View-Wechsel) */
      .sb-util-acc-head .sb-acc-chev { transition: transform .18s ease; transform: rotate(-90deg); }
      .sb-util-acc-head[aria-expanded="true"] .sb-acc-chev { transform: rotate(0deg); }
      .sb-util-acc-head > svg:first-child { color: rgba(255,255,255,0.76); }
      .sb-util-acc-body { padding: 2px 10px 8px 38px; display: grid; gap: 8px; }
      .sb-util-acc-body[hidden] { display: none; }
      .sb-usage-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: rgba(255,255,255,0.7); }
      .sb-usage-row strong { font-weight: 700; color: #fff; }
      .sb-usage-learn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0; color: rgba(255,255,255,0.7); font: inherit; font-size: 13px; cursor: pointer; }
      .sb-usage-learn:hover { color: #fff; }
      .sb-usage-learn svg { color: rgba(255,255,255,0.55); }
      body.light .sb-usage-row { color: var(--text-soft); }
      body.light .sb-util-acc-head > svg:first-child { color: var(--muted); }
      body.light .sb-usage-row strong { color: var(--txt); }
      body.light .sb-usage-learn { color: var(--text-soft); }
      body.light .sb-usage-learn:hover { color: var(--blue); }
      body.light .sb-usage-learn svg { color: var(--muted); }

      /* ISARMIND native-select normalization */
      .form-select,
      .assistant-editor .form-select,
      .settings-field select,
      .skill-modal-select,
      .skill-settings-select,
      .prompt-editor-category {
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%232457d4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 16px 16px;
      }
      .form-select,
      .assistant-editor .form-select,
      .settings-field select,
      .skill-modal-select,
      .skill-settings-select {
        padding-right: 42px;
      }
      .form-select:focus-visible,
      .assistant-editor .form-select:focus-visible,
      .settings-field select:focus-visible,
      .skill-modal-select:focus-visible,
      .skill-settings-select:focus-visible,
      .prompt-editor-category:focus-visible {
        outline: 0;
        border-color: rgba(36, 87, 212, 0.62);
        box-shadow: 0 0 0 4px rgba(36, 87, 212, 0.14);
      }

      /* --- Wissen: Bereichs-Tabs (Mein Wissen / Mit mir geteilt / Wissensspeicher)
         + Sichtbarkeits-Badge. Nutzt CI-Tokens -> automatisch Light/Dark-konsistent. --- */
      .kn-scope-tabs {
        /* Eigene Zeile ueber der Toolbar: das Toolbar-Grid definiert 6 Spalten
           fuer seine 6 Original-Kinder — als 7. Kind wuerden die Tabs sonst in
           Spalte 1 (max 194px) gequetscht und liefen unter den Neu-Button. */
        grid-column: 1 / -1;
        justify-self: start;
        display: inline-flex;
        gap: 4px;
        padding: 4px;
        background: var(--surf2);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
      }
      .kn-scope-tab {
        appearance: none;
        border: 0;
        background: transparent;
        color: var(--txt2);
        font: inherit;
        font-size: 13px;
        font-weight: 500;
        padding: 7px 14px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.15s ease, color 0.15s ease;
      }
      .kn-scope-tab:hover {
        color: var(--text);
      }
      .kn-scope-tab.active {
        background: var(--accent-soft-bg);
        color: var(--blue);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
      }
      .kn-vis-chip {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 11px;
        font-weight: 600;
        padding: 2px 9px;
        border-radius: 999px;
        line-height: 1.5;
      }
      .kn-vis-chip.private {
        background: var(--surf3);
        color: var(--txt2);
      }
      .kn-vis-chip.shared,
      .kn-vis-chip.company {
        background: var(--blue-soft);
        color: var(--blue);
      }
      /* Teilen-Modal: Empfaengerliste */
      .kn-share-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 6px 0 4px;
      }
      .kn-share-row {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font-size: 14px;
        color: var(--text);
        cursor: pointer;
      }
      .kn-share-row input {
        accent-color: var(--blue);
        width: 16px;
        height: 16px;
      }
      /* ISA-89: In der Teilen-Maske steht der Mitarbeitername im Vordergrund,
         die E-Mail nur sekundär und kleiner. Ohne Namen trägt .kn-share-name
         die E-Mail als Fallback. */
      .kn-share-person {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-width: 0;
      }
      .kn-share-name {
        color: var(--text);
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .kn-share-mail {
        font-size: 12px;
        color: var(--txt3);
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      /* ISA-94: Beispielprompt-Unterzeile auf Windows besser lesbar.
         Die graue Unterzeile (.sug-sub) lief mit font-weight 360 und wirkte
         unter Windows/ClearType blass. Etwas kraeftigeres Gewicht plus im
         Lightmode leicht dunklere und im Darkmode leicht hellere Farbe
         erhoehen den Kontrast, ohne das leichte CI zu verlieren. Bewusst auf
         .suggestion-btn .sug-sub gescopt, damit nur die Beispielprompt-Karten
         betroffen sind. */
      .suggestion-btn .sug-sub {
        font-weight: 430;
      }
      body.light .suggestion-btn .sug-sub {
        color: #3c4a61;
      }
      body:not(.light) .suggestion-btn .sug-sub {
        color: #e3ebfb;
      }
      /* Niedrige Fenster: Sidebar verdichten, damit Navigation UND Chats
         gleichzeitig sichtbar bleiben; das Kontingent-Meter ist dann in
         Einstellungen -> Mein Verbrauch erreichbar. */
      @media (max-height: 780px) {
        .sb-brand { padding: 12px 20px 10px; }
        .sb-top { padding: 10px 14px 6px; }
        /* ISA-33: 30px == Dark-Referenz (body:not(.light) .sb-nav-item).
           Vorher 34px nur im Light wirksam (Dark blieb per hoeherer
           Spezifitaet bei 30px) -> 4px/Item Theme-Versatz bei <=780px. */
        .sb-nav-item { min-height: 30px; }
        .sb-library-subitem { min-height: 30px; }
        .sb-util-item { min-height: 31px; font-size: 13px; }
        .sb-utilnav { padding: 4px 8px 2px; }
        .btn-new-chat { padding: 8px 16px; }
        .sb-footer-card, .sb-user-row { padding-top: 5px; padding-bottom: 5px; }
        .usage-meter { display: none; }
      }
      /* Sehr niedrige Fenster: sekundaere Util-Eintraege weichen zugunsten
         der Chatliste (Nutzung -> Einstellungen/Mein Verbrauch, Mehr = nur Version). */
      @media (max-height: 700px) {
        .sb-util-acc, .sb-util-more { display: none; }
        /* ISA-51: kein Chat-Mindesthoehen-Boden mehr -> die Chatliste schrumpft
           in den Restplatz und scrollt intern, damit alle Hauptreiter ohne
           Scrollen sichtbar bleiben (Basis-Regel min-height:0 greift). */
        .sb-chats-region { min-height: 0; }
      }

      /* Blauer Seiten-Fade auf allen Reitern — bisher nur im Wissen-Reiter
         (.knowledge-drive-scroll). Am Dateiende, damit es die spätere
         transparent-Regel (body:not(.light) .page-scroll) schlägt; spiegelt die
         Light-Regel `body.light .view:not(#view-chat) .page-scroll`. Chat behält
         seinen eigenen Verlauf. */
      body:not(.light) .view:not(#view-chat) .page-scroll {
        background:
          radial-gradient(circle at 18% 0%, rgba(36,87,212,0.18), transparent 34%),
          linear-gradient(180deg, #081120 0%, var(--bg) 52%, #060912 100%);
      }

      /* ============ ISA-108: einheitliche App-Shell-Trennlinien ============
         Ein zentrales Token (--shell-line) definiert Farbe + Stärke ALLER
         strukturellen Linien (Sidebar/Header/Content/Settings). Vorher lagen dort
         uneinheitliche Werte (0.06/0.07/0.08/0.09/0.10 sowie ein blaugrauer
         142,164,210-Ton) nebeneinander. Zusätzlich ist der Logo-Header exakt so
         hoch wie die Topbar (58px), damit der Divider unter dem Logo und die
         Header-Unterkante ohne Versatz zu EINER durchgehenden Linie zusammenlaufen.
         Am Dateiende platziert, damit die Regeln die früheren Spezialwerte schlagen. */
      :root { --shell-line: rgba(255,255,255,0.10); }
      body.light { --shell-line: #d6dfef; }

      /* Logo-Header (Sidebar) = Topbar-Höhe (58px inkl. 1px-Border, border-box) →
         Divider unter dem Logo sitzt exakt auf der Topbar-Unterkante. 26px-Logo bei
         top 16px (padding 16 oben / 15 unten), horizontale Paddings bleiben. */
      body:not(.light) .sb-brand,
      body.light .sb-brand {
        height: var(--header-h);
        min-height: var(--header-h);
        padding-top: 16px;
        padding-bottom: 15px;
      }
      /* Settings-Logo deckungsgleich zum App-Logo (ISA-96): 18px Menü-Padding
         minus 2px → gleiche Bildschirmhöhe wie das App-Logo (top 16px). */
      .settings-brand { margin-top: -2px; }

      /* Strukturelle Trennlinien einheitlich einfärben (Farbe zentral, 1px bleibt). */
      body:not(.light) #sidebar,
      body.light #sidebar { border-right-color: var(--shell-line); }
      body:not(.light) #topbar,
      body.light #topbar { border-bottom-color: var(--shell-line); }
      body:not(.light) .sb-brand,
      body.light .sb-brand { border-bottom-color: var(--shell-line); }
      body:not(.light) .sb-footer,
      body.light .sb-footer { border-top-color: var(--shell-line); }
      body:not(.light) .settings-menu,
      body.light .settings-menu { border-right-color: var(--shell-line); }
      body:not(.light) .settings-breadcrumb,
      body.light .settings-breadcrumb { border-bottom-color: var(--shell-line); }

      /* === ISA-152/166: Sichtbare Bearbeitungsschritte (processing_step) ====
         Wiederverwendbares Panel oberhalb der entstehenden Antwort. Nutzt nur
         Theme-Tokens (Dark + body.light), keine hartkodierten Farben. */
      .proc-steps {
        margin: 0 0 8px;
        max-width: 100%;
        border: 1px solid var(--bdr2, rgba(255,255,255,0.13));
        border-radius: 12px;
        background: var(--surface-2, rgba(255,255,255,0.03));
        overflow: hidden;
        font-size: 12.5px;
      }
      .proc-steps-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 8px 12px;
        background: none;
        border: 0;
        cursor: pointer;
        color: var(--txt2, inherit);
        font: inherit;
        font-size: 12.5px;
        text-align: left;
      }
      .proc-steps-toggle:focus-visible {
        outline: 2px solid var(--accent-focus-ring, rgba(74,122,255,0.7));
        outline-offset: -2px;
        border-radius: 12px;
      }
      .proc-steps-title {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .proc-steps-chevron::before {
        content: "\25BE";
        opacity: 0.7;
        display: inline-block;
        transition: transform 0.18s ease;
      }
      .proc-steps[data-state="collapsed"] .proc-steps-chevron::before { transform: rotate(-90deg); }
      .proc-steps-spinner {
        flex: none;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        border: 2px solid var(--accent-soft-bg-strong, rgba(74,122,255,0.3));
        border-top-color: var(--aqua, #4a7aff);
        animation: proc-steps-spin 0.9s linear infinite;
      }
      .proc-steps-done .proc-steps-spinner {
        animation: none;
        border: 0;
        width: 8px;
        height: 8px;
        background: var(--green, #22c55e);
      }
      .proc-steps-failed .proc-steps-spinner { background: var(--red, #ff6b61); }
      @keyframes proc-steps-spin { to { transform: rotate(360deg); } }
      .proc-steps-body {
        padding: 2px 12px 10px;
        display: flex;
        flex-direction: column;
        gap: 5px;
      }
      .proc-step {
        display: flex;
        align-items: baseline;
        gap: 8px;
        color: var(--txt3, inherit);
        line-height: 1.5;
        overflow-wrap: anywhere;
      }
      .proc-step-icon {
        flex: none;
        width: 14px;
        text-align: center;
        font-size: 11px;
      }
      .proc-step[data-status="running"] { color: var(--txt, inherit); font-weight: 600; }
      .proc-step[data-status="running"] .proc-step-icon::before {
        content: "";
        display: inline-block;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--aqua, #4a7aff);
        animation: proc-step-pulse 1s ease-in-out infinite;
      }
      @keyframes proc-step-pulse {
        0%, 100% { opacity: 0.35; }
        50% { opacity: 1; }
      }
      .proc-step[data-status="completed"] .proc-step-icon { color: var(--green, #22c55e); }
      .proc-step[data-status="failed"] { color: var(--red, #ff6b61); }
      .proc-step[data-status="failed"] .proc-step-icon { color: var(--red, #ff6b61); }
      .proc-step[data-status="skipped"] { opacity: 0.6; }
      .proc-step-summary { color: var(--txt3, inherit); font-size: 11.5px; }
      .proc-step[data-fallback="true"] .proc-step-summary { color: var(--yellow, #f2c94c); }
      .proc-steps-retry {
        margin-top: 6px;
        align-self: flex-start;
        padding: 5px 12px;
        border-radius: 8px;
        border: 1px solid var(--bdr2, rgba(255,255,255,0.13));
        background: var(--accent-soft-bg, rgba(36,87,212,0.1));
        color: var(--txt, inherit);
        font: inherit;
        font-size: 12px;
        cursor: pointer;
      }
      .proc-steps-retry:hover { background: var(--accent-soft-bg-strong, rgba(36,87,212,0.18)); }
      .proc-steps-retry:focus-visible {
        outline: 2px solid var(--accent-focus-ring, rgba(74,122,255,0.7));
        outline-offset: 2px;
      }
      .proc-steps .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
      }
      @media (prefers-reduced-motion: reduce) {
        .proc-steps-spinner,
        .proc-step[data-status="running"] .proc-step-icon::before { animation: none; }
      }

      /* === ISA-124: Artefakt-Freigabe-Dialog ================================ */
      .artifact-share-label {
        display: block;
        margin: 0 0 6px;
        font-size: 12.5px;
        color: var(--txt2, inherit);
      }
      .artifact-share-select {
        width: 100%;
        padding: 9px 11px;
        border-radius: 9px;
        border: 1px solid var(--bdr2, rgba(255,255,255,0.13));
        background: var(--surface-2, transparent);
        color: var(--txt, inherit);
        font: inherit;
        font-size: 13px;
      }
      .artifact-share-select:focus-visible {
        outline: 2px solid var(--accent-focus-ring, rgba(74,122,255,0.7));
        outline-offset: 2px;
      }
      .artifact-share-people {
        margin-top: 14px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-height: 240px;
        overflow-y: auto;
      }
      .artifact-share-people-label {
        margin-bottom: 4px;
        font-size: 12.5px;
        color: var(--txt2, inherit);
      }
      .artifact-share-person {
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 7px 8px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 13px;
        color: var(--txt, inherit);
      }
      .artifact-share-person:hover { background: var(--accent-soft-bg, rgba(36,87,212,0.1)); }
      .artifact-share-person input { accent-color: var(--blue, #2457d4); }
      .artifact-share-person input:focus-visible {
        outline: 2px solid var(--accent-focus-ring, rgba(74,122,255,0.7));
        outline-offset: 2px;
      }
      .artifact-share-empty,
      .artifact-share-error {
        padding: 9px 11px;
        border-radius: 8px;
        font-size: 12.5px;
      }
      .artifact-share-empty {
        background: var(--surface-2, transparent);
        color: var(--txt3, inherit);
      }
      .artifact-share-error {
        margin: 0 0 10px;
        border: 1px solid var(--red, #ff6b61);
        background: color-mix(in srgb, var(--red, #ff6b61) 12%, transparent);
        color: var(--red, #ff6b61);
      }

      /* ISA-134: Warnschwelle des Verbrauchsbalkens (>= 80 % des Limits). */
      .usage-bar-fill.usage-warn {
        background: linear-gradient(90deg, var(--red, #ff6b61), var(--red, #ff6b61));
      }
