* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #eef4fb;
    color: #0f172a;
}


/* SIDEBAR */

.sidebar {
    width: 245px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, #061a33, #0b345f);
    color: white;
    padding: 22px 14px;
    box-shadow: 4px 0 18px rgba(0,0,0,0.25);
}

.sidebar-header {
    text-align: center;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}

.logo-sidebar {
    width: 105px;
    height: 105px;
    object-fit: contain;
    background: white;
    padding: 8px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.sidebar h2 {
    margin: 8px 0 5px;
    font-size: 22px;
    letter-spacing: 2px;
    color: #ffffff;
}

.sidebar span {
    color: #dbeafe;
    font-size: 12px;
}

.menu-sidebar {
    list-style: none;
    padding: 25px 0;
    margin: 0;
}

.menu-sidebar li {
    margin-bottom: 8px;
}

.menu-sidebar a {
    display: block;
    padding: 12px 14px;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
}

.menu-sidebar a:hover {
    background: #2563eb;
}

.sidebar-footer {
    position: absolute;
    bottom: 25px;
    left: 14px;
    right: 14px;
}

.sidebar-footer a {
    display: block;
    text-align: center;
    padding: 12px;
    background: rgba(255,255,255,0.12);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
}

.sidebar-footer a:hover {
    background: #dc2626;
}

/* CONTENIDO */

.content {
    margin-left: 270px;
    padding: 35px;
}

h1 {
    font-size: 34px;
    margin-bottom: 18px;
    color: #0f172a;
}

h2 {
    font-size: 24px;
    color: #1e293b;
}

/* BOTONES */

.btn,
button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 11px 16px;
    border-radius: 9px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}

.btn:hover,
button:hover {
    background: #1d4ed8;
}

/* FORMULARIOS */

input,
select,
textarea {
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
}

/* CARDS */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
    margin: 20px 0 35px;
}

.card {
    min-height: 100px;
    padding: 22px;
    border-radius: 16px;
    color: white;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.13);
}

.card:nth-child(1) { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.card:nth-child(2) { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.card:nth-child(3) { background: linear-gradient(135deg, #10b981, #059669); }
.card:nth-child(4) { background: linear-gradient(135deg, #f59e0b, #d97706); }
.card:nth-child(5) { background: linear-gradient(135deg, #ef4444, #dc2626); }
.card:nth-child(6) { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.card:nth-child(7) { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.card:nth-child(8) { background: linear-gradient(135deg, #0f766e, #115e59); }
.card:nth-child(9) { background: linear-gradient(135deg, #9333ea, #6d28d9); }

/* DASHBOARD GRÁFICOS */

.chart-container {
    background: white;
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 35px;
    box-shadow: 0 8px 22px rgba(15,23,42,0.10);
    border-left: 6px solid #2563eb;
    max-width: 1050px;
}

.chart-container canvas {
    width: 100% !important;
    height: 360px !important;
}
.chart-container {
    background: white;
    padding: 25px;
    border-radius: 18px;
    margin-bottom: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.10);
    border-left: 6px solid #2563eb;
}

.chart-container canvas {
    width: 100% !important;
    max-height: 300px !important;
}

.chart-small {
    max-width: 650px;
    height: 360px;
}

/* TABLAS GENERALES */

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(15,23,42,0.10);
    margin-top: 18px;
}

th {
    background: #0b1f3a;
    color: white;
    padding: 12px 8px;
    font-size: 12px;
    text-align: center;
}

td {
    padding: 10px 8px;
    font-size: 12px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

tr:hover {
    background: #f8fafc;
}

/* TABLA CLIENTES */

.tabla-clientes th,
.tabla-clientes td {
    font-size: 13px;
    padding: 12px 10px;
}

.tabla-clientes td:nth-child(2) {
    text-align: left;
    width: 420px;
}

/* TABLA CONDUCTORES */

.tabla-conductores th,
.tabla-conductores td {
    font-size: 13px;
    padding: 12px 10px;
}

.tabla-conductores td:nth-child(3) {
    text-align: left;
    width: 420px;
}

/* TABLA UNIDADES */

.tabla-unidades th,
.tabla-unidades td {
    font-size: 13px;
    padding: 12px 10px;
}

.tabla-unidades td:nth-child(2),
.tabla-unidades td:nth-child(3) {
    font-weight: bold;
}

/* TABLA FACTURAS */

.facturas-table th {
    font-size: 11px;
    padding: 9px 6px;
}

.facturas-table td {
    font-size: 10px;
    padding: 8px 5px;
    line-height: 1.3;
}

.facturas-table td:nth-child(4) {
    min-width: 260px;
    max-width: 260px;
    text-align: left;
}

.facturas-table td:nth-child(13) {
    min-width: 170px;
}

/* TABLA GUÍAS */

.tabla-guias th {
    font-size: 10px;
    padding: 8px 5px;
}

.tabla-guias td {
    font-size: 9px;
    padding: 7px 4px;
    line-height: 1.25;
}

.tabla-guias td:nth-child(3) {
    min-width: 260px;
    max-width: 260px;
    text-align: left;
}

.tabla-guias td:nth-child(7) {
    min-width: 150px;
    max-width: 150px;
    font-size: 8.5px;
    text-align: left;
}

.tabla-guias td:nth-child(8),
.tabla-guias td:nth-child(9) {
    min-width: 180px;
    max-width: 180px;
    font-size: 8.8px;
}

/* ESTADOS */

.estado-pagada,
.estado-finalizada {
    color: #16a34a;
    font-weight: bold;
}

.estado-pendiente,
.estado-emitida {
    color: #2563eb;
    font-weight: bold;
}

.estado-ruta {
    color: #f59e0b;
    font-weight: bold;
}

.estado-anulada {
    color: #dc2626;
    font-weight: bold;
}

/* RESPONSIVE */

@media screen and (max-width: 1400px) {
    .content {
        margin-left: 260px;
        padding: 28px;
    }

    h1 {
        font-size: 30px;
    }

    th {
        font-size: 11px;
    }

    td {
        font-size: 10px;
    }

    .chart-container canvas {
        height: 320px !important;
    }
}

/* =========================
   TEMA OSCURO GLOBAL
========================= */

body.dark {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

body.dark .content {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

body.dark .sidebar {
    background: #020617 !important;
}

body.dark .sidebar-header h2,
body.dark .sidebar-header span,
body.dark .menu-sidebar a {
    color: #f8fafc !important;
}

body.dark .sidebar-footer a {
    background: #1e40af !important;
}

body.dark h1,
body.dark h2,
body.dark h3,
body.dark label {
    color: #f8fafc !important;
}

body.dark table {
    background: #1e293b !important;
    color: #ffffff !important;
}

body.dark th {
    background: #020617 !important;
    color: #ffffff !important;
}

body.dark td {
    background: #1e293b !important;
    color: #ffffff !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark tr:hover td {
    background: #334155 !important;
}

body.dark input,
body.dark select,
body.dark textarea {
    background: #334155 !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #cbd5e1 !important;
}

body.dark .chart-container,
body.dark .form-card,
body.dark .detalle-card,
body.dark .factura-box,
body.dark .resumen-reporte,
body.dark .bloque {
    background: #1e293b !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(0,0,0,.35) !important;
}

body.dark .btn,
body.dark button {
    background: #2563eb !important;
    color: #ffffff !important;
}

body.dark .btn:hover,
body.dark button:hover {
    background: #1d4ed8 !important;
}
/* =========================
   CORRECCIÓN GUÍAS EN TEMA OSCURO
========================= */

body.dark .content form label,
body.dark .content form h3,
body.dark .content form h4,
body.dark .content form p,
body.dark .content form span {
    color: #0f172a !important;
}

body.dark .content .form-section label,
body.dark .content .form-section h3,
body.dark .content .form-card label,
body.dark .content .form-card h3,
body.dark .content .importar-box label {
    color: #0f172a !important;
}

body.dark .content form {
    background: transparent !important;
}

body.dark .content input,
body.dark .content textarea,
body.dark .content select {
    background: #334155 !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
}

body.dark .content input::placeholder,
body.dark .content textarea::placeholder {
    color: #cbd5e1 !important;
}
/* =========================
   CORRECCIÓN TEXTO GUÍAS DARK
========================= */

body.dark .content label,
body.dark .content h3,
body.dark .content h4,
body.dark .content p,
body.dark .content span {
    background: transparent !important;
    color: #ffffff !important;
}

body.dark .content legend,
body.dark .content .section-title,
body.dark .content .titulo-seccion {
    background: transparent !important;
    color: #ffffff !important;
}

body.dark .content form {
    background: transparent !important;
}

body.dark .content input,
body.dark .content textarea,
body.dark .content select {
    background: #334155 !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
}

body.dark .content input[type="file"] {
    background: #334155 !important;
    color: #ffffff !important;
}
/* LOGIN */

.login-body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #eaf3ff, #dbeafe);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

.login-box {
    width: 390px;
    background: #ffffff;
    padding: 35px;
    border-radius: 18px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    text-align: center;
}

.logo-login {
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    padding: 8px;
}

.login-box h2 {
    margin: 10px 0 5px;
    color: #0f172a;
    letter-spacing: 2px;
}

.login-box h3 {
    margin-bottom: 25px;
    color: #1e293b;
    font-size: 15px;
}

.login-box input {
    width: 100%;
    margin-bottom: 13px;
    padding: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
}

.login-box button {
    width: 100%;
    padding: 13px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 9px;
    font-weight: bold;
    cursor: pointer;
}

.login-box p {
    margin-top: 20px;
    font-size: 12px;
    color: #64748b;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
}