/* ═══════════════════════════════════════════════
   THE LAB — Command Center UI
   Cyberpunk premium. Glow everything.
   ═══════════════════════════════════════════════ */

:root {
    --bg-deep: #050510;
    --bg-base: #08081a;
    --bg-surface: #0e0e1e;
    --bg-elevated: #161630;
    --bg-hover: #1e1e44;
    --border: #2a2a50;
    --border-glow: #3a3a6640;
    --text-primary: #eaf0ff;
    --text-secondary: #8899bb;
    --text-muted: #556080;
    --accent-user: #4d8eff;
    --accent-user-glow: #4d8eff50;
    --accent-codex: #ffaa22;
    --accent-codex-glow: #ffaa2240;
    --accent-anti: #00ff88;
    --accent-anti-glow: #00ff8840;
    --accent-group: #b366ff;
    --accent-group-glow: #b366ff40;
    --accent-danger: #ff4466;
    --accent-success: #22ff66;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%; width: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Screens ──────────────────────────────── */
.screen { display: none; height: 100%; width: 100%; position: absolute; top: 0; left: 0; }
.screen.active { display: flex; flex-direction: column; }

/* ── LOGIN ────────────────────────────────── */
#login-screen { justify-content: center; align-items: center; }

.login-bg {
    position: absolute; inset: 0; overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #0d1530 0%, var(--bg-deep) 70%);
}
.grid-overlay {
    position: absolute; inset: 0;
    background-image: linear-gradient(var(--border-glow) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border-glow) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: gridDrift 20s linear infinite;
}
@keyframes gridDrift { to { background-position: 40px 40px; } }

.scan-line {
    position: absolute; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-anti-glow), transparent);
    animation: scanMove 4s ease-in-out infinite;
}
@keyframes scanMove { 0% { top: -2px; } 100% { top: 100%; } }

.login-card {
    position: relative; z-index: 2;
    background: linear-gradient(135deg, #111119e0, #0a0a12f0);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: min(400px, 90vw);
    backdrop-filter: blur(20px);
    box-shadow: 0 0 60px #00ff8808, 0 20px 60px #00000060;
    text-align: center;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.logo-ring {
    width: 64px; height: 64px; border-radius: 50%;
    border: 2px solid var(--accent-anti);
    display: flex; align-items: center; justify-content: center;
    animation: ringPulse 3s ease-in-out infinite;
    box-shadow: 0 0 20px var(--accent-anti-glow);
}
@keyframes ringPulse {
    0%, 100% { box-shadow: 0 0 20px var(--accent-anti-glow); }
    50% { box-shadow: 0 0 40px var(--accent-anti-glow), inset 0 0 15px var(--accent-anti-glow); }
}
.logo-core {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-anti);
    box-shadow: 0 0 12px var(--accent-anti);
}

.login-title { font-size: 28px; font-weight: 700; letter-spacing: 6px; color: var(--text-primary); }
.login-subtitle { font-size: 13px; color: var(--text-muted); letter-spacing: 3px; margin-top: 6px; margin-bottom: 32px; }

.input-group { position: relative; margin-bottom: 20px; }
.input-group input {
    width: 100%; padding: 14px 16px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: var(--font-mono); font-size: 14px;
    outline: none; transition: var(--transition);
}
.input-group input:focus { border-color: var(--accent-anti); box-shadow: 0 0 16px var(--accent-anti-glow); }
.input-glow {
    position: absolute; bottom: -1px; left: 50%; width: 0; height: 2px;
    background: var(--accent-anti); transition: 0.3s;
    transform: translateX(-50%);
}
.input-group input:focus ~ .input-glow { width: 100%; }

.btn-primary {
    width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #00cc6a, #00ff88);
    color: #060c06; font-weight: 600; font-size: 14px; letter-spacing: 2px;
    cursor: pointer; transition: var(--transition); font-family: var(--font-sans);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-anti-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-loader { display: inline-block; width: 16px; height: 16px; border: 2px solid #060c06; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-text { color: var(--accent-danger); font-size: 13px; margin-top: 12px; }

/* ── HEADER ───────────────────────────────── */
#hub-header {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #0e0e22, var(--bg-surface));
    z-index: 10; flex-shrink: 0;
    position: relative;
}
#hub-header::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-anti), var(--accent-group), var(--accent-codex), transparent);
    opacity: 0.5;
    animation: headerGlow 6s ease-in-out infinite;
}
@keyframes headerGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}
.header-left { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.header-logo { width: 12px; height: 12px; }
.logo-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent-anti);
    box-shadow: 0 0 12px var(--accent-anti), 0 0 24px var(--accent-anti-glow);
    animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 12px var(--accent-anti), 0 0 24px var(--accent-anti-glow); }
    50% { box-shadow: 0 0 20px var(--accent-anti), 0 0 40px var(--accent-anti-glow); }
}
.header-title {
    font-size: 20px; font-weight: 900; letter-spacing: 5px;
    background: linear-gradient(135deg, #00ff88, #4dffb8, #00ff88);
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: titleShimmer 4s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.4));
}
@keyframes titleShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
/* ── VPS Resource Monitor — BOLD ────────── */
.header-vps-stats {
    display: flex; gap: 16px; align-items: center; justify-content: center;
    flex: 1 1 auto;
    min-width: 180px;
    max-width: 620px;
    padding: 6px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(10, 10, 30, 0.9), rgba(14, 14, 36, 0.85));
    border: 1px solid rgba(0, 255, 136, 0.12);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 136, 0.03);
}
.vps-stat {
    display: flex; align-items: center; gap: 8px;
    animation: statSlideIn 0.5s ease forwards;
    opacity: 0;
}
#stat-cpu { animation-delay: 0.3s; }
#stat-ram { animation-delay: 0.6s; }
#stat-disk { animation-delay: 0.9s; }
@keyframes statSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-label {
    font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
    color: rgba(0, 255, 136, 0.6); text-transform: uppercase; width: 34px;
    font-family: var(--font-mono);
}
.stat-bar {
    width: 80px; height: 8px;
    background: rgba(20, 20, 50, 0.8); border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
.stat-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #00cc6a, #00ff88);
    transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1), background 0.4s;
    width: 0%;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
    animation: statGlow 2s ease-in-out infinite;
}
@keyframes statGlow {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 14px rgba(0, 255, 136, 0.6); }
}
.stat-fill.warn {
    background: linear-gradient(90deg, #ee8800, #ffaa00);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
    animation: statGlowWarn 2s ease-in-out infinite;
}
@keyframes statGlowWarn {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 170, 0, 0.3); }
    50% { box-shadow: 0 0 14px rgba(255, 170, 0, 0.6); }
}
.stat-fill.crit {
    background: linear-gradient(90deg, #cc2222, #ff4444);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
    animation: statGlowCrit 1.5s ease-in-out infinite;
}
@keyframes statGlowCrit {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 68, 68, 0.3); }
    50% { box-shadow: 0 0 16px rgba(255, 68, 68, 0.7); }
}
.stat-val {
    font-size: 12px; font-weight: 800; color: #00ff88;
    min-width: 36px; text-align: right;
    font-family: var(--font-mono);
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}
.stat-val.warn { color: #ffaa00; text-shadow: 0 0 6px rgba(255, 170, 0, 0.3); }
.stat-val.crit { color: #ff4444; text-shadow: 0 0 6px rgba(255, 68, 68, 0.4); }

.header-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#btn-clear-all { display: none; } /* Trash is in settings now */

.icon-btn {
    background: none; border: none; color: var(--text-secondary); cursor: pointer;
    width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm); transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover {
    color: var(--accent-anti);
    background: var(--bg-hover);
    box-shadow: 0 0 12px var(--accent-anti-glow);
}

.conn-dot {
    width: 10px; height: 10px; border-radius: 50%; transition: var(--transition);
}
.conn-dot.connected {
    background: var(--accent-success);
    box-shadow: 0 0 10px var(--accent-success), 0 0 20px #22ff6640;
    animation: connPulse 2s ease-in-out infinite;
}
@keyframes connPulse {
    0%, 100% { box-shadow: 0 0 10px var(--accent-success); }
    50% { box-shadow: 0 0 18px var(--accent-success), 0 0 30px #22ff6640; }
}
.conn-dot.disconnected {
    background: var(--accent-danger);
    box-shadow: 0 0 10px var(--accent-danger);
    animation: connPulse 1.5s ease-in-out infinite;
}
.conn-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    min-width: 44px;
    letter-spacing: 0;
}
.conn-label.connected { color: var(--accent-success); }
.conn-label.disconnected { color: var(--accent-danger); }

/* ── TAB BAR — PREMIUM ────────────────────── */
#tab-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.06);
    background: linear-gradient(180deg, rgba(14, 14, 30, 0.95), rgba(8, 8, 24, 0.9));
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    position: relative;
}
#tab-bar::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,255,136,0.15), rgba(77,142,255,0.15), transparent);
}
.tab-bar-left {
    display: flex; gap: 6px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-bar-left::-webkit-scrollbar { display: none; }
.tab-bar-right {
    display: flex; align-items: center; flex-shrink: 0; margin-left: 12px;
}

.tab {
    padding: 10px 20px; border: 1px solid transparent; border-radius: 22px;
    background: transparent; color: var(--text-secondary);
    font-size: 15px; font-weight: 500; cursor: pointer;
    white-space: nowrap; transition: all 0.3s ease;
    font-family: var(--font-sans);
    position: relative;
}
.tab:hover {
    color: var(--text-primary);
    background: rgba(30, 30, 68, 0.5);
    border-color: rgba(42, 42, 80, 0.5);
    transform: translateY(-1px);
}
.tab.active {
    color: var(--bg-deep); background: var(--accent-anti); font-weight: 700;
    box-shadow: 0 0 20px var(--accent-anti-glow), 0 4px 16px rgba(0,0,0,0.3);
    border-color: transparent;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Lab tab special glow */
.tab.tab-lab.active {
    background: linear-gradient(135deg, #00cc6a, #00ff88);
    box-shadow: 0 0 16px #00ff8840, 0 2px 8px #00000040;
}

/* ── PROJECT SWITCHER ────────────────────── */
.project-switcher {
    position: relative;
}
.project-active-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px;
    border-radius: 12px;
    border: 1px solid #2a2a60;
    background: linear-gradient(135deg, #0e0e24, #1a1a3a);
    color: #ccd;
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    font-family: var(--font-sans);
    white-space: nowrap;
}
.project-active-btn:hover {
    border-color: #4a3a8a;
    background: linear-gradient(135deg, #14142e, #22224a);
    box-shadow: 0 0 12px rgba(102, 68, 204, 0.2);
}
.project-active-btn:active { transform: scale(0.97); }
.project-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-anti);
    box-shadow: 0 0 6px var(--accent-anti-glow);
    flex-shrink: 0;
}
.project-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.project-chevron {
    font-size: 10px; color: #666;
    transition: transform 0.2s;
}
.project-switcher.open .project-chevron { transform: rotate(180deg); }

/* Dropdown */
.project-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: linear-gradient(180deg, #0c0c22, #08081a);
    border: 1px solid #2a2a60;
    border-radius: 14px;
    z-index: 1200;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(102, 68, 204, 0.1);
    overflow: hidden;
    animation: projDrop 0.2s ease;
}
@keyframes projDrop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.project-dropdown-header {
    padding: 10px 16px 8px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: #556;
    border-bottom: 1px solid #1a1a3a;
}
.project-list {
    max-height: 240px; overflow-y: auto;
    padding: 6px 0;
}
.project-list::-webkit-scrollbar { width: 3px; }
.project-list::-webkit-scrollbar-thumb { background: #2a2a50; border-radius: 2px; }

.project-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    cursor: pointer; transition: all 0.15s;
    border-left: 3px solid transparent;
}
.project-item:hover {
    background: #12122e;
}
.project-item.active {
    background: linear-gradient(90deg, #0a1a0a, transparent);
    border-left-color: var(--accent-anti);
}
.project-item-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #333; flex-shrink: 0;
}
.project-item.active .project-item-dot {
    background: var(--accent-anti);
    box-shadow: 0 0 6px var(--accent-anti-glow);
}
.project-item-name {
    flex: 1; font-size: 13px; font-weight: 500; color: #aab;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-item.active .project-item-name { color: #eef; font-weight: 600; }
.project-item-agents {
    font-size: 10px; color: #556;
    background: #0a0a1e; padding: 2px 6px; border-radius: 6px;
}
.project-item-delete {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid transparent; background: transparent;
    color: #444; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; padding: 0;
}
.project-item-delete:hover {
    border-color: #f44; color: #f44; background: #1e0a0a;
}
.project-item.active .project-item-delete { display: none; }

.project-dropdown-footer {
    display: flex; gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #1a1a3a;
    background: #08081a;
}
.new-project-input {
    flex: 1; padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid #2a2a50;
    background: #0a0a1e; color: #ccd;
    font-size: 12px; font-family: var(--font-sans);
    outline: none; transition: border-color 0.2s;
}
.new-project-input:focus { border-color: #6644cc; }
.new-project-input::placeholder { color: #444; }
.btn-create-project {
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid #2a2a50;
    background: linear-gradient(135deg, #1a1a3a, #2a1a4a);
    color: #6644cc; font-size: 18px; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; padding: 0;
}
.btn-create-project:hover {
    border-color: #6644cc; background: #2a1a5a; color: #aa88ff;
    box-shadow: 0 0 10px rgba(102, 68, 204, 0.3);
}

/* ── LAB CASCADING DROPDOWNS ─────────────── */
.lab-dropdown {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(180deg, #0a1014, var(--bg-surface));
    border-bottom: 1px solid #00ff8820;
    flex-shrink: 0;
    animation: labSlide 0.25s ease;
}
@keyframes labSlide { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 60px; } }

.lab-team-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid #00ff8825; border-radius: 18px;
    background: transparent; color: var(--text-secondary);
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: var(--transition); white-space: nowrap;
    font-family: var(--font-sans);
}
.lab-team-btn:hover {
    background: #00ff8810; color: var(--accent-anti);
    border-color: #00ff8850;
    box-shadow: 0 0 10px #00ff8820;
    transform: translateY(-1px);
}
.lab-team-btn.active {
    background: var(--accent-anti-glow); color: var(--accent-anti);
    border-color: var(--accent-anti);
    box-shadow: 0 0 14px var(--accent-anti-glow);
    font-weight: 700;
}
.team-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Lab agents sub-row */
.lab-agents {
    background: linear-gradient(180deg, #080e12, #0a0e16);
    border-bottom: 1px solid #ffffff08;
    padding: 6px 16px 8px;
}
.agent-group { display: none; flex-wrap: wrap; gap: 6px; }
.agent-group.active { display: flex; }

.lab-agent-btn {
    padding: 6px 14px; border: 1px solid #ffffff12; border-radius: 14px;
    background: #ffffff06; color: var(--text-muted);
    font-size: 12px; cursor: pointer; transition: var(--transition);
    white-space: nowrap; font-family: var(--font-sans);
}
.lab-agent-btn:hover {
    background: #ffffff10; color: var(--text-primary);
    border-color: #ffffff25;
    transform: translateY(-1px);
}
.lab-agent-btn.active {
    background: var(--accent-anti-glow); color: var(--accent-anti);
    border-color: var(--accent-anti);
    box-shadow: 0 0 8px var(--accent-anti-glow);
}

/* ── JOB BANNER ───────────────────────────── */
.job-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; background: var(--bg-elevated);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
    animation: bannerSlide 0.3s ease;
}
@keyframes bannerSlide { from { transform: translateY(-100%); opacity: 0; } }
.job-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.job-agent { font-weight: 600; }
.job-status { color: var(--accent-codex); font-family: var(--font-mono); font-size: 12px; }

.btn-small {
    padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary); font-size: 12px;
    cursor: pointer; transition: var(--transition); font-family: var(--font-sans);
}
.btn-small:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { border-color: #ff444440; color: #ff6666; }
.btn-danger:hover { background: #ff444420; border-color: #ff4444; }

/* Jobs tab glow */
.tab.tab-jobs.active {
    background: linear-gradient(135deg, #ff8800, #ffaa00);
    box-shadow: 0 0 16px #ff880040, 0 2px 8px #00000040;
    color: #000;
}

/* ── JOBS QUEUE PANEL ────────────────────── */
.jobs-panel {
    flex-shrink: 0; border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #0c0a14, var(--bg-surface));
    animation: labSlide 0.25s ease;
    max-height: 260px; overflow: hidden; display: flex; flex-direction: column;
}
.jobs-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid #ffffff08;
}
.jobs-title {
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    letter-spacing: 0.5px;
}
.jobs-count {
    font-size: 12px; font-family: var(--font-mono);
    color: var(--accent-codex); background: #ff880015;
    padding: 2px 10px; border-radius: 10px; border: 1px solid #ff880025;
}
.jobs-list {
    overflow-y: auto; flex: 1; padding: 6px 12px 10px;
    scrollbar-width: thin; scrollbar-color: #ffffff12 transparent;
}
.jobs-list::-webkit-scrollbar { width: 4px; }
.jobs-list::-webkit-scrollbar-thumb { background: #ffffff15; border-radius: 4px; }
.jobs-empty {
    text-align: center; color: var(--text-muted); font-size: 13px;
    padding: 20px 0;
}

/* Individual Job Item */
.job-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin-bottom: 4px;
    background: #ffffff04; border: 1px solid #ffffff08;
    border-radius: 8px; transition: var(--transition);
}
.job-item:hover { background: #ffffff08; border-color: #ffffff15; }
.job-item .job-order {
    font-size: 11px; font-family: var(--font-mono);
    color: var(--text-muted); min-width: 24px; text-align: center;
    background: #ffffff08; border-radius: 4px; padding: 2px 6px;
}
.job-item .job-agent-name {
    font-size: 13px; font-weight: 600; min-width: 90px;
}
.job-item .job-agent-name.codex { color: var(--accent-codex); }
.job-item .job-agent-name.antigravity { color: var(--accent-anti); }
.job-item .job-preview {
    flex: 1; font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.job-item .job-status-badge {
    font-size: 11px; font-family: var(--font-mono); padding: 2px 8px;
    border-radius: 8px; white-space: nowrap;
}
.job-status-badge.queued { color: #ffaa00; background: #ffaa0015; border: 1px solid #ffaa0025; }
.job-status-badge.running { color: #00cc6a; background: #00cc6a15; border: 1px solid #00cc6a25; animation: statusPulse 1.5s ease-in-out infinite; }
.job-status-badge.done { color: var(--text-muted); background: #ffffff08; border: 1px solid #ffffff10; }
.job-status-badge.failed { color: #ff4444; background: #ff444415; border: 1px solid #ff444425; }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.job-item .job-time {
    font-size: 11px; font-family: var(--font-mono);
    color: var(--text-muted); min-width: 50px; text-align: right;
}
.btn-danger { border-color: var(--accent-danger); color: var(--accent-danger); }
.btn-danger:hover { background: #ef444420; }
.settings-danger { border-top: 1px solid rgba(255, 68, 68, 0.2); padding-top: 16px; }
.settings-danger h3 { color: #ff4466; }

/* ── CHAT AREA — INSANE EDITION ──────────── */
#chat-area {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 12px 20px;
    position: relative;
    background:
        radial-gradient(ellipse at 20% 50%, #0a0a2e 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, #100a20 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #0a1018 0%, transparent 50%),
        var(--bg-deep);
    /* Messenger-like scroll: momentum + containment */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: auto;
}
#chat-area::-webkit-scrollbar { width: 3px; }
#chat-area::-webkit-scrollbar-track { background: transparent; }
#chat-area::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00ff8840, #4d8eff40);
    border-radius: 3px;
}

/* Animated Background Canvas */
#chat-bg-canvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; opacity: 0.35;
}

/* Animated Grid Overlay */
.chat-grid-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 0; opacity: 0.04;
    background-image:
        linear-gradient(rgba(0, 255, 136, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.3) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridDrift 30s linear infinite;
}
@keyframes gridDrift {
    0% { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

/* Laser Scan Line */
.chat-scan-line {
    position: absolute; left: 0; right: 0; height: 2px;
    pointer-events: none; z-index: 1; opacity: 0.15;
    background: linear-gradient(90deg,
        transparent,
        #00ff8800,
        #00ff88,
        #4d8eff,
        #00ff8800,
        transparent
    );
    animation: scanDown 8s ease-in-out infinite;
    box-shadow: 0 0 20px #00ff8840, 0 0 60px #00ff8820;
}
@keyframes scanDown {
    0%, 100% { top: 0; opacity: 0; }
    10% { opacity: 0.2; }
    50% { opacity: 0.15; }
    90% { opacity: 0.2; }
    95% { opacity: 0; }
    100% { top: 100%; }
}

#messages-container {
    display: flex; flex-direction: column; gap: 3px;
    min-height: 100%; justify-content: flex-end;
    position: relative; z-index: 2;
    padding-bottom: 6px;
}
#messages-container.is-empty {
    justify-content: center;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 20px;
    align-self: center;
    max-width: 320px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-hint { font-size: 13px; margin-top: 8px; }

/* ══ MESSAGE BUBBLES — 3D GLASSMORPHISM ═══ */
.message {
    display: flex; flex-direction: column;
    max-width: 55%; width: fit-content;
    animation: msgSlideIn 0.25s ease-out;
    margin: 1px 0;
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user { align-self: flex-end; align-items: flex-end; }
.message.codex,
.message.antigravity,
.message.system { align-self: flex-start; align-items: flex-start; }

.msg-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; padding: 0 4px; }
.msg-name {
    font-size: 11px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 2px;
}
.msg-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.msg-name.user-name {
    color: var(--accent-user);
    text-shadow: 0 0 12px var(--accent-user-glow), 0 0 30px var(--accent-user-glow);
}
.msg-name.codex-name {
    color: var(--accent-codex);
    text-shadow: 0 0 12px var(--accent-codex-glow), 0 0 30px var(--accent-codex-glow);
}
.msg-name.anti-name {
    color: var(--accent-anti);
    text-shadow: 0 0 12px var(--accent-anti-glow), 0 0 30px var(--accent-anti-glow);
}
.msg-name.system-name { color: var(--text-muted); }

/* ── Base Bubble ─────────────────────── */
.msg-bubble {
    padding: 10px 14px; border-radius: 18px;
    font-size: 14px; line-height: 1.5; word-break: break-word;
    white-space: pre-wrap; position: relative;
}

/* ── USER Bubble — Holographic Blue ─── */
.message.user .msg-bubble {
    background: linear-gradient(135deg, #1a5cff, #3d7aff);
    color: #ffffff;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 2px 12px rgba(77, 142, 255, 0.3);
}

/* ── CODEX Bubble — Amber Glass ─────── */
.message.codex .msg-bubble {
    background: linear-gradient(135deg, #1a1a35, #252550);
    border: 1px solid rgba(255, 170, 34, 0.16);
    border-left: 3px solid var(--accent-codex);
    border-radius: 20px 20px 20px 4px;
    color: var(--text-primary);
    box-shadow: 0 2px 12px rgba(255, 170, 34, 0.14);
}

/* ── ANTIGRAVITY Bubble ── */
.message.antigravity .msg-bubble {
    background: linear-gradient(135deg, #1a1a35, #252550);
    border: 1px solid rgba(0, 255, 136, 0.16);
    border-left: 3px solid var(--accent-anti);
    border-radius: 20px 20px 20px 4px;
    color: var(--text-primary);
    box-shadow: 0 2px 12px rgba(0, 255, 136, 0.13);
}

/* ── SYSTEM Bubble — Muted Holo ─────── */
.message.system .msg-bubble {
    background: rgba(14, 14, 30, 0.7);
    border: 1px solid rgba(42, 42, 80, 0.3);
    font-size: 12px; color: var(--text-secondary);
    align-self: center; font-style: italic; text-align: center;
    max-width: 85%; padding: 6px 12px; border-radius: 12px;
}

/* ── Code Blocks — Terminal Style ──── */
.msg-bubble code {
    background: rgba(0, 0, 0, 0.5); padding: 3px 7px; border-radius: 6px;
    font-family: var(--font-mono); font-size: 13px;
    border: 1px solid rgba(0, 255, 136, 0.15);
    color: #00ff88cc;
}
.msg-bubble pre {
    background: linear-gradient(180deg, #050510, #0a0a1e);
    padding: 16px; border-radius: 10px;
    overflow-x: auto; margin: 10px 0; font-size: 13px;
    border: 1px solid rgba(0, 255, 136, 0.1);
    white-space: pre;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}
.msg-bubble pre code { background: none; padding: 0; border: none; display: block; color: #c0d0e0; }

/* ── Markdown Content Styles ─────────── */
.msg-bubble p { margin: 0 0 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0; padding-left: 22px; }
.msg-bubble li { margin-bottom: 3px; }
.msg-bubble .md-bullet { margin: 4px 0; padding-left: 12px; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
    margin: 12px 0 6px; font-weight: 700; color: var(--text-primary);
}
.msg-bubble h1 { font-size: 1.3em; }
.msg-bubble h2 { font-size: 1.15em; }
.msg-bubble h3 { font-size: 1.05em; }
.msg-bubble blockquote {
    border-left: 3px solid rgba(0, 255, 136, 0.3); padding-left: 12px;
    margin: 8px 0; color: var(--text-secondary); font-style: italic;
}
.msg-bubble a { color: var(--accent-anti); text-decoration: underline; }
.msg-bubble hr { border: none; border-top: 1px solid #ffffff12; margin: 10px 0; }
.msg-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.msg-bubble th, .msg-bubble td {
    padding: 6px 10px; border: 1px solid rgba(255,255,255,0.08); text-align: left;
}
.msg-bubble th { background: rgba(255,255,255,0.04); font-weight: 600; }
.msg-bubble strong { font-weight: 700; color: var(--text-primary); }
.msg-bubble em { font-style: italic; }

/* ── Copy Button ─────────────────────── */
.msg-copy-btn {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px; border-radius: 6px;
    border: 1px solid #ffffff15; background: #00000060;
    color: var(--text-muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 14px; transition: var(--transition);
    backdrop-filter: blur(8px); z-index: 2;
}
.msg-copy-btn:hover { background: #ffffff15; color: var(--text-primary); border-color: #ffffff30; }
.msg-copy-btn.copied { color: var(--accent-anti); border-color: var(--accent-anti); }
.message:hover .msg-copy-btn { display: flex; }

/* ── Pin & Delete Buttons ────────────── */
.msg-pin-btn, .msg-delete-btn {
    position: absolute; top: 8px; width: 30px; height: 30px; border-radius: 6px;
    border: 1px solid #ffffff15; background: #00000060;
    color: var(--text-muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 13px; transition: var(--transition);
    backdrop-filter: blur(8px); z-index: 2;
}
.msg-pin-btn { right: 42px; }
.msg-delete-btn { right: 76px; }
.msg-pin-btn:hover { background: #ffaa0020; color: #ffaa00; border-color: #ffaa0040; }
.msg-delete-btn:hover { background: #ff444420; color: #ff4444; border-color: #ff444040; }
.msg-pin-btn.pinned { color: #ffaa00; border-color: #ffaa0050; display: flex; }
.message:hover .msg-pin-btn, .message:hover .msg-delete-btn { display: flex; }

/* Pinned message indicator */
.message.pinned-msg { border-left: 3px solid #ffaa00; }
.msg-pin-badge {
    font-size: 10px; color: #ffaa00; margin-left: 8px;
    font-family: var(--font-mono); opacity: 0.8;
}

/* ── Agent Working / Typing State ─────────── */
.typing-message {
    opacity: 0.96;
}
.typing-message .typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 148px;
    padding-right: 16px;
}
.typing-text {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.typing-dots i {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: typingDot 1.2s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }
.message.codex .typing-dots { color: var(--accent-codex); }
.message.antigravity .typing-dots { color: var(--accent-anti); }
@keyframes typingDot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-4px); opacity: 1; }
}

.icon-btn-sm {
    width: 22px; height: 22px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: var(--transition);
}
.icon-btn-sm:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Search highlight */
.search-highlight { background: #ffaa0030; border-radius: 2px; padding: 0 2px; }

/* Job status tag on message */
.msg-job-tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; padding: 2px 8px; border-radius: 10px;
    margin-top: 6px; font-family: var(--font-mono);
    background: var(--bg-hover); color: var(--text-muted);
}

/* ── HEADER CALL BUTTON ─────────────────── */
.header-call-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 18px; border-radius: 24px;
    background: linear-gradient(135deg, rgba(25, 10, 50, 0.95), rgba(40, 15, 65, 0.9));
    border: 2px solid transparent;
    color: #d8a0ff; cursor: pointer;
    font-family: var(--font-sans); font-size: 12px; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative; overflow: visible;
    box-shadow: 0 2px 16px rgba(140, 70, 255, 0.25);
}
.header-call-btn::before {
    content: ''; position: absolute; inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #8c46ff, #ff6b9d, #4d8eff, #8c46ff);
    background-size: 300% 300%;
    animation: callBorderFlow 4s ease infinite;
    z-index: -1; opacity: 0.6;
}
.header-call-btn::after {
    content: ''; position: absolute; inset: 2px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(25, 10, 50, 0.95), rgba(40, 15, 65, 0.9));
    z-index: -1;
}
@keyframes callBorderFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.header-call-btn:hover {
    color: #fff;
    box-shadow: 0 4px 24px rgba(140, 70, 255, 0.4);
    transform: translateY(-1px);
}
.header-call-btn:hover::before { opacity: 1; }
.header-call-btn.active {
    color: #ff6b9d;
    box-shadow: 0 4px 24px rgba(255, 107, 157, 0.35);
}
.header-call-btn.active::before {
    background: linear-gradient(135deg, #ff6b9d, #ff3366, #ff6b9d);
    opacity: 1;
}
.hcall-icon { font-size: 16px; line-height: 1; }
.hcall-label { line-height: 1; }

/* ── PILL ROW + PANEL SYSTEM ───────────── */
.pill-row {
    display: flex; gap: 8px; padding: 6px 0;
}
.pill-btn {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 6px; padding: 10px 0;
    background: rgba(16, 16, 38, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px; cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-sans); font-size: 12px; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    transition: all 0.2s ease;
}
.pill-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 255, 136, 0.06);
    border-color: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.06);
}
.pill-btn.active {
    color: #031008;
    background: linear-gradient(135deg, #00cc6a, #00ff88);
    border-color: rgba(0, 255, 136, 0.65);
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-shadow: none;
}
.pill-icon { font-size: 13px; line-height: 1; }

/* Panel Content — slides open above pills */
.panel-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.25s ease;
}
.panel-content.open {
    max-height: 220px;
    overflow-y: auto;
}
.panel-empty {
    color: var(--text-muted);
    padding: 10px 4px;
    font-size: 13px;
}
.panel-items {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px 0 4px;
}

/* ── INPUT AREA — PREMIUM ────────────────── */
#input-area {
    border-top: 1px solid rgba(0, 255, 136, 0.08);
    background: linear-gradient(180deg,
        rgba(14, 14, 30, 0.95),
        rgba(8, 8, 20, 0.98)
    );
    backdrop-filter: blur(20px);
    padding: 12px 16px 20px; flex-shrink: 0;
    position: relative;
}
#input-area::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 255, 136, 0.3),
        rgba(77, 142, 255, 0.3),
        rgba(0, 255, 136, 0.3),
        transparent
    );
    animation: borderGlow 4s ease-in-out infinite;
}
@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Quick Action Buttons — Holo */
.action-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 4px 0;
}

.qa-btn {
    padding: 7px 14px; border: 1px solid rgba(42, 42, 80, 0.6);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(14, 14, 30, 0.8), rgba(22, 22, 48, 0.6));
    color: var(--text-secondary);
    font-size: 13px; cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap; font-family: var(--font-sans);
    backdrop-filter: blur(6px);
    position: relative; overflow: hidden;
}
.qa-btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.04) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
    pointer-events: none;
}
.qa-btn:hover::after { transform: translateX(100%); }
.qa-btn:hover {
    background: linear-gradient(135deg, rgba(22, 22, 60, 0.9), rgba(30, 30, 80, 0.7));
    color: var(--text-primary);
    border-color: var(--accent-anti);
    box-shadow: 0 0 12px var(--accent-anti-glow), 0 4px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.qa-btn:active { transform: translateY(0); }

/* Template Buttons */
.tpl-btn {
    padding: 7px 14px; border: 1px solid rgba(42, 42, 80, 0.4);
    border-radius: 10px;
    background: transparent; color: var(--text-muted);
    font-size: 13px; cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap; font-family: var(--font-sans);
}
.tpl-btn:hover {
    background: var(--bg-hover); color: var(--accent-codex);
    border-color: var(--accent-codex); box-shadow: 0 0 12px var(--accent-codex-glow);
    transform: translateY(-2px);
}
.tpl-btn:active { transform: translateY(0); }
.tpl-btn.active {
    border-color: var(--accent-codex); color: var(--accent-codex);
    background: var(--accent-codex-glow);
}

#target-bar {
    display: flex; align-items: center;
    padding: 6px 0 8px;
}
.target-buttons { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }

.target-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 14px; border: 1px solid rgba(42, 42, 80, 0.5); border-radius: 16px;
    background: transparent; color: var(--text-secondary); font-size: 13px;
    cursor: pointer; transition: all 0.25s ease; white-space: nowrap;
    font-family: var(--font-sans);
}
.target-btn:hover { background: var(--bg-hover); color: var(--text-primary); transform: translateY(-1px); }
.target-btn.active { color: var(--text-primary); border-color: var(--accent-anti); background: var(--accent-anti-glow); }

.target-btn.master-btn { border-color: #f59e0b60; color: var(--accent-codex); }
.target-btn.master-btn:hover { background: var(--accent-codex-glow); }
.target-btn.master-btn.active {
    border-color: var(--accent-codex); background: var(--accent-codex-glow);
    color: #fbbf24; box-shadow: 0 0 12px var(--accent-codex-glow);
}

.target-btn.relay-btn { border-color: #a855f740; color: var(--accent-group); }
.target-btn.relay-btn:hover { background: var(--accent-group-glow); }
.target-btn.relay-btn.active {
    border-color: var(--accent-group); background: var(--accent-group-glow);
    color: #c084fc; box-shadow: 0 0 12px var(--accent-group-glow);
}

.target-icon { font-size: 14px; line-height: 1; }
.target-dot { width: 7px; height: 7px; border-radius: 50%; }
.codex-dot { background: var(--accent-codex); }
.anti-dot { background: var(--accent-anti); }
.group-dot { background: var(--accent-group); }
.target-btn.group-btn { border-color: #b366ff55; color: var(--accent-group); }
.target-btn.group-btn:hover { background: var(--accent-group-glow); }
.target-btn.group-btn.active {
    border-color: var(--accent-group);
    background: var(--accent-group-glow);
    color: #d8b4fe;
    box-shadow: 0 0 12px var(--accent-group-glow);
}

.commander-dot { background: #ff4444; box-shadow: 0 0 6px #ff444460; }
.gemini-dot { background: #4488ff; box-shadow: 0 0 6px #4488ff60; }
.openai-dot { background: #22cc66; box-shadow: 0 0 6px #22cc6660; }
.claude-dot { background: #cc66ff; box-shadow: 0 0 6px #cc66ff60; }
.openclaw-dot { background: #ffcc00; box-shadow: 0 0 6px #ffcc0060; }
.perplexity-dot { background: #00cccc; box-shadow: 0 0 6px #00cccc60; }
.grok-dot { background: #ff8800; box-shadow: 0 0 6px #ff880060; }

.target-btn.lab-btn { border-color: #00ff8830; color: var(--text-secondary); font-size: 12px; }
.target-btn.lab-btn:hover { background: #00ff8810; color: var(--accent-anti); border-color: #00ff8860; }
.target-btn.lab-btn.active {
    border-color: var(--accent-anti); background: var(--accent-anti-glow);
    color: var(--accent-anti); box-shadow: 0 0 10px var(--accent-anti-glow);
}

#lab-target-bar { display: flex; align-items: center; padding: 2px 0 6px; border-top: 1px solid #00ff8815; }

.qa-btn.qa-lab { border-color: #00ff8830; color: #00ff88aa; }
.qa-btn.qa-lab:hover {
    border-color: var(--accent-anti); color: var(--accent-anti);
    box-shadow: 0 0 8px var(--accent-anti-glow);
}

/* ── INPUT COMPOSER — Embedded Send ──────── */
.composer-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 2px 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0;
}
.composer-status span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#composer-target-label { color: var(--text-secondary); }
#composer-mode-label.ready { color: var(--accent-anti); }
#composer-mode-label.warn { color: var(--accent-codex); }
#composer-mode-label.offline { color: var(--accent-danger); }

.input-composer {
    position: relative;
    padding-top: 8px;
}
.input-composer textarea {
    width: 100%; padding: 18px 132px 18px 22px;
    min-height: 90px; max-height: 200px;
    background: linear-gradient(135deg, rgba(16, 16, 38, 0.95), rgba(12, 12, 28, 0.98));
    border: 1px solid rgba(0, 255, 136, 0.12);
    border-radius: 16px; color: var(--text-primary);
    font-family: var(--font-sans); font-size: 16px; line-height: 1.6;
    resize: none; outline: none;
    transition: all 0.3s ease;
    scrollbar-width: none;
}
.input-composer textarea::-webkit-scrollbar { display: none; }
.input-composer textarea:focus {
    border-color: rgba(0, 255, 136, 0.35);
    box-shadow:
        0 0 20px rgba(0, 255, 136, 0.12),
        0 0 50px rgba(0, 255, 136, 0.04),
        inset 0 0 30px rgba(0, 255, 136, 0.015);
}
.input-composer textarea::placeholder {
    color: var(--text-muted);
}

/* Call Button — Embedded beside send */
.call-btn-embed {
    position: absolute; bottom: 10px; right: 68px;
    width: 52px; height: 52px; border-radius: 14px;
    border: 1px solid rgba(77, 142, 255, 0.35);
    background: linear-gradient(135deg, rgba(24, 34, 64, 0.95), rgba(12, 18, 38, 0.98));
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(77, 142, 255, 0.14);
    font-size: 22px;
}
.call-btn-embed:hover {
    transform: scale(1.06) translateY(-2px);
    border-color: var(--accent-user);
    box-shadow: 0 8px 26px rgba(77, 142, 255, 0.28);
}
.call-btn-embed.recording {
    background: linear-gradient(135deg, #ff335a, #ff7b99);
    color: #140208;
    border-color: #ff7b99;
    box-shadow: 0 0 24px rgba(255, 68, 102, 0.55);
}
.call-icon { line-height: 1; }

/* Send Button — Embedded inside composer */
.send-btn-embed {
    position: absolute; bottom: 10px; right: 10px;
    width: 52px; height: 52px; border-radius: 14px; border: none;
    background: linear-gradient(135deg, #00cc6a, #00ff88, #00ee77);
    background-size: 200% 200%;
    animation: sendPulseGrad 3s ease infinite;
    color: #040a04; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: all 0.25s ease;
    box-shadow:
        0 4px 16px rgba(0, 255, 136, 0.35),
        0 0 30px rgba(0, 255, 136, 0.1),
        inset 0 1px 0 rgba(255,255,255,0.2);
    font-weight: 800;
}
@keyframes sendPulseGrad {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.send-btn-embed svg { width: 24px; height: 24px; }
.send-btn-embed:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow:
        0 8px 30px rgba(0, 255, 136, 0.5),
        0 0 50px rgba(0, 255, 136, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.25);
}
.send-btn-embed:active { transform: scale(0.9); }


/* ── NOTIFICATION TOASTS ────────────────── */
#notification-container {
    position: fixed; top: 60px; right: 20px;
    z-index: 9999; display: flex; flex-direction: column;
    gap: 8px; pointer-events: none;
    max-width: 400px;
}
.notification-toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(16, 16, 38, 0.95), rgba(22, 22, 48, 0.92));
    border: 1px solid rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 255, 136, 0.06);
    color: var(--text-primary); font-size: 13px; font-family: var(--font-sans);
    pointer-events: all; cursor: pointer;
    animation: toastIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transition: all 0.3s ease;
}
.notification-toast:hover {
    transform: translateX(-4px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 255, 136, 0.1);
}
.notification-toast.toast-exit {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(100px) scale(0.9); }
}
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.toast-msg { color: var(--text-secondary); line-height: 1.4; }
.toast-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 14px; cursor: pointer; padding: 4px;
    transition: color 0.2s;
}
.toast-close:hover { color: var(--text-primary); }

/* Toast type variants */
.notification-toast.toast-success { border-color: rgba(0, 255, 136, 0.3); }
.notification-toast.toast-success .toast-title { color: #00ff88; }
.notification-toast.toast-error { border-color: rgba(255, 68, 102, 0.3); }
.notification-toast.toast-error .toast-title { color: #ff4466; }
.notification-toast.toast-warning { border-color: rgba(255, 170, 34, 0.3); }
.notification-toast.toast-warning .toast-title { color: #ffaa22; }
.notification-toast.toast-info { border-color: rgba(77, 142, 255, 0.3); }
.notification-toast.toast-info .toast-title { color: #4d8eff; }

/* Voice Button — hidden now but keep for recording bar */
.voice-btn { display: none; }
@keyframes voicePulse { 0%, 100% { box-shadow: 0 0 8px #ff444430; } 50% { box-shadow: 0 0 20px #ff444460; } }

/* Voice Recording Bar */
.voice-recording-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 16px; background: #1a0808;
    border-top: 1px solid #ff444430; border-radius: 0;
}
.recording-pulse {
    width: 10px; height: 10px; border-radius: 50%;
    background: #ff4444; animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.recording-label { color: #ff6666; font-size: 13px; font-weight: 600; }
.voice-cancel-btn {
    margin-left: auto; padding: 4px 12px; border: 1px solid #ff444440;
    border-radius: 12px; background: transparent; color: #ff6666;
    font-size: 12px; cursor: pointer; transition: var(--transition);
    font-family: var(--font-sans);
}
.voice-cancel-btn:hover { background: #ff444420; border-color: #ff4444; }
#recording-time { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }

/* Group Round Button */
.group-round-btn {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
    padding: 10px 24px; border: 1px solid var(--accent-group);
    border-radius: 24px; background: var(--accent-group-glow);
    color: var(--accent-group); font-weight: 600; font-size: 13px;
    cursor: pointer; z-index: 20; transition: var(--transition);
    backdrop-filter: blur(10px); font-family: var(--font-sans);
}
.group-round-btn:hover { background: #a855f740; box-shadow: 0 0 20px var(--accent-group-glow); }

/* ── SETTINGS PANEL ───────────────────────── */
.overlay {
    position: fixed; inset: 0; z-index: 100;
    background: #00000080; backdrop-filter: blur(4px);
    display: flex; justify-content: flex-end;
    animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } }

.settings-panel {
    width: min(400px, 100vw); height: 100%;
    background: var(--bg-surface); border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    animation: panelSlide 0.3s ease;
}
@keyframes panelSlide { from { transform: translateX(100%); } }

.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.settings-header h2 { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.settings-body { flex: 1; overflow-y: auto; padding: 20px; }

.settings-section { margin-bottom: 28px; }
.settings-section h3 {
    font-size: 11px; font-weight: 600; letter-spacing: 2px;
    color: var(--text-muted); text-transform: uppercase; margin-bottom: 14px;
}

.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #1a1a2680;
}
.setting-row label { font-size: 13px; color: var(--text-secondary); }
.setting-row select, .setting-row input[type="number"] {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    padding: 6px 10px; font-size: 13px; font-family: var(--font-mono);
    outline: none; width: 140px;
}
.setting-row select:focus, .setting-row input:focus { border-color: var(--accent-anti); }
.setting-info { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* Toggle Switch */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider {
    position: absolute; inset: 0; border-radius: 12px;
    background: var(--bg-hover); border: 1px solid var(--border);
    transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--text-secondary); transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent-anti-glow); border-color: var(--accent-anti); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--accent-anti); }

/* ── MODAL ────────────────────────────────── */
.modal-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px;
    width: min(500px, 90vw); margin: auto;
    box-shadow: 0 20px 60px #00000060;
    animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } }
.modal-card h3 { font-size: 18px; margin-bottom: 8px; }
.modal-info { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; font-family: var(--font-mono); }
.modal-card textarea {
    width: 100%; padding: 12px; background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: var(--font-mono);
    font-size: 13px; resize: vertical; outline: none;
}
.modal-card textarea:focus { border-color: var(--accent-anti); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── TOASTS ───────────────────────────────── */
#toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 200;
    display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
    padding: 12px 18px; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 13px;
    box-shadow: 0 8px 24px #00000040;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 4.7s forwards;
    max-width: 340px;
}
.toast.error { border-color: var(--accent-danger); }
.toast.success { border-color: var(--accent-success); }
.toast.warning { border-color: var(--accent-codex); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ── RESPONSIVE — DESKTOP (bigger text, more space) ───── */
@media (min-width: 768px) {
    .header-title { font-size: 20px; letter-spacing: 5px; }
    .tab { font-size: 16px; padding: 10px 24px; }
    .msg-bubble { font-size: 17px; padding: 16px 22px; line-height: 1.65; }
    .msg-name { font-size: 13px; letter-spacing: 2px; }
    .msg-time { font-size: 12px; }
    .message { max-width: 70%; }
    #chat-area { padding: 24px 32px; }
    .target-btn { padding: 8px 16px; font-size: 14px; }
    .qa-btn { padding: 10px 18px; font-size: 14px; }
    .qa-icon { font-size: 16px; }
    #template-picker { font-size: 14px; padding: 7px 28px 7px 12px; }
    .toolbar-btn { font-size: 14px; padding: 7px 14px; }
    .textarea-wrap textarea { font-size: 16px; padding: 14px 18px; }
    .send-btn { width: 50px; height: 50px; }
    .toast { font-size: 15px; padding: 14px 22px; }
    .settings-panel { width: min(480px, 100vw); }
    .setting-row label { font-size: 15px; }
    .preamble-group label { font-size: 14px; }
    .preamble-group textarea { font-size: 14px; }
    .login-card { padding: 56px 48px; }
    .login-title { font-size: 32px; }
    .btn-primary { font-size: 16px; padding: 16px; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — MOBILE (Complete Redesign)
   Native-app-feel with bottom nav, collapsible actions
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Login ─────────────────────────────── */
    .login-card { padding: 36px 24px; }
    .login-title { font-size: 22px; letter-spacing: 4px; }

    /* ── HEADER — Slim Command Bar ─────────── */
    #hub-header {
        padding: 13px 14px;
        min-height: 67px;
        flex-wrap: nowrap;
        position: relative; /* Context for stats */
        gap: 8px;
    }
    #hub-header::after { display: block; opacity: 0.45; }
    .header-left { gap: 8px; flex-shrink: 0; }
    .header-logo { display: none; }
    .header-title {
        font-size: 15px; letter-spacing: 4px;
        background: linear-gradient(90deg, #00ff88, #4dffeb);
        -webkit-background-clip: text; -webkit-text-fill-color: transparent;
        font-weight: 900;
        filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.3));
        white-space: nowrap;
    }
    .header-right { gap: 6px; flex-shrink: 0; margin-left: auto; }
    #connection-label,
    .conn-label { display: none; }
    .conn-dot {
        width: 8px; height: 8px; flex: 0 0 auto;
    }
    .header-right .icon-btn {
        width: 30px; height: 30px; padding: 0;
        display: flex; align-items: center; justify-content: center;
    }
    .header-right .icon-btn svg { width: 18px; height: 18px; }
    #btn-logout { display: none; }

    /* ── VPS Stats — Scrolling Ticker Strip ── */
    .header-vps-stats {
        position: fixed !important; top: 67px !important; left: 0 !important; right: 0 !important;
        z-index: 165;
        display: flex !important; align-items: center; justify-content: flex-start; gap: 18px;
        padding: 0 18px;
        border-radius: 0 !important;
        background: linear-gradient(180deg, rgba(5, 5, 16, 0.95), rgba(8, 8, 22, 0.92)) !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 255, 136, 0.06) !important;
        backdrop-filter: blur(12px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        overflow: hidden;
        height: 24px;
        max-width: none;
        pointer-events: none;
    }
    .header-vps-stats::before,
    .header-vps-stats::after {
        content: '';
        position: absolute;
        top: 0; bottom: 0;
        width: 46px;
        z-index: 2;
        pointer-events: none;
    }
    .header-vps-stats::before {
        left: 0;
        background: linear-gradient(90deg, rgba(5, 5, 16, 1), rgba(5, 5, 16, 0));
    }
    .header-vps-stats::after {
        right: 0;
        background: linear-gradient(270deg, rgba(5, 5, 16, 1), rgba(5, 5, 16, 0));
    }
    .vps-stat {
        gap: 6px; flex: 0 0 auto;
        padding: 0;
        animation: mobileStatTicker 7s ease-in-out infinite alternate;
        opacity: 1;
    }
    #stat-cpu,
    #stat-ram,
    #stat-disk { animation-delay: 0s; }
    #stat-cpu::after,
    #stat-ram::after {
        content: '·';
        color: rgba(0, 255, 136, 0.45);
        margin-left: 12px;
        font-size: 12px;
    }
    @keyframes mobileStatTicker {
        from { transform: translateX(0); }
        to { transform: translateX(34px); }
    }
    .stat-label {
        font-size: 8px; font-weight: 800; width: 24px;
        color: rgba(0, 255, 136, 0.5);
    }
    .stat-bar {
        width: 36px; height: 3px;
        border-radius: 2px;
    }
    .stat-val {
        font-size: 9px; font-weight: 800;
        min-width: 28px;
    }

    /* ── TAB BAR — Mobile Read Filters ──── */
    #tab-bar {
        position: fixed !important; top: 91px; left: 0; right: 0;
        z-index: 170;
        display: flex !important;
        justify-content: flex-start;
        padding: 6px 10px !important;
        background: linear-gradient(180deg, rgba(8, 8, 22, 0.98), rgba(6, 6, 18, 0.94)) !important;
        border-top: 1px solid rgba(0, 255, 136, 0.05) !important;
        border-bottom: 1px solid rgba(0, 255, 136, 0.08) !important;
        border-radius: 0 !important;
        backdrop-filter: blur(20px);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
        overflow-x: auto;
        scrollbar-width: none;
    }
    #tab-bar::-webkit-scrollbar { display: none; }
    #tab-bar::after {
        display: none;
    }
    .tab-bar-left {
        display: flex; gap: 6px; flex: 0 0 auto;
        justify-content: flex-start;
        overflow: visible;
        min-width: 0;
    }
    .tab-bar-right { display: none; }
    .tab {
        flex: 0 0 auto;
        min-width: auto !important;
        padding: 7px 11px !important; font-size: 10px !important;
        border-radius: 10px !important;
        display: flex; align-items: center; justify-content: center;
        font-weight: 700 !important;
        letter-spacing: 0.4px;
        white-space: nowrap;
        overflow: visible;
    }
    .tab.active {
        box-shadow: 0 0 16px var(--accent-anti-glow) !important;
        font-size: 10px !important;
    }

    /* ── MAIN LAYOUT — Adjust for fixed elements ── */
    #hub-screen {
        padding-top: 0;
    }
    #chat-area {
        padding: 10px 16px 8px !important;
        /* Space for: VPS ticker strip + top read filters */
        margin-top: 72px;
        margin-bottom: 0;
        padding-bottom: 210px !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    #messages-container {
        min-height: auto;
        justify-content: flex-start;
    }
    #messages-container.is-empty {
        min-height: calc(100vh - 360px);
        justify-content: center;
    }
    .empty-state {
        padding: 24px 18px !important;
    }

    /* ── MESSAGES — Mobile ──────── */
    .message {
        max-width: 86%;
        min-width: 0;
    }

    .msg-bubble {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .message .msg-bubble {
        max-height: 260px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .msg-bubble pre,
    .msg-bubble code {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .msg-bubble {
        font-size: 14px; padding: 9px 13px;
        border-radius: 18px;
        line-height: 1.45;
    }
    .msg-name { font-size: 10px; letter-spacing: 1.5px; }
    .msg-time { font-size: 10px; }
    .msg-actions {
        opacity: 1 !important;
        position: relative; top: auto; right: auto;
        margin-top: 6px;
        justify-content: flex-end;
    }
    .msg-actions button {
        width: 28px; height: 28px;
        font-size: 12px;
    }

    /* ── INPUT AREA — Fixed Bottom Composer ── */
    #input-area {
        position: fixed; bottom: 0; left: 0; right: 0;
        z-index: 150;
        padding: 6px 12px 8px; /* Tighter padding so pills fill width */
        background: linear-gradient(180deg, rgba(10, 10, 26, 0.98), rgba(6, 6, 18, 1));
        border-top: 1px solid rgba(0, 255, 136, 0.08);
        backdrop-filter: blur(20px);
    }
    #input-area::before { display: none; }

    /* 3-Bar System — Mobile */
    .bar-toggle {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    /* Pill Row — Mobile */
    .pill-btn {
        padding: 10px 0 !important; font-size: 12px !important;
        border-radius: 12px !important;
    }
    .pill-icon { font-size: 14px !important; }
    .panel-content.open {
        max-height: 54px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: none;
    }
    .panel-content.open::-webkit-scrollbar { display: none; }
    .panel-items {
        flex-wrap: nowrap !important;
        gap: 6px !important;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .panel-items::-webkit-scrollbar { display: none; }
    .qa-btn {
        padding: 7px 10px !important; font-size: 12px !important;
        border-radius: 10px !important;
        flex: 0 0 auto;
    }
    .tpl-btn {
        padding: 7px 10px !important; font-size: 12px !important;
        flex: 0 0 auto;
    }
    .target-btn {
        padding: 7px 12px !important; font-size: 12px !important;
        white-space: nowrap;
        border-radius: 14px !important;
        flex: 0 0 auto;
    }

    /* Input Composer — Compact */
    .input-composer { padding-top: 6px !important; }
    .input-composer textarea {
        min-height: 48px !important;
        max-height: 100px !important;
        padding: 12px 112px 12px 16px !important;
        font-size: 16px !important;
        border-radius: 16px !important;
    }
    .call-btn-embed,
    .send-btn-embed {
        width: 44px !important; height: 44px !important;
        bottom: 8px !important; right: 8px !important;
        border-radius: 12px !important;
    }
    .call-btn-embed { right: 58px !important; }
    .call-icon { font-size: 20px !important; }
    .send-btn-embed svg { width: 22px !important; height: 22px !important; }

    /* Header Call — compact on mobile */
    .header-call-btn {
        padding: 8px 12px !important;
        font-size: 11px !important;
        letter-spacing: 1.5px !important;
        gap: 6px !important;
    }
    .hcall-icon { font-size: 15px !important; }
    .hcall-label { display: none; } /* Icon-only on mobile */

    /* Settings */
    .settings-panel { width: 100vw; }
    .group-round-btn { bottom: 130px; font-size: 12px; padding: 8px 20px; }

    /* Notifications — Bottom-aligned on mobile */
    #notification-container {
        top: auto !important; bottom: 200px;
        right: 8px !important; left: 8px;
        max-width: 100% !important;
    }

    /* Voice room adjustments */
    .vr-panel {
        bottom: 58px !important;
    }
}

/* ── Settings Select ─────────────────── */
.setting-select {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 12px; color: var(--text-primary);
    font-size: 14px; font-family: var(--font-sans);
    outline: none; width: 180px; cursor: pointer;
    transition: var(--transition);
}
.setting-select:focus { border-color: var(--accent-anti); }
.setting-select option { background: var(--bg-deep); color: var(--text-primary); }
.setting-hint {
    font-size: 11px; color: var(--text-muted); margin-top: 8px;
    font-style: italic;
}
.setting-hint code {
    background: var(--bg-surface); padding: 2px 6px; border-radius: 4px;
    font-family: var(--font-mono); font-size: 11px;
}

/* ── AI Providers Grid ───────────────── */
.ai-providers-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-top: 8px;
}
.provider-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px;
    transition: var(--transition);
}
.provider-card:hover { border-color: var(--accent-anti); transform: translateY(-1px); }
.provider-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.provider-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); flex-shrink: 0;
}
.provider-dot.active { background: var(--accent-success); box-shadow: 0 0 6px var(--accent-success); }
.provider-dot.inactive { background: #ff4444; }
.provider-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.provider-model {
    font-size: 11px; color: var(--text-muted);
    font-family: var(--font-mono); margin-bottom: 4px;
}
.provider-status {
    font-size: 12px; color: var(--text-secondary);
}

/* ── TTS Speaker Button ─────────────── */
.msg-speak-btn {
    position: absolute; top: 8px; right: 110px;
    width: 30px; height: 30px; border-radius: 6px;
    border: 1px solid #ffffff15; background: #00000060;
    color: var(--text-muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 13px; transition: var(--transition);
    backdrop-filter: blur(8px); z-index: 2;
}
.msg-speak-btn:hover { background: #00ff8820; color: var(--accent-anti); border-color: #00ff8840; }
.msg-speak-btn.speaking { color: var(--accent-anti); border-color: var(--accent-anti); animation: pulse 1s infinite; }
.message:hover .msg-speak-btn { display: flex; }

/* ── File Viewer Modal ───────────────── */
.file-viewer-card {
    background: var(--bg-deep); border: 1px solid var(--border);
    border-radius: 16px; width: 90vw; max-width: 900px;
    max-height: 85vh; display: flex; flex-direction: column;
    overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.file-viewer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.file-viewer-title {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    font-family: var(--font-mono);
}
.file-viewer-body {
    padding: 20px; overflow: auto; flex: 1;
    font-size: 13px; color: var(--text-primary);
    font-family: var(--font-mono); line-height: 1.6;
}
.file-viewer-body img {
    max-width: 100%; max-height: 70vh; border-radius: 8px;
    display: block; margin: 0 auto;
}
.file-viewer-body pre {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px; overflow-x: auto;
    font-size: 12px; line-height: 1.5;
}
.file-viewer-body .mermaid-render {
    background: #fff; border-radius: 8px; padding: 16px;
    text-align: center;
}

/* File link styling in messages */
.file-link {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 10px; margin: 4px 0;
    color: var(--accent-anti); font-family: var(--font-mono);
    font-size: 12px; cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.file-link:hover { background: var(--bg-hover); border-color: var(--accent-anti); }
.file-link::before { content: '📄'; font-size: 14px; }
.file-link[data-type="image"]::before { content: '🖼️'; }
.file-link[data-type="diagram"]::before { content: '📊'; }
.file-link[data-type="code"]::before { content: '💻'; }

/* ═══════════════════════════════════════════════
   VOICE ROOM — Real-time Agent Voice Chat (v2)
   ═══════════════════════════════════════════════ */

/* ── Inline Toggle Button (in input bar) ──────── */
.vr-toggle-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a3a, #2a1a4a);
    border: 1.5px solid #4a3a8a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.vr-toggle-btn:hover {
    border-color: #7755dd;
    box-shadow: 0 0 16px rgba(102, 68, 204, 0.4);
    transform: scale(1.08);
}
.vr-toggle-btn.active {
    background: linear-gradient(135deg, #2a0a3a, #4a1a6a);
    border-color: #ff6b9d;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.35);
}
.vr-toggle-icon { font-size: 20px; line-height: 1; }
.vr-toggle-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 1.5px solid #6644cc;
    animation: vrTogglePulse 2.5s infinite;
    pointer-events: none;
    opacity: 0;
}
.vr-toggle-btn:not(.active) .vr-toggle-pulse { animation: vrTogglePulse 2.5s infinite; }
.vr-toggle-btn.active .vr-toggle-pulse { border-color: #ff6b9d; animation: vrTogglePulse 1.5s infinite; }
@keyframes vrTogglePulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* ── Voice Room Panel (Right-Side Drawer) ──────── */
.voice-room-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    height: 100vh;
    background: linear-gradient(180deg, #08081a 0%, #0a0a1e 40%, #060612 100%);
    border-left: 1px solid #2a2a60;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.7), 0 0 60px rgba(102, 68, 204, 0.1);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.voice-room-panel.open {
    right: 0;
}
/* Backdrop overlay when drawer is open */
.vr-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.vr-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ────────────────────────────────────── */
.vr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #0c0c22;
    border-bottom: 1px solid #2a2a50;
}
.vr-header-left { display: flex; align-items: center; gap: 10px; }
.vr-title { font-weight: 700; font-size: 15px; color: #eaf0ff; }
.vr-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #1a1a3a;
    color: #888;
}
.vr-status.connected { background: #0a2a0a; color: #0f0; }
.vr-status.meeting { background: #2a0a0a; color: #f44; animation: meetingPulse 1s infinite; }
.vr-status.error { background: #2a0a0a; color: #f44; }
@keyframes meetingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.vr-header-right { display: flex; gap: 6px; }
.vr-btn {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #2a2a50;
    background: #1a1a3a;
    color: #aaa;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.vr-btn:hover { background: #2a2a5a; color: #fff; }
.vr-btn.meeting:hover { border-color: #f44; color: #f44; }
.vr-btn.meeting.active { background: #2a0a0a; border-color: #f44; color: #f44; }
.vr-btn.end { border-color: #f44; color: #f44; }
.vr-btn.end:hover { background: #2a0a0a; }

/* ── Active Speaker ────────────────────────────── */
.vr-active-speaker {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0a0a2a, #1a0a3a);
    border-bottom: 1px solid #2a2a50;
    border-left: 3px solid #6644cc;
}
.speaker-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
}
.wave-bar {
    width: 4px;
    background: linear-gradient(to top, #6644cc, #aa66ff);
    border-radius: 2px;
    animation: waveAnim 0.8s ease-in-out infinite alternate;
    animation-play-state: paused;
}
.wave-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 30px; animation-delay: 0.15s; }
.wave-bar:nth-child(5) { height: 20px; animation-delay: 0.3s; }
.wave-bar:nth-child(6) { height: 28px; animation-delay: 0.05s; }
.wave-bar:nth-child(7) { height: 14px; animation-delay: 0.25s; }
.wave-bar:nth-child(8) { height: 22px; animation-delay: 0.35s; }
.wave-bar:nth-child(9) { height: 10px; animation-delay: 0.4s; }
@keyframes waveAnim {
    from { height: 4px; }
    to { height: 28px; }
}
.speaker-info { display: flex; flex-direction: column; }
.speaker-name { font-weight: 700; font-size: 14px; color: #eaf0ff; }
.speaker-role { font-size: 11px; color: #8899bb; }

/* ── Self Controls ─────────────────────────────── */
.vr-self-controls {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #0a0a1e;
    border-bottom: 1px solid #1a1a3a;
}
.vr-self-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #2a2a50;
    background: #0e1e0e;
    color: #0f0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.vr-self-btn:hover { background: #1a2e1a; }
.vr-self-btn.muted, .vr-self-btn.deafened {
    background: #1e0a0a;
    border-color: #661a1a;
    color: #f44;
}
.self-icon { font-size: 18px; }
.self-label { font-size: 12px; font-weight: 600; }

/* ── Agent Grid ────────────────────────────────── */
.vr-agents-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.vr-team-section { margin-bottom: 8px; }
.vr-team-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 0;
}
.vr-agent-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.vr-agent-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    padding: 6px 4px;
    border-radius: 10px;
    background: #0e0e1e;
    border: 1px solid #1a1a3a;
    cursor: pointer;
    transition: all 0.2s;
}
.vr-agent-card:hover {
    background: #1a1a3a;
    border-color: #3a3a6a;
    transform: translateY(-2px);
}
.vr-agent-card.active {
    background: linear-gradient(135deg, #0a1a0a, #0a2a0a);
    border-color: #0f0;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.2);
}
.vr-agent-card.agent-muted {
    opacity: 0.4;
}
.vr-agent-avatar {
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #2a2a50;
    background: #0a0a1e;
    margin-bottom: 4px;
    transition: all 0.2s;
    cursor: pointer;
}
.vr-agent-card.active .vr-agent-avatar {
    border-color: #0f0;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}
.vr-agent-name {
    font-size: 9px;
    color: #8899bb;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.vr-agent-controls {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}
.vr-ctrl {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #2a2a50;
    background: #0a0a1e;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}
.vr-ctrl:hover { background: #2a2a5a; }
.vr-agent-status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
}
.vr-agent-card.agent-ready .vr-agent-status-dot {
    background: var(--accent-success);
    box-shadow: 0 0 7px var(--accent-success);
}
.vr-agent-card.agent-unconfigured {
    opacity: 0.55;
}
.vr-agent-card.agent-unconfigured .vr-agent-status-dot {
    background: var(--accent-danger);
    box-shadow: 0 0 7px var(--accent-danger);
}
.vr-agent-card.active .vr-agent-status-dot {
    background: #0f0;
    box-shadow: 0 0 6px #0f0;
}

/* ── Transcript ────────────────────────────────── */
.vr-transcript {
    min-height: 120px;
    max-height: 220px;
    overflow-y: auto;
    padding: 12px 16px;
    background: #060610;
    border-top: 1px solid #1a1a3a;
    font-size: 12px;
}
.transcript-placeholder {
    color: #555;
    text-align: center;
    padding: 16px;
    font-style: italic;
}
.transcript-entry {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px solid #0a0a1a;
    align-items: baseline;
}
.transcript-speaker {
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
    min-width: 80px;
}
.transcript-text { color: #ccd; flex: 1; word-break: break-word; }
.transcript-time { color: #555; font-size: 10px; white-space: nowrap; }

/* ── Incoming Call Notification ─────────────────── */
.incoming-call {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.92);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.call-ring-animation {
    position: relative;
    width: 120px;
    height: 120px;
}
.ring-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin: -40px;
    border-radius: 50%;
    border: 2px solid #0f0;
    animation: ringPulse 1.5s ease infinite;
}
.ring-circle.delay-1 { animation-delay: 0.3s; }
.ring-circle.delay-2 { animation-delay: 0.6s; }
@keyframes ringPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}
.call-info { text-align: center; }
.call-avatar { font-size: 48px; margin-bottom: 12px; }
.call-name {
    font-size: 22px;
    font-weight: 800;
    color: #eaf0ff;
    margin-bottom: 6px;
}
.call-topic {
    font-size: 14px;
    color: #8899bb;
}
.call-actions { display: flex; gap: 20px; }
.call-btn {
    padding: 14px 32px;
    border-radius: 50px;
    border: 2px solid;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.call-btn.accept {
    background: #0a2a0a;
    border-color: #0f0;
    color: #0f0;
}
.call-btn.accept:hover {
    background: #0f0;
    color: #000;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.4);
}
.call-btn.decline {
    background: #2a0a0a;
    border-color: #f44;
    color: #f44;
}
.call-btn.decline:hover {
    background: #f44;
    color: #000;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.4);
}

/* ── Scrollbar (Voice Room) ────────────────────── */
.vr-agents-grid::-webkit-scrollbar,
.vr-transcript::-webkit-scrollbar {
    width: 4px;
}
.vr-agents-grid::-webkit-scrollbar-thumb,
.vr-transcript::-webkit-scrollbar-thumb {
    background: #2a2a50;
    border-radius: 2px;
}

/* ── Mobile (Voice Room Drawer) ────────────────── */
@media (max-width: 600px) {
    .voice-room-panel {
        width: 100vw;
        right: -100vw;
    }
    .voice-room-panel.open { right: 0; }
    .vr-toggle-btn { width: 40px; height: 40px; }
    .vr-toggle-icon { font-size: 17px; }
}

/* ═══ VOICE ROOM V2 (SWARM UI) ═══ */
.vr-groups-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex: 1;
    overflow-y: hidden; /* No scroll on mobile */
    padding-bottom: 20px;
}

.vr-group-block {
    background: rgba(20, 20, 25, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    min-height: 90px;
}

.vr-group-block:hover {
    border-color: #f00;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
    transform: translateY(-2px);
}

.vr-group-block.speaking {
    animation: pulse-glow 1.5s infinite;
    border-color: #0f0;
}

.vr-group-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 8px;
}

.vr-agent-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #333;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.agent-dot.active {
    background: #0f0;
    box-shadow: 0 0 10px #0f0, inset 0 0 5px #fff;
}

.agent-dot.speaking {
    background: #ff0055;
    box-shadow: 0 0 15px #ff0055, inset 0 0 5px #fff;
}

/* Control Row */
.vr-controls-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.vr-ctrl-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    border-radius: 12px;
    border: none;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.vr-ctrl-btn .ctrl-icon {
    font-size: 18px;
    margin-bottom: 4px;
}

.vr-ctrl-btn.state-green {
    background: rgba(0, 255, 0, 0.1);
    color: #0f0;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.vr-ctrl-btn.state-red {
    background: rgba(255, 0, 0, 0.15);
    color: #ff3333;
    border: 1px solid rgba(255, 0, 0, 0.4);
}

.vr-ctrl-btn.state-blue {
    background: rgba(0, 150, 255, 0.15);
    color: #00aaff;
    border: 1px solid rgba(0, 150, 255, 0.4);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 10px rgba(0,255,0,0.2); }
    50% { box-shadow: 0 0 25px rgba(0,255,0,0.6); }
    100% { box-shadow: 0 0 10px rgba(0,255,0,0.2); }
}

.group-detail-header {
    text-align: center;
    margin-bottom: 15px;
}
.group-detail-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}
