/* ────────────────────────────────────────────────────────────
   OVER_POWER  –  Professional AI Interface
   ──────────────────────────────────────────────────────────── */
:root {
    --bg:            #0d0d0d;
    --sidebar-bg:    #141414;
    --surface:       #1c1c1c;
    --surface-2:     #242424;
    --surface-3:     #2e2e2e;
    --border:        rgba(255,255,255,0.07);
    --border-strong: rgba(255,255,255,0.14);

    --accent:        #6366f1;
    --accent-dim:    rgba(99,102,241,0.18);
    --accent-text:   #818cf8;

    --green:  #22c55e;
    --red:    #ef4444;
    --yellow: #f59e0b;

    --text-1: #f2f2f2;
    --text-2: #a1a1aa;
    --text-3: #52525b;

    --font:         'Inter', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono:    'Cascadia Code', 'Fira Code', 'SF Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

    --chat-max: 760px;
    --sidebar-w: 260px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text-1);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar         { width: 5px; height: 5px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Auth Overlay ─────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(16px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.login-overlay.active { opacity: 1; pointer-events: all; }

.login-card {
    width: 100%;
    height: 100%;
    max-width: 100%;
    background: var(--bg);
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.35s ease forwards;
    overflow-y: auto;
}

.login-card > * {
    width: 100%;
    max-width: 400px;
    padding: 0 24px;
}

.login-card > div:first-child {
    max-width: 400px;
    padding: 0 24px;
    text-align: center;
    margin-bottom: 28px;
}

.auth-view {
    max-width: 400px;
    width: 100%;
    padding: 0 24px;
}

.login-card > p:last-child {
    max-width: 400px;
    padding: 0 24px;
    text-align: center;
    margin-top: 28px;
}

.auth-view            { display: none; flex-direction: column; animation: fadeIn 0.25s ease; }
.auth-view.active-auth { display: flex; }
.hidden-auth          { display: none !important; }

.auth-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 13px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 10px;
}
.auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.auth-input::placeholder { color: var(--text-3); }

.auth-btn {
    width: 100%;
    margin-top: 20px;
    padding: 13px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.auth-btn:hover  { background: #4f52d9; }
.auth-btn:active { transform: scale(0.98); }

/* keep old class working */
.run-audit-btn { @extend .auth-btn; }

.auth-link {
    color: var(--accent-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}
.auth-link:hover { color: var(--text-1); }

.auth-error   { color: var(--red);   font-size: 0.82rem; text-align: center; margin-top: 10px; display: none; }
.auth-success { color: var(--green); font-size: 0.82rem; text-align: center; margin-top: 10px; display: none; }

/* ── App Shell ────────────────────────────────────────────── */
.app-glass-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 1px;
    color: var(--text-1);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
.nav-item i         { font-size: 17px; flex-shrink: 0; }
.nav-item:hover     { background: var(--surface-2); color: var(--text-1); }
.nav-item.active    {
    background: var(--accent-dim);
    color: var(--accent-text);
}
.nav-item.active i  { color: var(--accent); }

/* Conversation list items (injected by JS) */
#conv-list .nav-item {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.sidebar-footer {
    padding: 14px 16px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-3);
}

.status-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.settings-btn {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.settings-btn:hover { color: var(--text-1); }

.color-picker {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    overflow: hidden;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch         { border: none; border-radius: 50%; }

/* ── Main Workspace ───────────────────────────────────────── */
.main-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

/* ── Top Header ───────────────────────────────────────────── */
.top-header {
    height: 62px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg);
    flex-shrink: 0;
}

.header-title h1 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-1);
}
.header-title p {
    font-size: 0.78rem;
    color: var(--text-3);
}

/* ── AI Selector ──────────────────────────────────────────── */
.ai-selector-container { position: relative; }

.ai-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    padding: 8px 14px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}
.ai-selector:hover        { background: var(--surface-2); }
.ai-selector i:first-child { color: var(--accent); font-size: 17px; }
.ai-selector .ph-caret-down { color: var(--text-3); font-size: 13px; }

.ai-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.18s ease forwards;
}
.ai-dropdown.open { display: flex; }

.dropdown-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-3);
    padding: 6px 10px 8px;
    font-weight: 600;
}

.ai-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}
.ai-option:hover  { background: var(--surface-2); }
.ai-option.active {
    background: var(--accent-dim);
    border-color: rgba(99,102,241,0.3);
}
.ai-option i       { font-size: 20px; color: var(--text-2); flex-shrink: 0; }
.ai-option.active i { color: var(--accent); }

.option-details        { display: flex; flex-direction: column; }
.option-details strong { font-size: 0.875rem; font-weight: 600; color: var(--text-1); }
.option-details span   { font-size: 0.75rem; color: var(--text-3); }

/* ── View Panels ──────────────────────────────────────────── */
.workspace-views {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

.view-panel {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.view-panel.active-view {
    display: flex;
    animation: fadeIn 0.25s ease forwards;
}

/* ── Chat Interface ───────────────────────────────────────── */
.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Welcome screen (shown before any messages) */
.welcome-screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 32px;
}
.welcome-screen h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-1);
    text-align: center;
}
.welcome-screen p {
    color: var(--text-2);
    text-align: center;
    font-size: 1rem;
    max-width: 480px;
}
.suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 560px;
    width: 100%;
}
.suggestion-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.suggestion-card:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
.suggestion-card strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 4px;
}
.suggestion-card span {
    font-size: 0.8rem;
    color: var(--text-2);
}

/* Message rows */
.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: var(--chat-max);
    width: 100%;
    margin: 0 auto;
    padding: 8px 0;
    animation: messageEnter 0.2s ease forwards;
}

.msg-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.msg-wrapper.user .msg-row {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 4px;
}
.ai .msg-avatar   { background: var(--accent); color: #fff; }
.user .msg-avatar { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong); }

.msg-content {
    flex-grow: 1;
    min-width: 0;
}

.msg-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: 6px;
}
.user .msg-name { text-align: right; }

.msg-bubble {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-1);
}

.user .msg-bubble {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-sm) var(--radius-lg) var(--radius-lg);
    padding: 12px 16px;
    display: inline-block;
    max-width: 100%;
    text-align: left;
}

.ai .msg-bubble {
    padding: 4px 0;
}

/* Markdown inside bubbles */
.msg-bubble p             { margin-bottom: 10px; }
.msg-bubble p:last-child  { margin-bottom: 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
    font-family: var(--font-heading);
    margin: 16px 0 8px;
    color: var(--text-1);
}
.msg-bubble h1 { font-size: 1.2rem; }
.msg-bubble h2 { font-size: 1.05rem; }
.msg-bubble h3 { font-size: 0.95rem; }
.msg-bubble ul, .msg-bubble ol {
    padding-left: 22px;
    margin-bottom: 10px;
}
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble strong { font-weight: 600; color: var(--text-1); }
.msg-bubble em { color: var(--text-2); font-style: italic; }
.msg-bubble a  { color: var(--accent-text); text-decoration: none; }
.msg-bubble a:hover { text-decoration: underline; }
.msg-bubble blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 14px;
    color: var(--text-2);
    margin: 8px 0;
}
.msg-bubble hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}
.msg-bubble code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e2c08d;
}
.msg-bubble pre {
    background: #111;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin: 10px 0;
    overflow: hidden;
}
.msg-bubble pre .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-3);
}
.msg-bubble pre .copy-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.msg-bubble pre .copy-btn:hover { background: var(--surface-3); color: var(--text-1); }
.msg-bubble pre code {
    display: block;
    padding: 14px;
    overflow-x: auto;
    background: transparent;
    color: #a5d6ff;
    font-size: 0.875rem;
    line-height: 1.6;
    border-radius: 0;
}

/* Typing cursor */
.typing-cursor::after {
    content: '▋';
    animation: blink 0.9s step-end infinite;
    color: var(--accent-text);
    margin-left: 2px;
    font-size: 0.85em;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* System message */
.msg-wrapper.system .msg-row {
    justify-content: center;
}
.msg-wrapper.system .msg-bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.8rem;
    color: var(--text-3);
    text-align: center;
}

/* ── Input Area ───────────────────────────────────────────── */
.input-area {
    padding: 0 20px 24px;
}
.input-area-inner {
    max-width: var(--chat-max);
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 10px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper:focus-within {
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.attach-btn {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.attach-btn:hover { color: var(--text-1); background: var(--surface-2); }

#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-1);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 6px 4px;
    outline: none;
    resize: none;
    max-height: 160px;
    overflow-y: auto;
    line-height: 1.5;
}
#chat-input::placeholder { color: var(--text-3); }

.send-btn {
    background: var(--accent);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}
.send-btn:hover  { background: #4f52d9; }
.send-btn:active { transform: scale(0.93); }
.send-btn:disabled { background: var(--surface-3); cursor: not-allowed; }

.input-footer {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-3);
    margin-top: 8px;
}

/* install btn */
#download-app-btn {
    width: 100%;
    padding: 9px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-2);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}
#download-app-btn:hover { background: var(--surface-3); color: var(--text-1); }
#download-app-btn.hidden { display: none; }

/* ── Dashboard Shells (Astro, Crypto, Designer, Admin) ────── */
.dash-shell {
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
    overflow: hidden;
}

.dash-title h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 3px;
}
.dash-title p { font-size: 0.82rem; color: var(--text-3); }

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* Editor bar */
.editor-bar {
    background: var(--surface-2);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-3);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.run-audit-btn {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 7px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s;
}
.run-audit-btn:hover { background: #4f52d9; }

/* Blockchain Auditor */
.astro-dashboard, .crypto-dashboard {
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
    overflow: hidden;
}
.astro-header h2, .crypto-header h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-1);
    margin-bottom: 3px;
}
.astro-header p, .crypto-header p { font-size: 0.82rem; color: var(--text-3); }

.astro-canvas-container {
    flex-grow: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
}

.astro-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
}
.astro-controls button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    transition: background 0.2s;
}
.astro-controls button:hover { background: var(--surface-3); }

.telemetry {
    display: flex;
    gap: 20px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-2);
}

.crypto-workspace {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
}
.crypto-editor {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.crypto-results {
    flex: 1;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow-y: auto;
}
.crypto-results h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-1);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.idle-state  { color: var(--text-3); font-size: 0.85rem; }
.scan-bar {
    height: 3px;
    width: 100%;
    background: var(--surface-3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.scan-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; height: 100%; width: 35%;
    background: var(--accent);
    animation: scanAnim 1s infinite linear;
    border-radius: 2px;
}
.scanning-state { position: relative; }
.vuln-card {
    background: rgba(239,68,68,0.08);
    border-left: 3px solid var(--red);
    padding: 14px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.85rem;
}
.vuln-card h4 { color: var(--red); font-size: 0.85rem; margin-bottom: 5px; }
.vuln-card p  { color: var(--text-2); }

/* Designer Studio */
.designer-dashboard {
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
}
.designer-header h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-1);
    margin-bottom: 3px;
}
.designer-header p { font-size: 0.82rem; color: var(--text-3); }
.designer-workspace {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
}
.designer-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.designer-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
}
.iframe-container { flex-grow: 1; background: #000; overflow: hidden; }
.iframe-container iframe { width: 100%; height: 100%; border: none; }

/* Admin */
#view-admin .astro-dashboard { overflow-y: auto; }
#api-key-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    outline: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
#api-key-input:focus { border-color: var(--accent); }

/* ── VS Code Shell ────────────────────────────────────────── */
.vscode-shell {
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid #3c3c3c;
}

.vscode-titlebar {
    display: flex;
    align-items: center;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    min-height: 38px;
    flex-shrink: 0;
}

.vscode-tabs {
    display: flex;
    align-items: stretch;
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.vscode-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 16px;
    min-height: 38px;
    font-size: 0.8rem;
    font-family: var(--font);
    color: #969696;
    border-right: 1px solid #3c3c3c;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.vscode-tab:hover              { background: #2d2d2d; color: #ccc; }
.vscode-tab.active             { color: #ccc; background: #1e1e1e; }
.vscode-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: #6366f1;
}
.vscode-tab i { font-size: 14px; opacity: 0.7; }

.vscode-statusbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #007acc;
    padding: 3px 14px;
    font-size: 0.72rem;
    font-family: var(--font);
    color: rgba(255,255,255,0.9);
    flex-shrink: 0;
    min-height: 24px;
}
.vscode-statusbar span { display: flex; align-items: center; gap: 4px; }
.vscode-statusbar span:last-child { margin-left: auto; }

.monaco-container {
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
}

/* Language select dropdown (in code editor toolbar) */
.lang-select {
    background: #3c3c3c;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.lang-select:focus { border-color: #6366f1; }
.lang-select option { background: #252526; }

/* ── Code Editor Layout ───────────────────────────────────── */
.code-editor-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.code-editor-main {
    flex: 1;
    min-width: 0;
    border-radius: 0;
    border: none;
    border-right: 1px solid #3c3c3c;
}

/* ── AI Assistant Panel ───────────────────────────────────── */
.code-ai-panel {
    width: 320px;
    flex-shrink: 0;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #3c3c3c;
}

.code-ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #252526;
    border-bottom: 1px solid #3c3c3c;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ccc;
    flex-shrink: 0;
}
.code-ai-header i { font-size: 16px; color: var(--accent); }
.code-ai-header span:first-of-type { flex-grow: 1; }

.code-ai-badge {
    background: var(--accent-dim);
    color: var(--accent-text);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(99,102,241,0.3);
    text-transform: uppercase;
}

.code-ai-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
    border-bottom: 1px solid #3c3c3c;
    flex-shrink: 0;
}

.ai-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    color: #aaa;
    font-size: 0.78rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.ai-action-btn i { font-size: 13px; flex-shrink: 0; }
.ai-action-btn:hover {
    background: #3a3a3a;
    border-color: rgba(99,102,241,0.5);
    color: #ccc;
}

.code-ai-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.code-ai-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-3);
    font-size: 0.82rem;
    padding: 20px;
}

.code-ai-msg {
    font-size: 0.82rem;
    line-height: 1.6;
    animation: fadeIn 0.2s ease;
}
.code-ai-msg.user  {
    background: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 8px 8px 2px 8px;
    padding: 8px 12px;
    color: #ccc;
    align-self: flex-end;
    max-width: 90%;
}
.code-ai-msg.ai {
    color: #d4d4d4;
}
.code-ai-msg.ai pre {
    background: #111;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    padding: 10px;
    overflow-x: auto;
    margin: 6px 0;
}
.code-ai-msg.ai code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #a5d6ff;
}

.code-ai-input-wrap {
    padding: 10px 12px;
    border-top: 1px solid #3c3c3c;
    background: #252526;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.code-ai-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
#code-ai-input {
    flex-grow: 1;
    background: #3c3c3c;
    border: 1px solid #555;
    color: #ccc;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}
#code-ai-input:focus  { border-color: var(--accent); }
#code-ai-input::placeholder { color: #666; }

.code-ai-insert-btn {
    width: 100%;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.4);
    color: var(--accent-text);
    padding: 6px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}
.code-ai-insert-btn:hover { background: rgba(99,102,241,0.25); }
.code-ai-insert-btn.hidden { display: none; }

/* ── Folder bar ───────────────────────────────────────────── */
.folder-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-dim);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: var(--radius-md);
    padding: 7px 12px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--accent-text);
    max-width: var(--chat-max);
    margin-left: auto;
    margin-right: auto;
}
.folder-bar i    { font-size: 15px; }
.folder-bar span { flex-grow: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-bar button {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.2s;
}
.folder-bar button:hover { color: var(--text-1); }

/* ── Tool execution steps ─────────────────────────────────── */
.tool-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.tool-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}
.tool-step.running {
    background: rgba(99,102,241,0.1);
    color: var(--accent-text);
    border: 1px solid rgba(99,102,241,0.2);
}
.tool-step.done {
    background: rgba(34,197,94,0.08);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.2);
}
.tool-step.error {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.2);
}
.tool-step i    { font-size: 14px; flex-shrink: 0; }
.tool-step code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.8rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ph-spinner-gap { animation: spin 0.8s linear infinite; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes slideUp   { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideDown { from { opacity:0; transform:scale(0.96) translateY(-8px); } to { opacity:1; transform:scale(1) translateY(0); } }
@keyframes fadeIn    { from { opacity:0; } to { opacity:1; } }
@keyframes messageEnter { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes scanAnim  { 0% { transform:translateX(-100%); } 100% { transform:translateX(350%); } }

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Custom theme override (color picker) ─────────────────── */
body.custom-theme .brand-logo,
body.custom-theme .send-btn,
body.custom-theme .ai .msg-avatar,
body.custom-theme .run-audit-btn { background-color: var(--theme-color) !important; }

body.custom-theme .nav-item.active { background: color-mix(in srgb, var(--theme-color) 15%, transparent) !important; }
body.custom-theme .nav-item.active,
body.custom-theme .nav-item.active i { color: var(--theme-color) !important; }
body.custom-theme .ai-selector i:first-child { color: var(--theme-color) !important; }
body.custom-theme .input-wrapper:focus-within { border-color: var(--theme-color) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-color) 20%, transparent) !important; }
body.custom-theme .status-pulse { background: var(--theme-color) !important; box-shadow: 0 0 6px var(--theme-color) !important; }
