/* NETVISION - estilos del panel administrativo
   Sistema visual: fondo gris azulado muy claro, superficies blancas con borde fino,
   un solo color de acción (azul), estados en tonos suaves y tipografía Inter. */
:root {
    --nv-dark: #0B1220;
    --nv-dark-2: #111A2E;
    --nv-primary: #2563EB;
    --nv-primary-dark: #1D4ED8;
    --nv-primary-soft: #EEF3FE;
    --nv-cyan: #06B6D4;
    --nv-white: #FFFFFF;
    --nv-light: #F4F6FA;
    --nv-surface-2: #F8FAFC;
    --nv-border: #E5E9F0;
    --nv-border-strong: #D3DAE4;
    --nv-text: #0F172A;
    --nv-text-2: #334155;
    --nv-muted: #64748B;
    --nv-faint: #94A3B8;
    --nv-radius: .625rem;
    --nv-radius-lg: .875rem;
    --nv-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .03);
    --nv-shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --nv-ring: 0 0 0 3px rgba(37, 99, 235, .16);
    --nv-ease: cubic-bezier(.2, .7, .2, 1);
    --nv-sidebar-w: 248px;
    --nv-sidebar-mini: 72px;
    --nv-topbar-h: 64px;
    /* Bootstrap: superficies blancas (tarjetas, campos, modales); el fondo de página va en body */
    --bs-body-bg: #FFFFFF;
    --bs-body-bg-rgb: 255, 255, 255;
    --bs-secondary-bg: #F1F4F8;
    --bs-tertiary-bg: #F8FAFC;
    --bs-primary: #2563EB;
    --bs-primary-rgb: 37, 99, 235;
    --bs-info: #06B6D4;
    --bs-info-rgb: 6, 182, 212;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-font-size: .9rem;
    --bs-body-color: #0F172A;
    --bs-body-color-rgb: 15, 23, 42;
    --bs-secondary-color: #64748B;
    --bs-border-color: #E5E9F0;
    --bs-border-radius: .5rem;
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: .75rem;
    --bs-link-color-rgb: 37, 99, 235;
    --bs-link-hover-color-rgb: 29, 78, 216;
    --bs-emphasis-color-rgb: 15, 23, 42;
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--nv-light); color: var(--nv-text); font-size: .9rem; line-height: 1.55; font-feature-settings: 'cv11', 'ss01'; text-rendering: optimizeLegibility; }
a { text-decoration: none; transition: color .15s ease; }
h1, h2, h3, h4, h5, h6, .h5, .modal-title { letter-spacing: -.015em; color: var(--nv-text); }
.text-muted { color: var(--nv-muted) !important; }
small, .small { font-size: .8125rem; }
::selection { background: rgba(37, 99, 235, .18); }
:focus-visible { outline: none; box-shadow: var(--nv-ring); }

/* ---------- Botones ---------- */
.btn {
    --bs-btn-font-weight: 500; --bs-btn-font-size: .875rem; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .9rem;
    --bs-btn-border-radius: .5rem; --bs-btn-focus-box-shadow: var(--nv-ring);
    display: inline-flex; align-items: center; justify-content: center; gap: 0; line-height: 1.35;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn > .bi { line-height: 1; }
.btn-sm { --bs-btn-font-size: .8125rem; --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .65rem; --bs-btn-border-radius: .45rem; }
/* Botón de la siguiente acción: algo más presente, sin desproporción */
.btn-lg { --bs-btn-font-size: .9375rem; --bs-btn-padding-y: .55rem; --bs-btn-padding-x: 1.15rem; --bs-btn-border-radius: .55rem; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--nv-primary); --bs-btn-border-color: var(--nv-primary); --bs-btn-hover-bg: var(--nv-primary-dark); --bs-btn-hover-border-color: var(--nv-primary-dark); --bs-btn-active-bg: #1E40AF; --bs-btn-active-border-color: #1E40AF; --bs-btn-disabled-bg: var(--nv-primary); --bs-btn-disabled-border-color: var(--nv-primary); box-shadow: 0 1px 2px rgba(37, 99, 235, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-success { --bs-btn-bg: #16A34A; --bs-btn-border-color: #16A34A; --bs-btn-hover-bg: #15803D; --bs-btn-hover-border-color: #15803D; --bs-btn-active-bg: #166534; --bs-btn-active-border-color: #166534; box-shadow: 0 1px 2px rgba(22, 163, 74, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-outline-primary { --bs-btn-color: var(--nv-primary); --bs-btn-border-color: #BFD0FA; --bs-btn-hover-color: var(--nv-primary-dark); --bs-btn-hover-bg: var(--nv-primary-soft); --bs-btn-hover-border-color: #9DB8F7; --bs-btn-active-color: var(--nv-primary-dark); --bs-btn-active-bg: #DCE6FD; --bs-btn-active-border-color: #9DB8F7; }
.btn-outline-success { --bs-btn-color: #15803D; --bs-btn-border-color: #B7E4C7; --bs-btn-hover-color: #166534; --bs-btn-hover-bg: #F0FDF4; --bs-btn-hover-border-color: #86D3A4; --bs-btn-active-color: #166534; --bs-btn-active-bg: #DCFCE7; --bs-btn-active-border-color: #86D3A4; }
.btn-outline-danger { --bs-btn-color: #DC2626; --bs-btn-border-color: #F5C2C2; --bs-btn-hover-color: #B91C1C; --bs-btn-hover-bg: #FEF2F2; --bs-btn-hover-border-color: #EFA3A3; --bs-btn-active-color: #B91C1C; --bs-btn-active-bg: #FEE2E2; --bs-btn-active-border-color: #EFA3A3; }
.btn-outline-secondary { --bs-btn-color: var(--nv-text-2); --bs-btn-border-color: var(--nv-border-strong); --bs-btn-hover-color: var(--nv-text); --bs-btn-hover-bg: var(--nv-surface-2); --bs-btn-hover-border-color: #C2CBD8; --bs-btn-active-color: var(--nv-text); --bs-btn-active-bg: #EEF2F6; --bs-btn-active-border-color: #C2CBD8; }
/* Botón neutro: superficie blanca con borde, para acciones secundarias */
.btn-light { --bs-btn-color: var(--nv-text-2); --bs-btn-bg: #fff; --bs-btn-border-color: var(--nv-border-strong); --bs-btn-hover-color: var(--nv-text); --bs-btn-hover-bg: var(--nv-surface-2); --bs-btn-hover-border-color: #C2CBD8; --bs-btn-active-color: var(--nv-text); --bs-btn-active-bg: #EEF2F6; --bs-btn-active-border-color: #C2CBD8; box-shadow: var(--nv-shadow-sm); }
.btn-info { --bs-btn-color: #fff; --bs-btn-bg: var(--nv-cyan); --bs-btn-border-color: var(--nv-cyan); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0891B2; --bs-btn-hover-border-color: #0891B2; }
.btn-link { --bs-btn-font-weight: 500; }
.btn-close { opacity: .45; transition: opacity .15s ease; }
.btn-close:hover { opacity: .8; }
.bg-primary { background-color: var(--nv-primary) !important; }
.text-primary { color: var(--nv-primary) !important; }
.bg-info { background-color: var(--nv-cyan) !important; }
.text-cyan { color: var(--nv-cyan) !important; }

/* ---------- Estructura ---------- */
.nv-app { display: flex; min-height: 100vh; }
.nv-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--nv-sidebar-w); color: #A9B4C6;
    background: linear-gradient(180deg, var(--nv-dark-2) 0%, var(--nv-dark) 55%);
    border-right: 1px solid rgba(255, 255, 255, .04);
    display: flex; flex-direction: column; transition: width .22s var(--nv-ease), transform .22s var(--nv-ease);
    overflow: hidden;
}
.nv-brand {
    display: flex; align-items: center; gap: .7rem; height: var(--nv-topbar-h);
    padding: 0 1.15rem; color: #fff; font-weight: 700; letter-spacing: .06em; font-size: .975rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06); white-space: nowrap;
}
.nv-brand:hover { color: #fff; }
.nv-brand-icon {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: grid; place-items: center; font-size: 1.05rem;
    background: linear-gradient(135deg, #3B82F6, var(--nv-cyan));
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.nv-brand-logo { width: 34px; height: 34px; flex: 0 0 34px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.nv-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem 1.5rem; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.nv-nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748B; padding: 1rem .75rem .35rem; white-space: nowrap; }
.nv-nav-link {
    position: relative; display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; margin-bottom: 3px;
    color: #A9B4C6; border-radius: .55rem; white-space: nowrap; font-weight: 500; font-size: .875rem;
    transition: background-color .15s ease, color .15s ease;
}
.nv-nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex: 0 0 20px; opacity: .85; }
.nv-nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nv-nav-link.active { background: rgba(59, 130, 246, .16); color: #fff; }
.nv-nav-link.active i { color: #60A5FA; opacity: 1; }
.nv-nav-link.active::before { content: ""; position: absolute; left: -.75rem; top: .5rem; bottom: .5rem; width: 3px; border-radius: 0 3px 3px 0; background: #3B82F6; }
.nv-main { flex: 1; min-width: 0; margin-left: var(--nv-sidebar-w); display: flex; flex-direction: column; transition: margin-left .22s var(--nv-ease); }
.nv-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--nv-topbar-h);
    display: flex; align-items: center; gap: .75rem; padding: 0 1.75rem 0 1.25rem;
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--nv-border);
}
.nv-page-title { display: flex; align-items: center; gap: .45rem; min-width: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; margin: 0; white-space: nowrap; }
.nv-page-title > span { overflow: hidden; text-overflow: ellipsis; }
.nv-crumb { color: var(--nv-muted); font-weight: 500; }
.nv-crumb:hover { color: var(--nv-primary); }
.nv-crumb-sep { color: var(--nv-faint); font-size: .75rem; }
.nv-icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: .5rem; font-size: 1.3rem; color: var(--nv-text-2); border: 0; }
.nv-icon-btn:hover { background: #EEF2F6; color: var(--nv-text); }
.nv-user-btn { display: flex; align-items: center; gap: .6rem; border: 0; padding: .3rem .55rem .3rem .3rem; border-radius: 999px; }
.nv-user-btn:hover, .nv-user-btn.show { background: #EEF2F6; }
.nv-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .875rem; color: #fff; background: linear-gradient(135deg, #3B82F6, var(--nv-cyan)); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--nv-border); }
.nv-content { flex: 1; padding: 1.75rem; width: 100%; max-width: 1600px; animation: nv-in .28s var(--nv-ease); /* sin fill-mode: al terminar no deja contexto de apilamiento (los modales quedarían bajo el fondo) */ }
@keyframes nv-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.nv-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 1.1rem 1.75rem; font-size: .75rem; color: var(--nv-faint); border-top: 1px solid var(--nv-border); }
.nv-footer .text-muted { color: var(--nv-faint) !important; }

/* Sidebar plegado (escritorio) */
.nv-collapsed .nv-sidebar { width: var(--nv-sidebar-mini); }
.nv-collapsed .nv-main { margin-left: var(--nv-sidebar-mini); }
.nv-collapsed .nv-brand-text, .nv-collapsed .nv-nav-link span { display: none; }
.nv-collapsed .nv-nav-section { font-size: 0; padding: .6rem 0; border-top: 1px solid rgba(255, 255, 255, .06); margin: .4rem .5rem 0; }
.nv-collapsed .nv-nav-link { justify-content: center; }
.nv-collapsed .nv-nav-link.active::before { left: -.75rem; }
.nv-backdrop { display: none; }

@media (max-width: 991.98px) {
    .nv-sidebar { transform: translateX(-100%); width: var(--nv-sidebar-w) !important; }
    .nv-main { margin-left: 0 !important; }
    .nv-sidebar-open .nv-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .nv-sidebar-open .nv-backdrop { display: block; position: fixed; inset: 0; background: rgba(11, 18, 32, .45); backdrop-filter: blur(2px); z-index: 1035; }
    .nv-collapsed .nv-brand-text, .nv-collapsed .nv-nav-link span { display: inline; }
    .nv-topbar { padding: 0 1rem 0 .75rem; }
    .nv-crumb, .nv-crumb-sep { display: none; }
    .nv-content { padding: 1rem; }
    .nv-footer { padding: 1rem; }
}

/* ---------- Tarjetas ---------- */
.card { --bs-card-bg: #fff; --bs-card-border-color: var(--nv-border); --bs-card-border-radius: var(--nv-radius-lg); --bs-card-inner-border-radius: calc(var(--nv-radius-lg) - 1px); box-shadow: var(--nv-shadow-sm); }
.card-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; min-height: 3.25rem;
    background: #fff; border-bottom: 1px solid var(--nv-border); padding: .8rem 1.25rem;
    font-weight: 600; font-size: .9375rem; letter-spacing: -.01em;
}
.card-header > .bi:first-child, .card-header > span > .bi:first-child { color: var(--nv-muted); }
.card-header.d-flex.justify-content-between { justify-content: space-between; }
.card-header:has(+ .collapse:not(.show)) { border-bottom-color: transparent; border-radius: var(--nv-radius-lg) !important; }
.card-body { padding: 1.25rem; }
.nv-px { padding-left: 1.25rem; padding-right: 1.25rem; }
.card-footer { background: var(--nv-surface-2); border-top: 1px solid var(--nv-border); padding: .8rem 1.25rem; }

/* Indicadores (Inicio) */
.nv-stat { flex-direction: row; display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem; height: 100%; color: var(--nv-text); transition: box-shadow .2s ease, border-color .2s ease, transform .2s var(--nv-ease); }
a.nv-stat:hover { color: var(--nv-text); border-color: var(--nv-border-strong); box-shadow: var(--nv-shadow-md); transform: translateY(-1px); }
.nv-stat-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 11px; display: grid; place-items: center; font-size: 1.2rem; }
.nv-stat-value { font-size: 1.375rem; font-weight: 700; line-height: 1.2; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nv-stat-label { color: var(--nv-muted); font-size: .8125rem; font-weight: 500; margin-top: .1rem; }
.nv-stat-sub { font-size: .75rem; color: var(--nv-muted); }
.nv-stat > .min-w-0 { min-width: 0; }
/* Celular: icono arriba y cifra completa (dos indicadores por fila) */
@media (max-width: 575.98px) {
    .nv-stat { flex-direction: column; align-items: flex-start; gap: .65rem; padding: 1rem; }
    .nv-stat-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; font-size: 1rem; }
    .nv-stat-value { font-size: 1.125rem; }
    .nv-stat-label { font-size: .75rem; line-height: 1.35; }
}
.nv-bg-blue { background: #EAF1FE; color: var(--nv-primary); }
.nv-bg-cyan { background: #E3F8FC; color: #0891B2; }
.nv-bg-green { background: #E8F8EE; color: #16A34A; }
.nv-bg-amber { background: #FEF5E1; color: #D97706; }
.nv-bg-red { background: #FDEDED; color: #DC2626; }
.nv-bg-slate { background: #EEF2F6; color: #334155; }
.nv-bg-violet { background: #F1EDFE; color: #7C3AED; }

/* Barra de herramientas de cada pantalla */
.nv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.nv-toolbar .nv-toolbar-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 650; font-size: 1.1875rem; letter-spacing: -.02em; margin: 0 auto 0 0; min-width: 0; }
.nv-toolbar-text { margin: 0 auto 0 0; max-width: 62ch; color: var(--nv-muted); font-size: .8125rem; line-height: 1.5; }

/* Pasos del trabajo */
.nv-steps { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.nv-step {
    flex: 1 1 110px; display: flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem .75rem; border-radius: .55rem; font-size: .8125rem; font-weight: 600;
    background: var(--nv-surface-2); color: var(--nv-faint); border: 1px solid var(--nv-border);
}
.nv-step.is-done { background: #F0FDF4; color: #15803D; border-color: #CDEFD9; }
.nv-step.is-current { background: var(--nv-primary); color: #fff; border-color: var(--nv-primary); box-shadow: 0 4px 12px rgba(37, 99, 235, .25); }
/* Celular: pasos en una sola fila; solo el paso actual muestra su nombre */
@media (max-width: 575.98px) {
    .nv-steps { flex-wrap: nowrap; gap: .35rem; }
    .nv-step { flex: 0 0 auto; padding: .5rem .65rem; }
    .nv-step:not(.is-current) .nv-step-name { display: none; }
    .nv-step.is-current { flex: 1 1 auto; }
}

/* Pestañas de filtro */
.nav-pills { --bs-nav-pills-border-radius: .5rem; gap: .25rem; }
.nav-pills .nav-link { color: var(--nv-text-2); font-weight: 500; font-size: .875rem; padding: .42rem .8rem; display: inline-flex; align-items: center; gap: .4rem; transition: background-color .15s ease, color .15s ease; }
.nav-pills .nav-link:hover { background: #EEF2F6; color: var(--nv-text); }
.nav-pills .nav-link.active { background: var(--nv-primary-soft); color: var(--nv-primary-dark); box-shadow: inset 0 0 0 1px #CFDCFB; }
.nav-pills .nav-link .badge { background: #fff !important; color: var(--nv-muted) !important; border: 1px solid var(--nv-border) !important; font-size: .6875rem; padding: .2em .5em; }
.nav-pills .nav-link.active .badge { color: var(--nv-primary-dark) !important; border-color: #CFDCFB !important; }

/* ---------- Tablas ---------- */
.table { --bs-table-bg: transparent; --bs-table-border-color: #EDF0F5; --bs-table-hover-bg: #F7F9FC; --bs-table-striped-bg: var(--nv-surface-2); margin-bottom: 0; font-size: .875rem; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table-sm > :not(caption) > * > * { padding: .5rem .75rem; }
.table > thead th { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nv-muted); font-weight: 600; background: var(--nv-surface-2); border-bottom: 1px solid var(--nv-border); white-space: nowrap; padding-top: .6rem; padding-bottom: .6rem; }
.table > thead th:first-child { border-top-left-radius: .5rem; }
.table > thead th:last-child { border-top-right-radius: .5rem; }
.table > tbody > tr:last-child > * { border-bottom-color: transparent; }
.table > tfoot > tr > * { border-bottom: 0; background: var(--nv-surface-2); }
.table > tfoot > tr:first-child > * { border-top: 1px solid var(--nv-border); }
.table td { vertical-align: middle; }
.table-hover > tbody > tr { transition: background-color .12s ease; }
/* Tablas a ras de la tarjeta: respetar el margen interior de la tarjeta */
.card-body.p-0 .table > :not(caption) > * > *:first-child, .card > .table > :not(caption) > * > *:first-child, .card > .table-responsive > .table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.card-body.p-0 .table > :not(caption) > * > *:last-child, .card > .table > :not(caption) > * > *:last-child, .card > .table-responsive > .table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.card-body.p-0 .table > thead th { border-radius: 0; }
.table-actions { white-space: nowrap; text-align: right; }
.table-actions .btn { padding: .28rem .5rem; }
.table-actions .btn + .btn { margin-left: .25rem; }

/* DataTables */
div.dt-container { font-size: .8125rem; color: var(--nv-muted); }
div.dt-container .dt-search input { min-width: 240px; margin-left: 0 !important; padding-left: 2.1rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") no-repeat .75rem center; }
div.dt-container .dt-length select { margin: 0 .4rem; }
div.dt-container .dt-length label, div.dt-container .dt-info { color: var(--nv-muted); }
div.dt-container .dt-input { border-color: var(--nv-border-strong); border-radius: .5rem; }
div.dt-container .dt-paging .pagination { gap: 3px; margin: 0; }
div.dt-container .dt-paging .page-link { border-radius: .45rem !important; border-color: var(--nv-border); color: var(--nv-text-2); min-width: 32px; text-align: center; padding: .3rem .55rem; font-size: .8125rem; }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--nv-primary); border-color: var(--nv-primary); color: #fff; }
div.dt-container .dt-paging .page-item.disabled .page-link { color: var(--nv-faint); background: #fff; }
div.dt-container > .row:first-child { margin-bottom: .75rem; }
div.dt-container > .row:last-child { margin-top: .75rem; }
table.dataTable > thead > tr > th.dt-orderable-asc:hover, table.dataTable > thead > tr > th.dt-orderable-desc:hover { outline: none; color: var(--nv-text-2); }
table.dataTable thead > tr > th .dt-column-order { opacity: .6; }

/* ---------- Formularios ---------- */
.form-label { font-weight: 500; font-size: .8125rem; color: var(--nv-text-2); margin-bottom: .35rem; }
.form-text { color: var(--nv-muted); font-size: .775rem; }
.form-control, .form-select { font-size: .875rem; padding: .5rem .8rem; border-color: var(--nv-border-strong); border-radius: .5rem; background-color: #fff; color: var(--nv-text); transition: border-color .15s ease, box-shadow .15s ease; }
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { font-size: .8125rem; padding: .32rem .6rem; border-radius: .45rem; }
.form-select-sm { padding-right: 2rem; }
.form-control-lg { font-size: 1rem; }
.form-control::placeholder { color: var(--nv-faint); }
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: #BCC6D3; }
.form-control:focus, .form-select:focus { border-color: var(--nv-primary); box-shadow: var(--nv-ring); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--nv-surface-2); }
.form-check-input { border-color: #BCC6D3; }
.form-check-input:checked { background-color: var(--nv-primary); border-color: var(--nv-primary); }
.form-check-input:focus { box-shadow: var(--nv-ring); }
.input-group-text { font-size: .875rem; background: var(--nv-surface-2); border-color: var(--nv-border-strong); color: var(--nv-muted); }
.input-group > .btn { box-shadow: none; }
.required::after { content: " *"; color: #DC2626; }
.invalid-feedback { font-size: .775rem; }
textarea.form-control { line-height: 1.5; }

/* Modales y menús */
.modal-content { border: 0; border-radius: 1rem; box-shadow: 0 24px 64px rgba(15, 23, 42, .22); }
.modal-header { border-bottom: 1px solid var(--nv-border); padding: 1rem 1.5rem; }
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--nv-border); padding: .9rem 1.5rem; background: var(--nv-surface-2); border-radius: 0 0 1rem 1rem; }
.modal-backdrop.show { opacity: .4; }
.dropdown-menu { --bs-dropdown-font-size: .875rem; --bs-dropdown-link-active-bg: var(--nv-primary-soft); --bs-dropdown-link-active-color: var(--nv-primary-dark); border: 1px solid var(--nv-border); border-radius: .7rem; padding: .35rem; box-shadow: var(--nv-shadow-md) !important; }
.dropdown-item { border-radius: .45rem; padding: .45rem .7rem; }
.dropdown-item:hover { background: #F1F4F8; }
.select2-container--bootstrap-5 .select2-selection { border-color: var(--nv-border-strong); border-radius: .5rem; min-height: calc(1.5em + 1rem + 2px); font-size: .875rem; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection, .select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: var(--nv-primary); box-shadow: var(--nv-ring); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: var(--nv-border); border-radius: .6rem; box-shadow: var(--nv-shadow-md); font-size: .875rem; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--nv-primary-soft); color: var(--nv-primary-dark); }
.select2-container--bootstrap-5.select2-container--open { z-index: 1060; }
.input-group > .select2-container--bootstrap-5 { flex: 1 1 auto; width: 1% !important; }

/* SweetAlert2 */
.swal2-popup { font-family: var(--bs-body-font-family); border-radius: 1rem !important; padding: 1.5rem 1.25rem 1.25rem !important; }
.swal2-title { font-size: 1.25rem !important; font-weight: 600 !important; letter-spacing: -.015em; color: var(--nv-text) !important; }
.swal2-html-container { font-size: .925rem !important; color: var(--nv-text-2) !important; }
.swal2-styled { border-radius: .5rem !important; font-weight: 500 !important; font-size: .875rem !important; padding: .55rem 1.1rem !important; }
.swal2-styled:focus { box-shadow: var(--nv-ring) !important; }
.swal2-cancel { background: #fff !important; color: var(--nv-text-2) !important; border: 1px solid var(--nv-border-strong) !important; }
.swal2-input, .swal2-textarea { font-size: .925rem !important; border-radius: .5rem !important; border-color: var(--nv-border-strong) !important; box-shadow: none !important; }
.swal2-toast { border-radius: .7rem !important; box-shadow: var(--nv-shadow-md) !important; padding: .65rem 1rem !important; }
.swal2-toast .swal2-title { font-size: .875rem !important; font-weight: 500 !important; }

/* ---------- Detalles ---------- */
.badge { --bs-badge-font-weight: 600; --bs-badge-font-size: .7rem; --bs-badge-padding-x: .6em; --bs-badge-padding-y: .35em; --bs-badge-border-radius: 999px; letter-spacing: .01em; vertical-align: middle; }
.alert { border-radius: .7rem; font-size: .875rem; border-width: 1px; }
.alert-info { --bs-alert-bg: #EFF8FF; --bs-alert-border-color: #CFE6FB; --bs-alert-color: #0C4A6E; }
.alert-warning { --bs-alert-bg: #FFFAEB; --bs-alert-border-color: #FCE6B0; --bs-alert-color: #7A4A06; }
.alert-secondary { --bs-alert-bg: var(--nv-surface-2); --bs-alert-border-color: var(--nv-border); --bs-alert-color: var(--nv-text-2); }
.progress { --bs-progress-bg: #EEF2F6; --bs-progress-border-radius: 999px; }
.list-group { --bs-list-group-border-color: #EDF0F5; --bs-list-group-action-hover-bg: #F7F9FC; }
.list-group-item { padding: .85rem 1.25rem; }
hr { border-color: var(--nv-border); opacity: 1; }
.nv-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nv-empty { text-align: center; color: var(--nv-muted); padding: 2.5rem 1rem; font-size: .875rem; }
.nv-empty i { font-size: 1.75rem; display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto .75rem; border-radius: 50%; background: #F1F4F8; color: var(--nv-faint); }
.text-success { color: #15803D !important; }
.text-danger { color: #DC2626 !important; }

/* Línea de tiempo */
.nv-timeline { position: relative; padding-left: 1.75rem; }
.nv-timeline::before { content: ""; position: absolute; left: .55rem; top: .35rem; bottom: .35rem; width: 2px; border-radius: 2px; background: #EDF0F5; }
.nv-timeline-item { position: relative; padding-bottom: 1.25rem; }
.nv-timeline-item:last-child { padding-bottom: 0; }
.nv-timeline-item::before { content: ""; position: absolute; left: -1.45rem; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2.5px solid var(--nv-primary); box-shadow: 0 0 0 3px #fff; }
.nv-timeline-item.is-status::before { border-color: #CBD5E1; }
.nv-timeline img { border-radius: .5rem; border: 1px solid var(--nv-border); transition: transform .2s var(--nv-ease), box-shadow .2s ease; }
.nv-timeline a:hover img { transform: scale(1.02); box-shadow: var(--nv-shadow-md); }

/* Matriz de permisos */
.nv-perm-group { border: 1px solid var(--nv-border); border-radius: .6rem; padding: .75rem 1rem; height: 100%; background: #fff; }
.nv-perm-group h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--nv-muted); }

/* ---------- Login ---------- */
.nv-auth-body { min-height: 100vh; background: radial-gradient(circle at 15% 20%, rgba(6, 182, 212, .2), transparent 40%), radial-gradient(circle at 85% 80%, rgba(37, 99, 235, .3), transparent 45%), var(--nv-dark); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.nv-auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 1.1rem; box-shadow: 0 30px 70px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .04); overflow: hidden; animation: nv-in .35s var(--nv-ease) both; }
.nv-auth-head { padding: 2.25rem 2rem 1.25rem; text-align: center; }
.nv-auth-head h1, .nv-auth-head .h4 { letter-spacing: -.02em; }
.nv-auth-logo { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 1rem; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, #3B82F6, var(--nv-cyan)); box-shadow: 0 8px 20px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.nv-auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 15px; background: #fff; }
.nv-auth-body .nv-auth-form { padding: 0 2rem 2rem; }
.nv-auth-body .input-group-text { background: #fff; }

/* ---------- Portal del cliente ---------- */
.nv-portal { background: var(--nv-light); min-height: 100vh; display: flex; flex-direction: column; }
.nv-portal-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.nv-portal-top { position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--nv-border); }
.nv-portal-top > .nv-portal-wrap { height: var(--nv-topbar-h); }
.nv-portal-brand { display: flex; align-items: center; gap: .6rem; color: var(--nv-text); font-weight: 700; letter-spacing: .04em; }
.nv-portal-brand:hover { color: var(--nv-text); }
.nv-portal-brand .nv-brand-icon { color: #fff; }
.nv-portal-main { flex: 1; padding-top: 1.75rem; padding-bottom: 2rem; animation: nv-in .28s var(--nv-ease); }
/* Línea superior del pie del mismo ancho que el contenido (sin el margen lateral) */
/* Texto #475569 sobre el fondo: contraste ≈ 7:1 (antes #94A3B8, 2,4:1, poco legible al sol) */
.nv-portal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding-top: 1.1rem; padding-bottom: 1.25rem; font-size: .8125rem; color: var(--nv-text-2); line-height: 1.5;
    background: linear-gradient(var(--nv-border), var(--nv-border)) top center / calc(100% - 2.5rem) 1px no-repeat; }
.nv-foot-contacto { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.nv-foot-link { color: var(--nv-text-2); }
.nv-foot-link:hover { color: var(--nv-primary); }
@media (max-width: 575.98px) {
    .nv-portal-foot { flex-direction: column; align-items: stretch; text-align: center; }
    .nv-foot-contacto { flex-direction: column; }
    .nv-foot-contacto .btn { width: 100%; padding-top: .55rem; padding-bottom: .55rem; }
}
@media (min-width: 992px) { .nv-sticky-lg { position: sticky; top: calc(var(--nv-topbar-h) + 1rem); } }
/* Menú del portal: opciones cómodas para el dedo (≥ 40 px) */
.nv-portal-menu { min-width: 230px; }
.nv-portal-menu .dropdown-item { padding: .6rem .8rem; }
/* Pago por QR en el portal */
.nv-pago-qr { scroll-margin-top: calc(var(--nv-topbar-h) + 1rem); border: 1px solid #CFDCFB; background: var(--nv-primary-soft); border-radius: .75rem; padding: .9rem 1rem; }
.nv-qr-img { width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--nv-border); border-radius: .6rem; padding: .4rem; }
.nv-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nv-portal-item { transition: box-shadow .2s ease, border-color .2s ease, transform .2s var(--nv-ease); }
.nv-portal-item:hover { border-color: var(--nv-border-strong); box-shadow: var(--nv-shadow-md); transform: translateY(-1px); }
@media (max-width: 575.98px) { .nv-portal-wrap { padding-left: 1rem; padding-right: 1rem; } .nv-portal-main { padding-top: 1.25rem; } .nv-portal-foot { background-size: calc(100% - 2rem) 1px; } }

/* Configuración: campos insertables y barra de guardar fija al pie */
.nv-chip { display: inline-block; margin: .3rem .3rem 0 0; padding: .12rem .5rem; border: 1px solid #CFDCFB; border-radius: 999px; background: var(--nv-primary-soft); color: var(--nv-primary-dark); font-size: .75rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.5; transition: background-color .15s ease, border-color .15s ease; }
.nv-chip:hover { background: #DCE6FD; border-color: #9DB8F7; }
textarea.nv-autosize { resize: vertical; min-height: 5.5rem; overflow: hidden; }
.nv-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 -1.75rem -1.75rem; padding: .85rem 1.75rem; background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(8px); border-top: 1px solid var(--nv-border); }
@media (max-width: 991.98px) { .nv-savebar { margin: 0 -1rem -1rem; padding: .75rem 1rem; } }

/* Filas que abren una ficha; los archivados se ven atenuados */
tr.nv-fila-link { cursor: pointer; }
tr.nv-archivado > td { color: var(--nv-muted); }
tr.nv-archivado > td:first-child a { color: var(--nv-muted) !important; }

/* Totales de reportes: casillas del mismo ancho */
.nv-totales { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.nv-totales > div { background: var(--nv-surface-2); }

/* ---------- Celular ---------- */
.min-w-0 { min-width: 0; }
@media (max-width: 575.98px) {
    .card-body { padding: 1rem; }
    .card-header { padding: .75rem 1rem; min-height: 3rem; }
    .nv-px { padding-left: 1rem; padding-right: 1rem; }
    .list-group-item { padding: .8rem 1rem; }
    .table > :not(caption) > * > * { padding: .65rem .5rem; }
    .card-body.p-0 .table > :not(caption) > * > *:first-child, .card > .table-responsive > .table > :not(caption) > * > *:first-child { padding-left: 1rem; }
    .card-body.p-0 .table > :not(caption) > * > *:last-child, .card > .table-responsive > .table > :not(caption) > * > *:last-child { padding-right: 1rem; }
    .nv-toolbar { margin-bottom: 1rem; }
    .nv-totales { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .nv-toolbar .nv-toolbar-title { font-size: 1.0625rem; }
    /* Botón principal de cada listado a lo ancho; las pestañas de filtro en una fila deslizable */
    .nv-toolbar > .btn-primary { width: 100%; }
    .nv-toolbar > .nav-pills { order: 2; flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; width: calc(100% + 2rem); margin: 0 -1rem; padding: 0 1rem 2px; }
    .nv-toolbar > .nav-pills::-webkit-scrollbar { display: none; }
    .nav-pills .nav-link { white-space: nowrap; }
    /* Listados: sin "Mostrar N", buscador a todo el ancho */
    div.dt-container .dt-length, div.dt-container .dt-layout-cell:has(> .dt-length) { display: none; }
    div.dt-container .dt-search { text-align: left; width: 100%; }
    div.dt-container .dt-search input { width: 100% !important; min-width: 0; }
    div.dt-container .dt-layout-cell, div.dt-container .row > div { width: 100%; }
    div.dt-container .dt-info { text-align: center; }
    /* Ítems de la cotización: cada fila como tarjeta (producto arriba; unidad, cantidad y precio abajo) */
    .nv-items-edit thead { display: none; }
    .nv-items-edit, .nv-items-edit tbody { display: block; width: 100%; }
    .nv-items-edit tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--nv-border); }
    .nv-items-edit tbody td { display: block; padding: 0 !important; border: 0; }
    .nv-items-edit tbody td:first-child { grid-column: 1 / -1; }
    .nv-items-edit tbody td.it-sub { grid-column: 1 / 3; text-align: left !important; font-weight: 600; }
    .nv-items-edit tbody td.it-del-cell { justify-self: end; align-self: end; }
    .nv-items-edit td[data-label]::before { content: attr(data-label); display: block; margin-bottom: .25rem; font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--nv-muted); }
    .nv-items-edit .form-control-sm { font-size: .875rem; padding: .45rem .6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
    .nv-sidebar, .nv-topbar, .nv-footer, .nv-toolbar .btn, .dt-search, .dt-paging, .dt-length { display: none !important; }
    .nv-main { margin: 0 !important; }
    .nv-content { animation: none; }
    .card { box-shadow: none; border: 0; }
}
