/*
 * CARGA DE ESTILOS
 * 1. bootstrap.min.css  — reset, grid, utilidades (d-flex, col-*, mt-*, etc.)
 * 2. site.css (este archivo) — design system AG, sobreescribe Bootstrap donde se necesita
 *
 * Para usar Bootstrap en vistas: col-md-6, d-flex, gap-3, mt-4, etc.
 * Para usar nuestros estilos: ag-*, frm-*, crd-*, mdl-*, alt-*, acd-*
 */

/* =============================================
   ALTA GESTIÓN – Global Styles
   ============================================= */

:root {
    --ag-navy: #0d1f3c;
    --ag-navy-dark: #091628;
    --ag-blue-accent: #1a3a6b;
    --ag-sidebar-bg: #ffffff;
    --ag-sidebar-width: 250px;
    --ag-sidebar-collapsed: 60px;
    --ag-topbar-height: 60px;
    --ag-page-bg: #eef2f7;
    --ag-text-primary: #1a2e4a;
    --ag-text-muted: #6b7a99;
    --ag-nav-label-color: #4a6fa5;
    --ag-active-bg: #d6e4f7;
    --ag-active-text: #001A3F;
    --ag-hover-bg: #f0f4f9;
    --ag-border: #dde3ef;
    --ag-avatar-bg: #2d5fa6;
    --ag-avatar-text: #ffffff;
    --ag-transition: 0.22s ease;
}

/* ── Override Bootstrap Reboot ── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 14px;
    height: 100%;
}
body {
    height: 100%;
    margin: 0;
    padding: 0 !important; /* Bootstrap JS añade padding-right al abrir modales */
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif !important;
    font-size: 1rem;
    background-color: var(--ag-page-bg) !important;
    overflow-x: hidden;
}

/* ── Tipografía: Poppins para headings ── */
h1, h2, h3, h4, h5, h6,
.ag-brand-text,
.ag-nav-label,
.ag-footer-col-title,
.ag-footer-logo span {
    font-family: 'Poppins', system-ui, sans-serif;
    margin-bottom: 0;
}

h1 { font-size: 48px; line-height: 56px; font-weight: 700; }
h2 { font-size: 36px; line-height: 44px; font-weight: 700; }
h3 { font-size: 28px; line-height: 36px; font-weight: 600; }
h4 { font-size: 22px; line-height: 30px; font-weight: 600; }
h5 { font-size: 18px; line-height: 26px; font-weight: 500; }
h6 { font-size: 14px; line-height: 22px; font-weight: 500; }

/* ── Anular estilos que Bootstrap aplica a elementos nativos ── */
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }
p { margin-bottom: 0; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Bootstrap container sigue disponible ── */
.container, .container-fluid,
.container-sm, .container-md,
.container-lg, .container-xl {
    /* Bootstrap gestiona estos, no los sobreescribimos */
}

.ag-body {
    background: var(--ag-page-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =============================================
   TOP BAR
   ============================================= */
.ag-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ag-topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--ag-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ag-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ag-sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--ag-text-primary);
    font-size: 20px;
    line-height: 1;
    transition: background var(--ag-transition);
}
.ag-sidebar-toggle:hover { background: var(--ag-hover-bg); }

.ag-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ag-navy);
}
.ag-brand-icon {
    font-size: 22px;
    color: var(--ag-navy);
}
.ag-brand-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.04em;
    color: var(--ag-navy);
}

.ag-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ag-icon-btn {
    background: var(--ag-border);
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 16px;
    color: var(--ag-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ag-transition), color var(--ag-transition);
}
.ag-icon-btn:hover { background: #c8d4e8; color: var(--ag-text-primary); }

.ag-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #d6e4f7;
    border-radius: 50px;
    padding: 5px 14px 5px 5px;
    cursor: pointer;
    transition: background var(--ag-transition);
}
.ag-user-chip:hover { background: #c5d8f0; }

.ag-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2d5fa6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ag-user-avatar.lg {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.ag-user-info {
    display: flex;
    flex-direction: column;
}
.ag-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #001A3F;
    line-height: 1.2;
}
.ag-user-role {
    font-size: 11px;
    color: var(--ag-text-muted);
    line-height: 1.2;
}

/* =============================================
   WRAPPER (sidebar + main)
   ============================================= */
.ag-wrapper {
    display: flex;
    margin-top: var(--ag-topbar-height);
    flex: 1;
}

/* =============================================
   SIDEBAR
   ============================================= */
.ag-sidebar {
    width: var(--ag-sidebar-width);
    min-height: calc(100vh - var(--ag-topbar-height));
    background: var(--ag-sidebar-bg);
    border-right: 1px solid var(--ag-border);
    position: fixed;
    top: var(--ag-topbar-height);
    left: 0;
    bottom: 0;
    transition: width var(--ag-transition);
    overflow: hidden;
    z-index: 900;
}

.ag-sidebar.collapsed {
    width: var(--ag-sidebar-collapsed);
}

.ag-sidebar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 0 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Nav groups */
.ag-nav-sections {
    flex: 1;
}

.ag-nav-group {
    margin-bottom: 6px;
}

.ag-nav-label {
    display: block;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--ag-nav-label-color);
    padding: 12px 18px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--ag-transition);
}

.ag-sidebar.collapsed .ag-nav-label {
    opacity: 0;
    height: 18px;
    padding: 10px 0 4px;
    /* show dots in collapsed mode */
    overflow: visible;
}

.ag-sidebar.collapsed .ag-nav-label::after {
    content: '···';
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--ag-nav-label-color);
    letter-spacing: 0;
}

.ag-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin: 2px 6px 2px 6px;
    color: var(--ag-text-primary);
    text-decoration: none;
    font-size: 13.5px;
    border-radius: 8px;
    transition: background var(--ag-transition), color var(--ag-transition);
    white-space: nowrap;
    position: relative;
}

.ag-nav-item i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.ag-nav-item:hover {
    background: var(--ag-hover-bg);
    color: var(--ag-text-primary);
    text-decoration: none;
}

    .ag-nav-item.active {
        background: var(--ag-active-bg);
        color: var(--ag-active-text);
        border-left: 3px solid #001A3F;
        padding-left: 7px;
    }
.ag-nav-item.active:hover {
    background: var(--ag-active-bg);
    color: var(--ag-active-text);
}

.ag-nav-item span {
    transition: opacity var(--ag-transition);
}
.ag-sidebar.collapsed .ag-nav-item span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.ag-sidebar.collapsed .ag-nav-item {
    margin: 2px 8px;
    padding: 9px;
    justify-content: center;
}

.ag-sidebar.collapsed .ag-nav-item.active {
    border-left: 3px solid #001A3F;
    padding: 9px 0px 9px 6px;
    justify-content: center;
}

/* Sidebar footer */
.ag-sidebar-footer {
    border-top: 1px solid var(--ag-border);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.ag-sidebar-user-info {
    display: flex;
    flex-direction: column;
    transition: opacity var(--ag-transition);
    white-space: nowrap;
}
.ag-sidebar-user-info .ag-user-name {
    color: var(--ag-text-primary);
    font-size: 13px;
}
.ag-sidebar-user-info .ag-user-role {
    color: var(--ag-text-muted);
    font-size: 11px;
}
.ag-sidebar.collapsed .ag-sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
/* Wrapper que agrupa contenido + footer y se desplaza como una sola unidad
   cuando el sidebar colapsa (evita tener que sincronizar el margin-left
   de .ag-main y .ag-footer por separado) */
.ag-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-left: var(--ag-sidebar-width);
    min-height: calc(100vh - var(--ag-topbar-height));
    transition: margin-left var(--ag-transition);
}

.ag-sidebar.collapsed ~ .ag-content-wrapper,
.ag-wrapper:has(.ag-sidebar.collapsed) .ag-content-wrapper {
    margin-left: var(--ag-sidebar-collapsed);
}

.ag-main {
    flex: 1;
    padding: 28px;
}

/* =============================================
   FOOTER
   ============================================= */
.ag-footer {
    position: relative;
    overflow: hidden;
    background: var(--ag-navy);
    color: rgba(255,255,255,0.85);
}

/* Círculos decorativos de fondo */
.ag-footer-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
    z-index: 0;
}
.ag-footer-circle--tr { width: 320px; height: 320px; top: -160px; right: -100px; }
.ag-footer-circle--bl { width: 260px; height: 260px; bottom: -140px; left: -80px; }

.ag-footer-main {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 1fr 1fr;
    gap: 32px;
    padding: 44px 44px 28px;
}

/* Brand column */
.ag-footer-brand {}

.ag-footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.ag-footer-logo i {
    font-size: 26px;
}
.ag-footer-logo-img {
    height: 30px;
    width: auto;
}

.ag-footer-tagline {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
    margin-bottom: 20px;
}

.ag-footer-developed {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
    flex-shrink: 0;
}
.ag-footer-dev-logo {
    height: 30px;
    width: auto;
    flex-shrink: 0;
}

/* Contact column */
.ag-footer-col-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #ffffff;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.ag-footer-socials {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.ag-footer-social-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s;
}
.ag-footer-social-btn:hover {
    background: rgba(255,255,255,0.22);
    color: #ffffff;
}

.ag-footer-contact-item {
    font-size: 12.5px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ag-footer-contact-item i { font-size: 13px; }

/* Link columns */
.ag-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ag-footer-links li {
    margin-bottom: 8px;
}
.ag-footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}
.ag-footer-links a:hover { color: #ffffff; }

/* ISO strip */
.ag-footer-iso {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 44px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ag-iso-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ag-iso-badge-icon { width: 30px; height: 30px; object-fit: contain; }
.ag-footer-iso p,
.ag-footer-iso-text p {
    font-size: 11.5px;
    color: rgba(255,255,255,0.6);
    margin: 0;
    line-height: 1.5;
}
.ag-footer-iso-text { max-width: 520px; }

/* Copyright */
.ag-footer-bottom {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
    .ag-footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        padding: 32px 24px 20px;
    }
    .ag-footer-iso { padding: 14px 24px; }
}

@media (max-width: 600px) {
    .ag-sidebar { width: var(--ag-sidebar-collapsed); }
    .ag-sidebar .ag-nav-label { opacity: 0; }
    .ag-sidebar .ag-nav-item span { opacity: 0; width: 0; overflow: hidden; }
    .ag-sidebar .ag-sidebar-user-info { opacity: 0; width: 0; overflow: hidden; }
    .ag-main { margin-left: var(--ag-sidebar-collapsed); padding: 16px; }
    .ag-footer { margin-left: var(--ag-sidebar-collapsed); }
    .ag-footer-main { grid-template-columns: 1fr; }
    .ag-user-info { display: none; }
}

/* =============================================
   BREADCRUMB
   ============================================= */
.ag-breadcrumb {
    margin-bottom: 20px;
}
.ag-bc-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    list-style: none;
    padding: 0; margin: 0;
}
.ag-bc-item {
    display: flex; align-items: center;
    font-size: 12px;
    font-family: 'Public Sans', sans-serif;
}
.ag-bc-link {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--ag-active-bg);
    color: var(--ag-active-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.ag-bc-link:hover {
    background: #c3d9f5;
    color: #001A3F;
}
.ag-bc-link i { font-size: 14px; }
.ag-bc-sep {
    color: var(--ag-border);
    font-size: 10px;
    display: flex; align-items: center;
    padding: 0 4px;
}
.ag-bc-section {
    color: var(--ag-text-muted);
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: transparent;
    letter-spacing: 0.02em;
}
.ag-bc-current {
    color: var(--ag-active-text);
    font-weight: 600;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--ag-active-bg);
    border: 1px solid #b8d0ed;
}

/* =============================================
   BOTONES — design system
   ============================================= */

/* Base */
.ag-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    font-family: 'Public Sans', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.ag-btn:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

/* Tamaños */
.ag-btn--sm  { font-size: 12px; padding: 6px 12px; }
.ag-btn--md  { font-size: 13px; padding: 8px 16px; }
.ag-btn--lg  { font-size: 14px; padding: 10px 20px; }

/* Icono solo */
.ag-btn--icon.ag-btn--sm { padding: 6px;  width: 28px; height: 28px; justify-content: center; border-radius: 8px; }
.ag-btn--icon.ag-btn--md { padding: 8px;  width: 34px; height: 34px; justify-content: center; border-radius: 8px; }
.ag-btn--icon.ag-btn--lg { padding: 10px; width: 40px; height: 40px; justify-content: center; border-radius: 9px; }

/* ── PRIMARY ── */
.ag-btn--primary                           { background: #1e4da1; color: #fff; }
.ag-btn--primary:hover:not(:disabled)      { background: #163880; color: #fff; }
.ag-btn--primary.ag-btn--dark              { background: #0d1f3c; color: #fff; }
.ag-btn--primary.ag-btn--ghost             { background: transparent; color: #1e4da1; border: none; }
.ag-btn--primary.ag-btn--ghost:hover:not(:disabled) { background: var(--ag-hover-bg); }
.ag-btn--primary.ag-btn--soft              { background: var(--ag-active-bg); color: #1e4da1; }
.ag-btn--primary.ag-btn--soft:hover:not(:disabled)  { background: #c3d9f5; }
.ag-btn--primary.ag-btn--outline           { background: transparent; color: #1e4da1; border: 1.5px solid #1e4da1; }
.ag-btn--primary.ag-btn--outline:hover:not(:disabled) { background: var(--ag-active-bg); }

/* ── SUCCESS ── */
.ag-btn--success                           { background: #1a7a4a; color: #fff; }
.ag-btn--success:hover:not(:disabled)      { background: #135c37; }
.ag-btn--success.ag-btn--soft              { background: #d4f0e2; color: #1a7a4a; }
.ag-btn--success.ag-btn--soft:hover:not(:disabled) { background: #b8e4ce; }
.ag-btn--success.ag-btn--outline           { background: transparent; color: #1a7a4a; border: 1.5px solid #1a7a4a; }
.ag-btn--success.ag-btn--outline:hover:not(:disabled) { background: #d4f0e2; }

/* ── DANGER ── */
.ag-btn--danger                            { background: #c0392b; color: #fff; }
.ag-btn--danger:hover:not(:disabled)       { background: #962d22; }
.ag-btn--danger.ag-btn--soft               { background: #fde8e6; color: #c0392b; }
.ag-btn--danger.ag-btn--soft:hover:not(:disabled) { background: #f9ccc8; }
.ag-btn--danger.ag-btn--outline            { background: transparent; color: #c0392b; border: 1.5px solid #c0392b; }
.ag-btn--danger.ag-btn--outline:hover:not(:disabled) { background: #fde8e6; }

/* ── WARNING ── */
.ag-btn--warning                           { background: #b07d12; color: #fff; }
.ag-btn--warning:hover:not(:disabled)      { background: #8a620e; }
.ag-btn--warning.ag-btn--soft              { background: #fef3d0; color: #8a620e; }
.ag-btn--warning.ag-btn--soft:hover:not(:disabled) { background: #fde8a8; }
.ag-btn--warning.ag-btn--outline           { background: transparent; color: #8a620e; border: 1.5px solid #b07d12; }
.ag-btn--warning.ag-btn--outline:hover:not(:disabled) { background: #fef3d0; }

/* ── HEADER (sobre fondo azul) ── */
.ag-btn--header                            { background: #ffffff; color: #1e4da1; }
.ag-btn--header:hover:not(:disabled)       { background: #eef2f7; color: #163880; }

/* ── SECONDARY ── */
.ag-btn--secondary                         { background: #dbeafe; color: #1e4da1; border: 1.5px solid #93c5fd; }
.ag-btn--secondary:hover:not(:disabled)    { background: #bfdbfe; color: #163880; }

/* ── NEUTRAL ── */
.ag-btn--neutral                           { background: var(--ag-border); color: var(--ag-text-primary); }
.ag-btn--neutral:hover:not(:disabled)      { background: #c8cfe0; }
.ag-btn--neutral.ag-btn--soft              { background: var(--ag-hover-bg); color: var(--ag-text-muted); }
.ag-btn--neutral.ag-btn--soft:hover:not(:disabled) { background: #e4e8f2; }
.ag-btn--neutral.ag-btn--outline           { background: transparent; color: var(--ag-text-muted); border: 1.5px solid var(--ag-border); }
.ag-btn--neutral.ag-btn--outline:hover:not(:disabled) { background: var(--ag-hover-bg); }

/* Showcase layout */
.btn-section { margin-bottom: 32px; }
.btn-showcase-card {
    background: #fff;
    border: 1px solid var(--ag-border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}
.btn-showcase-card--row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
}
.btn-showcase-label {
    font-family: 'Public Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ag-text-muted);
    margin-bottom: 4px;
}
.btn-showcase-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-state-tag {
    font-family: 'Public Sans', sans-serif;
    font-size: 11px;
    color: var(--ag-text-muted);
    min-width: 52px;
}
.btn-size-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* =============================================
   ACCORDION
   ============================================= */

.acd-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
}

.acd { display: flex; flex-direction: column; }

/* ── Item ── */
.acd-item { overflow: hidden; }

.acd-header {
    width: 100%; display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
    background: none; border: none; cursor: pointer;
    padding: 15px 18px;
    text-align: left;
    transition: background 0.18s;
}
.acd-header:hover { background: var(--ag-hover-bg); }

.acd-title {
    display: flex; align-items: center; gap: 9px;
    font-family: 'Poppins', sans-serif;
    font-size: 13.5px; font-weight: 600;
    color: #001A3F;
}
.acd-title i { font-size: 15px; flex-shrink: 0; color: #2d5fa6; }

.acd-chevron {
    font-size: 14px; color: var(--ag-text-muted);
    transition: transform 0.25s ease; flex-shrink: 0;
}
.acd-item--open > .acd-header .acd-chevron { transform: rotate(180deg); }

.acd-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.acd-body p {
    margin: 0;
    padding: 0 18px 16px;
    font-size: 13.5px; line-height: 1.6;
    font-family: 'Public Sans', sans-serif;
    color: var(--ag-text-muted);
}

/* ── Default style ── */
.acd--default {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.acd--default .acd-item { border-bottom: 1px solid var(--ag-border); }
.acd--default .acd-item:last-child { border-bottom: none; }
.acd--default .acd-item--open > .acd-header { background: #f5f8fd; }

/* ── Filled Navy style ── */
.acd--filled { border-radius: 14px; overflow: hidden; }
.acd--filled .acd-item { border-bottom: 1px solid rgba(255,255,255,0.1); }
.acd--filled .acd-item:last-child { border-bottom: none; }

.acd--filled .acd-header { background: #001A3F; }
.acd--filled .acd-header:hover { background: #0a2d5e; }
.acd--filled .acd-item--open > .acd-header { background: #0a2d5e; }

.acd--filled .acd-title { color: #fff; }
.acd--filled .acd-title i { color: #7eb3e8; }
.acd--filled .acd-chevron { color: rgba(255,255,255,0.6); }

.acd--filled .acd-body { background: #eef4fb; }
.acd--filled .acd-body p { color: var(--ag-text-primary); }

/* ── Border Left style ── */
.acd--border { display: flex; flex-direction: column; gap: 8px; }

.acd--border .acd-item {
    background: #fff;
    border-radius: 10px;
    border-left: 4px solid var(--ag-border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: border-color 0.2s;
}
.acd--border .acd-item--open {
    border-left-color: #2563eb;
}
.acd--border .acd-header { border-radius: 10px; }
.acd--border .acd-item--open > .acd-header { background: #f0f6ff; }
.acd--border .acd-body p { padding-left: 18px; }

/* Bootstrap col-* gestiona el responsive del accordion */

/* =============================================
   ALERTS PAGE
   ============================================= */

.alt-section { padding: 24px; margin-bottom: 0; }

/* Trigger buttons */
.alt-trigger-row {
    display: flex; flex-wrap: wrap; gap: 12px;
}
.alt-trigger-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px; border-radius: 10px; border: none;
    font-size: 13.5px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; cursor: pointer;
    transition: opacity 0.18s, transform 0.15s;
}
.alt-trigger-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.alt-trigger--success { background: #e6f9f0; color: #1a7f4e; }
.alt-trigger--error   { background: #fde8e8; color: #c0392b; }
.alt-trigger--warning { background: #fff4e0; color: #b07a10; }
.alt-trigger--info    { background: #e0f0ff; color: #1a6fa8; }
.alt-trigger--confirm { background: #ede8fd; color: #6c3fc7; }

/* Inline alerts */
.alt-inline-list { display: flex; flex-direction: column; gap: 10px; }

.alt-inline {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 10px;
    font-size: 13.5px; font-family: 'Public Sans', sans-serif;
    font-weight: 500; overflow: hidden;
}
.alt-inline i:first-child { font-size: 16px; flex-shrink: 0; }
.alt-inline span:nth-child(2) { flex: 1; }

.alt-inline--success { background: #e8faf2; color: #1a7f4e; border: 1px solid #a8e6c8; }
.alt-inline--error   { background: #fef0f0; color: #c0392b; border: 1px solid #f5b8b8; }
.alt-inline--warning { background: #fffbee; color: #9a6700; border: 1px solid #fad980; }
.alt-inline--info    { background: #e8f4ff; color: #1460a0; border: 1px solid #90c8f0; }

.alt-inline-close {
    background: none; border: none; cursor: pointer;
    font-size: 16px; line-height: 1;
    opacity: 0.55; transition: opacity 0.15s;
    display: flex; align-items: center; flex-shrink: 0;
    color: inherit; padding: 0;
}
.alt-inline-close:hover { opacity: 1; }

.alt-inline-tag {
    font-size: 11px; font-weight: 700;
    padding: 2px 9px; border-radius: 20px;
    background: rgba(0,0,0,0.07);
    color: inherit; flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.03em;
}

/* Alert dialogs */
.alt-dialog {
    background: #fff; border-radius: 18px;
    padding: 36px 32px 28px;
    max-width: 360px; width: 100%;
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    box-shadow: 0 20px 60px rgba(0,26,63,0.18);
    transform: translateY(20px) scale(0.97); opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.mdl-overlay--visible .alt-dialog {
    transform: translateY(0) scale(1); opacity: 1;
}

.alt-dialog-icon {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: 18px;
}
.alt-dialog-icon--success { background: #e6f9f0; color: #1a9e5f; }
.alt-dialog-icon--error   { background: #fde8e8; color: #e05050; }
.alt-dialog-icon--warning { background: #fff4e0; color: #d4850a; }
.alt-dialog-icon--info    { background: #e0f0ff; color: #1a6fa8; }
.alt-dialog-icon--confirm { background: #ede8fd; color: #6c3fc7; }

.alt-dialog-title {
    font-family: 'Poppins', sans-serif;
    font-size: 17px; font-weight: 700;
    color: #001A3F; margin: 0 0 10px;
}
.alt-dialog-msg {
    font-size: 13.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
    line-height: 1.55; margin: 0 0 24px;
}
.alt-dialog-actions {
    width: 100%; display: flex; flex-direction: column; gap: 8px;
}
.alt-dialog-actions--row {
    flex-direction: row; justify-content: center; gap: 10px;
}

.alt-dialog-btn {
    padding: 11px 24px; border-radius: 10px; border: none;
    font-size: 14px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; cursor: pointer; width: 100%;
    transition: opacity 0.18s;
}
.alt-dialog-actions--row .alt-dialog-btn { width: auto; flex: 1; }
.alt-dialog-btn:hover { opacity: 0.88; }

.alt-dialog-btn--success { background: #1a9e5f; color: #fff; }
.alt-dialog-btn--error   { background: #e05050; color: #fff; }
.alt-dialog-btn--warning { background: #d4850a; color: #fff; }
.alt-dialog-btn--info    { background: #1a6fa8; color: #fff; }
.alt-dialog-btn--confirm { background: #6c3fc7; color: #fff; }
.alt-dialog-btn--ghost {
    background: #f0f4f9; color: var(--ag-text-primary);
    border: 1.5px solid var(--ag-border);
}

/* =============================================
   MODAL COMPONENTS
   ============================================= */

/* Demo launcher row */
.mdl-demo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 32px;
}
.mdl-demo-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
}
.mdl-demo-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: #d6e4f7; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #001A3F;
}
.mdl-demo-info { flex: 1; }
.mdl-demo-title {
    font-family: 'Poppins', sans-serif;
    font-size: 14px; font-weight: 600; color: #001A3F;
}
.mdl-demo-desc {
    font-size: 12.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
}

/* Overlay */
.mdl-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 10, 30, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
}
.mdl-overlay--visible {
    opacity: 1; pointer-events: all;
}
.mdl-overlay--visible .mdl-dialog {
    transform: translateY(0); opacity: 1;
}

/* Compatibilidad: vistas legacy usan addClass/removeClass('hidden') en lugar de --visible */
.mdl-overlay:not(.hidden) {
    opacity: 1 !important;
    pointer-events: all !important;
}
.mdl-overlay:not(.hidden) .mdl-dialog {
    transform: translateY(0) !important;
    opacity: 1 !important;
}
/* SweetAlert2 siempre por encima de cualquier modal */
.swal2-container { z-index: 99999 !important; }
/* Inputs compactos para filas de tabla (distribución, etc.) */
.tbl-input {
    height: 32px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
}
.min-h-screen  { min-height: 100vh; }
.max-h-screen  { max-height: 100vh; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Dialog box */
.mdl-dialog {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,26,63,0.2);
    width: 100%;
    max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    transform: translateY(20px); opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    overflow: hidden;
}
.mdl-dialog--sm  { max-width: 480px; }
.mdl-dialog--lg  { max-width: 820px; }
.mdl-dialog--xl  { max-width: 1060px; }
.mdl-dialog--xxl { max-width: 1280px; }

/* Header */
.mdl-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--ag-border);
    flex-shrink: 0;
    gap: 12px;
}
.mdl-header--blue { background: #d6e4f7; border-bottom: none; }

.mdl-header-left { display: flex; flex-direction: column; gap: 2px; }
.mdl-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px; font-weight: 600; color: #001A3F;
}
.mdl-subtitle {
    font-size: 12px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
}
.mdl-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--ag-text-muted);
    transition: background 0.18s, color 0.18s; flex-shrink: 0;
}
.mdl-close:hover { background: rgba(0,26,63,0.08); color: #001A3F; }

/* Toolbar (table modal) */
.mdl-toolbar {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--ag-border);
    gap: 12px; flex-shrink: 0;
}

/* Body */
.mdl-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.mdl-body--table {
    padding: 0;
    overflow-x: auto;
}

/* Footer */
.mdl-footer {
    display: flex; align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--ag-border);
    flex-shrink: 0;
}
.mdl-footer--between { justify-content: space-between; }

@media (max-width: 600px) {
    .mdl-demo-row { grid-template-columns: 1fr; }
    .mdl-dialog--lg { max-width: 100%; }
}

/* =============================================
   CARDS PAGE
   ============================================= */

.crd-showcase { display: flex; flex-direction: column; gap: 32px; }

.crd-section {}
.crd-section-label {
    font-family: 'Poppins', sans-serif;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--ag-nav-label-color);
    margin-bottom: 14px;
}

.crd-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: start;
}
.crd-row--mixed {
    grid-template-columns: 1fr 1fr;
}

/* ── Stat Card ── */
.crd-stat {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    display: flex; flex-direction: column; gap: 14px;
}
.crd-stat-top {
    display: flex; align-items: center; gap: 14px;
}
.crd-stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: #d6e4f7;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #001A3F; flex-shrink: 0;
}
.crd-stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 26px; font-weight: 700;
    color: #001A3F; line-height: 1.1;
}
.crd-stat-label {
    font-size: 12.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
    margin-top: 2px;
}
.crd-stat-footer {
    display: flex; align-items: center; gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--ag-border);
}
.crd-trend {
    display: inline-flex; align-items: center;
    font-size: 12px; font-weight: 700;
    font-family: 'Public Sans', sans-serif;
    padding: 2px 8px; border-radius: 20px;
}
.crd-trend--up   { background: #e6f9f0; color: #1a7f4e; }
.crd-trend--down { background: #fde8e8; color: #c0392b; }
.crd-trend--neutral { background: #f0f4f9; color: var(--ag-text-muted); }
.crd-trend-label {
    font-size: 11.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
}

/* ── News Card ── */
.crd-news {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.crd-news-img {
    height: 160px; background: #d6e4f7;
    display: flex; align-items: center; justify-content: center;
}
.crd-news-img-placeholder { font-size: 36px; color: #a0b8d8; }
.crd-news-body { padding: 18px 20px 20px; }
.crd-news-date {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-family: 'Public Sans', sans-serif;
    background: #d6e4f7; color: #2d5fa6;
    padding: 3px 10px; border-radius: 20px;
    margin-bottom: 10px; font-weight: 500;
}
.crd-news-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px; font-weight: 600;
    color: #001A3F; margin: 0 0 8px;
}
.crd-news-desc {
    font-size: 13px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
    line-height: 1.55; margin: 0 0 16px;
}
.crd-news-actions { display: flex; gap: 10px; }
.crd-btn-ghost {
    background: none; border: 1.5px solid var(--ag-border);
    border-radius: 8px; padding: 8px 16px;
    font-size: 13px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; color: #001A3F; cursor: pointer;
    transition: background 0.18s;
}
.crd-btn-ghost:hover { background: var(--ag-hover-bg); }
.crd-btn-primary {
    background: #001A3F; border: none;
    border-radius: 8px; padding: 8px 18px;
    font-size: 13px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; color: #fff; cursor: pointer;
    transition: background 0.18s;
}
.crd-btn-primary:hover { background: #0a2d5e; }

/* ── Institution Card ── */
.crd-institution {
    background: #fff; border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    display: flex; flex-direction: column; gap: 16px;
}
.crd-inst-main {
    display: flex; align-items: center; gap: 14px;
}
.crd-inst-logo {
    width: 48px; height: 48px; border-radius: 12px;
    background: #d6e4f7; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #001A3F;
}
.crd-inst-info { flex: 1; }
.crd-inst-name {
    font-family: 'Poppins', sans-serif;
    font-size: 15px; font-weight: 600; color: #001A3F;
}
.crd-inst-sub {
    font-size: 12px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
}
.crd-inst-arrow {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1.5px solid var(--ag-border);
    background: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--ag-text-muted);
    transition: background 0.18s, color 0.18s; flex-shrink: 0;
}
.crd-inst-arrow:hover { background: var(--ag-hover-bg); color: #001A3F; }
.crd-inst-stats {
    display: flex; gap: 0;
    border-top: 1px solid var(--ag-border);
    padding-top: 14px;
}
.crd-inst-stat {
    flex: 1; text-align: center;
    border-right: 1px solid var(--ag-border);
}
.crd-inst-stat:last-child { border-right: none; }
.crd-inst-stat-val {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 18px; font-weight: 700; color: #001A3F;
}
.crd-inst-stat-lbl {
    font-size: 11.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
}

/* ── Module Card ── */
.crd-module {
    background: #fff; border-radius: 14px;
    padding: 24px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    display: flex; flex-direction: column;
    align-items: center; text-align: center; gap: 10px;
}
.crd-module-icon {
    width: 60px; height: 60px; border-radius: 16px;
    background: #d6e4f7;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #001A3F;
    margin-bottom: 4px;
}
.crd-module-name {
    font-family: 'Poppins', sans-serif;
    font-size: 15px; font-weight: 600; color: #001A3F;
}
.crd-module-desc {
    font-size: 12.5px; color: var(--ag-text-muted);
    font-family: 'Public Sans', sans-serif;
    line-height: 1.5; flex: 1;
}
.crd-module-btn {
    width: 100%; margin-top: 8px;
    background: #001A3F; color: #fff; border: none;
    border-radius: 10px; padding: 10px;
    font-size: 13.5px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; cursor: pointer;
    transition: background 0.18s;
}
.crd-module-btn:hover { background: #0a2d5e; }

/* ── Role Card (Dark) ── */
.crd-role {
    background: #001A3F; border-radius: 14px;
    padding: 22px 20px;
    box-shadow: 0 4px 16px rgba(0,26,63,0.25);
    display: flex; flex-direction: column; gap: 10px;
}
.crd-role-top {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}
.crd-role-badge {
    font-size: 11px; font-weight: 600;
    font-family: 'Public Sans', sans-serif;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 3px 10px; border-radius: 20px;
}
.crd-role-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: rgba(255,255,255,0.8);
}
.crd-role-title {
    font-family: 'Poppins', sans-serif;
    font-size: 16px; font-weight: 700;
    color: #ffffff;
}
.crd-role-desc {
    font-size: 12.5px; color: rgba(255,255,255,0.6);
    font-family: 'Public Sans', sans-serif;
    line-height: 1.5; flex: 1;
}
.crd-role-btn {
    margin-top: 6px;
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 10px; padding: 9px 16px;
    font-size: 13px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; color: #fff; cursor: pointer;
    transition: background 0.18s;
    text-align: center;
}
.crd-role-btn:hover { background: rgba(255,255,255,0.18); }

/* Bootstrap col-* gestiona el responsive de las cards */

/* =============================================
   FORM COMPONENTS
   ============================================= */

/* Layout */
.frm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
.frm-col { display: flex; flex-direction: column; gap: 24px; }

.frm-section { padding: 24px; }
.frm-section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #001A3F;
    margin: 0 0 16px;
}

.frm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; position: relative; }
.frm-field:last-child { margin-bottom: 0; }
.frm-field--inline { flex-direction: row; align-items: center; margin-bottom: 10px; }

.frm-label-row { display: flex; justify-content: space-between; align-items: center; }
.frm-label {
    font-size: 13px;
    font-weight: 500;
    color: #001A3F;
    font-family: 'Public Sans', sans-serif;
}
.frm-label--disabled { color: var(--ag-text-muted); }

/* State badges */
.frm-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    background: #e8edf5;
    color: #4a6fa5;
    font-family: 'Public Sans', sans-serif;
}
.frm-badge--error   { background: #fde8e8; color: #c0392b; }
.frm-badge--success { background: #e6f9f0; color: #1a7f4e; }
.frm-badge--disabled{ background: #f0f0f0; color: #aaa; }

/* Base input */
.frm-input {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--ag-border);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 13.5px;
    font-family: 'Public Sans', sans-serif;
    color: #001A3F;
    background: #ffffff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
}
.frm-input::placeholder { color: var(--ag-text-muted); }
.frm-input:focus, .frm-input--focus {
    border-color: #001A3F;
    box-shadow: 0 0 0 3px rgba(0,26,63,0.1);
}
.frm-input--filled  { border-color: var(--ag-border); background: #fafbfd; }
.frm-input--error   { border-color: #e05050; box-shadow: 0 0 0 3px rgba(224,80,80,0.1); }
.frm-input--success { border-color: #1a9e5f; box-shadow: 0 0 0 3px rgba(26,158,95,0.1); }
.frm-input--disabled, .frm-input:disabled,
.frm-select--disabled, .frm-select:disabled {
    background: #f1f5f9; border-color: #e0e0e6; color: #334155; cursor: not-allowed;
    opacity: 1; -webkit-text-fill-color: #334155;
}
.frm-input--date { padding-right: 44px; }

/* Input with icon */
.frm-input-wrap { position: relative; display: flex; align-items: center; }
.frm-input-wrap .frm-input { width: 100%; padding-right: 44px; }
.frm-input-icon {
    position: absolute; right: 14px;
    font-size: 16px; line-height: 1; pointer-events: none;
}
.frm-icon--error   { color: #e05050; }
.frm-icon--success { color: #1a9e5f; }
.frm-icon--date    { pointer-events: all; cursor: pointer; color: var(--ag-text-muted); }

/* Native date inputs inside frm-input-wrap: hide the browser's built-in calendar icon */
.frm-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
}

/* Hints */
.frm-hint { font-size: 12px; font-family: 'Public Sans', sans-serif; }
.frm-hint--error   { color: #e05050; }
.frm-hint--success { color: #1a9e5f; }

/* Mode-selector cards (Vincular a, etc.) */
.tx-mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--ag-border);
    border-left: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: #f8fafc;
    transition: background .15s, border-left-color .15s;
    margin-bottom: 8px;
    user-select: none;
}
.tx-mode-card:last-child { margin-bottom: 0; }
.tx-mode-card--active {
    border-left-color: #1e4da1 !important;
    background: #eff6ff !important;
}
.tx-mode-card--active .tx-mode-card-title { color: #1e4da1 !important; }

/* Select */
.frm-select-wrap { position: relative; }
.frm-select {
    width: 100%; height: 44px;
    border: 1.5px solid var(--ag-border);
    border-radius: 10px;
    padding: 0 40px 0 14px;
    font-size: 13.5px;
    font-family: 'Public Sans', sans-serif;
    color: #001A3F;
    background: #ffffff;
    outline: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.18s;
}
.frm-select:focus { border-color: #001A3F; box-shadow: 0 0 0 3px rgba(0,26,63,0.1); }
.frm-select-arrow {
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%);
    pointer-events: none; color: var(--ag-text-muted); font-size: 13px;
}

/* Textarea */
.frm-textarea {
    width: 100%; min-height: 100px;
    border: 1.5px solid var(--ag-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13.5px;
    font-family: 'Public Sans', sans-serif;
    color: #001A3F;
    background: #ffffff;
    outline: none; resize: vertical;
    transition: border-color 0.18s;
    box-sizing: border-box;
}
.frm-textarea::placeholder { color: var(--ag-text-muted); }
.frm-textarea:focus { border-color: #001A3F; box-shadow: 0 0 0 3px rgba(0,26,63,0.1); }

/* Checkbox */
.frm-check-group { display: flex; flex-direction: column; gap: 10px; }
.frm-check-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 13.5px; font-family: 'Public Sans', sans-serif;
    color: #001A3F; cursor: pointer; user-select: none;
}
.frm-check-item--disabled { color: var(--ag-text-muted); cursor: not-allowed; }

.frm-checkbox {
    width: 18px; height: 18px;
    border-radius: 4px;
    accent-color: #001A3F;
    cursor: pointer; flex-shrink: 0;
}

/* Radio */
.frm-radio {
    width: 18px; height: 18px;
    accent-color: #001A3F;
    cursor: pointer; flex-shrink: 0;
}

/* Toggle */
.frm-toggle { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.frm-toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.frm-toggle-track {
    width: 40px; height: 22px;
    background: #c5cfe0;
    border-radius: 20px;
    transition: background 0.22s;
    position: relative;
    cursor: pointer;
}
.frm-toggle-track::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px;
    border-radius: 50%; background: #fff;
    transition: transform 0.22s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.frm-toggle-input:checked + .frm-toggle-track { background: #001A3F; }
.frm-toggle-input:checked + .frm-toggle-track::after { transform: translateX(18px); }
.frm-toggle-input:disabled + .frm-toggle-track { background: #e0e0e6; cursor: not-allowed; }

/* Search command box */
.frm-search-cmd {
    display: flex; align-items: center; gap: 10px;
    border: 1.5px solid var(--ag-border);
    border-radius: 10px; padding: 0 14px; height: 44px;
    background: #ffffff;
}
.frm-search-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--ag-border); flex-shrink: 0;
}
.frm-search-cmd-input {
    flex: 1; border: none; outline: none;
    font-size: 13.5px; font-family: 'Public Sans', sans-serif;
    color: #001A3F;
}
.frm-search-cmd-input::placeholder { color: var(--ag-text-muted); }
.frm-kbd {
    font-size: 11px; font-family: 'Public Sans', sans-serif;
    color: var(--ag-text-muted);
    background: #f0f4f9; border: 1px solid var(--ag-border);
    border-radius: 5px; padding: 2px 7px;
    white-space: nowrap;
}

/* Mini Calendar */
.frm-calendar {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 10000;
    background: #fff; border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,26,63,0.14);
    padding: 16px; width: 280px;
}
.cal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.cal-month-label {
    font-family: 'Poppins', sans-serif; font-size: 14px;
    font-weight: 600; color: #001A3F;
}
.cal-nav {
    background: none; border: none; cursor: pointer;
    color: var(--ag-text-muted); font-size: 14px;
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.cal-nav:hover { background: var(--ag-hover-bg); color: #001A3F; }
.cal-grid { }
.cal-dow {
    display: inline-block; width: calc(100%/7);
    text-align: center; font-size: 11px;
    font-family: 'Poppins', sans-serif; font-weight: 600;
    color: var(--ag-text-muted); padding: 4px 0;
}
.cal-days {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-day {
    height: 32px; width: 100%;
    border: none; background: none; border-radius: 8px;
    font-size: 12.5px; font-family: 'Public Sans', sans-serif;
    color: #001A3F; cursor: pointer;
    transition: background 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.cal-day:hover:not(.cal-day--other) { background: var(--ag-hover-bg); }
.cal-day--other { color: #c0c8d8; }
.cal-day--today {
    border: 1.5px solid #001A3F; font-weight: 600;
}
.cal-day--selected {
    background: #001A3F !important; color: #fff !important;
    font-weight: 600;
}
.cal-footer {
    display: flex; justify-content: space-between;
    border-top: 1px solid var(--ag-border); padding-top: 10px; margin-top: 8px;
}
.cal-foot-btn {
    background: none; border: none; cursor: pointer;
    font-size: 12.5px; font-family: 'Public Sans', sans-serif;
    color: #001A3F; font-weight: 600; padding: 4px 8px;
    border-radius: 6px; transition: background 0.15s;
}
.cal-foot-btn:hover { background: var(--ag-hover-bg); }

/* Date range picker */

.cal-range-hint {
    font-size: 11.5px; font-family: 'Public Sans', sans-serif;
    color: #2d5fa6; font-weight: 600;
    text-align: center; margin-bottom: 8px;
    padding: 4px 10px; background: #d6e4f7;
    border-radius: 6px;
}

.cal-day--range-start,
.cal-day--range-end {
    background: #001A3F !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 8px;
}
.cal-day--in-range {
    background: #d6e4f7 !important;
    color: #001A3F;
    border-radius: 0;
}
.cal-day--range-start { border-radius: 8px 0 0 8px !important; }
.cal-day--range-end   { border-radius: 0 8px 8px 0 !important; }

/* Form card: Nuevo Usuario */
.frm-form-card { overflow: visible; }
.frm-card-header {
    border-bottom: 1px solid var(--ag-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.frm-card-title {
    font-family: 'Poppins', sans-serif; font-size: 15px;
    font-weight: 600; color: #001A3F;
}
.frm-card-body { padding: 24px; }
.frm-card-actions {
    display: flex; justify-content: center; gap: 16px;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--ag-border);
}
.frm-btn-cancel {
    background: none; border: none; cursor: pointer;
    font-size: 14px; font-family: 'Public Sans', sans-serif;
    font-weight: 600; color: var(--ag-text-muted);
    padding: 10px 20px; border-radius: 10px;
    transition: color 0.18s, background 0.18s;
}
.frm-btn-cancel:hover { color: #001A3F; background: var(--ag-hover-bg); }
.frm-btn-save {
    background: #001A3F; color: #fff; border: none;
    cursor: pointer; font-size: 14px;
    font-family: 'Public Sans', sans-serif; font-weight: 600;
    padding: 10px 24px; border-radius: 10px;
    transition: background 0.18s;
}
.frm-btn-save:hover { background: #0a2d5e; }

@media (max-width: 860px) {
    .frm-grid { grid-template-columns: 1fr; }
}

/* Focus styles */
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* =============================================
   DATATABLES OVERRIDES
   ============================================= */
div.dt-container { font-family: 'Public Sans', sans-serif; font-size: 13px; color: var(--ag-text-primary); }

/* Wrapper top/bottom */
div.dt-layout-row { display: flex !important; align-items: center; justify-content: space-between !important; flex-wrap: wrap; gap: 10px; padding: 12px 16px; width: 100%; }
div.dt-layout-row:first-child { border-bottom: 1px solid var(--ag-border); }
div.dt-layout-row:last-child  { border-top: 1px solid var(--ag-border); }
div.dt-layout-start {
    margin-right: auto !important;
    flex: 0 0 auto;
    margin-left: 10px !important;
    margin-right: 10px !important;
}
div.dt-layout-end {
    margin-left: auto !important;
    flex: 0 0 auto;
    margin-left: 10px !important;
    margin-right: 10px !important;
}

/* Length (mostrar N registros) */
div.dt-length label { display: flex; align-items: center; gap: 8px; color: var(--ag-text-muted); font-size: 12.5px; }
div.dt-length select {
    border: 1px solid var(--ag-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12.5px;
    font-family: 'Public Sans', sans-serif;
    color: var(--ag-text-primary);
    background: #fff;
    outline: none;
}

/* Search */
div.dt-search { display: flex; align-items: center; gap: 8px; }
div.dt-search label { color: var(--ag-text-muted); font-size: 12.5px; }
div.dt-search input {
    border: 1px solid var(--ag-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-family: 'Public Sans', sans-serif;
    color: var(--ag-text-primary);
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
div.dt-search input:focus { border-color: #1e4da1; }

/* Info */
div.dt-info { color: var(--ag-text-muted); font-size: 12px; }

/* Paginación */
div.dt-paging .dt-paging-button {
    border: 1px solid var(--ag-border) !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: var(--ag-text-primary) !important;
    padding: 4px 10px !important;
    font-size: 12.5px !important;
    font-family: 'Public Sans', sans-serif !important;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 32px;
    text-align: center;
}
div.dt-paging .dt-paging-button:hover:not(.disabled) { background: var(--ag-hover-bg) !important; border-color: #1e4da1 !important; }
div.dt-paging .dt-paging-button.current { background: #1e4da1 !important; color: #fff !important; border-color: #1e4da1 !important; }
div.dt-paging .dt-paging-button.disabled { opacity: 0.4; cursor: not-allowed; }
div.dt-paging nav { display: flex; gap: 4px; }

/* Scroll wrapper */
div.dtfh-floatingparent, .dataTables_scrollBody { border: none !important; }
.dataTables_scrollBody::-webkit-scrollbar { height: 5px; }
.dataTables_scrollBody::-webkit-scrollbar-track { background: var(--ag-hover-bg); }
.dataTables_scrollBody::-webkit-scrollbar-thumb { background: var(--ag-border); border-radius: 4px; }

/* Sorting icons */
table.dataTable thead th.dt-orderable-asc span.dt-column-order::before,
table.dataTable thead th.dt-orderable-desc span.dt-column-order::after { opacity: 0.3; }
table.dataTable thead th.dt-ordering-asc span.dt-column-order::before,
table.dataTable thead th.dt-ordering-desc span.dt-column-order::after { opacity: 1; color: #1e4da1; }

/* =============================================
   PAGE COMPONENTS
   ============================================= */
.ag-page-header {
    background: #1e4da1;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.ag-page-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ag-page-header-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ag-page-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}
.ag-page-subtitle {
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.70);
    margin: 2px 0 0;
}

/* Card container */
.ag-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
}
.ag-card.frm-section--overflow {
    overflow: visible;
}

/* =============================================
   TABLE TOOLBAR
   ============================================= */
.ag-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
}

.ag-table-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ag-text-primary);
}

.ag-table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ag-toolbar-label {
    font-size: 13.5px;
    color: var(--ag-text-primary);
}

.ag-input-sm {
    width: 60px;
    height: 34px;
    border: 1px solid var(--ag-border);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 13.5px;
    color: var(--ag-text-primary);
    text-align: center;
    outline: none;
    font-family: 'Public Sans', sans-serif;
}
.ag-input-sm:focus { border-color: #2d5fa6; }

/* Primary button */
.ag-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #001A3F;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 13.5px;
    font-family: 'Public Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ag-btn-primary:hover { background: #0a2d5e; }

.ag-btn-icon {
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

/* Search box */
.ag-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--ag-border);
    border-radius: 10px;
    padding: 0 14px;
    height: 38px;
    background: #ffffff;
    min-width: 200px;
}
.ag-search-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ag-border);
    flex-shrink: 0;
}
.ag-search-input {
    border: none;
    outline: none;
    font-size: 13.5px;
    color: var(--ag-text-primary);
    font-family: 'Public Sans', sans-serif;
    flex: 1;
}
.ag-search-input::placeholder { color: var(--ag-text-muted); }

/* Normalización de altura en toolbars de filtro:
   ag-search-box, frm-input tipo date/text, y ag-btn deben medir igual */
.ag-table-toolbar .frm-input,
.ag-table-toolbar .frm-select {
    height: 38px;
    width: auto;
    font-size: 13px;
    padding: 0 10px;
}
.ag-table-toolbar .frm-input:focus,
.ag-table-toolbar .frm-select:focus {
    height: 38px;
}
.ag-table-toolbar .ag-btn {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    min-width: 0;
}
/* Formularios de filtro fuera de toolbar (Offerings flat form, etc.) */
form.ag-card .frm-input,
form.ag-card .frm-select {
    height: 38px;
    width: auto;
    font-size: 13px;
    padding: 0 10px;
}
form.ag-card .ag-btn {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
}

/* =============================================
   TABLE
   ============================================= */
.ag-table-wrapper {
    overflow-x: auto;
}

.ag-table {
    width: 100%;
    border-collapse: collapse;
}

.ag-table thead tr {
    background: #c8d9f0;
}

.ag-table th {
    padding: 13px 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #001A3F;
    text-align: left;
    white-space: nowrap;
}

.ag-th-check { width: 44px; }

.ag-table td {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--ag-text-primary);
    border-bottom: 1px solid var(--ag-border);
    vertical-align: middle;
}

.ag-table tbody tr:last-child td {
    border-bottom: none;
}

.ag-table tbody tr:hover {
    background: var(--ag-hover-bg);
}

.ag-row-selected td {
    background: #dce8f8 !important;
}

/* Checkbox */
.ag-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #001A3F;
    cursor: pointer;
    border-radius: 4px;
}

/* Badges */
.ag-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Public Sans', sans-serif;
}
.ag-badge-activo        { background: #e6f9f0; color: #1a7f4e; }
.ag-badge-inactivo      { background: #fde8e8; color: #c0392b; }
.ag-badge-pendiente     { background: #fff4e0; color: #b07a10; }
.ag-badge-contabilizada { background: #eef2ff; color: #4338ca; }

/* Action buttons — td debe mantener display:table-cell para no romper alineación del thead */
.ag-td-actions {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
/* Wrapper interior para los botones de acción */
.ag-td-actions > div,
.ag-actions-wrap {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}
/* Botones directos hijos (sin wrapper) quedan inline-flex */
.ag-td-actions > .ag-action-btn,
.ag-td-actions > a.ag-action-btn {
    display: inline-flex;
    margin: 0 2px;
}

.ag-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.18s;
}
.ag-action-btn:hover { opacity: 0.8; }

.ag-action-edit {
    background: transparent;
    color: #001A3F;
    border-color: transparent;
}
.ag-action-delete {
    background: #fde8e8;
    color: #c0392b;
    border-color: #f5c0c0;
}
.ag-action-view {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}
.ag-action-confirm {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}
.ag-action-post {
    background: #dbeafe;
    color: #1e4da1;
    border-color: #93c5fd;
}
.ag-action-void {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fdba74;
}

/* ── Edit direction toggle ── */
.edit-dir-toggle {
    display: flex; gap: 4px;
    background: #eef2f7; border-radius: 10px; padding: 4px;
    margin-bottom: 16px;
}
.edit-dir-btn {
    flex: 1; padding: 8px 12px; border-radius: 8px;
    border: none; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all .18s; color: var(--ag-text-muted);
    background: transparent;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.edit-dir-btn--active-ingreso { background: #fff; color: #15803d; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.edit-dir-btn--active-egreso  { background: #fff; color: #dc2626; box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* =============================================
   TABLE FOOTER / PAGINATION
   ============================================= */
.ag-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--ag-border);
}

.ag-table-info {
    font-size: 13px;
    color: var(--ag-text-muted);
}

.ag-pagination {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ag-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--ag-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ag-text-primary);
    font-size: 13px;
    font-family: 'Public Sans', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}
.ag-page-btn:hover:not(:disabled):not(.active) {
    background: var(--ag-hover-bg);
}
.ag-page-btn.active {
    background: #001A3F;
    color: #ffffff;
    border-color: #001A3F;
    font-weight: 600;
}
.ag-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.ag-page-ellipsis {
    border-color: transparent;
    background: transparent;
    cursor: default;
}

/* ============================================================
   COMPATIBILIDAD — utilidades Tailwind usadas en JS y vistas legacy
   ============================================================ */
.hidden { display: none !important; }

/* Flex & Grid */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

/* Gap & Spacing */
.gap-1 { gap: 4px; }   .gap-2 { gap: 8px; }   .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }  .gap-6 { gap: 24px; }
.p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-5 { padding: 20px; }
.p-6 { padding: 24px; } .p-10 { padding: 40px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1\.5 { padding-top: 6px; padding-bottom: 6px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.pt-1\.5 { padding-top: 6px; } .pt-2 { padding-top: 8px; } .pt-4 { padding-top: 16px; }
.pb-5 { padding-bottom: 20px; }
.pl-9 { padding-left: 36px; }
.mt-0\.5 { margin-top: 2px; } .mt-1 { margin-top: 4px; }
.mt-1\.5 { margin-top: 6px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-1\.5 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; } .mr-16 { margin-right: 64px; }
.space-y-1\.5 > * + * { margin-top: 6px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }

/* Typography */
.text-xs { font-size: 12px; line-height: 1.4; }
.text-sm { font-size: 14px; line-height: 1.5; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: .025em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =============================================
   SELECT2 — AG Design overrides
   ============================================= */
.select2-container--bootstrap-5 .select2-selection {
    font-family: 'Public Sans', sans-serif;
    font-size: 13px;
    color: var(--ag-text-primary);
    background: #fff;
    border: 1.5px solid var(--ag-border);
    border-radius: 8px;
    min-height: 40px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    transition: border-color .15s;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open  .select2-selection {
    border-color: #1e4da1;
    box-shadow: 0 0 0 3px rgba(30,77,161,.12);
    outline: none;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--ag-text-primary);
    font-size: 13px;
    padding: 0;
    line-height: 1.4;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: var(--ag-text-muted);
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 10px;
}
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1.5px solid var(--ag-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,26,63,.10);
    font-size: 13px;
    font-family: 'Public Sans', sans-serif;
    overflow: hidden;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--ag-border);
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: 'Public Sans', sans-serif;
    color: var(--ag-text-primary);
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #1e4da1;
    box-shadow: none;
    outline: none;
}
.select2-container--bootstrap-5 .select2-results__option {
    padding: 7px 12px;
    font-size: 13px;
    color: var(--ag-text-primary);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: #dbeafe;
    color: #1e4da1;
}
.select2-container--bootstrap-5 .select2-results__option--selected {
    background: var(--ag-hover-bg);
    color: var(--ag-text-primary);
    font-weight: 600;
}
/* z-index dentro de modales */
.mdl-overlay .select2-container { z-index: 10500; }
.select2-dropdown { z-index: 10600; }
.whitespace-nowrap { white-space: nowrap; }
.italic { font-style: italic; } .leading-none { line-height: 1; }

/* Text colors */
.text-slate-400 { color: #94a3b8; } .text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; } .text-slate-700 { color: #334155; }
.text-slate-800 { color: #1e293b; }
.text-blue-600 { color: #2563eb; }  .text-blue-700 { color: #1d4ed8; }
.text-indigo-600 { color: #4f46e5; }
.text-green-600 { color: #16a34a; } .text-green-700 { color: #15803d; }
.text-emerald-600 { color: #059669; } .text-emerald-700 { color: #047857; }
.text-red-500 { color: #ef4444; }   .text-red-600 { color: #dc2626; }  .text-red-700 { color: #b91c1c; }
.text-orange-700 { color: #c2410c; } .text-amber-600 { color: #d97706; }

/* Background & border colors */
.bg-white { background-color: #fff; }
.bg-slate-50 { background-color: #f8fafc; } .bg-slate-100 { background-color: #f1f5f9; }
.bg-blue-50 { background-color: #eff6ff; }  .bg-blue-600 { background-color: #2563eb; }
.bg-green-50 { background-color: #f0fdf4; } .bg-green-100 { background-color: #dcfce7; }
.bg-red-50 { background-color: #fef2f2; }   .bg-red-100 { background-color: #fee2e2; }
.bg-orange-100 { background-color: #ffedd5; }
.bg-amber-50 { background-color: #fffbeb; }
.bg-indigo-50 { background-color: #eef2ff; }
.bg-emerald-50 { background-color: #ecfdf5; }
.border { border-width: 1px; border-style: solid; }
.border-t { border-top: 1px solid; } .border-b { border-bottom: 1px solid; }
.border-t-2 { border-top: 2px solid; }
.border-slate-100 { border-color: #f1f5f9; }  .border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }   .border-indigo-300 { border-color: #a5b4fc; }
.border-red-200 { border-color: #fecaca; }     .border-amber-300 { border-color: #fcd34d; }
.divide-y > * + * { border-top: 1px solid #f1f5f9; }

/* Border radius */
.rounded { border-radius: 4px; } .rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; } .rounded-xl { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

/* Size & overflow */
.w-full { width: 100%; } .w-full { width: 100%; }
.max-w-xs { max-width: 20rem; } .max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; } .max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.min-h-screen { min-height: 100vh; } .min-w-48 { min-width: 12rem; }
.h-6 { height: 24px; } .w-6 { width: 24px; } .w-32 { width: 8rem; }
.w-44 { width: 11rem; } .w-24 { width: 6rem; } .w-28 { width: 7rem; }
.overflow-hidden { overflow: hidden; } .overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Position & z-index */
.relative { position: relative; } .absolute { position: absolute; } .fixed { position: fixed; }
.top-2\.5 { top: 10px; } .left-3 { left: 12px; }
.inset-0 { inset: 0; } .z-50 { z-index: 50; } .z-\[9999\] { z-index: 9999; }

/* Shadow, transition, opacity */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); }
.transition-colors { transition: color .15s, background-color .15s, border-color .15s; }
.outline-none { outline: none; }
.opacity-25 { opacity: .25; } .opacity-60 { opacity: .6; } .opacity-75 { opacity: .75; }
@keyframes ag-spin { to { transform: rotate(360deg); } }
.animate-spin { animation: ag-spin 1s linear infinite; }

/* Tab buttons (clases asignadas por JS en Treasury) */
.tab-btn {
    padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s, color .15s;
    color: var(--ag-text-muted); background: transparent;
    border: none; cursor: pointer; white-space: nowrap;
}
.tab-btn.bg-blue-50 {
    background: #d6e4f7 !important; color: #001A3F !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tab-btn:not(.bg-blue-50):hover { background: var(--ag-hover-bg); }

/* Botones de acción compactos legacy (Registrar / Anular / Contabilizar) */
.btn-registrar, .btn-anular, .btn-contabilizar {
    padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
    border: none; cursor: pointer; transition: background .15s; white-space: nowrap;
}
.btn-registrar { background: #d6e4f7; color: #001A3F; }
.btn-registrar:hover { background: #b8d0ed; }
.btn-contabilizar { background: #d4f0e2; color: #1a7a4a; }
.btn-contabilizar:hover { background: #b8e4ce; }
.btn-anular { background: #fde8e8; color: #c0392b; }
.btn-anular:hover { background: #fcc8c8; }

/* Focusring (forms en modales legacy) */
.focus\:ring-2:focus, input.focus-ring:focus, select.focus-ring:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .4);
}

/* Backdrop darkened overlay (Tailwind bg-black/50 usado en algunos modales) */
.bg-black\/50 { background-color: rgba(0,0,0,.5); }
.bg-black\/40 { background-color: rgba(0,0,0,.4); }
.bg-black\/60 { background-color: rgba(0,0,0,.6); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }

/* Hover utilities usados en botones legacy */
.hover\:bg-slate-50:hover  { background-color: #f8fafc; }
.hover\:bg-slate-100:hover { background-color: #f1f5f9; }
.hover\:bg-blue-50:hover   { background-color: #eff6ff; }
.hover\:bg-blue-100:hover  { background-color: #dbeafe; }
.hover\:bg-red-50:hover    { background-color: #fef2f2; }
.hover\:bg-red-100:hover   { background-color: #fee2e2; }
.hover\:bg-green-100:hover { background-color: #dcfce7; }
.hover\:bg-indigo-50:hover { background-color: #eef2ff; }
.hover\:bg-emerald-100:hover { background-color: #d1fae5; }
.hover\:text-slate-600:hover { color: #475569; }
.hover\:text-slate-800:hover { color: #1e293b; }
.hover\:bg-amber-100:hover   { background-color: #fef3c7; }
.hover\:bg-violet-100:hover  { background-color: #ede9fe; }

/* Spacing utilities adicionales */
.space-y-5 > * + * { margin-top: 20px; }
.gap-x-6 { column-gap: 24px; }
.gap-y-0 { row-gap: 0; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-0\.5 { padding-top: 2px; padding-bottom: 2px; }
.px-2\.5 { padding-left: 10px; padding-right: 10px; }
.pr-4 { padding-right: 16px; } .pr-6 { padding-right: 24px; }
.pl-0 { padding-left: 0; }
.mb-0\.5 { margin-bottom: 2px; }
.max-h-\[90vh\] { max-height: 90vh; }

/* Misc */
.leading-tight { line-height: 1.25; }
.line-through { text-decoration: line-through; }
.w-4 { width: 16px; } .h-4 { height: 16px; }
.w-9 { width: 36px; } .h-9 { height: 36px; }
.text-right { text-align: right; }
.flex-shrink-0 { flex-shrink: 0; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; -webkit-user-select: none; }
.rounded-2xl { border-radius: 16px; }
.sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 640px) { .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ============================================================
   SIDEBAR — COLLAPSIBLE NAV GROUPS (acordeón)
   El toggle se diseña igual que ag-nav-item para coherencia visual.
   ============================================================ */

/* Toggle header: ag-nav-item + cursor pointer */
.ag-nav-group-toggle {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Flecha de colapso — vive dentro del toggle como último hijo */
.ag-nav-chevron-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(180, 196, 220, .5);
    transition: transform .22s ease;
    flex-shrink: 0;
    /* width: auto sobreescribe el width:20px que ag-nav-item i hereda */
    width: auto !important;
}
.ag-nav-group.open > .ag-nav-group-toggle .ag-nav-chevron-wrap {
    transform: rotate(180deg);
    color: rgba(180, 196, 220, .85);
}

/* Sub-items: mismo diseño que ag-nav-item pero con sangría */
.ag-nav-subitem {
    padding-left: 28px;
}
.ag-nav-subitem.active {
    padding-left: 25px; /* compensa el border-left: 3px */
}

/* Collapse container — max-height controlado por JS para animación exacta */
.ag-nav-collapse {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-in-out;
}

/* ── Sidebar colapsado (60px): ignora estado del acordeón ── */
.ag-sidebar.collapsed .ag-nav-collapse {
    max-height: none !important;
    overflow: visible;
}
/* En modo colapsado el sub-item se centra igual que ag-nav-item */
.ag-sidebar.collapsed .ag-nav-subitem {
    padding-left: 9px;
    justify-content: center;
}
.ag-sidebar.collapsed .ag-nav-subitem.active {
    padding-left: 6px;
    justify-content: center;
}

/* ============================================================
   KT MENU — reemplazo de colores del skin oscuro de Metronic
   Solo se sobreescriben colores; layout y comportamiento intactos
   ============================================================ */

/* menu.css pone background-color:#242939 en .aside-menu directamente */
nav#sidebar .aside-menu { background-color: transparent !important; }

/* menu.css pone padding:15px 0 en .menu-nav — quitamos el top para que
   el primer ítem quede pegado al borde superior del sidebar */
nav#sidebar .aside-menu .menu-nav { padding-top: 0 !important; }

/* Flecha: fuente Ki no está cargada → ::before muestra □.
   Lo ocultamos; el bi-chevron-down dentro del <i> se encarga */
nav#sidebar .menu-link .menu-arrow::before { content: none !important; }
nav#sidebar .menu-item-open > .menu-link .menu-arrow { transform: rotate(90deg); }

/* Iconos SVG propios (wwwroot/Iconos): se muestran con su color original,
   sin heredar el color de estado normal/hover/activo del menú */
.ag-icon-svg {
    display: inline-block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: none;
}

/* Variante pequeña: iconos de acciones dentro de tablas (ver/editar/eliminar/etc.) */
.ag-icon-svg--sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex: none;
}

/* Tipografía del menú: forzamos Public Sans (misma familia que Login/Landing) */
nav#sidebar .menu-nav .menu-text { font-family: 'Public Sans', sans-serif !important; }

/* Estado normal: menu.css pone text=#989EB3, icon=#4B5575, arrow=#4B5575 */
nav#sidebar .menu-nav > .menu-item > .menu-link .menu-text { color: var(--ag-text-primary) !important; }
nav#sidebar .menu-nav > .menu-item > .menu-link .menu-icon { color: var(--ag-nav-label-color) !important; }
nav#sidebar .menu-nav > .menu-item > .menu-link .menu-arrow { color: var(--ag-nav-label-color) !important; }

/* Hover: menu.css pone bg=#1F2433, text=#fff, icon=#3699FF */
nav#sidebar .menu-nav > .menu-item:hover > .menu-link { background-color: var(--ag-hover-bg) !important; }
nav#sidebar .menu-nav > .menu-item:hover > .menu-link .menu-text { color: var(--ag-text-primary) !important; }
nav#sidebar .menu-nav > .menu-item:hover > .menu-link .menu-icon { color: var(--ag-active-text) !important; }
nav#sidebar .menu-nav > .menu-item:hover > .menu-link .menu-arrow { color: var(--ag-active-text) !important; }

/* Abierto (menu-item-open): menu.css pone bg=#1F2433, text=#fff, icon=#3699FF */
nav#sidebar .menu-nav > .menu-item.menu-item-open > .menu-link { background-color: var(--ag-hover-bg) !important; }
nav#sidebar .menu-nav > .menu-item.menu-item-open > .menu-link .menu-text { color: var(--ag-active-text) !important; }
nav#sidebar .menu-nav > .menu-item.menu-item-open > .menu-link .menu-icon { color: var(--ag-active-text) !important; }
nav#sidebar .menu-nav > .menu-item.menu-item-open > .menu-link .menu-arrow { color: var(--ag-active-text) !important; }

/* Activo (menu-item-active): menu.css pone bg=#1F2433, text=#fff, icon=#3699FF */
nav#sidebar .menu-nav > .menu-item.menu-item-active > .menu-link {
    background-color: var(--ag-active-bg) !important;
    border-left: 3px solid #001A3F !important;
}
nav#sidebar .menu-nav > .menu-item.menu-item-active > .menu-link .menu-text { color: var(--ag-active-text) !important; }
nav#sidebar .menu-nav > .menu-item.menu-item-active > .menu-link .menu-icon { color: var(--ag-active-text) !important; }

/* Sub-ítems normal: menu.css pone text=#989EB3, icon=#494b74 */
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item > .menu-link .menu-text { color: var(--ag-text-primary) !important; }
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item > .menu-link .menu-icon { color: var(--ag-nav-label-color) !important; }

/* Sub-ítems hover */
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item:hover > .menu-link { background-color: var(--ag-hover-bg) !important; }
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item:hover > .menu-link .menu-text { color: var(--ag-text-primary) !important; }

/* Sub-ítems activos */
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item.menu-item-active > .menu-link {
    background-color: var(--ag-active-bg) !important;
    border-left: 3px solid #001A3F !important;
}
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item.menu-item-active > .menu-link .menu-text { color: var(--ag-active-text) !important; }
nav#sidebar .menu-nav > .menu-item .menu-submenu .menu-item.menu-item-active > .menu-link .menu-icon { color: var(--ag-active-text) !important; }

/* Flyout colapsado — solo fondo blanco con sombra */
body.aside-minimize nav#sidebar .menu-item.menu-item-hover > .menu-submenu {
    background-color: #ffffff !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12) !important;
    border-radius: 8px !important;
}
