:root {
    /* Base Colors - Dark Mode default */
    --bg-main: #0B0F19;
    --bg-side: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);

    /* Status Colors */
    --status-cartera: #10b981;
    --status-deposito: #f59e0b;
    --status-acreditado: #3b82f6;
    --status-rechazado: #ef4444;
    --status-entregado: #8b5cf6;

    /* Spacing & Misc */
    --sidebar-width: 260px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-mid: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 16px;
    --radius-md: 12px;
}

body.light-mode {
    --bg-main: #F1F5F9;
    --bg-side: #FFFFFF;
    --bg-card: #FFFFFF;
    --accent-primary: #2563EB;
    --accent-secondary: #7C3AED;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --border-color: #CBD5E1;
    --glass-border: rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}


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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-side);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-primary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.logo-icon {
    width: 28px;
    height: 28px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo:hover .logo-icon {
    transform: scale(1.25) rotate(-12deg);
}

.sidebar-nav {
    flex: 1;
    padding: 0 0.75rem;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover, .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-mode .nav-item:hover, body.light-mode .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    background: var(--accent-primary);
    color: var(--bg-main);
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
}

.nav-separator {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin: 1.5rem 1rem 0.75rem;
    opacity: 0.5;
}

.nav-respaldo {
    color: var(--accent-secondary) !important;
    border: 1px dashed rgba(139, 92, 246, 0.3);
    margin-top: 1rem;
    font-weight: 600;
}

body.light-mode .nav-respaldo {
    background: #F5F3FF;
    border-color: rgba(124, 58, 237, 0.2);
}

.nav-respaldo:hover {
    background: rgba(139, 92, 246, 0.1) !important;
}

.sidebar-footer {
    padding: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: calc(100vw - var(--sidebar-width));
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.main-header h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
    flex: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.btn-icon-only {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.light-mode .btn-icon-only:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-toggle-btn {
    display: none; /* Hidden on desktop */
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Glassmorphism Cards */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow, 0 8px 32px 0 rgba(0, 0, 0, 0.3));
    transition: var(--transition-mid);
}


.glass:hover {
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Dashboard Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
}

body.light-mode .metric-card:hover {
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.metric-icon {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    width: fit-content;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    font-family: inherit;
    font-size: 0.9375rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

body.light-mode .btn-secondary {
    background: #E2E8F0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

body.light-mode .btn-secondary:hover {
    background: #CBD5E1;
}

/* Table Design */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--border-color);
    transition: background-color 0.2s;
}

th[onclick] {
    cursor: pointer;
    user-select: none;
}

th[onclick]:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

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

tr {
    transition: background var(--transition-fast);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-cartera { background: rgba(52, 211, 153, 0.1); color: var(--status-cartera); }
.status-deposito { background: rgba(251, 191, 36, 0.1); color: var(--status-deposito); }
.status-acreditado { background: rgba(96, 165, 250, 0.1); color: var(--status-acreditado); }
.status-rechazado { background: rgba(248, 113, 113, 0.1); color: var(--status-rechazado); }
.status-entregado { background: rgba(167, 139, 250, 0.1); color: var(--status-entregado); }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

input, select, textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
}

body.light-mode input, body.light-mode select, body.light-mode textarea {
    background: #F8FAFC;
}

select option {
    color: #000000;
    background: #ffffff;
}


input:focus, select:focus, textarea:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Notifications */
.notification-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: #1e293b;
    color: white;
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.light-mode .toast {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.toast-warning { border-color: var(--status-rechazado); }
body.light-mode .toast-warning { border-left-color: var(--status-rechazado); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    width: 64px;
    height: 64px;
    opacity: 0.2;
    margin-bottom: 1.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 1rem;
        width: 100%;
    }

    .menu-toggle-btn {
        display: flex;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    /* Stack section headers on mobile */
    .section-header-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }

    .summary-action {
        width: 100% !important;
    }

    .summary-action input {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .full-width {
        grid-column: span 1;
    }

    .summary-card {
        padding: 1rem;
    }

    .summary-info .value {
        font-size: 1.75rem;
    }

    .modal {
        padding: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .results-zone {
        background: rgba(255, 255, 255, 0.02);
        border-radius: var(--radius-lg);
        padding: 0.5rem;
        border: 1px solid var(--border-color);
        margin-top: 1rem;
    }
    
    /* Responsive Table Styles */
    .table-container {
        position: relative;
    }
    
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, var(--bg-main), transparent);
        pointer-events: none;
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    .header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    #add-check-btn {
        grid-column: span 2;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* Summary Cards in Views */
.view-summary-header {
    margin-bottom: 2rem;
}

.summary-card {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.summary-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-info .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-info .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: 'Outfit', sans-serif;
}

.summary-action {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

body.light-mode .summary-action {
    background: #F1F5F9;
}

.summary-action label {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0px !important;
}

.summary-action input[type="date"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 700;

    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .summary-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .summary-action {
        width: 100%;
        justify-content: space-between;
    }
}

/* Overdue Highlights */
.row-overdue td {
    color: #ff4d4d !important;
}

.row-overdue td strong {
    color: #ff4d4d !important;
}

.row-overdue td .badge {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Projection Widget */
.projection-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.projection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition-fast);
}

.projection-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.projection-item .date {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.projection-item .value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}


body.light-mode .projection-item {
    background: rgba(0, 0, 0, 0.03);
}

body.light-mode .projection-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Floating Navigation Buttons */
.floating-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1001;
}

.btn-float {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: var(--transition-fast);
}

.btn-float:hover {
    transform: translateY(-4px);
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-float i {
    width: 24px;
    height: 24px;
}

body.light-mode .btn-float {
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Utility for responsive spacing */
.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
