﻿/* ══════════════════════════════════════════════════════════════════
   GEOMIL FRONT OFFICE — estilos globales (Principal2026.Master)
   Prefijo de todo lo global: g-   ·   Tokens: --g-*
   Reglas:
   - Las vistas usan los tokens por su significado (texto, fondo, borde),
     nunca colores sueltos. Así el modo oscuro sale solo.
   - Verde = guardar / confirmar.  Rojo = cancelar / eliminar.
     Gris corporativo = acción principal neutra (buscar, continuar).
   - Capas (z-index): header 20 · sidebar 30 · selects 40 ·
     dropdown y toasts 50 · aviso de conexión 150 · carga 200.
   ══════════════════════════════════════════════════════════════════ */

/* ───────────────────────── 1. TOKENS ───────────────────────── */
:root {
    --g-fuente: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --g-mono: Consolas, 'SFMono-Regular', 'Courier New', monospace;

    /* Marca */
    --g-rojo: #bf0d3e;            /* texto, bordes, anillos */
    --g-rojo-bg: #bf0d3e;         /* fondos con texto blanco */
    --g-rojo-hover: #a20b35;
    --g-rojo-suave: #fcebef;      /* fondos de aviso */
    --g-rojo-borde: #f3c2cf;
    --g-gris: #5c666c;
    --g-gris-bg: #3a4348;         /* botón principal neutro (buscar, continuar) */
    --g-gris-hover: #2a3135;

    /* Estados */
    --g-verde: #15803d;
    --g-verde-bg: #16a34a;
    --g-verde-hover: #12863d;
    --g-verde-suave: #e8f6ed;
    --g-verde-borde: #b9e3c7;
    --g-ambar: #a15c07;
    --g-ambar-bg: #d97706;
    --g-ambar-suave: #fff6e0;
    --g-ambar-borde: #f3d99a;
    --g-azul: #1d5fa8;
    --g-azul-bg: #2563eb;
    --g-azul-suave: #eaf1fb;
    --g-azul-borde: #c3d6f2;

    /* Superficies y texto */
    --g-fondo: #f2f3f5;           /* fondo de página */
    --g-superficie: #ffffff;      /* tarjetas, campos */
    --g-superficie-2: #f7f8f9;    /* cabeceras suaves, filas alternas */
    --g-superficie-hover: #f4f5f7;
    --g-borde: #e3e6e9;
    --g-borde-fuerte: #cdd2d6;
    --g-texto: #1d2326;
    --g-texto-2: #5c666c;
    --g-texto-3: #8b949a;
    --g-texto-invertido: #ffffff;

    /* Estructura */
    --g-header: #bf0d3e;
    --g-header-texto: #ffffff;
    --g-sidebar: #2f363a;
    --g-sidebar-texto: #c9d0d4;
    --g-sidebar-titulo: #8d989e;
    --g-sidebar-hover: rgba(255, 255, 255, .07);
    --g-sidebar-activo: rgba(255, 255, 255, .11);
    --g-sidebar-acento: #ff4f7b;
    --g-sidebar-linea: rgba(255, 255, 255, .08);

    --g-foco: 0 0 0 3px rgba(191, 13, 62, .18);
    --g-sombra-1: 0 1px 2px rgba(16, 24, 28, .06), 0 1px 3px rgba(16, 24, 28, .05);
    --g-sombra-2: 0 6px 18px rgba(16, 24, 28, .10), 0 2px 6px rgba(16, 24, 28, .06);
    --g-sombra-3: 0 18px 48px rgba(16, 24, 28, .20);

    --g-radio-s: 8px;
    --g-radio: 12px;
    --g-radio-l: 16px;

    --g-alto-header: 60px;
    --g-ancho-menu: 68px;
    --g-ancho-menu-abierto: 268px;
    --g-alto-control: 42px;

    color-scheme: light;
}

html.dark {
    --g-rojo: #ff6b8f;
    --g-rojo-bg: #b00c3a;
    --g-rojo-hover: #c81147;
    --g-rojo-suave: #3a1520;
    --g-rojo-borde: #5e2133;
    --g-gris: #aab3b8;
    --g-gris-bg: #56636a;
    --g-gris-hover: #66747b;

    --g-verde: #4ade80;
    --g-verde-bg: #15803d;
    --g-verde-hover: #17924a;
    --g-verde-suave: #12291b;
    --g-verde-borde: #1f4a30;
    --g-ambar: #fbbf24;
    --g-ambar-bg: #b45309;
    --g-ambar-suave: #2f2410;
    --g-ambar-borde: #5a4416;
    --g-azul: #7cb2ff;
    --g-azul-bg: #2558c9;
    --g-azul-suave: #142235;
    --g-azul-borde: #23406a;

    --g-fondo: #0f1214;
    --g-superficie: #181c1f;
    --g-superficie-2: #1e2327;
    --g-superficie-hover: #232a2e;
    --g-borde: #2a3236;
    --g-borde-fuerte: #3a4449;
    --g-texto: #e7ebed;
    --g-texto-2: #a9b2b7;
    --g-texto-3: #7a858b;

    --g-header: #7e0a2b;
    --g-sidebar: #14181a;
    --g-sidebar-texto: #b9c2c7;
    --g-sidebar-titulo: #6f7a80;
    --g-sidebar-acento: #ff6b8f;

    --g-foco: 0 0 0 3px rgba(255, 107, 143, .25);
    --g-sombra-1: 0 1px 2px rgba(0, 0, 0, .4);
    --g-sombra-2: 0 8px 22px rgba(0, 0, 0, .45);
    --g-sombra-3: 0 20px 50px rgba(0, 0, 0, .6);

    color-scheme: dark;
}

/* Transición suave entre pantallas (Chrome/Edge 126+; los demás navegadores cambian como siempre).
   Sirve sobre todo al pasar del login al inicio: un fundido corto en lugar del salto en blanco. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

/* ───────────────────────── 2. BASE ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body.g-app {
    margin: 0;
    overflow: hidden;              /* la página nunca hace scroll completo */
    font-family: var(--g-fuente);
    font-size: 14px;
    line-height: 1.55;
    color: var(--g-texto);
    background: var(--g-fondo);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.g-app form#form1 { height: 100%; margin: 0; }

.g-app h1, .g-app h2, .g-app h3, .g-app h4 { margin: 0; font-weight: 700; line-height: 1.25; color: var(--g-texto); }
.g-app p { margin: 0 0 10px; }
.g-app a { color: inherit; text-decoration: none; }
.g-app a:not([class]) { color: var(--g-rojo); }
.g-app a:not([class]):hover { text-decoration: underline; }
.g-app img { max-width: 100%; }
.g-app button, .g-app input, .g-app select, .g-app textarea { font-family: inherit; font-size: inherit; }
.g-app ::selection { background: rgba(191, 13, 62, .2); }

/* Sin animaciones mientras la página se pinta (evita que el menú "se abra" en cada pantalla) */
html.g-sin-anim *, html.g-sin-anim *::before, html.g-sin-anim *::after { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Barras de scroll discretas */
.g-scroll { scrollbar-width: thin; scrollbar-color: var(--g-borde-fuerte) transparent; }
.g-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.g-scroll::-webkit-scrollbar-thumb { background: var(--g-borde-fuerte); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
.g-scroll::-webkit-scrollbar-track { background: transparent; }

.g-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────────────────────── 3. ESTRUCTURA ───────────────────────── */
.g-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ── Header ── */
.g-header {
    position: relative;
    z-index: 20;
    flex: 0 0 var(--g-alto-header);
    height: var(--g-alto-header);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 0 16px 0 10px;
    background: var(--g-header);
    color: var(--g-header-texto);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .10);
}

.g-header-izq, .g-header-der { display: flex; align-items: center; gap: 10px; min-width: 0; }
.g-header-der { justify-content: flex-end; }

.g-hamburguesa {
    display: none;
    width: 40px; height: 40px;
    border: 0; border-radius: 10px;
    background: transparent; color: #fff;
    font-size: 18px; cursor: pointer;
}
.g-hamburguesa:hover { background: rgba(255, 255, 255, .14); }

.g-logo { display: inline-flex; align-items: center; height: 44px; padding: 0 8px; border-radius: 10px; }
.g-logo img { height: 34px; width: auto; display: block; }
.g-logo:hover { background: rgba(255, 255, 255, .10); }

/* Agencia (centro) */
.g-agencia { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 46vw; text-align: center; line-height: 1.2; }
.g-agencia-nombre { display: flex; align-items: center; gap: 8px; max-width: 100%; font-size: 15px; font-weight: 700; letter-spacing: .1px; }
.g-agencia-texto { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-agencia-codigo { flex: 0 0 auto; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.g-agencia-pais { margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; opacity: .82; }
.g-agencia-pais .fa { margin-right: 4px; }

/* Chip de conexión (solo aparece si está lenta o sin conexión) */
.g-chip-conexion {
    display: none;
    align-items: center; gap: 6px;
    height: 28px; padding: 0 11px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .22);
    font-size: 12px; font-weight: 700; white-space: nowrap;
}
html[data-conexion="lenta"] .g-chip-conexion,
html[data-conexion="sin"] .g-chip-conexion { display: inline-flex; }
html[data-conexion="sin"] .g-chip-conexion { background: #1d2326; }

/* Usuario */
.g-usuario { position: relative; }
.g-usuario-btn {
    display: flex; align-items: center; gap: 10px;
    height: 44px; padding: 0 10px 0 6px;
    border: 0; border-radius: 12px;
    background: transparent; color: #fff; cursor: pointer;
}
.g-usuario-btn:hover, .g-usuario.g-abierto .g-usuario-btn { background: rgba(255, 255, 255, .14); }
.g-avatar {
    width: 34px; height: 34px; flex: 0 0 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #fff; color: var(--g-header);
    font-size: 13px; font-weight: 800; letter-spacing: .3px;
}
html.dark .g-avatar { background: #f2d3dc; color: #7e0a2b; }
.g-usuario-login { font-size: 13px; font-weight: 700; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-usuario-btn .fa-angle-down { opacity: .8; transition: transform .2s; }
.g-usuario.g-abierto .fa-angle-down { transform: rotate(180deg); }

.g-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
    width: 260px; padding: 6px;
    background: var(--g-superficie); color: var(--g-texto);
    border: 1px solid var(--g-borde); border-radius: var(--g-radio);
    box-shadow: var(--g-sombra-2);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.g-usuario.g-abierto .g-dropdown { opacity: 1; visibility: visible; transform: none; }
.g-dropdown-cab { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--g-borde); }
.g-dropdown-cab .g-avatar { background: var(--g-rojo-bg); color: #fff; }
.g-dropdown-nombre { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.g-dropdown-sub { font-size: 12px; color: var(--g-texto-2); }
.g-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--g-texto); font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.g-dropdown a .fa { width: 18px; text-align: center; color: var(--g-texto-2); }
.g-dropdown a:hover { background: var(--g-superficie-hover); }
.g-dropdown-sep { height: 1px; margin: 4px 0; background: var(--g-borde); }
.g-dropdown a.g-salir, .g-dropdown a.g-salir .fa { color: var(--g-rojo); }

/* ── Cuerpo: sidebar + main ── */
.g-cuerpo { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }

.g-sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 30;
    width: var(--g-ancho-menu);
    display: flex; flex-direction: column;
    background: var(--g-sidebar); color: var(--g-sidebar-texto);
    transition: width .2s ease, box-shadow .2s ease;
    overflow: hidden;
}
/* Se abre al pasar el mouse (encima del contenido) o al fijarlo (empuja el contenido) */
@media (min-width: 1024px) and (hover: hover) {
    .g-sidebar:hover { width: var(--g-ancho-menu-abierto); box-shadow: var(--g-sombra-3); transition-delay: .08s; }
}
html.g-menu-fijo .g-sidebar { width: var(--g-ancho-menu-abierto); box-shadow: none; }

.g-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 10px; }
.g-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }

.g-nav-seccion + .g-nav-seccion { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--g-sidebar-linea); }

/* Con el menú cerrado el título no ocupa lugar (riel de íconos limpio); al abrirlo aparece */
.g-nav-titulo {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 26px; max-height: 0; padding: 0 12px; overflow: hidden;
    border: 0; border-radius: 8px; background: transparent; cursor: pointer;
    color: var(--g-sidebar-titulo);
    font-size: 10.5px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase;
    white-space: nowrap; opacity: 0; transition: opacity .15s, max-height .2s ease;
}
.g-nav-titulo:hover { color: var(--g-sidebar-texto); }
.g-nav-titulo .fa { font-size: 12px; transition: transform .2s; }
.g-nav-seccion.g-cerrada .g-nav-titulo .fa { transform: rotate(-90deg); }

.g-nav-lista { list-style: none; margin: 0; padding: 0; }
.g-nav-seccion.g-cerrada .g-nav-lista { display: none; }

.g-nav-link {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    min-height: 37px; padding: 8px 12px 8px 14px; margin: 1px 0;
    border-radius: 10px;
    color: var(--g-sidebar-texto); text-decoration: none;
    font-size: 13.5px; font-weight: 600; line-height: 1.3;
}
.g-nav-link:hover { background: var(--g-sidebar-hover); color: #fff; }
.g-nav-link .fa { flex: 0 0 20px; width: 20px; font-size: 16px; text-align: center; }
/* Texto: con el menú cerrado no ocupa lugar ni se parte; abierto, los textos largos bajan a una segunda línea */
.g-nav-link span { flex: 1 1 auto; min-width: 0; opacity: 0; white-space: nowrap; overflow: hidden; transition: opacity .15s; }
.g-nav-link.g-activo { background: var(--g-sidebar-activo); color: #fff; }
.g-nav-link.g-activo::before {
    content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--g-sidebar-acento);
}
.g-nav-link.g-activo .fa { color: var(--g-sidebar-acento); }

/* Con el menú cerrado (riel de íconos) se ven todos los íconos, aunque la sección esté plegada */
.g-sidebar .g-nav-seccion.g-cerrada .g-nav-lista { display: block; }

/* Menú abierto: títulos, textos y secciones plegadas */
@media (min-width: 1024px) and (hover: hover) {
    .g-sidebar:hover .g-nav-titulo { max-height: 26px; opacity: 1; transition-delay: .08s; }
    .g-sidebar:hover .g-nav-link span, .g-sidebar:hover .g-pie-btn span { opacity: 1; transition-delay: .1s; }
    .g-sidebar:hover .g-nav-link span { white-space: normal; }
    .g-sidebar:hover .g-nav-seccion.g-cerrada .g-nav-lista { display: none; }
}
html.g-menu-fijo .g-nav-titulo { max-height: 26px; opacity: 1; }
html.g-menu-fijo .g-nav-link span, html.g-menu-fijo .g-pie-btn span { opacity: 1; }
html.g-menu-fijo .g-nav-link span { white-space: normal; }
html.g-menu-fijo .g-sidebar .g-nav-seccion.g-cerrada .g-nav-lista { display: none; }

/* Pie del menú: señal, tema y fijar */
.g-sidebar-pie { flex: 0 0 auto; padding: 6px 10px 8px; border-top: 1px solid var(--g-sidebar-linea); }
.g-pie-btn {
    display: flex; align-items: center; gap: 14px;
    width: 100%; height: 36px; padding: 0 0 0 14px; margin: 1px 0;
    border: 0; border-radius: 10px; background: transparent; cursor: pointer;
    color: var(--g-sidebar-texto); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap;
}
.g-pie-btn:hover { background: var(--g-sidebar-hover); color: #fff; }
.g-pie-btn > .fa, .g-pie-btn > .g-senal { flex: 0 0 20px; width: 20px; font-size: 15px; text-align: center; }
.g-pie-btn span { opacity: 0; transition: opacity .15s; overflow: hidden; text-overflow: ellipsis; }
.g-pie-btn.g-info { cursor: default; }
.g-pie-btn.g-info:hover { background: transparent; color: var(--g-sidebar-texto); }
html.g-menu-fijo .g-btn-fijar { color: #fff; }
html.g-menu-fijo .g-btn-fijar .fa { color: var(--g-sidebar-acento); transform: rotate(45deg); }
.g-btn-tema .fa-sun-o { display: none; }
html.dark .g-btn-tema .fa-sun-o { display: inline-block; }
html.dark .g-btn-tema .fa-moon-o { display: none; }

/* Barras de señal */
.g-senal { display: inline-flex; align-items: flex-end; justify-content: center; gap: 2px; height: 16px; position: relative; }
.g-senal i { display: block; width: 3px; border-radius: 1px; background: currentColor; opacity: .25; }
.g-senal i:nth-child(1) { height: 25%; }
.g-senal i:nth-child(2) { height: 50%; }
.g-senal i:nth-child(3) { height: 75%; }
.g-senal i:nth-child(4) { height: 100%; }
html[data-conexion="buena"] .g-senal { color: #4ade80; }
html[data-conexion="buena"] .g-senal i { opacity: 1; }
html[data-conexion="regular"] .g-senal { color: #facc15; }
html[data-conexion="regular"] .g-senal i:nth-child(-n+3) { opacity: 1; }
html[data-conexion="lenta"] .g-senal { color: #fb923c; }
html[data-conexion="lenta"] .g-senal i:nth-child(1) { opacity: 1; }
html[data-conexion="sin"] .g-senal { color: #f87171; }
html[data-conexion="sin"] .g-senal::after {
    content: ""; position: absolute; left: -2px; right: -2px; top: 50%;
    height: 2px; background: currentColor; transform: rotate(-35deg);
}
.g-chip-conexion .g-senal { color: #fff !important; height: 12px; }
.g-chip-conexion .g-senal i { width: 2.5px; }

/* ── Main: lo único que hace scroll ── */
.g-main {
    flex: 1 1 auto; min-width: 0;
    margin-left: var(--g-ancho-menu);
    overflow-y: auto; overflow-x: hidden;
    transition: margin-left .2s ease;
}
html.g-menu-fijo .g-main { margin-left: var(--g-ancho-menu-abierto); }
.g-main-interior { max-width: 1320px; margin: 0 auto; padding: 24px 28px 40px; }
/* Pantalla completa (tableros): todo el ancho y el alto del área de contenido */
.g-main-completa { max-width: none; height: 100%; display: flex; flex-direction: column; padding: 16px 20px; }

/* Cabecera de cada pantalla: ← Volver / Título */
.g-pagina-cab {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 14px; margin-bottom: 22px;
}
.g-pagina-tit-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.g-volver {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 14px 0 10px;
    border-radius: 10px; border: 1px solid var(--g-borde);
    background: var(--g-superficie); color: var(--g-texto-2);
    font-size: 13px; font-weight: 700; white-space: nowrap;
}
.g-volver:hover { color: var(--g-texto); border-color: var(--g-borde-fuerte); }
.g-pagina-sep { width: 1px; height: 28px; background: var(--g-borde-fuerte); }
.g-pagina-titulo { font-size: 24px; font-weight: 800; letter-spacing: -.3px; color: var(--g-texto); }
.g-pagina-sub { margin-top: 2px; font-size: 13.5px; color: var(--g-texto-2); }
.g-pagina-acciones { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.g-pagina-acciones:empty { display: none; }

/* ── Responsive estructura ── */
.g-drawer-cab {
    display: none; align-items: center; justify-content: space-between;
    height: var(--g-alto-header); padding: 0 12px 0 16px;
    background: var(--g-header); color: #fff;
}
.g-drawer-cab img { height: 30px; }
.g-drawer-cerrar { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: #fff; font-size: 18px; cursor: pointer; }
.g-drawer-cerrar:hover { background: rgba(255, 255, 255, .14); }

.g-backdrop {
    position: fixed; inset: 0; z-index: 29;
    background: rgba(10, 14, 16, .5);
    opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}

@media (max-width: 1023.98px) {
    .g-hamburguesa { display: inline-flex; align-items: center; justify-content: center; }
    .g-sidebar {
        position: fixed; top: 0; bottom: 0;
        width: 280px; transform: translateX(-100%);
        transition: transform .22s ease; box-shadow: none;
    }
    html.g-menu-fijo .g-sidebar { width: 280px; }
    html.g-drawer .g-sidebar { transform: none; box-shadow: var(--g-sombra-3); }
    html.g-drawer .g-backdrop { opacity: 1; visibility: visible; }
    .g-sidebar .g-nav-titulo { max-height: 26px; opacity: 1; }
    .g-sidebar .g-nav-link span, .g-sidebar .g-pie-btn span { opacity: 1; }
    .g-sidebar .g-nav-link span { white-space: normal; }
    .g-sidebar .g-nav-seccion.g-cerrada .g-nav-lista { display: none; }
    .g-btn-fijar { display: none; }
    .g-drawer-cab { display: flex; }
    .g-main, html.g-menu-fijo .g-main { margin-left: 0; }
    .g-main-interior { padding: 18px 16px 32px; }
    .g-usuario-login { display: none; }
    .g-usuario-btn .fa-angle-down { display: none; }
}
@media (max-width: 640px) {
    .g-header { gap: 8px; padding: 0 8px 0 4px; }
    .g-logo img { height: 28px; }
    .g-agencia-codigo { display: none; }
    .g-agencia-nombre { font-size: 13.5px; }
    .g-agencia { max-width: 44vw; }
    .g-chip-conexion span { display: none; }
    .g-pagina-titulo { font-size: 20px; }
    .g-pagina-cab { margin-bottom: 16px; }
}

/* ───────────────────────── 4. COMPONENTES ───────────────────────── */

/* Tarjeta */
.g-card {
    background: var(--g-superficie);
    border: 1px solid var(--g-borde);
    border-radius: var(--g-radio-l);
    box-shadow: var(--g-sombra-1);
}
.g-card + .g-card { margin-top: 20px; }
.g-card-cab {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    padding: 18px 24px; border-bottom: 1px solid var(--g-borde);
}
.g-card-titulo { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; }
.g-card-icono {
    width: 36px; height: 36px; flex: 0 0 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--g-rojo-suave); color: var(--g-rojo); font-size: 15px;
}
.g-card-cuerpo { padding: 22px 24px; }
.g-card-pie { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--g-borde); background: var(--g-superficie-2); border-radius: 0 0 var(--g-radio-l) var(--g-radio-l); }
@media (max-width: 640px) {
    .g-card-cab, .g-card-cuerpo, .g-card-pie { padding-left: 16px; padding-right: 16px; }
}

/* Formularios */
.g-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.g-form-grid .g-col-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .g-form-grid { grid-template-columns: 1fr; } }

.g-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--g-texto); }
.g-label .g-req { color: var(--g-rojo); margin-left: 2px; }
.g-ayuda { margin-top: 5px; font-size: 12px; color: var(--g-texto-3); }
.g-error { display: block; margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--g-rojo); }

.g-input, .g-select, .g-textarea {
    display: block; width: 100%;
    height: var(--g-alto-control); padding: 0 14px;
    border: 1px solid var(--g-borde-fuerte); border-radius: 10px;
    background: var(--g-superficie); color: var(--g-texto);
    font-size: 14px; line-height: 1.4;
    transition: border-color .15s, box-shadow .15s;
}
.g-textarea { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
.g-input::placeholder, .g-textarea::placeholder { color: var(--g-texto-3); }
.g-input:focus, .g-select:focus, .g-textarea:focus { outline: none; border-color: var(--g-rojo); box-shadow: var(--g-foco); }
.g-input[disabled], .g-input[readonly], .g-select[disabled] { background: var(--g-superficie-2); color: var(--g-texto-2); cursor: not-allowed; }
.g-input.g-invalido, .g-select.g-invalido { border-color: var(--g-rojo); }
.g-select {
    padding-right: 38px; cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b949a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 11px 7px;
}
.g-select::-ms-expand { display: none; }

/* Botones */
.g-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--g-alto-control); padding: 0 20px;
    border: 1px solid transparent; border-radius: 10px;
    background: var(--g-gris-bg); color: #fff;
    font-family: var(--g-fuente); font-size: 14px; font-weight: 700; line-height: 1;
    white-space: nowrap; cursor: pointer; text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 28, .12);
    transition: background .15s, box-shadow .15s, transform .08s, opacity .15s;
}
.g-btn:hover { background: var(--g-gris-hover); }
.g-btn:active { transform: translateY(1px); }
.g-btn:focus-visible { outline: none; box-shadow: var(--g-foco); }
.g-btn[disabled], .g-btn.g-deshabilitado { opacity: .55; cursor: not-allowed; transform: none; }
.g-btn-guardar { background: var(--g-verde-bg); }
.g-btn-guardar:hover { background: var(--g-verde-hover); }
.g-btn-cancelar, .g-btn-eliminar { background: var(--g-rojo-bg); }
.g-btn-cancelar:hover, .g-btn-eliminar:hover { background: var(--g-rojo-hover); }
.g-btn-secundario { background: var(--g-superficie); color: var(--g-texto); border-color: var(--g-borde-fuerte); box-shadow: none; }
.g-btn-secundario:hover { background: var(--g-superficie-hover); }
.g-btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.g-btn-icono { width: 36px; height: 36px; padding: 0; border-radius: 9px; font-size: 14px; }
.g-btn-bloque { width: 100%; }

/* Envoltorio para poner un ícono a un asp:Button (input type=submit no admite <i>) */
.g-btn-wrap { position: relative; display: inline-flex; }
.g-btn-wrap > .fa { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #fff; pointer-events: none; z-index: 1; font-size: 14px; }
.g-btn-wrap > .g-btn { padding-left: 44px; }
.g-btn-wrap.g-btn-wrap-sec > .fa { color: var(--g-texto-2); }

/* Etiquetas de estado */
.g-badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--g-superficie-2); color: var(--g-texto-2); border: 1px solid var(--g-borde); }
.g-badge-verde { background: var(--g-verde-suave); color: var(--g-verde); border-color: var(--g-verde-borde); }
.g-badge-rojo { background: var(--g-rojo-suave); color: var(--g-rojo); border-color: var(--g-rojo-borde); }
.g-badge-ambar { background: var(--g-ambar-suave); color: var(--g-ambar); border-color: var(--g-ambar-borde); }
.g-badge-azul { background: var(--g-azul-suave); color: var(--g-azul); border-color: var(--g-azul-borde); }

/* Avisos dentro de la página */
.g-alerta { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--g-radio); border: 1px solid var(--g-borde); background: var(--g-superficie-2); color: var(--g-texto); font-size: 13.5px; }
.g-alerta > .fa { margin-top: 2px; font-size: 16px; }
.g-alerta-error { background: var(--g-rojo-suave); border-color: var(--g-rojo-borde); }
.g-alerta-error > .fa { color: var(--g-rojo); }
.g-alerta-ok { background: var(--g-verde-suave); border-color: var(--g-verde-borde); }
.g-alerta-ok > .fa { color: var(--g-verde); }
.g-alerta-aviso { background: var(--g-ambar-suave); border-color: var(--g-ambar-borde); }
.g-alerta-aviso > .fa { color: var(--g-ambar); }
.g-alerta-info { background: var(--g-azul-suave); border-color: var(--g-azul-borde); }
.g-alerta-info > .fa { color: var(--g-azul); }

/* Tablas */
.g-tabla-wrap { overflow-x: auto; border-radius: var(--g-radio); }
.g-tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.g-tabla th {
    padding: 12px 18px; text-align: left; white-space: nowrap;
    background: var(--g-gris-bg); color: #fff;
    font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
}
.g-tabla th:first-child { border-top-left-radius: var(--g-radio); }
.g-tabla th:last-child { border-top-right-radius: var(--g-radio); }
.g-tabla td { padding: 12px 18px; border-bottom: 1px solid var(--g-borde); vertical-align: middle; color: var(--g-texto); }
.g-tabla tr:last-child td { border-bottom: 0; }
.g-tabla tbody tr:hover td, .g-tabla tr:hover td { background: var(--g-superficie-hover); }
.g-tabla .g-num { text-align: right; font-variant-numeric: tabular-nums; }
.g-tabla .g-mono { font-family: var(--g-mono); }

/* Vacío */
.g-vacio { padding: 40px 20px; text-align: center; color: var(--g-texto-3); }
.g-vacio .fa { display: block; margin-bottom: 10px; font-size: 28px; color: var(--g-borde-fuerte); }

/* Spinner: dos aros, rojo y gris */
.g-spinner { position: relative; display: inline-block; width: 44px; height: 44px; }
.g-spinner::before, .g-spinner::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; }
.g-spinner::before { border-top-color: var(--g-rojo); border-right-color: var(--g-rojo); animation: g-giro .8s linear infinite; }
.g-spinner::after { inset: 8px; border-bottom-color: var(--g-gris); border-left-color: var(--g-gris); animation: g-giro 1.1s linear infinite reverse; }
.g-spinner-sm { width: 22px; height: 22px; }
.g-spinner-sm::before, .g-spinner-sm::after { border-width: 2px; }
.g-spinner-sm::after { inset: 4px; }
@keyframes g-giro { to { transform: rotate(360deg); } }

/* Select pequeño (paginador, filtros) */
.g-select-sm { height: 32px; padding: 0 30px 0 10px; font-size: 13px; border-radius: 8px; background-position: right 10px center; }

/* ── Modal (G.modal) y diálogo de confirmación (G.confirmar) ── */
.g-modal {
    position: fixed; inset: 0; z-index: 160;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: rgba(10, 14, 16, .55);
    animation: g-modal-fondo .16s ease;
}
.g-modal[hidden] { display: none; }
.g-modal.g-saliendo { animation: g-modal-fondo-out .15s ease forwards; }
.g-modal-caja {
    position: relative;
    width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column;
    background: var(--g-superficie); color: var(--g-texto);
    border: 1px solid var(--g-borde); border-radius: var(--g-radio-l);
    box-shadow: var(--g-sombra-3);
    animation: g-modal-entra .2s cubic-bezier(.2, .8, .2, 1);
}
.g-modal.g-saliendo .g-modal-caja { animation: g-modal-sale .15s ease forwards; }
.g-modal-sm { max-width: 440px; }
.g-modal-lg { max-width: 860px; }
.g-modal-xl { max-width: 1140px; }
.g-modal-cab {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px 14px 24px; border-bottom: 1px solid var(--g-borde);
}
.g-modal-titulo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.g-modal-titulo .fa { color: var(--g-rojo); }
.g-modal-cerrar {
    flex: 0 0 auto; width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 10px; background: transparent; color: var(--g-texto-3);
    font-size: 16px; cursor: pointer;
}
.g-modal-cerrar:hover { background: var(--g-superficie-hover); color: var(--g-texto); }
.g-modal-cerrar:focus-visible { outline: none; box-shadow: var(--g-foco); }
.g-modal-cuerpo { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.g-modal-pie {
    flex: 0 0 auto;
    display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px;
    padding: 14px 20px; border-top: 1px solid var(--g-borde);
    background: var(--g-superficie-2); border-radius: 0 0 var(--g-radio-l) var(--g-radio-l);
}
@keyframes g-modal-fondo { from { opacity: 0; } to { opacity: 1; } }
@keyframes g-modal-fondo-out { to { opacity: 0; } }
@keyframes g-modal-entra { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes g-modal-sale { to { opacity: 0; transform: translateY(8px) scale(.98); } }

.g-dialogo { z-index: 170; }
.g-dialogo-cuerpo { display: flex; align-items: flex-start; gap: 16px; padding: 24px 24px 20px; }
.g-dialogo-ico {
    flex: 0 0 46px; width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 19px;
    background: var(--g-azul-suave); color: var(--g-azul);
}
.g-dialogo-peligro .g-dialogo-ico { background: var(--g-rojo-suave); color: var(--g-rojo); }
.g-dialogo-guardar .g-dialogo-ico { background: var(--g-verde-suave); color: var(--g-verde); }
.g-dialogo-aviso .g-dialogo-ico { background: var(--g-ambar-suave); color: var(--g-ambar); }
.g-dialogo-txt { min-width: 0; padding-top: 2px; }
.g-dialogo-titulo { font-size: 17px; font-weight: 800; margin-bottom: 6px !important; }
.g-dialogo-msj { margin: 0 !important; font-size: 14px; color: var(--g-texto-2); line-height: 1.55; white-space: pre-line; }
@media (max-width: 640px) {
    .g-modal { padding: 12px; align-items: flex-end; }
    .g-modal-caja { max-height: calc(100vh - 24px); }
    .g-modal-cuerpo { padding: 16px; }
    .g-modal-pie .g-btn { flex: 1 1 0; }
}

/* ── Buscador de listados ── */
.g-buscador { position: relative; display: flex; align-items: center; width: 100%; max-width: 380px; }
.g-buscador > .fa { position: absolute; left: 14px; color: var(--g-texto-3); pointer-events: none; font-size: 14px; }
.g-buscador .g-input { padding-left: 40px; padding-right: 38px; }
.g-buscador .g-input::-webkit-search-cancel-button { display: none; }
.g-buscador-limpiar {
    position: absolute; right: 6px; width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--g-texto-3); cursor: pointer;
}
.g-buscador-limpiar:hover { background: var(--g-superficie-hover); color: var(--g-texto); }
.g-buscador-limpiar[hidden] { display: none; }
.g-buscador-contador { font-size: 12.5px; font-weight: 600; color: var(--g-texto-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-tabla-sinres td { padding: 28px 16px !important; text-align: center; color: var(--g-texto-3); background: transparent !important; }
.g-tabla-sinres .fa { margin-right: 6px; }

/* ── Paginación ── */
.g-paginador {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
    padding: 12px 16px; border-top: 1px solid var(--g-borde);
    font-size: 13px; color: var(--g-texto-2);
}
.g-paginador[hidden] { display: none; }
.g-pag-info { font-variant-numeric: tabular-nums; }
.g-pag-botones { display: flex; align-items: center; gap: 4px; }
.g-pag-btn {
    min-width: 34px; height: 34px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 9px;
    background: transparent; color: var(--g-texto-2);
    font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.g-pag-btn:hover:not(:disabled) { background: var(--g-superficie-hover); color: var(--g-texto); }
.g-pag-btn.g-actual { background: var(--g-gris-bg); color: #fff; }
.g-pag-btn:disabled:not(.g-actual) { opacity: .35; cursor: default; }
.g-pag-btn:focus-visible { outline: none; box-shadow: var(--g-foco); }
.g-pag-puntos { min-width: 20px; text-align: center; color: var(--g-texto-3); }
.g-pag-tam { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.g-pag-tam .g-select { width: auto; }
@media (max-width: 640px) {
    .g-paginador { justify-content: center; }
    .g-pag-info, .g-pag-tam { width: 100%; text-align: center; justify-content: center; }
}

/* ── Fecha ── */
.g-fecha { position: relative; display: block; width: 100%; }
.g-fecha .g-input { padding-right: 44px; font-variant-numeric: tabular-nums; }
.g-fecha-btn {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--g-texto-3); cursor: pointer;
}
.g-fecha-btn:hover:not(:disabled) { background: var(--g-superficie-hover); color: var(--g-rojo); }
.g-fecha-btn:disabled { cursor: not-allowed; opacity: .5; }
.g-fecha-nativo { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* ── Borrador ── */
.g-borrador-aviso { align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.g-borrador-txt { flex: 1 1 260px; min-width: 0; }
.g-borrador-acc { display: flex; gap: 8px; }

/* ───────────────────────── 5. GLOBALES DE COMPORTAMIENTO ───────────────────────── */

/* Pantalla de carga: bloquea clics al instante, muestra el spinner si tarda más de 300 ms */
.g-carga { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: transparent; cursor: progress; }
html.g-ocupado .g-carga { display: flex; }
.g-carga-caja {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    padding: 24px 30px; border-radius: var(--g-radio-l);
    background: var(--g-superficie); color: var(--g-texto-2); box-shadow: var(--g-sombra-3);
    font-size: 13px; font-weight: 700;
    opacity: 0; transform: scale(.96); transition: opacity .15s, transform .15s;
}
html.g-ocupado-visible .g-carga { background: rgba(10, 14, 16, .28); }
html.g-ocupado-visible .g-carga-caja { opacity: 1; transform: none; }

/* Barra de sin conexión */
.g-sin-conexion {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    display: none; align-items: center; justify-content: center; gap: 10px;
    min-height: 46px; padding: 10px 16px;
    background: #b91c1c; color: #fff; font-size: 13.5px; font-weight: 700; text-align: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .2);
}
html[data-conexion="sin"] .g-sin-conexion { display: flex; }

/* Toasts */
.g-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
html[data-conexion="sin"] .g-toasts { bottom: 66px; }
.g-toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 12px;
    width: 380px; max-width: calc(100vw - 32px);
    padding: 14px 14px 14px 16px; border-radius: var(--g-radio);
    background: var(--g-superficie); color: var(--g-texto);
    border: 1px solid var(--g-borde); border-left: 4px solid var(--g-gris);
    box-shadow: var(--g-sombra-2);
    animation: g-toast-in .22s ease;
    position: relative; overflow: hidden;
}
.g-toast.g-saliendo { animation: g-toast-out .2s ease forwards; }
.g-toast-ico { flex: 0 0 22px; font-size: 18px; line-height: 22px; text-align: center; color: var(--g-gris); }
.g-toast-txt { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.g-toast-tit { display: block; font-weight: 800; margin-bottom: 2px; }
.g-toast-cerrar { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--g-texto-3); cursor: pointer; font-size: 14px; }
.g-toast-cerrar:hover { background: var(--g-superficie-hover); color: var(--g-texto); }
.g-toast-barra { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .35; }
.g-toast-success { border-left-color: var(--g-verde-bg); }
.g-toast-success .g-toast-ico, .g-toast-success .g-toast-barra { color: var(--g-verde); }
.g-toast-error { border-left-color: var(--g-rojo-bg); }
.g-toast-error .g-toast-ico, .g-toast-error .g-toast-barra { color: var(--g-rojo); }
.g-toast-warning { border-left-color: var(--g-ambar-bg); }
.g-toast-warning .g-toast-ico, .g-toast-warning .g-toast-barra { color: var(--g-ambar); }
.g-toast-info .g-toast-ico, .g-toast-info .g-toast-barra { color: var(--g-texto-2); }
@keyframes g-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes g-toast-out { to { opacity: 0; transform: translateX(16px); } }
@media (max-width: 640px) { .g-toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; } .g-toast { width: auto; } }
