/* ==========================================================================
   DESIGN SYSTEM & CUSTOM VARIABLES (Servus Theme)
   ========================================================================== */
:root {
    /* Color Palette: Deep Cosmic Slate & Glowing Neon Accents */
    --bg-primary: #060913;
    --bg-secondary: #0d1326;
    --card-bg-glass: rgba(13, 20, 38, 0.55);
    --border-glass: rgba(255, 255, 255, 0.05);
    --border-glass-hover: rgba(255, 255, 255, 0.12);
    
    /* Neon glow colors */
    --accent-green: #10b981;       /* Active / OK State */
    --accent-green-glow: rgba(16, 185, 129, 0.35);
    --accent-purple: #8b5cf6;      /* Main branding */
    --accent-purple-glow: rgba(139, 92, 246, 0.35);
    --accent-blue: #06b6d4;        /* Info / Sub-states */
    --accent-blue-glow: rgba(6, 182, 212, 0.3);
    --accent-red: #ef4444;         /* Error / Attack blocked */
    --accent-red-glow: rgba(239, 68, 68, 0.4);

    /* Text colors */
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Spacing & Borders */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-outfit: 'Outfit', sans-serif;
    --font-fira: 'Fira Code', monospace;
}

/* ==========================================================================
   GLOBAL RESET & THEME BASICS
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* ==========================================================================
   ANIMATED GRADIENT GLOWS & BACKGROUND GRID
   ========================================================================== */
.bg-gradient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: 
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
    filter: blur(40px);
    animation: bg-pulse 20s infinite alternate ease-in-out;
}

@keyframes bg-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1) translate(20px, -20px); }
}

.bg-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* ==========================================================================
   GLASSMORPHISM BASE CLASS
   ========================================================================== */
.glass-card {
    background: var(--card-bg-glass);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   COMMON UI LAYOUTS & BUTTONS
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Form Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    background: rgba(6, 9, 19, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px var(--accent-purple-glow);
    background: rgba(6, 9, 19, 0.8);
}

.input-group select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Glowing Button */
.btn-glow {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #7c3aed 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    color: white;
    font-family: var(--font-outfit);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px var(--accent-purple-glow);
    transition: var(--transition-smooth);
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--accent-purple);
}

.btn-glow:active {
    transform: translateY(0);
}

/* Standard Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0891b2 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    color: white;
    font-family: var(--font-outfit);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px var(--accent-blue-glow);
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 15px var(--accent-blue);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-hover);
}

.link-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.link-btn:hover {
    color: var(--accent-purple);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close:hover {
    color: white;
}

/* ==========================================================================
   SCREEN 1: LOGIN PORTAL LAYOUT
   ========================================================================== */
#login-screen {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

#login-screen.active-screen {
    display: flex;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
}

.brand-header {
    text-align: center;
    margin-bottom: 28px;
}

.brand-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-purple-glow);
}

.logo-icon {
    font-size: 1.8rem;
    color: white;
    animation: float-slow 4s infinite alternate ease-in-out;
}

@keyframes float-slow {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-5px) rotate(3deg); }
}

.brand-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, white 40%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--accent-blue);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
}

.form-instructions {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.4;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 20px;
}

/* ==========================================================================
   SCREEN 2: SAAS DASHBOARD CONSOLE LAYOUT
   ========================================================================== */
#dashboard-screen {
    display: none;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

#dashboard-screen.active-screen {
    display: flex;
}

/* Header styling */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
}

.brand-icon {
    color: var(--accent-purple);
    font-size: 1.4rem;
}

.accent-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent-green);
    border-radius: 50%;
    margin-left: 2px;
}

.divider {
    width: 1px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.08);
}

.tenant-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 500;
}

.tenant-identity i {
    color: var(--accent-blue);
}

.tenant-display-name {
    font-size: 1.05rem;
}

.tenant-id-badge {
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-family: var(--font-fira);
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Connection Status Badge */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-live {
    border-color: rgba(16, 185, 129, 0.15);
    background: rgba(16, 185, 129, 0.04);
    color: var(--accent-green);
}

.badge-realgcp {
    border-color: rgba(139, 92, 246, 0.15);
    background: rgba(139, 92, 246, 0.04);
    color: #a78bfa;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.pulsing {
    animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* ==========================================================================
   METRICS PANEL GRID
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.metric-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.budget-color {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.agents-color {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.tasks-color {
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.15);
    color: var(--accent-blue);
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-val {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 2px 0;
    color: white;
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   DASHBOARD MAIN CONTENTS GRID
   ========================================================================== */
.dashboard-body {
    display: flex;
    gap: 24px;
}

.body-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.flex-grow-1 { flex: 1.1; }
.flex-grow-2 { flex: 2; }

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.panel-title i {
    color: var(--accent-purple);
}

/* ==========================================================================
   AI AGENTS GRID & CARD DESIGN
   ========================================================================== */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.agent-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    height: 100%;
}

.agent-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.agent-title-info h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.agent-sub-spec {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.agent-status-badge {
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-active {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.status-idle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.status-processing {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.agent-body {
    background: rgba(6, 9, 19, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    min-height: 72px;
}

.agent-footer {
    display: flex;
    gap: 10px;
}

.agent-footer .btn-secondary,
.agent-footer .btn-primary {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    justify-content: center;
}

/* ==========================================================================
   EXECUTION LEDGER TABLE CARD
   ========================================================================== */
.ledger-card {
    padding: 24px;
    height: 380px;
}

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

.log-table-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 16px;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.log-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.log-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    vertical-align: middle;
}

.log-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.log-table tr:last-child td {
    border-bottom: none;
}

.align-right { text-align: right; }
.cost-neg { color: #f87171; font-weight: 600; font-family: var(--font-fira); }
.cost-pos { color: var(--accent-green); font-weight: 600; font-family: var(--font-fira); }

.log-timestamp {
    font-family: var(--font-fira);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.log-agent-name {
    font-weight: 600;
    color: white;
}

/* Log entrance animation */
@keyframes row-slide-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-row-animate {
    animation: row-slide-in 0.3s ease-out forwards;
}

/* ==========================================================================
   EDUCATIONAL RLS SHIELD CARD
   ========================================================================== */
.shield-card {
    padding: 24px;
}

.shield-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.shield-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.success-shield {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.alert-shield {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--accent-red);
    box-shadow: 0 0 20px var(--accent-red-glow);
    animation: shield-shake 0.5s ease;
}

@keyframes shield-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.shield-title h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
}

.shield-title p {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.shield-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* SQL Code Block display */
.sql-code-box {
    background: #020408;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-family: var(--font-fira);
    font-size: 0.8rem;
    line-height: 1.6;
    color: #e2e8f0;
    margin-bottom: 16px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.sql-keyword { color: #f43f5e; font-weight: 500; }
.sql-string { color: #f59e0b; }

.shield-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-ok-icon {
    color: var(--accent-green);
}

.shield-footer-text {
    color: var(--text-muted);
}

/* ==========================================================================
   OVERLAY: SLIDING CONFIGURATION DRAWER (FROM RIGHT)
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 4, 8, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active-overlay {
    opacity: 1;
    pointer-events: auto;
}

.drawer-content {
    position: absolute;
    top: 0;
    right: -420px;
    width: 100%;
    max-width: 420px;
    height: 100%;
    border-radius: 0;
    border-left: 1px solid var(--border-glass);
    border-top: none;
    border-bottom: none;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.active-overlay .drawer-content {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 16px;
}

.drawer-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-header h3 i {
    color: var(--accent-purple);
}

.drawer-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Live Toggle Switch */
.toggle-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px !important;
}

.toggle-label {
    font-weight: 600 !important;
    color: white !important;
}

/* Switch UI Component */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.gcp-instruction-alert {
    background: rgba(6, 182, 212, 0.04);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.gcp-instruction-alert i {
    font-size: 1.1rem;
    color: var(--accent-blue);
    margin-top: 2px;
}

.w-full {
    width: 100%;
}

/* ==========================================================================
   OVERLAY: POPUP MODAL (DEPLOY NEW AGENT)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 4, 8, 0.6);
    backdrop-filter: blur(5px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-overlay.active-overlay {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 640px;
    padding: 40px;
}

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

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--accent-blue);
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Template Select Cards */
.template-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.template-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.template-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.template-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.template-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.template-card.active-template-card {
    background: rgba(139, 92, 246, 0.04);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.template-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.leadgen-color {
    background: rgba(139, 92, 246, 0.08);
    color: #a78bfa;
}

.parser-color {
    background: rgba(6, 182, 212, 0.08);
    color: #22d3ee;
}

.support-color {
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
}

.modal-footer-row {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 24px;
    margin-top: 12px;
}

.modal-footer-row button {
    padding: 10px 24px;
}

/* ==========================================================================
   UI UTILITIES & FADE ANIMATIONS
   ========================================================================== */
.fade-in {
    animation: screen-fade-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes screen-fade-in {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden-screen {
    display: none !important;
}

/* ==========================================================================
   TOAST SYSTEM (NOTIFICATIONS)
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(13, 20, 38, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-width: 320px;
    animation: toast-slide-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-error { border-left: 4px solid var(--accent-red); }
.toast-info { border-left: 4px solid var(--accent-blue); }

.toast-icon-success { color: var(--accent-green); }
.toast-icon-error { color: var(--accent-red); }
.toast-icon-info { color: var(--accent-blue); }

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-fade-out {
    animation: toast-slide-out 0.3s ease-in forwards;
}

@keyframes toast-slide-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */
@media (max-width: 1024px) {
    .dashboard-body {
        flex-direction: column;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   AGENTIC EXECUTION TRACE AND KNOWLEDGE CARD ADDITIONS
   ========================================================================== */
.knowledge-upload-zone {
    transition: all 0.3s ease;
}

.knowledge-upload-zone:hover {
    border-color: var(--accent-blue) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 0 10px rgba(var(--accent-blue-rgb), 0.15);
}

.knowledge-doc-item {
    animation: fade-in 0.3s ease-out;
}

/* Custom styles for scrollable items inside trace and lists */
.knowledge-docs-list-container::-webkit-scrollbar,
.trace-steps-container::-webkit-scrollbar,
#trace-final-response::-webkit-scrollbar {
    width: 6px;
}

.knowledge-docs-list-container::-webkit-scrollbar-track,
.trace-steps-container::-webkit-scrollbar-track,
#trace-final-response::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.knowledge-docs-list-container::-webkit-scrollbar-thumb,
.trace-steps-container::-webkit-scrollbar-thumb,
#trace-final-response::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.knowledge-docs-list-container::-webkit-scrollbar-thumb:hover,
.trace-steps-container::-webkit-scrollbar-thumb:hover,
#trace-final-response::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.trace-step {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 10px;
    animation: slide-in-step 0.4s ease-out forwards;
}

@keyframes slide-in-step {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
