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

/* === Dark theme (default) === */
[data-theme="dark"] {
    --bg: #09090b;
    --bg-subtle: #0f0f13;
    --card: #131318;
    --card-hover: #1a1a21;
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(255, 255, 255, 0.1);
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.35);
    --accent-subtle: rgba(124, 58, 237, 0.08);
    --gradient-start: #7c3aed;
    --gradient-end: #3b82f6;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --text-dim: #52525b;
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.25);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.25);
    --warning: #f59e0b;
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-hover: rgba(255, 255, 255, 0.2);
}

/* === Light theme === */
[data-theme="light"] {
    --bg: #f8f9fb;
    --bg-subtle: #ffffff;
    --card: #ffffff;
    --card-hover: #f1f5f9;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-border-hover: rgba(0, 0, 0, 0.14);
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.2);
    --accent-subtle: rgba(124, 58, 237, 0.06);
    --gradient-start: #7c3aed;
    --gradient-end: #3b82f6;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --success: #16a34a;
    --success-glow: rgba(22, 163, 74, 0.15);
    --error: #dc2626;
    --error-glow: rgba(220, 38, 38, 0.15);
    --warning: #d97706;
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --scrollbar-thumb: rgba(0, 0, 0, 0.12);
    --scrollbar-hover: rgba(0, 0, 0, 0.2);
}

:root {
    --sidebar-width: 280px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === App Layout: sidebar + main === */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    background: var(--bg-subtle);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    padding: 20px 16px;
}

.sidebar-header {
    padding: 0 0 20px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 6px var(--accent-glow));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.logo-text {
    font-family: 'Grenze Gotisch', serif;
    font-size: 1.6rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
    text-shadow: none;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.sidebar-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.sidebar-create-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.sidebar-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 10px;
    font-weight: 600;
}

/* Agent list in sidebar */
.agent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.agent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    flex-wrap: wrap;
    color: var(--text-muted);
}

.agent-item:hover {
    background: var(--card);
    color: var(--text);
}

.agent-item.active-agent {
    border-color: var(--card-border-hover);
    background: var(--accent-subtle);
    color: var(--text);
}

.agent-name {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.agent-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
    display: none;
    box-shadow: 0 0 8px var(--success-glow);
}

.active-agent .agent-active-dot {
    display: inline-block;
}

.agent-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.agent-delete-btn {
    background: none;
    color: var(--text-dim);
    border: 1px solid var(--card-border);
    padding: 3px 7px;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
}

.agent-item:hover .agent-delete-btn {
    opacity: 1;
}

.agent-delete-btn:hover {
    color: var(--error);
    border-color: var(--error);
    background: var(--error-glow);
}

.agents-empty {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-align: center;
    padding: 24px 8px;
}

/* Agent tooltip (pipeline info) */
.agent-tooltip {
    display: none;
    width: 100%;
    padding: 8px 0 0;
    font-size: 0.68rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.agent-item:hover .agent-tooltip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}

.agent-tooltip .tip-label {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.58rem;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.agent-tooltip .tip-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
}

/* === Main area === */
.main-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-subtle);
    backdrop-filter: blur(12px);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
}

.hamburger-btn:hover {
    background: var(--card);
    color: var(--text);
}

.top-bar-title {
    font-family: 'Grenze Gotisch', serif;
    font-weight: 600;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.active-agent-badge {
    font-size: 0.72rem;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 500;
    border: 1px solid rgba(124, 58, 237, 0.15);
    letter-spacing: 0.01em;
}

/* Theme toggle */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Show sun icon in dark mode, moon icon in light mode */
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
    max-width: 840px;
    width: 100%;
    margin: 0 auto;
}

/* === Chat === */
.chat-container {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

/* Chat header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 0;
}

.chat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    font-weight: 600;
}

.clear-chat-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.68rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.clear-chat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Chat messages */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
    animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-row.ai {
    align-self: flex-start;
}

.chat-row.interim {
    opacity: 0.4;
}

.chat-row.interim .chat-msg {
    font-style: italic;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar.user {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
}

.chat-avatar.ai {
    background: var(--card-hover);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
}

.chat-msg {
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 10px 14px;
    border-radius: var(--radius);
    word-wrap: break-word;
}

.chat-msg.user {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.ai {
    background: var(--card-hover);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-bottom-left-radius: 4px;
}

.chat-row.metrics {
    justify-content: center;
    padding: 0;
    max-width: 100%;
    align-self: center;
}

.metrics-badge {
    font-size: 0.66rem;
    color: var(--text-dim);
    background: var(--bg-subtle);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 3px 14px;
    letter-spacing: 0.02em;
    font-weight: 500;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.chat-history:empty::after {
    content: "Press the mic button to start talking...";
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
    padding-top: 60px;
}

/* === Pipeline === */
.pipeline-container {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 18px;
}

.pipeline-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 10px;
    font-weight: 600;
}

.pipeline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pipeline-stage {
    font-size: 0.75rem;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-dim);
    transition: all 0.3s;
    font-weight: 500;
    border: 1px solid var(--card-border);
}

.pipeline-stage.active {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 20px var(--accent-glow);
}

.pipeline-arrow {
    color: var(--text-dim);
    font-size: 0.7rem;
    opacity: 0.4;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--error);
    transition: all 0.3s;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

.status-dot.disconnected {
    background: var(--text-dim);
}

/* === Mic / Voice Orb === */
.mic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 0 8px;
    position: relative;
}

.mic-btn {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid var(--card-border-hover);
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    z-index: 2;
}

.mic-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--card-hover);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* Active: streaming — pulsing gradient orb */
.mic-btn.active {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-color: transparent;
    color: #fff;
    box-shadow:
        0 0 30px var(--accent-glow),
        0 0 60px rgba(124, 58, 237, 0.15);
    animation: orbPulse 2s ease-in-out infinite;
}

.mic-btn.active::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    opacity: 0.15;
    animation: orbRing 2s ease-out infinite;
    z-index: -1;
}

.mic-btn.active::after {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    opacity: 0.08;
    animation: orbRing 2s ease-out infinite 0.3s;
    z-index: -2;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes orbRing {
    0% { opacity: 0.2; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Hearing: voice detected — green glow */
.mic-btn.hearing {
    box-shadow:
        0 0 30px var(--success-glow),
        0 0 60px rgba(34, 197, 94, 0.15),
        inset 0 0 20px rgba(34, 197, 94, 0.1);
    border-color: var(--success);
    animation: hearingPulse 0.8s ease-in-out infinite;
}

@keyframes hearingPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px var(--success-glow), 0 0 60px rgba(34,197,94,0.15); }
    50% { transform: scale(1.06); box-shadow: 0 0 40px var(--success-glow), 0 0 80px rgba(34,197,94,0.2); }
}

/* Paused */
.mic-btn.paused {
    background: var(--card);
    color: var(--warning);
    border-color: var(--warning);
    animation: none;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.mic-btn.paused::before,
.mic-btn.paused::after {
    display: none;
}

/* Connecting */
.mic-btn.connecting {
    border-color: transparent;
    background: var(--card);
    color: var(--text-dim);
    cursor: wait;
    animation: none;
}

.mic-btn.connecting::before {
    display: none;
}

.mic-btn.connecting::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

.mic-label {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 12px;
    transition: color 0.2s;
    font-weight: 500;
}

.mic-label.streaming {
    color: var(--text-muted);
}

.mic-label.interrupted {
    color: var(--warning);
    animation: interrupted-flash 0.4s ease-in-out 2;
}

@keyframes interrupted-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.disconnect-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
    color: var(--error);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: absolute;
    right: calc(50% - 80px);
    top: 50%;
    transform: translateY(-50%);
}

.disconnect-btn:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
    box-shadow: 0 0 16px var(--error-glow);
}

/* === Controls === */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.control-group select {
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 7px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

.control-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    z-index: 2000;
    transition: opacity 0.3s;
    font-weight: 500;
    backdrop-filter: blur(12px);
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* === Scrollbar === */
.chat-history::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.chat-history::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.chat-history::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.chat-history::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

/* === Activation loading overlay === */
.activation-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activation-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 48px 56px;
    text-align: center;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.activation-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.activation-agent-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.activation-message {
    font-size: 0.82rem;
    color: var(--text-dim);
    min-height: 1.2em;
    transition: opacity 0.3s;
}

/* === Wizard Overlay === */
.wizard-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wizard-overlay.hidden {
    display: none;
}

.wizard-modal {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    width: 100%;
    max-width: 75vw;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5vh 1.5vw;
    border-bottom: 1px solid var(--card-border);
}

.wizard-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.wizard-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    line-height: 1;
    transition: all 0.15s;
}

.wizard-close:hover {
    background: var(--card-hover);
    color: var(--text);
}

/* Step indicator */
.wizard-steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5vw;
    padding: 1.5vh 1.5vw;
    border-bottom: 1px solid var(--card-border);
}

.wizard-step-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 500;
}

.wizard-step-indicator .step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--card-border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all 0.3s;
}

.wizard-step-indicator.active .step-num {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.wizard-step-indicator.active {
    color: var(--text);
}

.wizard-step-indicator.completed .step-num {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.wizard-step-connector {
    width: 28px;
    height: 2px;
    background: var(--card-border-hover);
    border-radius: 1px;
}

/* Step content */
.wizard-body {
    padding: 2vh 1.5vw;
    flex: 1;
    overflow-y: auto;
}

.wizard-step-content.hidden {
    display: none;
}

.wizard-step-title {
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text);
}

/* Model cards grid */
.wizard-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12vw, 1fr));
    gap: 0.7vw;
}

.wizard-model-card {
    background: var(--bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1vh 0.8vw;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-model-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    background: var(--card-hover);
}

.wizard-model-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    background: var(--accent-subtle);
}

.wizard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.wizard-card-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
}

.wizard-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.wizard-badge.local {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.wizard-badge.cloud {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.wizard-hf-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-xs);
    padding: 0.6vh 1vw;
    margin-top: 1vh;
    line-height: 1.5;
}

.wizard-hf-notice strong {
    color: var(--text);
}

.wizard-card-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.wizard-model-size {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Inline config (appears below cards when model selected) */
.wizard-inline-config {
    margin-top: 1.2vh;
}

.wizard-inline-config:empty {
    margin-top: 0;
}

.wizard-config-section {
    margin-bottom: 1.5vh;
}

.wizard-type-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 600;
}

.wizard-field-group {
    margin-bottom: 1vh;
}

.wizard-field-group.hidden {
    display: none;
}

.wizard-field-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.wizard-env-hint {
    font-size: 0.68rem;
    color: var(--warning);
    margin-left: 8px;
}

.wizard-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 0.8vh 0.7vw;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.wizard-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

select.wizard-input {
    cursor: pointer;
}

/* Agent name input */
.wizard-name-group {
    margin-bottom: 1.5vh;
}

.wizard-name-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.wizard-name-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 1vh 0.8vw;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.wizard-name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.wizard-system-prompt-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 1vh 0.8vw;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.wizard-system-prompt-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Transport toggle */
.wizard-transport-toggle {
    display: flex;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 6px;
}

.transport-opt {
    flex: 1;
    padding: 0.8vh 1vw;
    border: none;
    background: var(--bg);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.transport-opt:not(:last-child) {
    border-right: 1px solid var(--card-border);
}

.transport-opt:hover {
    background: var(--card-hover);
    color: var(--text-muted);
}

.transport-opt.selected {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
}

.wizard-transport-hint {
    font-size: 0.68rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Review summary */
.wizard-review-summary {
    display: flex;
    flex-direction: row;
    gap: 0.8vw;
    margin-bottom: 1.5vh;
}

.wizard-review-card {
    flex: 1;
    min-width: 0;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 1vh 0.8vw;
    text-align: center;
}

.wizard-review-card-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 2px;
}

.wizard-review-card-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.wizard-review-card-detail {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Progress (Step 4 creation) */
.wizard-progress-section {
    margin-bottom: 1.5vh;
}

.wizard-progress-section.hidden {
    display: none;
}

.wizard-progress-track {
    width: 100%;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1.2vh;
}

.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

.wizard-progress-log {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 1vh 0.7vw;
    max-height: 25vh;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.wizard-log-line {
    white-space: pre-wrap;
    word-break: break-all;
}

/* Wizard buttons */
.wizard-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5vw;
    padding: 1.5vh 1.5vw;
    border-top: 1px solid var(--card-border);
}

.wizard-footer.hidden {
    display: none;
}

.wizard-btn {
    padding: 0.8vh 1.6vw;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.wizard-btn.hidden {
    display: none;
}

.wizard-btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
}

.wizard-btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.wizard-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.wizard-btn-secondary {
    background: var(--card-hover);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
}

.wizard-btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

/* Wizard misc */
.wizard-loading,
.wizard-error {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.wizard-error {
    color: var(--error);
}

.wizard-inline-error {
    background: var(--error-glow);
    color: var(--error);
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    margin-bottom: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* === Light mode tweaks === */
[data-theme="light"] .logo-icon {
    filter: none;
}

[data-theme="light"] .logo-text {
    filter: none;
}

[data-theme="light"] .sidebar {
    box-shadow: 1px 0 0 var(--card-border);
}

[data-theme="light"] .chat-container,
[data-theme="light"] .pipeline-container {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chat-msg.user {
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

[data-theme="light"] .mic-btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .toast.success {
    background: rgba(22, 163, 74, 0.1);
}

[data-theme="light"] .toast.error {
    background: rgba(220, 38, 38, 0.1);
}

/* === Mobile (<=768px) === */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        top: 0;
        width: var(--sidebar-width);
        z-index: 500;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 499;
    }

    .sidebar-overlay.hidden {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .top-bar-title {
        display: block;
    }

    .main-content {
        padding: 14px;
    }

    .mic-btn {
        width: 76px;
        height: 76px;
    }

    .pipeline {
        gap: 4px;
    }

    .pipeline-stage {
        font-size: 0.68rem;
        padding: 4px 10px;
    }

    .wizard-modal {
        max-width: 95vw;
    }

    .wizard-cards-row {
        grid-template-columns: 1fr;
    }
}
