/* =========================================
   SISTEMA ADUANAL 2.0 — STYLESHEET
   Paleta: blancos, grises, sombras flotantes
========================================= */
:root {
    --bg-main:           #f4f6f8;
    --bg-card:           #ffffff;
    --bg-white:          #ffffff;
    --text-dark:         #2b3035;
    --text-muted:        #879097;
    --text-light:        #ffffff;
    --border-radius:     24px;
    --radius-sm:         12px;
    --radius-md:         16px;
    --shadow-float:      0 20px 40px rgba(0, 0, 0, 0.08);
    --shadow-sm:         0 4px 12px rgba(0, 0, 0, 0.05);
    --transition-smooth: all 0.3s ease;
    --sidebar-width:     280px;
    --navbar-height:     68px;
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    color: var(--text-dark);
    background-color: var(--bg-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ──────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-main);
}

.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── SIDEBAR FLOTANTE (BLANCO) ───────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    padding: 1.25rem;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-float);
    overflow: visible; /* permite flyouts en rail */
    padding: 1.5rem 1rem;
}

/* Header sticky: brand + sede + search no se desplazan al scrollear */
.sidebar-header-sticky {
    flex-shrink: 0;
    background: var(--bg-white);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding-bottom: .5rem;
}

/* Brand */
.sidebar-brand-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0.5rem 1rem;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
    width: 100%;
    position: relative;
}
.sidebar-brand-container img.brand-logo-img {
    max-width: calc(100% - 40px);
    height: auto;
    flex: 1;
}

/* Botón rail toggle (chevron en el brand) */
.sidebar-rail-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #eef0f3;
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}
.sidebar-rail-toggle:hover { background: #f4f6f8; color: var(--text-dark); }
body.sidebar-rail .sidebar-rail-toggle i { transform: rotate(180deg); }

/* Search inline */
.sidebar-search-wrap {
    position: relative;
    padding: .5rem .25rem 0;
}
.sidebar-search-icon {
    position: absolute;
    top: 50%; left: 18px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .85rem;
    pointer-events: none;
    z-index: 1;
}
.sidebar-search-input {
    width: 100%;
    border: 1px solid #eef0f3;
    background: #fafbfd;
    border-radius: 10px;
    padding: 8px 34px 8px 38px;
    font-size: .82rem;
    color: var(--text-dark);
    transition: var(--transition-smooth);
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
    height: 38px;
}
.sidebar-search-input:focus {
    outline: none;
    border-color: var(--text-dark);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43, 48, 53, .06);
}
.sidebar-search-input::-webkit-search-cancel-button { display: none; }
.sidebar-search-clear {
    position: absolute;
    top: 50%; right: 12px;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    border: none;
    background: #eef0f3;
    color: var(--text-muted);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .65rem;
    padding: 0;
}
.sidebar-search-clear:hover { background: #dde0e4; color: var(--text-dark); }

.sidebar-search-empty {
    display: none;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .78rem;
}
.sidebar-search-empty i { font-size: 1.6rem; }

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--text-dark);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-dark);
    letter-spacing: -0.3px;
    display: block;
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
}

/* Sede */
.sidebar-sede {
    padding: 0.75rem 0.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: #e9ecef transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #e9ecef;
    border-radius: 4px;
}

/* Sección colapsable (acordeón exclusivo controlado por JS) */
.nav-section { margin-bottom: 5px; }
.nav-section.sidebar-hidden { display: none !important; }
.nav-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    min-height: 40px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}
.nav-section-toggle:hover { background: #f8f9fa; }

/* Body del acordeón — controlado por clase .is-open desde JS */
.nav-section-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.nav-section-body.is-open {
    max-height: 2000px; /* suficiente para contener cualquier sub-lista */
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.nav-section-arrow {
    font-size: 0.65rem;
    color: #ced4da;
    transition: transform 0.25s ease;
}

.nav-section-toggle:not(.collapsed) .nav-section-arrow {
    transform: rotate(180deg);
}

/* Links */
.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 2px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.nav-link-custom.sidebar-hidden { display: none !important; }

.nav-link-custom:hover {
    background-color: #f8f9fa;
    color: var(--text-dark);
    transform: translateX(2px);
}

.nav-link-custom.active {
    background-color: var(--text-dark);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(43, 48, 53, 0.18);
    font-weight: 600;
}

.nav-link-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-icon {
    font-size: 1rem;
    width: 18px;
    flex-shrink: 0;
    text-align: center;
}

/* ── Submenús (segundo nivel) ─────────────────────────────── */
.nav-parent { margin-bottom: 2px; }
.nav-parent.sidebar-hidden { display: none !important; }
.nav-parent-toggle .nav-parent-arrow {
    font-size: .6rem;
    color: #ced4da;
    transition: transform .2s ease;
    margin-left: auto;
}
.nav-parent.is-open .nav-parent-arrow { transform: rotate(180deg); }

.nav-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
    padding-left: 10px;
    margin-left: 12px;
    border-left: 1px solid #eef0f3;
}
.nav-submenu.is-open { max-height: 1000px; }
.nav-link-sub {
    font-size: .82rem;
    padding: 0.45rem 0.75rem;
}

/* Footer sidebar */
.sidebar-bottom {
    padding: 1rem 0.5rem 0;
    border-top: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.user-mini { display: flex; align-items: center; gap: 10px; }

.user-mini-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-mini-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.user-mini-role {
    display: block;
    font-size: 0.67rem;
    color: var(--text-muted);
}

.btn-logout {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-logout:hover {
    background: #fff0f0;
    color: #dc3545;
}

/* Overlay móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

/* ── NAVBAR SUPERIOR ─────────────────────── */
.top-navbar {
    height: var(--navbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.navbar-left { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f4f6f8;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.sidebar-toggle:hover {
    background: #e9ecef;
    color: var(--text-dark);
    transform: scale(1.05);
}

.page-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    text-transform: capitalize;
}

.navbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* Tasa BCV */
.tasa-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-main);
    border: 1px solid #e9ecef;
    border-radius: 50px;
    text-decoration: none;
    transition: var(--transition-smooth);
    font-size: 0.8rem;
}

.tasa-badge:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.tasa-badge i { color: var(--text-dark); font-size: 0.85rem; }
.tasa-label { font-weight: 700; color: var(--text-muted); }
.tasa-valor {
    font-weight: 700;
    color: var(--text-dark);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* User pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid #e9ecef;
    border-radius: 50px;
    padding: 4px 14px 4px 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.user-pill:hover, .user-pill.show {
    background: #e9ecef;
    box-shadow: var(--shadow-sm);
}

.user-pill::after { display: none !important; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--text-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-pill-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.user-pill-sede {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ── CONTENT BODY ────────────────────────── */
.content-body {
    flex: 1;
    padding: 2rem 2.5rem;
    animation: fadeIn 0.35s ease-out;
}

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

/* ══════════════════════════════════════════════════════
   ESTRUCTURA DEL MENÚ — Drag-and-drop con submenús
   ══════════════════════════════════════════════════════ */

.draggable-mod {
    background: #fff;
    transition: box-shadow .15s ease;
}
.draggable-mod.is-sub {
    background: #f8fafc;
    border-left: 3px solid #cfd8dc !important;
    border-radius: 0 8px 8px 0 !important;
    margin-left: 4px;
}
.draggable-mod.has-children {
    border-left: 3px solid var(--text-dark) !important;
    border-radius: 0 12px 12px 0 !important;
}
.draggable-mod .mod-row { cursor: default; }
.draggable-mod .handle { cursor: grab; }
.draggable-mod .handle:active { cursor: grabbing; }

/* Sublist wrapper — siempre visible como drop target */
.mod-sublist-wrap {
    padding: 0 .75rem .5rem;
    border-top: 1px dashed #e9ecef;
    margin-top: 4px;
}
.mod-sublist-label {
    display: flex;
    align-items: center;
    padding: 6px 4px 4px;
    font-size: .65rem;
    font-weight: 700;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.mod-sublist {
    min-height: 36px;
    padding: 4px;
    border: 1px dashed #e3e6e9;
    border-radius: 8px;
    background: #fbfcfd;
    transition: background .2s ease, border-color .2s ease;
}
.mod-sublist:empty::before {
    content: 'Suelta aquí para anidar como submenú';
    display: block;
    text-align: center;
    color: #c2c8cd;
    font-size: .7rem;
    padding: 8px 4px;
    font-style: italic;
}
/* Highlight cuando SortableJS está mostrando que se puede soltar */
.mod-sublist.sortable-drag-over,
.mod-sublist:has(.sortable-ghost) {
    background: #f0f7ff;
    border-color: #6ea8fe;
    border-style: solid;
}

/* Ghost (placeholder mientras arrastras) */
.sortable-ghost {
    opacity: .35;
    background: #eef5ff !important;
    border: 1px dashed #6ea8fe !important;
}

/* ── FOOTER ──────────────────────────────── */
.app-footer {
    padding: 1rem 2.5rem;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── SIDEBAR OCULTO TOTAL (DESKTOP) — botón del navbar ────── */
body.sidebar-hidden .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width) - 1rem));
}
body.sidebar-hidden .main-content {
    margin-left: 0;
}

/* ── SIDEBAR RAIL MODE (DESKTOP) — solo iconos ~80px ─────── */
:root {
    --sidebar-rail-width: 88px;
}
body.sidebar-rail .sidebar {
    width: var(--sidebar-rail-width);
    padding: 1rem .5rem;
}
body.sidebar-rail .main-content {
    margin-left: var(--sidebar-rail-width);
    transition: margin-left .3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* En rail: ocultar labels, badges, search, sede; mantener solo iconos */
body.sidebar-rail .sidebar-inner {
    padding: 1rem .5rem;
    border-radius: 18px;
    overflow: visible;
}
body.sidebar-rail .sidebar-header-sticky {
    padding-bottom: .25rem;
}
body.sidebar-rail .sidebar-sede,
body.sidebar-rail .sidebar-search-wrap,
body.sidebar-rail .nav-section-toggle,
body.sidebar-rail .nav-link-label,
body.sidebar-rail .nav-parent-arrow,
body.sidebar-rail .sidebar-badge-alerta,
body.sidebar-rail .user-mini-info {
    display: none !important;
}
body.sidebar-rail .sidebar-brand-container {
    padding: 0 0 .5rem;
    justify-content: center;
    border-bottom: 1px solid #f0f2f5;
    flex-direction: column;
    gap: 0;
}
body.sidebar-rail .sidebar-brand-container img.brand-logo-img { display: none; }
body.sidebar-rail .sidebar-rail-toggle {
    margin: 0 auto;
}

/* Separadores visuales entre secciones (que ya no se ven con label) */
body.sidebar-rail .nav-section {
    margin-bottom: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #f4f6f8;
}
body.sidebar-rail .nav-section:last-child { border-bottom: none; }
body.sidebar-rail .nav-section-body {
    max-height: none;
    overflow: visible;
    padding-top: 4px;
}

/* Iconos centrados, cuadrados (44×44) — visibles y legibles */
body.sidebar-rail .nav-link-custom {
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 44px;
    margin: 4px auto;
    border-radius: 10px;
    gap: 0;
    position: relative;
}
body.sidebar-rail .nav-link-custom:hover { transform: none; }
body.sidebar-rail .nav-link-custom .nav-icon {
    font-size: 1.15rem;
    width: 44px;
    height: 44px;
    line-height: 44px;
    text-align: center;
    margin: 0;
}
body.sidebar-rail .nav-link-custom.active {
    box-shadow: 0 4px 12px rgba(43, 48, 53, 0.22);
}

/* Submenús en rail: hijos apilados verticalmente, sin línea ni indent */
body.sidebar-rail .nav-submenu {
    max-height: none;
    padding-left: 0;
    margin-left: 0;
    border-left: none;
    overflow: visible;
}
body.sidebar-rail .nav-link-sub {
    width: 36px;
    height: 36px;
    margin: 2px auto;
}
body.sidebar-rail .nav-link-sub .nav-icon {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 1rem;
}

/* Footer */
body.sidebar-rail .sidebar-bottom {
    padding: .75rem 0 0;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid #f0f2f5;
}
body.sidebar-rail .user-mini { gap: 0; justify-content: center; }
body.sidebar-rail .btn-logout {
    margin: 0 auto;
    width: 36px;
    height: 36px;
}

/* ── Flyout "banda" al pasar el mouse en modo rail ────────────
   La banda NO puede ser un pseudo-elemento del link: el contenedor
   de scroll del sidebar (overflow-y:auto) recorta cualquier cosa
   que sobresalga. Por eso es un elemento propio anclado al <body>
   (position:fixed) que JS posiciona sobre el icono al hacer hover.
   Ver initRailFlyout() en main.js. */
body.sidebar-rail .nav-link-custom {
    overflow: visible;
}

.sidebar-rail-flyout {
    position: fixed;
    display: flex;
    align-items: center;
    background: var(--text-dark);
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .30);
    white-space: nowrap;
    z-index: 4000;
    pointer-events: none;
    /* Revelado de izquierda a derecha vía clip-path */
    clip-path: inset(0 100% 0 0 round 10px);
    opacity: 0;
    transition: clip-path .26s cubic-bezier(.4, 0, .2, 1),
                opacity .15s ease;
}
.sidebar-rail-flyout.is-visible {
    clip-path: inset(0 0 0 0 round 10px);
    opacity: 1;
}
/* El icono del flyout queda exactamente sobre el icono real del
   rail (mismo tamaño) → la banda parece "integrarlo". */
.sidebar-rail-flyout .srf-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.sidebar-rail-flyout .srf-icon i {
    font-size: 1.15rem;
    line-height: 1;
}
.sidebar-rail-flyout .srf-label {
    font-size: .82rem;
    font-weight: 600;
    padding-left: 2px;
    padding-right: 18px;
}

/* Botón rail-toggle: el chevron se invierte cuando estás en rail */
body.sidebar-rail .sidebar-rail-toggle i { transform: rotate(180deg); }

/* Compat — class legacy 'sidebar-collapsed' equivale a hidden */
body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width) - 1rem));
}
body.sidebar-collapsed .main-content { margin-left: 0; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .main-content { margin-left: 0 !important; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-overlay { display: block; }
    .content-body { padding: 1.25rem 1rem; }
    .top-navbar { padding: 0 1rem; }
    .user-pill-name, .user-pill-sede, .tasa-label { display: none; }
    /* En móvil ignoramos rail */
    body.sidebar-rail .sidebar { width: var(--sidebar-width); }
}

/* ── TARJETA FLOTANTE (componente general) ── */
.floating-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-float);
    border: 1px solid rgba(0,0,0,0.03);
}

/* ── ICON SHAPE ──────────────────────────── */
.icon-shape {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ── OVERLAY LOADER GLOBAL (standby) ─────── */
.overlay-loader {
    position: fixed;
    inset: 0;
    background: rgba(244, 246, 248, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.overlay-loader.active {
    opacity: 1;
    visibility: visible;
}

/* Spinner personalizado para el loader */
.overlay-loader .spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.overlay-loader .spinner-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ── LOGIN ───────────────────────────────── */
body.login-bg {
    background-color: var(--bg-main);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
}

/* Decoración de fondo */
body.login-bg::before {
    content: '';
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43,48,53,0.04) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

body.login-bg::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43,48,53,0.03) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    pointer-events: none;
}

@keyframes floatUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-float);
    animation: floatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--text-dark);
    color: white;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 20px rgba(43,48,53,0.2);
}

.login-logo-img {
    display: block;
    max-width: 180px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
}

.login-title {
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* Input con icono */
.input-icon-group { position: relative; margin-bottom: 1rem; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    z-index: 2;
    pointer-events: none;
}

.form-control-custom {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    font-size: 0.9rem;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    transition: var(--transition-smooth);
    outline: none;
    font-family: inherit;
}

.form-control-custom:focus {
    background: var(--bg-card);
    border-color: var(--text-dark);
    box-shadow: 0 8px 16px rgba(43,48,53,0.08);
}

.form-control-custom::placeholder { color: #ced4da; }

.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.85rem 1.5rem;
    background-color: var(--text-dark);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
    text-decoration: none;
    margin-bottom: 1rem;
}

.btn-modern:hover {
    background-color: #495057;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(43, 48, 53, 0.2);
}

.btn-modern:disabled {
    background-color: #adb5bd;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-link-text {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.btn-link-text:hover { color: var(--text-dark); }

/* Loading overlay del login (interno a la card) */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    z-index: 10;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── DATATABLES OVERRIDE ─────────────────── */
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--radius-sm) !important;
    border: 2px solid #e9ecef !important;
    padding: 0.4rem 0.8rem !important;
    transition: var(--transition-smooth) !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--text-dark) !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ── PRINT ───────────────────────────────── */
@media print {
    .sidebar, .top-navbar, .app-footer,
    .sidebar-overlay, .overlay-loader,
    .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-body { padding: 0 !important; }
    body { background: white !important; }
}

/* Evitar que DataTables corte el dropdown */
#tablaUsuarios { overflow: visible !important; }
#tablaUsuarios td { overflow: visible !important; }
.dataTables_scrollBody { overflow: visible !important; }
div.dataTables_wrapper { overflow: visible !important; }

.table-responsive { overflow: visible !important; }


/* ── MÓDULO: USUARIOS ────────────────────────────────────── */



/* Sortable */
.sortable-ghost {
    opacity: 0.4;
    background: #f8f9fa !important;
    border: 2px dashed #ced4da !important;
}
.handle, .handle-seccion { cursor: grab; }
.handle:active, .handle-seccion:active { cursor: grabbing; }

/* Botón eliminar módulo — visible solo en hover */
.btn-delete-mod {
    opacity: 0;
    transition: opacity 0.2s ease;
}
.list-group-item:hover .btn-delete-mod { opacity: 1; }

/* Tarjeta de permisos */
.permisos-card { transition: var(--transition-smooth); }
.permisos-card:hover { transform: translateY(-3px); }

/* Fix dropdown cortado por table-responsive */
.table-responsive { overflow: visible !important; }


/* ── TABS DE MÓDULOS — Estilo global del sistema ─────────── */
.sistema-tabs .nav-link {
    border-radius: 50px !important;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}
.sistema-tabs .nav-link.active {
    background: var(--text-dark) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 8px 20px rgba(43, 48, 53, 0.18);
}
.sistema-tabs .nav-link:hover:not(.active) {
    background: #f0f2f5;
    color: var(--text-dark);
}


/* ── WIZARD ──────────────────────────────────────────────── */
#wizard_steps {
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 16px;
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    opacity: 0.4;
    transition: var(--transition-smooth);
}
.wizard-step::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 16px);
    width: calc(100% - 32px);
    height: 2px;
    background: #e9ecef;
}
.wizard-step:last-child::after { display: none; }
.wizard-step.active,
.wizard-step.completed { opacity: 1; }
.wizard-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    transition: var(--transition-smooth);
    position: relative;
    z-index: 1;
}
.wizard-step.active  .wizard-step-num {
    background: var(--text-dark);
    color: #fff;
    box-shadow: 0 6px 16px rgba(43,48,53,.25);
}
.wizard-step.completed .wizard-step-num {
    background: #198754;
    color: #fff;
}
.wizard-step.completed::after { background: #198754; }
.wizard-step-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
}
.wizard-step.active .wizard-step-label { color: var(--text-dark); }
 
/* ── PLANILLA ─────────────────────────────────────────────── */
@media print {
    .sidebar-inner, .main-content > nav,
    .modal, .btn, .dropdown,
    #content-body > div:first-child { display: none !important; }
    .floating-card { box-shadow: none !important; border: 1px solid #dee2e6; }
    body { background: white; }
}
 
/* ── WIZARD: DROPDOWN DE RESULTADOS ─────────────────────────── */
.wz-results-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 9999;
    background: #fff;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
    border-radius: 16px !important;
}
.wz-results-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: .88rem;
}
.wz-results-dropdown .dropdown-item:hover {
    background: #f4f6f8;
}
/* El contenedor del input debe ser position:relative para que funcione */
.wz-search-wrap {
    position: relative;
}

/* ╔════════════════════════════════════════════════════════════╗
   ║  EXTENSIÓN VISUAL — Fase A (paleta soft + utilidades)      ║
   ║                                                             ║
   ║  REGLA DE COLOR DEL SISTEMA:                                ║
   ║    · Sin amarillo/warning. Cualquier "warning" se neutraliza║
   ║      a gris oscuro para mantener la estética blanco/gris.  ║
   ║    · Tipografías en gris oscuro (--text-dark), NO negro.    ║
   ║    · success/danger se reservan a SALDOS:                   ║
   ║         saldo > 0 → success ; saldo < 0 → danger.           ║
   ║      Para estados (BORRADOR/PARCIAL/PENDIENTE/...) usar     ║
   ║      badge-soft-secondary o badge-soft-info.                ║
   ╚════════════════════════════════════════════════════════════╝ */
:root {
    /* Paleta semántica soft — fondo tintado, texto contrastado */
    --color-success-soft:   #e6f4ec;
    --color-success-text:   #1e7e44;
    /* warning neutralizado a gris oscuro — alias de secondary */
    --color-warning-soft:   #eef0f3;
    --color-warning-text:   #495057;
    --color-danger-soft:    #fde7e9;
    --color-danger-text:    #b02a37;
    --color-info-soft:      #e3f2fd;
    --color-info-text:      #0d5b9c;
    --color-primary-soft:   #e7f0ff;
    --color-primary-text:   #2255aa;
    --color-secondary-soft: #eef0f3;
    --color-secondary-text: #495057;
    --color-dark-soft:      #e9ecef;
    --color-dark-text:      #2b3035;
}

/* ── Override Bootstrap warning → gris oscuro neutro ──────────
   Convierte automáticamente `bg-warning`, `text-warning`,
   `btn-warning`, `badge-warning`, `border-warning`, `alert-warning`
   en variantes gris-secondary sin tocar las vistas. */
:root {
    --bs-warning:        #6c757d;
    --bs-warning-rgb:    108, 117, 125;
    --bs-warning-bg-subtle:     #eef0f3;
    --bs-warning-text-emphasis: #495057;
    --bs-warning-border-subtle: #d4d7da;
}
.text-warning            { color: var(--text-dark)        !important; }
.bg-warning              { background-color: #6c757d      !important; color: #fff !important; }
.bg-warning.bg-opacity-10,
.bg-warning.bg-opacity-15,
.bg-warning.bg-opacity-25 { background-color: #eef0f3     !important; color: #495057 !important; }
.border-warning          { border-color: #d4d7da          !important; }
.btn-warning {
    background-color: #6c757d !important;
    border-color:     #6c757d !important;
    color:            #fff    !important;
}
.btn-warning:hover, .btn-warning:focus {
    background-color: #5c636a !important;
    border-color:     #5c636a !important;
    color:            #fff    !important;
}
.btn-outline-warning {
    color:        #495057 !important;
    border-color: #6c757d !important;
}
.btn-outline-warning:hover, .btn-outline-warning:focus {
    background-color: #6c757d !important;
    color:            #fff    !important;
}
.badge.bg-warning,
.badge.text-bg-warning {
    background-color: #495057 !important;
    color:            #fff    !important;
}
.alert-warning {
    background-color: #eef0f3 !important;
    border-color:     #d4d7da !important;
    color:            #495057 !important;
}
.text-bg-warning {
    background-color: #495057 !important;
    color:            #fff    !important;
}

/* Tipografía global — evitar negro puro */
body, .text-dark { color: var(--text-dark) !important; }

/* ── BADGES SOFT (fondo tintado + texto sólido legible) ────── */
.badge-soft-success   { background:var(--color-success-soft);   color:var(--color-success-text);   font-weight:600; }
/* warning queda como gris (override Bootstrap arriba) — texto oscuro sobre fondo claro */
.badge-soft-warning   { background:var(--color-warning-soft);   color:var(--color-warning-text);   font-weight:600; }
.badge-soft-danger    { background:var(--color-danger-soft);    color:var(--color-danger-text);    font-weight:600; }
.badge-soft-info      { background:var(--color-info-soft);      color:var(--color-info-text);      font-weight:600; }
.badge-soft-primary   { background:var(--color-primary-soft);   color:var(--color-primary-text);   font-weight:600; }
.badge-soft-secondary { background:var(--color-secondary-soft); color:var(--color-secondary-text); font-weight:600; }
.badge-soft-dark      { background:var(--color-dark-soft);      color:var(--color-dark-text);      font-weight:600; }

/* ── FLOATING-CARD CON HOVER (lift sutil, no agresivo) ────── */
.floating-card.is-interactive,
.floating-card[data-clickable="1"] {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.floating-card.is-interactive:hover,
.floating-card[data-clickable="1"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.10);
}

/* ── STICKY ACTION BAR (footer pegado para forms largos) ──── */
.sticky-action-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid #f0f2f5;
    padding: 0.75rem 1rem;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
    z-index: 100;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ── TIMELINE (eventos verticales — usado en bandejas/dashboard) ── */
.timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.timeline-list::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e9ecef;
}
.timeline-item {
    position: relative;
    padding: 0 0 1rem 2rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 3px solid var(--bg-white);
    box-shadow: 0 0 0 2px #e9ecef;
}
.timeline-dot.is-success { background: #198754; box-shadow: 0 0 0 2px var(--color-success-soft); }
.timeline-dot.is-warning { background: #6c757d; box-shadow: 0 0 0 2px var(--color-warning-soft); }
.timeline-dot.is-danger  { background: #dc3545; box-shadow: 0 0 0 2px var(--color-danger-soft); }
.timeline-dot.is-info    { background: #0dcaf0; box-shadow: 0 0 0 2px var(--color-info-soft); }
.timeline-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.timeline-text {
    font-size: 0.85rem;
    color: var(--text-dark);
    margin: 2px 0 0;
}

/* ── TRANSICIONES SUAVES PARA MODALES Y TABS ───────────────── */
.modal.fade .modal-dialog {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    transform: translateY(8px) scale(0.98);
    opacity: 0;
}
.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.tab-pane.fade { transition: opacity 0.2s ease-in-out; }

/* ── UTILIDADES TIPOGRÁFICAS (tamaños recurrentes) ────────── */
.t-xxs { font-size: 0.62rem !important; }
.t-xs  { font-size: 0.7rem  !important; }
.t-sm  { font-size: 0.78rem !important; }
.label-sec {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}
.mono { font-family: 'Courier New', monospace; letter-spacing: 0.5px; }

/* ── BOTONES — overrides para uniformidad ──────────────────── */
.btn { transition: var(--transition-smooth); }
.btn.rounded-pill { padding-left: 1rem; padding-right: 1rem; }
.btn-soft-success { background: var(--color-success-soft); color: var(--color-success-text); border: none; }
.btn-soft-success:hover { background: #d4ecdd; color: var(--color-success-text); }
.btn-soft-danger  { background: var(--color-danger-soft);  color: var(--color-danger-text);  border: none; }
.btn-soft-danger:hover  { background: #f8d7da; color: var(--color-danger-text); }
.btn-soft-warning { background: var(--color-warning-soft); color: var(--color-warning-text); border: none; }
.btn-soft-warning:hover { background: #d4d7da; color: var(--color-warning-text); }
.btn-soft-info    { background: var(--color-info-soft);    color: var(--color-info-text);    border: none; }
.btn-soft-info:hover    { background: #cfe5fb; color: var(--color-info-text); }

/* ── KPI CARD (versión compacta unificada) ─────────────────── */
.kpi-tile {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    transition: var(--transition-smooth);
}
.kpi-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); }
.kpi-tile .kpi-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.kpi-tile .kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
}
.kpi-tile .kpi-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }