/* ==========================================================================
   Almenara — panel de vigilancia de malware de FrogHub
   Identidad fajardo* (papel #F2F5F3, tinta #081606, verde #2EE91A, Host Grotesk
   para titulares, Geist para interfaz, Geist Mono para datos) con lenguaje de
   superficies tipo iOS: aire generoso, esquinas continuas, profundidad por capas
   de sombra suave, gradientes de estado y cristal liquido (backdrop-filter con
   brillo especular) solo en superficies clave: cabecera, KPIs, login y avisos.
   Movimiento (Emil Kowalski): curvas propias, solo transform/opacity, hover solo
   con raton fino, nada por encima de 300 ms y movimiento reducido respetado.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:wght@300;500;600;700;800&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap');

:root {
    color-scheme: light dark;
    interpolate-size: allow-keywords;   /* permite animar el desplegable de <details> */

    --tinta: #081606;
    --papel: #F2F5F3;

    --fondo: #EEF2EF;
    --superficie: #FFFFFF;
    --superficie-2: #F5F8F6;
    --relleno: rgba(15, 15, 18, 0.045);       /* rellenos de controles y filas */
    --separador: rgba(8, 22, 6, 0.08);         /* separadores insertados, estilo lista iOS */
    --borde: rgba(8, 22, 6, 0.08);
    --borde-fuerte: rgba(8, 22, 6, 0.16);

    --texto: #374035;              /* 9,8:1 */
    --texto-fuerte: #0F0F12;       /* 17,4:1 */
    --texto-suave: #4B5847;        /* 6,9:1 */

    --verde: #2EE91A;              /* acento: relleno y marca, nunca texto sobre claro */
    --verde-texto: #1F7A14;        /* unico verde como texto sobre claro (5:1) */

    --primario: #0F0F12;
    --primario-texto: #FFFFFF;

    /* Estados: texto legible + par de gradiente para rellenos */
    --ok-texto: #1F7A14;      --ok-a: #5DF24C;      --ok-b: #22C912;
    --aviso-texto: #8A5D00;   --aviso-a: #FFD66B;   --aviso-b: #F2A60C;
    --critico-texto: #B42318; --critico-a: #D92D20; --critico-b: #A61B0F;
    --info-texto: #1F5F8B;    --info-a: #6BB8EE;    --info-b: #2F86C9;
    --neutro-texto: #4B5847;  --neutro-a: #C2CCBF;  --neutro-b: #98A594;

    /* Cristal liquido */
    --cristal: rgba(255, 255, 255, 0.62);
    --cristal-borde: rgba(255, 255, 255, 0.75);
    --cristal-brillo: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(255, 255, 255, 0.25);
    --cristal-filtro: blur(22px) saturate(180%);

    /* Profundidad: capas cortas y difusas, tinte de tinta (nunca negro puro) */
    --sombra-1: 0 1px 1px rgba(8, 22, 6, 0.03), 0 2px 6px -1px rgba(8, 22, 6, 0.05);
    --sombra-2: 0 1px 2px rgba(8, 22, 6, 0.04), 0 10px 28px -10px rgba(8, 22, 6, 0.16);
    --sombra-3: 0 2px 4px rgba(8, 22, 6, 0.05), 0 22px 48px -18px rgba(8, 22, 6, 0.26);

    --r-xl: 28px;
    --r-l: 22px;
    --r-m: 16px;
    --r-s: 12px;

    --f-titulo: 'Host Grotesk', 'Helvetica Neue', Arial, sans-serif;
    --f-texto: 'Geist', -apple-system, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    --f-mono: 'Geist Mono', 'SF Mono', ui-monospace, monospace;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fondo: #050E04;
        --superficie: #0D1B0B;
        --superficie-2: #112410;
        --relleno: rgba(255, 255, 255, 0.06);
        --separador: rgba(255, 255, 255, 0.08);
        --borde: rgba(255, 255, 255, 0.08);
        --borde-fuerte: rgba(255, 255, 255, 0.18);
        --texto: #C7D2C3;          /* 11,9:1 */
        --texto-fuerte: #FFFFFF;
        --texto-suave: #A8B3A4;    /* 8,6:1 */
        --verde-texto: #2EE91A;    /* sobre oscuro el verde si puede ser texto (11,3:1) */
        --primario: #F2F5F3;
        --primario-texto: #081606;
        --ok-texto: #4CF03A;
        --aviso-texto: #F5C451;
        --critico-texto: #FF8A80;  --critico-a: #E5483B; --critico-b: #B42318;
        --info-texto: #8CC8F0;
        --neutro-texto: #A8B3A4;   --neutro-a: #5E6E5A; --neutro-b: #3F4D3C;
        --cristal: rgba(16, 34, 14, 0.55);
        --cristal-borde: rgba(255, 255, 255, 0.10);
        --cristal-brillo: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
        --sombra-1: 0 1px 2px rgba(0, 0, 0, 0.35);
        --sombra-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -12px rgba(0, 0, 0, 0.6);
        --sombra-3: 0 2px 4px rgba(0, 0, 0, 0.45), 0 24px 52px -18px rgba(0, 0, 0, 0.75);
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--fondo); }

body {
    position: relative;
    margin: 0 auto;
    max-width: 1240px;
    padding: 0 40px 140px;
    background: transparent;
    color: var(--texto);
    font-family: var(--f-texto);
    font-size: 15px;
    line-height: 1.6;
    font-kerning: normal;
    -webkit-font-smoothing: antialiased;
}
/* Luz ambiental fija: da algo que refractar al cristal y evita el plano gris de plantilla */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 8% -8%, rgba(46, 233, 26, 0.16), transparent 60%),
        radial-gradient(760px 560px at 100% 4%, rgba(120, 200, 230, 0.14), transparent 62%),
        radial-gradient(1100px 700px at 50% 110%, rgba(46, 233, 26, 0.07), transparent 60%),
        var(--fondo);
}
@media (prefers-color-scheme: dark) {
    body::before {
        background:
            radial-gradient(900px 520px at 8% -8%, rgba(46, 233, 26, 0.12), transparent 60%),
            radial-gradient(760px 560px at 100% 4%, rgba(60, 140, 170, 0.10), transparent 62%),
            var(--fondo);
    }
}

a { color: var(--texto-fuerte); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--borde-fuerte); text-underline-offset: 3px; transition: text-decoration-color 150ms ease; }
a:hover { text-decoration-color: currentColor; }
code, pre { font-family: var(--f-mono); }
code { font-size: 0.85em; color: var(--texto-fuerte); background: var(--relleno); padding: 2px 7px; border-radius: 7px; overflow-wrap: anywhere; }
::selection { background: var(--verde); color: #0F0F12; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--verde) 70%, transparent); outline-offset: 2px; border-radius: 8px; }

.icono { flex: none; width: 16px; height: 16px; vertical-align: -3px; }
.dato, td, .kpi-valor { font-variant-numeric: tabular-nums; }
.dato { font-family: var(--f-mono); font-size: 0.8rem; color: var(--texto-suave); }

/* ---------- Tipografia ---------- */
h1, .display {
    margin: 0;
    font-family: var(--f-titulo);
    font-weight: 800;
    font-size: clamp(2.2rem, 4.4vw, 3.6rem);
    line-height: 0.95;
    letter-spacing: -0.045em;
    text-transform: uppercase;
    color: var(--texto-fuerte);
    text-wrap: balance;
    overflow-wrap: anywhere;
}
.subtitulo-seccion, .cabecera-proveedor h2 {
    margin: 0;
    font-family: var(--f-titulo);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.05;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    color: var(--texto-fuerte);
}
.eyebrow {
    display: inline-block;
    font-family: var(--f-texto);
    font-weight: 600;
    font-size: 0.7rem;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--texto-suave);
}
.eyebrow--acento { color: var(--verde-texto); }
.intro { max-width: 68ch; margin: 0 0 32px; font-size: 1rem; color: var(--texto-suave); }

/* ---------- Cabecera: capsula flotante de cristal ---------- */
.cabecera {
    position: sticky;
    top: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 36px;
    height: 60px;
    margin-top: 14px;
    padding: 0 10px 0 24px;
    border: 1px solid var(--cristal-borde);
    border-radius: 999px;
    background: var(--cristal);
    -webkit-backdrop-filter: var(--cristal-filtro);
    backdrop-filter: var(--cristal-filtro);
    box-shadow: var(--cristal-brillo), var(--sombra-2);
}
.logo {
    font-family: var(--f-titulo);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--texto-fuerte);
    text-decoration: none;
    white-space: nowrap;
}
.logo i { font-style: normal; color: var(--verde); display: inline-block; transition: transform 400ms var(--ease-out); }
a.logo:hover { text-decoration: none; }
/* Navegacion segmentada: la activa es una pastilla elevada dentro de la capsula */
.nav { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--relleno); }
.nav a {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--texto-suave);
    text-decoration: none;
    transition: color 150ms ease, background-color 200ms ease, box-shadow 200ms ease;
}
.nav a[aria-current="page"] { color: var(--texto-fuerte); background: var(--superficie); box-shadow: var(--sombra-1); }
.producto { margin-left: auto; padding-right: 14px; font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--texto-suave); }

.volver {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 40px;
    padding: 7px 14px 7px 10px;
    border-radius: 999px;
    background: var(--relleno);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--texto-fuerte);
    text-decoration: none;
    transition: background-color 200ms ease, transform 160ms var(--ease-out);
}
.volver:active { transform: scale(0.97); }
.volver .icono { width: 14px; height: 14px; transition: transform 200ms var(--ease-out); }

/* ---------- Cabecera de pagina ---------- */
.top-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 28px 40px;
    margin: 64px 0 40px;
}
.volver + .top-bar { margin-top: 28px; }
.titulo-pagina { display: flex; flex-direction: column; gap: 16px; min-width: 0; flex: 1 1 420px; }
.acciones-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.resumen-sitio { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 4px; }
.seccion { display: flex; flex-direction: column; gap: 12px; margin: 88px 0 28px; }
.form-refrescar, .form-programacion { margin: 0; }
.form-lineabase { margin: 24px 0 0; }

/* ---------- KPIs: baldosas de cristal ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 40px; }
.kpi {
    --tinte: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px 24px 22px;
    border: 1px solid var(--cristal-borde);
    border-radius: var(--r-l);
    background: linear-gradient(160deg, var(--tinte), transparent 70%), var(--cristal);
    -webkit-backdrop-filter: var(--cristal-filtro);
    backdrop-filter: var(--cristal-filtro);
    box-shadow: var(--cristal-brillo), var(--sombra-2);
    overflow: hidden;
}
.kpi-valor {
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 2.8rem;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--texto-fuerte);
}
.kpi-etiqueta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 500; color: var(--texto-suave); }
.kpi-etiqueta::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(180deg, var(--ok-a), var(--ok-b)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok-a) 22%, transparent); }
.kpi--critico { --tinte: color-mix(in srgb, var(--critico-a) 16%, transparent); }
.kpi--critico .kpi-valor { color: var(--critico-texto); }
.kpi--critico .kpi-etiqueta::before { background: linear-gradient(180deg, #FF6B61, var(--critico-a)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--critico-a) 22%, transparent); }
.kpi--aviso { --tinte: color-mix(in srgb, var(--aviso-b) 18%, transparent); }
.kpi--aviso .kpi-valor { color: var(--aviso-texto); }
.kpi--aviso .kpi-etiqueta::before { background: linear-gradient(180deg, var(--aviso-a), var(--aviso-b)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--aviso-b) 22%, transparent); }

/* ---------- Botones ---------- */
.btn, .cta-fila, .btn-icono-refrescar {
    -webkit-tap-highlight-color: transparent;
    transition: transform 160ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primario) 86%, #fff), var(--primario));
    color: var(--primario-texto);
    font: 600 0.88rem/1 var(--f-texto);
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--sombra-1);
}
.btn-secundario {
    background: var(--cristal);
    -webkit-backdrop-filter: var(--cristal-filtro);
    backdrop-filter: var(--cristal-filtro);
    color: var(--texto-fuerte);
    box-shadow: var(--cristal-brillo), inset 0 0 0 1px var(--borde), var(--sombra-1);
}
.btn-marca {
    background: linear-gradient(180deg, #6CF55C, #2EE91A 55%, #22CF10);
    color: #0A2607;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(8, 22, 6, 0.08), 0 8px 20px -8px rgba(46, 233, 26, 0.7);
}
.btn-marca .icono-giro { transition: transform 400ms var(--ease-out); }
.btn:active, .cta-fila:active, .btn-icono-refrescar:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-icono-refrescar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--relleno);
    color: var(--texto-suave);
    cursor: pointer;
}
.btn-icono-refrescar .icono { transition: transform 300ms var(--ease-out); }
.btn-icono-refrescar:disabled { cursor: progress; }
.btn-icono-refrescar:disabled .icono, .btn-refrescar:disabled .icono { animation: girar 800ms linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.cta-fila {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px 0 16px;
    border-radius: 999px;
    background: var(--relleno);
    color: var(--texto-fuerte);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.cta-fila .icono { width: 14px; height: 14px; transition: transform 200ms var(--ease-out); }
.cta-fila--revisar {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primario) 86%, #fff), var(--primario));
    color: var(--primario-texto);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--sombra-1);
}
.cta-fila--rojo {
    background: linear-gradient(180deg, var(--critico-a), var(--critico-b));
    color: #FFFFFF;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 18px -8px color-mix(in srgb, var(--critico-a) 80%, transparent);
}

.btn-texto {
    padding: 6px 12px;
    margin: -6px -12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--texto-suave);
    font: 500 0.82rem/1.4 var(--f-texto);
    cursor: pointer;
    transition: color 150ms ease, background-color 200ms ease, transform 160ms var(--ease-out);
}
.btn-texto:active { transform: scale(0.97); }

/* ---------- Tarjetas y tablas: lista agrupada estilo iOS ---------- */
.tarjeta {
    overflow-x: auto;
    padding: 8px 28px 12px;
    border-radius: var(--r-xl);
    background: var(--superficie);
    box-shadow: var(--sombra-2);
}
table { width: 100%; border-collapse: collapse; }
th {
    padding: 18px 18px 14px 0;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--texto-suave);
    border-bottom: 1px solid var(--separador);
    white-space: nowrap;
}
td { padding: 20px 18px 20px 0; border-bottom: 1px solid var(--separador); font-size: 0.92rem; vertical-align: middle; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
table tr { transition: background-color 200ms ease; }
td.vacio { padding: 64px 0; text-align: center; color: var(--texto-suave); }
.celda-acciones { text-align: right; white-space: nowrap; }
.celda-acciones form.form-refrescar { display: inline-block; vertical-align: middle; margin-left: 8px; }
.nombre-sitio { font-weight: 600; font-size: 0.98rem; color: var(--texto-fuerte); text-decoration: none; }

/* Chips de estado: tinte en gradiente; el de nivel es un relleno solido con gradiente */
.pastilla {
    --a: var(--neutro-a); --b: var(--neutro-b); --t: var(--neutro-texto);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 11px 5px 9px;
    border-radius: 999px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--a) 20%, transparent), color-mix(in srgb, var(--b) 12%, transparent));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b) 22%, transparent);
    color: var(--t);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
}
.pastilla::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(180deg, var(--a), var(--b)); }
.pastilla-verde { --a: var(--ok-a); --b: var(--ok-b); --t: var(--ok-texto); }
.pastilla-amarillo { --a: var(--aviso-a); --b: var(--aviso-b); --t: var(--aviso-texto); }
.pastilla-rojo { --a: #FF6B61; --b: var(--critico-a); --t: var(--critico-texto); }
.pastilla-rojo::before { animation: latido 2.4s var(--ease-out) infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--critico-a) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

/* Nivel del sitio: pastilla solida con gradiente, la señal mas fuerte de la fila */
.pastilla-nivel.pastilla-rojo, .resumen-sitio .pastilla-rojo {
    background: linear-gradient(180deg, var(--critico-a), var(--critico-b));
    color: #FFFFFF;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 14px -6px color-mix(in srgb, var(--critico-a) 80%, transparent);
}
.pastilla-nivel.pastilla-amarillo, .resumen-sitio .pastilla-amarillo {
    background: linear-gradient(180deg, var(--aviso-a), var(--aviso-b));
    color: #3A2800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px color-mix(in srgb, var(--aviso-b) 75%, transparent);
}
.pastilla-nivel.pastilla-verde, .resumen-sitio .pastilla-verde {
    background: linear-gradient(180deg, var(--ok-a), var(--ok-b));
    color: #0A2607;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px color-mix(in srgb, var(--ok-b) 70%, transparent);
}
:is(.pastilla-nivel, .resumen-sitio .pastilla):is(.pastilla-rojo, .pastilla-amarillo, .pastilla-verde)::before { background: currentColor; opacity: 0.85; }
td .pastilla-nivel, .resumen-sitio .pastilla { font-family: var(--f-texto); font-weight: 600; }

/* Marcadores incluido / no incluido */
.yes, .no { display: inline-flex; align-items: center; gap: 10px; }
.yes::before, .no::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background-repeat: no-repeat; background-position: center; background-size: 13px; }
.yes::before { background-color: var(--verde); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23081606' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), linear-gradient(180deg, var(--ok-a), var(--ok-b)); box-shadow: 0 4px 10px -4px rgba(46, 233, 26, 0.8); }
.no::before { border: 1.5px solid var(--texto-suave); }

/* Texto de estado dentro de celdas */
.texto-suave { margin-top: 3px; font-size: 0.82rem; color: var(--texto-suave); overflow-wrap: anywhere; }
.texto-aviso { margin-top: 3px; font-size: 0.82rem; color: var(--aviso-texto); }
.texto-critico { margin-top: 3px; font-size: 0.82rem; font-weight: 500; color: var(--critico-texto); }
.texto-ok { font-size: 0.8rem; color: var(--ok-texto); }
.texto-critico-inline { color: var(--critico-texto); font-weight: 600; }
.texto-tenue-inline { color: var(--texto-suave); font-weight: 400; }
.aviso-conexion-fila, .aviso-waf-fila { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 0.8rem; }
.aviso-conexion-fila { color: var(--info-texto); }
.aviso-waf-fila { color: var(--critico-texto); }
.aviso-conexion-fila .icono, .aviso-waf-fila .icono { width: 13px; height: 13px; }

/* ---------- Avisos: tarjetas de cristal teñidas con gradiente ---------- */
.aviso-cron, .aviso-info, .aviso-ok, .aviso-error, .aviso-desatendidos, .aviso-vulnerable, .aviso-historico, .aviso-conexion {
    --c: var(--info-texto);
    --g: var(--info-a);
    margin: 14px 0;
    padding: 16px 20px;
    border: 1px solid color-mix(in srgb, var(--g) 26%, transparent);
    border-radius: var(--r-m);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--g) 18%, transparent), color-mix(in srgb, var(--g) 5%, transparent) 70%),
        var(--cristal);
    -webkit-backdrop-filter: var(--cristal-filtro);
    backdrop-filter: var(--cristal-filtro);
    box-shadow: var(--cristal-brillo), var(--sombra-1);
    color: var(--c);
    font-size: 0.92rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.aviso-cron, .aviso-error, .aviso-vulnerable, .aviso-historico { --c: var(--critico-texto); --g: #FF6B61; }
.aviso-desatendidos { --c: var(--aviso-texto); --g: var(--aviso-b); }
.aviso-ok { --c: var(--ok-texto); --g: var(--ok-b); }
.aviso-desatendidos .icono, .aviso-vulnerable .icono, .aviso-historico .icono, .aviso-conexion .icono { margin-right: 8px; }
.aviso-vulnerable a, .aviso-cron a { color: inherit; text-decoration-color: currentColor; }
.aviso-cron { padding: 22px 26px; border-radius: var(--r-l); }
.aviso-cron .aviso-titulo { margin-bottom: 8px; font-family: var(--f-titulo); font-weight: 700; font-size: 1.1rem; text-transform: uppercase; letter-spacing: -0.015em; }
.aviso-cron p { margin: 0; }
.aviso-cron p + p { margin-top: 8px; }
.aviso-cron .aviso-accion { color: var(--texto); }
.aviso-cron code, .aviso-info code, .aviso-error code { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; }

.estado-cron-ok {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: -12px 0 32px;
    padding: 8px 16px 8px 12px;
    border: 1px solid var(--cristal-borde);
    border-radius: 999px;
    background: var(--cristal);
    -webkit-backdrop-filter: var(--cristal-filtro);
    backdrop-filter: var(--cristal-filtro);
    box-shadow: var(--cristal-brillo), var(--sombra-1);
    font-family: var(--f-mono);
    font-size: 0.74rem;
    color: var(--texto-suave);
}
.estado-cron-ok::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(180deg, var(--ok-a), var(--ok-b)); animation: vivo 2.8s var(--ease-out) infinite; }
@keyframes vivo { 0% { box-shadow: 0 0 0 0 rgba(46, 233, 26, 0.55); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- Ficha del sitio: baldosas ---------- */
.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    margin: 0 0 12px;
}
.resumen-celda {
    min-width: 0;
    padding: 20px 22px 22px;
    border-radius: var(--r-l);
    background: var(--superficie);
    box-shadow: var(--sombra-1);
    transition: transform 250ms var(--ease-ios), box-shadow 250ms var(--ease-ios);
}
.resumen-etq { margin-bottom: 12px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texto-suave); transition: color 200ms ease; }
.resumen-valor { font-size: 1.05rem; font-weight: 600; color: var(--texto-fuerte); overflow-wrap: anywhere; }
.resumen-valor .pastilla { margin-right: 6px; }
.resumen-cambios { margin: 0 0 24px; color: var(--texto-suave); font-size: 0.92rem; }
.resumen-cambios strong { color: var(--texto-fuerte); font-weight: 600; font-variant-numeric: tabular-nums; }
.resumen-ramas { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }

.form-programacion { grid-column: span 2; }
.programacion-selects { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.programacion-selects select { flex: 1 1 130px; min-width: 0; min-height: 40px; font-size: 0.88rem; }
.programacion-selects .btn { min-height: 40px; padding: 0 18px; }

/* ---------- Hallazgos: tarjetas con icono de severidad ---------- */
.hallazgos { display: flex; flex-direction: column; gap: 14px; }
.hallazgo {
    --a: var(--neutro-a); --b: var(--neutro-b); --t: var(--neutro-texto); --sobre: #FFFFFF;
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0 22px;
    padding: 26px 28px;
    border-radius: var(--r-l);
    background: var(--superficie);
    box-shadow: var(--sombra-1);
    isolation: isolate;
    overflow: hidden;
    transition: transform 280ms var(--ease-ios), box-shadow 280ms var(--ease-ios);
}
.hallazgo.critico { --a: #FF6B61; --b: var(--critico-b); --t: var(--critico-texto); }
.hallazgo.aviso { --a: var(--aviso-a); --b: var(--aviso-b); --t: var(--aviso-texto); --sobre: #3A2800; }
.hallazgo.resuelto { --a: var(--ok-a); --b: var(--ok-b); --t: var(--ok-texto); --sobre: #0A2607; }
/* Halo de severidad: luz difusa en la esquina, se intensifica al pasar el raton */
.hallazgo::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(520px 220px at 0% 0%, color-mix(in srgb, var(--a) 16%, transparent), transparent 70%);
    opacity: 0.7;
    transition: opacity 280ms ease;
}
.hallazgo-num {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: var(--r-m);
    background: linear-gradient(160deg, var(--a), var(--b));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 18px -8px color-mix(in srgb, var(--b) 80%, transparent);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--sobre);
    font-variant-numeric: tabular-nums;
    transition: transform 280ms var(--ease-ios);
}
.hallazgo-cuerpo { min-width: 0; }
.hallazgo-cabecera { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; min-height: 22px; }
.hallazgo-nivel { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--t); }
.hallazgo-tipo { padding: 2px 8px; border-radius: 7px; background: var(--relleno); font-family: var(--f-mono); font-size: 0.76rem; color: var(--texto-suave); overflow-wrap: anywhere; }
.hallazgo-resumen { max-width: 72ch; margin: 0 0 20px; font-size: 1.04rem; line-height: 1.55; color: var(--texto-fuerte); overflow-wrap: anywhere; }
.hallazgo.resuelto .hallazgo-resumen { color: var(--texto); }
.hallazgo-pie { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; padding-top: 16px; border-top: 1px solid var(--separador); }
.hallazgo-fp { margin: 0; }

/* Detalle tecnico plegable */
.hallazgo-detalle { flex: 1 1 320px; min-width: 0; }
.hallazgo-detalle summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: -6px -12px;
    padding: 6px 12px;
    border-radius: 999px;
    list-style: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--texto-suave);
    transition: color 150ms ease, background-color 200ms ease;
    user-select: none;
}
.hallazgo-detalle summary::-webkit-details-marker { display: none; }
.hallazgo-detalle summary .icono { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform 250ms var(--ease-out); }
.hallazgo-detalle[open] summary { color: var(--texto-fuerte); }
.hallazgo-detalle[open] summary .icono { transform: rotate(0deg); }
.hallazgo-detalle::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 280ms var(--ease-ios), content-visibility 280ms allow-discrete;
}
.hallazgo-detalle[open]::details-content { block-size: auto; }
.hallazgo-detalle-contenido { padding-top: 14px; }
.hallazgo-detalle[open] .hallazgo-detalle-contenido { transition: opacity 250ms ease, transform 280ms var(--ease-out); }
@starting-style { .hallazgo-detalle[open] .hallazgo-detalle-contenido { opacity: 0; transform: translateY(-4px); } }
.hallazgo pre {
    max-height: 320px;
    margin: 0;
    padding: 16px 18px;
    overflow: auto;
    border-radius: var(--r-s);
    background: var(--superficie-2);
    box-shadow: inset 0 0 0 1px var(--separador);
    color: var(--texto);
    font-size: 0.76rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sin-hallazgos {
    padding: 24px 26px;
    border-radius: var(--r-l);
    background: linear-gradient(135deg, color-mix(in srgb, var(--ok-a) 16%, transparent), transparent 70%), var(--superficie);
    box-shadow: var(--sombra-1);
    color: var(--texto-fuerte);
    font-weight: 500;
}

/* ---------- Formularios: campos rellenos, sin borde duro ---------- */
.campo { margin-bottom: 22px; text-align: left; }
.campo label { display: block; margin: 0 0 8px 4px; font-size: 0.8rem; font-weight: 600; color: var(--texto-suave); }
.campo input, .campo textarea, .campo select, .programacion-selects select, .ticket textarea {
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: var(--r-s);
    background: var(--relleno);
    box-shadow: inset 0 0 0 1px transparent;
    color: var(--texto-fuerte);
    font: 400 0.95rem/1.5 var(--f-texto);
    transition: background-color 200ms ease, box-shadow 200ms var(--ease-out);
}
.campo input, .campo select { min-height: 48px; }
.campo textarea, .ticket textarea { font-family: var(--f-mono); font-size: 0.8rem; line-height: 1.7; resize: vertical; }
.campo input::placeholder, .campo textarea::placeholder { color: var(--texto-suave); opacity: 0.75; }
.campo select, .programacion-selects select {
    appearance: none;
    cursor: pointer;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B5847' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
}
.campo input:focus, .campo textarea:focus, .campo select:focus, .programacion-selects select:focus, .ticket textarea:focus {
    outline: none;
    background-color: var(--superficie);
    box-shadow: inset 0 0 0 1px var(--verde-texto), 0 0 0 4px color-mix(in srgb, var(--verde) 30%, transparent);
}
.campos-fila { display: grid; grid-template-columns: 1fr 200px; gap: 16px; }
.campos-fila--2 { grid-template-columns: 1fr 1fr; }
.nota-campo { margin: -8px 0 28px 4px; font-size: 0.84rem; color: var(--texto-suave); }

/* Alta de sitios */
.alta-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.alta-form { overflow: visible; padding: 32px; }
.alta-ayuda { padding: 8px 4px; color: var(--texto); font-size: 0.92rem; }
.alta-ayuda ol { margin: 16px 0 28px; padding: 0; list-style: none; counter-reset: paso; }
.alta-ayuda li { position: relative; margin-bottom: 18px; padding-left: 46px; counter-increment: paso; }
.alta-ayuda li::before {
    content: counter(paso);
    position: absolute;
    left: 0; top: -2px;
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 10px;
    background: linear-gradient(160deg, var(--ok-a), var(--ok-b));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 12px -6px rgba(46, 233, 26, 0.8);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 0.9rem;
    color: #0A2607;
}
.alta-ayuda p { color: var(--texto-suave); }
.alta-ayuda strong { color: var(--texto-fuerte); font-weight: 600; }

/* ---------- Login: cristal sobre tinta ---------- */
.login-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 0;
    background:
        radial-gradient(600px 420px at 22% 18%, rgba(46, 233, 26, 0.32), transparent 65%),
        radial-gradient(520px 420px at 82% 85%, rgba(80, 170, 200, 0.22), transparent 65%),
        var(--tinta);
    box-shadow: 0 0 0 100vmax var(--tinta);
    clip-path: inset(0 -100vmax);
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--r-xl);
    background: rgba(242, 245, 243, 0.86);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 30px 80px -24px rgba(0, 0, 0, 0.6);
    color: #374035;
}
.login-card .marca { margin-bottom: 36px; }
.login-card .logo { color: #0F0F12; font-size: 1.6rem; }
.login-card .eyebrow { color: #1F7A14; }
.display--login { margin: 12px 0 14px; font-size: 2.5rem; color: #0F0F12; }
.login-card p.subtitulo { margin: 0 0 28px; color: #4B5847; font-size: 0.94rem; }
.login-card .campo input { background: rgba(15, 15, 18, 0.05); color: #0F0F12; }
.login-card .campo input:focus { background: #FFFFFF; box-shadow: inset 0 0 0 1px #1F7A14, 0 0 0 4px rgba(46, 233, 26, 0.3); }
.login-card .campo label { color: #4B5847; }
.login-card .btn { width: 100%; min-height: 50px; margin-top: 6px; background: linear-gradient(180deg, #2A2A30, #0F0F12); color: #FFFFFF; }
.login-card .aviso-error { --c: #B42318; }

/* ---------- Acciones ---------- */
.grupo-proveedor { margin-bottom: 28px; }
.cabecera-proveedor { display: flex; align-items: baseline; gap: 12px; padding: 22px 0 6px; }
.accion { margin: 4px 0; font-size: 0.9rem; }
.ticket { padding: 16px 0 8px; }
.ticket summary { margin-bottom: 12px; cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--texto-fuerte); }
.ticket .btn-copiar { margin-top: 12px; }

/* ---------- Hover: solo con raton fino (Emil) ---------- */
@media (hover: hover) and (pointer: fine) {
    .btn:hover { filter: brightness(1.12); }
    .btn-secundario:hover { filter: none; background: var(--superficie); }
    .btn-marca:hover { filter: brightness(1.05) saturate(1.05); }
    .btn-marca:hover .icono-giro { transform: rotate(90deg); }
    .btn-icono-refrescar:hover { color: var(--texto-fuerte); background: color-mix(in srgb, var(--texto-fuerte) 10%, transparent); }
    .btn-icono-refrescar:hover .icono { transform: rotate(120deg); }
    .cta-fila:hover { background: color-mix(in srgb, var(--texto-fuerte) 10%, transparent); }
    .cta-fila--revisar:hover, .cta-fila--rojo:hover { filter: brightness(1.12); }
    .cta-fila--revisar:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--primario) 86%, #fff), var(--primario)); }
    .cta-fila--rojo:hover { background: linear-gradient(180deg, var(--critico-a), var(--critico-b)); }
    .cta-fila:hover .icono { transform: translateX(3px); }
    .btn-texto:hover { color: var(--texto-fuerte); background: var(--relleno); }

    .nav a:not([aria-current="page"]):hover { color: var(--texto-fuerte); }
    a.logo:hover i { transform: rotate(90deg); }
    .volver:hover { background: color-mix(in srgb, var(--texto-fuerte) 10%, transparent); }
    .volver:hover .icono { transform: translateX(-3px); }

    table tr:not(:first-child):hover { background: color-mix(in srgb, var(--verde) 5%, transparent); }
    .nombre-sitio:hover { text-decoration: underline; text-decoration-color: var(--verde); text-decoration-thickness: 2px; }

    .resumen-celda:hover { transform: translateY(-2px); box-shadow: var(--sombra-2); }
    .resumen-celda:hover .resumen-etq { color: var(--verde-texto); }

    .hallazgo:hover { transform: translateY(-2px); box-shadow: var(--sombra-3); }
    .hallazgo:hover::before { opacity: 1; }
    .hallazgo:hover .hallazgo-num { transform: scale(1.06) rotate(-3deg); }
    .hallazgo-detalle summary:hover { color: var(--texto-fuerte); background: var(--relleno); }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .alta-grid, .campos-fila, .campos-fila--2 { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 640px) {
    body { padding: 0 16px 96px; }
    .cabecera { top: 10px; margin-top: 10px; gap: 12px; height: 54px; padding: 0 6px 0 18px; }
    .logo { font-size: 1.2rem; }
    .nav { margin-left: auto; }
    .nav a { padding: 7px 10px; font-size: 0.76rem; }
    .producto { display: none; }
    .top-bar { margin-top: 40px; }
    .kpi { padding: 18px; }
    .kpi-valor { font-size: 2.2rem; }
    .tarjeta { padding: 4px 18px 8px; border-radius: var(--r-l); }
    .hallazgo { grid-template-columns: 1fr; gap: 16px; padding: 22px 20px; }
    .hallazgo-num { width: 44px; height: 44px; font-size: 1rem; }
    .form-programacion { grid-column: auto; }
    .alta-form { padding: 22px; }
    .login-card { padding: 28px 22px; }
}

/* ---------- Sin backdrop-filter: superficies opacas para mantener contraste ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --cristal: var(--superficie); }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* El login es una portada a pantalla completa */
body:has(.login-wrap) { padding-bottom: 0; }
body:has(.login-wrap)::before { background: var(--tinta); }

/* ---------- Tablas densas (Versiones, Acciones): nada se parte letra a letra ---------- */
td .pastilla { white-space: nowrap; overflow-wrap: normal; font-family: var(--f-texto); font-weight: 600; font-variant-numeric: tabular-nums; }
th { white-space: normal; min-width: 0; line-height: 1.3; }
td:last-child:has(.form-refrescar) { width: 1%; }
.texto-servidor { display: block; margin-top: 3px; font-family: var(--f-mono); font-size: 0.74rem; color: var(--texto-suave); overflow-wrap: anywhere; }
@media (max-width: 1320px) {
    .tarjeta { padding-left: 22px; padding-right: 22px; }
    th { padding-right: 14px; }
    td { padding-right: 14px; font-size: 0.88rem; }
}
