/* 🌿 TREEBIRD HUB - STYLE SHEET */
/* Aesthetic: Techno-Naturalist / Bioluminescent Control Room */

:root {
    /* -- PALETTE (Synced with Arti1) -- */
    /* Base - Earthy Darks */
    --bg-deep-slate: #1a1612;
    /* Deep earth */
    --bg-panel: #2a2420;
    /* Warm charcoal */
    --bg-panel-dark: #151210;
    /* Darker earth mix */

    /* Text */
    --text-bone: #e8e4df;
    /* Warm white */
    --text-dim: #9a958f;
    /* Muted earth */

    /* Accents */
    --accent-blue: #4a90d9;
    /* Bluejay */
    --accent-green: #6b9a5b;
    /* Moss */
    --accent-rust: #a85a4a;
    /* Terracotta */
    --accent-gold: #c9a227;
    /* Aged Gold */

    /* -- FONTS -- */
    --font-head: 'Spectral', serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    /* Bigger by default */
    font-size: 16px;

    /* -- SPACING -- */
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
}

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

/* -- 1. BACKGROUND TEXTURES (Tribal Polish) -- */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    /* Noise texture */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    opacity: 0.08;
}

/* Amazigh Geometric Pattern Background */
body {
    background-color: var(--bg-deep-slate);
    color: var(--text-bone);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;

    /* Tribal Pattern */
    background-image:
        radial-gradient(var(--bg-panel) 1px, transparent 1px),
        radial-gradient(var(--bg-panel) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* -- LAYOUT GRID -- */
.nexus-container {
    display: grid;
    grid-template-columns: 260px 1fr 360px;
    /* Sidebar | Stage | Stream */
    grid-template-rows: 1fr auto;
    /* Content | Console (Dynamic Height) */
    height: 100vh;
    height: 100dvh;
    /* Dynamic Viewport Height for mobile/laptops */
    width: 100vw;
    overflow: hidden;
    /* Prevent full page scroll */
    background: radial-gradient(circle at center, rgba(74, 144, 217, 0.03) 0%, transparent 70%);
}

/* Responsive - Tablet/Laptop */
@media (max-width: 1200px) {
    .nexus-container {
        grid-template-columns: 200px 1fr 280px;
    }
}

/* -- MOBILE NAVIGATION -- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(26, 22, 18, 0.95);
    border-top: 1px solid var(--text-dim);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-code);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.05);
    border-top: 2px solid var(--accent-gold);
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

/* Responsive - Mobile (< 768px) */
@media (max-width: 768px) {
    .nexus-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        /* Full height content */
        display: block;
        /* Switch to stack */
        padding-bottom: 60px;
        /* Space for nav */
    }

    /* Hide Desktop Views by default (except Drawer) */
    .sidebar-flock,
    .center-stage {
        display: none;
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border: none;
        z-index: 100;
        background: var(--bg-deep-slate);
    }

    /* STREAM DRAWER (Slide Over) */
    .stream-panel {
        display: flex !important;
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        height: 100%;
        z-index: 2000;
        transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
        border-left: 1px solid var(--accent-rust);
    }

    .stream-panel.active-drawer {
        right: 0;
    }

    /* Show only active tab */
    .sidebar-flock.active-tab,
    .center-stage.active-tab {
        display: flex;
    }

    /* Mobile Nav Visible */
    .mobile-nav {
        display: flex;
    }

    /* Specific Adjustments */
    .sidebar-flock {
        padding-top: 20px;
    }

    .logo-area {
        display: block !important;
    }

    .agent-name,
    .agent-role {
        display: block !important;
        /* Restore agent info in mobile tab */
    }

    .console-bar {
        position: fixed;
        bottom: 60px;
        /* Above nav */
        width: 100%;
        z-index: 2001;
        /* Above Drawer */
        display: none;
        /* Hide default fixed console */
    }

    /* Re-add console inside stream panel for mobile if needed, 
       or just position it fixed when Stream tab is active.
       Let's stick to fixed position but toggle visibility via JS.
    */
    .console-bar.mobile-visible {
        display: flex;
    }
}

/* -- 1. SIDEBAR (The Flock) -- */
.sidebar-flock {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background-color: var(--bg-panel-dark);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    /* Allow scrolling if agent list is long */
}

.logo-area {
    margin-bottom: var(--space-lg);
    text-align: center;
    opacity: 0.9;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-glyph {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    text-shadow: 0 0 15px rgba(107, 154, 91, 0.3);
}

.logo-area h1 {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 3px;
    line-height: 1.1;
    color: var(--text-bone);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.agent-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    /* Organic Borders - Wabi Sabi */
    border-radius: 2px 8px 3px 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.agent-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(3px) rotate(0.5deg);
}

.agent-card.active {
    background: rgba(74, 144, 217, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 4px 2px 6px 3px;
}

/* Clean status dots */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 12px;
}

.status-dot.online {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.busy {
    background-color: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
}

.status-dot.offline {
    background-color: var(--text-dim);
    opacity: 0.5;
}

/* 🟡 Stale status (>15s since last heartbeat) */
.status-dot.stale {
    background-color: var(--accent-gold);
    box-shadow: 0 0 8px var(--accent-gold);
    animation: stale-pulse 2s infinite;
}

@keyframes stale-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ⚡ Live status flash animation */
.status-dot.status-flash {
    animation: status-flash 0.5s ease-out;
}

@keyframes status-flash {
    0% { transform: scale(2); box-shadow: 0 0 20px currentColor; }
    100% { transform: scale(1); }
}

.agent-avatar {
    width: 48px;
    height: 48px;
    margin-right: 16px;
    /* Slightly more spacing for larger icon */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    /* Larger fallback for emojis */
    overflow: hidden;
    /* Prevent spill */
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Legacy Emoji Support */
.agent-avatar:not(:has(img)) {
    filter: grayscale(20%);
    transition: filter 0.3s;
}

.agent-card:hover .agent-avatar:not(:has(img)) {
    filter: grayscale(0%);
}

.agent-info {
    display: flex;
    flex-direction: column;
}

.agent-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.agent-role {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: var(--font-code);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.system-status {
    margin-top: auto;
    padding-top: var(--space-md);
    border-top: 1px dotted #333;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-code);
    font-size: 0.7rem;
    color: var(--text-dim);
    opacity: 0.6;
}

/* -- 2. CENTER STAGE (The Work) -- */
.center-stage {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background-color: var(--bg-deep-slate);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333;
    position: relative;
}

/* Inner shadow for depth */
.center-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.stage-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    border-bottom: 1px solid #333;
    background-color: var(--bg-panel);
    font-family: var(--font-code);
}

.file-info {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.file-info strong {
    color: var(--text-bone);
    border-bottom: 1px dashed var(--text-dim);
    padding-bottom: 2px;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-left: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--text-bone);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.editor-canvas {
    flex: 1;
    display: flex;
    padding: 32px;
    font-family: var(--font-code);
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding-right: 24px;
    color: #3a3430;
    /* Subtle numbers */
    user-select: none;
    text-align: right;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    margin-right: 24px;
}

/* Syntax styling */
.md-h1 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    color: var(--accent-gold);
    font-weight: 700;
    margin-bottom: 1rem;
    display: block;
}

.md-h2 {
    font-family: var(--font-head);
    font-size: 1.2rem;
    color: var(--text-bone);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    display: block;
}

.md-quote {
    color: var(--accent-green);
    font-style: italic;
    font-family: var(--font-head);
    border-left: 2px solid var(--accent-green);
    padding-left: 12px;
    display: block;
    margin: 1rem 0;
}

.md-comment {
    color: #555;
    display: block;
    margin-top: 1rem;
}

/* Cursor Mock */
.cursor-watsan {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--accent-blue);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

.tag-watsan {
    background-color: var(--accent-blue);
    color: #000;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: bold;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* -- 3. STREAM PANEL (Connectivity) -- */
.stream-panel {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    border-left: 1px solid #333;
    z-index: 10;
    overflow: hidden;
    /* Constrain height */
}

.stream-header {
    height: 56px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    background: rgba(0, 0, 0, 0.2);
}

.stream-header h2 {
    font-family: var(--font-code);
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.live-indicator {
    font-size: 0.65rem;
    color: var(--accent-rust);
    font-family: var(--font-code);
    font-weight: 700;
    animation: pulse 3s infinite ease-in-out;
    padding: 2px 6px;
    border: 1px solid rgba(168, 90, 74, 0.3);
    border-radius: 10px;
}

@keyframes pulse {
    50% {
        opacity: 0.5;
    }
}

.stream-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.msg-bubble {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 2px 12px 2px 8px;
    /* Organic tribal shape */
    padding: 12px 16px;
    border-left: 3px solid transparent;
    transition: transform 0.2s;
    position: relative;
}

.msg-bubble::before {
    /* Tiny corner accent */
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent rgba(255, 255, 255, 0.05) transparent transparent;
}

.msg-bubble.system {
    text-align: center;
    background: none;
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 8px;
    opacity: 0.6;
}

/* Specific Agent Colors */
.msg-bubble.agent-watsan {
    border-left-color: var(--accent-blue);
    background: linear-gradient(90deg, rgba(74, 144, 217, 0.05) 0%, transparent 100%);
}

.msg-bubble.agent-birdsan {
    border-left-color: var(--accent-green);
    background: linear-gradient(90deg, rgba(107, 154, 91, 0.05) 0%, transparent 100%);
}

.msg-bubble.agent-artisan {
    border-left-color: var(--accent-gold);
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.05) 0%, transparent 100%);
}

.msg-bubble.agent-spidersan {
    border-left-color: #666;
}

.msg-bubble.agent-treebird {
    border-left-color: var(--accent-green);
    background: linear-gradient(90deg, rgba(107, 154, 91, 0.08) 0%, transparent 100%);
    font-style: italic;
    border-radius: 4px 16px 4px 12px;
}

.msg-bubble.agent-treebird p {
    font-family: var(--font-head);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.msg-bubble.human-msg {
    border-left-color: var(--accent-rust);
    background: linear-gradient(90deg, rgba(168, 90, 74, 0.08) 0%, transparent 100%);
}

.msg-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 6px;
    font-family: var(--font-code);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* -- 4. CONSOLE BAR (The Root) -- */
.console-bar {
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    background-color: var(--bg-panel-dark);
    border-top: 1px solid var(--accent-rust);
    display: flex;
    align-items: center;
    padding: 16px 32px;
    /* Increased vertical padding */
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.console-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    background: var(--bg-deep-slate);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px 16px;
    transition: all 0.3s;
    /* Organic wobble */
    clip-path: polygon(0% 0%, 100% 0%, 99% 100%, 1% 100%);
}

.console-wrapper:focus-within {
    border-color: var(--accent-rust);
    box-shadow: 0 0 20px rgba(168, 90, 74, 0.15);
    transform: scale(1.005);
}

.console-prompt {
    font-family: var(--font-code);
    color: var(--accent-rust);
    margin-right: 16px;
    font-size: 0.9rem;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(168, 90, 74, 0.3);
}

.console-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-bone);
    font-family: var(--font-code);
    font-size: 1rem;
    outline: none;
    transition: background 0.2s ease;
}

.console-input.command-sent {
    background: rgba(107, 154, 91, 0.15);
}

.console-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.console-actions {
    margin-left: var(--space-md);
}

.action-btn {
    background: rgba(168, 90, 74, 0.1);
    color: var(--accent-rust);
    border: 1px solid var(--accent-rust);
    padding: 6px 16px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: all 0.2s;
    text-transform: uppercase;
}

.action-btn:hover {
    background: var(--accent-rust);
    color: #000;
    box-shadow: 0 0 8px var(--accent-rust);
}

/* -- 5. MODAL (Tribal Overlay) -- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 22, 18, 0.85);
    /* Deep earth fade */
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-panel);
    width: 400px;
    border: 1px solid var(--accent-rust);
    border-radius: 2px 12px 4px 8px;
    /* Apparent organic shape */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    padding: 0;
    transform: scale(1) rotate(-1deg);
    transition: transform 0.2s;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.95);
}

.modal-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    font-family: var(--font-code);
    color: var(--accent-rust);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.modal-body {
    padding: 24px;
}

.form-group label {
    display: block;
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    padding: 12px;
    color: var(--accent-gold);
    font-family: var(--font-code);
    font-size: 1rem;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.1);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 6px;
    font-style: italic;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: right;
}

/* Sidebar Button Override */
.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-code);
    font-size: 0.7rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--accent-gold);
}

/* -- UNREAD BADGE (Myceliumail Inbox) -- */
.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-rust);
    color: var(--bg-deep-slate);
    font-family: var(--font-code);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 8px rgba(168, 90, 74, 0.5);
    animation: badge-pulse 2s infinite ease-in-out;
}

@keyframes badge-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* -- ADMIN TODO SECTION -- */
.admin-todo {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.todo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-sm);
    font-family: var(--font-code);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.todo-icon {
    font-size: 0.9rem;
}

.todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.8rem;
    color: var(--text-bone);
    transition: opacity 0.2s;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item input[type="checkbox"] {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--accent-rust);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.todo-item input[type="checkbox"]:checked {
    background: var(--accent-rust);
}

.todo-item input[type="checkbox"]:checked+label {
    text-decoration: line-through;
    opacity: 0.5;
}

.todo-item label {
    cursor: pointer;
    flex: 1;
}

#add-todo-btn {
    margin-top: var(--space-sm);
    width: 100%;
    text-align: center;
    padding: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#add-todo-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* -- INBOX PREVIEW PANEL -- */
.inbox-preview {
    position: absolute;
    bottom: 80px;
    left: var(--space-md);
    right: var(--space-md);
    background: var(--bg-panel);
    border: 1px solid var(--accent-rust);
    border-radius: 4px 8px 4px 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    max-height: 200px;
    overflow: hidden;
    animation: slide-up 0.3s ease-out;
}

.inbox-preview.hidden {
    display: none;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inbox-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.inbox-title {
    flex: 1;
    font-family: var(--font-code);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--accent-rust);
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-icon-small:hover {
    color: var(--text-bone);
}

.inbox-messages {
    max-height: 140px;
    overflow-y: auto;
    padding: 8px;
}

.inbox-msg {
    padding: 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    border-left: 2px solid var(--accent-green);
    font-size: 0.75rem;
}

.inbox-msg.unread {
    border-left-color: var(--accent-rust);
    background: rgba(168, 90, 74, 0.08);
}

.inbox-msg-from {
    font-weight: 700;
    color: var(--text-bone);
    font-family: var(--font-code);
    font-size: 0.7rem;
}

.inbox-msg-subject {
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- MUSHROOM SPORE NOTIFICATION -- */
.spore {
    position: fixed;
    width: 6px;
    height: 6px;
    background: var(--accent-rust);
    border-radius: 50%;
    pointer-events: none;
    animation: spore-float 2s ease-out forwards;
    box-shadow: 0 0 10px var(--accent-rust);
}

@keyframes spore-float {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-100px);
    }
}

/* -- STREAM TABS -- */
.stream-tabs {
    display: flex;
    gap: 4px;
}

.stream-tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-code);
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
}

.stream-tab:hover {
    color: var(--text-bone);
}

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

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* -- CHAT ROOM -- */
.chat-room {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-welcome {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-dim);
}

.chat-welcome .chat-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.chat-welcome p {
    font-family: var(--font-head);
    font-size: 1rem;
    margin-bottom: 4px;
}

.chat-welcome small {
    font-family: var(--font-code);
    font-size: 0.7rem;
    opacity: 0.6;
}

.chat-msg {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px 12px 12px 4px;
    padding: 10px 14px;
    border-left: 3px solid var(--accent-blue);
    animation: chat-slide-in 0.2s ease-out;
}

@keyframes chat-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-msg.self {
    border-left-color: var(--accent-rust);
    background: rgba(168, 90, 74, 0.08);
}

.chat-msg.agent {
    border-left-color: var(--accent-green);
    background: rgba(107, 154, 91, 0.08);
}

.chat-msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 4px;
    font-family: var(--font-code);
    opacity: 0.7;
}

.chat-msg-sender {
    font-weight: 700;
    color: var(--text-bone);
}

.chat-msg-time {
    color: var(--text-dim);
}

.chat-msg-text {
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg-text .mention {
    color: var(--accent-gold);
    font-weight: 700;
}

/* Chat Input */
.chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    gap: 8px;
}

.chat-input {
    flex: 1;
    background: var(--bg-deep-slate);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text-bone);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--accent-rust);
}

.chat-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.chat-send-btn {
    background: var(--accent-rust);
    border: none;
    color: #000;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: var(--accent-gold);
    transform: scale(1.05);
}

/* -- 🕷️ SPIDERSAN UI STYLES -- */

/* Conflict Warning Banner */
.conflict-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(90deg, rgba(168, 90, 74, 0.95), rgba(201, 162, 39, 0.9));
    color: #000;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.conflict-warning.visible {
    transform: translateY(0);
}

.conflict-icon {
    font-size: 1.5rem;
}

.conflict-text {
    flex: 1;
    font-family: var(--font-code);
    font-size: 0.85rem;
}

.conflict-text strong {
    color: #1a1612;
}

.conflict-dismiss {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: #000;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.conflict-dismiss:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Branch Registry Panel */
.branch-registry {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.registry-title {
    font-family: var(--font-code);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.registry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.registry-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 2px;
    font-family: var(--font-code);
    font-size: 0.75rem;
    transition: background 0.2s;
}

.registry-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.registry-status {
    font-size: 0.7rem;
}

.registry-branch {
    flex: 1;
    color: var(--text-bone);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.registry-agent {
    color: var(--text-dim);
    font-size: 0.65rem;
}

.registry-empty {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.75rem;
    text-align: center;
    padding: 8px;
}

/* Spidersan message styling */
.msg-bubble.agent-spidersan {
    border-left-color: #888;
    background: linear-gradient(90deg, rgba(136, 136, 136, 0.08) 0%, transparent 100%);
}