/* ==========================================================================
   Stoa Design System & Stylesheet (Step 3)
   ========================================================================== */

/* 1. Core Variables & Design Tokens */
:root {
    /* Color Palette */
    --bg-primary:     #FFFFFF;
    --bg-secondary:   #F7F7F5;
    --bg-hover:       #F0F0EC;
    /* R10 FINAL (entry r92-6-signed-accent-purple, Gabriel 2026-06-12):
       the accent IS the logo purple — one signal, brand-true. Was blue
       #378ADD/#E6F1FB/#185FA5. Dark-mode accent takes the lighter stop. */
    --accent:         #534AB7;
    --accent-soft:    #EEEDFE;
    --accent-dark:    #3C3489;
    --border:         #E2E8F0;
    --text-primary:   #1A1A18;
    --text-secondary: #5F5E5A;
    --text-muted:     #9B9B94;
    --success:        #1D9E75;
    --success-bg:     #E1F5EE;
    --error:          #E24B4A;
    --error-bg:        #FCE8E6;

    /* Architecture-view category colors — [EXT] PLACEHOLDERS for Gabriel to tune.
       Dedicated tokens: none reuse --accent/--success/--error (those keep their
       meaning). Color classifies a node's type; it never decorates. */
    --cat-ui:          #6B8BB5;   /* UI / frontend — muted blue-grey, distinct from accent */
    --cat-service:     #4F9C92;   /* Service / backend — muted teal, not the success green */
    --cat-data:        #C2923F;   /* Data / storage — muted amber */
    --cat-external:    #9B9B94;   /* External / third-party — ~text-muted */
    --cat-integration: #8B6FB0;   /* Integration / API — muted violet */

    /* Shadows & Elevation */
    --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg:      0 12px 32px rgba(0, 0, 0, 0.12);

    /* Animation Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-med:  0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Hierarchy (full scale — see STOA_DESIGN_LANGUAGE.md §Tokens)
       dropdown(100) < popup(500) < panel(700) < overlay(1000)
       < surface(1300) < modal(1500) < chrome(2000) < alert(9000) */
    --z-dropdown:     100;
    --z-popup:        500;
    --z-panel:        700;
    --z-overlay:      1000;
    --z-surface:      1300;
    --z-modal:        1500;
    --z-chrome:       2000;
    --z-alert:        9000;

    /* Chat surface — warm paper palette (STOA_DESIGN_LANGUAGE.md §Tokens) */
    --chat-bg:        #F7F4EF;
    --chat-bubble:    #EDE7DC;
    --chat-input-bg:  #EFEBE4;
    --chat-border:    #DDD7CE;
    --chat-divider:   #E4DDD2;
    --on-accent:      #FFFFFF;
}

/* System Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary:     #121212;
        --bg-secondary:   #1C1C1A;
        --bg-hover:       #2A2A28;
        --border:         #2A2D31;
        --text-primary:   #ECECE9;
        --text-secondary: #A3A39F;
        --text-muted:     #73736E;
        /* R10 FINAL: dark-mode accent = the lighter purple stop (contrast holds) */
        --accent:         #7F77DD;
        --accent-soft:    #26215C;
        --accent-dark:    #AFA9EC;
        --success-bg:     #122D24;
        --error-bg:        #2D1C1B;
        /* Chat surface — warm-dark variants (chat was stuck light in dark mode
           while these were hardcoded) */
        --chat-bg:        #1B1A17;
        --chat-bubble:    #2A2722;
        --chat-input-bg:  #242220;
        --chat-border:    #3A362E;
        --chat-divider:   #2C2A25;
        /* Architecture-view category colors — dark variants ([EXT] placeholders) */
        --cat-ui:          #7E9CC4;
        --cat-service:     #5FB1A6;
        --cat-data:        #D2A557;
        --cat-external:    #8A8A84;
        --cat-integration: #A488C8;
    }
}

/* 2. Global Reset & Base Elements */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    overflow: hidden;
    font-size: 14px;
    line-height: 1.55;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Code Typography */
code, pre, .code-font {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
}

/* 3. Layout Structure */
#appContainer {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    overflow: hidden;
}

/* ==========================================================================
   ONBOARDING LAYER
   ========================================================================== */
.onboarding-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    z-index: var(--z-overlay);
    padding: 24px;
}

.onboarding-card {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 560px;
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Left Panel */
.onboarding-left {
    width: 38%;
    background-color: var(--bg-secondary);
    border-right: 0.5px solid var(--border);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.onboarding-left-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.onboarding-left-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
}

.onboarding-hero {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
    letter-spacing: -0.3px;
}

.onboarding-hero-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.45;
    letter-spacing: -0.2px;
    margin-top: -16px; /* sits tight under the hero inside the 24px-gap column */
}

.onboarding-pillars {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.onboarding-pillars li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
}

.onboarding-pillars li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

.onboarding-left-footer {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Step navigation in left panel */
.onboarding-step-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

.step-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.step-nav-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.step-nav-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.step-nav-item.active .step-nav-num {
    background-color: var(--accent);
    color: white;
}

.step-nav-item.active .step-nav-label {
    color: var(--text-primary);
    font-weight: 600;
}

.step-nav-item.done .step-nav-num {
    background-color: var(--success);
    color: white;
}

.step-nav-item.done .step-nav-num::after {
    content: '✓';
    font-size: 10px;
}

.step-nav-item.done .step-nav-num {
    font-size: 0; /* hide number, show checkmark via ::after */
}

/* Project creation — "meet your team" screen */
.creation-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    flex: 1;
    padding: 8px 0;
}

.creation-headline {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    text-align: center;
}

.creation-agents {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.creation-agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 0.5px solid var(--border);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.creation-agent-row.visible {
    opacity: 1;
    transform: translateY(0);
}

.creation-agent-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.creation-agent-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.creation-agent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.creation-agent-role {
    font-size: 11px;
    color: var(--text-muted);
}

.creation-agent-status {
    flex-shrink: 0;
}

.creation-ready-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.creation-ready-text.visible {
    opacity: 1;
}

/* Right Panel */
.onboarding-right {
    width: 62%;
    padding: 44px 52px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

/* Step progress dots */
.onboarding-step-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 32px;
}

.step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--border);
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    display: inline-block;
}

.step-dot.active {
    background-color: var(--accent);
    transform: scale(1.3);
}

.step-dot.done {
    background-color: var(--success);
}

.step-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: fadeIn var(--transition-med) forwards;
}

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

.step-headline {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.step-subhead {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 28px;
}

/* Step 2 section labels */
.step2-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.step2-import-link {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}
.step2-import-link:hover {
    text-decoration: underline;
}

/* Step 3 skip hint */
.step3-skip-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Loading bridge */
.loading-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex: 1;
}


.step-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Info Box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background-color: var(--accent-soft);
    border: 0.5px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: var(--accent-dark);
    line-height: 1.5;
}

.info-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    outline: none;
}

/* Keyboard focus — visible ring on all focusable controls (a11y).
   :focus-visible only fires for keyboard nav, so mouse clicks stay clean. */
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--on-accent);
    border: none;
}
.btn-primary:hover {
    background-color: var(--accent-dark);
}

.btn-secondary {
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-google {
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    width: 100%;
    justify-content: center;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 4px;
}
.btn-google:hover {
    background-color: var(--bg-hover);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.form-input:focus {
    border-color: var(--accent);
}

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Create Project Dashed Button */
.btn-dashed-create {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-dashed-create:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* ==========================================================================
   CARDS LIST (STEP 2)
   ========================================================================== */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.project-card, .invitation-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background-color: var(--bg-primary);
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.project-card:hover, .invitation-card:hover {
    border-color: var(--accent);
    background-color: var(--bg-hover);
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.card-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Spinner elements */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

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

/* Dynamic onboarding steps */
.progress-step-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    border: 0.5px solid var(--border);
    animation: fadeIn var(--transition-fast) forwards;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.step-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-checkmark {
    color: var(--success);
    font-weight: bold;
}

/* Drive Reconnect Banner */
.drive-reconnect-banner {
    /* R9 · A3 #15a — out of the controls' z-path (FP finding: top-center
       collided with the mode cluster + surface buttons, same band, same
       z-chrome). Bottom-center is unowned chrome territory; the banner can
       never overlap a control the user is trying to click. */
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    z-index: var(--z-chrome);
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}
.drive-reconnect-banner span {
    color: var(--error);
    font-weight: 500;
}
.drive-reconnect-banner #btnReconnectDrive {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.drive-reconnect-banner #btnReconnectDrive:hover {
    background: var(--accent-dark);
}

/* ==========================================================================
   WORKSPACE CONTAINER & SIDEBAR (3-COLUMN LAYOUT)
   ========================================================================== */
.workspace-container {
    width: 100%;
    height: 100%;
    display: flex;
    background-color: var(--bg-primary);
}

/* Column 1: Left Sidebar */
.workspace-sidebar {
    /* R10.2 (Gabriel 2026-06-13): float the sidebar 12px from top + bottom so its
       top reaches ~12px and its bottom lines up EXACTLY with the board (#stoaDock
       = top:12px, height:calc(100vh-24px)). */
    height: calc(100% - 24px);
    align-self: flex-start;
    margin: 12px;
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-med);
    flex-shrink: 0;
    overflow: hidden;
}

/* Sidebar Width States */
.workspace-sidebar.expanded {
    width: 248px !important;
}
.workspace-sidebar.collapsed {
    width: 48px !important;
}

/* Display Toggles for Dual Structure */
.workspace-sidebar.collapsed .sidebar-collapsed-strip {
    display: flex !important;
}
.workspace-sidebar.collapsed .sidebar-expanded-content {
    display: none !important;
}
.workspace-sidebar.expanded .sidebar-collapsed-strip {
    display: none !important;
}
.workspace-sidebar.expanded .sidebar-expanded-content {
    display: flex !important;
}

/* Collapsed strip buttons */
.strip-btn {
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.strip-btn:hover {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}
.strip-btn.active {
    color: #378ADD !important;
    background-color: var(--accent-soft) !important;
}

/* Sidebar Headings & Toggles */
.sidebar-header {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-bottom: 0.5px solid var(--border);
    gap: 8px;
    overflow: hidden;
}

.sidebar-toggle-btn {
    width: 28px;
    height: 28px;
    border: 0.5px solid var(--border);
    background: white;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color var(--transition-fast);
}
.sidebar-toggle-btn:hover {
    background-color: var(--bg-hover);
}

.sidebar-project-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: var(--text-primary);
}

/* Scrollable Sections Wrapper */
.sidebar-sections-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
}

/* Sidebar tab bar (R6 UI fix #1 — replaces the movable separators) */
/* R10 FINAL (entry c4-fixed-sidebar-tri-button, Gabriel 2026-06-12, signed
   mock c4_tri_button_sidebar_mock): "adopting Claude with a twist" — the
   sidebar frame is fixed (Claude's), and the connector between the three
   sidebars (Threads · Files · Users) is a FLOATING TRI-BUTTON pill at the
   top of the sidebar. Active segment = icon + label; inactive = icon-only
   (labels hidden via .tab-label). Same three buttons, same handlers. */
.sidebar-tabs {
    display: flex;
    gap: 2px;
    padding: 3px;
    margin: 8px auto 6px;
    width: max-content;
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.sidebar-tab {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sidebar-tab .tab-label { display: none; }
.sidebar-tab.active .tab-label { display: inline; }
.sidebar-tab:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.sidebar-tab.active {
    background-color: var(--accent-soft);
    color: var(--accent-dark);
}

/* User profile menu items (R6 UI fix #5) */
.profile-menu-item:hover {
    background-color: var(--bg-hover);
}

/* Surface navigation in the sidebar (R6-FINISH cleanup C — replaces the top
   mode-cluster bar; the active entry is the "you are here" signal) */
.surface-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border-bottom: 0.5px solid var(--border);
}
.surface-nav-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 7px 8px;
    border-radius: 6px;
    text-align: left;
    width: 100%;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}
.surface-nav-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.surface-nav-btn.active {
    background-color: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 600;
}
.surface-nav-btn .sn-ico {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.section-add-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}
.section-add-btn:hover {
    background-color: var(--bg-hover);
    color: var(--accent);
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Row Styling (Files, Threads, Humans) */
.sidebar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color var(--transition-fast);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.sidebar-row:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}
.sidebar-row.active {
    background-color: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 500;
}

/* R10.1 · U8 (#74) — the thread-row spec, uniform with the board's R&D rows
   (mock v2): dot grammar (colored = new info · empty = nothing new · three
   moving = working) + ONE sober archive button + the pin. */
.thread-dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.thread-dot-empty { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border); background: none; flex: none; box-sizing: border-box; }
.thread-dot-working { display: inline-flex; gap: 2.5px; flex: none; align-items: center; }
.thread-dot-working i { width: 4.5px; height: 4.5px; border-radius: 50%; background: var(--text-muted); animation: stoaDotWk 1.2s infinite; }
.thread-dot-working i:nth-child(2) { animation-delay: .2s; }
.thread-dot-working i:nth-child(3) { animation-delay: .4s; }
@keyframes stoaDotWk { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.thread-archive-btn {
    font-family: inherit;
    font-size: 10px;
    color: var(--text-muted);
    border: 0.5px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
    background: var(--bg-primary);
    cursor: pointer;
}
.thread-archive-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Agent Specific Compact Rows */
.agent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
.agent-row:hover {
    background-color: var(--bg-hover);
}

.agent-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.agent-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-accent);
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.agent-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.engine-badge {
    font-size: 8px;
    text-transform: uppercase;
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.2px;
    flex-shrink: 0;
}

/* Footer Section */
.sidebar-footer {
    border-top: 0.5px solid var(--border);
    padding: 12px;
    display: flex;
    flex-direction: column;
}

/* Visual Allowance Bars */
.allowance-container {
    padding-bottom: 12px;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 12px;
}

.allowance-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.allowance-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.allowance-bar-bg {
    width: 100%;
    height: 4px;
    background-color: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.allowance-bar-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.allowance-tier-text {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
}

/* Footer button tray */
.footer-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}
.settings-btn:hover {
    background-color: var(--bg-hover);
}

.avatar-compact-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-compact-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-compact-fallback {
    color: var(--on-accent);
    font-weight: 600;
    font-size: 13px;
}

/* ==========================================================================
   COLUMN 2: CHAT AREA (Always visible)
   ========================================================================== */
.workspace-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--chat-bg);
    position: relative;
}

.chat-message-container {
    flex: 1;
    overflow-y: auto;
    padding: 28px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Inner content centered, max readable width */
}

/* Inner wrapper that constrains readable width
   R9.2-7: the chat reads like Claude — generous reading column (720→790px,
   ≈+1.9cm at 96dpi), calm 16px type at 1.7 (below). */
.chat-inner {
    width: 100%;
    max-width: 790px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Chat Message Styling Rules */
.message-group {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-group.self {
    align-self: flex-end;
}

.message-group.other {
    align-self: flex-start;
}

.message-sender {
    font-size: 12px;   /* R9.2-7: scales with the 16px bubbles */
    font-weight: 600;
    margin-bottom: 4px;
}

.message-sender.ai {
    color: var(--accent);
}

.message-sender.human {
    color: var(--text-secondary);
}

.message-bubble {
    padding: 4px 0;
    font-size: 16px;     /* R9.2-7 (v0.2: LARGER, supersedes v0.1) */
    line-height: 1.7;    /* Claude's reading rhythm */
    color: var(--text-primary);
}

.message-group.self .message-bubble {
    background-color: var(--chat-bubble);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 12px;
    border-bottom-right-radius: 3px;
    font-size: 16px;     /* R9.2-7 */
}

.message-group.other .message-bubble {
    background-color: transparent;
    color: var(--text-primary);
    padding: 4px 0;
}

/* Fresh session input — centered prominent input before first message */
.workspace-chat.fresh-session .chat-input-container {
    position: absolute;
    bottom: 50%;
    left: 0; right: 0;
    transform: translateY(50%);
    border-top: none;
    background: transparent;
    padding: 0 0 40px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-chat.fresh-session .chat-input-inner {
    max-width: 660px;   /* R9.2-7: scales with the 720→790 column */
}

.workspace-chat.fresh-session .chat-textarea {
    min-height: 80px;
    border-radius: 14px;
    border-width: 1px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    font-size: 16px;    /* R9.2-7 */
}

.workspace-chat.fresh-session .chat-message-container {
    padding-bottom: 200px; /* leave space for centered input */
}

/* R10.2 · T2: the "What are we building?" hero — only on a fresh (empty) project,
   centered just above the prominent composer; drops away with it on first send. */
.chat-fresh-hero { display: none; }
.workspace-chat.fresh-session .chat-fresh-hero {
    display: block;
    position: absolute;
    bottom: 50%;
    left: 0; right: 0;
    transform: translateY(calc(50% - 118px));
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Session separator — marks where a new session begins */
.chat-session-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 32px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.chat-session-separator::before,
.chat-session-separator::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

/* Welcome state — centered input before first message */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    gap: 8px;
}

.chat-welcome-hint {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    margin-bottom: 16px;
}

/* Chat input — always max-width centered */
.chat-input-container {
    padding: 16px 0 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    border-top: 0.5px solid var(--chat-divider);
    background-color: var(--chat-bg);
}

.chat-input-inner {
    /* R9.2-6: the send/stop control lives INSIDE the textarea's bottom-right
       (absolute, below) — this is its positioning context. Width rides the
       R9.2-7 column. Pause controls stay flex siblings (outside the field). */
    position: relative;
    width: 100%;
    max-width: 790px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

/* Date divider */
.chat-date-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin: 16px 0 8px;
    text-transform: uppercase;
}
.chat-date-divider::before,
.chat-date-divider::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

/* Typing Indicators */
.chat-typing-indicator {
    padding: 8px 24px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    align-items: center;   /* no-op while display:block (human typing); aligns the */
    gap: 7px;              /* Doric column when showDoricThinking sets display:flex */
}

/* Doric thinking mark — the pixel-block column assembles bottom-up while an
   agent works. One looping 1.8s keyframe timeline per block level: blocks
   appear bottom-up (level 0 = base … 6 = cap), hold, then ALL fade together
   at 90–96% so the loop restarts in sync — no JS animation restarts needed. */
.doric-thinking {
    height: 18px;
    width: auto;
    flex: none;
    display: block;
}
.doric-thinking rect { opacity: 0; }
.doric-thinking .doric-thinking-b0,
.doric-thinking rect[class^="doric-thinking-b"] {
    animation-duration: 1.8s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.doric-thinking .doric-thinking-b0 { animation-name: doricRise0; }
.doric-thinking .doric-thinking-b1 { animation-name: doricRise1; }
.doric-thinking .doric-thinking-b2 { animation-name: doricRise2; }
.doric-thinking .doric-thinking-b3 { animation-name: doricRise3; }
.doric-thinking .doric-thinking-b4 { animation-name: doricRise4; }
.doric-thinking .doric-thinking-b5 { animation-name: doricRise5; }
.doric-thinking .doric-thinking-b6 { animation-name: doricRise6; }
@keyframes doricRise0 { 0%, 2%  { opacity: 0; } 7%,  90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise1 { 0%, 13% { opacity: 0; } 18%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise2 { 0%, 24% { opacity: 0; } 29%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise3 { 0%, 35% { opacity: 0; } 40%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise4 { 0%, 46% { opacity: 0; } 51%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise5 { 0%, 57% { opacity: 0; } 62%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes doricRise6 { 0%, 68% { opacity: 0; } 73%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .doric-thinking rect { animation: none !important; opacity: 1; }
}

/* Chat Input Bar */
.chat-textarea {
    flex: 1;
    border: 0.5px solid var(--border);
    background-color: var(--chat-input-bg);
    border-color: var(--chat-border);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px 52px 12px 16px;   /* R9.2-6: room for the in-field control */
    font-size: 16px;                /* R9.2-7: matches the bubbles */
    line-height: 1.6;
    resize: none;
    outline: none;
    min-height: 56px;
    max-height: 140px;
    transition: border-color var(--transition-fast);
    font-family: inherit;
}
.chat-textarea:focus {
    border-color: var(--accent);
    background-color: var(--chat-input-bg);
}

/* R9.2-6 (#32b finished + redesign, mock: visual-fixtures/r92-6-7-chat-mock.html):
   ONE control slot INSIDE the field border — a small circular arrow-up in the
   accent color (the Claude-family gesture), quiet at 45% while nothing is
   typed, full accent on content, and the SAME slot state-swaps to stop while
   running (#32 behavior untouched — placement only). #btnStopChat shares this
   class, so the swap inherits the slot. */
.chat-send-btn {
    position: absolute;
    right: 34px;            /* 24px inner padding + 10px inside the border */
    bottom: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background-color: var(--accent);
    color: var(--on-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
}
.chat-send-btn svg, .chat-send-btn i { width: 15px; height: 15px; }
.chat-send-btn:hover {
    background-color: var(--accent-dark);
}
/* the quiet idle state: nothing typed yet */
.chat-input-inner:has(.chat-textarea:placeholder-shown) .chat-send-btn:not(.chat-stop-btn) {
    opacity: .45;
}
.chat-input-inner:has(.chat-textarea:focus) .chat-send-btn:not(.chat-stop-btn),
.chat-send-btn:hover {
    opacity: 1;
}

/* ===== Decluttered allowance — single inline indicator ===== */
.allowance-inline { display: flex; align-items: center; gap: 8px; }
.allowance-inline .allowance-tier-text { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: none; flex-shrink: 0; }
.allowance-inline .allowance-bar-bg { flex: 1; height: 3px; background-color: var(--border); border-radius: 1.5px; overflow: hidden; }
.allowance-inline .allowance-bar-fill { width: 0%; height: 100%; background-color: var(--accent); transition: width 0.3s ease; }
.allowance-inline .allowance-usage-num { font-size: 10px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ===== Reconstructed: chat date divider ===== */
.chat-date-divider { text-align: center; font-size: 11px; color: var(--text-muted); margin: 18px 0 6px; letter-spacing: 0.3px; }

/* ===== Reconstructed: @mention popup ===== */
.mention-popup-alert { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; gap: 10px; align-items: center; z-index: var(--z-alert); font-size: 13px; }
.mention-popup-text { margin-right: 6px; }
.mention-popup-go, .mention-popup-dismiss { font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-primary); }
.mention-popup-go { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Chat textarea — slightly warmer background */
.chat-textarea {
    background-color: var(--chat-input-bg);
    border-color: var(--chat-border);
}
.chat-textarea:focus {
    border-color: var(--accent);
    background-color: var(--chat-input-bg);
}

/* ==========================================================================
   MARKDOWN FILE EDITOR
   ========================================================================== */
.md-file-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.md-edit-area {
    width: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    padding: 28px 32px;
    overflow-y: auto;
}

.md-edit-area::placeholder {
    color: var(--text-muted);
}

.md-preview-area {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background-color: var(--bg-primary);
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-primary);
}

/* Markdown preview typography */
.md-preview-area h1 { font-size: 22px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.3px; }
.md-preview-area h2 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; letter-spacing: -0.2px; }
.md-preview-area h3 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
.md-preview-area p  { margin: 0 0 12px; }
.md-preview-area ul, .md-preview-area ol { margin: 0 0 12px; padding-left: 20px; }
.md-preview-area li { margin-bottom: 4px; }
.md-preview-area code { font-family: 'DM Mono', monospace; font-size: 12px; background: var(--bg-secondary); padding: 1px 5px; border-radius: 3px; }
.md-preview-area pre  { background: var(--bg-secondary); padding: 14px 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 12px; }
.md-preview-area pre code { background: none; padding: 0; }
.md-preview-area blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-secondary); margin: 0 0 12px; }
.md-preview-area a { color: var(--accent); text-decoration: none; }
.md-preview-area a:hover { text-decoration: underline; }
.md-preview-area hr { border: none; border-top: 0.5px solid var(--border); margin: 20px 0; }
.md-preview-area strong { font-weight: 600; }
.md-preview-area table { border-collapse: collapse; width: 100%; margin-bottom: 12px; }
.md-preview-area td, .md-preview-area th { border: 0.5px solid var(--border); padding: 8px 12px; font-size: 13px; }
.md-preview-area th { background: var(--bg-secondary); font-weight: 600; }

/* R10.1 · U4 (#66): the .md-mode-toggle button CSS died with the Preview/Edit
   toggle — panels have ONE mode: preview, editable in place (click into the
   rendered doc to edit; leaving it returns the rendered view). */
.md-preview-area { cursor: text; }

/* ==========================================================================
   COLUMN 3: RIGHT PANEL (CLOSED BY DEFAULT)
   ========================================================================== */
/* Floating-window mode: the panel is a transparent overlay layer that lets
   clicks pass through to the canvas; each slot is an independent floating
   window the user can drag and resize freely. */
.workspace-file-panel {
    position: fixed;
    inset: 0;
    border: 0;
    background: transparent;
    pointer-events: none;        /* overlay passes clicks through to the chat canvas */
    overflow: visible;
    z-index: var(--z-panel);
    /* display toggled block/none by JS when a window is open */
}

/* The old fixed vertical divider has no role in floating mode */
.workspace-panel-divider { display: none !important; }

.file-panel-slot {
    position: absolute;
    pointer-events: auto;        /* the window itself is interactive */
    width: 460px;
    height: 560px;
    min-width: 280px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.18);
}

.file-slot-header {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--border);
    background-color: var(--bg-primary);
    flex-shrink: 0;
    cursor: move;                /* drag handle */
    user-select: none;
    border-radius: 10px 10px 0 0;
}

/* Resize handles (4 edges + 4 corners), injected into each window by JS.
   Edges are thin invisible strips; corners sit on top for diagonal resize. */
.file-panel-slot .rh { position: absolute; z-index: 6; }
.file-panel-slot .rh-n { top: -3px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.file-panel-slot .rh-s { bottom: -3px; left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.file-panel-slot .rh-e { right: -3px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.file-panel-slot .rh-w { left: -3px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.file-panel-slot .rh-ne { top: -4px; right: -4px; width: 16px; height: 16px; cursor: nesw-resize; z-index: 7; }
.file-panel-slot .rh-sw { bottom: -4px; left: -4px; width: 16px; height: 16px; cursor: nesw-resize; z-index: 7; }
.file-panel-slot .rh-nw { top: -4px; left: -4px; width: 16px; height: 16px; cursor: nwse-resize; z-index: 7; }
.file-panel-slot .rh-se { bottom: -4px; right: -4px; width: 18px; height: 18px; cursor: nwse-resize; z-index: 7; }
/* a faint visible grip on the bottom-right corner */
.file-panel-slot .rh-se::after {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
}

.file-slot-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.file-slot-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-save-status {
    font-size: 11px;
    color: var(--text-muted);
}

.file-slot-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-slot-close-btn:hover {
    color: var(--error);
}

.file-slot-content {
    flex: 1;
    overflow: auto;
    position: relative;
    background-color: var(--bg-primary);
}

/* Split slot divider */
.file-slot-divider {
    height: 4px;
    background-color: var(--border);
    cursor: row-resize;
    position: relative;
    flex-shrink: 0;
    transition: background-color var(--transition-fast);
}
.file-slot-divider:hover {
    background-color: var(--accent);
}

/* ==========================================================================
   DIALOGS, POPUPS & OVERLAYS
   ========================================================================== */
/* Slide over Settings */
.slide-over-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: var(--z-overlay);
    display: flex;
    justify-content: flex-end;
}

.slide-over-panel {
    width: 100%;
    max-width: 320px;
    height: 100%;
    background-color: var(--bg-primary);
    border-left: 0.5px solid var(--border);
    display: flex;
    flex-direction: column;
    animation: slideIn var(--transition-med) forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.slide-over-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--border);
}

.slide-over-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.close-overlay-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-over-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Settings as a CENTERED BLOCKING MODAL (R6 UI fix #6 — re-house the existing
   #overlaySettings contents; container only, contents unchanged). Overrides the
   slide-from-right behavior for this overlay alone. */
#overlaySettings {
    justify-content: center;
    align-items: center;
}
#overlaySettings .slide-over-panel {
    width: 92%;
    max-width: 560px;
    height: auto;
    max-height: 86vh;
    border-left: none;
    border: 0.5px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    animation: modalPop var(--transition-med) forwards;
}
@keyframes modalPop {
    from { transform: scale(0.97); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.settings-section {
    padding-bottom: 20px;
    border-bottom: 0.5px solid var(--border);
}

.settings-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Dialog Modals */
.dialog-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.dialog-card {
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dialog-header {
    padding: 16px;
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dialog-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.dialog-tabs {
    display: flex;
    border-bottom: 0.5px solid var(--border);
}

.dialog-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 2px solid transparent;
}

.dialog-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.dialog-content {
    padding: 20px;
}

.dialog-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Floating Agent Click Menu Popup */
.floating-context-popup {
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 4px;
    display: flex;
    flex-direction: column;
    min-width: 110px;
    z-index: var(--z-overlay);
}

.context-popup-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 12px;
    text-align: left;
    transition: background-color var(--transition-fast);
}

.context-popup-option:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Toast Notifications */
.toast-container {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: var(--z-chrome);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background-color: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: 12px;
    animation: toastIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   MONACO EDITOR INTEGRATION OVERLAYS / STYLES
   ========================================================================== */
.monaco-editor-wrapper {
    width: 100%;
    height: 100%;
}

.preview-iframe-wrapper {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #FFFFFF;
}

/* (Duplicate "Reconstructed" blocks removed 2026-06-06 — canonical definitions
   live in the chat section above: .chat-date-divider, .mention-popup-*,
   .allowance-inline.) */

/* (P-UX2 item 3's #avLauncher hide-rule removed 2026-06-08 — the launcher
   block itself was deleted from architecture-view.js buildUI in P8s1.) */
