/* ==========================================================================
   Sistema de Sorteo — Estilos base
   Basado en el diseño UI de Pagos4 (Inter Universidad)
   ========================================================================== */

/* ===================================================================
   VARIABLES INSTITUCIONALES
   =================================================================== */
:root {
    /* === Institucionales === */
    --inter-blue-primary:          #2d5593;
    --inter-blue-primary-hover:    #436498;
    --inter-blue-primary-dark:     #24457a;
    --inter-blue-dark:             #1f3668;
    --inter-blue-darker:           #0d1a33;
    --inter-orange:                #FF7A00;
    --inter-orange-hover:          #e8753a;
    --inter-orange-dark:           #c9571c;

    /* === Sidebar === */
    --sidebar-bg:                  #071A36;
    --sidebar-header-bg:           #05132a;
    --sidebar-width:               240px;
    --sidebar-collapsed-width:     72px;
    --sidebar-active-color:        #FF7A00;
    --sidebar-text:                #8a9ab5;
    --sidebar-text-hover:          #ffffff;
    --sidebar-section-color:       #4a5a7a;
    --sidebar-flyout-bg:           #0a1e3d;

    /* === Layout === */
    --inter-navbar-bg:             #ffffff;
    --inter-bg-content:            #F8FAFC;
    --inter-card-bg:               #ffffff;
    --inter-border-color:          #E2E8F0;
    --border-radius-base:          8px;
    --card-radius:                 10px;
    --badge-radius:                6px;

    /* === Tablas === */
    --table-header-bg:             #f8fafc;
    --table-header-color:          #64748b;
    --table-border:                #e2e8f0;

    /* === Colores planos comunes === */
    --text-body:                   #0f172a;
    --text-muted:                  #64748b;
    --text-table:                  #334155;

    /* === Login (glassmorphism) === */
    --login-bg-overlay:            rgba(8, 20, 42, 0.82);
    --glass-bg:                    rgba(255, 255, 255, 0.06);
    --glass-border:                rgba(255, 255, 255, 0.12);
    --glass-blur:                  blur(14px);
    --input-focus-border:          rgba(255, 255, 255, 0.4);
    --btn-gradient:                linear-gradient(90deg, #1f6fd8, #104ba3);
    --btn-gradient-hover:          linear-gradient(90deg, #2a81ed, #155cb7);
}


/* ===================================================================
   TIPOGRAFÍA
   =================================================================== */
html, body {
    overflow-x: hidden;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--inter-bg-content);
    color: var(--text-body);
}


/* ===================================================================
   SIDEBAR LAYOUT (wrapper flex)
   =================================================================== */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
    overflow-x: hidden;
}


/* ===================================================================
   SIDEBAR
   =================================================================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    transition: width 200ms ease, min-width 200ms ease, max-width 200ms ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
}

/* Header / Branding */
.sidebar-header {
    padding: 1.15rem 1.25rem;
    background: var(--sidebar-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 60px;
}

.sidebar-header .sidebar-brand-logo {
    height: auto;
    max-height: 38px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    flex-shrink: 0;
    transition: all 200ms ease;
}

/* Dos logos: expandido (guion bajo) y colapsado (guion). Por defecto solo
   se muestra el expandido; el colapsado aparece cuando sidebar.collapsed. */
.sidebar-header .logo-collapsed {
    display: none;
}

.sidebar-header .logo-expanded {
    display: block;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.15rem 0.5rem;
}

.sidebar.collapsed .logo-expanded {
    display: none !important;
}

.sidebar.collapsed .logo-collapsed {
    display: block !important;
}

.sidebar.collapsed .sidebar-brand-logo {
    max-width: 44px !important;
    max-height: 34px !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    margin: 0 auto;
    object-fit: contain;
}

/* Section labels */
.sidebar-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--sidebar-section-color);
    padding: 1.25rem 1.25rem 0.4rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-section-label {
    display: none !important;
}

/* Navegación */
.sidebar-nav {
    padding: 0.25rem 0;
    list-style: none;
    margin-bottom: 0;
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.sidebar-nav .nav-item {
    position: relative;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 100ms ease, color 100ms ease;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--sidebar-text-hover);
}

/* Active state: orange left border + orange text/icon */
.sidebar-nav .nav-item.active > .nav-link {
    border-left-color: var(--sidebar-active-color);
    color: var(--sidebar-active-color);
    background-color: rgba(255, 122, 0, 0.08);
    font-weight: 600;
}

.sidebar-nav .nav-link i.nav-icon {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1.05rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.75rem 0;
    border-left-width: 3px;
    text-align: center;
}

.sidebar.collapsed .sidebar-nav .nav-link i.nav-icon {
    margin-right: 0 !important;
    font-size: 1.15rem;
}

.sidebar-nav .nav-link .link-text {
    transition: opacity 200ms ease;
    overflow: hidden;
}

.sidebar.collapsed .nav-link .link-text {
    display: none !important;
}

/* Flyout chevron */
.sidebar-nav .flyout-arrow {
    margin-left: auto;
    font-size: 0.6rem;
    color: var(--sidebar-section-color);
    transition: opacity 200ms ease;
}

.sidebar.collapsed .flyout-arrow {
    display: none !important;
}

/* ── Flyout Panel ── */
.sidebar-flyout {
    position: fixed;
    background: var(--sidebar-flyout-bg);
    border-radius: 0 12px 12px 0;
    box-shadow: 6px 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    padding: 0.5rem 0;
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
    list-style: none;
    margin: 0;
}

.sidebar-flyout.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-flyout .flyout-header {
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--sidebar-active-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-flyout .flyout-header i {
    font-size: 0.85rem;
}

.sidebar-flyout li a {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 100ms ease, color 100ms ease;
}

.sidebar-flyout li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-flyout li a i {
    width: 18px;
    margin-right: 0.6rem;
    font-size: 0.85rem;
    text-align: center;
    color: var(--sidebar-section-color);
}

/* ── Tooltip (collapsed hover, no-children items) ── */
.sidebar-tooltip {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-flyout-bg);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease, visibility 150ms ease;
    pointer-events: none;
    box-shadow: 4px 2px 12px rgba(0, 0, 0, 0.3);
}

.sidebar.collapsed .nav-item:hover .sidebar-tooltip {
    opacity: 1;
    visibility: visible;
}

.sidebar:not(.collapsed) .sidebar-tooltip {
    display: none;
}

/* ── Sidebar Footer (profile + collapse btn) ── */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0;
}

.sidebar-profile {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: background-color 100ms ease;
}

.sidebar-profile:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.sidebar-profile .profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-active-color), var(--sidebar-active-color));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #fff;
    position: relative;
}

.sidebar-profile .profile-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--sidebar-bg);
}

.sidebar-profile .profile-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    transition: opacity 200ms ease;
}

.sidebar-profile .profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile .profile-role {
    font-size: 0.7rem;
    color: var(--sidebar-text);
}

.sidebar-profile .profile-chevron {
    color: var(--sidebar-section-color);
    font-size: 0.65rem;
    transition: opacity 200ms ease;
}

.sidebar.collapsed .sidebar-profile {
    justify-content: center;
    padding: 0.75rem 0;
}

.sidebar.collapsed .profile-info,
.sidebar.collapsed .profile-chevron {
    display: none !important;
}

/* Collapse toggle button */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    background: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--sidebar-section-color);
    cursor: pointer;
    transition: color 100ms ease, background-color 100ms ease;
    width: 100%;
    font-size: 0.85rem;
}

.sidebar-collapse-btn:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
}


/* ===================================================================
   PAGE CONTENT (lado derecho del wrapper)
   =================================================================== */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: all 200ms ease;
    background-color: var(--inter-bg-content);
}


/* ===================================================================
   NAVBAR SUPERIOR
   =================================================================== */
.navbar-top {
    background: var(--inter-navbar-bg);
    border-bottom: 1px solid var(--inter-border-color);
    min-height: 60px;
}

.navbar-toggler-btn {
    background: none;
    border: none;
    color: #475569;
    font-size: 1.2rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    transition: background-color 150ms ease, color 150ms ease;
    cursor: pointer;
}

.navbar-toggler-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

.navbar-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-left: 0.75rem;
}

/* Global search */
.navbar-search {
    position: relative;
    max-width: 400px;
    flex: 1;
    margin: 0 1.5rem;
}

.navbar-search input {
    border: 1px solid var(--inter-border-color);
    border-radius: 10px;
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    font-size: 0.85rem;
    width: 100%;
    background: #F7F9FC;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.navbar-search input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
    background: #fff;
}

.navbar-search input::placeholder {
    color: #94a3b8;
}

.navbar-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

/* Navbar right items */
.navbar-right-items {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #64748b;
    font-size: 0.82rem;
    white-space: nowrap;
}

.navbar-date i {
    color: #94a3b8;
}

.navbar-notification {
    position: relative;
    background: none;
    border: none;
    color: #475569;
    font-size: 1.1rem;
    padding: 0.375rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.navbar-notification:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.navbar-notification .notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.navbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease;
    color: #475569;
}

.navbar-user-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.navbar-user-btn .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-active-color), var(--sidebar-active-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
}

.navbar-user-btn .user-name-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
}

.navbar-user-btn .user-chevron {
    font-size: 0.6rem;
    color: #94a3b8;
}

.vertical-divider {
    width: 1px;
    height: 24px;
    background: var(--inter-border-color);
    margin: 0 0.25rem;
}


/* ===================================================================
   LOGIN — GLASSMORPHISM PREMIUM
   =================================================================== */
.login-wrapper {
    background: url("../img/background.23a689059713.jpg") no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    position: relative;
}

.login-overlay {
    background-color: var(--login-bg-overlay);
    position: absolute;
    inset: 0;
    z-index: 1;
}

.login-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 28px;
    padding: 3.5rem 2.5rem 2.5rem 2.5rem;
    color: #ffffff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 440px;
}

.glass-card .login-logo-img {
    max-height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.glass-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.glass-input-group i.input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
}

.glass-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    padding: 1rem 1rem 1rem 3.2rem !important;
    width: 100%;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: var(--input-focus-border) !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

/* Password toggle dentro del input */
.glass-input-group .password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    z-index: 5;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.glass-input-group .password-toggle:hover {
    color: #ffffff;
}

.glass-btn {
    background: var(--btn-gradient);
    border: none;
    border-radius: 14px;
    color: #ffffff;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(31, 111, 216, 0.3);
    cursor: pointer;
}

.glass-btn:hover {
    background: var(--btn-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 111, 216, 0.45);
    color: #ffffff;
}

.glass-btn:active {
    transform: translateY(0);
}

.glass-btn:disabled {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.glass-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 2rem 0 1.5rem 0;
}

.glass-link {
    color: #3b8cf6;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.glass-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Modal dentro del login (olvidé contraseña, etc.) */
.login-modal .modal-content {
    background: rgba(8, 20, 42, 0.95);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.login-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #ffffff;
}

.login-modal .modal-body {
    color: #ffffff;
}

.login-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

.login-modal .btn-close {
    filter: brightness(0) invert(1);
}

/* Mobile */
@media (max-width: 480px) {
    .glass-card {
        padding: 2.5rem 1.75rem 2rem;
        border-radius: 24px;
        margin: 15px;
    }
}


/* ===================================================================
   CARDS
   =================================================================== */
.card {
    border: 1px solid var(--inter-border-color);
    border-radius: var(--card-radius);
    background-color: var(--inter-card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--inter-border-color);
    padding: 0.85rem 1.25rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background-color: #f8fafc;
    border-top: 1px solid var(--inter-border-color);
    padding: 0.75rem 1.25rem;
}

/* Tarjetas KPI (dashboard y módulos) */
.kpi-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid var(--inter-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    height: 100%;
}

.kpi-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.kpi-card-body {
    padding: 1.15rem 1.25rem;
    position: relative;
}

.kpi-icon-box {
    position: absolute;
    top: 1.15rem;
    right: 1.15rem;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.25rem;
    padding-right: 48px;
}

.kpi-amount {
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--text-body);
    line-height: 1.2;
    padding-right: 48px;
}

/* Chart card */
.chart-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid var(--inter-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.chart-card-body {
    padding: 1.25rem 1.4rem;
}

.chart-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

/* Colores de iconos KPI (Tonos Suaves Pasteles) */
.bg-soft-blue { background: #f0f7ff; color: #2563eb; border: 1px solid #e0effe; }
.bg-soft-green { background: #f0fdf4; color: #10b981; border: 1px solid #dcfce7; }
.bg-soft-yellow { background: #fefce8; color: #ca8a04; border: 1px solid #fef9c3; }
.bg-soft-red { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }
.bg-soft-neutral { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

.icon-blue { color: #2563eb; }
.icon-red { color: #ef4444; }
.icon-green { color: #10b981; }
.icon-yellow { color: #ca8a04; }

/* ===================================================================
   TABLAS
   =================================================================== */
.table-responsive {
    border-radius: var(--border-radius-base);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--table-border);
    background: #ffffff;
}

.table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-color);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--table-border);
    padding: 0.6rem 0.85rem;
}

.table td {
    vertical-align: middle;
    font-size: 0.82rem;
    color: var(--text-table);
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--table-border);
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ===================================================================
   FORMULARIOS
   =================================================================== */
.form-control,
.form-select {
    border-radius: var(--border-radius-base);
    border: 1px solid var(--inter-border-color);
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    color: var(--text-body);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f8fafc;
    opacity: 1;
    color: #64748b;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.35rem;
}

/* ===================================================================
   BADGES GLOBALES (Tonos Pasteles Suaves)
   =================================================================== */
.badge {
    border-radius: var(--badge-radius) !important;
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.28rem 0.55rem;
}

.badge-subtle-success {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
}

.badge-subtle-warning {
    background: #fefce8 !important;
    color: #854d0e !important;
    border: 1px solid #fef08a !important;
}

.badge-subtle-danger {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca !important;
}

.badge-subtle-primary {
    background: #f0f7ff !important;
    color: #2563eb !important;
    border: 1px solid #bfdbfe !important;
}

.badge-subtle-neutral,
.badge-subtle-secondary {
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

/* ===================================================================
   MODALES
   =================================================================== */
.modal-content {
    border: 1px solid var(--inter-border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.modal-header {
    border-bottom: 1px solid var(--inter-border-color);
    background-color: #ffffff;
    padding: 1rem 1.25rem;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
}

.modal-title-big {
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--inter-border-color);
    background-color: #f8fafc;
    padding: 0.75rem 1.25rem;
}

/* ===================================================================
   BOTONES GLOBALES (Semi-Redondos 8px)
   =================================================================== */
.btn {
    border-radius: var(--border-radius-base) !important;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.45rem 0.95rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.btn-outline-secondary {
    border-color: var(--inter-border-color);
    color: #475569;
    background: #ffffff;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn-export {
    background: #ffffff;
    border: 1px solid var(--inter-border-color);
    border-radius: var(--border-radius-base);
    padding: 0.45rem 0.95rem;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-export:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}


/* ===================================================================
   LOADER OVERLAY
   =================================================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

.dashboard-loader-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(97, 97, 97, 0.49);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.loader-text {
    color: #fff;
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}


/* ===================================================================
   EMPTY STATE
   =================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}


/* ===================================================================
   UTILIDADES
   =================================================================== */
.filter-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}


/* ===================================================================
   UTILITY EXTENSIONS
   =================================================================== */
.min-width-0 {
    min-width: 0;
}


/* ===================================================================
   ANIMACIONES
   =================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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


/* ===================================================================
   RESPONSIVIDAD Y COMPORTAMIENTO MÓVIL
   =================================================================== */

/* Backdrop del Sidebar */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1025;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Tablet: collapsed by default */
@media (min-width: 769px) and (max-width: 1280px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
        min-width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
    }

    .sidebar .link-text,
    .sidebar .flyout-arrow,
    .sidebar .sidebar-section-label,
    .sidebar .profile-info,
    .sidebar .profile-chevron {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    .sidebar .logo-expanded {
        display: none;
    }

    .sidebar .logo-collapsed {
        display: block;
    }

    .sidebar .sidebar-brand-logo {
        max-width: 44px;
        max-height: 34px;
    }

    .sidebar .nav-link {
        justify-content: center;
        padding: 0.75rem 0;
    }

    .sidebar .nav-link i.nav-icon {
        margin-right: 0;
        font-size: 1.15rem;
    }

    /* When explicitly expanded on tablet */
    .sidebar.expanded {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        max-width: var(--sidebar-width);
    }

    .sidebar.expanded .logo-collapsed {
        display: none;
    }

    .sidebar.expanded .logo-expanded {
        display: block;
    }

    .sidebar.expanded .sidebar-brand-logo {
        max-width: 170px;
        max-height: 38px;
    }

    .sidebar.expanded .link-text,
    .sidebar.expanded .flyout-arrow,
    .sidebar.expanded .sidebar-section-label,
    .sidebar.expanded .profile-info,
    .sidebar.expanded .profile-chevron {
        opacity: 1;
        width: auto;
    }

    .sidebar.expanded .nav-link {
        justify-content: flex-start;
        padding: 0.6rem 1.25rem;
    }

    .sidebar.expanded .nav-link i.nav-icon {
        margin-right: 0.75rem;
    }
}

/* Mobile: drawer overlay */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        z-index: 1050;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-header {
        justify-content: flex-start !important;
        padding: 1.15rem 1.25rem !important;
    }

    /* On mobile, always show text (drawer is always full width) */
    .sidebar .logo-expanded {
        display: inline-block !important;
    }

    .sidebar .logo-collapsed {
        display: none !important;
    }

    .sidebar .sidebar-brand-logo,
    .sidebar .link-text,
    .sidebar .flyout-arrow,
    .sidebar .sidebar-section-label,
    .sidebar .profile-info,
    .sidebar .profile-chevron {
        opacity: 1 !important;
        width: auto !important;
        display: inline-block !important;
    }

    .sidebar .nav-link {
        justify-content: flex-start !important;
        padding: 0.6rem 1.25rem !important;
        text-align: left !important;
    }

    .sidebar .nav-link i.nav-icon {
        margin-right: 0.75rem !important;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    #page-content-wrapper {
        width: 100%;
        min-width: 100%;
    }

    #wrapper {
        position: relative;
        overflow-x: hidden;
    }

    .container-fluid {
        padding: 1rem !important;
    }

    /* Hide some navbar items on mobile */
    .navbar-search {
        display: none !important;
    }

    .navbar-date {
        display: none !important;
    }

    .navbar-user-btn .user-name-text {
        display: none;
    }

    /* Flyout becomes inline sub-menu on mobile */
    .sidebar-flyout {
        position: static !important;
        background: rgba(0, 0, 0, 0.2) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        min-width: auto !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none;
        padding: 0.25rem 0 !important;
        top: auto !important;
        left: auto !important;
    }

    .sidebar-flyout.show {
        display: block !important;
    }

    .sidebar-flyout .flyout-header {
        display: none !important;
    }

    .sidebar-flyout li a {
        padding: 0.5rem 1rem 0.5rem 2.75rem !important;
        font-size: 0.85rem !important;
    }
}


/* Segmented Control para OCR en modal */
.ocr-segmented-control {
    background: #e9ecef;
    padding: 3px;
    border-radius: 30px;
    display: inline-flex;
    border: 1px solid #dee2e6;
}

.ocr-segmented-control .nav-link {
    border-radius: 30px;
    border: none;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    background: transparent;
    transition: all 0.2s ease-in-out;
}

.ocr-segmented-control .nav-link.active {
    background: #ffffff;
    color: var(--bs-primary) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


/* ===================================================================
   PALETTE GLOBAL (Ctrl+K) — busqueda.js
   =================================================================== */

/* Disparador del navbar (reemplaza el input decorativo) */
.navbar-search-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--inter-border-color);
    border-radius: 10px;
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    font-size: 0.85rem;
    width: 100%;
    background: #F7F9FC;
    color: #94a3b8;
    text-align: left;
    cursor: pointer;
    transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.navbar-search-trigger:hover,
.navbar-search-trigger:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
    background: #fff;
    color: #475569;
}

.navbar-search-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-search-kbd {
    font-family: inherit;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
}

/* Trigger móvil (lupa compacta en navbar-right-items) */
.navbar-palette-trigger-mobile {
    background: none;
    border: none;
    color: #475569;
    font-size: 1.1rem;
    padding: 0.375rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}

.navbar-palette-trigger-mobile:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

/* Modal del palette */
#paletteModal .modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

#paletteModal .modal-header {
    border-bottom: 1px solid #eef2f7;
    padding: 0.6rem 0.9rem;
    gap: 0.6rem;
}

#paletteModal .palette-header-icon {
    color: #94a3b8;
}

#paletteModal .palette-input {
    border: none;
    box-shadow: none;
    font-size: 1rem;
    padding: 0.375rem 0.25rem;
}

#paletteModal .palette-input:focus {
    box-shadow: none;
}

#paletteModal .palette-kbd {
    font-family: inherit;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
}

#paletteModal .palette-close {
    font-size: 0.85rem;
}

#paletteModal .palette-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Grupos e ítems */
.palette-grupo {
    margin-bottom: 0.35rem;
}

.palette-grupo-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.palette-grupo-header i {
    font-size: 0.75rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.palette-item:hover,
.palette-item.activo {
    background-color: #f1f5f9;
}

.palette-item-text {
    flex: 1;
    min-width: 0;
}

.palette-item-label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
}

.palette-item-sub {
    display: block;
    font-size: 0.74rem;
    color: #94a3b8;
}

.palette-badge {
    font-size: 0.64rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: 6px;
    background: #e2e8f0;
    color: #475569;
    white-space: nowrap;
}

.palette-star {
    background: none;
    border: none;
    padding: 0.2rem 0.35rem;
    color: #f59e0b;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 6px;
}

.palette-star:hover {
    background: rgba(245, 158, 11, 0.12);
}

.palette-empty {
    text-align: center;
    color: #94a3b8;
    padding: 2.5rem 0;
    font-size: 0.9rem;
}

/* Indicador de carga inline mientras busca (busqueda.js: mostrarCargando) */
.palette-cargando {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Full-screen en viewport <lg (design §6.2). Scoped a #paletteModal para no
   afectar a los demás modales del sistema. */
@media (max-width: 991.98px) {
    #paletteModal .modal-dialog {
        max-width: 100%;
        margin: 0;
        height: 100%;
    }

    #paletteModal .modal-dialog-centered {
        align-items: stretch;
    }

    #paletteModal .modal-content {
        border-radius: 0;
        min-height: 100%;
    }

    #paletteModal .palette-body {
        max-height: none;
    }
}

/* ===================================================================
   SISTEMA DE DISEÑO UNIFICADO — MODALES, TOASTS, PANTALLAS (Dashboard & Responsables Base)
   =================================================================== */

/* --- Modales Estandarizados (Estilo Responsables) --- */
.modal-content {
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden;
}

.modal-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.5rem;
}

.modal-header-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0;
}

.modal-title-big {
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 400;
}

.modal-body {
    padding: 1.5rem;
    background-color: #ffffff;
}

.modal-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.modal-footer {
    border-top: 1px solid #f1f5f9;
    background-color: #f8fafc;
    padding: 0.85rem 1.5rem;
}

/* --- Form Elements Estandarizados --- */
.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    color: #0f172a;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
}

/* --- FORMA DE BOTONES ESTANDARIZADA (Cuadrada-redondeada 8px) --- */
.btn, 
.btn-pill, 
.rounded-pill, 
.btn-nuevo-registro,
.btn-exportar,
.btn-filtros-toggle,
.modal-footer .btn,
.swal2-popup .swal2-styled,
.swal2-popup .swal2-confirm,
.swal2-popup .swal2-cancel,
.swal2-popup .swal2-deny {
    border-radius: 8px !important;
}

.btn-pill {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
}

/* --- Badges Pasteles Subtles --- */
.badge-subtle-primary { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; }
.badge-subtle-success { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-subtle-warning { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-subtle-danger { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-subtle-neutral { background-color: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

/* --- Global Toast Design --- */
.global-toast-container {
    z-index: 99999 !important;
}

.global-toast-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
    min-width: 280px;
    max-width: 420px;
}



