/* assets/css/main.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Premium Palette - Slate/Indigo (Light Theme Default) */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;

    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.9);
    --background: #f8fafc;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-primary: 0 4px 14px 0 rgba(79, 70, 229, 0.3);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Mobile Refinements */
    --mobile-card-bg: #ffffff;
    --mobile-accent: #4f46e5;
}

/* Medium Theme (Soft Dark / Blue-Grey) */
/* Improved Medium Theme (Slate/Blue-Grey - "Dim") */
[data-theme="medium"] {
    --primary: #818cf8;
    --primary-light: #6366f1;
    --primary-dark: #4f46e5;

    --surface: #1e293b;
    /* Slate 800 - Solid */
    --surface-glass: rgba(30, 41, 59, 0.98);
    /* Almost solid */
    --background: #0f172a;
    /* Slate 900 */

    --text-main: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-light: #64748b;
    /* Slate 500 */

    --border: #334155;
    /* Slate 700 */
    --border-light: #1e293b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-primary: 0 0 15px rgba(99, 102, 241, 0.3);

    /* Disable Blur for clarity in "Dim" mode */
    --backdrop-blur: none;
}

/* Perfect Dark Theme (High Contrast / OLED) */
[data-theme="dark"] {
    --primary: #a5b4fc;
    /* Very light indigo */
    --primary-light: #818cf8;
    --primary-dark: #6366f1;

    --surface: #171717;
    /* Neutral 900 */
    --surface-glass: rgba(23, 23, 23, 0.95);
    --background: #000000;
    /* True Black */

    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    /* Neutral 400 */
    --text-light: #525252;
    /* Neutral 600 */

    --border: #404040;
    /* Neutral 700 */
    --border-light: #262626;

    --shadow-sm: none;
    --shadow-md: 0 4px 6px -1px rgba(255, 255, 255, 0.08);
    --shadow-primary: 0 0 20px rgba(165, 180, 252, 0.2);

    --backdrop-blur: none;
}

/* Global Theme Application */
body {
    background-color: var(--background);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Card Improvements */
.card {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
}

/* Bootstrap COMPONENT OVERRIDES for Dark/Medium */
[data-theme="dark"] .dropdown-menu,
[data-theme="medium"] .dropdown-menu {
    background-color: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .dropdown-item,
[data-theme="medium"] .dropdown-item {
    color: var(--text-main);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="medium"] .dropdown-item:hover {
    background-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .modal-content,
[data-theme="medium"] .modal-content {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="medium"] .modal-header,
[data-theme="medium"] .modal-footer {
    border-color: var(--border);
}

[data-theme="dark"] .list-group-item,
[data-theme="medium"] .list-group-item {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
}

/* KPI Card & Text Fixes */
[data-theme="dark"] .text-dark,
[data-theme="medium"] .text-dark {
    color: var(--text-main) !important;
    /* Override Bootstrap text-dark in dark mode */
}

/* Kanban Header Fix */
[data-theme="dark"] .kanban-col .card-header,
[data-theme="medium"] .kanban-col .card-header {
    background-color: var(--surface);
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

/* Dark Mode Text Utility Overrides (Fix for Kanban & Colored Text) */
[data-theme="dark"] .text-primary,
[data-theme="medium"] .text-primary {
    color: #a5b4fc !important;
}

[data-theme="dark"] .text-secondary,
[data-theme="medium"] .text-secondary {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-success,
[data-theme="medium"] .text-success {
    color: #6ee7b7 !important;
}

[data-theme="dark"] .text-danger,
[data-theme="medium"] .text-danger {
    color: #fca5a5 !important;
}

[data-theme="dark"] .text-warning,
[data-theme="medium"] .text-warning {
    color: #fcd34d !important;
}

[data-theme="dark"] .text-info,
[data-theme="medium"] .text-info {
    color: #7dd3fc !important;
}

[data-theme="dark"] .text-dark,
[data-theme="medium"] .text-dark {
    color: #f8fafc !important;
}

[data-theme="dark"] .text-body,
[data-theme="medium"] .text-body {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .text-muted,
[data-theme="medium"] .text-muted {
    color: #94a3b8 !important;
}

/* Apply Glass Effect to Cards in Dark Mode */
[data-theme="dark"] .card,
[data-theme="dark"] .navbar,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .offcanvas {
    background-color: var(--surface) !important;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="medium"] .form-control,
[data-theme="medium"] .form-select {
    background-color: var(--background) !important;
    /* Slightly darker than surface for inputs */
    border-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .form-control:focus,
[data-theme="medium"] .form-control:focus {
    background-color: var(--background) !important;
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="medium"] .form-control::placeholder {
    color: var(--text-light);
    /* Ensure placeholder is visible */
}

/* Table Fixes */
[data-theme="dark"] .table,
[data-theme="medium"] .table {
    --bs-table-color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    border-color: var(--border);
}

[data-theme="dark"] .table-hover>tbody>tr:hover,
[data-theme="medium"] .table-hover>tbody>tr:hover {
    color: var(--text-main);
    --bs-table-accent-bg: var(--border-light);
    /* Slight highlight */
}

[data-theme="dark"] .text-muted,
[data-theme="medium"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .bg-white,
[data-theme="medium"] .bg-white {
    background-color: var(--surface) !important;
    /* Override white backgrounds helpers */
    color: var(--text-main) !important;
}

[data-theme="dark"] .bg-light,
[data-theme="medium"] .bg-light {
    background-color: var(--background) !important;
    /* Swap light bg for dark background */
    color: var(--text-main) !important;
}


/* Logo Sizing Upgrade */
.navbar-brand img {
    height: auto;
    max-height: 110px;
    /* Bigger logo (Doubled size) */
    transition: all 0.3s ease;
}

/* Theme Transition */
body,
.card,
.navbar,
.form-control,
.table,
.modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Base */
body {
    background-color: var(--background);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: all 0.2s ease;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    padding: 0 1.5rem;
}

/* Navbar Premium */
.navbar {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.navbar-brand i {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.2));
}

/* Desktop Only - Stacked Icon/Text Layout */
@media (min-width: 992px) {
    .navbar-nav {
        gap: 0.25rem;
    }

    .navbar-nav .nav-link {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 600 !important;
        color: var(--text-muted) !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: var(--radius-md);
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        font-size: 0.75rem !important;
        text-transform: capitalize;
        min-width: 80px;
        position: relative;
        border-bottom: 2px solid transparent;
    }

    .navbar-nav .nav-link i,
    .navbar-nav .nav-link bi {
        font-size: 1.25rem !important;
        margin-bottom: 2px !important;
        margin-right: 0 !important;
        transition: transform 0.2s ease;
    }

    .navbar-nav .nav-link.active {
        color: #4f46e5 !important;
        /* Elegant Indigo */
        background-color: rgba(79, 70, 229, 0.08) !important;
        border-radius: 12px;
        border-bottom: 2px solid transparent !important;
    }

    .navbar-nav .nav-link.active i {
        color: #4f46e5 !important;
    }

    .navbar-nav .nav-link:hover {
        background-color: rgba(0, 0, 0, 0.03);
        border-radius: 12px;
        color: #2d3748 !important;
        border-bottom: 2px solid transparent !important;
    }

    .navbar-nav .nav-link:hover i {
        transform: translateY(-2px);
    }
}

/* Mobile Compatibility (Restoring original view) */
@media (max-width: 991.98px) {
    .nav-link {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
        gap: 0.75rem;
        /* Replaces the removed me-1 */
    }

    .nav-link i {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }
}

.navbar-toggler {
    border: none;
    color: var(--text-main);
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Cards & Containers */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card:hover {
    /* transform: translateY(-2px); REMOVED: Causes fixed/absolute position issues with FullCalendar D&D */
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.fc-daygrid-event {
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.85em;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
    margin-top: 2px !important;
    position: relative;
    /* Ensure z-index works */
    z-index: 1;
}

/* Fix for Drag and Drop Visuals (Z-Index popping & Offset) */
.fc-event-dragging,
.fc-event-mirror {
    z-index: 99999 !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2) !important;
    opacity: 0.9;
    cursor: grabbing;
    margin: 0 !important;
    /* Critical to prevent offset */
    /* top/left overrides removed to let JS handle positioning */
}

.card-header {
    background: var(--surface-glass);
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Forms Premium */
.form-label {
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.925rem;
}

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s;
    background-color: var(--surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

.input-group-text {
    background-color: var(--background);
    border-color: var(--border);
    border-radius: var(--radius-md);
}

/* Buttons Premium */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    letter-spacing: 0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: var(--primary);
    border: 1px solid transparent;
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
    background-color: var(--primary-dark);
    transform: translateY(0);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-danger {
    background-color: var(--danger);
    border: none;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* Tables */
.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    background: var(--background);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.table tbody td {
    padding: 1rem 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
}

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

.table-hover tbody tr:hover {
    background-color: var(--background);
    color: var(--text-main);
    /* Ensure hover doesn't turn text black */
}

/* Force Table Text Color in Dark Mode */
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="medium"] .table,
[data-theme="medium"] .table td,
[data-theme="medium"] .table th {
    color: var(--text-main) !important;
}

[data-theme="dark"] .table-hover tbody tr:hover,
[data-theme="medium"] .table-hover tbody tr:hover {
    color: var(--text-main) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Fix specific inner elements in tables for Dark Mode */
[data-theme="dark"] .table .text-muted,
[data-theme="dark"] .table a,
[data-theme="medium"] .table .text-muted,
[data-theme="medium"] .table a {
    color: var(--text-muted) !important;
    /* Ensure it uses our variable, not Bootstrap's default dark grey */
}

/* Ensure links in dark mode tables are visible/light */
[data-theme="dark"] .table a,
[data-theme="medium"] .table a {
    color: var(--primary-light) !important;
}

[data-theme="dark"] .table a:hover,
[data-theme="medium"] .table a:hover {
    color: var(--primary) !important;
}

/* Badges & Status */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 600;
    border-radius: 20px;
    font-size: 0.75em;
    letter-spacing: 0.02em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

/* Login Page Specifics */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}



.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: -webkit-linear-gradient(45deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Utilities */
.text-muted {
    color: var(--text-muted) !important;
}

.text-small {
    font-size: 0.875rem;
}

.fw-bold {
    font-weight: 600 !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    .container {
        padding: 0 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* --- CALENDAR MOBILE PREMIUM REDESIGN --- */
    .mobile-calendar-wrapper {
        padding-bottom: 100px !important;
        /* Espacio para el FAB */
    }

    .mobile-section-title {
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .mobile-section-title h1 {
        font-size: 2.2rem;
        font-weight: 800;
        color: var(--text-main);
        margin-bottom: 0.2rem;
        letter-spacing: -0.04em;
    }

    .mobile-section-title p {
        color: var(--text-muted);
        font-size: 1rem;
    }

    /* The Main Calendar Card */
    .mobile-calendar-card {
        background: white;
        border-radius: 2rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
        padding: 1.5rem;
        margin-bottom: 2rem;
        border: 1px solid rgba(0, 0, 0, 0.02);
    }

    /* Event List Header */
    .mobile-list-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 2rem !important;
        padding: 0 0.5rem !important;
    }

    .mobile-list-header h2 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-main);
        margin: 0;
    }

    .mobile-list-header .badge-count {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* Event Card */
    /* ULTRA-SPECIFIC FIX FOR IPHONE LAYOUT */
    #mobile-event-list .mobile-event-card {
        background: white !important;
        border-radius: 1.5rem !important;
        padding: 1.25rem !important;
        margin-bottom: 1rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 1.2rem !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        width: 100% !important;
        min-height: 80px !important;
    }

    #mobile-event-list .mobile-event-time {
        min-width: 70px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    #mobile-event-list .mobile-event-time .time {
        font-weight: 800 !important;
        font-size: 1.25rem !important;
        color: #4f46e5 !important;
        line-height: 1 !important;
    }

    #mobile-event-list .mobile-event-time .period {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        color: #818cf8 !important;
    }

    #mobile-event-list .mobile-event-indicator {
        width: 3px !important;
        height: 35px !important;
        border-radius: 4px !important;
        flex-shrink: 0 !important;
    }

    #mobile-event-list .mobile-event-info {
        flex: 1 !important;
        padding-left: 0.5rem !important;
        overflow: hidden !important;
    }

    #mobile-event-list .mobile-event-info .title {
        font-weight: 700 !important;
        font-size: 1.15rem !important;
        color: #1e293b !important;
        margin-bottom: 2px !important;
        display: block !important;
    }

    #mobile-event-list .mobile-event-info .subtitle {
        font-size: 0.95rem !important;
        color: #64748b !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
    }

    /* FullCalendar Overrides for Mobile Card */
    .fc .fc-toolbar.fc-header-toolbar {
        margin-bottom: 1.5rem !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .fc .fc-toolbar-title {
        font-size: 1.1rem !important;
        font-weight: 800 !important;
        color: var(--text-main) !important;
        text-transform: lowercase;
    }

    .fc .fc-button {
        background: #f8fafc !important;
        border: none !important;
        color: var(--text-muted) !important;
        border-radius: 0.75rem !important;
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    .fc .fc-button:active {
        background: #e2e8f0 !important;
    }

    .fc .fc-today-button {
        background: #f8fafc !important;
        font-weight: 700 !important;
        margin-left: auto !important;
    }

    .fc-theme-bootstrap5 .fc-scrollgrid {
        border: none !important;
    }

    .fc .fc-col-header-cell {
        border: none !important;
        padding-bottom: 1rem !important;
    }

    .fc .fc-col-header-cell-cushion {
        color: var(--mobile-accent) !important;
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        text-transform: lowercase;
    }

    .fc .fc-daygrid-day {
        border: none !important;
        height: 45px !important;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.9rem !important;
        font-weight: 500 !important;
        padding: 8px !important;
        color: var(--text-main) !important;
    }

    .fc .fc-daygrid-day-frame {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: unset !important;
    }

    /* Today highlight */
    .fc .fc-day-today {
        background: transparent !important;
    }

    /* Selection highlight */
    .selected-day-mobile {
        background-color: var(--mobile-accent) !important;
        border-radius: 50%;
        color: white !important;
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .selected-day-mobile .fc-daygrid-day-number {
        color: white !important;
    }

    /* Event Dot */
    .has-events-dot {
        width: 4px;
        height: 4px;
        background: var(--danger);
        border-radius: 50%;
        position: absolute;
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
    }

    .fc-daygrid-event-harness,
    .fc-daygrid-event,
    .fc-event,
    .fc-more-link {
        display: none !important;
    }

    /* Subtle FAB for mobile - Moved up to avoid overlap with chat bot */
    .mobile-fab {
        position: fixed;
        bottom: 7.5rem;
        right: 1.5rem;
        width: 3.8rem;
        height: 3.8rem;
        background: #4f46e5 !important;
        color: white !important;
        border-radius: 50%;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4) !important;
        z-index: 9999 !important;
        font-size: 1.8rem !important;
        text-decoration: none !important;
    }
}

/* FullCalendar Customization (Premium/Moovago Style) */
.fc-header-toolbar {
    padding: 1.5rem;
    background: var(--surface);
    /* Changed from white to variable */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem !important;
    border: 1px solid var(--border-light);
}

[data-theme="dark"] .fc-header-toolbar,
[data-theme="medium"] .fc-header-toolbar {
    background: var(--surface);
    border-color: var(--border);
}

.fc-toolbar-title {
    font-size: 1.75rem !important;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.fc-button {
    border-radius: var(--radius-md) !important;
    padding: 0.6em 1.2em !important;
    font-weight: 600 !important;
    text-transform: capitalize;
    letter-spacing: 0.01em;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.fc-button-primary {
    background-color: var(--surface) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
}

.fc-button-primary:hover {
    background-color: var(--background) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px);
}

.fc-button-primary:not(:disabled).fc-button-active,
.fc-button-primary:not(:disabled):active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

/* Events */
.fc-daygrid-event {
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.85em;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
    margin-top: 2px !important;
    position: relative;
    z-index: 1;
    color: white !important;
    /* Ensure readable text on blue background */
}

/* Ensure inner text elements are also white */
.fc-daygrid-event .fc-event-main,
.fc-daygrid-event .fc-event-title,
.fc-daygrid-event .fc-event-time {
    color: white !important;
}

/* Hide default FullCalendar dot as we use our own status indicator */
.fc-daygrid-event-dot {
    display: none !important;
}

/* Hide default FullCalendar dot as we use our own status indicator */
.fc-daygrid-event-dot {
    display: none !important;
}

.fc-daygrid-event:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    filter: brightness(1.1);
    /* Slighly brighter on hover */
    color: white !important;
}

/* Fix for Drag and Drop Visuals (High Contrast Light Theme) */
.fc-event-dragging,
.fc-event-mirror {
    z-index: 99999 !important;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25) !important;
    opacity: 1 !important;
    cursor: grabbing;
    margin: 0 !important;

    /* Light background for better readability */
    background-color: var(--surface) !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm);
}

/* Ensure text inside mirror overrides default styles */
.fc-event-mirror .fc-event-main,
.fc-event-mirror .fc-event-title,
.fc-event-mirror .fc-event-time {
    color: var(--primary-dark) !important;
}

/* Today Highlight */
.fc-day-today {
    background-color: rgba(79, 70, 229, 0.02) !important;
}

/* Mobile Specifics */
@media (max-width: 768px) {
    .fc-header-toolbar {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Move View Buttons to Bottom, Nav Buttons to Top, Title in Middle */
    .fc-toolbar-chunk:nth-child(1) {
        order: 2;
        justify-content: space-between;
    }

    /* Prev/Next */
    .fc-toolbar-chunk:nth-child(2) {
        order: 1;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    /* Title */
    .fc-toolbar-chunk:nth-child(3) {
        order: 3;
        display: none;
    }

    /* Views (often redundant on mobile if auto-switched) */

    .fc-toolbar-title {
        font-size: 1.5rem !important;
    }

    .fc-button {
        padding: 0.5em 1em !important;
        font-size: 0.9em !important;
    }

    /* List View Tweaks */
    .fc-list-event-title a {
        color: var(--text-main) !important;
        font-weight: 600;
        text-decoration: none;
    }

    .fc-list-day-cushion {
        background-color: var(--background) !important;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Welcome Card Premium */
.welcome-card {
    background: var(--surface);
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

/* Fix Tables for Dark Mode */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    color: var(--text-main);
}

.table thead th {
    background-color: var(--background);
    color: var(--text-muted);
    border-bottom-color: var(--border);
}

.table tbody td {
    border-bottom-color: var(--border-light);
    color: var(--text-main);
}

.table-hover tbody tr:hover {
    color: var(--text-main);
    background-color: var(--border-light);
}

/* Kanban Column Differentiation */
.kanban-col {
    min-width: 0 !important;
    /* Allow shrinking */
    max-width: none !important;
}

.kanban-col .card {
    transition: all 0.3s ease;
    height: auto !important;
    min-height: 100%;
    overflow: visible !important;
    /* Prevent text selection and separate dragging */
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

.kanban-col .card:active {
    cursor: grabbing;
}

/* Fix stacked cards or nesting issues */
.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-light);
}

.kanban-card * {
    /* Ensure child elements don't interfere with drag */
    pointer-events: none;
}

/* Re-enable pointer events for buttons/avatars if we had specific actions inside, 
   but currently the whole card is the click trigger so this is safer for pure DnD */


.kanban-col[data-status="CONTACTO_INICIAL"]>.card {
    border-top: 4px solid #64748b;
    background-color: rgba(226, 232, 240, 0.4);
}

.kanban-col[data-status="PROPUESTA_PRESENTADA"]>.card {
    border-top: 4px solid #3b82f6;
    background-color: rgba(219, 234, 254, 0.4);
}

.kanban-col[data-status="PROPUESTA_ACEPTADA"]>.card {
    border-top: 4px solid #10b981;
    background-color: rgba(209, 250, 229, 0.4);
}

.kanban-col[data-status="PROPUESTA_RECHAZADA"]>.card {
    border-top: 4px solid #ef4444;
    background-color: rgba(254, 226, 226, 0.4);
}

.kanban-col[data-status="CONTRATO_FIRMADO"]>.card {
    border-top: 4px solid #8b5cf6;
    background-color: rgba(237, 233, 254, 0.4);
}

/* Ensure header text is distinct */
.kanban-col .card-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.4);
    /* Slight frosted glass for header */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.kanban-col[data-status="CONTACTO_INICIAL"] .card-header {
    color: #475569;
}

.kanban-col[data-status="PROPUESTA_PRESENTADA"] .card-header {
    color: #1d4ed8;
}

.kanban-col[data-status="PROPUESTA_ACEPTADA"] .card-header {
    color: #047857;
}

.kanban-col[data-status="PROPUESTA_RECHAZADA"] .card-header {
    color: #b91c1c;
}

.kanban-col[data-status="CONTRATO_FIRMADO"] .card-header {
    color: #6d28d9;
}

.kanban-col[data-status="SERVICIO_CONCLUIDO"] .card-header {
    color: #0f172a;
}

.kanban-col .count-badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
}

/* Avatars */
.avatar-circle {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid white;
}

.avatar-circle.small {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

/* -------------------------------------------------------------------------- */
/*                        FullCalendar Dark Mode Fixes                        */
/* -------------------------------------------------------------------------- */

[data-theme="dark"] .fc-toolbar-title,
[data-theme="medium"] .fc-toolbar-title {
    color: var(--text-main) !important;
}

[data-theme="dark"] .fc-button,
[data-theme="medium"] .fc-button {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
    background-image: none;
}

[data-theme="dark"] .fc-button-primary:not(:disabled).fc-button-active,
[data-theme="medium"] .fc-button-primary:not(:disabled).fc-button-active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

[data-theme="dark"] .fc-button:hover,
[data-theme="medium"] .fc-button:hover {
    background-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .fc-col-header-cell-cushion,
[data-theme="medium"] .fc-col-header-cell-cushion,
[data-theme="dark"] .fc-daygrid-day-number,
[data-theme="medium"] .fc-daygrid-day-number {
    color: var(--text-main) !important;
    text-decoration: none !important;
}

[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th,
[data-theme="medium"] .fc-theme-standard td,
[data-theme="medium"] .fc-theme-standard th {
    border-color: var(--border) !important;
}

[data-theme="dark"] .fc-day-today,
[data-theme="medium"] .fc-day-today {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Ensure Calendar Card Background matches theme */
[data-theme="dark"] .card,
[data-theme="medium"] .card {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-main);
}

/* Fix for specific white background in calendar if present */
[data-theme="dark"] .fc-view-harness,
[data-theme="medium"] .fc-view-harness {
    background-color: var(--surface);
}

[data-theme="dark"] .fc-scrollgrid,
[data-theme="medium"] .fc-scrollgrid {
    border-color: var(--border);
}

[data-theme="dark"] .fc-list-day-cushion,
[data-theme="medium"] .fc-list-day-cushion {
    background-color: var(--surface);
}

/* -------------------------------------------------------------------------- */
/* CRITICAL FIX: Kanban Column Colors in Dark Mode */
/* -------------------------------------------------------------------------- */

/* 1. Override the specific column backgrounds which were winning fast specificity wars */
[data-theme="dark"] .kanban-col[data-status]>.card,
[data-theme="medium"] .kanban-col[data-status]>.card {
    background-color: var(--surface) !important;
    /* Force nice dark glass/slate */
    border-color: var(--border) !important;
}

/* 2. Fix the header text - make it pop */
[data-theme="dark"] .kanban-col .card-header,
[data-theme="medium"] .kanban-col .card-header {
    background-color: transparent !important;
    /* Let card bg show through */
    border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] .kanban-col .card-header span,
[data-theme="medium"] .kanban-col .card-header span {
    color: var(--text-main) !important;
    /* White text */
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
    text-transform: uppercase;
    opacity: 0.9;
}

/* 3. Ensure the 'badge' count is visible */
[data-theme="dark"] .kanban-col .count-badge,
[data-theme="medium"] .kanban-col .count-badge {
    background-color: var(--background) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
}

/* 4. Column-specific header border colors (Keep the colored top strip) */
[data-theme="dark"] .kanban-col[data-status="CONTACTO_INICIAL"]>.card {
    border-top: 3px solid #64748b !important;
}

[data-theme="dark"] .kanban-col[data-status="PROPUESTA_PRESENTADA"]>.card {
    border-top: 3px solid #3b82f6 !important;
}

[data-theme="dark"] .kanban-col[data-status="PROPUESTA_ACEPTADA"]>.card {
    border-top: 3px solid #10b981 !important;
}

[data-theme="dark"] .kanban-col[data-status="PROPUESTA_RECHAZADA"]>.card {
    border-top: 3px solid #ef4444 !important;
}

[data-theme="dark"] .kanban-col[data-status="CONTRATO_FIRMADO"]>.card {
    border-top: 3px solid #8b5cf6 !important;
}

/* --- EXPENSES PREMIUM REDESIGN --- */
@media (max-width: 991.98px) {
    .expense-page-bg {
        background-color: #f8faff !important;
        min-height: 100vh !important;
        margin-top: -1.5rem !important;
        /* Adjust for parent padding if needed */
    }


    .expense-mobile-header {
        padding: 1.5rem 1rem !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .expense-mobile-header h1 {
        font-size: 1.8rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        margin-bottom: 0.15rem !important;
    }

    .expense-mobile-header p {
        color: #94a3b8 !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    #btnNuevoGasto.btn-new-expense {
        background: #4f46e5 !important;
        border: none !important;
        border-radius: 1.25rem !important;
        padding: 0.75rem 1.6rem !important;
        font-weight: 700 !important;
        color: white !important;
        box-shadow: 0 8px 25px rgba(79, 70, 229, 0.35) !important;
        font-size: 1.1rem !important;
    }

    .expense-filters-card {
        background: white !important;
        border-radius: 2rem !important;
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        border: 1px solid #f1f5f9 !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
    }

    .expense-input-wrapper {
        background: #f8fafc !important;
        border-radius: 1.25rem !important;
        padding: 0.8rem 1.2rem !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    .expense-input-wrapper i {
        color: #94a3b8 !important;
    }

    .expense-input-wrapper input {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        font-size: 1.05rem !important;
        width: 100% !important;
    }

    .expense-filter-label {
        font-size: 0.7rem !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        color: #94a3b8 !important;
        letter-spacing: 0.05em !important;
        margin-bottom: 0.75rem !important;
        display: block !important;
    }

    .expense-state-filters {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
    }

    .expense-state-filters::-webkit-scrollbar {
        display: none;
    }

    .state-pill {
        padding: 0.65rem 1.25rem !important;
        border-radius: 1rem !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        background: #f1f5f9 !important;
        color: #64748b !important;
        border: 1px solid transparent !important;
        transition: all 0.2s !important;
    }

    .state-pill.active {
        background: #4f46e5 !important;
        color: white !important;
        box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3) !important;
    }

    /* ULTRA-SPECIFIC FIX FOR IPHONE GASTOS LIST */
    #expense-list-mobile .expense-card {
        background: white !important;
        border-radius: 2rem !important;
        padding: 1.75rem !important;
        margin-bottom: 1.5rem !important;
        border: 1px solid #f1f5f9 !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
        width: 100% !important;
    }

    #expense-list-mobile .expense-card-main {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 1.5rem !important;
        width: 100% !important;
    }

    #expense-list-mobile .expense-icon-box {
        width: 4rem !important;
        height: 4rem !important;
        background: #f0f7ff !important;
        color: #3b82f6 !important;
        border-radius: 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.8rem !important;
        flex-shrink: 0 !important;
    }

    #expense-list-mobile .expense-card-info {
        flex: 1 !important;
        min-width: 0 !important;
    }

    #expense-list-mobile .expense-card-date {
        font-size: 0.85rem !important;
        color: #94a3b8 !important;
        font-weight: 600 !important;
        margin-bottom: 0.25rem !important;
        display: block !important;
    }

    #expense-list-mobile .expense-card-title {
        font-weight: 800 !important;
        font-size: 1.2rem !important;
        color: #0f172a !important;
        margin-bottom: 0.75rem !important;
        display: block !important;
        line-height: 1.2 !important;
    }

    #expense-list-mobile .expense-card-amount {
        text-align: right !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
    }

    #expense-list-mobile .expense-amount-value {
        font-weight: 800 !important;
        font-size: 1.5rem !important;
        color: #0f172a !important;
        margin-bottom: 0.25rem !important;
    }

    #expense-list-mobile .expense-status-badge {
        display: inline-flex !important;
        padding: 0.4rem 0.9rem !important;
        border-radius: 0.75rem !important;
        font-size: 0.7rem !important;
        font-weight: 800 !important;
        width: fit-content !important;
        letter-spacing: 0.02em !important;
    }

    #expense-list-mobile .status-badge-aprobado {
        background: #dcfce7 !important;
        color: #16a34a !important;
    }

    #expense-list-mobile .status-badge-pendiente {
        background: #fef9c3 !important;
        color: #ca8a04 !important;
    }

    #expense-list-mobile .status-badge-rechazado {
        background: #fee2e2 !important;
        color: #dc2626 !important;
    }

    #expense-list-mobile .expense-card-footer {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-top: 1.5rem !important;
        border-top: 1px solid #f1f5f9 !important;
        width: 100% !important;
    }

    #btnResetFilters {
        color: #3b82f6 !important;
        font-weight: 800 !important;
        font-size: 0.8rem !important;
        text-decoration: none !important;
        text-transform: none !important;
    }

    .expense-filters-card select.form-select {
        background-color: #f8fafc !important;
        border: 1px solid #f1f5f9 !important;
        border-radius: 1rem !important;
        padding: 0.75rem 1rem !important;
        font-weight: 600 !important;
        color: #1e293b !important;
        font-size: 0.95rem !important;
        box-shadow: none !important;
    }

    #expense-list-mobile .expense-tag {
        background: #f1f5f9 !important;
        color: #64748b !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 0.5rem !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        border: none !important;
        text-transform: uppercase !important;
        letter-spacing: 0.02em !important;
    }

    #expense-list-mobile .expense-actions-circle {
        display: flex !important;
        gap: 0.75rem !important;
    }

    #expense-list-mobile .action-btn-circle {
        width: 3rem !important;
        height: 3rem !important;
        border-radius: 1rem !important;
        background: #f8fafc !important;
        color: #94a3b8 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: none !important;
        transition: all 0.2s !important;
        text-decoration: none !important;
        font-size: 1.25rem !important;
    }

    #expense-list-mobile .action-btn-circle:active {
        background: #f1f5f9 !important;
        transform: scale(0.95) !important;
    }

    #expense-list-mobile .view-ticket-link {
        color: #4f46e5 !important;
        font-weight: 800 !important;
        font-size: 0.95rem !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    /* --- INSIGHTS PREMIUM REDESIGN --- */
    .insight-mobile-container {
        background-color: #f8faff !important;
        min-height: 100vh !important;
    }

    .insight-mobile-header {
        background: linear-gradient(145deg, #1d4ed8 0%, #3b82f6 100%) !important;
        padding: 3rem 1.75rem 6.5rem 1.75rem !important;
        position: relative !important;
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25) !important;
        z-index: 1 !important;
    }

    .insight-header-icon {
        width: 3.5rem !important;
        height: 3.5rem !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: white !important;
        font-size: 1.5rem !important;
        backdrop-filter: blur(5px) !important;
    }

    .insight-mobile-filters {
        position: absolute !important;
        bottom: -3.5rem !important;
        left: 1.5rem !important;
        right: 1.5rem !important;
        background: white !important;
        border-radius: 1.25rem !important;
        padding: 1.25rem 1rem !important;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.03) !important;
        z-index: 10 !important;
        display: flex !important;
        align-items: center !important;
    }

    .insight-filter-pill {
        background: #f8fafc !important;
        border-radius: 1rem !important;
        padding: 0.5rem 0.75rem !important;
        display: flex !important;
        flex-direction: column !important;
        border: 1px solid #f1f5f9 !important;
    }

    .insight-filter-pill label {
        font-size: 0.6rem !important;
        font-weight: 800 !important;
        color: #94a3b8 !important;
        text-transform: uppercase !important;
        margin-bottom: 0.1rem !important;
    }

    .insight-filter-pill select {
        background: transparent !important;
        border: none !important;
        font-weight: 700 !important;
        color: #3b82f6 !important;
        font-size: 0.85rem !important;
        padding: 0 !important;
        outline: none !important;
        width: 100% !important;
    }

    .insight-mobile-content {
        padding: 8rem 1.5rem 4rem 1.5rem !important;
    }

    /* Tab Switcher */
    .insight-tab-switcher {
        background: #f1f5f9 !important;
        padding: 0.4rem !important;
        border-radius: 1.25rem !important;
        display: flex !important;
        gap: 0.25rem !important;
    }

    .insight-tab-btn {
        flex: 1 !important;
        border: none !important;
        padding: 0.75rem !important;
        border-radius: 1rem !important;
        font-weight: 700 !important;
        font-size: 0.9rem !important;
        color: #64748b !important;
        background: transparent !important;
        transition: all 0.2s !important;
    }

    .insight-tab-btn.active {
        background: white !important;
        color: #1e293b !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    }

    /* KPI Cards */
    .insight-kpi-card {
        padding: 1.5rem !important;
        border-radius: 2rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        transition: transform 0.2s !important;
    }

    .insight-kpi-card.bg-primary {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
        box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2) !important;
    }

    .kpi-label {
        font-weight: 700 !important;
        font-size: 0.85rem !important;
        margin-bottom: 0.5rem !important;
    }

    .kpi-value {
        font-weight: 800 !important;
        letter-spacing: -0.02em !important;
    }

    .kpi-badge {
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        padding: 0.4rem 0.75rem !important;
        border-radius: 0.75rem !important;
        width: fit-content !important;
    }

    /* Chart Cards */
    .insight-chart-card {
        padding: 1.75rem !important;
        border-radius: 2rem !important;
        border: 1px solid #f1f5f9 !important;
    }

    .chart-center-text {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        text-align: center !important;
        pointer-events: none !important;
    }

    /* Legend List */
    .insight-legend-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .legend-item {
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    .legend-dot {
        width: 1rem !important;
        height: 1rem !important;
        border-radius: 0.4rem !important;
        flex-shrink: 0 !important;
    }

    .legend-info {
        display: flex !important;
        flex-direction: column !important;
        line-height: 1.1 !important;
    }

    .legend-name {
        font-weight: 800 !important;
        font-size: 0.95rem !important;
        color: #1e293b !important;
    }

    .legend-val {
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        color: #94a3b8 !important;
    }

    /* User List (Progress) */
    .insight-user-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .user-progress-item {
        width: 100% !important;
    }

    .user-progress-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 0.75rem !important;
    }

    .user-name {
        font-weight: 700 !important;
        font-size: 1.05rem !important;
        color: #1e293b !important;
    }

    .user-amount {
        font-weight: 800 !important;
        font-size: 1.1rem !important;
        color: #2563eb !important;
    }

}

/* END PREVIOUS MOBILE MEDIA QUERY */

/* === POS MOBILE PREMIUM REDESIGN (ISOLATED) === */
@media (max-width: 991.98px) {
    .pos-mobile-container {
        background-color: #f8faff !important;
        min-height: calc(100vh - 60px) !important;
        padding-top: 6rem !important;
        /* Increased to clear fixed header */
        padding-bottom: 5rem !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .pos-mobile-header {
        padding: 0 1.5rem 1rem 1.5rem !important;
    }

    .pos-search-box {
        background: white !important;
        border-radius: 1.5rem !important;
        padding: 0.75rem 1rem !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #e2e8f0 !important;
    }

    .no-scrollbar::-webkit-scrollbar {
        display: none !important;
    }

    .no-scrollbar {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }

    /* POS Card */
    .pos-mobile-card {
        display: block !important;
        width: 100% !important;
        background: white !important;
        border-radius: 1.5rem !important;
        /* Slightly reduced for better rendering */
        padding: 1.5rem !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
        /* Standard Tailwind-like shadow */
        border: 1px solid #f1f5f9 !important;
        position: relative !important;
        -webkit-appearance: none !important;
        /* Safari fix */
    }

    .pos-mobile-card:active {
        transform: scale(0.99) !important;
    }

    .pos-card-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin-bottom: 1rem !important;
    }

    .pos-title {
        font-weight: 700 !important;
        font-size: 1.15rem !important;
        color: #0f172a !important;
        line-height: 1.3 !important;
        margin-bottom: 0.25rem !important;
    }

    .pos-id {
        font-size: 0.75rem !important;
        color: #64748b !important;
        font-weight: 600 !important;
        letter-spacing: 0.05em !important;
    }

    .pos-actions {
        display: flex !important;
        gap: 0.75rem !important;
    }

    .pos-action-icon {
        color: #94a3b8 !important;
        font-size: 1.25rem !important;
        cursor: pointer !important;
        padding: 0.25rem !important;
    }

    .pos-info-row {
        display: flex !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .pos-icon-circle {
        width: 2rem !important;
        height: 2rem !important;
        border-radius: 50% !important;
        background-color: #f1f5f9 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #475569 !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
    }

    .pos-info-text {
        font-size: 0.9rem !important;
        color: #334155 !important;
        line-height: 1.5 !important;
    }

    .pos-phone-link {
        color: #2563eb !important;
        font-weight: 600 !important;
        text-decoration: none !important;
    }

    .pos-card-footer {
        border-top: 1px solid #f1f5f9 !important;
        padding-top: 1rem !important;
        margin-top: 1rem !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .pos-pill-resp {
        background: #f8fafc !important;
        border-radius: 9999px !important;
        padding: 0.25rem 0.75rem !important;
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        color: #475569 !important;
        text-transform: uppercase !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        border: 1px solid #e2e8f0 !important;
    }

    .pos-link-detail {
        color: #2563eb !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }
}

/* === OPPORTUNITIES MOBILE PREMIUM REDESIGN === */

@media (max-width: 991.98px) {
    .opp-mobile-container {
        border-radius: 1.5rem !important;
        position: relative !important;
    }

    .opp-search-box {
        background: white !important;
        border-radius: 1.5rem !important;
        padding: 0.75rem 1rem !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #e2e8f0 !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Tabs Horizontal Scroll */
    .opp-tabs-container {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 0.5rem !important;
        /* Hide scrollbar visual */
    }

    .opp-tab {
        display: inline-block !important;
        padding: 0.5rem 1rem !important;
        background: white !important;
        color: #64748b !important;
        border-radius: 999px !important;
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        border: 1px solid #e2e8f0 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }

    .opp-tab.active {
        background: #4f46e5 !important;
        /* Indigo primary */
        color: white !important;
        border-color: #4f46e5 !important;
        box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3) !important;
    }

    .opp-tab .count {
        background: rgba(255, 255, 255, 0.2) !important;
        padding: 0.1rem 0.4rem !important;
        border-radius: 50% !important;
        margin-left: 0.25rem !important;
        font-size: 0.7rem !important;
    }

    .opp-tab:not(.active) .count {
        background: #f1f5f9 !important;
        color: #64748b !important;
    }

    /* Mobile Cards */
    .opp-mobile-card {
        background: white !important;
        border-radius: 1.5rem !important;
        padding: 1.5rem !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #f1f5f9 !important;
        position: relative !important;
        display: block !important;
        -webkit-appearance: none !important;
    }

    .opp-card-title {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: #4f46e5 !important;
        /* Indigo */
        margin-bottom: 0.25rem !important;
        line-height: 1.3 !important;
    }

    .opp-company-name {
        font-size: 0.7rem !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        color: #64748b !important;
        letter-spacing: 0.05em !important;
    }

    .opp-tag {
        background: #eff6ff !important;
        color: #2563eb !important;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        padding: 0.25rem 0.75rem !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .opp-avatar-circle {
        width: 2.2rem !important;
        height: 2.2rem !important;
        border-radius: 50% !important;
        background: #e2e8f0 !important;
        color: #4f46e5 !important;
        border: 1px solid #cbd5e1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: bold !important;
        font-size: 0.85rem !important;
    }

    /* FAB Button */
    .opp-fab {
        position: fixed !important;
        bottom: 25px !important;
        right: 25px !important;
        width: 3.5rem !important;
        height: 3.5rem !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1050 !important;
        background: #4f46e5 !important;
        /* Match Theme */
        border: none !important;
    }
}