/* ============================================================
   GFG H2H — Sistema de diseño
   Grupo Firmas Globales · paleta clara derivada de la identidad
   ------------------------------------------------------------
   Los tres colores del manual quedan intactos:
     #28333b (PANTONE 7546 C) · #71E4D1 (PANTONE 332 C) · #E6E6E5 (663 C)
   El resto se derivó en OKLCH sobre el matiz exacto de esos colores.
   Todo par texto/fondo del sistema cumple WCAG AA (mínimo 4.5:1).
   ============================================================ */

:root {
    /* ─── Marca (sin cambios) ─────────────────────────── */
    --gfg-teal:             #28333b;
    --gfg-teal-deep:        #1f2a33;
    --gfg-teal-soft:        #33454f;
    --gfg-turquoise-fill:   #71E4D1;   /* rellenos, CTA, marcas de gráfica */
    --gfg-gray:             #E6E6E5;
    --gfg-white:            #FFFFFF;

    /* ─── Superficies ─────────────────────────────────── */
    --bg:                   #eff4f8;
    --surface:              #ffffff;
    --surface-2:            #f6f9fb;
    --surface-3:            #f0f4f7;
    --border:               #e2e9ee;
    --border-strong:        #cbdae5;

    /* ─── Texto (contraste verificado sobre blanco) ───── */
    --text-primary:         #28333b;   /* 12.9:1 */
    --text-secondary:       #4d5a63;   /*  7.1:1 */
    --text-muted:           #616e78;   /*  5.2:1 */
    --text-on-dark:         #ffffff;
    --text-on-dark-soft:    #b8c4cc;
    --text-on-dark-mute:    #8697a3;

    /* ─── Acento interactivo ──────────────────────────── */
    /* El turquesa de marca da 1.4:1 como texto sobre blanco: se conserva
       para rellenos y CTA, y para texto se usa el mismo matiz oscurecido. */
    --accent:               #007a6c;   /*  5.3:1 — enlaces, texto activo */
    --accent-hover:         #005f54;   /*  7.6:1 */
    --accent-tint:          #d9faf3;
    --accent-tint-2:        #bdf1e7;

    /* ─── Colores con significado ─────────────────────── */
    /* Separados del turquesa de marca: antes abono y logotipo compartían color. */
    --pos:                  #2f7a41;
    --pos-fill:             #4fae62;
    --pos-tint:             #e3f9e5;
    --neg:                  #b3372c;
    --neg-fill:             #dc5a4d;
    --neg-tint:             #ffeae5;
    --warn:                 #8a6008;
    --warn-fill:            #d49838;
    --warn-tint:            #ffefd8;
    --warn-border:          #f0d5a8;

    /* ─── Compatibilidad con estilos en línea de las páginas ─── */
    --gfg-turquoise:        #007a6c;   /* se usa como color de texto */
    --gfg-turquoise-bright: #005f54;
    --gfg-turquoise-dim:    #00a28c;
    --gfg-green:            #2f7a41;   /* ya NO es el turquesa de marca */
    --gfg-red:              #b3372c;
    --gfg-red-bright:       #dc5a4d;
    --gfg-amber:            #8a6008;
    --gfg-teal-mid:         #f6f9fb;
    --gfg-teal-light:       #f0f4f7;
    --gfg-slate:            #4d5a63;
    --gfg-slate-light:      #616e78;
    --border-light:         #cbdae5;
    --glass:                rgba(255,255,255,.86);

    /* ─── Forma y elevación ───────────────────────────── */
    --r-sm:                 4px;
    --r:                    6px;
    --r-lg:                 8px;
    --r-xl:                 10px;
    --shadow-sm:            0 1px 2px rgba(31,42,51,.06);
    --shadow:               0 1px 3px rgba(31,42,51,.08), 0 4px 12px rgba(31,42,51,.05);
    --shadow-lg:            0 20px 60px rgba(31,42,51,.28);

    /* ─── Bootstrap ───────────────────────────────────── */
    --bs-body-bg:           #eff4f8;
    --bs-body-color:        #28333b;
    --bs-border-color:      #e2e9ee;
    --bs-link-color:        #007a6c;
    --bs-link-hover-color:  #005f54;
    --bs-primary:           #007a6c;
    --bs-font-sans-serif:   'Montserrat', -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* ─── Base ────────────────────────────────────────────── */
html, body {
    font-family: 'Montserrat', -apple-system, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', Arial, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 24px; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: 0; }

h1:focus { outline: none; }

.mono, .amount, .kpi-value, .card-text {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* ─── Enlaces ─────────────────────────────────────────── */
a, .btn-link {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s;
}

a:hover, .btn-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ─── Botones ─────────────────────────────────────────── */
.btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    border-radius: var(--r);
    padding: 0 16px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background-color .15s, border-color .15s, color .15s;
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
}

.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; }

/* Acción principal: turquesa de marca con texto teal (8.4:1) */
.btn-primary, .btn-success {
    color: var(--gfg-teal);
    background-color: var(--gfg-turquoise-fill);
    border-color: var(--gfg-turquoise-fill);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active {
    color: var(--gfg-teal);
    background-color: #55d7c1;
    border-color: #55d7c1;
}

.btn-primary:disabled, .btn-success:disabled,
.btn-primary.disabled, .btn-success.disabled {
    background-color: var(--border);
    border-color: var(--border);
    color: var(--text-on-dark-mute);
    opacity: 1;
}

.btn-secondary {
    color: var(--text-primary);
    background-color: transparent;
    border-color: var(--gfg-teal);
}

.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active {
    color: var(--text-on-dark);
    background-color: var(--gfg-teal);
    border-color: var(--gfg-teal);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    background-color: var(--surface);
    border-color: var(--border-strong);
    font-weight: 500;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus, .btn-outline-secondary:active {
    background-color: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-outline-success {
    color: var(--accent);
    background-color: var(--surface);
    border-color: var(--border-strong);
}

.btn-outline-success:hover, .btn-outline-success:focus, .btn-outline-success:active {
    background-color: var(--accent-tint);
    color: var(--accent-hover);
    border-color: var(--accent);
}

.btn-danger {
    color: var(--gfg-white);
    background-color: var(--neg);
    border-color: var(--neg);
}

.btn-danger:hover, .btn-danger:focus { background-color: #8f2c23; border-color: #8f2c23; }

.btn-outline-danger {
    color: var(--neg);
    background-color: transparent;
    border-color: var(--neg);
}

.btn-outline-danger:hover, .btn-outline-danger:focus {
    background-color: var(--neg);
    color: var(--gfg-white);
    border-color: var(--neg);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 122, 108, .16);
    outline: none;
}

/* Botón de sólo icono, para acciones dentro de tablas */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--r);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
}

.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-tint);
}

.btn-icon svg { width: 15px; height: 15px; }

/* ─── Formularios ─────────────────────────────────────── */
.form-control, .form-select {
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--r);
    transition: border-color .15s, box-shadow .15s;
}

textarea.form-control { height: auto; padding: 10px 12px; }

.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 108, .14);
}

.form-control:disabled, .form-select:disabled,
.form-control[readonly] {
    background-color: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
    opacity: 1;
}

.form-control::placeholder { color: #90a0ab; }

.form-select {
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23616e78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 14px;
    cursor: pointer;
}

/* Etiqueta: antes 8.8 px con 0.18em de espaciado, ilegible */
.form-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.form-check-input {
    width: 17px;
    height: 17px;
    border: 1.5px solid #a6b3bd;
    border-radius: var(--r-sm);
    background-color: var(--surface);
    cursor: pointer;
    margin-top: .12em;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-label { font-size: 13.5px; color: var(--text-primary); }

/* ─── Validación ──────────────────────────────────────── */
.valid.modified:not([type=checkbox]) { border-color: var(--pos-fill); }
.invalid { border-color: var(--neg) !important; background-color: #fffafa; }

.validation-message {
    color: var(--neg);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* ─── Tablas ──────────────────────────────────────────── */
.table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: #f9fbfc;
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--accent-tint);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-active-bg: var(--accent-tint);
    --bs-table-active-color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-strong);
    padding: 11px 14px;
    white-space: nowrap;
    vertical-align: middle;
}

/* Encabezado ordenable */
.table thead th[role="button"],
.table thead th.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: color .15s, background-color .15s;
}

.table thead th[role="button"]:hover,
.table thead th.sortable-th:hover {
    color: var(--accent);
    background: var(--accent-tint);
}

.table tbody td {
    padding: 0 14px;
    height: 46px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover > * { background-color: var(--accent-tint) !important; }

.table-sm tbody td { height: 38px; }

/* Encabezado que permanece visible al desplazar tablas largas */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Clases contextuales de Bootstrap, en clave clara.
   Abono y cargo ya no comparten color con la marca. */
.table .table-success,
.table .table-success > td,
.table .table-success > th,
.table-striped > tbody > tr.table-success:nth-of-type(odd) > * {
    --bs-table-color: var(--pos);
    --bs-table-bg: var(--pos-tint);
    --bs-table-striped-color: var(--pos);
    --bs-table-striped-bg: #ddf4e0;
    --bs-table-hover-color: var(--pos);
    --bs-table-hover-bg: #d2efd6;
    color: var(--pos);
}

.table .table-danger,
.table .table-danger > td,
.table .table-danger > th,
.table-striped > tbody > tr.table-danger:nth-of-type(odd) > * {
    --bs-table-color: var(--neg);
    --bs-table-bg: var(--neg-tint);
    --bs-table-striped-color: var(--neg);
    --bs-table-striped-bg: #ffe2db;
    --bs-table-hover-color: var(--neg);
    --bs-table-hover-bg: #ffd9d1;
    color: var(--neg);
}

.table .table-warning,
.table .table-warning > td,
.table .table-warning > th,
.table-striped > tbody > tr.table-warning:nth-of-type(odd) > * {
    --bs-table-color: var(--warn);
    --bs-table-bg: var(--warn-tint);
    --bs-table-striped-color: var(--warn);
    --bs-table-striped-bg: #fbe8cd;
    --bs-table-hover-color: var(--warn);
    --bs-table-hover-bg: #f8e0bd;
    color: var(--warn);
}

/* Contenedor de tabla con esquinas y sombra propias */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-card .table { border-collapse: collapse; }
.table-card .table tbody tr:last-child td { border-bottom: none; }

.table-foot {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

/* ─── Tarjetas ────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.card-body { padding: 16px 18px; }

.card-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
}

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

/* ─── Alertas ─────────────────────────────────────────── */
.alert {
    border-radius: var(--r-lg);
    font-size: 13.5px;
    line-height: 1.55;
    border: 1px solid;
    padding: 14px 18px;
}

.alert-danger {
    background: var(--neg-tint);
    border-color: #f3c4bc;
    color: #8f2c23;
}

.alert-success {
    background: var(--pos-tint);
    border-color: #b9e6bf;
    color: #256435;
}

.alert-warning {
    background: var(--warn-tint);
    border-color: var(--warn-border);
    color: #6b4c06;
}

.alert-info {
    background: var(--accent-tint);
    border-color: var(--accent-tint-2);
    color: #00544a;
}

/* ─── Insignias ───────────────────────────────────────── */
.badge {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-active, .bg-success {
    background: var(--pos-tint) !important;
    color: var(--pos) !important;
}

.badge-inactive, .bg-secondary {
    background: var(--surface-3) !important;
    color: var(--text-secondary) !important;
}

.bg-warning { background: var(--warn-tint) !important; color: var(--warn) !important; }
.bg-danger  { background: var(--neg-tint)  !important; color: var(--neg)  !important; }
.bg-info    { background: var(--accent-tint) !important; color: var(--accent) !important; }

/* Insignia con punto de estado */
.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
    flex-shrink: 0;
}

/* Etiqueta neutra para unidad de negocio / división */
.unidad-badge, .tag-neutral {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    white-space: nowrap;
}

.tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tag-up   { background: var(--pos-tint);  color: var(--pos); }
.tag-warn { background: var(--warn-tint); color: var(--warn); }
.tag-down { background: var(--neg-tint);  color: var(--neg); }

/* ─── Encabezado de página (compartido) ───────────────── */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head-left { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }

.page-head-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.page-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Barra de filtros (compartida) ───────────────────── */
.filter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.filter-field { display: flex; flex-direction: column; gap: 6px; }

.filter-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.filter-foot-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.filter-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 14px;
}

.filter-count b {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* Ficha de filtro activo */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 6px 0 10px;
    border-radius: 5px;
    background: var(--accent-tint);
    border: 1px solid var(--accent-tint-2);
    color: #00655a;
    font-size: 12px;
    font-weight: 600;
}

.filter-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 3px;
    line-height: 0;
}

.filter-chip button:hover { background: var(--accent-tint-2); }
.filter-chip svg { width: 13px; height: 13px; }

/* ─── Barra contextual de selección ───────────────────── */
.sel-bar {
    background: var(--gfg-teal);
    border-radius: var(--r-lg);
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.sel-bar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 13px;
    background: var(--gfg-turquoise-fill);
    color: var(--gfg-teal);
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
}

.sel-bar-text { font-size: 14px; color: var(--text-on-dark); font-weight: 500; }

.sel-bar-clear {
    border: none;
    background: transparent;
    color: var(--gfg-turquoise-fill);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.sel-bar .btn-ghost-light {
    border: 1px solid rgba(255,255,255,.25);
    background: transparent;
    color: var(--text-on-dark);
}

.sel-bar .btn-ghost-light:hover { background: rgba(255,255,255,.1); color: var(--text-on-dark); }

/* ─── Estado vacío ────────────────────────────────────── */
.empty-state {
    padding: 56px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.empty-state svg { width: 40px; height: 40px; color: #a6b3bd; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.empty-state-text { font-size: 13px; color: var(--text-muted); max-width: 400px; line-height: 1.55; }

/* ─── Paginación ──────────────────────────────────────── */
.pager { display: flex; align-items: center; gap: 6px; }

.pager-page {
    width: 34px;
    height: 34px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.pager-page:hover { border-color: var(--accent); color: var(--accent); }

.pager-page.active {
    background: var(--gfg-teal);
    border-color: var(--gfg-teal);
    color: var(--text-on-dark);
    font-weight: 600;
}

/* ─── Paneles (secciones de dashboard) ────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    position: relative;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
}

.panel-title svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.panel-tag {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--r-sm);
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ─── Cuadrículas ─────────────────────────────────────── */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

/* ─── Tarjetas de indicador ───────────────────────────── */
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: box-shadow .2s, transform .2s;
}

.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(31,42,51,.09), 0 8px 20px rgba(31,42,51,.07); }

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

.kpi-value {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-primary);
}

.kpi-sub { font-size: 12px; color: var(--text-muted); }

.kpi-card.is-positive { border-top-color: var(--pos-fill); }
.kpi-card.is-positive .kpi-value { color: var(--pos); }
.kpi-card.is-negative { border-top-color: var(--neg-fill); }
.kpi-card.is-negative .kpi-value { color: var(--neg); }
.kpi-card.is-accent   { border-top-color: var(--gfg-turquoise-fill); }
.kpi-card.is-warn     { border-top-color: var(--warn-fill); }
.kpi-card.is-warn .kpi-value { color: var(--warn); }

/* ─── Banda destacada (posición para inversión) ───────── */
.hero-band {
    background: linear-gradient(100deg, var(--gfg-teal) 0%, var(--gfg-teal-soft) 100%);
    border-radius: var(--r-lg);
    padding: 22px 26px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-band-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gfg-turquoise-fill);
}

.hero-band-value {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 38px;
    font-weight: 600;
    color: var(--text-on-dark);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-band-chip {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--gfg-turquoise-fill);
    background: rgba(113,228,209,.15);
    padding: 4px 10px;
    border-radius: 5px;
}

.hero-band-note {
    font-size: 13px;
    color: var(--text-on-dark-soft);
    line-height: 1.55;
    margin: 0;
}

.hero-band-note b { color: var(--text-on-dark); font-weight: 600; }

.hero-band-aside-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-on-dark-mute);
}

.hero-band-aside-value {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 19px;
    font-weight: 600;
    color: var(--text-on-dark);
}

/* ─── Barras de proporción ────────────────────────────── */
.bar-track {
    background: var(--surface-3);
    border-radius: var(--r-sm);
    overflow: hidden;
    height: 8px;
}

.bar-fill {
    height: 100%;
    background: var(--gfg-turquoise-fill);
    border-radius: var(--r-sm);
    transition: width .8s cubic-bezier(.22, 1, .36, 1);
}

/* ─── Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 42, 51, .55);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.modal-dialog-edit {
    background: var(--surface);
    border: none;
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header-edit {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 26px;
    border-bottom: 1px solid var(--border);
}

.modal-title-edit {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    text-transform: none;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
}

.modal-subtitle-edit {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.btn-close-edit {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: background-color .15s, color .15s;
}

.btn-close-edit:hover { background: var(--border); color: var(--text-primary); }

.modal-body-edit { padding: 22px 26px; }

.modal-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
}

.modal-footer-edit {
    padding: 16px 26px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 22px -26px -22px;
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: 4px;
    display: block;
}

/* ─── Estado de carga ─────────────────────────────────── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    gap: 14px;
}

.loading-state p { color: var(--text-muted); font-size: 13.5px; margin: 0; }

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: gfg-spin .8s linear infinite;
}

@keyframes gfg-spin { to { transform: rotate(360deg); } }

/* ─── Pantalla de arranque ────────────────────────────── */
.gfg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 28px;
    background: var(--bg);
}

.gfg-loading-logo {
    width: auto;
    max-width: 220px;
    height: 56px;
    object-fit: contain;
    animation: gfg-pulse 2s ease-in-out infinite;
}

@keyframes gfg-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.95); }
}

.loading-progress { display: block; width: 4rem; height: 4rem; }

.loading-progress circle {
    fill: none;
    stroke: var(--border);
    stroke-width: .5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray .05s ease-in-out;
}

.loading-progress-text {
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Montserrat', sans-serif;
}

.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Cargando"); }

code { color: var(--accent); }

/* ─── Error de Blazor ─────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: var(--surface);
    bottom: 0;
    box-shadow: 0 -2px 16px rgba(31, 42, 51, .16);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 12px 20px 14px;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--neg);
    font-size: 13.5px;
    border-top: 2px solid var(--neg);
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 10px; }

.blazor-error-boundary {
    background: var(--neg-tint);
    padding: 16px 16px 16px 20px;
    color: #8f2c23;
    border-radius: var(--r-lg);
    border-left: 3px solid var(--neg);
}

.blazor-error-boundary::after { content: "Ocurrió un error."; }

/* ─── Barra de desplazamiento ─────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-2); }

::-webkit-scrollbar-thumb {
    background: #c2ccd4;
    border-radius: 5px;
    border: 2px solid var(--surface-2);
}

::-webkit-scrollbar-thumb:hover { background: #a6b3bd; }

/* ─── Fila seleccionada ───────────────────────────────── */
.table tbody tr.row-selected > * {
    background-color: var(--accent-tint) !important;
}

/* Botón de acción principal en el encabezado de una página */
.page-action { margin-bottom: 18px; }

/* ─── Campo de búsqueda dentro de filtros ─────────────── */
.search-field {
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    transition: border-color .15s, box-shadow .15s;
}

.search-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 108, .14);
}

.search-field svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }

.search-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.search-field input::placeholder { color: #90a0ab; font-weight: 400; }

.no-filters { font-size: 13px; color: var(--text-muted); }

/* ─── Indicadores de orden en encabezados ─────────────── */
.sort-idle {
    color: #b6c2cb;
    font-size: 11px;
    margin-left: 3px;
}

.sort-arrow {
    color: var(--accent);
    font-size: 11px;
    margin-left: 3px;
}

/* ─── Acciones por fila ───────────────────────────────── */
.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.pager-label {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 0 8px;
    white-space: nowrap;
}

/* ─── Piezas de formulario en modales ─────────────────── */
.modal-rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0 0 20px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.toggle-row-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.toggle-row .form-check-input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; }

/* Contador y estados de la CLABE */
.clabe-count { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.form-control.is-ok { border-color: var(--pos-fill); }
.form-control.is-error { border-color: var(--neg); background: #fffafa; }
.form-help.is-ok, .clabe-count.is-ok { color: var(--pos); }
.form-help.is-error, .clabe-count.is-error { color: var(--neg); }

/* ─── Utilidades ──────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.text-end   { text-align: right; }
.content    { padding-top: 16px; }
.fw-medium  { font-weight: 500 !important; }
.table-responsive { overflow-x: auto; }

/* ─── Responsivo ──────────────────────────────────────── */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2col { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 19px; }
    .hero-band { padding: 18px; gap: 18px; }
    .hero-band-value { font-size: 28px; }
    .page-head { align-items: flex-start; }
    .filter-count { margin-left: 0; width: 100%; }
    .modal-overlay { padding: 12px; }
}
