*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    color-scheme: dark;
    font-family: Segoe UI, Arial, sans-serif;
    --bg: #0f172a;
    --surface: #111827;
    --surface2: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #2563eb;
    --primary-h: #1d4ed8;
    --ok: #22c55e;
    --fail: #ef4444;
    --warn: #f59e0b;
    --sky: #38bdf8;
    --link: #93c5fd;
    --radius: 12px;
}

/* ── UI-Themes ───────────────────────────────────────────────────────────────
   Von Team (TeamAdmin/Admin) bzw. teamlosem Super-Admin auf /appearance wählbar
   (siehe TeamPilot.Domain.UiThemes für den Auswahl-Katalog). Jeder Block überschreibt
   die :root-Variablen vollständig; --ok/--fail/--warn/--sky bleiben bewusst überall
   gleich (themenunabhängige Signalfarben für Status-Badges, siehe Plan-Notiz). */

html[data-theme="mitternacht-violett"] {
    color-scheme: dark;
    --bg: #150c28; --surface: #1e1240; --surface2: #2a1a54; --border: #3d2a70;
    --text: #ede9fe; --muted: #a29bd6; --primary: #7c3aed; --primary-h: #6d28d9;
    --link: #c4b5fd; --radius: 10px;
}

html[data-theme="waldgruen"] {
    color-scheme: dark;
    --bg: #0b1f17; --surface: #122b20; --surface2: #1a3b2a; --border: #2d5240;
    --text: #e3f5ec; --muted: #8fbfa4; --primary: #15803d; --primary-h: #166534;
    --link: #86efac; --radius: 10px;
}

html[data-theme="graphit"] {
    color-scheme: dark;
    --bg: #18181b; --surface: #212124; --surface2: #2b2b2f; --border: #3f3f46;
    --text: #f4f4f5; --muted: #a1a1aa; --primary: #c2410c; --primary-h: #9a3412;
    --link: #fdba74; --radius: 6px;
}

html[data-theme="bernstein"] {
    color-scheme: dark;
    --bg: #1c1408; --surface: #261c0d; --surface2: #382a15; --border: #4f3c1e;
    --text: #f5ead2; --muted: #c2a877; --primary: #92400e; --primary-h: #78350f;
    --link: #fcd34d; --radius: 10px;
}

html[data-theme="sonnenuntergang"] {
    color-scheme: dark;
    --bg: #160b12; --surface: #20111b; --surface2: #301926; --border: #4a2438;
    --text: #fbe8f0; --muted: #c48ca8; --primary: #be123c; --primary-h: #9f1239;
    --link: #fda4af; --radius: 16px;
}

html[data-theme="papier"] {
    color-scheme: light;
    --bg: #faf8f5; --surface: #ffffff; --surface2: #f1ede6; --border: #ddd6cb;
    --text: #2b2620; --muted: #6b6357; --primary: #57534e; --primary-h: #44403c;
    --link: #2563eb; --radius: 8px;
}

html[data-theme="koenigsblau"] {
    color-scheme: light;
    --bg: #f4f7fc; --surface: #ffffff; --surface2: #e7edf9; --border: #c9d6ec;
    --text: #1a2233; --muted: #5b6b85; --primary: #1d4ed8; --primary-h: #1e40af;
    --link: #1d4ed8; --radius: 8px;
}

html[data-theme="ozean"] {
    color-scheme: light;
    --bg: #f0fbfc; --surface: #ffffff; --surface2: #e0f5f7; --border: #bfe6ea;
    --text: #123b3f; --muted: #4f7a80; --primary: #0e7490; --primary-h: #155e75;
    --link: #0e7490; --radius: 12px;
}

html[data-theme="lavendel"] {
    color-scheme: light;
    --bg: #faf8ff; --surface: #ffffff; --surface2: #f1ebfc; --border: #ded1f2;
    --text: #2e2144; --muted: #7a6a95; --primary: #4f46e5; --primary-h: #4338ca;
    --link: #4f46e5; --radius: 16px;
}

html[data-theme="rose"] {
    color-scheme: light;
    --bg: #fdf6f7; --surface: #ffffff; --surface2: #faebee; --border: #f0d3da;
    --text: #3a2226; --muted: #8a6870; --primary: #be185d; --primary-h: #9d174d;
    --link: #be185d; --radius: 16px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--link);
    text-decoration: none;
}

    a:hover {
        color: var(--text);
    }

h1, h2, h3, h4 {
    margin-top: 0;
}

/* ── Start-Animation (nur erster Seitenaufruf pro Tab, siehe _Layout.cshtml) ──────────────── */

.app-splash-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg);
    animation: app-splash-fade 1.1s ease forwards;
}

.app-splash-overlay img {
    width: 64px;
    height: 64px;
    animation: app-splash-logo 0.6s ease forwards;
}

.app-splash-word {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    opacity: 0;
    animation: app-splash-word-in 0.5s ease 0.25s forwards;
}

.app-splash-word span {
    color: var(--link);
}

@keyframes app-splash-fade {
    0% { opacity: 0; }
    15% { opacity: 1; }
    75% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

@keyframes app-splash-logo {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes app-splash-word-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Site Header ─────────────────────────────────────────────────────────── */

.site-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    height: 52px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--parchment);
    flex-shrink: 0;
}


.login-logo-icon {
    height: 52px;
    width: auto;
    margin: 0px;
    padding:0px;
}

.site-logo-icon {
    height: 26px;
    width: auto;
}

.logo-ai {
    color: var(--link);
}

.logo-menu {
    position: relative;
}

.logo-menu-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.logo-menu-panel {
    position: absolute;
    top: 2.75rem;
    left: 0;
    min-width: 220px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: .375rem;
}

    /* Author-Style "display: flex" oben überschreibt sonst das hidden-Attribut, siehe .chat-history-panel. */
    .logo-menu-panel[hidden] {
        display: none;
    }

.logo-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .5rem .75rem;
    border-radius: .375rem;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
}

    .logo-menu-item:hover {
        background: var(--border);
        color: var(--text);
    }

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .site-nav a {
        font-size: 13px;
        font-weight: 500;
        color: var(--muted);
        padding: 5px 11px;
        border-radius: 6px;
        text-decoration: none;
        transition: color 0.15s, background 0.15s;
    }

        .site-nav a:hover {
            color: var(--text);
            background: var(--surface2);
        }

        .site-nav a.is-active {
            color: var(--text);
            background: var(--surface2);
        }

.site-main {
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--primary-h);
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

    .btn-ghost:hover {
        color: var(--text);
        border-color: var(--muted);
    }

    .btn-ghost.is-active {
        background: var(--surface2);
        color: var(--text);
        border-color: var(--muted);
    }

/* ── Panel ───────────────────────────────────────────────────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

/* ── Tags ────────────────────────────────────────────────────────────────── */

.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--border);
    font-size: 12px;
    margin-right: 6px;
    margin-bottom: 6px;
}

    .tag.state-queued {
        background: #1e3a8a;
        color: #bfdbfe;
    }

    .tag.state-analyzing {
        background: #78350f;
        color: #fcd34d;
    }

    .tag.state-waiting-plan {
        background: #0c4a6e;
        color: #bae6fd;
    }

    .tag.state-running {
        background: #14532d;
        color: #bbf7d0;
    }

    .tag.state-completed {
        background: #14532d;
        color: #bbf7d0;
    }

    .tag.state-failed {
        background: #7f1d1d;
        color: #fecaca;
    }

    .tag.state-cancelled {
        background: #374151;
        color: #9ca3af;
    }

.ok {
    color: var(--ok);
}

.fail {
    color: var(--fail);
}

.warn {
    color: var(--warn);
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */

.prompt-heading {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.prompt-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.free-model-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(245,158,11,.1);
    border: 1px solid rgba(245,158,11,.3);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.free-model-hint-icon {
    color: #fbbf24;
    flex-shrink: 0;
}

.free-model-hint a {
    color: var(--link);
    white-space: nowrap;
}

/* ── "Braucht deine Aufmerksamkeit"-Panel (offene manuelle Schritte + abgebrochene eigene Läufe) ── */

.action-needed-panel {
    background: rgba(245,158,11,.1);
    border: 1px solid rgba(245,158,11,.3);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.action-needed-title {
    font-size: 13px;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 8px;
}

.action-needed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-needed-item {
    font-size: 13px;
}

    .action-needed-item a {
        color: var(--text);
        font-weight: 600;
    }

    .action-needed-item .action-needed-hint {
        color: var(--muted);
    }

/* Testphase abgelaufen — härterer Block statt des dezenten .free-model-hint, gleiche
   Verlaufs-Panel-Struktur wie .workflow-preparing-panel/.planner-panel-open, nur in Rot statt Orange. */
.trial-blocked-panel {
    background: linear-gradient(135deg, #2a0a0a 0%, #3d0f0f 100%);
    border: 2px solid var(--fail);
    border-radius: 14px;
    padding: 22px 26px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.trial-blocked-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.trial-blocked-content {
    flex: 1;
    min-width: 0;
}

.trial-blocked-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #fecaca;
    font-weight: 600;
}

.trial-blocked-desc {
    margin: 0 0 14px;
    color: #fca5a5;
    font-size: 0.875rem;
    line-height: 1.6;
}

.trial-blocked-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.prompt-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    padding: 14px 16px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

    .prompt-input:focus {
        border-color: var(--primary);
    }

.prompt-actions {
    display: flex;
    justify-content: flex-end;
}

.runs-section {
    margin-top: 48px;
}

.runs-heading {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.runs-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.run-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}

    .run-item:hover {
        border-color: var(--link);
    }

.run-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.run-prompt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: wrap;
    font-size: 14px;
}

.run-time {
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.run-badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

    .run-badge.is-ok {
        background: #14532d;
        color: var(--ok);
    }

    .run-badge.is-fail {
        background: #7f1d1d;
        color: var(--fail);
    }

    .run-badge.is-warn {
        background: #78350f;
        color: #fbbf24;
    }

    .run-badge.is-active {
        background: #1e3a8a;
        color: #93c5fd;
    }

    .run-badge.is-needs-action {
        background: #451a03;
        color: #fdba74;
    }

/* ── Run Page Topbar ─────────────────────────────────────────────────────── */

.run-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: 10px;
    margin-bottom: 20px;
    position: sticky;
    top: 60px;
    z-index: 9;
    flex-wrap: wrap;
}

.run-back {
    color: var(--muted);
    font-size: 13px;
    flex-shrink: 0;
}

    .run-back:hover {
        color: var(--link);
    }

.run-prompt-preview {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: wrap;
}

.run-state-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

    .run-state-badge.is-ok {
        background: rgba(34,197,94,.15);
        color: #4ade80;
        border: 1px solid rgba(34,197,94,.3);
    }

    .run-state-badge.is-fail {
        background: rgba(239,68,68,.15);
        color: #f87171;
        border: 1px solid rgba(239,68,68,.3);
    }

    .run-state-badge.is-warn {
        background: rgba(245,158,11,.15);
        color: #fbbf24;
        border: 1px solid rgba(245,158,11,.3);
    }

    .run-state-badge.is-active {
        background: rgba(37,99,235,.15);
        color: #93c5fd;
        border: 1px solid rgba(37,99,235,.3);
    }

.run-topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.run-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 24px 14px;
}

.run-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

    .run-source-chip:hover {
        background: var(--surface3, var(--border));
    }

.run-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 6px;
    padding: 4px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.run-restart-btn:hover {
    color: var(--sky);
    border-color: var(--sky);
}

.run-action-delete:hover {
    color: var(--fail);
    border-color: var(--fail);
}

.run-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.run-delete-btn {
    background: transparent;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s;
}

    .run-delete-btn:hover {
        color: var(--fail);
    }

.run-error-banner {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
    color: #fca5a5;
}

/* ── Workflow Preparing Panel ────────────────────────────────────────────── */

.workflow-preparing-panel {
    background: linear-gradient(135deg, #1a1208 0%, #2d1e08 100%);
    border: 2px solid #d97706;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(217,119,6,.2);
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.workflow-preparing-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #3b2200;
    border-top-color: #f59e0b;
    border-right-color: #d97706;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
    flex-shrink: 0;
    margin-top: 4px;
}

.workflow-preparing-content {
    flex: 1;
    min-width: 0;
}

.workflow-preparing-title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: #fef3c7;
    font-weight: 600;
}

.workflow-preparing-hint {
    margin: 0 0 14px;
    color: #fcd34d;
    font-size: 0.875rem;
    line-height: 1.55;
}

.workflow-preparing-status-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.825rem;
    margin-top: 5px;
}

.workflow-preparing-status-label {
    color: #92400e;
    font-weight: 600;
    flex-shrink: 0;
}

.workflow-preparing-status-value {
    color: #fde68a;
    word-break: break-word;
}

.workflow-preparing-dots::after {
    content: '';
    animation: preparing-dots 1.6s steps(4, end) infinite;
    display: inline-block;
    min-width: 1.5ch;
}

@keyframes preparing-dots {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}

/* ── Workflow Executing Panel ────────────────────────────────────────────── */

.workflow-executing-panel {
    background: linear-gradient(135deg, #071a0f 0%, #0d2818 100%);
    border: 2px solid #16a34a;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(22,163,74,.18);
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

    .workflow-executing-panel .workflow-preparing-title {
        color: #d1fae5;
    }

    .workflow-executing-panel .workflow-preparing-hint {
        color: #86efac;
    }

    .workflow-executing-panel .workflow-preparing-status-label {
        color: #166534;
    }

    .workflow-executing-panel .workflow-preparing-status-value {
        color: #bbf7d0;
    }

.workflow-executing-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #14532d;
    border-top-color: #22c55e;
    border-right-color: #16a34a;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
    flex-shrink: 0;
    margin-top: 4px;
}

.run-progress-bar {
    width: 100%;
    height: 8px;
    background: #14532d;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}

.run-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ── Step-Status-Karten (Live-Ausführung + nachträgliche Einsicht) ────────
   Nutzen bewusst dieselben Klassen wie das Workflow-Plan-Panel (step-toggle-label
   etc., siehe unten) für optische Konsistenz — hier nur um Status-Modifier ergänzt. */

.step-status-icon-glyph {
    font-weight: 700;
}

/* Höhere Spezifität als .step-toggle-badge (display:none per Default) nötig, da unsere
   Status-Badges — anders als das Skip-Badge im Plan-Panel — immer sichtbar sein sollen. */
.step-toggle-badge.step-status-badge {
    display: inline-block;
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.step-status-error {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #fca5a5;
}

.step-status-details {
    margin-top: 6px;
    font-size: 0.75rem;
}

    .step-status-details summary {
        cursor: pointer;
        color: #7dd3fc;
    }

    .step-status-details pre {
        margin-top: 6px;
        white-space: pre-wrap;
        font-size: 0.75rem;
        color: var(--muted);
        max-height: 220px;
        overflow-y: auto;
    }

.step-toggle-label.step-status-pending {
    opacity: 0.6;
}

.step-toggle-label.step-status-running {
    border-color: #38bdf8;
    background: var(--surface2);
    box-shadow: 0 0 8px rgba(56,189,248,.2);
}

    .step-toggle-label.step-status-running .step-status-icon-glyph {
        display: inline-block;
        color: var(--link);
        animation: step-status-spin 1.2s linear infinite;
    }

    .step-toggle-label.step-status-running .step-status-badge {
        background: #0c4a6e;
        color: #93c5fd;
        border-color: #38bdf8;
    }

.step-toggle-label.step-status-completed {
    border-color: #166534;
}

    .step-toggle-label.step-status-completed .step-status-icon-glyph {
        color: var(--ok);
    }

    .step-toggle-label.step-status-completed .step-status-badge {
        background: #052e16;
        color: #86efac;
        border-color: #166534;
    }

.step-toggle-label.step-status-failed {
    border-color: var(--fail);
    background: #1f0a0a;
}

    .step-toggle-label.step-status-failed .step-status-icon-glyph {
        color: var(--fail);
    }

    .step-toggle-label.step-status-failed .step-toggle-name,
    .step-toggle-label.step-status-failed .step-toggle-goal {
        color: #fca5a5;
    }

    .step-toggle-label.step-status-failed .step-status-badge {
        background: #450a0a;
        color: #fca5a5;
        border-color: var(--fail);
    }

.step-toggle-label.step-status-skipped,
.step-toggle-label.step-status-disabled {
    opacity: 0.55;
}

    .step-toggle-label.step-status-skipped .step-status-icon-glyph,
    .step-toggle-label.step-status-disabled .step-status-icon-glyph {
        color: var(--muted);
    }

@keyframes step-status-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Step Selection Panel (MSAF-Style) ───────────────────────────────────── */

.step-selection-panel {
    background: linear-gradient(135deg, #0c1a35 0%, #082f49 100%);
    border: 2px solid #0ea5e9;
    border-radius: 14px;
    padding: 28px 28px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(14,165,233,.18);
}

.step-selection-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.step-selection-header-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-selection-title {
    margin: 0 0 6px;
    font-size: 1.2rem;
    color: var(--text);
}

.step-selection-subtitle {
    margin: 0;
    color: var(--link);
    font-size: 0.9rem;
    line-height: 1.5;
}

.step-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.step-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

    .step-toggle-label:hover {
        border-color: #38bdf8;
        background: var(--surface2);
        box-shadow: 0 0 8px rgba(56,189,248,.15);
    }

.step-toggle-icon {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 1rem;
    line-height: 1;
}

.step-toggle-check-icon {
    color: #22c55e;
    font-weight: 700;
}

.step-toggle-skip-icon {
    display: none;
    color: var(--fail);
    font-weight: 700;
}

.step-toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.step-toggle-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    padding-right: 22px;
}

.step-toggle-goal {
    font-size: 0.75rem;
    color: var(--link);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.step-toggle-agent {
    font-size: 0.7rem;
    color: #fbbf24;
    font-weight: 600;
}

.step-email-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    cursor: default;
}

.step-manual-move {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    cursor: default;
}

    .step-manual-move-btn {
        padding: 2px 8px;
        font-size: 0.7rem;
    }

    .step-manual-move-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

.step-email-input,
.step-email-textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.78rem;
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

    .step-email-input:focus,
    .step-email-textarea:focus {
        outline: none;
        border-color: #38bdf8;
    }

    .step-email-input::placeholder,
    .step-email-textarea::placeholder {
        color: var(--muted);
    }

.step-execute-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    cursor: default;
}

.step-execute-warning {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fca5a5;
}

.step-execute-command {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.78rem;
    font-family: 'Consolas', 'Cascadia Code', monospace;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-all;
}

.step-execute-workdir {
    font-size: 0.7rem;
    color: var(--muted);
}

.step-toggle-agent-default {
    color: var(--link);
    font-weight: 400;
}

.step-toggle-agent-missing {
    color: #fca5a5;
}

.step-toggle-badge {
    display: none;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 6px;
    width: fit-content;
    margin-top: 2px;
}

/* Überspringen-Zustand (checkbox checked = skip) */
.step-toggle-label:has(.step-toggle-checkbox:checked) {
    border-color: var(--fail);
    background: #1f0a0a;
}

    .step-toggle-label:has(.step-toggle-checkbox:checked) .step-toggle-check-icon {
        display: none;
    }

    .step-toggle-label:has(.step-toggle-checkbox:checked) .step-toggle-skip-icon {
        display: inline;
    }

    .step-toggle-label:has(.step-toggle-checkbox:checked) .step-toggle-name {
        color: #fca5a5;
    }

    .step-toggle-label:has(.step-toggle-checkbox:checked) .step-toggle-goal {
        color: #f87171;
    }

    .step-toggle-label:has(.step-toggle-checkbox:checked) .step-toggle-badge {
        display: inline-block;
        background: #450a0a;
        color: #fca5a5;
        border: 1px solid var(--fail);
    }

/* ── Admin: aufklappbare Bereiche (Benutzer- / Agentenverwaltung) ───────── */

.admin-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.admin-section-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--surface2);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

    .admin-section-summary::-webkit-details-marker {
        display: none;
    }

.admin-section-chevron {
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.admin-section[open] > .admin-section-summary .admin-section-chevron {
    transform: rotate(90deg);
}

.admin-section-title {
    font-size: 16px;
    font-weight: 600;
}

.admin-section-count {
    font-size: 12px;
    color: var(--muted);
    margin-left: auto;
}

.admin-section-body {
    padding: 20px;
}

/* ── Admin: Übersicht (Online-/Team-/Workflow-Statistik) ─────────────────── */

.admin-overview-heading {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.stats-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

    .stats-chart-header .admin-overview-heading {
        margin-bottom: 0;
    }

.stats-chart-controls {
    display: flex;
    gap: 8px;
}

.stats-chart-canvas {
    width: 100%;
    height: 260px;
    display: block;
}

.stat-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1 1 160px;
    min-width: 160px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text);
    margin-top: 2px;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.workflow-status-breakdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.workflow-language-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-muted);
    background: transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.workflow-status-title {
    font-size: 13px;
    color: var(--muted);
    margin-right: 4px;
}

.workflow-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
}

    .workflow-status-badge strong {
        color: var(--text);
    }

    .workflow-status-badge.is-running {
        border-color: var(--sky);
        color: var(--sky);
    }

    .workflow-status-badge.is-waiting {
        border-color: var(--warn);
        color: var(--warn);
    }

    .workflow-status-badge.is-completed {
        border-color: var(--ok);
        color: var(--ok);
    }

    .workflow-status-badge.is-failed {
        border-color: var(--fail);
        color: var(--fail);
    }

    .workflow-status-badge.is-cancelled {
        color: var(--muted);
    }

    .workflow-status-badge.is-total {
        background: transparent;
    }

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

    .online-dot.is-online {
        background: var(--ok);
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    }

    .online-dot.is-offline {
        background: var(--border);
    }

/* ── Avatar (Profilbild/Initialen-Kreis) ─────────────────────────────────────
   Neue Konvention — existierte im Projekt bisher nicht. .avatar-circle-sm für Listen
   (Nutzerverwaltung, Dashboard-Läufe, Chat), .avatar-circle-lg für die große Vorschau
   auf der Profil-Seite selbst. */

.avatar-circle {
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-circle-sm {
    width: 24px;
    height: 24px;
    margin-right: 6px;
}

.avatar-circle-lg {
    width: 72px;
    height: 72px;
}

.avatar-fallback {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.avatar-circle-lg.avatar-fallback {
    font-size: 1.6rem;
}

/* ── Refine Collapsible (auf Plan-Screen) ────────────────────────────────── */

.refine-collapsible {
    margin-top: 16px;
    border: 1px solid #1e3a5f;
    border-radius: 10px;
    overflow: hidden;
}

.refine-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: var(--surface2);
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 14px;
    font-weight: 600;
    color: #7dd3fc;
}

    .refine-summary::-webkit-details-marker {
        display: none;
    }

.refine-summary-icon {
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.refine-collapsible[open] .refine-summary-icon {
    transform: rotate(45deg);
}

.refine-summary-hint {
    font-size: 12px;
    color: #38bdf8;
    font-weight: 400;
    margin-left: auto;
}

.refine-body {
    padding: 16px;
    background: #071828;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.refine-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.refine-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--link);
}

.refine-label-hint {
    font-weight: 400;
    color: #38bdf8;
    font-size: 12px;
}

.refine-input, .refine-textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

    .refine-input:focus, .refine-textarea:focus {
        border-color: #38bdf8;
    }

.refine-textarea {
    resize: vertical;
}

.refine-url-row {
    display: flex;
    gap: 8px;
}

    .refine-url-row .refine-input {
        flex: 1;
    }

.refine-url-btn {
    background: #0c4a6e;
    border: 1px solid #0ea5e9;
    color: #bae6fd;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}

    .refine-url-btn:hover {
        background: #075985;
    }

.refine-url-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.refine-url-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.refine-url-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #7dd3fc;
}

.refine-url-remove {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
}

    .refine-url-remove:hover {
        color: var(--fail);
    }

.step-selection-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #164e63;
    flex-wrap: wrap;
}

.step-selection-hint {
    margin: 0;
    color: var(--link);
    font-size: 0.8rem;
    flex: 1;
    min-width: 200px;
}

.step-selection-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0369a1;
    border: 1px solid #0ea5e9;
    color: #e0f2fe;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 22px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

    .step-selection-submit:hover {
        background: #0284c7;
        border-color: #38bdf8;
        box-shadow: 0 0 12px rgba(56,189,248,.35);
    }

    .step-selection-submit:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ── Result Panel ────────────────────────────────────────────────────────── */

.run-result-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 40px;
}

.option-input {
    height: 32px;
    padding: 6px;
}

.result-heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.run-share-box {
    margin-bottom: 20px;
}

.run-share-row {
    display: flex;
    gap: 8px;
}

.run-share-url {
    flex: 1;
    font-size: 13px;
}

/* ── Download-Zusammenfassung (oben + unten auf der Ergebnisseite, siehe _ArtifactDownloadSummary) ── */
.artifact-download-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.artifact-download-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(37,99,235,.15);
    border: 1px solid rgba(37,99,235,.3);
    color: var(--link);
    text-decoration: none;
    max-width: 320px;
    transition: background 0.15s, border-color 0.15s;
}

    .artifact-download-summary-chip:hover {
        background: rgba(37,99,235,.3);
        border-color: #3b82f6;
    }

.artifact-download-summary-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artifact-download-summary-action {
    opacity: 0.75;
    font-weight: 400;
}

.artifact-collapsible {
    margin-bottom: 12px;
}

.artifact-summary {
    cursor: pointer;
    padding: 10px 14px;
    background: var(--surface2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    font-weight: 500;
}

.artifact-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artifact-summary-spacer {
    flex: 1;
}

.artifact-download-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(37,99,235,.15);
    color: #93c5fd;
    border: 1px solid rgba(37,99,235,.3);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

    .artifact-download-btn:hover {
        background: rgba(37,99,235,.3);
        border-color: #3b82f6;
        color: #bfdbfe;
    }

.artifact-url-link {
    color: var(--link);
    word-break: break-all;
    font-size: 14px;
}

.artifact-kind {
    font-size: 11px;
    padding: 2px 8px;
    background: #1e3a8a;
    color: #93c5fd;
    border-radius: 4px;
}

.artifact-content {
    padding: 12px 0 0;
}

.artifact-image-preview {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.artifact-audio-preview {
    width: 100%;
    display: block;
}

.artifact-html-preview {
    width: 100%;
    min-height: 200px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: block;
    background: #fff;
}

.artifact-file-hint {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.artifact-content pre {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.result-text {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-x: auto;
}


/* ── Refine Page ─────────────────────────────────────────────────────────── */

.refine-analysis-bar {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, #0f1e38 0%, #162140 100%);
    border: 1px solid #2563eb44;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.refine-analysis-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    color: #60a5fa;
}

.refine-analysis-summary {
    margin: 0;
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1.5;
}

.refine-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.option-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s;
}

    .option-card.is-suggested {
        border-color: #2563eb88;
        background: linear-gradient(135deg, #111827 0%, #131d35 100%);
        box-shadow: 0 2px 12px rgba(37,99,235,.12);
    }

    /* Werte aus einem vorherigen Lauf/Neustart bereits gesetzt — bewusst grün statt blau (is-suggested),
       damit "das hat die KI vorgeschlagen" und "das hattest du schon konfiguriert" optisch unterscheidbar bleiben. */
    .option-card.is-active {
        border-color: #16a34a88;
        background: linear-gradient(135deg, #111827 0%, #132a1d 100%);
        box-shadow: 0 2px 12px rgba(22,163,74,.12);
    }

.option-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

    .option-card-header::-webkit-details-marker {
        display: none;
    }

    .option-card-header::marker {
        display: none;
    }

.option-card:not([open]) .option-card-header:hover {
    background: var(--surface2);
}

.option-card-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.option-card-text {
    flex: 1;
    min-width: 0;
}

.option-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: block;
}

.option-card-reason {
    font-size: 12px;
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.option-card-badge {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
}

    .option-card-badge.is-suggested {
        background: rgba(37,99,235,.2);
        color: #93c5fd;
        border-color: #2563eb55;
    }

    .option-card-badge.is-active {
        background: rgba(22,163,74,.2);
        color: #86efac;
        border-color: #16a34a55;
    }

.option-card-body {
    padding: 0 18px 16px;
    border-top: 1px solid var(--border);
}

.option-card[open] .option-card-body {
    padding-top: 14px;
}

.option-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
}

.option-label-hint {
    font-weight: 400;
    color: #475569;
}

.option-textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 10px 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

    .option-textarea:focus {
        border-color: var(--primary);
    }

.option-file-placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
}

.option-file-icon {
    font-size: 18px;
}

/* ── File Upload ─────────────────────────────────────────────────────────── */
.file-upload-input {
    display: none;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

    .file-upload-label:hover,
    .file-upload-zone.is-dragging .file-upload-label {
        border-color: #3b82f6;
        background: rgba(59, 130, 246, 0.06);
        color: var(--text);
    }

.file-upload-icon {
    font-size: 18px;
}

.file-upload-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-upload-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
}

.file-upload-item-icon {
    flex-shrink: 0;
}

.file-upload-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-item-size {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 11px;
}

.file-existing-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.file-existing-hint {
    font-size: 12px;
    color: var(--muted);
    flex-basis: 100%;
}

.file-existing-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text);
}

.refine-footer {
    display: flex;
    justify-content: flex-end;
}

.refine-submit-btn {
    padding: 11px 28px;
    font-size: 15px;
}

/* ── Language Switcher ───────────────────────────────────────────────────── */

.lang-switcher {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.lang-btn {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

    .lang-btn:hover {
        color: var(--text);
        border-color: var(--border);
    }

    .lang-btn.is-active {
        color: var(--sky);
        border-color: #0e4166;
        background: rgba(56,189,248,.08);
    }

/* ── Confirm Modal ───────────────────────────────────────────────────────── */

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .confirm-modal[hidden] {
        display: none;
    }

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirm-modal.is-open .confirm-backdrop {
    opacity: 1;
}

.confirm-dialog {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 28px 22px;
    width: min(380px, calc(100vw - 32px));
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    transform: scale(0.93) translateY(8px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.confirm-modal.is-open .confirm-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Schritt-Ausgabe-Overlay (kumulierte Ergebnisse bis zum angeklickten Schritt) ────────────── */

.step-output-dialog {
    width: min(720px, calc(100vw - 32px));
    max-height: 80vh;
    text-align: left;
    /* Selbst NICHT scrollen — nur .step-output-modal-body darunter, damit der absolut positionierte
       .modal-close-btn (relativ zu diesem Dialog) beim Scrollen sichtbar an derselben Stelle bleibt,
       statt mit dem Inhalt aus dem Blickfeld zu wandern. */
    display: flex;
    flex-direction: column;
}

.step-output-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}

    .modal-close-btn:hover {
        color: var(--text);
        background: var(--border);
    }

.step-output-entry {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

    .step-output-entry:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .step-output-entry h4 {
        margin: 0 0 8px;
        font-size: 14px;
        color: var(--link);
    }

    .step-output-entry pre {
        white-space: pre-wrap;
        font-size: 13px;
        color: var(--text);
        margin: 0 0 10px;
    }

.confirm-message {
    margin: 0 0 22px;
    font-size: 15px;
    color: var(--text);
    line-height: 1.55;
}

.confirm-dialog.is-success .confirm-message {
    color: #86efac;
}

.confirm-dialog.is-error .confirm-message {
    color: #fca5a5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

    .btn-danger:hover {
        background: #991b1b;
        border-color: var(--fail);
        color: #fecaca;
    }

/* ── Animations ──────────────────────────────────────────────────────────── */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Error page ──────────────────────────────────────────────────────────── */

.error-msg {
    color: var(--fail);
    padding: 24px 0;
}

/* ── Header: User Info ───────────────────────────────────────────────────── */

.site-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.lang-switcher {
    margin-left: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.header-username {
    color: var(--muted);
    margin-right: 8px;
}

.header-admin-badge {
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(37,99,235,.2);
    color: #93c5fd;
    border: 1px solid rgba(37,99,235,.3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.header-admin-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

    .header-admin-link:hover,
    .header-admin-link.is-active {
        color: var(--text);
        border-color: var(--muted);
        background: var(--surface2);
    }

.btn-logout {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}

    .btn-logout:hover {
        color: var(--text);
        border-color: var(--muted);
    }

/* ── Auth Pages (Login / Setup) ──────────────────────────────────────────── */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
}

.auth-card {
    width: min(400px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px 36px;
}

.auth-logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    margin-top:0px;
    text-align: center;
}

.auth-heading {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.auth-intro {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-error {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
    color: #fca5a5;
    font-size: 13px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.auth-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s;
}

    .auth-input:focus {
        border-color: var(--primary);
    }

    /* Zahlenfelder mit min/max (z. B. Whisper-/Piper-Parameter) — Browser-native Validierung
       (:invalid greift wegen min/max/step schon vor dem Absenden) bekommt hier nur eine sichtbare
       Randfarbe, damit ein Wert außerhalb des gültigen Bereichs sofort auffällt statt erst beim
       (serverseitig ohnehin abgelehnten) Speichern-Versuch. */
    .auth-input:invalid {
        border-color: var(--warn);
    }

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 15px;
    margin-top: 4px;
}

/* ── Dashboard: Templates ────────────────────────────────────────────────── */

.section-heading {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.templates-section {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Gesamte Vorlagen-Sektion einklappbar (siehe Index.cshtml) — im geschlossenen Zustand nur
   Überschrift + Icon-Streifen aller Kategorien sichtbar, um in der Sidebar neben Planer/Notizen
   Platz zu sparen. */
.templates-collapsible {
    display: flex;
    flex-direction: column;
    border: none;
}

.templates-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .15s;
}

    .templates-summary::-webkit-details-marker {
        display: none;
    }

    .templates-summary:hover {
        background: var(--surface);
    }

    .templates-summary .section-heading {
        margin-bottom: 0;
    }

.templates-icon-strip {
    display: flex;
    gap: 6px;
    flex: 1;
    font-size: .95rem;
    color: var(--text-muted);
    overflow: hidden;
}

.templates-collapsible[open] > .templates-summary .template-group-chevron {
    transform: rotate(90deg);
}

.templates-body {
    margin-top: 10px;
}

.templates-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.templates-toggle-btn {
    font-size: .75rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font: inherit;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}

    .templates-toggle-btn:hover {
        color: var(--text);
        border-color: var(--text-muted);
    }

.template-group {
    display: flex;
    flex-direction: column;
    border: none;
}

    .template-group + .template-group {
        margin-top: 4px;
    }

.template-group-heading {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .15s, color .15s;
}

    .template-group-heading::-webkit-details-marker {
        display: none;
    }

    .template-group-heading:hover {
        background: var(--surface);
        color: var(--text);
    }

.template-group[open] > .template-group-heading {
    color: var(--text);
}

.template-group-icon {
    font-size: .95rem;
}

.template-group-title {
    flex: 1;
}

.template-group-chevron {
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    transition: transform .2s;
    margin-left: auto;
    transform: rotate(0deg);
}

.template-group[open] > .template-group-heading .template-group-chevron {
    transform: rotate(90deg);
}

.template-group .template-grid {
    margin-top: 6px;
    padding: 0 4px 8px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.template-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    font: inherit;
    color: var(--text);
}

    .template-tile:hover {
        border-color: #3b82f6;
        background: rgba(59,130,246,.06);
        box-shadow: 0 0 8px rgba(59,130,246,.15);
    }

.template-icon {
    font-size: 20px;
    line-height: 1;
}

.template-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

/* ── Dashboard: recent runs ──────────────────────────────────────────────── */

.runs-section {
    margin-top: 36px;
}

.runs-heading {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.runs-empty {
    margin-top: 48px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

/* ── Dashboard: runs search & grouping ───────────────────────────────────── */

.runs-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.run-search-input {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.run-groupby-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor:pointer;
}

.run-group {
    display: flex;
    flex-direction: column;
    border: none;
}

    .run-group + .run-group {
        margin-top: 8px;
    }

.run-group-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

    .run-group-heading::-webkit-details-marker {
        display: none;
    }

.run-group-title {
    flex: 1;
}

.run-group-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface2);
    border-radius: 999px;
    padding: 1px 8px;
}

.run-group-chevron {
    color: var(--muted);
    transition: transform 0.2s;
}

.run-group[open] > .run-group-heading .run-group-chevron {
    transform: rotate(90deg);
}

.run-group-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-left: 2px;
}

.runs-no-results {
    margin-top: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ── Dashboard: Eigene/Team-Workflow-Kacheln ─────────────────────────────────
   Gleiche Farbsprache wie .workflow-preparing-panel (orange) und .step-selection-panel
   (blau) — hier als Sichtbarkeits-Kennzeichnung statt Status-Anzeige wiederverwendet. */

.run-owner-panel {
    border-radius: 14px;
    margin-bottom: 20px;
    overflow: hidden;
}

.run-owner-panel.is-own {
    background: linear-gradient(135deg, #1a1208 0%, #2d1e08 100%);
    border: 2px solid #d97706;
    box-shadow: 0 4px 24px rgba(217,119,6,.2);
}

.run-owner-panel.is-shared {
    background: linear-gradient(135deg, #0c1a35 0%, #082f49 100%);
    border: 2px solid #0ea5e9;
    box-shadow: 0 4px 24px rgba(14,165,233,.18);
}

.run-owner-panel-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

    .run-owner-panel-heading::-webkit-details-marker {
        display: none;
    }

.run-owner-panel.is-own .run-owner-panel-title {
    color: #fef3c7;
}

.run-owner-panel.is-shared .run-owner-panel-title {
    color: #bae6fd;
}

.run-owner-panel-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
}

.run-owner-panel-count {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: inherit;
}

.run-owner-panel-chevron {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.2s;
    transform: rotate(0deg);
}

.run-owner-panel[open] > .run-owner-panel-heading .run-owner-panel-chevron {
    transform: rotate(90deg);
}

.run-owner-panel-body {
    padding: 0 20px 20px;
}

/* ── Markdown artifact content ───────────────────────────────────────────── */

.artifact-md-content {
    padding: 4px 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text);
}

    .artifact-md-content h1,
    .artifact-md-content h2,
    .artifact-md-content h3,
    .artifact-md-content h4 {
        margin: 20px 0 10px;
        font-weight: 700;
        line-height: 1.3;
        color: #e2e8f0;
    }

    .artifact-md-content h1 {
        font-size: 1.4em;
    }

    .artifact-md-content h2 {
        font-size: 1.2em;
        border-bottom: 1px solid var(--border);
        padding-bottom: 6px;
    }

    .artifact-md-content h3 {
        font-size: 1.05em;
    }

    .artifact-md-content p {
        margin: 0 0 12px;
    }

    .artifact-md-content ul,
    .artifact-md-content ol {
        margin: 0 0 12px;
        padding-left: 24px;
    }

    .artifact-md-content li {
        margin-bottom: 4px;
    }

    .artifact-md-content code {
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 4px;
        padding: 1px 6px;
        font-size: 0.88em;
        font-family: 'Consolas', 'Cascadia Code', monospace;
        color: var(--link);
    }

    .artifact-md-content pre {
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 14px 16px;
        overflow-x: auto;
        margin: 0 0 14px;
    }

        .artifact-md-content pre code {
            background: none;
            border: none;
            padding: 0;
            font-size: 13px;
            color: var(--text);
        }

    .artifact-md-content blockquote {
        border-left: 3px solid var(--border);
        margin: 0 0 12px;
        padding: 4px 0 4px 16px;
        color: var(--muted);
    }

    .artifact-md-content table {
        border-collapse: collapse;
        width: 100%;
        margin-bottom: 14px;
        font-size: 13px;
    }

    .artifact-md-content th,
    .artifact-md-content td {
        border: 1px solid var(--border);
        padding: 6px 12px;
        text-align: left;
    }

    .artifact-md-content th {
        background: var(--surface2);
        font-weight: 600;
    }

    .artifact-md-content a {
        color: var(--link);
    }

        .artifact-md-content a:hover {
            color: var(--text);
        }

    .artifact-md-content hr {
        border: none;
        border-top: 1px solid var(--border);
        margin: 18px 0;
    }

/* ── Admin Pages ─────────────────────────────────────────────────────────── */

.admin-page {
    margin: 40px;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.admin-heading {
    margin: 0 0 4px;
    font-size: 1.5rem;
    color: var(--text);
}

.admin-team-name {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.users-table-wrap {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .users-table th {
        text-align: left;
        padding: 10px 14px;
        color: var(--muted);
        font-weight: 600;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        border-bottom: 1px solid var(--border);
    }

    .users-table td {
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

.user-row:last-child td {
    border-bottom: none;
}

.user-row.is-pending td {
    color: var(--muted);
}

.user-username {
    font-weight: 600;
    align-items: center;
    gap: 8px;
}

.user-you-badge {
    font-size: 10px;
    font-weight: 700;
    background: #0c4a6e;
    color: #7dd3fc;
    border-radius: 4px;
    padding: 2px 6px;
    text-transform: uppercase;
}

.agent-default-badge {
    font-size: 10px;
    font-weight: 700;
    background: #14532d;
    color: #86efac;
    border-radius: 4px;
    padding: 2px 6px;
    text-transform: uppercase;
}

.agent-test-result {
    display: block;
    min-height: 14px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .agent-test-result.is-ok {
        color: #86efac;
    }

    .agent-test-result.is-fail {
        color: #fca5a5;
    }

.agent-tags-cell {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-config-row {
    opacity: .75;
}

    .agent-config-row:hover {
        opacity: 1;
    }

.agent-test-btn {
    color: #93c5fd;
    border: 1px solid rgba(37,99,235,.4);
    font-size: 15px;
    font-weight: 600;
    background: #0c4a6e;
    color: #7dd3fc;
    border-radius: 4px;
    padding: 2px 6px;
    text-transform: uppercase;
}

    .agent-test-btn:hover {
        background: rgba(37,99,235,.3);
        color: #bfdbfe;
        border-color: #3b82f6;
    }

    .agent-test-btn.is-ok {
        background: rgba(34,197,94,.18);
        color: #86efac;
        border-color: rgba(34,197,94,.5);
    }

        .agent-test-btn.is-ok:hover {
            background: rgba(34,197,94,.3);
            border-color: #22c55e;
        }

    .agent-test-btn.is-fail {
        background: rgba(239,68,68,.18);
        color: #fca5a5;
        border-color: rgba(239,68,68,.5);
    }

        .agent-test-btn.is-fail:hover {
            background: rgba(239,68,68,.3);
            border-color: #ef4444;
        }

.admin-default-agent-hint {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

    .admin-default-agent-hint.is-missing {
        color: #fbbf24;
    }

.user-role-badge {
    font-size: 11px;
    font-weight: 700;
    border-radius: 5px;
    padding: 3px 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

    .user-role-badge.role-admin {
        background: #1e1b4b;
        color: #a5b4fc;
        border: 1px solid #4338ca;
    }

    .user-role-badge.role-teamadmin {
        background: #082f49;
        color: #7dd3fc;
        border: 1px solid #0369a1;
    }

    .user-role-badge.role-user {
        background: var(--surface2);
        color: var(--muted);
    }

.user-last-seen {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.user-status-badge {
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    padding: 3px 8px;
    white-space: nowrap;
}

    .user-status-badge.is-active {
        background: #052e16;
        color: #4ade80;
        border: 1px solid #166534;
    }

    .user-status-badge.is-pending {
        background: #422006;
        color: #fb923c;
        border: 1px solid #92400e;
    }

.user-delete-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

    .user-delete-btn:hover {
        background: #450a0a;
        color: #fca5a5;
        border-color: var(--fail);
    }

/* ── Planner (Kalender & Aufgaben) ───────────────────────────────────────── */

.planner-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.planner-month-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 160px;
    text-align: center;
}

.planner-completed-title {
    text-decoration: line-through;
    color: var(--muted);
}

.planner-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.planner-weekday-header {
    background: var(--surface2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    padding: 8px 4px;
}

.planner-day {
    background: var(--surface);
    min-height: 110px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .planner-day.is-outside-month {
        opacity: 0.45;
    }

    .planner-day.is-today {
        box-shadow: inset 0 0 0 2px var(--sky, #38bdf8);
    }

.planner-day-number {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.planner-item-pill {
    display: block;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--text);
    background: var(--surface2);
    border-left: 3px solid var(--muted);
}

    .planner-item-pill.priority-low {
        border-left-color: var(--ok);
    }

    .planner-item-pill.priority-medium {
        border-left-color: var(--warn);
    }

    .planner-item-pill.priority-high {
        border-left-color: var(--fail);
    }

    .planner-item-pill.is-done {
        text-decoration: line-through;
        opacity: 0.6;
    }

.planner-more {
    font-size: 11px;
    color: var(--muted);
}

.planner-priority-badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
}

    .planner-priority-badge.priority-low {
        color: var(--ok);
    }

    .planner-priority-badge.priority-medium {
        color: var(--warn);
    }

    .planner-priority-badge.priority-high {
        color: var(--fail);
    }

.planner-visibility-badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
}

    .planner-visibility-badge.is-team {
        color: var(--sky, #38bdf8);
    }

.planner-widget-section {
    margin-top: 36px;
}

.planner-due-cell {
    white-space: nowrap;
    font-size: 13px;
}

.planner-no-due {
    color: var(--muted);
}

/* Offene Einträge: gleiches orangenes Panel wie .workflow-preparing-panel (Workflow-Analyse). */
.planner-panel-open {
    border-width: 2px;
    border-color: #d97706;
    box-shadow: 0 4px 24px rgba(217,119,6,.2);
}

    .planner-panel-open .refine-summary {
        background: linear-gradient(135deg, #1a1208 0%, #2d1e08 100%);
        color: #fef3c7;
    }

    .planner-panel-open .refine-body {
        background: linear-gradient(135deg, #1a1208 0%, #2d1e08 100%);
    }

/* Erledigt: gleiches blaues Panel wie .step-selection-panel (MSAF-Style). */
.planner-panel-completed {
    border-width: 2px;
    border-color: #0ea5e9;
    box-shadow: 0 4px 24px rgba(14,165,233,.18);
}

    .planner-panel-completed .refine-summary {
        background: linear-gradient(135deg, #0c1a35 0%, #082f49 100%);
        color: var(--text);
    }

    .planner-panel-completed .refine-body {
        background: linear-gradient(135deg, #0c1a35 0%, #082f49 100%);
    }

.planner-grid.dashboard-calendar {
    cursor: pointer;
}

    .planner-grid.dashboard-calendar .planner-day {
        min-height: 56px;
    }

    .planner-grid.dashboard-calendar .planner-day:hover {
        background: var(--surface2);
    }

.planner-widget-cta {
    margin-bottom: 10px;
    display: inline-flex;
}

/* ── Notizverwaltung ─────────────────────────────────────────────────────── */

.notes-widget-section {
    margin-top: 36px;
}

.notes-empty {
    color: var(--muted);
    font-size: 14px;
}

.notes-preview-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-preview-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--surface2);
    text-decoration: none;
    color: var(--text);
}

    .note-preview-card:hover {
        background: var(--surface);
        box-shadow: inset 0 0 0 1px var(--border);
    }

.note-preview-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview-snippet {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-widget-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* ── Team-Chat ───────────────────────────────────────────────────────────────── */

.teamchat-participant-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.teamchat-participant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.teamchat-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.teamchat-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.teamchat-conversation-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.teamchat-conversation-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}

    .teamchat-conversation-item:hover,
    .teamchat-conversation-item.is-active {
        background: var(--surface2);
        border-color: var(--muted);
    }

.teamchat-conversation-participants {
    font-weight: 600;
    font-size: 14px;
}

.teamchat-conversation-preview {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teamchat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 16px;
    min-height: 400px;
}

.teamchat-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.teamchat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 420px;
}

.teamchat-msg {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface2);
    font-size: 14px;
}

    .teamchat-msg.own {
        align-self: flex-end;
        background: var(--primary);
        color: #fff;
    }

.teamchat-msg-sender {
    display: block;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.75;
    margin-bottom: 2px;
}

.teamchat-input-row {
    display: flex;
    gap: 8px;
}

    .teamchat-input-row .refine-input {
        flex: 1;
    }

@media (max-width: 900px) {
    .teamchat-layout {
        flex-direction: column;
    }

    .teamchat-sidebar {
        width: 100%;
    }
}

.note-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.note-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

    .note-card-title:hover {
        color: var(--sky, #38bdf8);
    }

.note-card-snippet {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-meta {
    font-size: 11px;
    color: var(--muted);
}

.note-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Notiz-Editor (Rich-Text-Toolbar, WordPad-Umfang) ───────────────────────
   Toolbar-Buttons/-Selects übernehmen bewusst die .btn-ghost-Optik, der Editor-
   Rahmen die .auth-input-Optik — keine neuen Farben, siehe Projektkonvention. */

.note-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    background: var(--surface2);
}

.note-editor-btn,
.note-editor-select {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.note-editor-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    line-height: 1;
}

    .note-editor-btn:hover {
        color: var(--text);
        border-color: var(--muted);
        background: var(--surface);
    }

.note-editor-select {
    height: 30px;
    padding: 0 6px;
}

.note-editor-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 2px 2px;
}

.note-editor-color-label {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

.note-editor-color {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.note-editor {
    min-height: 260px;
    border-radius: 0 0 8px 8px;
    border-top: none;
    line-height: 1.6;
    overflow-y: auto;
}

    .note-editor:focus {
        border-color: var(--primary);
    }

    .note-editor ul,
    .note-editor ol {
        padding-left: 28px;
        margin: 8px 0;
    }

    .note-editor h1,
    .note-editor h2,
    .note-editor h3 {
        margin: 14px 0 8px;
    }

/* ── Role Choice Cards ───────────────────────────────────────────────────── */

.role-choice-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.role-choice {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

    .role-choice input[type=radio] {
        display: none;
    }

    .role-choice span {
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
    }

    .role-choice small {
        font-size: 12px;
        color: var(--muted);
    }

    .role-choice.is-selected {
        border-color: #0ea5e9;
        background: var(--surface2);
    }

        .role-choice.is-selected span {
            color: var(--link);
        }

/* ── Auth pages extras ───────────────────────────────────────────────────── */

.auth-success {
    background: #052e16;
    border: 1px solid #166534;
    color: #4ade80;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 8px;
}

.auth-success-hint {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.5;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}

    .auth-switch a {
        color: #38bdf8;
        text-decoration: none;
    }

        .auth-switch a:hover {
            text-decoration: underline;
        }

/* ── Invite form ─────────────────────────────────────────────────────────── */

.invite-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Monitor / Scheduling ────────────────────────────────────────────────── */

.monitors-section {
    margin-top: 40px;
}

    .monitors-section .monitors-heading {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: .06em;
        margin-bottom: 12px;
    }

.monitors-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.monitor-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

    .monitor-item.is-disabled {
        opacity: .5;
    }

.monitor-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.monitor-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monitor-interval-badge {
    font-size: .72rem;
    background: #1e3a5f;
    color: #93c5fd;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.monitor-meta {
    display: flex;
    gap: 16px;
    font-size: .78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.monitor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.monitor-feed-btn {
    font-size: .8rem;
    padding: 4px 12px;
}

.monitor-feed-pending {
    font-size: .78rem;
    color: var(--text-muted);
    font-style: italic;
}

.monitor-slug {
    font-size: .72rem;
    color: var(--text-muted);
    font-family: monospace;
}

.monitor-no-change {
    color: var(--text-muted);
    font-style: italic;
}

/* Refine page — monitor scheduling card */
.monitor-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.monitor-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.monitor-interval-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.monitor-interval-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-muted);
    background: transparent;
    transition: background .15s, color .15s, border-color .15s;
}

    .monitor-interval-btn input[type="radio"] {
        display: none;
    }

    .monitor-interval-btn.is-selected,
    .monitor-interval-btn:has(input:checked) {
        background: #1e3a5f;
        color: #93c5fd;
        border-color: #2563eb;
    }

.monitor-feed-url {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
}

.monitor-feed-label {
    color: var(--text-muted);
}

.monitor-feed-link {
    color: var(--link);
    text-decoration: none;
    font-family: monospace;
}

    .monitor-feed-link:hover {
        text-decoration: underline;
    }

/* Monitor-Toggle-Schalter */
.monitor-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

    .monitor-toggle-label input[type="checkbox"] {
        display: none;
    }

.monitor-toggle-track {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--border);
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}

.monitor-toggle-label input:checked ~ .monitor-toggle-track {
    background: #2563eb;
}

.monitor-toggle-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: left .2s;
}

.monitor-toggle-label input:checked ~ .monitor-toggle-track .monitor-toggle-thumb {
    left: 21px;
}

.monitor-toggle-text {
    font-size: .9rem;
    color: var(--text-muted);
}

.monitor-toggle-label input:checked ~ .monitor-toggle-text,
.monitor-toggle-label:has(input:checked) .monitor-toggle-text {
    color: var(--text);
}

#monitor-detail-fields {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Breites Layout: Templates rechts neben Prompt/Runs */
@media (min-width: 1260px) {
    .site-main {
        /*max-width: 1240px;*/
    }

    .dashboard {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        column-gap: 36px;
        align-items: start;
    }

    /* Linke Spalte: alle Hauptbereiche */
    .prompt-section,
    .runs-section,
    .runs-empty,
    .monitors-section {
        grid-column: 1;
    }

    /* Rechte Spalte: EIN Grid-Element (Templates + Kalender-Vorschau gestapelt im normalen Fluss,
       ohne Sticky/Overflow-Tricks — beide bleiben dadurch immer auf einer Ebene ohne
       Überlappung beim Scrollen), damit der Kalender immer direkt unter den Vorlagen bleibt.
       Spannt mehrere Zeilen: teilt sich .dashboard-sidebar sonst mit .prompt-section (links) EINE
       Grid-Zeile, zwingt deren gemeinsame Zeilenhöhe auf die (meist deutlich größere) Sidebar-Höhe
       hoch — dadurch würden Runs/Monitore links erst unterhalb des Kalenders beginnen. Der Span
       verteilt die Sidebar-Höhe stattdessen über mehrere Zeilen, sodass Zeile 1 links normal kurz
       bleibt (Größe von .prompt-section) und Runs direkt danach folgen. */
    .dashboard-sidebar {
        grid-column: 2;
        grid-row: 1 / span 10;
    }

    .templates-section {
        margin-top: 0;
    }

        /* Im schmalen Sidebar 2 Spalten reichen aus */
        .templates-section .template-grid {
            grid-template-columns: repeat(2, 1fr);
        }

    .dashboard-sidebar .planner-widget-section,
    .dashboard-sidebar .notes-widget-section {
        margin-top: 24px;
    }
}

@media (max-width: 640px) {
    .site-main {
        padding: 16px 12px 60px;
    }

    .step-toggle-grid {
        grid-template-columns: 1fr;
    }

    .step-status-grid {
        grid-template-columns: 1fr;
    }

    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .workflow-preparing-panel,
    .workflow-executing-panel {
        flex-direction: column;
    }

    .header-user .header-username {
        display: none;
    }

    .role-choice-group {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
    }
}

/* ── Chat Agent ──────────────────────────────────────────────────────────── */

.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 16px rgba(37,99,235,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, box-shadow .15s;
    font-family: inherit;
}

    .chat-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 24px rgba(37,99,235,.6);
    }

    /* Dezenter Heiligenschein-Effekt hinter dem Button — dieselbe Orange-Tönung
       wie das "Workflow wird analysiert"-Panel (.workflow-preparing-spinner). */
    .chat-fab::before {
        content: '';
        position: absolute;
        inset: -8px;
        border-radius: 50%;
        background: radial-gradient(circle, #0c4a6e 0%, #0c4a6e 70%);
        z-index: -1;
        pointer-events: none;
        animation: chat-fab-halo 2.6s ease-in-out infinite;
    }

@keyframes chat-fab-halo {
    0%, 100% { opacity: .35; transform: scale(.7); }
    50%      { opacity: .65; transform: scale(.8); }
}

@media (prefers-reduced-motion: reduce) {
    .chat-fab::before {
        animation: none;
        opacity: .5;
    }
}

.chat-panel {
    position: fixed;
    bottom: 5.2rem;
    right: 1.5rem;
    width: 22rem;
    height: 34rem;
    min-width: 20rem;
    min-height: 22.5rem;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .875rem;
    display: flex;
    flex-direction: column;
    z-index: 199;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(.97);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

    .chat-panel.is-open {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

.chat-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 1rem;
    height: 1rem;
    cursor: nwse-resize;
    z-index: 1;
    background:
        linear-gradient(135deg, transparent 0 40%, var(--border) 40% 46%, transparent 46% 54%, var(--border) 54% 60%, transparent 60%);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
}

.chat-title {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: .1rem;
}

.chat-new-btn,
.chat-pin-btn,
.chat-history-btn,
.chat-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: .25rem .4rem;
    border-radius: 4px;
    transition: background .15s, color .15s;
}

    .chat-new-btn:hover,
    .chat-pin-btn:hover,
    .chat-history-btn:hover,
    .chat-close:hover {
        color: var(--text);
        background: var(--border);
    }

    .chat-pin-btn.is-active {
        color: var(--primary);
    }

.chat-history-panel {
    position: absolute;
    top: 2.75rem;
    left: .75rem;
    right: .75rem;
    max-height: 60%;
    overflow-y: auto;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: .375rem;
}

    /* Author-Style "display: flex" oben überschreibt sonst das hidden-Attribut (UA-Default
       display:none hat geringere Priorität als jede Autoren-Regel) — ohne das bliebe der Panel-
       Rahmen als leere Box sichtbar, auch wenn keine Historie vorhanden ist. */
    .chat-history-panel[hidden] {
        display: none;
    }

.chat-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border-radius: .375rem;
    padding: .1rem .1rem .1rem .5rem;
    transition: background .15s;
}

    .chat-history-item:hover {
        background: var(--border);
    }

.chat-history-item-select {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: none;
    border: none;
    padding: .3rem 0;
    font-size: .78rem;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    min-width: 0;
}

.chat-history-item-delete {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .75rem;
    padding: .3rem .4rem;
    border-radius: .3rem;
    flex-shrink: 0;
}

    .chat-history-item-delete:hover {
        color: var(--fail);
        background: rgba(239,68,68,.15);
    }

.chat-history-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-item-date {
    flex-shrink: 0;
    color: var(--muted);
    font-size: .7rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: .875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-msg {
    max-width: 88%;
    padding: .5rem .75rem;
    border-radius: .5rem;
    font-size: .84rem;
    line-height: 1.5;
    word-break: break-word;
}

    .chat-msg.is-user {
        align-self: flex-end;
        background: var(--primary);
        color: #fff;
        border-bottom-right-radius: .2rem;
        display: flex;
        align-items: flex-start;
        gap: 6px;
    }

    .chat-msg-avatar {
        margin-right: 0;
    }

    .chat-msg.is-bot {
        align-self: flex-start;
        background: var(--surface2);
        color: var(--text);
        border-bottom-left-radius: .2rem;
    }

    .chat-msg.is-typing {
        opacity: .5;
        font-style: italic;
    }

.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    padding: .5rem 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

    .chat-chips:empty {
        display: none;
    }

.chat-chip {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: .25rem .65rem;
    font-size: .76rem;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

    .chat-chip:hover {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

.chat-input-row {
    display: flex;
    gap: .5rem;
    padding: .625rem .875rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: .375rem;
    padding: .45rem .65rem;
    font-size: .84rem;
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
}

    .chat-input:focus {
        border-color: var(--primary);
    }

    .chat-input::placeholder {
        color: var(--muted);
    }

.chat-send-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: .375rem;
    width: 2.25rem;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter .15s;
    flex-shrink: 0;
}

    .chat-send-btn:hover {
        filter: brightness(1.15);
    }

    .chat-send-btn:disabled {
        opacity: .45;
        cursor: default;
    }

.chat-mic-btn {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: .375rem;
    width: 2.25rem;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter .15s, background .15s, border-color .15s;
    flex-shrink: 0;
}

    .chat-mic-btn:hover {
        filter: brightness(1.15);
    }

    .chat-mic-btn:disabled {
        opacity: .45;
        cursor: default;
    }

    /* Dauerzuhören aktiv (VAD wartet auf den nächsten Befehl) — ruhiges Blau, im Unterschied zum
       pulsierenden Rot bei is-recording, damit "an, aber wartet" von "nimmt gerade auf" unterscheidbar bleibt. */
    .chat-mic-btn.is-listening {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
    }

    /* Ein konkreter Befehl wird gerade aufgenommen — deutliches Rot + Puls */
    .chat-mic-btn.is-recording {
        background: #dc2626;
        border-color: #dc2626;
        color: #fff;
        animation: chat-mic-pulse 1.4s ease-in-out infinite;
    }

    .chat-mic-btn.is-processing {
        opacity: .6;
        cursor: wait;
    }

/* Unabhängig vom Mikro-Button — steuert nur, ob Chat-Antworten vorgelesen werden (siehe speech.js) */
.chat-tts-btn {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: .375rem;
    width: 2.25rem;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter .15s, background .15s, border-color .15s;
    flex-shrink: 0;
}

    .chat-tts-btn:hover {
        filter: brightness(1.15);
    }

    .chat-tts-btn.is-active {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
    }

@keyframes chat-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
    50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 2rem);
        right: 1rem;
    }

    .chat-fab {
        bottom: 1rem;
        right: 1rem;
    }
}

/* ── Dokument-Design-Auswahl (Refine-Seite, siehe DocumentThemes) ─────────── */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.theme-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s;
}
.theme-tile:hover { border-color: var(--muted); }
.theme-tile:has(input:checked) { border-color: var(--primary); }

/* Radio unsichtbar, aber fokussierbar (Tastatur-Bedienbarkeit bleibt erhalten) */
.theme-tile input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.theme-tile:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

.theme-swatch {
    position: relative;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
}
.theme-swatch-bar {
    position: absolute;
    left: 8px; right: 8px; bottom: 8px;
    height: 6px;
    border-radius: 3px;
}
.theme-swatch-dot {
    position: absolute;
    top: 8px; left: 8px;
    width: 12px; height: 12px;
    border-radius: 50%;
}

.theme-tile-name { font-size: .85rem; font-weight: 600; }
.theme-tile-desc { font-size: .72rem; color: var(--muted); line-height: 1.3; }

/* ── Suchgefundene Quellen (TaskSourceKind.FoundUrl) — gestrichelt + Akzentton,
      klar unterscheidbar von Nutzer-URLs (Run-Seite und Refine-Vorlaufsblock) ── */
.run-source-chip.run-source-found {
    border-style: dashed;
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}
.run-source-chip.run-source-found:hover {
    background: var(--surface2);
}

.found-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
