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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
    display: flex; flex-direction: column;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 12px;
}

.sidebar-logo img { width: 36px; height: 36px; border-radius: 8px; }

.sidebar-logo span {
    font-size: 1.25rem; font-weight: 700; color: #fff;
    letter-spacing: -0.5px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-section { padding: 16px 24px 6px; }

.sidebar-section span {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--sidebar-text); font-weight: 600;
}

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; color: var(--sidebar-text);
    font-size: 0.9rem; font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.05); text-decoration: none; }
.sidebar-link.active { color: #fff; background: rgba(37,99,235,0.2); border-left-color: var(--sidebar-active); }

.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex; align-items: center; gap: 12px;
    color: #fff; font-size: 0.85rem;
}

.sidebar-user .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.9rem; color: #fff;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 50;
}

.topbar h1 { font-size: 1.3rem; font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.topbar-actions button {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 8px; border-radius: 8px;
    transition: all var(--transition);
}

.topbar-actions button:hover { background: var(--bg); color: var(--text); }

.page-content { padding: 28px 32px; }

.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.card-header h3 { font-size: 1.05rem; font-weight: 600; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px 24px;
    display: flex; align-items: flex-start; gap: 16px;
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-info h2 { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-info p { color: var(--text-muted); font-size: 0.83rem; margin-top: 2px; }

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

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 8px; font-size: 0.85rem;
    font-weight: 500; cursor: pointer; border: 1px solid transparent;
    transition: all var(--transition); line-height: 1.5;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline {
    background: transparent; color: var(--text);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

.btn-icon { padding: 8px 10px; }

table {
    width: 100%; border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left; padding: 12px 16px;
    background: var(--bg); color: var(--text-muted);
    font-weight: 600; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}

table.table-scrollable {
    display: block; max-height: 500px; overflow-y: auto;
}

table.table-scrollable thead th {
    position: sticky; top: 0;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

tbody tr { transition: background-color var(--transition); }
tbody tr:hover { background: var(--bg); }

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block; margin-bottom: 6px;
    font-size: 0.85rem; font-weight: 500; color: var(--text);
}

.form-control {
    width: 100%; padding: 9px 14px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.9rem; color: var(--text);
    background: var(--card); transition: border-color var(--transition);
}

.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    transform: translateY(-1px);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
    transition: transform var(--transition);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--card); border-radius: var(--radius);
    width: 90%; max-width: 600px; max-height: 85vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}

.modal-lg { max-width: 900px; }

.modal-header {
    padding: 18px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.3rem; color: var(--text-muted); padding: 4px;
    border-radius: 6px;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 24px; }

.toast-container {
    position: fixed; top: 24px; right: 24px;
    z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}

.toast {
    padding: 14px 20px; border-radius: 10px;
    color: #fff; font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text); }
.toast-info { background: var(--info); }

.loading {
    display: inline-block; width: 20px; height: 20px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.6s linear infinite;
}

.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 0.88rem; margin-bottom: 16px;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: #155e75; border: 1px solid #a5f3fc; }

.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }

.tab {
    padding: 12px 24px; cursor: pointer;
    font-weight: 500; color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all var(--transition); font-size: 0.88rem;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}

.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 0.88rem; }

.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); padding: 8px 14px;
    border-radius: 8px; border: 1px solid var(--border);
}

.search-box input {
    border: none; background: none; outline: none;
    font-size: 0.88rem; flex: 1; min-width: 200px;
}

.drag-ghost { opacity: 0.4; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .page-content { padding: 20px 16px; }
    .topbar { padding: 0 16px; }
}

/* ---- TABLE RESPONSIVE LAYOUT ---- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.table-responsive table {
    margin-bottom: 0;
}

/* ---- PREMIUM DARK THEME OVERRIDES ---- */
html.dark-mode, body.dark-mode {
    --bg: #0b0f19; /* Ultra premium dark backdrop */
    --card: #121826; /* Deep dark slate card */
    --border: #1f2937; /* Gray-800 borders */
    --text: #f3f4f6; /* Gray-100 main text */
    --text-muted: #9ca3af; /* Gray-400 muted text */
    --text-light: #6b7280; /* Gray-500 helper text */
    
    --primary-light: rgba(37, 99, 235, 0.15);
    --success-light: rgba(22, 163, 74, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger-light: rgba(220, 38, 38, 0.15);
    --info-light: rgba(8, 145, 178, 0.15);
    
    --sidebar-bg: #090c13;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Specific component overrides for dark mode */
html.dark-mode input.form-control,
html.dark-mode select.form-control,
html.dark-mode textarea.form-control {
    background: #192132;
    border-color: #27314a;
    color: #f3f4f6;
}
html.dark-mode input.form-control:focus,
html.dark-mode select.form-control:focus,
html.dark-mode textarea.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}
html.dark-mode select.form-control option {
    background: #121826;
    color: #f3f4f6;
}
html.dark-mode thead th {
    background: #192132;
    color: #9ca3af;
    border-bottom: 2px solid #27314a;
}
html.dark-mode tbody tr:hover {
    background: #151e30;
}
html.dark-mode tbody td {
    border-bottom: 1px solid #1f2937;
}
html.dark-mode .search-box {
    background: #192132;
    border-color: #27314a;
}
html.dark-mode .search-box input {
    color: #f3f4f6;
}
html.dark-mode .tab {
    color: #9ca3af;
    border-bottom-color: transparent;
}
html.dark-mode .tab:hover {
    color: #f3f4f6;
}
html.dark-mode .tabs {
    border-bottom-color: #1f2937;
}
html.dark-mode .card {
    background: #121826;
    border-color: #1f2937;
}
html.dark-mode .alert-success { background: rgba(22, 163, 74, 0.1); color: #4ade80; border-color: rgba(74, 222, 128, 0.2); }
html.dark-mode .alert-danger { background: rgba(220, 38, 38, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.2); }
html.dark-mode .alert-warning { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border-color: rgba(251, 191, 36, 0.2); }
html.dark-mode .alert-info { background: rgba(8, 145, 178, 0.1); color: #22d3ee; border-color: rgba(34, 211, 238, 0.2); }

/* Provider split pane adjustments */
html.dark-mode .prov-panel {
    background: #121826;
    border-color: #1f2937;
}
html.dark-mode .prov-panel-header {
    background: linear-gradient(135deg, #161e30, #121826);
    border-bottom: 1px solid #1f2937;
}
html.dark-mode .prov-row:hover {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.2);
}
html.dark-mode .prov-row.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--primary);
}
html.dark-mode .prov-row .prov-avatar {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* Lightbox Modal Dark adjustments */
html.dark-mode #globalLightboxModal {
    background: rgba(8, 10, 15, 0.95);
}

/* ---- EXTRA MOBILE/TABLET STYLING ---- */
@media (max-width: 768px) {
    .prov-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .prov-panel {
        height: 500px;
    }
    #detailPanel {
        height: auto;
        min-height: 300px;
    }
}
@media (max-width: 576px) {
    .modal-body {
        padding: 16px;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .page-content {
        padding: 16px 12px;
    }
    .modal-body form div[style*="justify-content:flex-end"] {
        flex-direction: column-reverse;
        gap: 8px !important;
    }
    .modal-body form div[style*="justify-content:flex-end"] button,
    .modal-body form div[style*="justify-content:flex-end"] a {
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: center;
    }
    .topbar h1 {
        font-size: 1.15rem;
    }
}

/* ---- RESPONSIVE MENUS AND LAYOUTS ---- */
@media (max-width: 1024px) {
    .menu-toggle {
        display: block !important;
        color: var(--text) !important;
    }
    
    /* Planner Responsive Stacking */
    .planner-container {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto 400px auto !important;
        height: auto !important;
        overflow-y: auto !important;
    }
    .p-sidebar {
        height: 450px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--p-border) !important;
    }
    .p-sidebar-right {
        border-left: none !important;
        border-top: 1px solid var(--p-border) !important;
        height: 450px !important;
    }
    
    /* General multi-column split panes on tablets */
    .cmp-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }
    .cmp-panel {
        height: 450px !important;
        margin-bottom: 1.5rem;
    }
    #ocDetailPanel {
        height: auto !important;
        min-height: 400px !important;
    }
}

@media (max-width: 768px) {
    /* Tracking layout stacking map on top */
    .tracking-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
        gap: 16px !important;
    }
    .tracking-side {
        height: 350px !important;
        order: -1 !important;
    }
    .tracking-main {
        height: auto !important;
        max-height: 500px;
    }
    
    /* General responsive KPI widgets */
    .inv-kpi-bar {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 576px) {
    .inv-kpi-bar {
        grid-template-columns: 1fr !important;
    }
}

/* ---- PREMIUM DARK THEME MODULE SPECIFIC OVERRIDES ---- */
html.dark-mode, body.dark-mode {
    /* Planner module local variables override */
    --p-bg: #0b0f19;
    --p-card: #121826;
    --p-primary: #6366f1;
    --p-secondary: #0ea5e9;
    --p-success: #10b981;
    --p-danger: #ef4444;
    --p-warning: #f59e0b;
    --p-text: #f3f4f6;
    --p-text-light: #9ca3af;
    --p-border: #1f2937;
    
    /* Global brand highlights */
    --accent: #6366f1;
}

/* Planner Dark Theme Overrides */
html.dark-mode .p-sidebar,
html.dark-mode .p-sidebar-header,
html.dark-mode .p-order-card,
html.dark-mode .p-route-card {
    background: var(--p-card) !important;
    border-color: var(--p-border) !important;
    color: var(--p-text) !important;
}
html.dark-mode .p-order-card:hover,
html.dark-mode .p-route-card:hover {
    border-color: var(--p-primary) !important;
}
html.dark-mode .p-order-card.selected,
html.dark-mode .p-route-card.active {
    background: rgba(99, 102, 241, 0.12) !important;
    border-color: var(--p-primary) !important;
    box-shadow: 0 0 0 2px var(--p-primary) !important;
}
html.dark-mode .p-stat-pill {
    background: #1f2937 !important;
    color: #f3f4f6 !important;
}
html.dark-mode .p-map-overlay {
    background: rgba(18, 24, 38, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
html.dark-mode .p-map-overlay button, 
html.dark-mode .p-map-overlay select {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}
html.dark-mode .p-kpi-bar {
    background: rgba(18, 24, 38, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}
html.dark-mode .p-kpi-card {
    background: #1f2937 !important;
    border-color: #27314a !important;
}
html.dark-mode .btn-p {
    background: #1f2937 !important;
    border-color: #27314a !important;
    color: #f3f4f6 !important;
}
html.dark-mode .btn-p:hover {
    background: #27314a !important;
}
html.dark-mode .p-search-box {
    background: #1f2937 !important;
    border-color: #27314a !important;
}
html.dark-mode .p-search-box input {
    color: #f3f4f6 !important;
}
html.dark-mode .p-order-id {
    color: var(--p-text-light) !important;
}
html.dark-mode .p-order-client {
    color: var(--p-text) !important;
}

/* Driver App Dark Theme Overrides */
html.dark-mode .ruta-card-driver,
html.dark-mode .parada-item {
    background: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
html.dark-mode .bottom-bar {
    background: var(--card) !important;
    border-color: var(--border) !important;
}
html.dark-mode #conductorSelect {
    background: #192132 !important;
    border-color: #27314a !important;
    color: #f3f4f6 !important;
}
html.dark-mode #firmaCanvas {
    border-color: var(--border) !important;
    background: #1f2937 !important;
}
html.dark-mode .progress-bar {
    background: #1f2937 !important;
}

/* Inventario Dark Theme Overrides */
html.dark-mode .inv-kpi {
    background: var(--card) !important;
    border-color: var(--border) !important;
}
html.dark-mode .inv-main {
    background: var(--card) !important;
    border-color: var(--border) !important;
}
html.dark-mode .inv-toolbar {
    background: #192132 !important;
    border-color: #27314a !important;
}
html.dark-mode .inv-table th {
    background: #192132 !important;
    border-color: #27314a !important;
}
html.dark-mode .inv-table td {
    border-color: #1f2937 !important;
}
html.dark-mode .inv-table tr:hover td {
    background: #151e30 !important;
}
html.dark-mode #invSearch,
html.dark-mode #invDeposito {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}
html.dark-mode #modalAjuste > div,
html.dark-mode #modalTransferencia > div,
html.dark-mode #modalMovimientos > div {
    background: var(--card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html.dark-mode .detail-label {
    color: var(--text-muted) !important;
}

/* Compras (OC) Dark Theme Overrides */
html.dark-mode .cmp-panel {
    background: var(--card) !important;
    border-color: var(--border) !important;
}
html.dark-mode .cmp-header {
    background: linear-gradient(135deg, #161e30, #121826) !important;
    border-color: var(--border) !important;
}
html.dark-mode .oc-card {
    border-color: var(--border) !important;
}
html.dark-mode .oc-card:hover {
    background: #151e30 !important;
}
html.dark-mode .oc-card.active {
    background: rgba(99, 102, 241, 0.12) !important;
    border-left-color: var(--primary) !important;
}
html.dark-mode #modalOC > div,
html.dark-mode #modalRecepcion > div {
    background: var(--card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html.dark-mode #itemsContainer > div {
    background: #192132 !important;
    border-color: #27314a !important;
}
html.dark-mode #itemsContainer select,
html.dark-mode #itemsContainer input {
    background: #121826 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}
html.dark-mode .items-table th {
    background: #192132 !important;
    border-color: #27314a !important;
}
html.dark-mode .items-table td {
    border-color: #1f2937 !important;
}
html.dark-mode select[id="filtroEstado"] {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}
html.dark-mode #recepcionBody > div {
    background: #192132 !important;
}
html.dark-mode #recepcionBody input {
    background: #121826 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}
html.dark-mode div[style*="background:#fffbeb"],
html.dark-mode div[style*="background: #fffbeb"] {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
}
html.dark-mode #oc_proveedor,
html.dark-mode #oc_deposito,
html.dark-mode #oc_fecha,
html.dark-mode #oc_entrega,
html.dark-mode #oc_notas {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}

/* Portal and Cobranzas Dark Theme Overrides (Attribute Styling selectors) */
html.dark-mode div[style*="background: white"],
html.dark-mode div[style*="background:white"] {
    background: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
html.dark-mode div[style*="background: #f1f5f9"],
html.dark-mode div[style*="background:#f1f5f9"] {
    background: #192132 !important;
    color: #f3f4f6 !important;
}
html.dark-mode span[style*="background: #f1f5f9"],
html.dark-mode span[style*="background:#f1f5f9"] {
    background: #192132 !important;
    border-color: #27314a !important;
    color: #f3f4f6 !important;
}
html.dark-mode span[style*="background: #f8fafc"],
html.dark-mode span[style*="background:#f8fafc"] {
    background: #192132 !important;
    border-color: #27314a !important;
    color: #f3f4f6 !important;
}
html.dark-mode div[style*="background: #eff6ff"],
html.dark-mode div[style*="background:#eff6ff"] {
    background: rgba(37, 99, 235, 0.15) !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
    color: #60a5fa !important;
}
html.dark-mode tr[style*="background: #f8fafc"],
html.dark-mode tr[style*="background:#f8fafc"] {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-bottom: 1px solid #27314a !important;
}
html.dark-mode tr.orden-row,
html.dark-mode tr.cobranza-row {
    border-bottom: 1px solid #1f2937 !important;
}
html.dark-mode tr.orden-row:hover,
html.dark-mode tr.cobranza-row:hover {
    background: #151e30 !important;
}
html.dark-mode select[id="filterEstadoOrden"],
html.dark-mode select[id="filterEstado"],
html.dark-mode input[id="searchOrdenes"],
html.dark-mode input[id="searchCobranzas"] {
    background: #192132 !important;
    color: #f3f4f6 !important;
    border-color: #27314a !important;
}

/* Emissions and Settlement Dark Theme Overrides */
html.dark-mode div[style*="border: 1px solid #ddd"] {
    border-color: #1f2937 !important;
}
html.dark-mode table[style*="background: white"],
html.dark-mode table[style*="background:white"] {
    background: var(--card) !important;
}
html.dark-mode tr[style*="background: #eee"],
html.dark-mode tr[style*="background:#eee"] {
    background: #192132 !important;
    color: #f3f4f6 !important;
}
html.dark-mode td[style*="border: 1px solid #ccc"],
html.dark-mode th[style*="border: 1px solid #ccc"] {
    border-color: #1f2937 !important;
    color: #f3f4f6 !important;
}

/* Login Dark Theme Overrides */
html.dark-mode .login-card {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}
html.dark-mode .login-body label {
    color: #f3f4f6 !important;
}
html.dark-mode .login-tab {
    color: var(--text-muted) !important;
    border-bottom-color: var(--border) !important;
}
html.dark-mode .login-tab.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
}
html.dark-mode #demoCredentials {
    color: var(--text-muted) !important;
}

/* Ordenes Suggestions and Assignments */
html.dark-mode .suggestions-list {
    background: #121826 !important;
    border-color: #1f2937 !important;
}
html.dark-mode .suggestion-item {
    border-bottom: 1px solid #1f2937 !important;
    color: #f3f4f6 !important;
}
html.dark-mode .suggestion-item:hover {
    background: #192132 !important;
}
html.dark-mode #routeAssignmentInfo {
    background: rgba(22, 163, 74, 0.1) !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
    color: #4ade80 !important;
}

/* General high contrast form controls and tables helper */
html.dark-mode label {
    color: var(--text) !important;
}
html.dark-mode .alert-row {
    background-color: rgba(220, 38, 38, 0.15) !important;
    color: #f87171 !important;
}
html.dark-mode table td {
    color: #f3f4f6 !important;
}

