:root {
            /* Canonical Theme System Surfaces (Image 1 Dark Palette) */
            --theme-canvas: #0d0d11;
            --theme-panel: #131419;
            --theme-card: #171821;
            --theme-surface-hover: #1c1d26;
            --theme-surface-well: #0f1014;
            --theme-border: rgba(255, 255, 255, 0.07);
            --theme-border-subtle: rgba(255, 255, 255, 0.035);
            --theme-border-hover: rgba(255, 255, 255, 0.16);
            --theme-text: #ececf1;
            --theme-text-secondary: #9a9cae;
            --theme-text-subtle: #626577;

            /* Theme Accents (Dynamically overridden by html[data-accent]) */
            --theme-accent: #8b5cf6;
            --theme-accent-hover: #7c3aed;
            --theme-accent-subtle: rgba(139, 92, 246, 0.15);
            --theme-accent-glow: rgba(139, 92, 246, 0.35);
            --theme-accent-contrast: #ffffff;

            /* Semantic Feedback Colors */
            --color-success: #10b981;
            --color-warning: #f59e0b;
            --color-error: #ef4444;
            --color-info: #06b6d4;

            /* Radii & Metrics */
            --radius-sm: 6px;
            --radius-md: 10px;
            --radius-lg: 14px;
            --radius-xl: 18px;
            --radius-full: 9999px;
            --bottom-nav-h: 60px;

            /* Modern Soft Shadows */
            --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
            --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
            --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
            --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.65);
            --shadow-command: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);

            /* Legacy and subsystem variable bridges */
            --color-background: var(--theme-canvas);
            --color-surface: var(--theme-panel);
            --color-surface-elevated: var(--theme-card);
            --color-surface-hover: var(--theme-surface-hover);
            --color-border: var(--theme-border);
            --color-border-subtle: var(--theme-border-subtle);
            --color-border-focus: var(--theme-accent);
            --color-text: var(--theme-text);
            --color-text-secondary: var(--theme-text-secondary);
            --color-text-muted: var(--theme-text-subtle);

            --color-accent: var(--theme-accent);
            --color-accent-hover: var(--theme-accent-hover);
            --color-accent-subtle: var(--theme-accent-subtle);
            --color-accent-contrast: var(--theme-accent-contrast);
            --color-accent-glow: var(--theme-accent-glow);
            --color-secondary-cyan: #06b6d4;
            --color-secondary-cyan-subtle: rgba(6, 182, 212, 0.12);

            --tw-bg-dark: var(--theme-canvas);
            --tw-panel-dark: var(--theme-panel);
            --tw-panel-elevated: var(--theme-card);
            --tw-border-glass: var(--theme-border);
            --tw-accent-purple: var(--theme-accent);
            --tw-accent-glow: var(--theme-accent-glow);

            --dp-color-canvas: var(--theme-canvas);
            --dp-color-surface: var(--theme-panel);
            --dp-color-surface-raised: var(--theme-card);
            --dp-color-surface-soft: var(--theme-surface-hover);
            --dp-color-surface-inset: var(--theme-surface-well);
            --dp-color-border: var(--theme-border);
            --dp-color-border-strong: var(--theme-border-hover);
            --dp-color-text: var(--theme-text);
            --dp-color-text-muted: var(--theme-text-secondary);
            --dp-color-text-subtle: var(--theme-text-subtle);
            --dp-color-accent: var(--theme-accent);
            --dp-color-accent-strong: var(--theme-accent-hover);
            --dp-accent: var(--theme-accent);
            --dp-accent-strong: var(--theme-accent-hover);
        }

        /* Accent Themes: Violet, Blue, Cyan, Emerald, Amber, Rose */
        html[data-accent="violet"], html:not([data-accent]) {
            --theme-accent: #8b5cf6;
            --theme-accent-hover: #7c3aed;
            --theme-accent-subtle: rgba(139, 92, 246, 0.15);
            --theme-accent-contrast: #ffffff;
            --theme-accent-glow: rgba(139, 92, 246, 0.35);
        }
        html[data-accent="blue"] {
            --theme-accent: #3b82f6;
            --theme-accent-hover: #2563eb;
            --theme-accent-subtle: rgba(59, 130, 246, 0.15);
            --theme-accent-contrast: #ffffff;
            --theme-accent-glow: rgba(59, 130, 246, 0.35);
        }
        html[data-accent="cyan"] {
            --theme-accent: #06b6d4;
            --theme-accent-hover: #0891b2;
            --theme-accent-subtle: rgba(6, 182, 212, 0.15);
            --theme-accent-contrast: #ffffff;
            --theme-accent-glow: rgba(6, 182, 212, 0.35);
        }
        html[data-accent="emerald"] {
            --theme-accent: #10b981;
            --theme-accent-hover: #059669;
            --theme-accent-subtle: rgba(16, 185, 129, 0.15);
            --theme-accent-contrast: #ffffff;
            --theme-accent-glow: rgba(16, 185, 129, 0.35);
        }
        html[data-accent="amber"] {
            --theme-accent: #f59e0b;
            --theme-accent-hover: #d97706;
            --theme-accent-subtle: rgba(245, 158, 11, 0.18);
            --theme-accent-contrast: #181102;
            --theme-accent-glow: rgba(245, 158, 11, 0.35);
        }
        html[data-accent="rose"] {
            --theme-accent: #f43f5e;
            --theme-accent-hover: #e11d48;
            --theme-accent-subtle: rgba(244, 63, 94, 0.15);
            --theme-accent-contrast: #ffffff;
            --theme-accent-glow: rgba(244, 63, 94, 0.35);
        }

        body {
            background-color: var(--color-background);
            color: var(--color-text);
            font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
            min-height: 100vh;
            min-height: 100dvh;
        }
        ::-webkit-scrollbar { width: 4px; height: 4px; }
        ::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }
        
        .glass-dock {
            background: color-mix(in srgb, var(--color-surface) 94%, transparent);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid var(--color-border);
            box-shadow: var(--shadow-md);
        }
        .active-tab {
            background: var(--color-accent-subtle) !important;
            color: var(--color-accent) !important;
            border-left: 2px solid var(--color-accent);
        }
        .nav-item {
            transition: all 0.14s cubic-bezier(0.16, 1, 0.3, 1);
            border-radius: var(--radius-sm);
        }
        .nav-item:hover {
            background: var(--color-surface-hover);
            color: var(--color-text);
        }
        .btn-brand {
            background: var(--color-accent);
            color: var(--color-accent-contrast);
            font-weight: 500;
            border-radius: var(--radius-sm);
            transition: all 0.16s ease;
        }
        .btn-brand:hover {
            background: var(--color-accent-hover);
            box-shadow: 0 4px 12px var(--color-accent-glow);
        }
        .todo-done {
            text-decoration: line-through;
            opacity: 0.5;
            color: #94a3b8;
        }
        .todo-pending {
            text-decoration: none;
            opacity: 1;
            color: #e2e8f0;
        }
        .doc-prose p { margin-bottom: 0.75rem; line-height: 1.65; }
        .doc-prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* =====================================================================
   PRIORA AGENT — THEME SETUP: OBSIDIAN DARK (DEFAULT)
   One stylesheet per theme setup.
   Consolidates repeated dark canvas, panel, card, well, border, and text tokens.
   ===================================================================== */

:root,
html[data-theme="dark"],
html:not([data-theme="light"]) {
    color-scheme: dark;

    /* Repeated Core Surfaces (Image 1 Dark Palette) */
    --theme-canvas: #0d0d11;
    --theme-panel: #131419;
    --theme-card: #171821;
    --theme-surface-well: #0f1014;
    --theme-surface-hover: #1c1d26;

    /* Repeated Borders */
    --theme-border: rgba(255, 255, 255, 0.07);
    --theme-border-subtle: rgba(255, 255, 255, 0.035);
    --theme-border-hover: rgba(255, 255, 255, 0.16);

    /* Repeated Typography */
    --theme-text: #ececf1;
    --theme-text-secondary: #9a9cae;
    --theme-text-subtle: #626577;

    /* Soft Dark Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.75);
    --shadow-command: 0 20px 48px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* =====================================================================
   PRIORA AGENT — THEME SETUP: VELOCITY LIGHT
   One stylesheet per theme setup.
   Consolidates repeated light canvas, panel, card, well, border, and text tokens.
   ===================================================================== */

html[data-theme="light"] {
    color-scheme: light;

    /* Repeated Core Surfaces */
    --theme-canvas: #f8fafc;
    --theme-panel: #ffffff;
    --theme-card: #ffffff;
    --theme-surface-hover: #f1f5f9;
    --theme-surface-well: #f1f5f9;

    /* Repeated Borders */
    --theme-border: rgba(100, 116, 139, 0.20);
    --theme-border-subtle: rgba(100, 116, 139, 0.12);
    --theme-border-hover: rgba(100, 116, 139, 0.36);

    /* Repeated Typography */
    --theme-text: #0f172a;
    --theme-text-secondary: #334155;
    --theme-text-subtle: #64748b;

    /* Crisp Light Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
    --shadow-command: 0 20px 48px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* --- Base light canvas, scrollbars, and selection --- */
html[data-theme="light"] body {
    background-color: var(--theme-canvas) !important;
    color: var(--theme-text) !important;
}
html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: linear-gradient(#d5cfe4, #c3bbd8) !important;
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(#bfb5d6, #a99ec6) !important;
}
html[data-theme="light"] ::selection {
    background: var(--theme-accent-subtle) !important;
    color: var(--theme-text) !important;
}

/* --- Role-Based Surface Mappings (Consolidating repeated classes) --- */

/* Canvas / Background */
html[data-theme="light"] .ui-canvas,
html[data-theme="light"] [class*="bg-[#08060d]"],
html[data-theme="light"] [class*="bg-[#0a0812]"],
html[data-theme="light"] [class*="bg-[#090712]"],
html[data-theme="light"] [class*="bg-[#090a0f]"] {
    background-color: var(--theme-canvas) !important;
    color: var(--theme-text) !important;
}

/* Panels (Sidebars, Header, Modals, Popovers) */
html[data-theme="light"] .ui-panel,
html[data-theme="light"] [class*="bg-[#0c0a16]"],
html[data-theme="light"] [class*="bg-[#0d0a17]"],
html[data-theme="light"] [class*="bg-[#0e0b1a]"],
html[data-theme="light"] [class*="bg-[#0f0d17]"],
html[data-theme="light"] [class*="bg-[#10121a]"],
html[data-theme="light"] [class*="bg-[#12141c]"],
html[data-theme="light"] [class*="bg-[#100c1b]"] {
    background-color: var(--theme-panel) !important;
    color: var(--theme-text) !important;
}

/* Cards & Elevated Elements */
html[data-theme="light"] .ui-card,
html[data-theme="light"] [class*="bg-[#161924]"],
html[data-theme="light"] [class*="bg-[#181329]"],
html[data-theme="light"] [class*="bg-[#181326]"],
html[data-theme="light"] [class*="bg-[#1f1733]"],
html[data-theme="light"] [class*="bg-[#161224]"],
html[data-theme="light"] [class*="bg-[#110d1c]"] {
    background-color: var(--theme-card) !important;
    color: var(--theme-text) !important;
}

/* Wells, Sunken Panels & Inputs */
html[data-theme="light"] .ui-well,
html[data-theme="light"] [class*="bg-[#0c0e14]"],
html[data-theme="light"] [class*="bg-black/30"],
html[data-theme="light"] [class*="bg-black/40"] {
    background-color: var(--theme-surface-well) !important;
    color: var(--theme-text) !important;
}

/* Hover States */
html[data-theme="light"] [class*="bg-[#1c202e]"],
html[data-theme="light"] [class*="bg-[#222533]"],
html[data-theme="light"] [class*="hover:bg-[#1c202e]"]:hover,
html[data-theme="light"] [class*="hover:bg-[#161924]"]:hover {
    background-color: var(--theme-surface-hover) !important;
}

/* --- Role-Based Border Mappings (Consolidating repeated borders) --- */
html[data-theme="light"] .ui-border,
html[data-theme="light"] [class*="border-[rgba(255,255,255"],
html[data-theme="light"] [class*="border-[#1e1a2c]"],
html[data-theme="light"] [class*="border-[#1e2235]"],
html[data-theme="light"] [class*="border-[#231b36]"],
html[data-theme="light"] [class*="border-[#2b2242]"],
html[data-theme="light"] [class*="border-[#31254a]"] {
    border-color: var(--theme-border) !important;
}
html[data-theme="light"] .ui-border-subtle {
    border-color: var(--theme-border-subtle) !important;
}

/* --- Role-Based Text Mappings (Consolidating repeated text colors) --- */
html[data-theme="light"] .ui-text,
html[data-theme="light"] [class*="text-white"],
html[data-theme="light"] [class*="text-slate-200"] {
    color: var(--theme-text) !important;
}
html[data-theme="light"] .ui-text-muted,
html[data-theme="light"] [class*="text-slate-300"],
html[data-theme="light"] [class*="text-slate-400"] {
    color: var(--theme-text-secondary) !important;
}
html[data-theme="light"] .ui-text-subtle,
html[data-theme="light"] [class*="text-slate-500"],
html[data-theme="light"] [class*="text-slate-600"] {
    color: var(--theme-text-subtle) !important;
}

/* --- Distinct Semantic Highlights & Status Chips (Only where required) --- */
html[data-theme="light"] [class*="text-emerald-300"],
html[data-theme="light"] [class*="text-emerald-400"] { color: #047857 !important; }
html[data-theme="light"] [class*="text-amber-300"],
html[data-theme="light"] [class*="text-amber-400"] { color: #b45309 !important; }
html[data-theme="light"] [class*="text-sky-300"],
html[data-theme="light"] [class*="text-cyan-300"],
html[data-theme="light"] [class*="text-cyan-400"] { color: #0e7490 !important; }
html[data-theme="light"] [class*="text-red-300"],
html[data-theme="light"] [class*="text-red-400"] { color: #dc2626 !important; }

html[data-theme="light"] [class*="bg-purple-950"] { background-color: rgba(124, 58, 237, 0.10) !important; }
html[data-theme="light"] [class*="bg-amber-950"] { background-color: rgba(217, 119, 6, 0.12) !important; }
html[data-theme="light"] [class*="bg-emerald-950"] { background-color: rgba(5, 150, 105, 0.12) !important; }
html[data-theme="light"] [class*="bg-red-950"] { background-color: rgba(220, 38, 38, 0.10) !important; }

/* Interactive Controls in Light Theme */
html[data-theme="light"] .glass-dock {
    background: #ffffff !important;
    border-color: var(--theme-border) !important;
    box-shadow: 0 8px 32px rgba(30, 20, 60, 0.08) !important;
}
html[data-theme="light"] #prompt-input {
    background: var(--theme-canvas) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme="light"] .active-tab {
    background: var(--theme-accent-subtle) !important;
    color: var(--theme-accent) !important;
    border-left-color: var(--theme-accent) !important;
}
html[data-theme="light"] .inspector-tab:not(.active-tab) {
    color: var(--theme-text-subtle) !important;
}
html[data-theme="light"] .inspector-tab:not(.active-tab):hover {
    color: var(--theme-text) !important;
    background-color: var(--theme-surface-hover) !important;
}
html[data-theme="light"] .nav-item:hover {
    background: var(--theme-surface-hover) !important;
    color: var(--theme-text) !important;
}
html[data-theme="light"] .smart-pill:hover {
    border-color: var(--theme-accent) !important;
    background: var(--theme-accent-subtle) !important;
    color: var(--theme-text) !important;
}

/* Markdown Prose Light Overrides */
html[data-theme="light"] .md-body h1,
html[data-theme="light"] .md-body h2,
html[data-theme="light"] .md-body h3 { color: var(--theme-text) !important; }
html[data-theme="light"] .md-body h4,
html[data-theme="light"] .md-body h5,
html[data-theme="light"] .md-body h6 { color: var(--theme-text-secondary) !important; }
html[data-theme="light"] .md-body strong { color: var(--theme-text) !important; }
html[data-theme="light"] .md-body blockquote {
    border-left-color: var(--theme-accent) !important;
    background: var(--theme-accent-subtle) !important;
    color: var(--theme-text-secondary) !important;
}
html[data-theme="light"] .md-body code {
    background: var(--theme-accent-subtle) !important;
    border-color: var(--theme-accent-subtle) !important;
    color: var(--theme-accent) !important;
}
html[data-theme="light"] .md-body .md-code-block {
    border-color: var(--theme-border) !important;
    background: var(--theme-canvas) !important;
}
html[data-theme="light"] .md-body .md-code-head {
    background: var(--theme-card) !important;
    border-bottom-color: var(--theme-border) !important;
}
html[data-theme="light"] .md-body pre { background: var(--theme-canvas) !important; }
html[data-theme="light"] .md-body pre code { color: var(--theme-text-secondary) !important; }

/* =====================================================================
   PRIORA STUDIO — MODERN REACTIVE COMPONENT SYSTEM
   ===================================================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--theme-canvas, #090a0f);
    color: var(--theme-text, #f3f4f6);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Base Surfaces */
.bg-canvas { background-color: var(--theme-canvas, #090a0f); }
.bg-panel { background-color: var(--theme-panel, #10121a); }
.bg-card { background-color: var(--theme-card, #161924); }
.bg-hover:hover { background-color: var(--theme-surface-hover, #1c202e); }
.border-theme { border-color: var(--theme-border, rgba(255, 255, 255, 0.08)); }
.border-subtle { border-color: var(--theme-border-subtle, rgba(255, 255, 255, 0.04)); }

/* Layout Shell */
.app-header {
    height: 48px;
    background-color: var(--theme-panel, #10121a);
    border-bottom: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 30;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar Resizing & Structure */
.sidebar-container {
    height: 100%;
    background-color: var(--theme-panel, #10121a);
    border-right: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
    flex-shrink: 0;
}

.sidebar-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 40;
    transition: background 0.15s ease;
}

.sidebar-resizer:hover,
.sidebar-resizer.is-dragging {
    background: var(--theme-accent, #8b5cf6);
    opacity: 0.8;
}

/* Inspector Rail Resizing & Attached Tabs (IDE Style) */
.inspector-panel {
    height: 100%;
    background-color: var(--theme-panel, #131419);
    border-left: 1px solid var(--theme-border, rgba(255, 255, 255, 0.07));
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
    flex-shrink: 0;
}

.inspector-resizer {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 40;
    transition: background 0.15s ease;
}

.inspector-resizer:hover,
.inspector-resizer.is-dragging {
    background: var(--theme-accent, #8b5cf6);
    opacity: 0.8;
}

.inspector-tabs-header {
    background: var(--theme-surface-well, #0f1014);
    border-bottom: 1px solid var(--theme-border, rgba(255, 255, 255, 0.07));
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    height: 38px;
    padding: 0 4px;
    flex-shrink: 0;
}

.inspector-tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--theme-text-secondary, #9a9cae);
    border: none;
    border-right: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.035));
    background: transparent;
    cursor: pointer;
    border-top: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.inspector-tab-item:hover {
    color: var(--theme-text, #ffffff);
    background: rgba(255, 255, 255, 0.03);
}

.inspector-tab-item.active {
    background: var(--theme-panel, #131419);
    color: var(--theme-text, #ffffff);
    border-top-color: var(--theme-accent, #8b5cf6);
}

/* Inspector Multi-Panel Split Resizer & Panes */
.inspector-split-resizer {
    height: 6px;
    width: 100%;
    cursor: row-resize;
    background: var(--theme-border, rgba(255, 255, 255, 0.07));
    position: relative;
    z-index: 20;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.inspector-split-resizer:hover,
.inspector-split-resizer.is-dragging {
    background: var(--theme-accent, #8b5cf6);
    opacity: 0.9;
}

.inspector-split-resizer::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.inspector-split-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 80px;
    position: relative;
}

/* Chat Canvas & Feed */
.chat-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: var(--theme-canvas, #090a0f);
}

.chat-feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 20px 16px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

/* Message Items */
.msg-row {
    display: flex;
    gap: 14px;
    width: 100%;
    animation: fadeIn 0.2s ease-out;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.msg-bubble-user {
    background: var(--theme-accent-subtle, rgba(139, 92, 246, 0.15));
    border: 1px solid var(--theme-accent, #8b5cf6);
    border-radius: 14px 14px 4px 14px;
    padding: 12px 16px;
    max-width: 82%;
    color: var(--theme-text, #f3f4f6);
    word-break: break-word;
    font-size: 14px;
    line-height: 1.5;
}

.msg-bubble-assistant {
    background: var(--theme-card, #161924);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    border-radius: 4px 14px 14px 14px;
    padding: 16px 18px;
    max-width: 88%;
    width: 100%;
    color: var(--theme-text, #f3f4f6);
    word-break: break-word;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    font-size: 14px;
    line-height: 1.6;
}

/* Thinking Accordion */
.thinking-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.05));
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    font-size: 12px;
}

.thinking-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    user-select: none;
    color: var(--theme-text-secondary, #9ca3af);
}

.thinking-content {
    padding: 10px 14px;
    border-top: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.04));
    color: var(--theme-text-subtle, #94a3b8);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    max-height: 240px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Generative UI Sandboxed Embed Card (<agent-embed src="...">) */
.agent-embed-card {
    margin: 12px 0;
    border: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    overflow: hidden;
    background: var(--theme-surface-well, #100c1c);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
    transition: all 0.2s ease;
}
.agent-embed-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.06));
    font-size: 11px;
    color: var(--theme-text-secondary, #cbd5e1);
    font-family: ui-monospace, monospace;
}
.agent-embed-iframe {
    width: 100%;
    min-height: 480px;
    border: 0;
    background: transparent;
    display: block;
}
.agent-embed-card.expanded {
    position: fixed;
    inset: 3vh 3vw;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: var(--theme-canvas, #0d0d11);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}
.agent-embed-card.expanded .agent-embed-iframe {
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Antigravity / Cursor Style Thinking Foldout & Execution Tree */
.thinking-foldout {
    margin: 6px 0 10px 0;
    font-size: 12px;
    line-height: 1.5;
    user-select: none;
}
.thinking-foldout-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-text-subtle, #94a3b8);
    cursor: pointer;
    font-size: 12px;
    font-weight: 450;
    padding: 3px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.thinking-foldout-header:hover {
    color: var(--theme-text-primary, #f1f5f9);
    background: rgba(255, 255, 255, 0.04);
}
.thinking-tree {
    margin-top: 4px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 2.5px;
}
.thinking-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12px;
    color: var(--theme-text-secondary, #94a3b8);
    padding: 1.5px 4px;
    border-radius: 4px;
    transition: background 0.1s ease;
}
.thinking-item:hover {
    background: rgba(255, 255, 255, 0.02);
}
.thinking-item-action {
    color: var(--theme-text-subtle, #64748b);
    font-size: 11.5px;
    flex-shrink: 0;
}
.thinking-item-file {
    color: var(--theme-text-primary, #e2e8f0);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11.5px;
}
.thinking-item-lines {
    color: var(--theme-text-subtle, #64748b);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
}
.thinking-item-clickable {
    cursor: pointer;
}
.thinking-item-clickable:hover .thinking-item-action {
    color: var(--theme-text-primary, #f1f5f9);
}
.thinking-item-icon {
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    flex-shrink: 0;
}
.thinking-raw-box {
    margin: 4px 0 6px 14px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: var(--theme-text-subtle, #94a3b8);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}
.thinking-working {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-text-subtle, #94a3b8);
    font-size: 12px;
    padding: 2px 4px;
}
.thinking-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a855f7;
    animation: status-pulse 1.2s ease-in-out infinite;
}

/* Tool Execution Badge */
.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
    margin: 4px 0;
}

/* Composer Dock */
.composer-dock {
    flex-shrink: 0;
    width: 100%;
    padding: 12px 24px 16px;
    background: var(--theme-canvas, #090a0f);
    border-top: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.05));
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
}

.composer-box {
    width: 100%;
    max-width: 860px;
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    padding: 10px 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer-box:focus-within {
    border-color: var(--theme-accent, #8b5cf6);
    box-shadow: 0 12px 36px var(--theme-accent-glow, rgba(139, 92, 246, 0.35));
}

.composer-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--theme-text, #f3f4f6);
    font-size: 14px;
    resize: none;
    max-height: 200px;
    min-height: 48px;
    line-height: 1.5;
    font-family: inherit;
}

/* Markdown Rendering */
.md-body {
    color: var(--theme-text, #f3f4f6);
    font-size: 14px;
    line-height: 1.6;
}

.md-body p { margin-bottom: 12px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    font-weight: 600;
    margin: 16px 0 8px;
    color: #ffffff;
}
.md-body h1 { font-size: 1.4rem; }
.md-body h2 { font-size: 1.25rem; }
.md-body h3 { font-size: 1.1rem; }
.md-body ul, .md-body ol {
    margin: 8px 0 12px 20px;
}
.md-body li { margin-bottom: 4px; }

.md-body li.md-task {
    list-style: none;
    margin-left: -20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.md-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.2));
    font-size: 11px;
}
.md-check-on {
    background: var(--theme-accent, #8b5cf6);
    border-color: var(--theme-accent, #8b5cf6);
    color: #ffffff;
}

.md-code-block {
    background: #08090d;
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
}
.md-code-head {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.05));
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--theme-text-subtle, #94a3b8);
}
.md-code-block pre {
    padding: 12px 14px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
}
.md-body code:not(pre code) {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #f43f5e;
}
.md-body blockquote {
    border-left: 3px solid var(--theme-accent, #8b5cf6);
    padding-left: 12px;
    margin: 12px 0;
    color: var(--theme-text-secondary, #9ca3af);
}
.md-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}
.md-body th, .md-body td {
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.1));
    padding: 8px 12px;
}
.md-body th {
    background: rgba(255, 255, 255, 0.04);
}

/* Inspector Drawer */
.inspector-panel {
    background-color: var(--theme-panel, #10121a);
    border-left: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 25;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--theme-accent, rgba(255, 255, 255, 0.28));
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.22);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--theme-accent, rgba(0, 0, 0, 0.35));
}
html[data-theme="light"] * {
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

/* Settings Modal Styles */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.15s ease-out;
}

.settings-card {
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border-hover, rgba(255, 255, 255, 0.15));
    border-radius: 16px;
    width: 100%;
    max-width: 860px;
    height: 640px;
    max-height: 92vh;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--theme-text-secondary, #94a3b8);
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
}
.settings-nav-btn:hover {
    color: var(--theme-text, #ffffff);
    background: rgba(255, 255, 255, 0.05);
}
.settings-nav-btn.active {
    color: var(--theme-accent, #8b5cf6);
    background: var(--theme-accent-subtle, rgba(139, 92, 246, 0.15));
    font-weight: 600;
}

.settings-input {
    width: 100%;
    background: var(--theme-canvas, #090a0f);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--theme-text, #f3f4f6);
    outline: none;
    transition: border-color 0.15s;
}
.settings-input:focus {
    border-color: var(--theme-accent, #8b5cf6);
}

.accent-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.accent-swatch:hover {
    transform: scale(1.1);
}
.accent-swatch.active {
    box-shadow: 0 0 0 3px var(--theme-panel, #10121a), 0 0 0 5px currentColor;
}

/* ========================================================
   Priora Canonical Reusable Component Classes (Primitives)
   ======================================================== */

/* Dialog & Modal */
.dp-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}
.dp-dialog-card {
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border-hover, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 90vh;
}
.dp-dialog-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.06));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}
.dp-dialog-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.dp-dialog-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.06));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0, 0, 0, 0.15);
}

/* Panel */
.dp-panel {
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dp-panel-header {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--theme-border-subtle, rgba(255, 255, 255, 0.05));
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dp-panel-body {
    padding: 12px;
    flex: 1;
}

/* Card */
.dp-card {
    background: var(--theme-card, #161924);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-md, 10px);
    padding: 12px 14px;
    transition: all 0.15s ease;
}
.dp-card-elevated {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.dp-card-interactive {
    cursor: pointer;
}
.dp-card-interactive:hover {
    border-color: var(--theme-border-hover, rgba(255, 255, 255, 0.2));
    background: var(--theme-surface-hover, #1c202e);
    transform: translateY(-1px);
}

/* Themed Select & Dropdown */
.dp-select-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}
.dp-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--theme-card, #161924);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-sm, 8px);
    padding: 7px 11px;
    font-size: 12px;
    color: var(--theme-text, #f3f4f6);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.dp-select-trigger:hover {
    border-color: var(--theme-border-hover, rgba(255, 255, 255, 0.2));
    background: var(--theme-surface-hover, #1c202e);
}
.dp-select-trigger:focus-visible,
.dp-select-trigger.is-open {
    border-color: var(--theme-accent, #8b5cf6);
    box-shadow: 0 0 0 1px var(--theme-accent, #8b5cf6);
}
.dp-select-wrap.is-flush {
    width: auto;
}
.dp-select-wrap.is-flush .dp-select-trigger,
.dp-select-trigger.is-flush {
    background: transparent !important;
    border: 1px solid transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--theme-text-secondary, #94a3b8);
    border-radius: 6px;
}
.dp-select-wrap.is-flush .dp-select-trigger:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: transparent !important;
    color: var(--theme-text, #f3f4f6);
}
.dp-select-wrap.is-flush .dp-select-trigger:focus-visible,
.dp-select-wrap.is-flush .dp-select-trigger.is-open {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    color: var(--theme-text, #f3f4f6);
}
.dp-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 340px;
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border-hover, rgba(255, 255, 255, 0.16));
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    z-index: 80;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
    animation: fadeIn 0.1s ease-out;
}
.dp-select-wrap.drop-up .dp-select-menu,
.dp-select-menu.drop-up {
    top: auto;
    bottom: calc(100% + 6px);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.75);
}
.dp-select-search {
    width: calc(100% - 8px);
    margin: 4px;
    background: var(--theme-canvas, #090a0f);
    border: 1px solid var(--theme-border, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 11px;
    color: var(--theme-text, #f3f4f6);
    outline: none;
}
.dp-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--theme-text-secondary, #9ca3af);
    cursor: pointer;
    transition: all 0.12s ease;
}
.dp-select-item:hover {
    color: var(--theme-text, #ffffff);
    background: rgba(255, 255, 255, 0.06);
}
.dp-select-item.is-selected {
    color: var(--theme-accent, #8b5cf6);
    background: var(--theme-accent-subtle, rgba(139, 92, 246, 0.14));
    font-weight: 500;
}

/* Button */
.dp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm, 8px);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}
.dp-btn:active {
    transform: scale(0.98);
}
.dp-btn-primary {
    background: var(--theme-accent, #8b5cf6);
    color: #ffffff;
}
.dp-btn-primary:hover {
    background: var(--theme-accent-hover, #7c3aed);
}
.dp-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--theme-border, rgba(255, 255, 255, 0.1));
    color: var(--theme-text, #f3f4f6);
}
.dp-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.dp-btn-ghost {
    background: transparent;
    color: var(--theme-text-secondary, #94a3b8);
}
.dp-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--theme-text, #ffffff);
}
.dp-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}
.dp-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

/* Badge */
.dp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    text-transform: uppercase;
}
.dp-badge-accent {
    background: var(--theme-accent-subtle, rgba(139, 92, 246, 0.15));
    border: 1px solid var(--theme-accent-glow, rgba(139, 92, 246, 0.3));
    color: var(--theme-accent, #c084fc);
}
.dp-badge-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.dp-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}
.dp-badge-muted {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

/* Slash Commands Popup */
.slash-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 20px;
    width: 280px;
    background: var(--theme-panel, #10121a);
    border: 1px solid var(--theme-border-hover, rgba(255, 255, 255, 0.16));
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    padding: 6px;
    z-index: 50;
    animation: fadeIn 0.12s ease-out;
}
.slash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--theme-text-secondary, #9ca3af);
    transition: all 0.12s ease;
}
.slash-item:hover, .slash-item.active {
    background: var(--theme-accent-subtle, rgba(139, 92, 246, 0.15));
    color: #ffffff;
}
.slash-cmd {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--theme-accent, #c084fc);
}
