/* 
 * OUSS OS V2 - Premium Dashboard Stylesheet
 * Custom Dark Glassmorphism Design
 */

:root {
    /* Color Palette - Vibrant/Neon */
    --color-primary: #4F46E5; /* Vibrant Indigo */
    --color-primary-light: #6366F1;
    --color-primary-dark: #3730A3;
    --color-primary-neon: #818CF8;
    
    --color-accent: #F43F5E; /* Neon Pink/Rose */
    --color-accent-light: #FB7185;
    --color-accent-neon: #FFA7B6;
    
    --color-bg-dark: #05050A; /* Deep OLED Black */
    --color-bg-card: rgba(15, 15, 25, 0.4);
    --color-bg-sidebar: rgba(8, 8, 14, 0.6);
    
    /* Text Colors */
    --color-text: #F3F4F6;
    --color-text-muted: #9CA3AF;
    --color-text-inverse: #FFFFFF;
    
    /* Semantic Colors */
    --color-success: #10B981; /* Neon Green */
    --color-warning: #F59E0B; /* Vibrant Amber */
    --color-danger: #EF4444; /* Bright Red */
    --color-info: #3B82F6; /* Bright Blue */
    
    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-highlight: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(24px);
    
    /* Geometry */
    --radius: 20px;
    --radius-sm: 10px;
    --radius-lg: 30px;
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 80px;
    --header-height: 80px;
    
    /* Typography */
    --font-primary: 'Poppins', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}


/* =========================================
   RESET & BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    background: 
        radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(244, 63, 94, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
    background-color: var(--color-bg-dark);
    background-attachment: fixed;
    animation: bgFloat 15s ease-in-out infinite alternate;
}

@keyframes bgFloat {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--color-text-inverse);
    margin-bottom: 0.5rem;
}

a {
    text-decoration: none;
    color: var(--color-primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-light);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* =========================================
   SCREENS (Login vs App)
   ========================================= */
.screen {
    display: none !important;
    min-height: 100vh;
    width: 100%;
}
.screen.active {
    display: flex !important;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, var(--color-bg-card) 0%, var(--color-bg-dark) 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.login-card .brand-logo {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.login-card h2 {
    margin-bottom: 0.25rem;
}

.login-card p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* =========================================
   COMPONENTS
   ========================================= */

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: transform var(--transition-normal), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.glass-card:hover {
    border-color: rgba(129, 140, 248, 0.3); /* Neon subtle border */
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5), 0 0 20px rgba(79, 70, 229, 0.15);
    transform: translateY(-4px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease-out, height 0.4s ease-out, opacity 0.4s ease-out;
}

.btn:active::after {
    width: 250px;
    height: 250px;
    opacity: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6), 0 0 15px var(--color-primary-neon), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-outline {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border-highlight);
    color: var(--color-text);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--color-primary-neon);
    color: white;
    box-shadow: 0 0 15px rgba(129, 140, 248, 0.2);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}
.btn-ghost:hover {
    background: var(--glass-bg-hover);
    color: var(--color-primary-neon);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.btn-icon:hover {
    background: var(--glass-bg-hover);
    color: var(--color-text);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}
.form-group input, 
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-fast);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(58, 63, 196, 0.2);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.span-full {
    grid-column: 1 / -1;
}

/* Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.badge.success { background: rgba(34, 197, 94, 0.15); color: var(--color-success); border: 1px solid rgba(34, 197, 94, 0.2); }
.badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge.danger { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge.info { background: rgba(59, 130, 246, 0.15); color: var(--color-info); border: 1px solid rgba(59, 130, 246, 0.2); }

/* =========================================
   LAYOUT (Sidebar + Main)
   ========================================= */
#main-app {
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--glass-border);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow);
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}
.brand-logo i {
    color: var(--color-accent);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    transition: all var(--transition-fast);
}
.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}
.nav-item:hover, .nav-item.active {
    color: white;
    background: var(--glass-bg-hover);
}
.nav-item.active {
    background: linear-gradient(90deg, rgba(58, 63, 196, 0.2), transparent);
    border-left: 3px solid var(--color-primary);
}
.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

/* Main Wrapper & Topbar */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-height);
    background: rgba(10, 10, 26, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-menu-btn {
    display: none;
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    width: 350px;
}
.search-bar i {
    color: var(--color-text-muted);
    margin-right: 0.5rem;
}
.search-bar input {
    background: none;
    border: none;
    color: var(--color-text);
    width: 100%;
    outline: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.connection-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-text-muted);
}
.connection-status.connected {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2s infinite;
}

.notify-btn .notify-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--color-danger);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}
.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
}
.user-info {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}
.user-role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* =========================================
   PAGE CONTENT
   ========================================= */
.content-area {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.page-view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.page-view.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.stat-icon.primary { background: rgba(58, 63, 196, 0.15); color: var(--color-primary-light); }
.stat-icon.accent { background: rgba(245, 166, 35, 0.15); color: var(--color-accent); }
.stat-icon.success { background: rgba(34, 197, 94, 0.15); color: var(--color-success); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
    margin: 0;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0.25rem 0;
}
.stat-change {
    font-size: 0.8rem;
    font-weight: 500;
}
.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-danger); }
.stat-change.neutral { color: var(--color-text-muted); }

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.card-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.chart-wrapper {
    height: 300px;
    width: 100%;
}

/* Activity Feed */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.feed-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}
.feed-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.feed-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-light);
}
.feed-content h4 {
    font-size: 0.9rem;
    margin: 0;
}
.feed-content p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0.2rem 0 0 0;
}
.feed-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}
.data-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
}
.data-table tbody tr {
    transition: background var(--transition-fast);
}
.data-table tbody tr:hover {
    background: var(--glass-bg-hover);
}
.data-table td {
    font-size: 0.95rem;
}

/* Products View */
.pipeline-stages {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}
.stage {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}
.stage:hover {
    color: white;
}
.stage.active {
    background: var(--color-primary);
    color: white;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.product-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.product-image {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: rgba(0,0,0,0.3);
}
.product-info h3 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
}
.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}
.product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* File Upload */
.file-upload-box {
    border: 2px dashed var(--glass-border-highlight);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: rgba(0,0,0,0.1);
}
.file-upload-box:hover {
    border-color: var(--color-primary);
    background: rgba(58, 63, 196, 0.05);
}
.file-upload-box i {
    font-size: 2.5rem;
    color: var(--color-primary-light);
    margin-bottom: 1rem;
}
.image-preview {
    margin-top: 1rem;
    width: 100%;
    height: 200px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
}
.hidden { display: none !important; }

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}
.modal {
    width: 100%;
    max-width: 500px;
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-normal);
}
.modal-backdrop.show .modal {
    transform: translateY(0) scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}
.toast {
    background: var(--color-bg-card);
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out forwards;
    min-width: 300px;
}
.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-danger); }
.toast.warning { border-color: var(--color-warning); }
.toast-icon { font-size: 1.2rem; }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast-content h4 { margin: 0 0 0.25rem 0; font-size: 0.95rem; }
.toast-content p { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.mobile-open {
        left: 0;
    }
    /* Mobile Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s;
    }
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    .topbar {
        padding: 0 1rem;
        height: 70px;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .search-bar {
        display: none; /* Can be toggleable */
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .content-area {
        padding: 1rem;
    }
    .stat-card {
        padding: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* =========================================
   AI CO-PILOT COMMAND BAR
   ========================================= */
.copilot-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(244,63,94,0.08));
    border: 1px solid rgba(129,140,248,0.2);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}
.copilot-bar::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 200%; height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(129,140,248,0.08) 50%, transparent 100%);
    animation: copilotShimmer 4s infinite linear;
}
@keyframes copilotShimmer {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(50%); }
}
.copilot-bar:focus-within {
    border-color: var(--color-primary-neon);
    box-shadow: 0 0 25px rgba(79,70,229,0.25), 0 0 60px rgba(79,70,229,0.08);
}
.copilot-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1rem;
    flex-shrink: 0;
    animation: copilotPulse 2s infinite;
    z-index: 1;
}
@keyframes copilotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.5); }
    50% { box-shadow: 0 0 0 8px rgba(79,70,229,0); }
}
.copilot-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    outline: none;
    z-index: 1;
}
.copilot-input::placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}
.copilot-send {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border: none;
    color: white;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 1;
    flex-shrink: 0;
}
.copilot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(79,70,229,0.5);
}
.copilot-response {
    background: rgba(79,70,229,0.08);
    border: 1px solid rgba(129,140,248,0.15);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.copilot-response.visible {
    display: block;
}
.copilot-response p {
    margin: 0;
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.6;
}
.copilot-response .copilot-label {
    font-size: 0.75rem;
    color: var(--color-primary-neon);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: flex; align-items: center; gap: 0.4rem;
}

/* =========================================
   AGENTS DASHBOARD CARDS
   ========================================= */
.agents-monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.agent-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.agent-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.agent-card:hover {
    border-color: rgba(129,140,248,0.3);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4), 0 0 20px rgba(79,70,229,0.1);
}
.agent-card:hover::after {
    opacity: 1;
}
.agent-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.agent-avatar {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.agent-avatar.media { background: rgba(59,130,246,0.15); color: var(--color-info); }
.agent-avatar.whatsapp { background: rgba(37,211,102,0.15); color: #25D366; }
.agent-avatar.logistics { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.agent-avatar.creative { background: rgba(168,85,247,0.15); color: #A855F7; }
.agent-avatar.cfo { background: rgba(16,185,129,0.15); color: var(--color-success); }
.agent-avatar.copilot { background: linear-gradient(135deg, rgba(79,70,229,0.2), rgba(244,63,94,0.15)); color: var(--color-accent); }

.agent-card-info h3 {
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
}
.agent-card-info p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0;
}

.agent-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.agent-status-indicator {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}
.agent-status-indicator .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.agent-status-indicator .dot.active {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2s infinite;
}
.agent-status-indicator .dot.paused {
    background: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
}

.agent-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.agent-metric {
    text-align: center;
    padding: 0.6rem 0.25rem;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
}
.agent-metric .metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}
.agent-metric .metric-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

.agent-actions {
    display: flex;
    gap: 0.5rem;
}
.agent-actions .btn {
    flex: 1;
}

.agent-log-feed {
    max-height: 120px;
    overflow-y: auto;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.agent-log-item {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    gap: 0.5rem;
}
.agent-log-item:last-child { border-bottom: none; }
.agent-log-item .log-time {
    color: var(--color-primary-neon);
    font-family: monospace;
    flex-shrink: 0;
}
.agent-log-item .log-msg {
    color: var(--color-text-muted);
}

/* =========================================
   CREATIVE STUDIO
   ========================================= */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.studio-output {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    min-height: 200px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text);
    white-space: pre-wrap;
}
.studio-output .output-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #A855F7;
    margin-bottom: 0.75rem;
    display: flex; align-items: center; gap: 0.4rem;
}
.hook-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
}
.hook-card:hover {
    border-color: rgba(168,85,247,0.4);
    background: var(--glass-bg-hover);
}
.hook-card .hook-number {
    font-size: 0.7rem;
    color: #A855F7;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.hook-card .hook-text {
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.5rem;
}
.hook-card .hook-script {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* =========================================
   LOGISTIQUE AVANCEE
   ========================================= */
.reconciliation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.recon-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.recon-card h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
}
.recon-amount {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}
.recon-detail {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Helper Classes */
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-4 { padding: 1.5rem; }
.gap-3 { gap: 1.5rem; }
.text-center { text-align: center; }

/* Typing animation for copilot */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.typing-cursor::after {
    content: '▊';
    animation: blink 0.8s infinite;
    color: var(--color-primary-neon);
    margin-left: 2px;
}

/* Responsive for new elements */
@media (max-width: 768px) {
    .agents-monitor-grid {
        grid-template-columns: 1fr;
    }
    .studio-grid {
        grid-template-columns: 1fr;
    }
    .agent-metrics {
        grid-template-columns: 1fr 1fr;
    }
    .copilot-bar {
        flex-wrap: nowrap;
    }
}

/* =========================================
   HIERARCHIE SUB-AGENTS & INTERACTIVE TREE
   ========================================= */
.main-agent-box {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: all var(--transition-normal);
    position: relative;
}
.main-agent-box:hover {
    border-color: rgba(129, 140, 248, 0.4);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 25px rgba(79, 70, 229, 0.15);
}
.main-agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1.25rem;
}
.main-agent-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.main-agent-title h3 {
    font-size: 1.2rem;
    margin: 0;
    color: white;
}
.main-agent-title p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}
.subagent-count-badge {
    background: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.3);
    color: var(--color-primary-neon);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Sub-Agents Grid */
.subagents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    position: relative;
}
.subagent-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: all var(--transition-fast);
    position: relative;
}
.subagent-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 3px;
    background: var(--color-primary-neon);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}
.subagent-card.running::before {
    background: var(--color-success);
    box-shadow: 0 0 10px var(--color-success);
}
.subagent-card.paused::before {
    background: var(--color-warning);
}
.subagent-card:hover {
    border-color: rgba(129, 140, 248, 0.3);
    background: rgba(15, 15, 30, 0.4);
    transform: translateY(-2px);
}

.subagent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.subagent-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-inverse);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.subagent-name i {
    color: var(--color-primary-neon);
}
.subagent-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
}
.subagent-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.subagent-status.paused {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.subagent-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.subagent-metrics-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}
.subagent-metrics-row span {
    color: var(--color-text-muted);
}
.subagent-metrics-row strong {
    color: white;
}
.subagent-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}
.subagent-actions-row .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
}
.subagent-log-drawer {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.75rem;
    font-family: monospace;
    max-height: 100px;
    overflow-y: auto;
    color: #A5B4FC;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.subagent-log-line {
    padding: 0.25rem 0;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
    line-height: 1.3;
}
.subagent-log-line:last-child { border-bottom: none; }
.subagent-log-line .timestamp {
    color: #818CF8;
    margin-right: 0.5rem;
}

