:root {
    --bg-base: #0b0f19;
    --bg-sidebar: rgba(15, 23, 42, 0.78);
    --bg-card: rgba(17, 24, 39, 0.72);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-purple: #7c3aed;
    --accent-cyan: #0891b2;
    --accent-green: #059669;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

html.light {
    --bg-base: #f1f5f9;
    --bg-sidebar: rgba(255, 255, 255, 0.88);
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: rgba(241, 245, 249, 0.96);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif; }
body { background: var(--bg-base); color: var(--text-primary); height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; position: relative; }

/* Fully Unlimited & Borderless Viewport-Spanning 3D Background Canvas */
#bg3dCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    display: block;
    transition: background 0.3s ease;
}

html.dark #bg3dCanvas {
    background: radial-gradient(circle at 50% 50%, rgba(30, 58, 138, 0.22) 0%, rgba(3, 7, 18, 1) 90%);
}

html.light #bg3dCanvas {
    background: radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.12) 0%, rgba(226, 232, 240, 1) 90%);
}

/* Glassmorphism Panel Class */
.glass-panel {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* Custom Modal Dialog Overlay */
.solace-dialog-overlay {
    position: fixed; inset: 0; background: rgba(3, 7, 18, 0.8); display: flex;
    justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(12px);
    animation: fadeInModal 0.2s ease;
}
@keyframes fadeInModal { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.solace-dialog-card {
    background: var(--bg-card); padding: 32px; border-radius: 20px; text-align: center; width: 380px;
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.dialog-icon { font-size: 32px; color: var(--accent-blue); margin-bottom: 12px; }
.solace-dialog-card h3 { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.solace-dialog-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 24px; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; }
.dialog-btn {
    padding: 10px 20px; border-radius: 10px; border: none; font-weight: 700; font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.dialog-btn.primary { background: var(--accent-blue); color: white; box-shadow: var(--shadow-sm); }
.dialog-btn.primary:hover { background: var(--accent-blue-hover); }
.dialog-btn.secondary { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border-strong); }
.dialog-btn.secondary:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }

/* Production Auth Modal */
.auth-overlay {
    position: fixed; inset: 0; background: rgba(3, 7, 18, 0.85); display: flex;
    justify-content: center; align-items: center; z-index: 999; backdrop-filter: blur(16px);
}
.auth-modal-card {
    background: var(--bg-card); padding: 44px; border-radius: 24px; text-align: center; width: 440px;
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.brand-badge-lg {
    width: 52px; height: 52px; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white; font-size: 24px; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px auto;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}
.auth-modal-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; color: var(--text-primary); }
.auth-modal-header p { font-size: 13px; color: var(--text-secondary); margin-top: 6px; margin-bottom: 28px; line-height: 1.5; }

.enterprise-auth-btn {
    width: 100%; padding: 13px; border-radius: 12px; border: none; font-weight: 700;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13.5px;
}
.enterprise-auth-btn.google { background: #ffffff; color: #0f172a; border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
.enterprise-auth-btn.google:hover { background: #f8fafc; transform: translateY(-1px); }
.enterprise-auth-btn.primary { background: var(--accent-blue); color: #ffffff; box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.enterprise-auth-btn.primary:hover { background: var(--accent-blue-hover); transform: translateY(-1px); }
.enterprise-auth-btn.secondary { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border-strong); }
.enterprise-auth-btn.secondary:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.auth-field-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.enterprise-input {
    width: 100%; padding: 13px; border-radius: 12px; border: 1px solid var(--border-strong);
    background: var(--bg-base); color: var(--text-primary); outline: none; font-size: 13.5px; transition: all 0.2s;
}
.enterprise-input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.auth-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.auth-divider { margin: 20px 0; font-size: 10.5px; color: var(--text-muted); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.auth-dismiss-link { background: transparent; border: none; color: var(--text-muted); margin-top: 22px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: color 0.2s; }
.auth-dismiss-link:hover { color: var(--accent-blue); }

/* App Layout Structure */
.app-layout { display: flex; height: 100vh; width: 100vw; overflow: hidden; position: relative; z-index: 1; }

/* Sidebar Pane */
.sidebar-pane {
    width: 300px; background: var(--bg-sidebar); border-right: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; padding: 16px; flex-shrink: 0; z-index: 10;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; overflow: hidden;
}
.sidebar-pane.collapsed { width: 0px; padding-left: 0px; padding-right: 0px; border-right: none; transform: translateX(-100%); }

.sidebar-edge-toggle {
    position: absolute; left: 300px; top: 50%; transform: translateY(-50%); z-index: 50;
    width: 22px; height: 48px; background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-left: none; border-radius: 0 8px 8px 0; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
    box-shadow: var(--shadow-sm); transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, color 0.2s;
}
.sidebar-pane.collapsed ~ .sidebar-edge-toggle { left: 0px; border-left: 1px solid var(--border-subtle); border-radius: 0 8px 8px 0; }
.sidebar-edge-toggle:hover { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; gap: 8px;
}
.logo-container { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; color: var(--text-primary); white-space: nowrap; }
.logo-spark { color: var(--accent-blue); font-size: 15px; }
.logo-tier { font-size: 9px; background: var(--accent-blue); color: white; padding: 2px 6px; border-radius: 6px; font-weight: 700; letter-spacing: 0.5px; }

.btn-new-session {
    background: var(--accent-blue); color: white; border: none; padding: 6px 12px;
    border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 11.5px; display: flex; align-items: center; gap: 4px;
    white-space: nowrap; transition: all 0.2s; box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.btn-new-session:hover { background: var(--accent-blue-hover); transform: translateY(-1px); }

.sidebar-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; flex-shrink: 0; }
.tool-chip {
    background: var(--bg-card-hover); border: 1px solid var(--border-subtle); color: var(--text-secondary);
    padding: 8px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 4px; transition: all 0.2s;
}
.tool-chip:hover { background: rgba(37, 99, 235, 0.08); color: var(--accent-blue); border-color: rgba(37, 99, 235, 0.2); }
.tool-chip.plugin { background: rgba(124, 58, 237, 0.06); color: var(--accent-purple); border-color: rgba(124, 58, 237, 0.15); }
.tool-chip.plugin:hover { background: var(--accent-purple); color: white; }

.sidebar-section-title { font-size: 10px; font-weight: 800; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 8px; flex-shrink: 0; }
.chat-history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; min-height: 0; }

.history-node {
    padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-secondary);
    transition: all 0.15s; border: 1px solid transparent; display: flex; align-items: center; justify-content: space-between; font-weight: 500;
}
.history-node:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.history-node.active { background: rgba(37, 99, 235, 0.12); color: var(--accent-blue); border-color: rgba(37, 99, 235, 0.25); font-weight: 700; }
.history-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.history-delete-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px; opacity: 0; transition: all 0.2s; }
.history-node:hover .history-delete-btn { opacity: 1; }
.history-delete-btn:hover { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.sidebar-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border-subtle); flex-shrink: 0; }
.user-pill { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background 0.2s; overflow: hidden; flex: 1; margin-right: 8px; }
.user-pill:hover { background: var(--bg-card-hover); }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue)); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: 700; color: white; font-size: 12px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 12px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--accent-blue); font-weight: 700; }
.icon-action-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; transition: color 0.2s; flex-shrink: 0; }
.icon-action-btn:hover { color: var(--text-primary); }

/* Main Content Pane */
.main-content-pane { flex: 1; display: flex; flex-direction: column; height: 100vh; position: relative; overflow: hidden; min-width: 0; }

.workspace-topbar {
    padding: 16px 28px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-sidebar);
    display: flex; justify-content: space-between; align-items: center; z-index: 5; flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.topbar-left h2 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.sync-status { font-size: 11px; color: var(--accent-green); display: flex; align-items: center; gap: 6px; margin-top: 2px; font-weight: 600; }
.pulse-dot { width: 6px; height: 6px; background: var(--accent-green); border-radius: 50%; box-shadow: 0 0 6px var(--accent-green); animation: pulseAnim 2s infinite; }
@keyframes pulseAnim { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.3); } 100% { opacity: 1; transform: scale(1); } }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.model-pill { background: rgba(8, 145, 178, 0.08); color: var(--accent-cyan); border: 1px solid rgba(8, 145, 178, 0.2); padding: 5px 12px; border-radius: 16px; font-size: 11.5px; font-weight: 700; }
.agent-pill-btn { background: rgba(124, 58, 237, 0.08); color: var(--accent-purple); border: 1px solid rgba(124, 58, 237, 0.2); padding: 6px 14px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 11.5px; transition: all 0.2s; }
.agent-pill-btn:hover { background: var(--accent-purple); color: white; }

.chat-stream-container { flex: 1; overflow-y: auto; padding: 28px 32px; display: flex; flex-direction: column; gap: 24px; min-height: 0; }
.message-card { display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; width: 100%; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.prompt-header { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 13.5px; color: var(--text-primary); }
.prompt-avatar { width: 30px; height: 30px; background: var(--accent-purple); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 12px; color: white; font-weight: 700; box-shadow: var(--shadow-sm); }

.ai-response-box {
    background: var(--bg-card); border: 1px solid var(--border-subtle); padding: 24px; border-radius: 18px;
    box-shadow: var(--shadow-sm); line-height: 1.7; font-size: 14px; color: var(--text-primary);
}
.ai-badge-label { font-weight: 800; color: var(--accent-blue); margin-bottom: 12px; font-size: 13px; display: flex; align-items: center; gap: 6px; }

.hero-node-banner {
    background: var(--bg-card); border: 1px solid var(--border-subtle); padding: 24px; border-radius: 18px;
    display: flex; justify-content: space-between; align-items: center; max-width: 900px; margin: 0 auto; width: 100%; box-shadow: var(--shadow-sm);
}

.input-dock-container { flex-shrink: 0; padding: 16px 32px 24px 32px; border-top: 1px solid var(--border-subtle); z-index: 10; }
.input-dock-box { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 18px; padding: 14px 18px; box-shadow: var(--shadow-md); max-width: 900px; margin: 0 auto; transition: border-color 0.2s; }
.input-dock-box:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1), var(--shadow-md); }

.file-preview-badge {
    display: flex; align-items: center; justify-content: space-between; background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2); padding: 6px 12px; border-radius: 8px; font-size: 12px; color: var(--accent-blue); margin-bottom: 10px; font-weight: 600;
}
.badge-close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-weight: 700; font-size: 13px; }
.badge-close-btn:hover { color: #ef4444; }

textarea { width: 100%; background: transparent; border: none; color: var(--text-primary); resize: none; outline: none; height: 48px; font-size: 14px; line-height: 1.5; }
.dock-actions-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; border-top: 1px solid var(--border-subtle); padding-top: 10px; }
.dock-tools-left { display: flex; gap: 8px; }
.dock-tool-btn {
    background: var(--bg-card-hover); color: var(--text-secondary); border: 1px solid var(--border-subtle);
    padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.2s;
}
.dock-tool-btn:hover { background: rgba(37, 99, 235, 0.08); color: var(--accent-blue); border-color: rgba(37, 99, 235, 0.2); }
.execute-btn {
    background: var(--accent-blue); color: white; border: none; padding: 8px 20px; border-radius: 10px;
    cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 12.5px; box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.execute-btn:hover { background: var(--accent-blue-hover); transform: translateY(-1px); }

/* Artifact Studio Pane */
.artifact-studio-pane { width: 520px; border-left: 1px solid var(--border-subtle); background: var(--bg-card); display: flex; flex-direction: column; z-index: 20; box-shadow: var(--shadow-lg); }
.studio-header { padding: 18px; border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: center; }
.studio-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--accent-blue); }
.studio-code-output { flex: 1; padding: 18px; background: #090d16; color: #38bdf8; font-family: 'JetBrains Mono', monospace; overflow: auto; font-size: 12.5px; line-height: 1.6; }
.studio-btn { padding: 6px 14px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; font-size: 11.5px; transition: all 0.2s; }
.studio-btn.run { background: var(--accent-green); color: white; box-shadow: var(--shadow-sm); }
.studio-btn.close { background: var(--bg-card-hover); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.studio-footer { padding: 12px 18px; border-top: 1px solid var(--border-subtle); font-size: 10.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }