/* ============================================================
   FAS Portal v7 — Diseño Completo
   Paleta: Navy #0B1E3F · Gold #FFD700 · Blanco #FFFFFF
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --fas-navy: #0B1E3F;
    --fas-navy-dark: #07152B;
    --fas-gold: #FFD700;
    --fas-gold-hover: #E6C200;
    --fas-gold-dim: rgba(255, 215, 0, 0.12);
    --fas-gold-glow: rgba(255, 215, 0, 0.3);
    --fas-white: #FFFFFF;
    --fas-offwhite: #F8FAFC;
    --fas-blue: #003366;
    --fas-green: #16A34A;

    --bg-primary: var(--fas-navy-dark);
    --bg-secondary: var(--fas-navy);
    --bg-card: #0F2445;
    --bg-card-alt: #12284D;
    --bg-input: #132A4F;
    --bg-hover: #1A3560;
    --accent: var(--fas-gold);
    --accent-hover: var(--fas-gold-hover);
    --accent-dim: var(--fas-gold-dim);
    --text-primary: #EEF0F4;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 215, 0, 0.15);
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #60A5FA;
    --success: var(--fas-green);
    
    /* Neon Accent Palette */
    --neon-cyan: #00F0FF;
    --neon-cyan-dim: rgba(0, 240, 255, 0.10);
    --neon-cyan-glow: rgba(0, 240, 255, 0.35);
    --neon-purple: #B44AFF;
    --neon-purple-dim: rgba(180, 74, 255, 0.10);
    --neon-green: #00FF88;
    --neon-green-dim: rgba(0, 255, 136, 0.10);

    --sidebar-width: 260px;
    --topbar-height: 56px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

a {
    color: var(--fas-gold);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: #FFF; }

/* ════════════════════════════════════════════════════════════
   TOP BAR (mobile + tablet, max 1024px)
   ════════════════════════════════════════════════════════════ */
.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, #0A1A38, #0B1E3F);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}
.menu-btn:hover { background: var(--bg-hover); }
.menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,0.8);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.menu-btn.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.active span:nth-child(2) { opacity: 0; }
.menu-btn.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.topbar-logo {
    height: 28px;
    width: auto;
}

.topbar-center {
    flex: 1;
    text-align: center;
}

.topbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #FFF;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-role {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR / DRAWER
   ════════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 300;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.sidebar.open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #050D1E, #030914);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s var(--transition-smooth);
}

/* ── Logo ── */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    min-height: 72px;
}
.sidebar-logo img {
    max-width: 170px;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.12));
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s;
}
.sidebar-close:hover { color: #FFF; }

/* ── User ── */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fas-gold-dim);
    color: var(--fas-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.sidebar-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-role {
    font-size: 0.6rem;
    padding: 1px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-block;
    width: fit-content;
}

/* ── Navigation ── */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: #FFF;
}
.nav-item.active {
    background: linear-gradient(90deg, var(--fas-gold-dim), transparent);
    color: var(--fas-gold);
    border-left-color: var(--fas-gold);
}

.nav-icon {
    font-size: 1.1rem;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label { flex: 1; white-space: nowrap; }

.nav-badge {
    font-size: 0.65rem;
    background: var(--fas-gold-dim);
    color: var(--fas-gold);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}
.nav-badge-cyan {
    background: rgba(0, 240, 255, 0.1);
    color: #00F0FF;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

.nav-section-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 6px 16px 4px;
    font-weight: 600;
}

.nav-spacer { flex: 1; }

.nav-logout {
    color: #e74c3c !important;
}
.nav-logout:hover {
    background: rgba(231,76,60,0.1) !important;
    color: #e74c3c !important;
}

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: 100vh;
    max-width: 1500px;
}

/* ── Flash Messages ── */
.flash-messages {
    margin-bottom: 16px;
}
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}
.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}
.flash-success {
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: #86EFAC;
}
.flash-info {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #93C5FD;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h1, .page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #FFF;
}
.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.last-update {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Footer ── */
.footer-angular {
    margin-top: 40px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--fas-gold);
    color: var(--fas-navy);
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font-family);
}
.btn:hover {
    background: var(--fas-gold-hover);
    color: var(--fas-navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}
.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 0.95rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: #FFF; transform: none; box-shadow: none; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--fas-gold);
    color: var(--fas-gold);
}
.btn-outline:hover {
    background: var(--fas-gold-dim);
    color: var(--fas-gold);
}

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: #FFF; }
.card-body { padding: 16px 20px; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,215,0,0.08);
}
.stat-card-gold { border-top: 3px solid var(--fas-gold); }
.stat-card-blue { border-top: 3px solid var(--info); }
.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--fas-gold);
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ── Roles Badge ── */
.role-admin { background: var(--fas-gold-dim); color: var(--fas-gold); }
.role-ventas { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.role-cliente { background: rgba(245, 158, 11, 0.12); color: var(--warning); }

/* ════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fas-navy-dark), var(--fas-navy), #0D2045);
    padding: 20px;
}
.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img {
    max-width: 200px;
    margin-bottom: 16px;
}
.login-logo h1 { color: #FFF; font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); font-size: 0.85rem; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.login-form input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #FFF;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-family);
}
.login-form input:focus { border-color: var(--fas-gold); }
.login-form .btn-full { margin-top: 8px; }

/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #FFF;
    font-size: 0.85rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════════
   CHAT WIDGET
   ════════════════════════════════════════════════════════════ */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--fas-gold);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255,215,0,0.3);
    z-index: 1000;
    transition: transform 0.2s;
}
.chat-fab:hover { transform: scale(1.1); }
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.chat-widget.open { display: flex; }
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--fas-navy), #0D2045);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}
.chat-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
}
.chat-close-btn:hover { color: #FFF; }
.chat-messages {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    max-height: 350px;
}
.chat-msg {
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
}
.chat-msg.user {
    background: var(--fas-gold-dim);
    color: #FFF;
    margin-left: 30px;
}
.chat-msg.ai {
    background: var(--bg-input);
    color: var(--text-primary);
    margin-right: 30px;
}
.msg-sender {
    font-size: 0.7rem;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}
.msg-time {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
    text-align: right;
}
.chat-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
}
.chat-input-area input {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #FFF;
    font-size: 0.8rem;
    outline: none;
    font-family: var(--font-family);
}
.chat-input-area input:focus { border-color: var(--fas-gold); }
.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--fas-gold);
    color: var(--fas-navy);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-send-btn:hover { background: var(--fas-gold-hover); }

/* ════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-in {
    animation: fadeInUp 0.5s var(--transition-smooth) both;
}
.animate-in-d1 { animation-delay: 0.05s; }
.animate-in-d2 { animation-delay: 0.1s; }
.animate-in-d3 { animation-delay: 0.15s; }
.animate-in-d4 { animation-delay: 0.2s; }
.animate-in-d5 { animation-delay: 0.25s; }
.card-hover {
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border-color: var(--fas-gold-dim);
}
.text-gradient {
    background: linear-gradient(135deg, var(--fas-gold), #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ════════════════════════════════════════════════════════════
   PIPELINE (horizontal boxes — CRM, Dashboard)
   ════════════════════════════════════════════════════════════ */
.pipeline-horizontal {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.pipeline-box {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 14px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}
.pipeline-box:hover {
    border-color: var(--fas-gold);
    transform: translateY(-1px);
}
.pipeline-box.active {
    border-color: var(--fas-gold);
    background: var(--fas-gold-dim);
}
.pipeline-count {
    font-size: 1.4rem;
    font-weight: 700;
}
.pipeline-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pipeline-box.pipeline-new .pipeline-count { color: var(--info); }
.pipeline-box.pipeline-contacted .pipeline-count { color: var(--warning); }
.pipeline-box.pipeline-qualified .pipeline-count { color: var(--fas-gold); }
.pipeline-box.pipeline-converted .pipeline-count { color: var(--fas-green); }
.pipeline-box.pipeline-lost .pipeline-count { color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   TABLE
   ════════════════════════════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.table thead th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.table tbody tr:hover td {
    background: var(--bg-hover);
}
.table tbody a {
    color: var(--text-primary);
    font-weight: 500;
}
.table tbody a:hover {
    color: var(--fas-gold);
}
.table tbody tr.clickable {
    cursor: pointer;
}
.empty-table {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-new, .badge-info { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.badge-contacted, .badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-qualified, .badge-success { background: rgba(22, 163, 74, 0.12); color: var(--fas-green); }
.badge-converted { background: rgba(22, 163, 74, 0.12); color: var(--fas-green); }
.badge-lost, .badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-pending, .badge-secondary { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.badge-planned, .badge-primary { background: var(--fas-gold-dim); color: var(--fas-gold); }
.badge-ready { background: rgba(22, 163, 74, 0.12); color: var(--fas-green); }
.badge-draft { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.badge-script { background: rgba(180, 74, 255, 0.10); color: #B44AFF; }
.badge-whatsapp { background: rgba(37, 211, 102, 0.10); color: #25D366; }
.badge-email { background: var(--neon-cyan-dim); color: var(--neon-cyan); }

/* ════════════════════════════════════════════════════════════
   FILTER BAR
   ════════════════════════════════════════════════════════════ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-input {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #FFF;
    font-size: 0.82rem;
    outline: none;
    font-family: var(--font-family);
    min-width: 180px;
}
.filter-input:focus {
    border-color: var(--fas-gold);
}
.filter-select {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    font-family: var(--font-family);
    min-width: 130px;
}
.filter-select:focus {
    border-color: var(--fas-gold);
}
.filter-select option {
    background: var(--bg-card);
    color: #FFF;
}
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ════════════════════════════════════════════════════════════
   DETAIL GRID (CRM detail page)
   ════════════════════════════════════════════════════════════ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detail-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.detail-value.phone {
    font-family: 'SF Mono', 'Courier New', monospace;
    color: var(--neon-cyan);
}

/* ════════════════════════════════════════════════════════════
   CHART BARS (Dashboard mini chart)
   ════════════════════════════════════════════════════════════ */
.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
    margin-top: 10px;
}
.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 4px;
}
.chart-bar {
    width: 100%;
    max-width: 30px;
    background: var(--bg-input);
    border-radius: 3px 3px 0 0;
    display: flex;
    align-items: flex-end;
    min-height: 4px;
}
.chart-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
}
.chart-bar-fill.gold {
    background: linear-gradient(180deg, var(--fas-gold), var(--fas-gold-dim));
}
.chart-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-align: center;
}

/* ════════════════════════════════════════════════════════════
   AI RESEARCH PANEL
   ════════════════════════════════════════════════════════════ */
.ai-research-body {
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.ai-research-loading {
    text-align: center;
    padding: 30px;
}
.ai-research-error {
    padding: 16px;
    color: var(--danger);
    font-size: 0.85rem;
}
.ai-research-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 6px;
    margin-bottom: 4px;
}
.ai-tag-industry { background: var(--neon-cyan-dim); color: var(--neon-cyan); }
.ai-tag-size { background: var(--neon-purple-dim); color: var(--neon-purple); }
.ai-tag-interest { background: var(--fas-gold-dim); color: var(--fas-gold); }
.classification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.classification-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.classification-item .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.classification-item .value {
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   SPINNER
   ════════════════════════════════════════════════════════════ */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--fas-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════
   COMMISSION / EMPTY STATE
   ════════════════════════════════════════════════════════════ */
.commission-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.commission-count {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.commission-total {
    font-weight: 700;
    color: #FFF;
}
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

/* ════════════════════════════════════════════════════════════
   ALERTS BAR (Dashboard)
   ════════════════════════════════════════════════════════════ */
.alerts-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
}
.alert-danger { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.25); color: #FCA5A5; }
.alert-warning { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); color: #FCD34D; }
.alert-info { background: rgba(96, 165, 250, 0.08); border: 1px solid rgba(96, 165, 250, 0.25); color: #93C5FD; }

/* ════════════════════════════════════════════════════════════
   TIMELINE (Activity page)
   ════════════════════════════════════════════════════════════ */
.timeline-visual {
    padding: 20px;
    position: relative;
}
.timeline-date-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 12px;
}
.timeline-date-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--fas-gold);
    background: var(--fas-gold-dim);
    padding: 3px 12px;
    border-radius: 12px;
}
.timeline-today-badge {
    font-size: 0.65rem;
    color: var(--neon-green);
    background: var(--neon-green-dim);
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 700;
}
.timeline-event {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    padding: 6px 0;
}
.timeline-event:hover {
    transform: translateX(4px);
}
.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}
.event-error .timeline-dot { background: var(--danger); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.event-warning .timeline-dot { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.event-import .timeline-dot { background: #00F0FF; box-shadow: 0 0 8px rgba(0,240,255,0.35); }
.event-login .timeline-dot { background: #B44AFF; box-shadow: 0 0 8px rgba(180,74,255,0.1); }
.event-login-success .timeline-dot { background: #3B82F6; box-shadow: 0 0 8px rgba(59,130,246,0.4); }
.event-info .timeline-dot { background: var(--info); box-shadow: 0 0 8px rgba(96,165,250,0.3); }
.timeline-time {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
    margin-top: 7px;
}
.timeline-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.event-error .timeline-card { border-left: 3px solid var(--danger); }
.event-warning .timeline-card { border-left: 3px solid var(--warning); }
.event-import .timeline-card { border-left: 3px solid #00F0FF; }
.event-login .timeline-card { border-left: 3px solid #B44AFF; }
.event-login-success .timeline-card { border-left: 3px solid #3B82F6; }
.event-info .timeline-card { border-left: 3px solid var(--info); }
.timeline-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}
.timeline-card-body {
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.timeline-card-meta {
    padding: 0 14px 10px;
    font-size: 0.7rem;
}
.event-badge {
    margin-left: auto;
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
}
.event-badge-error { background: rgba(239,68,68,0.1); color: #FCA5A5; }
.event-badge-warning { background: rgba(245,158,11,0.1); color: #FCD34D; }
.event-badge-data_import { background: rgba(0,240,255,0.1); color: #00F0FF; }
.event-badge-info { background: rgba(96,165,250,0.1); color: var(--info); }
.event-badge-login_failed { background: rgba(180,74,255,0.1); color: #B44AFF; }

/* ════════════════════════════════════════════════════════════
   MISC UTILITIES
   ════════════════════════════════════════════════════════════ */
.code-block {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 200px;
}
.cmd-output {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--neon-green);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 300px;
}
.section {
    margin-bottom: 24px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.back-link:hover { color: var(--fas-gold); }

/* Neon / gradient fijos que referencian las páginas */
/* (ya declarados en el :root original arriba) */

/* Campañas extras */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.campaign-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.campaign-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 14px 18px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}
.campaign-row:hover { background: var(--bg-hover); }
.campaign-info { flex: 1; min-width: 0; }
.campaign-name { font-weight: 600; color: #e0e8f0; font-size: 1rem; }
.campaign-meta { font-size: 0.8rem; color: #8899bb; margin-top: 2px; }
.campaign-stats { display: flex; gap: 12px; white-space: nowrap; }
.campaign-bar { width: 120px; }
.progress-bar { height: 6px; background: #1a3050; border-radius: 3px; overflow: hidden; display: flex; gap: 2px; }
.progress-open { background: #2ecc71; }
.progress-reply { background: #9b59b6; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

/* Lead Map */
#lead-map { height: 75vh; border-radius: 12px; overflow: hidden; border: 1px solid #1a3a5a; }

/* Temperature */
.temperature {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
}
.temperature-hot { background: rgba(239, 68, 68, 0.12); color: #FCA5A5; }
.temperature-warm { background: rgba(245, 158, 11, 0.12); color: #FCD34D; }
.temperature-cold { background: rgba(96, 165, 250, 0.12); color: #93C5FD; }

/* ROI */
.roi-value { font-size: 2rem; font-weight: 800; }
.roi-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.text-gradient-green {
    background: linear-gradient(135deg, var(--neon-green), var(--fas-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

/* ── Tablet / Mobile (≤ 1024px) ── */
@media (max-width: 1024px) {
    .topbar {
        display: flex;
    }

    .sidebar-panel {
        transform: translateX(-100%);
    }
    .sidebar.open .sidebar-panel {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: calc(var(--topbar-height) + 20px);
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ── Mobile small (≤ 480px) ── */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
    }
    .topbar-title {
        font-size: 0.8rem;
    }
    .topbar-logo {
        height: 22px;
    }

    .sidebar-panel {
        width: 85vw;
        max-width: var(--sidebar-width);
    }

    .main-content {
        padding: calc(var(--topbar-height) + 12px) 12px 12px;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-value {
        font-size: 1.4rem;
    }

    .grid-2col {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .page-header h1 {
        font-size: 1.2rem;
    }

    .chat-widget {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 80px;
    }
}

/* ── Desktop (≥ 1025px) ── */
@media (min-width: 1025px) {
    .sidebar-overlay {
        display: none !important;
        pointer-events: none !important;
    }
    .sidebar-close {
        display: none !important;
    }
    .menu-btn {
        display: none !important;
    }
}
