:root {
    --erp-azul: #16233a;
    --erp-azul-2: #1f3152;
    --erp-rojo: #c8372d;
    --erp-fondo: #f3f5f8;
}
body { background: var(--erp-fondo); font-size: .95rem; }
.bg-erp { background: var(--erp-azul) !important; }
.sidebar { width: 250px; min-height: 100vh; }
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; }
}
.sidebar .logo { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.sidebar .nav-link { color: rgba(255,255,255,.8); padding: .45rem .75rem; border-radius: .5rem; }
.sidebar .nav-link i { width: 1.4rem; display: inline-block; }
.sidebar .nav-link:hover { background: var(--erp-azul-2); color: #fff; }
.sidebar .nav-link.active { background: var(--erp-rojo); color: #fff; }
.sidebar .seccion { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); margin: .9rem .75rem .2rem; }
.sidebar .usuario { border-top: 1px solid rgba(255,255,255,.15); }
.contenido { min-width: 0; }
.card { border: 0; box-shadow: 0 1px 3px rgba(22,35,58,.08); }
.card-header { background: #fff; font-weight: 600; }
.kpi .valor { font-size: 1.6rem; font-weight: 700; }
.kpi .icono { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #5b6576; }
.btn-erp { background: var(--erp-rojo); color: #fff; }
.btn-erp:hover { background: #a92c24; color: #fff; }
.login-fondo { min-height: 100vh; background: linear-gradient(135deg, var(--erp-azul), #2c4470); }

/* Documentos imprimibles (comprobantes, recibos, órdenes) */
.hoja { background: #fff; max-width: 820px; margin: 1.5rem auto; padding: 2rem; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.hoja + .hoja { margin-top: 1rem; }
.firma { border-top: 1px solid #333; margin-top: 3.5rem; padding-top: .3rem; text-align: center; font-size: .85rem; }
@media print {
    .no-imprimir { display: none !important; }
    body { background: #fff; }
    .hoja { box-shadow: none; margin: 0 auto; padding: 0; page-break-after: always; }
    .hoja:last-child { page-break-after: auto; }
}

/* Montos en una sola línea */
.kpi .valor { white-space: nowrap; font-size: clamp(1.15rem, 1.7vw, 1.6rem); }
.table td.text-end, .table th.text-end { white-space: nowrap; }

/* Logo en impresión: conservar colores */
.hoja img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Celular: tarjetas de indicadores sin ícono para que quepa el monto */
@media (max-width: 575.98px) {
    .kpi .icono { display: none; }
    .kpi .valor { font-size: 1.1rem; }
}

/* Fotos de perfil */
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; flex-shrink: 0; }
.avatar-iniciales { background: var(--erp-rojo); color: #fff; font-weight: 600; font-size: .85rem; }
.avatar-xl { width: 110px; height: 110px; font-size: 2rem; }

/* Tablas que en celular se muestran como tarjetas apiladas (formularios con filas y listas largas).
   Cada celda indica su título con data-label. */
@media (max-width: 575.98px) {
    .tabla-apilable { min-width: 0 !important; }
    .tabla-apilable thead { display: none; }
    .tabla-apilable, .tabla-apilable tbody, .tabla-apilable tr, .tabla-apilable td { display: block; width: 100% !important; }
    .tabla-apilable tbody tr { border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .5rem .75rem; margin: .5rem; width: auto !important; background: #fff; }
    .tabla-apilable tbody td { border: 0; padding: .2rem 0; text-align: left !important; white-space: normal !important; }
    .tabla-apilable td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); }
    .tabla-apilable tfoot, .tabla-apilable tfoot tr { display: flex; justify-content: space-between; width: 100%; }
    .tabla-apilable tfoot th { border: 0; }
    .tabla-apilable td.acciones-fila { text-align: right !important; }
    .tabla-apilable .numero:not(:empty)::before { content: 'Vehículo '; }
}

/* Celular: botones de acciones del encabezado a lo ancho y textos largos que no desbordan */
@media (max-width: 575.98px) {
    .contenido h1 { font-size: 1.15rem; }
    .card-header { overflow-wrap: anywhere; }
    .contenido .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
}

/* Buscador de listas (código o nombre) */
.buscador-lista { position: absolute; top: 100%; left: 0; right: 0; z-index: 1060; max-height: 280px; overflow-y: auto; margin-top: 2px; }
.buscador-lista .list-group-item { white-space: normal; text-align: left; }
.buscador input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
.table-responsive:has(.buscador) { overflow: visible; }
.lista-recibos { max-height: 60vh; overflow-y: auto; }

/* Ayuda en línea */
.ayuda-panel { width: 420px; max-width: 100vw; }
.ayuda-nota { background: #fff8e6; border-left: 3px solid #e0a800; padding: .4rem .6rem; border-radius: .25rem; }
.ayuda-img { max-height: 420px; object-fit: contain; background: #fff; }
.ayuda-tema { transition: box-shadow .15s; }
.ayuda-tema:hover { box-shadow: 0 3px 10px rgba(22,35,58,.15); }
.ayuda-seccion ol li::marker { font-weight: 600; color: var(--erp-rojo); }
@media print { .btn-ayuda, .ayuda-panel { display: none !important; } }
