/* ============================================================
   TRANSPORTES BARGONIBICH E.I.R.L. - Premium Dark Mode UI
   ============================================================ */

/* Tipografía del sistema: disponible también sin conexión. */

/* ============================================================
   CSS VARIABLES / DESIGN TOKENS
   ============================================================ */
:root {
    /* Dark Mode Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(17, 24, 39, 0.6);
    --bg-hover: rgba(59, 130, 246, 0.08);
    --bg-input: #1e2a3a;
    
    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #06b6d4);
    --accent-gradient-hover: linear-gradient(135deg, #2563eb, #0891b2);
    --accent-glow: rgba(59, 130, 246, 0.3);
    
    /* Status Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #6366f1;
    --info-bg: rgba(99, 102, 241, 0.12);
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #3b82f6;
    
    /* Border Colors */
    --border-color: rgba(148, 163, 184, 0.1);
    --border-active: rgba(59, 130, 246, 0.4);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    animation: fadeInUp 0.6s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: var(--transition-normal);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    outline: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-info {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.login-info code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-secondary);
}

/* ============================================================
   LAYOUT - APP SHELL
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--header-height);
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.sidebar-header .logo-text {
    overflow: hidden;
}

.sidebar-header .logo-text h2 {
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header .logo-text span {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.user-info:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
}

.user-details .name {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .role {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
.content-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-left .breadcrumb {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
}

.header-date {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-date i {
    color: var(--accent-primary);
}

/* ============================================================
   CONTENT BODY
   ============================================================ */
.content-body {
    padding: 28px 32px;
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-active);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.blue::before { background: var(--accent-gradient); }
.stat-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card.cyan::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-card-header .icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.stat-card.blue .icon { background: rgba(59, 130, 246, 0.12); color: var(--accent-primary); }
.stat-card.green .icon { background: var(--success-bg); color: var(--success); }
.stat-card.orange .icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.red .icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.purple .icon { background: var(--info-bg); color: var(--info); }
.stat-card.cyan .icon { background: rgba(6, 182, 212, 0.12); color: var(--accent-secondary); }

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   ALERTS SECTION (Dashboard)
   ============================================================ */
.alerts-section {
    margin-bottom: 28px;
}

.alerts-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1.125rem;
    font-weight: 700;
}

.alerts-title i {
    color: var(--warning);
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: var(--transition-fast);
    animation: fadeInLeft 0.4s ease;
}

.alert-item:hover {
    border-color: var(--border-active);
    transform: translateX(4px);
}

.alert-item.danger {
    border-left: 3px solid var(--danger);
}

.alert-item.warning {
    border-left: 3px solid var(--warning);
}

.alert-item.info {
    border-left: 3px solid var(--info);
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.alert-item.danger .alert-icon { background: var(--danger-bg); color: var(--danger); }
.alert-item.warning .alert-icon { background: var(--warning-bg); color: var(--warning); }
.alert-item.info .alert-icon { background: var(--info-bg); color: var(--info); }

.alert-content {
    flex: 1;
}

.alert-content .alert-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.alert-content .alert-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.alert-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.alert-item.danger .alert-badge { background: var(--danger-bg); color: var(--danger); }
.alert-item.warning .alert-badge { background: var(--warning-bg); color: var(--warning); }

/* ============================================================
   CHARTS GRID
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition-normal);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 28px;
}

.table-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    position: relative;
}

.search-input input {
    padding: 8px 14px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    outline: none;
    width: 240px;
    transition: var(--transition-normal);
}

.search-input input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* Status badges in tables */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.vigente,
.status-badge.disponible,
.status-badge.pagado {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.vencido,
.status-badge.debe {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-badge.por-vencer,
.status-badge.en-ruta {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge.en-mantenimiento {
    background: var(--info-bg);
    color: var(--info);
}

.status-badge.parcial {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

/* Action buttons in table */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btns .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.8125rem;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px 28px;
}

.modal-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.table-footer {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================================
   STAR RATING
   ============================================================ */
.star-rating {
    color: var(--warning);
    font-size: 0.875rem;
    letter-spacing: 2px;
}

/* ============================================================
   KM PROGRESS BAR
   ============================================================ */
.km-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.km-progress .bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.km-progress .bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.km-progress .bar .fill.green { background: var(--success); }
.km-progress .bar .fill.orange { background: var(--warning); }
.km-progress .bar .fill.red { background: var(--danger); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content-body {
        padding: 20px 16px;
    }
    
    .content-header {
        padding: 0 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .modal-body .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input input {
        width: 100%;
    }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: fadeInLeft 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #1a1a1a; }
.toast.info { background: var(--info); }

/* ============================================================
   SECTION-SPECIFIC (Deuda chart, Costos Fijos etc.)
   ============================================================ */
.info-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.info-card .info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.info-card .info-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.info-card .info-value.blue { color: var(--accent-primary); }
.info-card .info-value.green { color: var(--success); }
.info-card .info-value.orange { color: var(--warning); }
.info-card .info-value.red { color: var(--danger); }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: fit-content;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9375rem;
}

/* Logout btn */
.logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: 8px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.logout-link:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.logout-link i {
    width: 20px;
    text-align: center;
}

/* Confirm dialog */
.confirm-dialog {
    text-align: center;
    padding: 20px 0;
}

.confirm-dialog i {
    font-size: 3rem;
    color: var(--warning);
    margin-bottom: 16px;
}

.confirm-dialog h4 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============================================================
   EXPORT BUTTON
   ============================================================ */
.btn-export {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}
.btn-export:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

/* ============================================================
   TRACKING / MAP STYLES
   ============================================================ */
.tracking-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tracking-stat-item {
    flex: 1;
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}
.tracking-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.tracking-stat-icon.blue { background: rgba(59,130,246,0.15); color: #3b82f6; }
.tracking-stat-icon.green { background: rgba(16,185,129,0.15); color: #10b981; }
.tracking-stat-icon.orange { background: rgba(245,158,11,0.15); color: #f59e0b; }
.tracking-stat-icon.cyan { background: rgba(6,182,212,0.15); color: #06b6d4; }
.tracking-stat-icon.purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.tracking-stat-icon.pink { background: rgba(236,72,153,0.15); color: #ec4899; }
.tracking-stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.tracking-stat-label { font-size: 0.75rem; color: var(--text-muted); }

.tracking-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    height: calc(100vh - 280px);
    min-height: 500px;
}
.tracking-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tracking-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tracking-panel-header h3 {
    font-size: 0.9375rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tracking-vehicle-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.vehicle-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.vehicle-card:hover { border-color: var(--accent-primary); background: var(--bg-hover); }
.vehicle-card.active { border-color: var(--accent-primary); box-shadow: 0 0 12px rgba(59,130,246,0.2); }
.vehicle-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.vehicle-card-icon {
    width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.875rem;
}
.vehicle-card-icon.green { background: rgba(16,185,129,0.15); color: #10b981; }
.vehicle-card-icon.blue { background: rgba(59,130,246,0.15); color: #3b82f6; }
.vehicle-card-icon.orange { background: rgba(245,158,11,0.15); color: #f59e0b; }
.vehicle-card-icon.red { background: rgba(239,68,68,0.15); color: #ef4444; }
.vehicle-card-info { flex: 1; }
.vehicle-card-placa { font-weight: 700; font-size: 0.9375rem; color: var(--text-primary); }
.vehicle-card-model { font-size: 0.75rem; color: var(--text-muted); }
.vehicle-card-status {
    font-size: 0.6875rem; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.vehicle-card-status.green { background: rgba(16,185,129,0.15); color: #10b981; }
.vehicle-card-status.blue { background: rgba(59,130,246,0.15); color: #3b82f6; }
.vehicle-card-status.orange { background: rgba(245,158,11,0.15); color: #f59e0b; }
.vehicle-card-status.red { background: rgba(239,68,68,0.15); color: #ef4444; }
.vehicle-card-details { display: flex; flex-wrap: wrap; gap: 6px; }
.vehicle-card-detail {
    font-size: 0.6875rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px;
    background: rgba(148,163,184,0.06); padding: 2px 8px; border-radius: 4px;
}
.vehicle-card-detail i { color: var(--text-muted); font-size: 0.625rem; }

/* Map Container */
.tracking-map-container {
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}
.tracking-map { width: 100%; height: 100%; min-height: 500px; background: #0a0e1a; }
.map-overlay-controls {
    position: absolute; top: 12px; right: 12px; z-index: 1000;
    display: flex; flex-direction: column; gap: 6px;
}
.map-control-btn {
    width: 36px; height: 36px; border-radius: 8px; border: none;
    background: rgba(17,24,39,0.9); color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(10px); border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}
.map-control-btn:hover { background: var(--accent-primary); color: #fff; }

/* Vehicle Markers */
.vehicle-marker-wrapper { background: none !important; border: none !important; }
.vehicle-marker {
    width: 36px; height: 36px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: #fff; font-size: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    transition: transform 0.3s ease;
}
.vehicle-marker:hover { transform: scale(1.2); }

/* Marker Pulse Animation */
.marker-pulse {
    position: absolute; width: 36px; height: 36px; border-radius: 50%; opacity: 0;
    animation: markerPulse 2s infinite;
}
@keyframes markerPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Pulse dot on stats */
.pulse-dot { position: relative; }
.pulse-dot::after {
    content: ''; position: absolute; top: 2px; right: 2px; width: 8px; height: 8px;
    background: #10b981; border-radius: 50%; animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* Map Popup */
.dark-popup .leaflet-popup-content-wrapper {
    background: rgba(17,24,39,0.95) !important; color: #f1f5f9 !important;
    border-radius: 12px !important; border: 1px solid rgba(148,163,184,0.15);
    backdrop-filter: blur(20px); box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.dark-popup .leaflet-popup-tip { background: rgba(17,24,39,0.95) !important; }
.map-popup { padding: 4px; }
.map-popup-title { font-weight: 700; font-size: 0.9375rem; margin-bottom: 6px; }
.map-popup-status {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 0.75rem; font-weight: 600; margin-bottom: 8px;
}
.map-popup-status.disponible { background: rgba(16,185,129,0.15); color: #10b981; }
.map-popup-status.en-ruta { background: rgba(59,130,246,0.15); color: #3b82f6; }
.map-popup-status.en-mantenimiento { background: rgba(245,158,11,0.15); color: #f59e0b; }
.map-popup-status.fuera-de-servicio { background: rgba(239,68,68,0.15); color: #ef4444; }
.map-popup-detail { font-size: 0.8125rem; color: #94a3b8; margin-bottom: 4px; }
.map-popup-detail i { width: 16px; color: #64748b; }
.map-popup-btn {
    display: block; width: 100%; margin-top: 10px; padding: 8px;
    background: var(--accent-gradient); color: #fff; border: none; border-radius: 8px;
    font-size: 0.8125rem; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all var(--transition-fast);
}
.map-popup-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }

/* Route Info Panel */
.route-info-panel {
    position: absolute; top: 12px; left: 12px; z-index: 1000;
    background: rgba(10,14,26,0.92); backdrop-filter: blur(20px);
    border: 1px solid rgba(148,163,184,0.15); border-radius: 16px;
    padding: 20px; width: 320px; max-height: calc(100% - 24px);
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.route-info-close {
    position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
    border-radius: 50%; background: rgba(148,163,184,0.1); display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    color: var(--text-muted); transition: all var(--transition-fast);
}
.route-info-close:hover { background: var(--danger); color: #fff; }
.route-info-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.route-info-title i { color: var(--accent-primary); }
.route-info-vehicle { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.6; }
.route-info-vehicle i { color: var(--text-muted); width: 18px; }
.route-info-dates {
    display: flex; align-items: center; gap: 8px; font-size: 0.8125rem;
    color: var(--text-secondary); margin-bottom: 16px;
    background: rgba(148,163,184,0.05); padding: 8px 12px; border-radius: 8px;
}
.route-info-dates i { color: var(--accent-primary); }
.route-info-stats {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px;
}
.route-stat {
    text-align: center; background: rgba(148,163,184,0.06); padding: 10px 6px; border-radius: 8px;
}
.route-stat-value { display: block; font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.route-stat-label { display: block; font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }
.route-info-finance { margin-bottom: 12px; }
.route-finance-item {
    display: flex; justify-content: space-between; padding: 6px 0;
    font-size: 0.8125rem; border-bottom: 1px solid rgba(148,163,184,0.06);
}
.route-finance-item.green span:first-child { color: #10b981; }
.route-finance-item.green span:last-child { color: #10b981; font-weight: 600; }
.route-finance-item.red span:first-child { color: var(--text-secondary); }
.route-finance-item.red span:last-child { color: #ef4444; }
.route-finance-total {
    display: flex; justify-content: space-between; padding: 10px 0 0;
    font-size: 0.9375rem; font-weight: 700;
}
.route-finance-total.green span { color: #10b981; }
.route-finance-total.red span { color: #ef4444; }
.route-info-multas {
    background: rgba(239,68,68,0.08); padding: 12px; border-radius: 8px;
    border-left: 3px solid var(--danger);
}

/* Route Endpoint Markers */
.route-endpoint-marker { background: none !important; border: none !important; }
.route-endpoint {
    width: 30px; height: 30px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: #fff; font-size: 12px;
}
.route-endpoint.origin { background: #10b981; box-shadow: 0 0 20px rgba(16,185,129,0.4); }
.route-endpoint.destination { background: #ef4444; box-shadow: 0 0 20px rgba(239,68,68,0.4); }
.route-endpoint-label {
    position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
    white-space: nowrap; font-size: 11px; font-weight: 600; color: #f1f5f9;
    background: rgba(10,14,26,0.85); padding: 2px 8px; border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Moving Vehicle */
.moving-vehicle {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px;
    box-shadow: 0 0 24px rgba(59,130,246,0.5);
    animation: vehicleGlow 1.5s infinite alternate;
}
.moving-vehicle.arrived { background: linear-gradient(135deg, #10b981, #059669); }
@keyframes vehicleGlow {
    0% { box-shadow: 0 0 16px rgba(59,130,246,0.4); }
    100% { box-shadow: 0 0 32px rgba(6,182,212,0.6); }
}
.moving-vehicle-icon { background: none !important; border: none !important; }

/* Arrival Pulse */
.arrival-pulse-wrapper { background: none !important; border: none !important; }
.arrival-pulse {
    position: absolute; width: 50px; height: 50px; border-radius: 50%;
    border: 3px solid #10b981; animation: arrivalPulse 1.5s infinite;
    top: 0; left: 0;
}
@keyframes arrivalPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* ============================================================
   NOTIFICATIONS STYLES
   ============================================================ */
.noti-item {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
    border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
    transition: all var(--transition-fast); border: 1px solid transparent;
}
.noti-item.unread { background: rgba(59,130,246,0.06); border-color: rgba(59,130,246,0.15); }
.noti-item:hover { background: var(--bg-hover); }
.noti-icon {
    width: 36px; height: 36px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.noti-icon.danger { background: rgba(239,68,68,0.15); color: #ef4444; }
.noti-icon.warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.noti-icon.success { background: rgba(16,185,129,0.15); color: #10b981; }
.noti-icon.info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.noti-content { flex: 1; min-width: 0; }
.noti-title { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); margin-bottom: 2px; }
.noti-msg { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 4px; }
.noti-time { font-size: 0.75rem; color: var(--text-muted); }
.noti-time i { margin-right: 4px; }
.noti-unread-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent-primary);
    flex-shrink: 0; margin-top: 6px;
}

/* Filter select class */
.filter-select {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

/* Responsive tracking */
@media (max-width: 768px) {
    .tracking-layout { grid-template-columns: 1fr; height: auto; }
    .tracking-panel { max-height: 300px; }
    .tracking-stats { gap: 8px; }
    .tracking-stat-item { min-width: 100px; padding: 10px; }
    .route-info-panel { width: calc(100% - 24px); max-width: 320px; }
}
