/* ============================================================
   4RENTAL · Sistema de Diseño Compartido
   Paleta: pizarra profunda + ámbar (estilo logística/transporte)
   ============================================================ */

:root {
    --c-brand: #f59e0b;
    --c-brand-2: #f97316;
    --c-sidebar: #0f172a;
    --c-fondo: #f4f6fb;
    --c-borde: #e2e8f0;
    --c-texto: #0f172a;
    --c-texto-suave: #64748b;
    --radio: 14px;
    --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --sombra-hover: 0 4px 8px rgba(15, 23, 42, .08), 0 18px 36px -16px rgba(15, 23, 42, .22);
    --fuente: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html, body { font-family: var(--fuente); }

body.app-body {
    background: var(--c-fondo);
    color: var(--c-texto);
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 264px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0f172a 0%, #111c33 55%, #16233f 100%);
    color: #cbd5e1;
    transform: translateX(-100%);
    transition: transform .28s ease;
}

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

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

@media (min-width: 992px) {
    .sidebar { transform: translateX(0); }
    .app-main { margin-left: 264px; }
}

.brand {
    display: flex;
    gap: .8rem;
    align-items: center;
    padding: 1.35rem 1.3rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-icono {
    width: 46px; height: 46px;
    flex: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2));
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 8px 18px -6px rgba(249, 115, 22, .55);
}

.brand-logo {
    width: 46px; height: 46px;
    flex: none;
    border-radius: 14px;
    box-shadow: 0 8px 18px -6px rgba(249, 115, 22, .55);
}

.brand-nombre { font-weight: 800; color: #fff; font-size: 1.15rem; letter-spacing: .03em; line-height: 1.1; }
.brand-sub { font-size: .64rem; color: #94a3b8; letter-spacing: .16em; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .9rem .85rem 1.2rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 6px; }

.sidebar-seccion {
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: #64748b;
    font-weight: 800;
    margin: 1.05rem .5rem .4rem;
}

.sidebar-nav a.nav-enlace {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .62rem .8rem;
    border-radius: 11px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    font-size: .89rem;
    margin-bottom: .2rem;
    position: relative;
    transition: background .15s, color .15s;
}

.sidebar-nav a.nav-enlace i { width: 20px; text-align: center; font-size: .95rem; color: #94a3b8; transition: color .15s; }
.sidebar-nav a.nav-enlace:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.sidebar-nav a.nav-enlace.activo {
    background: linear-gradient(90deg, rgba(245, 158, 11, .22), rgba(245, 158, 11, .04));
    color: #fff;
}

.sidebar-nav a.nav-enlace.activo::before {
    content: "";
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 3px;
    background: var(--c-brand);
}

.sidebar-nav a.nav-enlace.activo i { color: var(--c-brand); }

.sidebar-pie {
    padding: .9rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .68rem;
    color: #64748b;
}

/* ---------- Estructura principal ---------- */
.app-main { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--c-borde);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-titulo h1 { font-size: 1.02rem; font-weight: 800; margin: 0; }
.topbar-titulo p { margin: 0; font-size: .72rem; color: var(--c-texto-suave); }

.topbar-usuario { margin-left: auto; display: flex; align-items: center; gap: .75rem; }

.usuario-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #f8fafc;
    border: 1px solid var(--c-borde);
    border-radius: 999px;
    padding: .28rem 1rem .28rem .35rem;
}

.usuario-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: .76rem;
    flex: none;
}

.usuario-chip .nombre { font-weight: 700; font-size: .8rem; line-height: 1.15; color: var(--c-texto); }
.usuario-chip .rol { font-size: .67rem; color: var(--c-texto-suave); }

.app-contenido { padding: 1.6rem 1.5rem 2.6rem; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }

.cabecera-pagina { margin-bottom: 1.4rem; }
.titulo-vista { font-weight: 800; font-size: 1.5rem; margin: 0; letter-spacing: -.01em; }
.subtitulo-vista { color: var(--c-texto-suave); font-size: .86rem; margin: .2rem 0 0; }

/* ---------- Tarjetas ---------- */
.tarjeta {
    background: #fff;
    border: 1px solid var(--c-borde);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
}

.tarjeta-cabecera {
    padding: 1rem 1.3rem;
    border-bottom: 1px solid var(--c-borde);
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.tarjeta-cabecera h5, .tarjeta-cabecera h6 { margin: 0; font-weight: 800; font-size: .98rem; }

/* ---------- Tarjetas de estadísticas ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; }

.stat-card {
    background: #fff;
    border: 1px solid var(--c-borde);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.05rem 1.2rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

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

.stat-icono {
    width: 48px; height: 48px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.12rem;
    color: #fff;
    flex: none;
    box-shadow: 0 8px 16px -8px rgba(15, 23, 42, .35);
}

.grad-ambar { background: linear-gradient(135deg, #f59e0b, #f97316); }
.grad-azul { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.grad-verde { background: linear-gradient(135deg, #10b981, #059669); }
.grad-rojo { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.grad-slate { background: linear-gradient(135deg, #64748b, #475569); }

.stat-info .valor { font-size: 1.42rem; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.stat-info .etiqueta { font-size: .73rem; color: var(--c-texto-suave); font-weight: 700; }

.etiqueta-resumen { font-size: .66rem; font-weight: 800; color: var(--c-texto-suave); letter-spacing: .05em; }

/* ---------- Botones ---------- */
.btn { border-radius: 10px; font-weight: 600; }

.btn-brand {
    background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2));
    border: 0;
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(249, 115, 22, .75);
}

.btn-brand:hover, .btn-brand:focus {
    color: #fff;
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(249, 115, 22, .8);
}

.btn-icono {
    width: 34px; height: 34px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 10px;
    padding: 0;
}

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; border-radius: 0 0 var(--radio) var(--radio); }

table.tabla { margin: 0; width: 100%; }

.tabla thead th {
    background: #f8fafc;
    color: #5b6b81;
    font-size: .67rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--c-borde);
    padding: .72rem 1rem;
    white-space: nowrap;
}

.tabla tbody td {
    padding: .82rem 1rem;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    font-size: .86rem;
}

.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #f8fafc; }
.tabla .celda-id { font-weight: 800; color: var(--c-texto); white-space: nowrap; }
.tabla .acciones { white-space: nowrap; text-align: right; }

/* ---------- Badges suaves ---------- */
.badge-suave {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    font-weight: 700;
    padding: .42em .8em;
    border-radius: 999px;
    font-size: .68rem;
    letter-spacing: .02em;
}

.suave-exito { background: #dcfce7; color: #15803d; }
.suave-alerta { background: #fef3c7; color: #b45309; }
.suave-peligro { background: #ffe4e6; color: #be123c; }
.suave-neutral { background: #e2e8f0; color: #475569; }
.suave-info { background: #e0e7ff; color: #4338ca; }
.suave-ambar { background: #fef3c7; color: #92400e; }

/* ---------- Chips de documentos ---------- */
.doc-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .66rem;
    font-weight: 800;
    padding: .3em .6em;
    border-radius: 8px;
    text-decoration: none;
    margin: .12rem .15rem .12rem 0;
    letter-spacing: .03em;
}

.doc-ok { background: #dcfce7; color: #15803d; }
.doc-ok:hover { background: #bbf7d0; color: #14532d; }
.doc-falta { background: #ffe4e6; color: #be123c; }

/* ---------- Chips de fechas de vencimiento ---------- */
.fecha-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .68rem;
    font-weight: 700;
    padding: .32em .6em;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    margin-bottom: .15rem;
}

.fecha-vencida { background: #ffe4e6; color: #be123c; }
.fecha-proxima { background: #fef3c7; color: #b45309; }

/* ---------- Formularios ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #cbd5e1; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--c-brand); box-shadow: 0 0 0 .22rem rgba(245, 158, 11, .18); }
.form-label { font-weight: 700; font-size: .78rem; color: #475569; }

.buscador { position: relative; }
.buscador i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .82rem; pointer-events: none; }
.buscador input { padding-left: 2.4rem; }

/* ---------- Modales ---------- */
.modal-content { border-radius: 18px; border: 0; box-shadow: 0 24px 64px -16px rgba(15, 23, 42, .4); }
.modal-header { border-bottom: 1px solid var(--c-borde); padding: 1.05rem 1.4rem; align-items: center; }
.modal-header .modal-title { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: .65rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--c-borde); }

.modal-icono {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: .95rem;
    color: #fff;
    flex: none;
}

.seccion-formulario {
    font-weight: 800;
    font-size: .8rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px dashed var(--c-borde);
}

.seccion-formulario i { color: var(--c-brand); }

/* ---------- Toasts ---------- */
#contenedorToasts {
    position: fixed;
    top: 1rem; right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: 360px;
}

.toast-app {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--c-borde);
    border-left: 4px solid #94a3b8;
    border-radius: 12px;
    padding: .8rem .9rem;
    box-shadow: var(--sombra-hover);
    animation: toastEntra .3s ease;
    min-width: 280px;
}

.toast-app-exito { border-left-color: #10b981; }
.toast-app-peligro { border-left-color: #f43f5e; }
.toast-app-alerta { border-left-color: #f59e0b; }
.toast-app-info { border-left-color: #3b82f6; }

.toast-app-icono { font-size: 1.05rem; line-height: 1.2; }
.toast-app-titulo { font-weight: 800; font-size: .8rem; }
.toast-app-msg { font-size: .78rem; color: var(--c-texto-suave); }
.toast-app-close { border: 0; background: transparent; font-size: 1rem; color: #94a3b8; margin-left: auto; padding: 0; cursor: pointer; }

.toast-app.saliendo { opacity: 0; transform: translateX(14px); transition: all .3s; }

@keyframes toastEntra { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Estados vacíos ---------- */
.vacio { padding: 3rem 1rem; text-align: center; color: var(--c-texto-suave); }
.vacio .icono {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: #94a3b8;
    margin-bottom: .8rem;
}
.vacio .titulo { font-weight: 800; color: #334155; font-size: .95rem; }
.vacio .pista { font-size: .8rem; }

/* ---------- Login ---------- */
.login-pagina { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }

.login-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1100px 550px at -10% -10%, rgba(245, 158, 11, .28), transparent 60%),
        radial-gradient(800px 400px at 110% 110%, rgba(59, 130, 246, .18), transparent 55%),
        linear-gradient(160deg, #0f172a, #16233f 60%, #1e293b);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3.5rem;
}

.login-hero .marca { display: flex; align-items: center; gap: .8rem; margin-bottom: 2.2rem; }
.login-hero h1 { font-weight: 800; font-size: 2.35rem; color: #fff; line-height: 1.16; letter-spacing: -.02em; }
.login-hero .resaltado { color: var(--c-brand); }
.login-hero p.lead { color: #94a3b8; font-size: .98rem; margin-top: .9rem; }

.login-hero ul { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .85rem; }
.login-hero li { display: flex; gap: .7rem; align-items: center; font-size: .92rem; }
.login-hero li i { color: #34d399; width: 18px; text-align: center; }

.login-hero .marca-agua {
    position: absolute;
    right: -3rem;
    bottom: -4.5rem;
    font-size: 15rem;
    color: rgba(255, 255, 255, .045);
    transform: rotate(-12deg);
    pointer-events: none;
}

.login-formulario { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--c-fondo); }
.login-caja { width: 100%; max-width: 430px; }

.login-logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--c-brand), var(--c-brand-2));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1.1rem;
    box-shadow: 0 12px 26px -10px rgba(249, 115, 22, .7);
}

.login-pie { text-align: center; font-size: .72rem; color: #94a3b8; margin-top: 1.4rem; }

/* Botón público de acceso al catálogo (pantalla de login) */
.btn-catalogo {
    background: #fff;
    border: 2px solid var(--c-brand);
    color: #0f172a;
    border-radius: 12px;
    font-size: .95rem;
    box-shadow: 0 8px 18px -10px rgba(249, 115, 22, .65);
    transition: background .15s, color .15s, transform .15s;
}

.btn-catalogo:hover {
    background: var(--c-brand);
    color: #fff;
    transform: translateY(-1px);
}

@media (max-width: 991px) {
    .login-pagina { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

/* ---------- Responsivo general ---------- */
@media (max-width: 575px) {
    .app-contenido { padding: 1.1rem 1rem 2rem; }
    .titulo-vista { font-size: 1.22rem; }
    .topbar { padding: .7rem 1rem; }
}
