/* =========================================================
   SLyT-DGAAA — UI Refresh
   Diseño: glassmorphism + gradientes + microanimaciones
   ========================================================= */

:root {
    --c-bg-1: #0b1f33;
    --c-bg-2: #102e4d;
    --c-bg-3: #061522;
    --c-accent: #4ea8de;
    --c-accent-2: #38d9a9;
    --c-warn: #ffd166;
    --c-danger: #ef476f;
    --c-text: #e8f2fb;
    --c-muted: #9fb6cc;
    --c-card: rgba(255, 255, 255, 0.98);
    --c-card-border: rgba(255, 255, 255, 0.18);
    --c-shadow: 0 18px 38px rgba(2, 12, 22, 0.32);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { -webkit-tap-highlight-color: transparent; }

body {
    background: linear-gradient(135deg, #f4f8fb 0%, #e3eef9 100%);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
}

.app-body {
    background:
        radial-gradient(circle at 12% 0%, rgba(78, 168, 222, .18) 0, transparent 42%),
        radial-gradient(circle at 90% 8%, rgba(56, 217, 169, .12) 0, transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(17, 56, 90, .55) 0, transparent 55%),
        linear-gradient(160deg, var(--c-bg-3) 0%, var(--c-bg-1) 50%, var(--c-bg-2) 100%);
    background-attachment: fixed;
    color: var(--c-text);
}

/* ===================== SHELL / LAYOUT ===================== */

.app-shell {
    display: grid;
    grid-template-columns: 264px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: linear-gradient(180deg, rgba(4, 18, 30, .92), rgba(8, 32, 50, .88));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid rgba(255, 255, 255, .07);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width .35s var(--ease), transform .35s var(--ease);
    overflow: hidden;
    z-index: 20;
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 6px 4px;
}

.brand-mini {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: #fff;
    background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
    box-shadow: 0 6px 18px rgba(78, 168, 222, .35);
    animation: brandPulse 4s ease-in-out infinite;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    padding: 4px;
    box-shadow: 0 6px 18px rgba(78, 168, 222, .25);
    animation: brandPulse 4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes brandPulse {
    0%, 100% { box-shadow: 0 6px 18px rgba(78, 168, 222, .35); }
    50%      { box-shadow: 0 6px 26px rgba(56, 217, 169, .55); }
}

.brand-title { font-weight: 700; letter-spacing: .4px; font-size: 15px; }
.brand-sub   { font-size: 11px; opacity: .75; letter-spacing: .6px; text-transform: uppercase; }

.sidebar-nav { display: grid; gap: 4px; }

.nav-item2 {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #cfe2f3;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all .25s var(--ease);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-item2::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--c-accent), var(--c-accent-2));
    transform: scaleY(0);
    transform-origin: center;
    transition: transform .25s var(--ease);
    border-radius: 0 3px 3px 0;
}

.nav-item2 i { font-size: 16px; opacity: .85; transition: transform .25s var(--ease); }

.nav-item2:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    transform: translateX(3px);
}

.nav-item2:hover i { transform: scale(1.15); color: var(--c-accent-2); }

.nav-item2.active,
.nav-item2[aria-current="page"] {
    background: linear-gradient(90deg, rgba(78, 168, 222, .22), rgba(78, 168, 222, .04));
    color: #fff;
}

.nav-item2.active::before,
.nav-item2[aria-current="page"]::before {
    transform: scaleY(.7);
}

/* ===================== TOPBAR ===================== */

.app-content-wrap { min-width: 0; }

.app-topbar {
    height: 64px;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    background: rgba(7, 26, 42, .55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}

#sidebarToggle {
    border: 1px solid rgba(255, 255, 255, .15);
    color: #cfe2f3;
    background: rgba(255, 255, 255, .04);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: grid; place-items: center;
    transition: all .25s var(--ease);
}
#sidebarToggle:hover { background: rgba(255,255,255,.12); color: #fff; transform: rotate(90deg); }

.topbar-title {
    font-weight: 700;
    letter-spacing: .35px;
    font-size: 16px;
    flex: 1;
    background: linear-gradient(90deg, #fff, #b6dff5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.topbar-user {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: #cfe2f3;
}

.topbar-user .btn { border-radius: 10px; font-size: 12.5px; padding: 6px 14px; }

/* ===================== MAIN ===================== */

.app-main { padding: 10px; }
.container-fluid.py-3 { color: #12263a; }

/* ===================== CARDS ===================== */

.card-soft {
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-card-border);
    background: var(--c-card);
    box-shadow: var(--c-shadow);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
    overflow: hidden;
}

.card-soft:hover {
    box-shadow: 0 22px 46px rgba(2, 12, 22, 0.38);
}

.card-soft .card-body { padding: 18px 20px; }

/* KPI cards en dashboard */
.col-md-3 > .card-soft {
    position: relative;
    overflow: hidden;
}
.col-md-3 > .card-soft::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(78,168,222,.18), rgba(56,217,169,.12));
    transition: transform .5s var(--ease);
}
.col-md-3 > .card-soft:hover::after { transform: scale(1.25); }
.col-md-3 > .card-soft:hover { transform: translateY(-4px); }

.col-md-3 .display-6 {
    font-weight: 700;
    background: linear-gradient(135deg, #0d3a5c, #1a6f8e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 2rem;
}

.col-md-3 h6.text-muted {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===================== TABLES ===================== */

.table {
    font-size: 12.5px;
    margin-bottom: 0;
}

.table thead th {
    font-size: 11.5px;
    text-transform: none;
    letter-spacing: .2px;
    font-weight: 600;
    color: #4a6781;
    background: linear-gradient(180deg, #f6fbff, #eaf3fb);
    border-bottom: 2px solid #d8e6f2;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
    padding: 12px 14px;
}
.table tbody td { padding: 10px 14px; }

.table tbody td {
    padding: 7px 8px;
    vertical-align: middle;
    border-color: #eef3f8;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #fbfdff;
}

.table tbody tr {
    transition: background .2s var(--ease), transform .2s var(--ease);
}

.table tbody tr:hover {
    background: #eaf4ff !important;
    transform: scale(1.001);
}

.table-responsive {
    max-height: 70vh;
    border-radius: var(--radius-md);
    border: 1px solid #e6eef6;
}

/* badges con sabor */
.badge {
    font-weight: 600;
    letter-spacing: .3px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 10.5px;
}

.status-pill {
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11.5px;
}

/* ===================== BUTTONS ===================== */

.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all .22s var(--ease);
    border-width: 1px;
    letter-spacing: .2px;
}

.btn-sm { font-size: 11.5px; padding: 5px 11px; border-radius: 8px; }

.btn-primary {
    background: linear-gradient(135deg, #1d6fa5 0%, #4ea8de 100%);
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(29, 111, 165, .28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #185f8e 0%, #3b97cc 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(29, 111, 165, .36);
}

.btn-warning {
    background: linear-gradient(135deg, #f2b134, #ffd166);
    border-color: transparent;
    color: #4a3300;
    font-weight: 600;
}
.btn-warning:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(242, 177, 52, .35); color: #2b1f00; }

.btn-danger {
    background: linear-gradient(135deg, #d63b5e, #ef476f);
    border-color: transparent;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(239, 71, 111, .35); }

.btn-info {
    background: linear-gradient(135deg, #0aa6c2, #20c997);
    border-color: transparent;
    color: #fff;
}
.btn-info:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(32, 201, 151, .35); }

.btn-outline-primary {
    color: #1d6fa5;
    border-color: #b8d6ea;
    background: #fff;
}
.btn-outline-primary:hover {
    background: #1d6fa5;
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c7a89;
    border-color: transparent;
}

/* ===================== FORMS ===================== */

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid #d6e1ec;
    font-size: 13px;
    padding: 7px 11px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(78, 168, 222, .18);
}

.form-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    color: #5a6f85;
    margin-bottom: 4px;
}

textarea.form-control { min-height: 80px; }

/* ===================== MODALES ===================== */

.modal-backdrop.show { opacity: .15; }
.modal-backdrop { background-color: #0b1f33; }
/* Evitar acumulación de backdrops si quedan huérfanos */
.modal-backdrop + .modal-backdrop { display: none; }

.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(2, 12, 22, .45);
    background: #fff;
    animation: modalIn .35s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    background: linear-gradient(120deg, #0b3c5d 0%, #1a6f8e 50%, #20c997 130%);
    color: #fff;
    border: 0;
    padding: 14px 22px;
    position: relative;
}

.modal-header .modal-title {
    font-weight: 600;
    letter-spacing: .3px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header .modal-title::before {
    content: "";
    width: 4px;
    height: 22px;
    background: var(--c-accent-2);
    border-radius: 2px;
}

.modal-header .btn-close {
    filter: invert(1) brightness(2);
    opacity: .85;
}

.modal-body {
    padding: 22px;
    background: #f9fbfd;
    max-height: 72vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-thumb { background: #cfdce8; border-radius: 999px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #a8bfd1; }

.modal-footer {
    background: #fff;
    border-top: 1px solid #eef3f8;
    padding: 12px 22px;
}

/* Campos del modal: estilo "field card" */
.modal-body .col-md-4,
.modal-body .col-md-6 {
    position: relative;
}

.modal-body .form-label {
    margin-bottom: 5px;
}

.modal-body .form-control,
.modal-body .form-select {
    background: #fff;
    border: 1px solid #dce6f0;
    transition: all .22s var(--ease);
}

.modal-body .form-control:hover,
.modal-body .form-select:hover {
    border-color: #b8d6ea;
}

/* badge editado */
.field-dirty .form-control,
.field-dirty .form-select {
    border-color: var(--c-warn);
    background: #fffaeb;
}

/* ===================== REVEAL / ANIMACIONES ===================== */

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* stagger entrada de tarjetas en dashboard */
.row.g-3 > [class*="col-"] {
    animation: fadeUp .55s var(--ease) both;
}
.row.g-3 > [class*="col-"]:nth-child(1) { animation-delay: .02s; }
.row.g-3 > [class*="col-"]:nth-child(2) { animation-delay: .07s; }
.row.g-3 > [class*="col-"]:nth-child(3) { animation-delay: .12s; }
.row.g-3 > [class*="col-"]:nth-child(4) { animation-delay: .17s; }
.row.g-3 > [class*="col-"]:nth-child(5) { animation-delay: .22s; }
.row.g-3 > [class*="col-"]:nth-child(6) { animation-delay: .27s; }
.row.g-3 > [class*="col-"]:nth-child(7) { animation-delay: .32s; }
.row.g-3 > [class*="col-"]:nth-child(8) { animation-delay: .37s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================== SIDEBAR COLLAPSED ===================== */

body.sidebar-collapsed .app-shell { grid-template-columns: 78px 1fr; }
body.sidebar-collapsed .app-sidebar .brand-sub,
body.sidebar-collapsed .app-sidebar .brand-title,
body.sidebar-collapsed .app-sidebar .nav-item2 span {
    display: none;
}
body.sidebar-collapsed .app-sidebar .nav-item2 { justify-content: center; padding: 12px; }
body.sidebar-collapsed .sidebar-head { justify-content: center; }

/* ===================== LOGIN (sin tocar) ===================== */

.video-bg-wrap { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.video-bg-wrap video { width: 100%; height: 100%; object-fit: cover; }
.overlay-dark { position: absolute; inset: 0; background: rgba(7, 22, 35, 0.62); }
.login-card { backdrop-filter: blur(8px); background: rgba(255, 255, 255, 0.92); }
.login-shell { min-height: 100vh; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.login-bottom-bar {
    width: min(1400px, 100%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(4, 23, 37, 0.52);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    color: #fff;
    padding: 12px 14px;
}
.login-top-brand { position: fixed; top: 16px; left: 16px; z-index: 4; color: rgba(255, 255, 255, 0.9); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.login-form-inline { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 10px; align-items: end; }
.login-form-inline .form-label { color: rgba(245, 252, 255, 0.95); margin-bottom: 4px; }
.login-form-inline .form-control { background: rgba(255, 255, 255, 0.94); border: 1px solid rgba(255, 255, 255, 0.45); }
.login-error-inline { margin-bottom: 8px; }
.login-note { margin-top: 8px; font-size: 12px; color: rgba(236, 247, 255, 0.82); }

.particles-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    opacity: 0; transition: opacity 900ms ease;
    background:
        radial-gradient(circle at 18% 35%, rgba(255,255,255,.24) 0 2px, transparent 3px),
        radial-gradient(circle at 72% 22%, rgba(255,255,255,.18) 0 2px, transparent 3px),
        radial-gradient(circle at 36% 78%, rgba(255,255,255,.2) 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 88% 66%, rgba(255,255,255,.16) 0 2px, transparent 3px),
        radial-gradient(circle at 58% 58%, rgba(255,255,255,.22) 0 1.5px, transparent 2.5px);
    animation: floatParticles 14s linear infinite;
}
.particles-bg.is-active { opacity: .55; }
@keyframes floatParticles {
    0%   { transform: translateY(0px) scale(1); }
    50%  { transform: translateY(-14px) scale(1.015); }
    100% { transform: translateY(0px) scale(1); }
}

/* ===================== UTILIDADES NUEVAS ===================== */

.row-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.row-actions .btn { padding: 3px 9px; font-size: 11px; border-radius: 7px; }

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
    font-size: 13px;
}

.toolbar-search {
    position: relative;
}
.toolbar-search .bi-search {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: #94a8bd;
    pointer-events: none;
}
.toolbar-search input { padding-left: 34px; }

.pagination-mini { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-mini .btn { min-width: 32px; }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #6b8197;
}
.empty-state i { font-size: 44px; opacity: .35; display: block; margin-bottom: 10px; }

/* Toast notificación */
.app-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1090;
    background: #122b40;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(0,0,0,.3);
    font-size: 13px;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .3s var(--ease), transform .3s var(--ease);
    pointer-events: none;
    border-left: 4px solid var(--c-accent-2);
}
.app-toast.show { opacity: 1; transform: translateY(0); }

/* Loading overlay — solo visible cuando se le agrega .show, nunca bloquea por defecto */
.app-loading {
    position: fixed; inset: 0;
    background: rgba(6, 21, 34, .45);
    z-index: 2000;
    display: none;
    place-items: center;
    pointer-events: none;
}
.app-loading.show {
    display: grid;
    pointer-events: auto;
}
.spinner-ring {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,.18);
    border-top-color: var(--c-accent-2);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================================================================
   FIX MODAL CLICKS — asegurar que el contenido reciba pointer-events
   ================================================================= */
.modal { z-index: 1080; }
.modal-backdrop { z-index: 1070; }
.modal-dialog, .modal-content, .modal-body, .modal-header, .modal-footer {
    pointer-events: auto;
}
.modal-open .app-sidebar,
.modal-open .app-topbar { z-index: 5; }

/* =================================================================
   COLORES POR MÓDULO (kpi + module-scope)
   ================================================================= */

.kpi { transition: all .3s var(--ease); position: relative; overflow: hidden; }
.kpi .card-body {
    position: relative;
    padding: 16px 18px 14px;
}
.kpi .kpi-icon {
    position: absolute;
    top: 14px; right: 14px;
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,.15);
    transition: transform .35s var(--ease);
}
.kpi:hover .kpi-icon { transform: rotate(-8deg) scale(1.08); }
.kpi h6 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin: 4px 0 6px; }
.kpi .display-6 { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.kpi .kpi-foot { color: #7e93a8; font-size: 11.5px; }

/* Personal — violeta */
.kpi-personal { border-top: 4px solid #7c5cff; }
.kpi-personal .kpi-icon { background: linear-gradient(135deg, #7c5cff, #a78bfa); }
.kpi-personal .display-6 { background: linear-gradient(135deg, #5b3df0, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-personal::after { background: linear-gradient(135deg, rgba(124,92,255,.16), rgba(167,139,250,.08)) !important; }

/* Visados — azul */
.kpi-visados { border-top: 4px solid #1d6fa5; }
.kpi-visados .kpi-icon { background: linear-gradient(135deg, #1d6fa5, #4ea8de); }
.kpi-visados .display-6 { background: linear-gradient(135deg, #0d3a5c, #1a6f8e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-visados::after { background: linear-gradient(135deg, rgba(29,111,165,.16), rgba(78,168,222,.08)) !important; }

/* Notas — teal/verde */
.kpi-notas { border-top: 4px solid #0d9488; }
.kpi-notas .kpi-icon { background: linear-gradient(135deg, #0d9488, #38d9a9); }
.kpi-notas .display-6 { background: linear-gradient(135deg, #0d9488, #38d9a9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-notas::after { background: linear-gradient(135deg, rgba(13,148,136,.16), rgba(56,217,169,.08)) !important; }

/* Hoy — naranja/coral */
.kpi-today { border-top: 4px solid #f59e0b; }
.kpi-today .kpi-icon { background: linear-gradient(135deg, #f59e0b, #fb923c); }
.kpi-today .display-6 { background: linear-gradient(135deg, #d97706, #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-today::after { background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(251,146,60,.08)) !important; }

.kpi:hover { transform: translateY(-5px); }

/* Module scope: tinta los headers, badges, modal y barra superior */
.module-scope .card-soft { border-top: 4px solid var(--mod-c1, #1d6fa5); }
.module-scope h1 i { color: var(--mod-c1, #1d6fa5) !important; }
.module-scope .table thead th { background: linear-gradient(180deg, var(--mod-tint, #f6fbff), #fff); color: var(--mod-c1, #4a6781); border-bottom-color: var(--mod-c2, #d8e6f2); }
.module-scope .modal-header { background: linear-gradient(120deg, var(--mod-c1, #0b3c5d) 0%, var(--mod-c2, #1a6f8e) 100%) !important; }
.module-scope .modal-title::before { background: var(--mod-c2, #20c997) !important; }

.module-personal { --mod-c1: #5b3df0; --mod-c2: #a78bfa; --mod-tint: #f3efff; }
.module-visados  { --mod-c1: #1d6fa5; --mod-c2: #4ea8de; --mod-tint: #eaf3fb; }
.module-notas    { --mod-c1: #0d9488; --mod-c2: #38d9a9; --mod-tint: #e6fbf5; }

/* Botones del carrito por fila */
.btn-cart {
    background: #eef4fb;
    color: #1d6fa5;
    border: 1px solid #c7dcee;
}
.btn-cart:hover {
    background: #1d6fa5;
    color: #fff;
    transform: translateY(-1px);
    border-color: transparent;
}
.btn-cart.is-in {
    background: linear-gradient(135deg, #0d9488, #38d9a9);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(13,148,136,.35);
    animation: pulseCart .8s ease;
}
@keyframes pulseCart {
    0%   { transform: scale(.85); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Badge del carrito en sidebar/topbar */
.cart-badge {
    background: linear-gradient(135deg, #ef476f, #f97316);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(239, 71, 111, .45);
}

.topbar-cart {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #cfe2f3;
    text-decoration: none;
    transition: all .25s var(--ease);
    border: 1px solid rgba(255,255,255,.12);
}
.topbar-cart:hover {
    background: rgba(255,255,255,.14);
    color: #fff;
    transform: translateY(-1px);
}
.topbar-cart-count {
    position: absolute;
    top: -6px; right: -6px;
    background: linear-gradient(135deg, #ef476f, #f97316);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(239, 71, 111, .55);
    border: 2px solid #0c2438;
}

/* Empty state ícono más vivo */
.empty-state i {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 1;
}

/* Sidebar — colorear ítems por sección */
.nav-item2[href*="m=personal"] i { color: #a78bfa; }
.nav-item2[href*="m=visados"]  i { color: #4ea8de; }
.nav-item2[href*="m=notas"]    i { color: #38d9a9; }
.nav-item2[href*="reports"]    i { color: #fb923c; }
.nav-item2[href*="remito_lote"] i { color: #f472b6; }
.nav-item2[href*="usuarios"]   i { color: #facc15; }
.nav-item2[href*="auditoria"]  i { color: #f87171; }
.nav-item2[href="dashboard.php"] i { color: #4ea8de; }

/* ===================== RESPONSIVE ===================== */

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        z-index: 30;
        width: 264px;
        transform: translateX(-102%);
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-topbar { position: sticky; }
    .login-shell { align-items: flex-end; padding: 12px; }
    .login-form-inline { grid-template-columns: 1fr; }
    .table { font-size: 11.5px; }
    .modal-body { padding: 16px; }
}

@media print {
    body { background: #fff !important; }
    .no-print { display: none !important; }
    .print-a4 {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 16mm;
        background: #fff;
        font-size: 12pt;
    }
}
