/**
 * ============================================
 * Inventario Educativo v4 - App Stylesheet
 * Manual IC y UI v2.1 - Entersolo
 * ============================================
 *
 * Requiere: tokens.css (cargado antes)
 * Colores corporativos: --brand-blue, --brand-red
 */

/* ============================================
   LAYOUT — Main content container
   ============================================ */
.main-contained {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   HEADER / NAVBAR - IC v2.1 (gestionv6 style)
   ============================================ */
.header-ic {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

/* --- Container --- */
.header-container {
    display: flex;
    align-items: center;
    height: 64px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    gap: var(--space-lg);
}

/* --- Logo Block --- */
.header-logo-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.header-logo {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    line-height: 1;
}

.header-logo:hover {
    text-decoration: none;
}

.logo-e {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-blue);
    letter-spacing: -0.02em;
}

.logo-dot {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-red);
}

.logo-product {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding-left: var(--space-md);
    border-left: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.logo-product .fa-solid,
.logo-product .fa-regular {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* --- Center Navigation --- */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 auto;
    justify-content: center;
}

.nav-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius-md);
    background: rgba(28, 48, 82, 0.06);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.nav-btn:hover {
    color: var(--brand-blue);
    text-decoration: none;
}

.nav-btn:hover::before {
    opacity: 1;
}

.nav-btn.active {
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(28, 48, 82, 0.25);
}

.nav-btn.active::before {
    display: none;
}

.nav-btn .fa-solid,
.nav-btn .fa-regular {
    font-size: 0.85em;
    position: relative;
}

.nav-btn span {
    position: relative;
}

/* Nav icon colors (inactive state only — active uses white) */
.nav-btn:not(.active) .nav-ic-inventario  { color: #1C3052; }
.nav-btn:not(.active) .nav-ic-prestamos   { color: #0D9488; }

/* --- Nav Dropdowns --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown > .nav-btn {
    border: none;
    background: none;
    cursor: pointer;
}

.nav-dropdown > .nav-btn.active {
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(28, 48, 82, 0.25);
}

.nav-dropdown-arrow {
    font-size: 0.6em !important;
    margin-left: 2px;
    opacity: 0.6;
    transition: transform var(--transition-fast);
}

.nav-dropdown > .nav-btn[aria-expanded="true"] .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    min-width: 200px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    margin-top: 4px !important;
}

.nav-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-dropdown-menu .dropdown-item:hover {
    background: rgba(28, 48, 82, 0.06);
    color: var(--brand-blue);
}

.nav-dropdown-menu .dropdown-item.active {
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
    font-weight: 600;
}

.nav-dropdown-menu .dropdown-item .fa-solid {
    width: 16px;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* --- Disabled nav items (no permission) --- */
.nav-dropdown-menu .dropdown-item.nav-disabled,
.nav-dropdown-menu .dropdown-item.nav-disabled:hover {
    color: var(--text-tertiary);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    background: none;
    display: flex;
    align-items: center;
}
.nav-dropdown-menu .dropdown-item.nav-disabled::after {
    content: "\f023"; /* fa-lock */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.6rem;
    margin-left: auto;
    opacity: 0.7;
}

.mobile-nav-link.nav-disabled,
.mobile-nav-link.nav-disabled:hover {
    color: var(--text-tertiary);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    background: none;
    display: flex;
    align-items: center;
}
.mobile-nav-link.nav-disabled::after {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.55rem;
    margin-left: auto;
    opacity: 0.7;
}

.nav-btn.nav-disabled,
.nav-btn.nav-disabled:hover {
    color: var(--text-tertiary);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}
.nav-btn.nav-disabled::before { display: none; }

/* --- Mobile nav section header --- */
.mobile-nav-section {
    padding: 10px 20px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
}

.mobile-nav-section:first-child {
    border-top: none;
    margin-top: 0;
}

/* --- Right Actions --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* User block */
.header-user-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
}

.header-user-block:hover {
    background: rgba(28, 48, 82, 0.05);
}

.header-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6 0%, #1d4ed8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}
.header-user-avatar--logo {
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    padding: 2px;
    overflow: hidden;
}
.header-user-avatar--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.header-user-info {
    line-height: 1.25;
}

.header-user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--brand-blue);
}

.header-user-entity {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Config button (gear icon) */
.btn-config {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    text-decoration: none;
    flex-shrink: 0;
}

.btn-config:hover {
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.06);
}

.btn-config:hover .fa-gear {
    transform: rotate(45deg);
}

.btn-config .fa-gear {
    transition: transform var(--transition-smooth);
}

.btn-config.active {
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.08);
}

/* Config dropdown */
.header-dropdown {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--card-shadow-hover);
    padding: var(--space-sm) 0;
    min-width: 200px;
}

.header-dropdown .dropdown-item {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    transition: background var(--transition-fast);
}

.header-dropdown .dropdown-item:hover {
    background: rgba(28, 48, 82, 0.06);
}

.header-dropdown .dropdown-item .fa-solid {
    color: var(--text-secondary);
    width: 1.25em;
    font-size: 0.85rem;
}

.header-dropdown .dropdown-divider {
    margin: 4px 0;
    border-color: var(--card-border);
}

/* Logout button (always visible) */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(231, 60, 30, 0.3);
    background: rgba(231, 60, 30, 0.06);
    color: var(--brand-red);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: white;
    text-decoration: none;
}

.btn-logout .fa-solid {
    font-size: 0.85rem;
}

/* Mobile toggle */
.navbar-toggler {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    background: transparent;
}

.navbar-toggler:focus {
    box-shadow: none;
    border-color: var(--brand-blue);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%231C3052' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 20px;
    height: 20px;
}

/* --- Mobile Navigation --- */
.header-mobile-nav {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm) var(--space-lg) var(--space-md);
    background: white;
    border-top: 1px solid var(--header-border);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.mobile-nav-link:hover {
    color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.06);
    text-decoration: none;
}

.mobile-nav-link.active {
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    font-weight: 600;
}

.mobile-nav-link .fa-solid {
    width: 1.25em;
    text-align: center;
    font-size: 0.9rem;
}

/* Punto rojo corporativo (utility) */
.brand-dot {
    color: var(--brand-red);
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 0.6rem 1rem;
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.85rem;
    align-items: center;
}

.breadcrumb a {
    color: var(--ui-interaction);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    color: var(--brand-blue);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

nav[aria-label="breadcrumb"].d-flex > .breadcrumb {
    margin-top: 0;
    margin-bottom: 0;
}

.btn-fichas {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #64748B);
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border, #dee2e6);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-fichas:hover {
    color: var(--brand-blue, #1C3052);
    border-color: var(--brand-blue, #1C3052);
    background: rgba(28, 48, 82, 0.04);
}
.btn-fichas i {
    font-size: 0.85rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›" !important;
    color: var(--text-tertiary);
    font-size: 1rem;
    vertical-align: middle;
}

/* ============================================
   CARDS - IC v2.1
   ============================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    padding: var(--space-md) var(--space-lg);
}

/* Panel header corporativo (azul con gradiente) */
.panel-header-ic {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    padding: var(--space-md) var(--space-lg);
}

.panel-header-ic .fa-solid,
.panel-header-ic .fa-regular {
    color: var(--text-inverse) !important;
}

/* Punto rojo en titulos */
.title-dot::after {
    content: '.';
    color: var(--brand-red);
}

/* ============================================
   MODULE CARDS (DASHBOARD)
   ============================================ */
.module-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: var(--space-2xl) var(--space-lg) var(--space-xl);
    text-align: center;
    transition: all var(--transition-smooth);
    cursor: pointer;
    height: 100%;
    box-shadow: var(--card-shadow);
    text-decoration: none;
    color: var(--text-primary);
    display: block;
    position: relative;
}

.module-card:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
    text-decoration: none;
    color: var(--text-primary);
    transform: translateY(-4px);
}

.module-card .module-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
    color: var(--icon-stroke);
    background: var(--icon-fill);
    transition: all var(--transition-smooth);
}

.module-card:hover .module-icon {
    background: var(--icon-fill-hover);
    transform: scale(1.08);
}

/* Module icon colors (differentiated per module) */
.module-icon.ic-inventario   { color: #1C3052; background: rgba(28, 48, 82, 0.10); }
.module-icon.ic-prestamos    { color: #0D9488; background: rgba(13, 148, 136, 0.10); }
.module-icon.ic-altaia       { color: #D97706; background: rgba(217, 119, 6, 0.10); }
.module-icon.ic-etiquetas    { color: #7C3AED; background: rgba(124, 58, 237, 0.10); }
.module-icon.ic-solicitudes  { color: #2563EB; background: rgba(37, 99, 235, 0.10); }
.module-icon.ic-estadisticas  { color: #64748B; background: rgba(100, 116, 139, 0.10); }
.module-icon.ic-registroaux   { color: #7C3AED; background: rgba(124, 58, 237, 0.10); }
.module-icon.ic-proveedores   { color: #059669; background: rgba(5, 150, 105, 0.10); }
.module-icon.ic-enajenaciones { color: #DC2626; background: rgba(220, 38, 38, 0.10); }

.module-card:hover .ic-inventario    { background: rgba(28, 48, 82, 0.18); }
.module-card:hover .ic-prestamos     { background: rgba(13, 148, 136, 0.18); }
.module-card:hover .ic-altaia        { background: rgba(217, 119, 6, 0.18); }
.module-card:hover .ic-etiquetas     { background: rgba(124, 58, 237, 0.18); }
.module-card:hover .ic-solicitudes   { background: rgba(37, 99, 235, 0.18); }
.module-card:hover .ic-estadisticas  { background: rgba(100, 116, 139, 0.18); }
.module-card:hover .ic-registroaux   { background: rgba(124, 58, 237, 0.18); }
.module-card:hover .ic-proveedores   { background: rgba(5, 150, 105, 0.18); }
.module-card:hover .ic-enajenaciones { background: rgba(220, 38, 38, 0.18); }

.module-card h5 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: var(--space-xs);
    color: var(--brand-blue);
}

.module-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.4;
}

/* Large variant for dashboard (4 cards) */
.module-card-lg {
    padding: var(--space-2xl) var(--space-lg) var(--space-2xl);
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.module-card-lg .module-icon {
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
    margin-bottom: var(--space-lg);
}

.module-card-lg h5 {
    font-size: 1.1rem;
}

.module-card-lg p {
    font-size: 0.85rem;
}

/* Disabled variant for deactivated modules (shown with lock) */
.module-card.module-card-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}
.module-card.module-card-disabled:hover {
    border-color: var(--card-border);
    box-shadow: 0 1px 3px rgba(28,48,82,0.06), 0 4px 16px rgba(28,48,82,0.06);
    transform: none;
}
.module-card.module-card-disabled:hover .module-icon {
    background: var(--icon-fill);
    transform: none;
}
.module-card.module-card-disabled h5 {
    color: var(--text-secondary);
}
.module-card-lock {
    position: absolute;
    top: 12px;
    right: 14px;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Compact variant for config page */
.module-card-compact {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 0.65rem 0.85rem;
    gap: 0.7rem;
}
.module-card-compact .module-icon {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    margin-bottom: 0;
    flex-shrink: 0;
    border-radius: 8px;
}
.module-card-compact h5 {
    font-size: 0.85rem;
    margin-bottom: 0;
    line-height: 1.2;
}
.module-card-compact p {
    font-size: 0.72rem;
    line-height: 1.3;
}
.module-card-compact:hover {
    transform: translateY(-2px);
}
.module-card-compact:hover .module-icon {
    transform: scale(1.05);
}

/* Expandable config cards (collapse trigger) */
.module-card-compact.config-expandable {
    cursor: pointer;
    user-select: none;
}
.module-card-compact.config-expandable:hover {
    border-color: var(--brand-blue);
}
.config-expand-panel {
    margin-top: -0.25rem;
}
.config-expand-panel > .card {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* Module card link (when card has secondary action like Import) */
.module-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.7rem;
    flex: 1;
    min-width: 0;
}
.module-card-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Config import button inside module card */
.config-import-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    padding: 2px 7px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}
.module-card:hover .config-import-btn {
    opacity: 1;
}

/* Config page group labels */
.config-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-blue);
    margin-bottom: 0.5rem;
    padding-left: 2px;
    opacity: 0.7;
}

/* Clickable table rows (ficha navigation) */
.table-clickable-rows tbody tr {
    cursor: pointer;
}
.table-clickable-rows tbody tr:hover td {
    background-color: rgba(28, 48, 82, 0.03);
}
/* Disable DT Select blue highlight on clickable-row tables */
.table-clickable-rows tbody tr.selected,
.table-clickable-rows tbody tr.selected td,
.table-clickable-rows tbody tr.selected > *,
table.table-clickable-rows.table-striped > tbody > tr.selected > *,
table.table-clickable-rows > tbody > tr.selected > * {
    background-color: transparent !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
}
table.table-clickable-rows.table-striped > tbody > tr.odd.selected > * {
    background-color: transparent !important;
    background: transparent !important;
}
.table-clickable-rows tbody tr.selected:hover td,
.table-clickable-rows tbody tr.selected:hover > * {
    background-color: rgba(28, 48, 82, 0.03) !important;
}

/* Config collapsible panel headers */
.config-collapse-header {
    cursor: pointer;
    user-select: none;
}
.config-collapse-header:hover {
    background: rgba(28, 48, 82, 0.06);
}
.config-collapse-chevron {
    transition: transform 0.2s ease;
}

/* Hero variant for main dashboard (2 big cards) */
.module-card-hero {
    padding: var(--space-2xl) var(--space-xl) var(--space-2xl);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.module-card-hero .module-icon {
    width: 96px;
    height: 96px;
    font-size: 2.25rem;
    margin-bottom: var(--space-xl);
}

.module-card-hero h5 {
    font-size: 1.3rem;
}

.module-card-hero p {
    font-size: 0.95rem;
}

/* ============================================
   STAT CARDS (DASHBOARD)
   ============================================ */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: var(--space-lg);
    box-shadow: var(--card-shadow);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--brand-blue);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================
   BUTTONS - IC v2.1
   ============================================ */
.btn-ic-primary {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    color: white;
    border: none;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    --bs-btn-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #15253f;
    --bs-btn-active-border-color: #15253f;
}

.btn-ic-primary:hover {
    background: linear-gradient(135deg, #15253f 0%, #1C3052 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(28, 48, 82, 0.3);
}

.btn-ic-outline {
    background: transparent;
    color: var(--brand-blue);
    border: 1px solid var(--card-border);
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.btn-ic-outline:hover {
    border-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.06);
    color: var(--brand-blue);
}

.btn-group .btn-ic-outline.active {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    color: #fff;
    border-color: var(--brand-blue);
}

.btn-ic-primary:disabled,
.btn-ic-primary.disabled {
    opacity: 1;
    background: #8a9bb5;
    color: #e8ecf0;
    cursor: not-allowed;
}

.btn-ic-outline:disabled,
.btn-ic-outline.disabled {
    opacity: 1;
    color: #9aa8b8;
    border-color: #d0d7de;
    background: transparent;
    cursor: not-allowed;
}

.btn-ic-danger {
    background: transparent;
    color: var(--brand-red);
    border: 1px solid var(--brand-red);
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.btn-ic-danger:hover {
    background: var(--brand-red);
    color: white;
}

/* Danger outline button (subtle, for delete) */
.btn-ic-outline-danger {
    color: var(--brand-red) !important;
    border-color: var(--brand-red) !important;
}

.btn-ic-outline-danger:hover {
    background: rgba(231, 60, 30, 0.08) !important;
    color: var(--brand-red) !important;
}

.btn-ic-outline-danger.disabled,
.btn-ic-outline-danger:disabled {
    color: var(--text-tertiary) !important;
    border-color: var(--card-border) !important;
    background: transparent !important;
    opacity: 0.65;
}

/* ============================================
   DATATABLES - IC v2.1
   ============================================ */

/* --- DataTable wrapper: horizontal scroll for wide tables --- */
.dataTables_wrapper {
    max-width: 100%;
    overflow-x: auto;
}

/* --- Top scrollbar (synced with wrapper bottom scrollbar) --- */
.scroll-top-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    margin-bottom: 8px;
    background: var(--ui-bg-light);
    border-radius: 7px;
    border: 1px solid var(--card-border);
}

.scroll-top-wrapper > div {
    height: 1px;
}

/* --- Custom scrollbar styling (more visible) --- */
.dataTables_wrapper::-webkit-scrollbar,
.scroll-top-wrapper::-webkit-scrollbar {
    height: 10px;
}

.dataTables_wrapper::-webkit-scrollbar-track,
.scroll-top-wrapper::-webkit-scrollbar-track {
    background: var(--ui-bg-light);
    border-radius: 5px;
}

.dataTables_wrapper::-webkit-scrollbar-thumb,
.scroll-top-wrapper::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 5px;
    border: 2px solid var(--ui-bg-light);
}

.dataTables_wrapper::-webkit-scrollbar-thumb:hover,
.scroll-top-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.table-responsive {
    border-radius: var(--border-radius-md);
}

table.dataTable {
    border-collapse: collapse !important;
}

table.dataTable thead th {
    background: var(--ui-bg-light);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--card-border) !important;
    padding: 0.75rem 0.85rem !important;
    white-space: nowrap;
}

table.dataTable tfoot th,
table.dataTable tfoot td {
    background: var(--ui-bg-light);
    border-top: 1px solid var(--card-border) !important;
}

table.dataTable tfoot input,
table.dataTable tfoot select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    width: 100%;
}

table.dataTable tfoot input:focus,
table.dataTable tfoot select:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    outline: none;
}

table.dataTable tfoot input::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

table.dataTable tbody td {
    padding: 0.65rem 0.85rem !important;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(28, 48, 82, 0.06);
    color: var(--text-primary);
}

table.dataTable tbody tr {
    transition: background-color 0.1s ease;
}

table.dataTable tbody tr:hover td {
    background-color: rgba(59, 130, 246, 0.06) !important;
}

table.dataTable tbody tr.selected td {
    background-color: rgba(59, 130, 246, 0.12) !important;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 3px !important;
    margin: 0 1px;
    padding: 0.15em 0.45em !important;
    font-size: 0.72rem;
    min-width: 0;
    line-height: 1.4;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--ui-interaction) !important;
    border-color: var(--ui-interaction) !important;
    color: white !important;
    font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--card-border) !important;
    color: var(--brand-blue) !important;
}

/* DataTables BS5 pagination */
.dataTables_wrapper .pagination {
    margin: 0;
    gap: 2px;
}
.dataTables_wrapper .pagination .page-link {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px !important;
    border: 1px solid var(--card-border);
    color: var(--brand-blue);
    background: #fff;
    line-height: 1.4;
}
.dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--ui-interaction);
    border-color: var(--ui-interaction);
    color: #fff;
    font-weight: 600;
}
.dataTables_wrapper .pagination .page-link:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--card-border);
    color: var(--brand-blue);
}
.dataTables_wrapper .pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    opacity: 0.5;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

table.dataTable td img {
    max-width: 50px;
    max-height: 40px;
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar-ic {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 0.6rem 1rem;
    box-shadow: var(--card-shadow);
    margin-bottom: var(--space-md);
}

/* Toolbar groups: visually separated sections */
.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: rgba(28, 48, 82, 0.03);
    border: 1px solid rgba(28, 48, 82, 0.08);
}

.toolbar-group-acciones {
    flex-direction: row;
    gap: 0.35rem;
    background: transparent;
    border: none;
    padding: 0;
}

.toolbar-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-blue);
    opacity: 0.6;
    line-height: 1;
}

/* Labeled selects (Fungible / Prestable) */
.toolbar-labeled-select {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.toolbar-labeled-select label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
    line-height: 1;
}

.toolbar-labeled-select .form-select {
    padding: 0.2rem 1.8rem 0.2rem 0.4rem;
    font-size: 0.78rem;
    min-width: 70px;
}

/* Date range */
.toolbar-date-range .input-group-text {
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    white-space: nowrap;
    color: var(--text-muted);
    background: var(--card-bg);
    border-color: var(--input-border);
}

.toolbar-date-range .form-control {
    max-width: 140px;
    font-size: 0.78rem;
    padding: 0.2rem 0.35rem;
}

/* Ubicación group selects */
.toolbar-group-ubicacion .form-select {
    font-size: 0.78rem;
    padding: 0.2rem 1.8rem 0.2rem 0.4rem;
}

/* Active filter highlight */
.toolbar-group.toolbar-group-active {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.04);
}

/* Tom Select inside toolbar groups */
.toolbar-group .ts-wrapper,
.toolbar-labeled-select .ts-wrapper {
    min-width: 120px;
}
.toolbar-group .ts-wrapper .ts-control {
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    min-height: 0;
    border-color: #dee2e6;
}
.toolbar-group .ts-wrapper .ts-control .item {
    font-size: 0.78rem;
}
.toolbar-group .ts-wrapper .ts-dropdown {
    font-size: 0.8rem;
}
/* Tom Select inside modals */
.modal .ts-wrapper .ts-control {
    min-height: calc(1.5em + 0.75rem + 2px);
}
.modal .ts-dropdown .option {
    padding: 4px 10px;
}

/* Column filter select/input with active filter */
.column-search.column-search-active,
.filters-row select.column-search-active,
.filters-row input.column-search-active {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.04) !important;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.2) !important;
}

/* ============================================
   CENTRO INFO (config page)
   ============================================ */
.centro-info-header {
    background: rgba(28, 48, 82, 0.04);
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    user-select: none;
}
.centro-info-header:hover {
    background: rgba(28, 48, 82, 0.07);
}
.centro-logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 130px;
}
.centro-logo-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--card-border);
    border-radius: var(--border-radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafbfc;
}
.centro-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.centro-logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.centro-logo-placeholder i {
    font-size: 1.5rem;
    opacity: 0.4;
}
.centro-logo-actions {
    display: flex;
    gap: 0.3rem;
}
.centro-logo-actions .btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}
.centro-info-table {
    font-size: 0.82rem;
}
.centro-info-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
}
.centro-info-table td {
    padding: 0.4rem 0.3rem;
    vertical-align: middle;
}
.centro-info-table .form-control-sm {
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
}

/* ============================================
   SELECTION BAR (inventario list)
   ============================================ */
.selection-bar {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--border-radius-md, 6px);
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    animation: selectionBarSlide 0.2s ease;
}
@keyframes selectionBarSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.selection-bar-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ui-interaction, #3b82f6);
}
.selection-bar-count i {
    color: var(--ui-interaction, #3b82f6);
}

/* Checkbox column */
td.select-checkbox {
    cursor: pointer;
    text-align: center;
    vertical-align: middle;
}
th .dt-select-all {
    cursor: pointer;
}

/* ============================================
   ETIQUETAS MODAL (full filtered list)
   ============================================ */
.etiquetas-modal-toolbar {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--card-border, #dee2e6);
    background: rgba(28, 48, 82, 0.02);
}
.etiquetas-modal-count {
    font-size: 0.78rem;
    color: var(--text-muted, #6c757d);
}
.etiquetas-modal-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Plantillas modal: generating state (keeps button visible, not dimmed) */
.plt-generating {
    opacity: 1 !important;
    cursor: wait !important;
}
.etq-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: background 0.1s;
    margin: 0;
}
.etq-item:hover {
    background: rgba(59, 130, 246, 0.04);
}
.etq-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary, #1a1a2e);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.etq-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted, #6c757d);
    white-space: nowrap;
}

/* Estado badges inside etiquetas modal (units mode) */
.etq-badge-estado {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-weight: 600;
    line-height: 1;
    vertical-align: middle;
}
.etq-badge-disponible { background: #dcfce7; color: #166534; }
.etq-badge-prestado   { background: #fef3c7; color: #92400e; }
.etq-badge-baja       { background: #fee2e2; color: #991b1b; }

/* ============================================
   PLANTILLAS SELECTOR
   ============================================ */
.plantillas-selector {
    display: inline-block;
    position: relative;
}
.plantillas-toggle-btn {
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    border-color: var(--card-border, #dee2e6);
    color: var(--brand-blue, #1c3052);
}
.plantillas-toggle-btn:hover {
    background: rgba(28, 48, 82, 0.06);
    border-color: var(--brand-blue, #1c3052);
    color: var(--brand-blue, #1c3052);
}
.plantillas-toggle-chevron {
    transition: transform 0.2s;
}
.plantillas-panel {
    margin-top: 0.4rem;
}
.plantillas-panel-inner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    background: rgba(28, 48, 82, 0.03);
    border: 1px solid var(--card-border, #dee2e6);
    border-radius: var(--border-radius-sm, 6px);
}
.plantillas-select {
    min-width: 180px;
    max-width: 280px;
    font-size: 0.78rem;
}
.plantillas-btn-descargar,
.plantillas-btn-imprimir {
    font-size: 0.78rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}
/* In DT toolbar (batch mode, moved by JS into .dt-buttons) */
.dt-buttons .plantillas-selector {
    display: inline-block;
    vertical-align: middle;
}
.dt-buttons .plantillas-selector .plantillas-toggle-btn {
    /* Match DT button look */
    font-size: 0.78rem;
    padding: 0.25rem 0.6rem;
    border-color: var(--card-border, #dee2e6);
    color: var(--brand-blue, #1c3052);
}
.dt-buttons .plantillas-selector .plantillas-panel {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10;
    min-width: 380px;
}
.dt-buttons .plantillas-selector .plantillas-panel-inner {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
/* In ficha show.php, selector goes inline with action buttons */
.d-flex > .plantillas-selector {
    align-self: center;
}
.d-flex > .plantillas-selector .plantillas-panel {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 10;
    min-width: 380px;
}
.d-flex > .plantillas-selector .plantillas-panel-inner {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ============================================
   FICHAS SINGLE PANEL (breadcrumb collapse)
   ============================================ */
.fichas-single-panel {
    margin-bottom: 1rem;
}
.fichas-single-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border, #dee2e6);
    border-radius: var(--border-radius-md);
}
.fichas-single-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #64748B);
    white-space: nowrap;
}
.fichas-single-select {
    flex: 1;
    min-width: 200px;
    font-size: 0.85rem;
}
.fichas-single-btn-descargar,
.fichas-single-btn-imprimir {
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
}

/* ============================================
   UNIDADES PANEL (ficha detail)
   ============================================ */
.unidades-panel {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    background: var(--card-bg);
    overflow: hidden;
}

/* DataTable toolbar inside panel */
.unidades-panel .dt-toolbar-row {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.78rem;
}

.unidades-panel .dt-toolbar-row .dt-buttons {
    gap: 0.3rem;
}

.unidades-panel .dataTables_filter input {
    font-size: 0.78rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.unidades-info-row {
    padding: 0.2rem 0.6rem;
    background: rgba(28, 48, 82, 0.025);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.unidades-panel .dataTables_info {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0;
}

.unidades-dt-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.3rem 0.6rem;
    border-top: 1px solid var(--card-border);
    background: rgba(0,0,0,0.015);
}

.unidades-dt-bottom .dataTables_paginate .paginate_button {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.72rem !important;
}

/* Table compact styles */
.unidades-table {
    font-size: 0.78rem;
    margin: 0 !important;
}

.unidades-table thead th {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid var(--card-border);
    background: transparent;
    white-space: nowrap;
}

.unidades-table tbody td {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
}

.unidades-table tbody tr.selected {
    background: rgba(28, 48, 82, 0.08) !important;
}

.unidades-table tbody tr.selected td {
    background: transparent;
}

.unidades-table .row-baja {
    opacity: 0.45;
}

.unidades-table .row-baja:hover,
.unidades-table .row-baja.selected {
    opacity: 0.7;
}

.ut-id { width: 45px; }

.ut-barcode {
    font-size: 0.72rem;
    padding: 0.1rem 0.3rem;
    background: rgba(0,0,0,0.04);
    border-radius: 3px;
    color: var(--text-primary);
}

.ut-link { font-size: 0.75rem; }

.badge-sm {
    font-size: 0.62rem;
    padding: 0.15em 0.45em;
}

/* ============================================
   FORMS - IC v2.1
   ============================================ */
.form-control,
.form-select {
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    background: white;
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

/* ============================================
   ALERTS - IC v2.1
   ============================================ */
.alert {
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    border: none;
    padding: var(--space-md) var(--space-lg);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--ui-success);
    color: #065f46;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--ui-error);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--ui-warning);
    color: #92400e;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--ui-interaction);
    color: #1e40af;
}

/* ============================================
   BADGES
   ============================================ */
.badge-alta {
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 50rem;
}

.badge-baja {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 50rem;
}

.badge-estado {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25em 0.65em;
    border-radius: 50rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Solicitudes - Estado badges */
.badge-estado-pendiente {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
}

.badge-estado-aprobada {
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.badge-estado-rechazada {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

.badge-estado-completada {
    background: rgba(59, 130, 246, 0.15);
    color: #1e40af;
}

/* Solicitudes - Prioridad badges */
.badge-prioridad-alta {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

.badge-prioridad-media {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
}

.badge-prioridad-normal {
    background: rgba(156, 163, 175, 0.2);
    color: #4b5563;
}

/* (Solicitudes active state now covered by generic .btn-group .btn-ic-outline.active) */

/* ============================================
   LOADING ALERT (tabla cargando)
   ============================================ */
.loading-alert {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: var(--space-xl) var(--space-2xl);
    box-shadow: var(--card-shadow);
    max-width: 400px;
    margin: var(--space-2xl) auto;
}

.loading-alert .spinner-border {
    color: var(--ui-interaction);
}

/* ============================================
   DATATABLE EDITOR OVERRIDES - IC v2.1
   ============================================ */

/* Editor form styling */
div.DTE {
    font-family: var(--font-main);
}

div.DTE div.DTE_Header {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%) !important;
    color: white !important;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: var(--space-md) var(--space-lg);
    font-weight: 600;
}

div.DTE div.DTE_Footer {
    background: var(--ui-bg-light);
    border-top: 1px solid var(--card-border);
    padding: var(--space-md) var(--space-lg);
}

div.DTE div.DTE_Body {
    padding: var(--space-lg);
}

div.DTE div.DTE_Body div.DTE_Body_Content {
    max-height: 65vh;
    overflow-y: auto;
}

div.DTE div.DTE_Body label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

div.DTE div.DTE_Body input,
div.DTE div.DTE_Body select,
div.DTE div.DTE_Body textarea {
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--input-bg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

div.DTE div.DTE_Body input:focus,
div.DTE div.DTE_Body select:focus,
div.DTE div.DTE_Body textarea:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    background: white;
}

/* Editor buttons */
div.DTE div.DTE_Footer button.btn {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1.25rem;
}

/* Inline editing */
div.DTE_Inline {
    vertical-align: middle !important;
}

div.DTE_Inline input,
div.DTE_Inline select {
    border: 1px solid var(--input-border-focus) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 0.85rem !important;
    background: white !important;
    box-shadow: var(--input-shadow-focus) !important;
}

div.DTE_Inline button {
    background: var(--ui-interaction) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 0.85rem !important;
    cursor: pointer;
}

/* Highlight animation on edit */
table.dataTable tr.highlight {
    animation: dte-highlight 1s ease;
}

@keyframes dte-highlight {
    0%   { box-shadow: 0 0 0 rgba(59, 130, 246, 1); }
    50%  { box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
    100% { box-shadow: 0 0 0 rgba(59, 130, 246, 0); }
}

/* Editor two-column layout */
.dte-two-column .DTE_Form_Content {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1.25rem;
}

.dte-two-column .DTE_Form_Content > div.DTE_Field {
    min-width: 0;
}

/* Override Bootstrap row/col inside fields for stacked label+input */
.dte-two-column .DTE_Field.row {
    flex-direction: column !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.dte-two-column .DTE_Field > label.col-lg-4 {
    flex: 0 0 auto !important;
    max-width: 100% !important;
    width: 100% !important;
    text-align: left !important;
    padding-bottom: 0.15rem;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.dte-two-column .DTE_Field > div.col-lg-8 {
    flex: 0 0 auto !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Textarea spans full width (both columns) */
.dte-two-column .DTE_Form_Content > div.DTE_Field_Type_textarea {
    grid-column: 1 / -1;
}

/* Wider modal for two-column layout */
.dte-two-column.modal-content {
    max-width: 750px;
}

.modal-dialog:has(.dte-two-column) {
    max-width: 750px;
}

/* Also handle DTED_Lightbox if used */
.DTED_Lightbox_Wrapper:has(.dte-two-column) {
    max-width: 750px !important;
}

/* Responsive: single column on narrow screens */
@media (max-width: 576px) {
    .dte-two-column .DTE_Form_Content {
        grid-template-columns: 1fr;
    }
}

/* Tipo de bien: highlighted fields at top of Editor form */
.dte-two-column .DTE_Form_Content > div.DTE_Field.dte-field-tipo-bien {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid #c5d5f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
}

.dte-two-column .DTE_Form_Content > div.DTE_Field.dte-field-tipo-bien > label {
    font-weight: 600;
    color: var(--primary, #2563eb);
    font-size: 0.9rem;
}

.dte-two-column .DTE_Form_Content > div.DTE_Field.dte-field-tipo-bien select {
    font-weight: 500;
    border-color: #a3bffa;
}

/* Prestable-dependent fields: hidden by default, shown via parent class */
div.DTE .DTE_Field.dte-field-prestable-dep {
    display: none !important;
}
div.DTE.dte-prestable-visible .DTE_Field.dte-field-prestable-dep {
    display: block !important;
}

/* Selected row styling */
table.dataTable tbody tr.selected td {
    background-color: rgba(59, 130, 246, 0.1) !important;
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

/* DataTable toolbar: buttons + length + search in one row */
.dt-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.dt-toolbar-row div.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 0;
}

.dt-toolbar-info {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin: 0 auto;
}

.dt-toolbar-row .dataTables_info {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.dt-toolbar-row .dataTables_length {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin-left: auto;
}

.dt-toolbar-row .dataTables_length select {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--input-bg);
    margin: 0 4px;
}

.dt-toolbar-row .dataTables_filter {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.dt-toolbar-row .dataTables_filter input {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    margin-left: 4px;
}

.dt-toolbar-row .dataTables_filter input:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    outline: none;
}

div.dt-buttons .btn {
    font-size: 0.8rem !important;
    padding: 0.35rem 0.85rem;
}

div.dt-buttons .btn-separator {
    width: 1px;
    background: #94a3b8;
    align-self: stretch;
    padding: 0;
    margin: 0 6px;
    border: none;
}

/* Export dropdown (collection) */
div.dt-button-collection {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 4px 0;
    min-width: 160px;
}
div.dt-button-collection .dt-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 14px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary, #1e293b);
    font-size: 0.85rem;
    transition: background 0.15s;
}
div.dt-button-collection .dt-button:hover {
    background: #f1f5f9;
}
div.dt-button-collection .dt-button i {
    width: 18px;
    text-align: center;
    margin-right: 6px;
}

/* Column search filters in header row 2 */
.filters-row th {
    padding: 4px 6px !important;
    background: white !important;
    border-bottom: 2px solid var(--card-border) !important;
}

.filters-row input.column-search,
.filters-row select.column-search {
    border: 1px solid var(--input-border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.78rem;
    color: var(--text-primary);
    background: var(--input-bg);
    width: 100%;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filters-row input.column-search:focus,
.filters-row select.column-search:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    outline: none;
    background: white;
}

.filters-row input.column-search::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

/* ID column min-width */
.dt-col-id { min-width: 70px; }

/* SearchBuilder styling */
#searchbuilder-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--card-shadow);
}

#searchbuilder-container .dtsb-group {
    border: 1px solid var(--card-border) !important;
    border-radius: var(--border-radius-sm) !important;
    background: var(--ui-bg-light) !important;
    padding: var(--space-sm) !important;
}

#searchbuilder-container select,
#searchbuilder-container input {
    border: 1px solid var(--input-border) !important;
    border-radius: 4px !important;
    font-size: 0.8rem !important;
    padding: 4px 8px !important;
}

/* All action buttons share btn-ic-outline style — no colored export buttons */

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--card-shadow-hover);
}

.modal-header {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: var(--space-md) var(--space-lg);
}

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

/* ============================================
   LOGIN PAGE - Split layout
   ============================================ */
body.login-body-full {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--brand-blue);
}

.login-page {
    min-height: 100vh;
    display: flex;
}

.login-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* --- Hero Panel (left) --- */
.login-hero {
    flex: 1 1 55%;
    background: linear-gradient(160deg, #1C3052 0%, #0f1d33 50%, #162844 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(44, 181, 160, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-hero::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-hero-content {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.login-hero-brand {
    margin-bottom: 2.5rem;
}

.login-hero-logo {
    width: 56px;
    height: 56px;
    background: rgba(44, 181, 160, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #2cb5a0;
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
    user-select: none;
}

.login-hero-logo:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.login-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 0.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.login-hero h1 .brand-dot {
    color: var(--brand-red);
}

.login-hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    margin: 0;
}

/* Features list */
.login-hero-features {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.login-feature-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: rgba(44, 181, 160, 0.12);
    border: 1px solid rgba(44, 181, 160, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2cb5a0;
    font-size: 0.95rem;
}

.login-feature strong {
    display: block;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.login-feature span {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.login-hero-footer {
    position: relative;
    z-index: 1;
    margin-top: 3rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-ens-badge {
    height: 56px;
    width: auto;
    border-radius: 4px;
    opacity: 0.85;
    transition: opacity var(--transition-fast);
}

.login-ens-badge:hover {
    opacity: 1;
}

.login-hero-footer a {
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.login-hero-footer a:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* --- Form Panel (right) --- */
.login-form-panel {
    flex: 0 0 45%;
    max-width: 520px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.login-form-inner {
    width: 100%;
    max-width: 380px;
}

.login-form-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-form-logo img {
    height: 64px;
    width: auto;
}

.login-form-header {
    margin-bottom: 1.75rem;
}

.login-form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin: 0 0 0.35rem;
}

.login-form-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Form fields */
.login-form-panel .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.login-form-panel .form-control {
    background: var(--ui-bg-light);
    border: 1px solid rgba(28, 48, 82, 0.1);
    border-radius: var(--border-radius-sm);
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.login-form-panel .form-control:focus {
    border-color: var(--ui-interaction);
    background: #ffffff;
    box-shadow: var(--input-shadow-focus);
}

.login-form-panel .form-control::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Login messages */
.login-msg {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    letter-spacing: 0.01em;
    line-height: 1.45;
    animation: loginMsgSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginMsgSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-msg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 0.75rem;
    margin-top: 1px;
}

.login-msg i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.login-msg-text strong {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.login-msg-text span {
    font-weight: 400;
    font-size: 0.78rem;
    opacity: 0.85;
}

.login-msg a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.login-msg a:hover {
    opacity: 0.8;
}

.login-msg-success {
    background: rgba(16, 185, 129, 0.07);
    color: #065f46;
    border-left: 3px solid var(--ui-success);
}

.login-msg-success .login-msg-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--ui-success);
}

.login-msg-error {
    background: rgba(239, 68, 68, 0.05);
    color: #991b1b;
    border-left: 3px solid var(--ui-error);
}

.login-msg-error .login-msg-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ui-error);
}

.login-msg-warning {
    background: rgba(245, 158, 11, 0.06);
    color: #92400e;
    border-left: 3px solid var(--ui-warning);
}

.login-msg-warning .login-msg-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--ui-warning);
}

.login-msg-info {
    background: rgba(28, 48, 82, 0.04);
    color: var(--brand-blue);
    border-left: 3px solid var(--brand-blue);
}

.login-msg-info .login-msg-icon {
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
}

/* Button */
.login-btn {
    background: var(--brand-blue);
    color: #ffffff;
    border: none;
    font-weight: 600;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    width: 100%;
    transition: all var(--transition-base);
    letter-spacing: 0.01em;
}

.login-btn:hover {
    background: #243d5e;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(28, 48, 82, 0.3);
    transform: translateY(-1px);
}

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

/* Connected info badge */
.login-connected-info {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--ui-bg-light);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* Form footer */
.login-form-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(28, 48, 82, 0.08);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.login-form-footer a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.login-form-footer a:hover {
    color: var(--brand-blue);
}

/* --- Centro verification display --- */
.centro-seleccionado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f0f7ff;
    border: 1px solid var(--brand-blue, #1a5276);
    border-radius: 8px;
    font-size: 0.9rem;
}

.centro-seleccionado-info {
    display: flex;
    align-items: center;
    min-width: 0;
}

.centro-seleccionado-info span:first-of-type {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-centro-cambiar {
    background: none;
    border: none;
    color: var(--brand-blue, #1a5276);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.btn-centro-cambiar:hover {
    background: rgba(26, 82, 118, 0.1);
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    body.login-body-full {
        overflow: auto;
    }

    .login-split {
        flex-direction: column;
        min-height: auto;
    }

    .login-hero {
        flex: none;
        padding: 2rem 1.5rem;
    }

    .login-hero h1 {
        font-size: 1.5rem;
    }

    .login-hero-subtitle {
        font-size: 0.92rem;
    }

    .login-hero-features {
        display: none;
    }

    .login-hero-footer {
        display: none;
    }

    .login-form-panel {
        flex: none;
        max-width: none;
        padding: 2rem 1.5rem;
        align-items: flex-start;
    }

    .login-form-inner {
        max-width: 420px;
        margin: 0 auto;
    }
}

@media (max-width: 575.98px) {
    .login-hero {
        padding: 1.5rem 1.25rem;
    }

    .login-hero h1 {
        font-size: 1.3rem;
    }

    .login-form-panel {
        padding: 1.5rem 1.25rem;
    }
}

/* ============================================
   ARTICLE DETAIL
   ============================================ */
.detail-field {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    min-height: 60px;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value a {
    color: var(--ui-interaction);
}

.detail-value.empty {
    color: var(--text-tertiary);
    font-style: italic;
    font-weight: 400;
}

/* ============================================
   CONFIG CARDS
   ============================================ */
.config-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    transition: all var(--transition-smooth);
    height: 100%;
}

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

.config-card .config-icon {
    font-size: 2.5rem;
    color: var(--icon-stroke);
    margin-bottom: var(--space-md);
}

/* ============================================
   FOOTER - IC v2.1 (gestionv6 style)
   ============================================ */
.footer-ic {
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    padding: var(--space-lg) var(--space-xl);
    margin-top: auto;
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* Logo y Copyright */
.footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.footer-logo {
    display: flex;
    align-items: baseline;
    gap: 1px;
    text-decoration: none;
    transition: transform var(--transition-fast);
}

.footer-logo:hover {
    transform: scale(1.05);
    text-decoration: none;
}

.footer-logo-e {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-blue);
    letter-spacing: -0.5px;
}

.footer-logo-dot {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-red);
    transition: transform var(--transition-fast);
}

.footer-logo:hover .footer-logo-dot {
    transform: scale(1.2);
}

.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.footer-brand {
    color: var(--text-primary);
    font-weight: 600;
}

/* Links centrales */
.footer-center {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.footer-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.footer-nav-link:hover {
    color: var(--ui-interaction);
    background: rgba(59, 130, 246, 0.08);
    text-decoration: none;
}

.footer-nav-link .fa-solid {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.footer-nav-link:hover .fa-solid {
    opacity: 1;
}

/* Links legales y version */
.footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.footer-legal {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-legal a {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: var(--space-xs) 0;
}

.footer-legal a:hover {
    color: var(--ui-interaction);
}

.footer-separator {
    color: var(--text-tertiary);
    opacity: 0.4;
    font-size: 0.65rem;
}

.footer-version {
    font-size: 0.7rem;
    color: white;
    background: var(--brand-red);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.footer-version:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(231, 60, 30, 0.3);
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.3;
    color: var(--text-tertiary) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .nav-btn span {
        display: none;
    }
    .nav-btn {
        padding: 10px 12px;
    }
    .logo-product {
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 992px) {
    .header-container {
        height: 56px;
        padding: 0 var(--space-md);
        gap: var(--space-md);
    }

    .logo-product {
        display: none;
    }

    .header-user-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }

    .btn-config {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Footer responsive 992px */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-lg);
    }

    .footer-left,
    .footer-center,
    .footer-right {
        width: 100%;
        justify-content: center;
    }

    .footer-center {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .module-card {
        padding: var(--space-lg) var(--space-md);
    }

    .module-card .module-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    table.dataTable td img {
        max-width: 40px;
        max-height: 30px;
    }

    .stat-card .stat-number {
        font-size: 1.35rem;
    }

    .header-container {
        height: 52px;
    }

    .logo-e, .logo-dot {
        font-size: 1.5rem;
    }

    /* Footer responsive 768px */
    .footer-ic {
        padding: var(--space-md);
    }

    .footer-left {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .footer-copyright {
        font-size: 0.75rem;
    }

    .footer-nav-link span {
        display: none;
    }

    .footer-nav-link {
        padding: var(--space-sm);
    }

    .footer-nav-link .fa-solid {
        font-size: 1rem;
    }

    .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   FICHA (Article Detail) - gestionv6 style
   ============================================ */

/* Header bar - dark blue gradient */
.ficha-header-bar {
    background: linear-gradient(135deg, var(--brand-blue, #1C3052) 0%, #263f66 100%);
    color: #fff;
    padding: 0.7rem 1.25rem;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ficha-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ficha-header-title i {
    font-size: 1rem;
    opacity: 0.7;
}
.ficha-header-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(255,255,255,0.18);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.ficha-header-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ficha-header-btn {
    font-size: 0.78rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* Tabs bar - pill style */
.ficha-tabs-bar {
    background: var(--ui-bg-light, #F5F7FA);
    border: 1px solid var(--card-border, #dee2e6);
    border-top: none;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}
.ficha-nav {
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ficha-nav .nav-item {
    margin: 0;
}
.ficha-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #64748B);
    background: transparent;
    border: none;
    border-radius: 5px;
    padding: 0.45rem 0.85rem;
    margin: 0.35rem 0.15rem;
    transition: all 0.15s ease;
    cursor: pointer;
}
.ficha-nav .nav-link:hover {
    color: var(--brand-blue, #1C3052);
    background: rgba(28, 48, 82, 0.10);
}
.ficha-nav .nav-link.active {
    color: var(--brand-blue, #1C3052);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Action buttons in tabs bar */
.ficha-tabs-bar .btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
}
.ficha-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(28, 48, 82, 0.12);
    color: var(--brand-blue, #1C3052);
}
.ficha-nav .nav-link.active .ficha-tab-badge {
    background: rgba(28, 48, 82, 0.12);
    color: var(--brand-blue, #1C3052);
}

/* Tab content body */
.ficha-body {
    background: var(--ui-bg-light, #F5F7FA);
    border-left: 1px solid var(--card-border, #dee2e6);
    border-right: 1px solid var(--card-border, #dee2e6);
    min-height: 200px;
}
.ficha-body > .tab-pane {
    padding: 0;
}

/* Padding wrapper for documents tab */
.ficha-tab-pad {
    padding: 1rem 1.25rem;
}

/* Data fields - 12-column grid (like Bootstrap) */
.ficha-fields-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.5rem;
    padding: 1rem 1.25rem;
}
.ficha-field-card {
    background: #fff;
    border: 1px solid var(--card-border, #dee2e6);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    min-height: 0;
    /* grid-column: span X set inline via data-ancho */
}
.ficha-field-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 0.35rem;
}
.ficha-field-value {
    font-size: 0.85rem;
    color: var(--text-primary, #1C3052);
    word-break: break-word;
    line-height: 1.4;
}
.ficha-field-value.empty {
    color: #c0c5cc;
    font-style: italic;
}

/* Inline editing */
.ficha-field-editable {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ficha-field-editable:hover {
    border-color: var(--ui-interaction, #3B82F6);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}
.ficha-inline-editor {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin-top: 0.2rem;
    flex: 1;
}
.ficha-inline-input {
    flex: 1;
    font-size: 0.82rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--input-border, #cbd5e1);
    border-radius: 4px;
    background: #fff;
    color: var(--text-primary, #1C3052);
    outline: none;
    font-family: inherit;
    min-width: 0;
}
.ficha-inline-input:focus {
    border-color: var(--ui-interaction, #3B82F6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
textarea.ficha-inline-input {
    resize: vertical;
    min-height: 60px;
}
select.ficha-inline-input {
    cursor: pointer;
}
.ficha-inline-actions {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
    padding-top: 1px;
}
.ficha-inline-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: background 0.12s;
}
.ficha-inline-btn.save {
    background: var(--ui-success, #10B981);
    color: #fff;
}
.ficha-inline-btn.save:hover {
    background: #059669;
}
.ficha-inline-btn.cancel {
    background: #e5e7eb;
    color: #6b7280;
}
.ficha-inline-btn.cancel:hover {
    background: #d1d5db;
}
.ficha-inline-editor.saving {
    opacity: 0.5;
    pointer-events: none;
}
.ficha-field-saved {
    animation: fieldSaved 0.8s ease;
}
@keyframes fieldSaved {
    0% { background: rgba(16, 185, 129, 0.12); }
    100% { background: #fff; }
}

/* Footer - centered close button */
.ficha-footer {
    background: var(--ui-bg-light, #F5F7FA);
    border: 1px solid var(--card-border, #dee2e6);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 0.5rem 1.25rem;
    display: flex;
    justify-content: center;
}

.ficha-footer .btn {
    font-size: 0.78rem;
    padding: 0.3rem 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .ficha-fields-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .ficha-field-card {
        grid-column: span 3 !important;
    }
    .ficha-header-bar {
        flex-wrap: wrap;
    }
}
@media (max-width: 480px) {
    .ficha-fields-grid {
        grid-template-columns: 1fr;
    }
    .ficha-field-card {
        grid-column: span 1 !important;
    }
    .ficha-header-title {
        font-size: 0.85rem;
    }
    .ficha-tabs-bar {
        flex-wrap: wrap;
        padding: 0 0.5rem;
    }
    .ficha-nav .nav-link {
        font-size: 0.72rem;
        padding: 0.35rem 0.6rem;
    }
}

/* ============================================
   DOCUMENT MANAGER (inside tab)
   ============================================ */

/* Drop Zone - compact inline */
.doc-dropzone {
    border: 1.5px dashed var(--card-border, #d1d5db);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    color: var(--text-muted, #6b7280);
    transition: all 0.15s ease;
    cursor: pointer;
}
.doc-dropzone-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.doc-dropzone-inner i {
    font-size: 1.25rem;
    color: var(--brand-blue, #1C3052);
    opacity: 0.4;
}
.doc-dropzone-inner span {
    font-size: 0.82rem;
}
.doc-dropzone-inner small {
    font-size: 0.7rem;
    color: #aaa;
    margin-left: auto;
}
.doc-dropzone a {
    color: var(--brand-blue, #1C3052);
    font-weight: 600;
    text-decoration: underline;
}
.doc-dropzone-active,
.doc-dropzone:hover {
    border-color: var(--brand-blue, #1C3052);
    background: rgba(28, 48, 82, 0.03);
}
.doc-dropzone-active .doc-dropzone-inner i {
    opacity: 1;
}

/* URL upload link + inline form */
.doc-url-link {
    font-size: 0.75rem;
    color: var(--brand-blue, #1C3052) !important;
    opacity: 0.6;
    text-decoration: none !important;
    transition: opacity 0.15s;
}
.doc-url-link:hover {
    opacity: 1;
}
.doc-url-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.2rem;
}
.doc-url-form .form-control {
    font-size: 0.78rem;
    flex: 1;
    min-width: 0;
}

/* Section titles */
.doc-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.doc-section-title .badge {
    font-size: 0.65rem;
    font-weight: 500;
}

/* Image Gallery Grid */
.doc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
}
.doc-gallery-item {
    position: relative;
    border: 1px solid var(--card-border, #d1d5db);
    border-radius: 5px;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.doc-gallery-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.doc-gallery-link {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6;
}
.doc-gallery-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}
.doc-gallery-item:hover .doc-gallery-link img {
    transform: scale(1.05);
}
.doc-gallery-info {
    padding: 0.25rem 0.4rem;
}
.doc-gallery-name {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-gallery-size {
    font-size: 0.62rem;
    color: var(--text-muted, #6b7280);
}
.doc-gallery-star {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.doc-gallery-item:hover .doc-gallery-star {
    opacity: 1;
}
.doc-gallery-star:hover {
    background: rgba(0, 0, 0, 0.6);
    color: #facc15;
}
.doc-gallery-star.active {
    opacity: 1;
    background: rgba(250, 204, 21, 0.9);
    color: #fff;
}
.doc-gallery-star.active:hover {
    background: rgba(234, 179, 8, 1);
}
.doc-gallery-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: white;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.doc-gallery-item:hover .doc-gallery-delete {
    opacity: 1;
}
.doc-gallery-delete:hover {
    background: rgba(185, 28, 28, 1);
}

/* File List */
.doc-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.doc-file-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--card-border, #e5e7eb);
    border-radius: 5px;
    transition: background 0.12s ease;
}
.doc-file-item:hover {
    background: #f9fafb;
}
.doc-file-icon {
    font-size: 1.3rem;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}
.doc-file-info {
    flex: 1;
    min-width: 0;
}
.doc-file-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--brand-blue, #1C3052);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-file-name:hover {
    text-decoration: underline;
}
.doc-file-size {
    font-size: 0.7rem;
    color: var(--text-muted, #6b7280);
}
.doc-file-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Responsive - Document Manager */
@media (max-width: 576px) {
    .doc-gallery {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.4rem;
    }
    .doc-file-icon {
        font-size: 1.1rem;
        width: 24px;
    }
    .doc-dropzone-inner small {
        display: none;
    }
}

/* ============================================
   CARGA RAPIDA (mobile-first quick capture)
   ============================================ */

.carga-rapida-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-md);
    min-height: calc(100vh - 140px);
}

/* Section layout */
.cr-section {
    background: var(--card-bg, white);
    border: 1px solid var(--card-border, #dee2e6);
    border-radius: var(--border-radius-md, 12px);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.cr-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #64748B);
    margin-bottom: var(--space-sm);
}

/* Photo capture area */
.foto-capture-area {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 2px dashed var(--card-border, #d1d5db);
    border-radius: var(--border-radius-sm, 8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    transition: border-color var(--transition-base, 200ms), background var(--transition-base, 200ms);
}

.foto-capture-area:hover {
    border-color: var(--ui-interaction, #3B82F6);
    background: rgba(59, 130, 246, 0.04);
}

.foto-capture-area.has-photo {
    border-style: solid;
    border-color: var(--ui-success, #10B981);
}

.foto-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.btn-remove-foto {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background var(--transition-fast, 150ms);
}

.btn-remove-foto:hover {
    background: rgba(220, 38, 38, 1);
}

/* Form inputs - touch-friendly */
.form-control-cr {
    padding: 12px 14px;
    font-size: 1rem;
    border-radius: var(--border-radius-sm, 8px);
    border: 1px solid var(--input-border, #cbd5e1);
    background: var(--input-bg, #f8fafc);
    transition: border-color var(--transition-fast, 150ms), box-shadow var(--transition-fast, 150ms);
    -webkit-appearance: none;
}

.form-control-cr:focus {
    border-color: var(--input-border-focus, #3B82F6);
    box-shadow: var(--input-shadow-focus, 0 0 0 3px rgba(59, 130, 246, 0.1));
    background: white;
    outline: none;
}

/* Quantity controls */
.cantidad-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 8px);
}

.cantidad-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
}

.cantidad-input {
    width: 80px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-cantidad {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--brand-blue, #1C3052);
    background: transparent;
    color: var(--brand-blue, #1C3052);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
    flex-shrink: 0;
}

.btn-cantidad:hover {
    background: var(--brand-blue, #1C3052);
    color: white;
}

.btn-cantidad:active {
    transform: scale(0.93);
}

.cantidad-presets {
    display: flex;
    gap: 6px;
}

.btn-preset {
    min-width: 44px;
    height: 36px;
    border: 1.5px solid var(--card-border, #dee2e6);
    border-radius: 18px;
    background: transparent;
    color: var(--text-secondary, #64748B);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms);
    padding: 0 12px;
}

.btn-preset:hover {
    border-color: var(--brand-blue, #1C3052);
    color: var(--brand-blue, #1C3052);
}

.btn-preset.active {
    background: var(--brand-blue, #1C3052);
    border-color: var(--brand-blue, #1C3052);
    color: white;
}

/* Save button */
.btn-guardar-captura {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm, 8px);
    background: linear-gradient(135deg, var(--brand-blue, #1C3052), #2a4a7f);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base, 200ms);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: var(--space-md);
}

.btn-guardar-captura:hover {
    box-shadow: 0 4px 16px rgba(28, 48, 82, 0.3);
    transform: translateY(-1px);
}

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

.btn-guardar-captura:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Success message */
.ultimo-guardado {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid var(--ui-success, #10B981);
    border-radius: var(--border-radius-md, 12px);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-primary, #1C3052);
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Desktop */
@media (min-width: 768px) {
    .carga-rapida-container {
        padding: var(--space-xl, 32px);
    }

    .foto-capture-area {
        aspect-ratio: 16 / 9;
    }
}

/* ============================================
   BANCO DE LIBROS - PRÉSTAMOS
   ============================================ */

/* Step icons (alumno, barcode) */
.prestamo-step-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Selected alumno badge */
.prestamo-alumno-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
}

.prestamo-alumno-badge .btn-close-sm {
    font-size: 0.55rem;
    padding: 0.3rem;
    opacity: 0.5;
}

.prestamo-alumno-badge .btn-close-sm:hover {
    opacity: 1;
}

/* Meta info chips in header */
.prestamo-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Empty state illustration */
.prestamo-empty-state {
    color: var(--text-tertiary);
    padding: var(--space-lg) 0;
}

.prestamo-empty-state i {
    font-size: 2.5rem;
    opacity: 0.25;
    display: block;
    margin-bottom: var(--space-md);
}

.prestamo-empty-state p {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

/* Observations collapsible */
.prestamo-obs-details summary {
    list-style: none;
    user-select: none;
}

.prestamo-obs-details summary::-webkit-details-marker {
    display: none;
}

.prestamo-obs-details summary::before {
    content: '\203A';
    display: inline-block;
    margin-right: 0.3rem;
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform var(--transition-fast);
}

.prestamo-obs-details[open] summary::before {
    transform: rotate(90deg);
}

/* Typeahead suggestion dropdown */
#buscarAlumno + .list-group,
#buscarAlumno ~ .list-group {
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow-hover);
    margin-top: 2px;
}

/* Footer with save button */
.prestamo-footer {
    padding: 0.75rem 1.25rem;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.prestamo-btn-guardar {
    padding: 0.6rem 2rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all var(--transition-base);
}

.prestamo-btn-guardar:disabled {
    background: transparent;
    border: 2px dashed rgba(28, 48, 82, 0.2);
    color: var(--text-tertiary);
    opacity: 1;
}

.prestamo-btn-guardar:not(:disabled) {
    box-shadow: 0 4px 12px rgba(28, 48, 82, 0.25);
}

.prestamo-btn-guardar:not(:disabled):hover {
    box-shadow: 0 6px 20px rgba(28, 48, 82, 0.35);
    transform: translateY(-1px);
}

/* Panel préstamos activos colapsable */
.prestamos-activos-panel summary {
    list-style: none;
    user-select: none;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.prestamos-activos-panel summary::-webkit-details-marker {
    display: none;
}

.prestamos-activos-panel summary::before {
    content: '\203A';
    display: inline-block;
    margin-right: 0.3rem;
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform var(--transition-fast);
}

.prestamos-activos-panel[open] summary::before {
    transform: rotate(90deg);
}

/* Responsive */
@media (max-width: 991.98px) {
    .prestamo-meta {
        display: none !important;
    }
}

/* ============================================
   MANUAL DE USUARIO
   ============================================ */

/* --- Layout --- */
.manual-container {
    display: flex;
    gap: var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* --- Sidebar --- */
.manual-sidebar {
    width: 260px;
    min-width: 260px;
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    padding: 0;
}

.manual-sidebar-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-blue);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--card-border);
}

.manual-nav {
    padding: var(--space-sm) 0;
}

.manual-nav-link {
    display: flex;
    align-items: center;
    padding: 8px var(--space-lg);
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.manual-nav-link:hover {
    color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.04);
    text-decoration: none;
}

.manual-nav-link.active {
    color: var(--brand-blue);
    font-weight: 600;
    border-left-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.06);
}

.manual-nav-sub {
    padding-left: calc(var(--space-lg) + 12px);
    font-size: 0.78rem;
}

.manual-nav-section {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: var(--space-md) var(--space-lg) 4px;
    margin-top: 4px;
}

/* --- Toggle boton movil --- */
.manual-sidebar-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-fixed);
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(28, 48, 82, 0.3);
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.manual-sidebar-toggle:hover {
    background: var(--brand-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(28, 48, 82, 0.4);
}

.manual-sidebar-toggle.active {
    background: var(--brand-red);
}

/* --- Contenido principal --- */
.manual-content {
    flex: 1;
    min-width: 0;
}

/* --- Secciones --- */
.manual-section {
    margin-bottom: var(--space-2xl);
    scroll-margin-top: 80px;
}

.manual-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--brand-blue);
}

.manual-section-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
    font-size: 1.2rem;
}

.manual-section-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--brand-blue);
    margin: 0;
}

.manual-section-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 2px 0 0;
}

/* --- Cards de contenido --- */
.manual-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--card-shadow);
}

.manual-card h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: var(--space-md);
}

.manual-card p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* --- Acordeones --- */
.manual-accordion .accordion-item {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm) !important;
    margin-bottom: 6px;
    overflow: hidden;
}

.manual-accordion .accordion-button {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand-blue);
    padding: 12px var(--space-lg);
    background: var(--bg-light);
}

.manual-accordion .accordion-button:not(.collapsed) {
    background: rgba(28, 48, 82, 0.06);
    color: var(--brand-blue);
    box-shadow: none;
}

.manual-accordion .accordion-button::after {
    width: 0.9rem;
    height: 0.9rem;
    background-size: 0.9rem;
}

.manual-accordion .accordion-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: var(--space-md) var(--space-lg);
}

.manual-accordion .accordion-body p {
    font-size: 0.85rem;
}

/* --- Pasos numerados --- */
.manual-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.manual-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.manual-step-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-blue);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.manual-step-content {
    flex: 1;
    padding-top: 4px;
}

.manual-step-content strong {
    display: block;
    font-size: 0.88rem;
    color: var(--brand-blue);
    margin-bottom: 4px;
}

.manual-step-content p {
    margin: 0;
    font-size: 0.83rem;
    line-height: 1.6;
}

/* --- Tips / Notas --- */
.manual-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--border-radius-sm);
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-md);
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.manual-tip > i {
    color: #F59E0B;
    font-size: 1rem;
    margin-top: 2px;
}

.manual-tip strong {
    color: var(--text-primary);
}

.manual-tip-info {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
}

.manual-tip-info > i {
    color: var(--ui-info, #3B82F6);
}

.manual-tip-warning {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
}

.manual-tip-warning > i {
    color: var(--ui-error, #EF4444);
}

/* --- Listas estilizadas --- */
.manual-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: var(--space-sm);
}

.manual-list li {
    position: relative;
    padding: 6px 0 6px 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.manual-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-blue);
}

/* --- Features grid (primeros pasos) --- */
.manual-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.manual-feature {
    display: flex;
    gap: 12px;
    padding: var(--space-md);
    border-radius: var(--border-radius-sm);
    background: var(--bg-light);
    border: 1px solid var(--card-border);
}

.manual-feature-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
    font-size: 1rem;
}

.manual-feature strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 2px;
}

.manual-feature p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
}

/* --- Navigation diagram (primeros pasos) --- */
.manual-nav-diagram {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: var(--space-md) 0;
}

.manual-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--space-md);
    border-radius: var(--border-radius-sm);
    background: var(--bg-light);
    border: 1px solid var(--card-border);
}

.manual-nav-badge {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    background: var(--brand-blue);
    color: white;
    font-size: 0.9rem;
}

.manual-nav-item strong {
    display: block;
    font-size: 0.85rem;
    color: var(--brand-blue);
}

.manual-nav-item span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* --- Tabla manual (roles) --- */
.manual-table {
    font-size: 0.83rem;
}

.manual-table th {
    font-weight: 700;
    color: var(--brand-blue);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-light);
}

.manual-table td {
    color: var(--text-secondary);
    vertical-align: middle;
}

/* --- Tricks grid --- */
.manual-tricks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.manual-trick {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    border-radius: var(--border-radius-md);
    background: var(--bg-light);
    border: 1px solid var(--card-border);
    transition: all var(--transition-smooth);
}

.manual-trick:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.manual-trick-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(28, 48, 82, 0.08);
    color: var(--brand-blue);
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
}

.manual-trick h6 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 6px;
}

.manual-trick p {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}

/* --- KBD styling --- */
.manual-card kbd {
    background: var(--bg-light);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.78rem;
    color: var(--brand-blue);
    font-family: var(--font-mono);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* --- Footer del manual --- */
.manual-footer {
    text-align: center;
    padding: var(--space-2xl) 0 var(--space-lg);
    border-top: 1px solid var(--card-border);
    margin-top: var(--space-xl);
}

.manual-footer-brand {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.manual-footer-brand .logo-e {
    color: var(--brand-blue);
}

.manual-footer-brand .logo-dot {
    color: var(--brand-red);
}

.manual-footer p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0;
}

/* --- Help button (navbar) --- */
.btn-help {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.05rem;
    transition: all var(--transition-smooth);
    text-decoration: none;
}

.btn-help:hover {
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.06);
    text-decoration: none;
}

.btn-help.active {
    color: var(--brand-blue);
    border-color: var(--brand-blue);
    background: rgba(28, 48, 82, 0.08);
}

/* --- Responsive manual --- */
@media (max-width: 991.98px) {
    .manual-sidebar {
        position: fixed;
        left: -300px;
        top: 64px;
        bottom: 0;
        width: 280px;
        min-width: 280px;
        z-index: var(--z-modal);
        border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
        transition: left var(--transition-smooth);
        max-height: none;
        height: auto;
    }

    .manual-sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .manual-features-grid {
        grid-template-columns: 1fr;
    }

    .manual-tricks-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-help {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }
}

@media (max-width: 575.98px) {
    .manual-card {
        padding: var(--space-lg);
    }

    .manual-section-header {
        gap: var(--space-sm);
    }

    .manual-section-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }

    .manual-section-title {
        font-size: 1rem;
    }

    .manual-tricks-grid {
        grid-template-columns: 1fr;
    }

    .manual-step-number {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 0.8rem;
    }
}

/* ============================================
   PRESTAMO FICHA
   ============================================ */
.prestamo-items-panel {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1.5rem;
}
.prestamo-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.prestamo-items-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--brand-blue);
}
.prestamo-items-table {
    margin: 0;
    font-size: 0.85rem;
}
.prestamo-items-table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    background: transparent;
}
.prestamo-items-table td {
    vertical-align: middle;
    padding: 0.6rem 0.75rem;
}
.prestamo-item-pendiente {
    border-left: 3px solid #f59e0b;
    background: #fffbeb;
}
.prestamo-item-devuelto {
    border-left: 3px solid #22c55e;
}
/* Badges de estado conservación en ficha prestamo */
.badge-estado-entrega {
    font-size: 0.7rem;
    padding: 0.2em 0.55em;
    font-weight: 600;
}
/* Modal devolución rápida */
.devolucion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.devolucion-item:last-child {
    border-bottom: none;
}
.devolucion-item-info {
    flex: 1;
    min-width: 0;
}
.devolucion-item-info strong {
    display: block;
    font-size: 0.85rem;
}
.devolucion-item-info code {
    font-size: 0.75rem;
    color: #64748b;
}
.devolucion-item select {
    width: auto;
    min-width: 130px;
    font-size: 0.8rem;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .header-ic, .footer-ic, .breadcrumb, .btn, .toolbar-ic {
        display: none !important;
    }
    body {
        background: white;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== Config Toggle Rows (modules, dashboard, etc.) ===== */
.modulo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: background 0.15s;
}
.modulo-row:hover {
    background: rgba(28, 48, 82, 0.02);
}
.modulo-row-last {
    border-bottom: none;
}
.modulo-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.modulo-icon {
    font-size: 1.1rem;
    color: var(--brand-blue);
    width: 28px;
    text-align: center;
}
.modulo-icon-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.modulo-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-dark, #1a1a2e);
}
.modulo-desc {
    font-size: 0.72rem;
    color: var(--text-muted, #6c757d);
    margin-top: 1px;
}
.modulo-subgroup {
    border-left: 3px solid rgba(28, 48, 82, 0.12);
    margin-left: 1.2rem;
    transition: opacity 0.3s;
}
.modulo-subgroup .modulo-row {
    padding-left: 1rem;
}
.modulo-sub .modulo-name {
    font-size: 0.82rem;
    font-weight: 500;
}
.modulo-sub .modulo-desc {
    font-size: 0.68rem;
}
.form-check-input:checked {
    background-color: var(--brand-blue, #1c3052);
    border-color: var(--brand-blue, #1c3052);
}
.modulo-toggle {
    width: 2.5em;
    height: 1.3em;
    cursor: pointer;
}
.modulo-toggle-saving {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Dashboard Stats ===== */
@keyframes statsFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes statsPulseIn {
    0%   { opacity: 0; transform: scale(0.92); }
    60%  { opacity: 1; transform: scale(1.03); }
    100% { transform: scale(1); }
}
.kpi-card {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 1.2rem;
    background: var(--card-bg);
    transition: box-shadow var(--transition-base), transform 0.18s ease;
    opacity: 0;
    animation: statsFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--stagger, 0ms);
}
.kpi-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.kpi-icon {
    font-size: 1.4rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
}
.kpi-card:hover .kpi-icon {
    transform: scale(1.15);
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.chart-card {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 1.2rem;
    background: var(--card-bg);
    opacity: 0;
    animation: statsFadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--stagger, 0ms);
}
.chart-card canvas {
    max-height: 280px;
}
.kpi-pct {
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: 0.3rem;
    opacity: 0.7;
}
.stats-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    animation: statsFadeUp 0.4s ease forwards;
    animation-delay: var(--stagger, 0ms);
}
/* Skeleton loading for stats page */
.stats-skeleton-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.stats-skeleton-card {
    flex: 1;
    height: 88px;
    border-radius: var(--border-radius-md);
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--card-border) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}
.stats-skeleton-chart {
    height: 240px;
    border-radius: var(--border-radius-md);
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--card-border) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ===== Libro de Inventario — Generador ===== */

.libro-seccion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.libro-seccion-item:last-child {
    border-bottom: none;
}

.libro-seccion-item:hover {
    background: rgba(28, 48, 82, 0.03);
}

.libro-seccion-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.libro-seccion-disabled:hover {
    background: transparent;
}

.libro-seccion-info {
    flex: 1;
}

.libro-seccion-nombre {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.libro-seccion-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.libro-deptos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.libro-columnas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}

.libro-col-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.88rem;
}

/* ============================================
 * LISTADOS DE LIBROS DE TEXTO
 * ============================================ */

.listado-campana-card {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.listado-campana-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(28, 48, 82, 0.12);
    border-color: var(--brand-blue);
}

/* Summary bar */
#summaryBar {
    border: 1px solid var(--card-border);
    font-size: 0.8rem;
}

/* Entry form ISBN search result */
#isbnResult .alert {
    border-radius: 6px;
}

/* Campaign header badges */
.listado-campana-card .badge {
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}

/* ============================================
   SOLICITUD SHOW — Stepper, Stats, Comments, Timeline
   ============================================ */

/* --- Solicitud header meta grid --- */
.sol-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 0.82rem;
    color: #64748b;
}
.sol-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sol-meta-item i {
    color: #94a3b8;
    font-size: 0.75rem;
    width: 14px;
    text-align: center;
}
.sol-observaciones {
    font-size: 0.84rem;
    color: #64748b;
    background: #f8fafc;
    border-left: 3px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 0 6px 6px 0;
}

/* --- Stepper --- */
.solicitud-stepper {
    padding: 8px 0;
}
.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}
.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s;
}
.step-done .step-circle {
    background: var(--step-color, #10b981);
    color: #fff;
}
.step-current .step-circle {
    background: var(--step-color, #3b82f6);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.step-future .step-circle {
    background: #e9ecef;
    color: #6c757d;
}
.step-label {
    font-size: 0.7rem;
    margin-top: 4px;
    text-align: center;
    color: #6c757d;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.step-current .step-label {
    color: var(--brand-blue);
    font-weight: 600;
}
.step-connector {
    flex: 1;
    height: 2px;
    min-width: 20px;
    background: #dee2e6;
    margin-top: -12px;
    align-self: flex-start;
    margin-top: 15px;
}
.step-connector-done {
    background: #10b981;
}

/* --- Stats pills --- */
.stat-pill {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-pill strong {
    color: var(--brand-blue);
}

/* --- Comment bubble --- */
.comment-bubble {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
}

/* --- Timeline --- */
.timeline-list {
    position: relative;
}
.timeline-item {
    position: relative;
    padding: 8px 0 8px 16px;
    border-left: 2px solid #dee2e6;
    margin-left: 6px;
}
.timeline-item:last-child {
    border-left-color: transparent;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-blue);
}

/* --- Items table in solicitud show --- */
#tablaItems {
    border-collapse: separate;
    border-spacing: 0;
}
#tablaItems thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8492a6;
    border-bottom: 2px solid #e9ecef;
    padding: 10px 12px;
    white-space: nowrap;
    background: #fafbfc;
}
#tablaItems tbody td {
    font-size: 0.84rem;
    vertical-align: middle;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f2f5;
    color: #3c4858;
}
#tablaItems tbody tr:last-child td {
    border-bottom: none;
}
#tablaItems tbody tr:hover td {
    background: #f7f9fc;
}

/* Denominacion cell — flex layout with thumbnail */
.item-denom-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.item-thumb {
    width: 36px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    flex-shrink: 0;
    background: #f8f9fa;
}
.item-denom-text {
    min-width: 0;
}
.item-title {
    font-weight: 600;
    color: #1a2332;
    line-height: 1.3;
}
.item-authors {
    font-size: 0.78rem;
    color: #8492a6;
    line-height: 1.3;
    margin-top: 1px;
}
.badge-imported {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 1px 8px;
    margin-top: 3px;
    line-height: 1.4;
}
.item-isbn {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.8rem;
    color: #64748b;
    letter-spacing: 0.02em;
}

/* Action buttons — compact circles */
.item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.82rem;
    padding: 0;
}
.btn-action-edit {
    color: #64748b;
}
.btn-action-edit:hover {
    color: var(--brand-blue);
    background: #eff6ff;
    border-color: #bfdbfe;
}
.btn-action-delete {
    color: #94a3b8;
}
.btn-action-delete:hover {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}
.btn-import-item {
    color: #22c55e;
}
.btn-import-item:hover {
    color: #16a34a;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* --- Auto-revealed fields (URL extraction / search auto-fill) --- */
.campo-autorellenado {
    animation: campoRevealSlide 0.4s ease-out;
}
.campo-autorellenado .form-control,
.campo-autorellenado .input-group .form-control {
    border-color: #86efac !important;
    background-color: #f0fdf4;
    transition: border-color 0.3s, background-color 0.3s;
}
.campo-autorellenado .form-label {
    color: #059669;
    font-weight: 600;
}
@keyframes campoRevealSlide {
    0% { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- URL extraction card (solicitud items modal) --- */
.url-extract-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #ede9fe 100%);
    border: 1.5px dashed #a5b4fc;
    border-radius: 10px;
    padding: 14px 16px;
}
.url-extract-header {
    font-size: 0.88rem;
    font-weight: 600;
    color: #4338ca;
    margin-bottom: 10px;
}
.url-extract-card .input-group {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-radius: 8px;
    overflow: hidden;
}
.url-extract-card .input-group .input-group-text {
    background: #fff;
    border-color: #c7d2fe;
    color: #6366f1;
}
.url-extract-card .input-group .form-control {
    border-color: #c7d2fe;
}
.url-extract-card .input-group .form-control:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 0.2rem rgba(99,102,241,0.15);
}
.url-extract-card .btn-ic-primary {
    white-space: nowrap;
}
.url-extract-hint {
    font-size: 0.76rem;
    color: #6b7280;
    margin-top: 8px;
}
.url-extract-hint i {
    color: #8b5cf6;
}

/* --- Item modal two-panel layout --- */
.item-form-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}
.item-form-panel .form-label {
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 0.3rem;
}

.item-image-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    height: 100%;
}

/* Image preview */
.item-image-preview {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    object-fit: contain;
    background: #fff;
    border: 1px solid #e2e8f0;
}

/* Placeholder (no image) */
.item-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 16px;
}
.item-image-placeholder .placeholder-icon {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}
.item-image-placeholder .placeholder-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
}
.item-image-placeholder .placeholder-hint {
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.4;
    max-width: 200px;
}

/* Image upload zone (inside placeholder) */
.img-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    padding: 12px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    cursor: default;
    transition: border-color 0.2s, background-color 0.2s;
}
.img-upload-zone.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
}
.img-upload-zone .placeholder-icon {
    font-size: 2.4rem;
    color: #6366f1;
    margin-bottom: 8px;
}
.img-upload-zone .placeholder-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 2px;
}
.img-upload-zone .placeholder-hint {
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.4;
    max-width: 220px;
}
.img-upload-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.img-upload-actions .btn-sm {
    font-size: 0.78rem;
    padding: 4px 12px;
}

/* Responsive: stack on mobile */
@media (max-width: 767.98px) {
    .item-image-panel {
        min-height: 160px;
    }
    .item-image-preview {
        max-height: 200px;
    }
}

/* --- Search results panel (modal text search) --- */
.search-results-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.search-result-item {
    display: block;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background 0.12s;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover,
.search-result-item:focus {
    background: #f0f7ff;
    outline: none;
}
.search-result-body {
    display: flex;
    align-items: center;
    gap: 10px;
}
.search-result-thumb {
    width: 32px;
    height: 44px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #f8f9fa;
}
.search-result-text {
    min-width: 0;
}
.search-result-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a2332;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-meta {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.2;
}
.search-result-details {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.2;
    margin-top: 1px;
}

/* ===== Desde Excel/CSV ===== */
.excel-container {
    max-width: 800px;
    margin: 0 auto;
}
.excel-header {
    text-align: center;
    margin-bottom: 2rem;
}
.excel-header h4 {
    color: var(--brand-blue, #1c3052);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}
.excel-header-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #16a34a15;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1rem;
}

/* Drop zone */
.excel-dropzone {
    border: 2px dashed #d0d7de;
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fafbfc;
}
.excel-dropzone:hover {
    border-color: #16a34a;
    background: #f0fdf4;
}
.excel-dropzone-active {
    border-color: #16a34a;
    background: #dcfce7;
    transform: scale(1.01);
}
.excel-dropzone-icon {
    font-size: 2.5rem;
    color: #16a34a;
    margin-bottom: 0.8rem;
    opacity: 0.7;
}
.excel-dropzone-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark, #1a1a2e);
    margin-bottom: 0.2rem;
}
.excel-dropzone-hint {
    font-size: 0.82rem;
    color: var(--text-muted, #6c757d);
    margin-bottom: 0.5rem;
}
.excel-dropzone-formats {
    font-size: 0.72rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

/* Import fields info panel */
.import-fields-info {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.import-fields-summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--brand-blue, #1c3052);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.import-fields-summary::-webkit-details-marker { display: none; }
.import-fields-summary::before {
    content: '\f0da';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    margin-right: 0.4rem;
    transition: transform 0.2s;
}
details.import-fields-info[open] > .import-fields-summary::before {
    transform: rotate(90deg);
}
.import-fields-summary:hover {
    background: rgba(28, 48, 82, 0.04);
}
.import-fields-body {
    padding: 0.75rem 0.5rem 0.25rem;
}
.import-fields-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.3rem 0.5rem;
}
.import-fields-table td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
}
.import-fields-table code {
    font-size: 0.82rem;
    background: rgba(28, 48, 82, 0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--brand-blue, #1c3052);
}

/* Mapping rows */
.excel-mapping-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background: #fff;
    transition: border-color 0.2s;
}
.excel-mapping-row:hover {
    border-color: var(--brand-blue, #1c3052);
}
.excel-mapping-left {
    flex: 1;
    min-width: 0;
}
.excel-mapping-header {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}
.excel-mapping-header strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.excel-mapping-samples {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}
.excel-sample-value {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.excel-mapping-arrow {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.excel-mapping-right {
    flex: 0 0 220px;
}
.excel-field-select {
    font-size: 0.8rem;
}

/* Result icon */
.excel-result-icon {
    font-size: 3rem;
}

/* Badge small */
.badge-sm {
    font-size: 0.6rem;
    padding: 0.12rem 0.35rem;
    font-weight: 600;
}

/* AI badge */
.excel-ai-badge .badge {
    font-size: 0.75rem;
}

@media (max-width: 576px) {
    .excel-mapping-row {
        flex-direction: column;
        align-items: stretch;
    }
    .excel-mapping-arrow {
        display: none;
    }
    .excel-mapping-right {
        flex: 1;
    }
    .excel-dropzone {
        padding: 2rem 1rem;
    }
}

/* ============================================
   DEMO — Banner + Help Panel
   ============================================ */

/* Demo banner (dashboard — inside module grid) */
.demo-banner {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1rem);
    padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
    background: rgba(28, 48, 82, 0.04);
    border: 1px solid rgba(28, 48, 82, 0.10);
    border-radius: var(--border-radius-md, 12px);
    color: var(--text-secondary, #64748B);
    font-size: 0.82rem;
    line-height: 1.5;
}
.demo-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm, 8px);
    background: rgba(231, 60, 30, 0.08);
    color: var(--brand-red, #E73C1E);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.demo-banner-text strong {
    color: var(--text-primary, #1C3052);
}
.demo-banner-link {
    color: var(--brand-blue, #1C3052);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.demo-banner-link:hover {
    color: var(--ui-interaction, #3B82F6);
}

/* Alias toggle in alumnos toolbar */
.alias-toggle-toolbar {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.375rem;
    margin-right: 0.5rem;
    background: rgba(0,0,0,0.02);
}

/* ── Demo Sidebar (offcanvas) ──────────────────────────────── */

.demo-sidebar-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1040;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    border: none;
    background: var(--brand-blue, #1C3052);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(28, 48, 82, 0.25),
                0 2px 4px rgba(28, 48, 82, 0.1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.demo-sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(28, 48, 82, 0.3),
                0 4px 8px rgba(28, 48, 82, 0.12);
    border-radius: 18px;
}
.demo-sidebar-toggle.active {
    background: var(--brand-red, #E73C1E);
    border-radius: 14px;
}
@keyframes demoBtnNudge {
    0%   { transform: scale(1); }
    15%  { transform: scale(1.18) rotate(-8deg); }
    30%  { transform: scale(1.18) rotate(8deg); }
    45%  { transform: scale(1.18) rotate(-5deg); }
    60%  { transform: scale(1.12) rotate(3deg); }
    75%  { transform: scale(1.06) rotate(0deg); }
    100% { transform: scale(1); }
}
.demo-sidebar-toggle.nudge {
    animation: demoBtnNudge 0.6s ease-in-out;
}

.demo-sidebar {
    width: 360px !important;
    display: flex !important;
    flex-direction: column !important;
    top: 1rem !important;
    bottom: 1rem !important;
    right: 1rem !important;
    height: auto !important;
    border-radius: var(--border-radius-lg, 16px);
    border: 1px solid rgba(28, 48, 82, 0.08);
    box-shadow: 0 12px 48px rgba(28, 48, 82, 0.14),
                0 4px 16px rgba(28, 48, 82, 0.06);
    overflow: hidden;
}
.demo-sidebar .offcanvas-header {
    padding: 0;
}
.demo-sidebar-header {
    padding: 1rem 1.25rem !important;
    background: var(--brand-blue, #1C3052);
    color: #fff;
    border-bottom: none;
}
.demo-sidebar-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.6;
}
.demo-sidebar-header .btn-close:hover {
    opacity: 1;
}
.demo-sidebar-title {
    font-size: 0.88rem !important;
    font-weight: 600;
    color: #fff;
    margin: 0;
}
.demo-sidebar-title .text-warning {
    color: #FCD34D !important;
}
.demo-sidebar .offcanvas-body {
    display: none;
}

/* Tip contextual */
.demo-sidebar-tip {
    padding: 0.9rem 1.25rem;
    background: rgba(28, 48, 82, 0.03);
    border-bottom: 1px solid rgba(28, 48, 82, 0.06);
}
.demo-sidebar-tip-text {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary, #64748B);
    margin: 0 0 0.4rem;
}
.demo-sidebar-manual {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand-blue, #1C3052);
    text-decoration: none;
    transition: all 0.15s;
}
.demo-sidebar-manual:hover {
    color: var(--ui-interaction, #3B82F6);
    gap: 6px;
}

/* ── Demo AI Chat (inside sidebar) ────────────────────────── */

.demo-chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.demo-chat-header {
    padding: 0.6rem 1.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    background: #fff;
    border-bottom: 1px solid rgba(28, 48, 82, 0.06);
    flex-shrink: 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.demo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg-app, #F5F7FA);
}
.demo-chat-messages:empty::before {
    content: 'Pregunta lo que quieras sobre la plataforma...';
    color: #9ca3af;
    font-size: 0.8rem;
    font-style: italic;
    align-self: center;
    margin-top: 4rem;
}
.demo-chat-msg {
    max-width: 85%;
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    font-size: 0.82rem;
    line-height: 1.55;
    word-break: break-word;
}
.demo-chat-msg-user {
    align-self: flex-end;
    background: var(--brand-blue, #1C3052);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(28, 48, 82, 0.12);
}
.demo-chat-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: var(--text-primary, #1C3052);
    border: 1px solid rgba(28, 48, 82, 0.08);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(28, 48, 82, 0.04);
}
.demo-chat-msg-error {
    align-self: center;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-size: 0.78rem;
    text-align: center;
}
.demo-chat-msg-typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(28, 48, 82, 0.08);
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 0.25rem;
    align-items: center;
    box-shadow: 0 1px 2px rgba(28, 48, 82, 0.04);
}
.demo-chat-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: demoChatBounce 1.2s infinite ease-in-out;
}
.demo-chat-dot:nth-child(2) { animation-delay: 0.15s; }
.demo-chat-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes demoChatBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Chat input fixed at sidebar bottom */
.demo-chat-form-wrap {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(28, 48, 82, 0.06);
}
.demo-chat-form {
    display: flex;
    align-items: center;
    background: var(--bg-app, #F5F7FA);
    border: 1px solid rgba(28, 48, 82, 0.1);
    border-radius: 24px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    padding-right: 0.3rem;
}
.demo-chat-form:focus-within {
    border-color: var(--ui-interaction, #3B82F6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.demo-chat-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.demo-chat-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.6rem 0.9rem;
    font-size: 0.84rem;
    background: transparent;
}
.demo-chat-input::placeholder {
    color: #9ca3af;
}
.demo-chat-input:disabled {
    background: #f3f4f6;
}
.demo-chat-send {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    background: var(--brand-blue, #1a56db);
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.demo-chat-send:hover {
    background: #1648b8;
}
.demo-chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ── Mobile: bottom sheet ─────────────────────────────── */

/* Drag handle (inserted by JS on mobile) */
.demo-sheet-handle {
    display: none;
}

@media (max-width: 576px) {
    /* FAB: raise above CTA pill */
    .demo-sidebar-toggle {
        bottom: 4.5rem;
        right: 1rem;
    }

    /* Drag handle visible on mobile */
    .demo-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0 2px;
        cursor: grab;
        flex-shrink: 0;
    }
    .demo-sheet-handle::before {
        content: '';
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(28, 48, 82, 0.2);
    }

    /* Override offcanvas-end → bottom sheet */
    .demo-sidebar.offcanvas-end {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        border-top: 1px solid rgba(28, 48, 82, 0.08);
        box-shadow: 0 -4px 24px rgba(28, 48, 82, 0.12);
        transform: translateY(100%) !important;
        transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    .demo-sidebar.offcanvas-end.showing,
    .demo-sidebar.offcanvas-end.show:not(.hiding) {
        transform: translateY(0) !important;
    }
    .demo-sidebar.offcanvas-end.hiding {
        transform: translateY(100%) !important;
    }

    /* Collapsed state (default): tip + input only */
    .demo-sidebar:not(.demo-sheet-expanded) .demo-sidebar-header {
        padding: 8px 16px;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-sidebar-title {
        font-size: 0.82rem;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-sidebar-tip {
        padding: 0 16px 8px;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-sidebar-tip-text {
        font-size: 0.78rem;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-sidebar-manual {
        display: none;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-chat-section {
        display: none;
    }
    .demo-sidebar:not(.demo-sheet-expanded) .demo-chat-form-wrap {
        padding: 8px 12px;
    }

    /* Expanded state: full bottom sheet */
    .demo-sidebar.demo-sheet-expanded {
        max-height: 75vh;
    }
    .demo-sidebar.demo-sheet-expanded .demo-chat-section {
        display: flex;
        flex-direction: column;
        min-height: 0;
        flex: 1;
    }
    .demo-sidebar.demo-sheet-expanded .demo-chat-messages {
        max-height: 40vh;
    }

    /* Close button smaller on mobile */
    .demo-sidebar .offcanvas-header .btn-close {
        padding: 0.4rem;
    }
}

/* ── Demo CTA Pill (floating bottom center) ──────────────── */

.demo-cta-pill {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1039; /* just below demo-sidebar-toggle (1040) */
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--brand-blue, #1C3052);
    color: #fff;
    padding: 12px 44px 12px 14px; /* extra right padding for close button */
    border-radius: 60px;
    box-shadow: 0 8px 32px rgba(28, 48, 82, 0.25),
                0 2px 8px rgba(28, 48, 82, 0.15);
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    animation: demoPillFloat 3s ease-in-out infinite;
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--font-main, 'Inter', sans-serif);
}
.demo-cta-pill:hover {
    color: #fff;
    text-decoration: none;
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 12px 40px rgba(28, 48, 82, 0.3),
                0 4px 12px rgba(28, 48, 82, 0.2);
    background: #243d66;
}
.demo-cta-pill--hiding {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    pointer-events: none;
}

@keyframes demoPillFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

.demo-cta-pill-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-red, #E73C1E);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.demo-cta-pill-text {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.3;
}
.demo-cta-pill-text small {
    display: block;
    font-size: 0.72rem;
    opacity: 0.7;
    font-weight: 400;
}

.demo-cta-pill-arrow {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.demo-cta-pill:hover .demo-cta-pill-arrow {
    transform: translateX(3px);
}

.demo-cta-pill-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}
.demo-cta-pill-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Mobile: pill becomes more compact */
@keyframes demoPillFloatMobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 576px) {
    .demo-cta-pill {
        left: 1rem;
        right: 1rem;
        transform: none;
        white-space: normal;
        border-radius: 16px;
        bottom: 1rem;
        gap: 10px;
        padding: 10px 40px 10px 12px;
        animation-name: demoPillFloatMobile;
    }
    .demo-cta-pill:hover {
        transform: translateY(-3px);
    }
    .demo-cta-pill--hiding {
        transform: translateY(16px);
    }
    .demo-cta-pill-text { font-size: 0.82rem; }
    .demo-cta-pill-icon { width: 32px; height: 32px; font-size: 0.8rem; }
}
