:root {
  --fondo: #0b0e14;
  --panel: #10141c;
  --panel-alto: #141a24;
  --borde: #1e2632;
  --borde-claro: #2a3444;
  --texto: #e8eef6;
  --tenue: #7d8899;
  --apagado: #5a6474;

  --ok: #46d17f;
  --ok-suave: #0f2b1d;
  --aviso: #e5a83a;
  --aviso-suave: #2e2411;
  --mal: #f4635c;
  --mal-suave: #33161a;
  --nulo: #5a6474;

  --radio: 14px;
  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--texto);
  background:
    radial-gradient(1200px 600px at 15% -10%, #16202e 0%, transparent 60%),
    radial-gradient(900px 500px at 95% 0%, #151b28 0%, transparent 55%),
    var(--fondo);
  background-attachment: fixed;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

/* ---------- barra superior ---------- */
.cinta {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--borde);
  background: rgba(11,14,20,.78);
  backdrop-filter: saturate(160%) blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.marca { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.logo {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 4px rgba(70,209,127,.14);
  animation: pulso 3s ease-in-out infinite;
}
@keyframes pulso { 50% { box-shadow: 0 0 0 7px rgba(70,209,127,.05); } }
.reloj { margin-left: auto; color: var(--tenue); font-size: 12.5px; font-variant-numeric: tabular-nums; }

main { padding: 26px; max-width: 1560px; margin: 0 auto; }

/* ---------- portada / resumen ---------- */
.portada {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr) auto;
  align-items: center;
  gap: 34px;
  padding: 24px 30px;
  background: linear-gradient(180deg, var(--panel-alto), var(--panel));
  border: 1px solid var(--borde);
  border-radius: 18px;
  box-shadow: var(--sombra);
}

.anillo { position: relative; width: 128px; height: 128px; flex: none; }
.anillo svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anillo circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.anillo .pista { stroke: #1c2530; }
.anillo .valor { stroke: var(--ok); transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1), stroke .4s; }
.anillo.aviso .valor { stroke: var(--aviso); }
.anillo.mal .valor { stroke: var(--mal); }
.anillo .centro {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.anillo .pct { font-size: 34px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; display: block; line-height: 1; }
.anillo .sub { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--tenue); margin-top: 5px; display: block; }

.titular { min-width: 0; }
.titular .grande {
  font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.titular .grande b { font-weight: 700; color: var(--ok); }
.titular .grande.aviso b { color: var(--aviso); }
.titular .grande.mal b { color: var(--mal); }
.titular .pie { color: var(--tenue); font-size: 13px; margin-top: 7px; }

.tira { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin-top: 16px; background: #1c2530; gap: 2px; }
.tira i { display: block; transition: width .7s cubic-bezier(.4,0,.2,1); }
.tira i.ok { background: var(--ok); }
.tira i.aviso { background: var(--aviso); }
.tira i.mal { background: var(--mal); }
.tira i.nulo { background: #2c3644; }

.leyenda { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 11px; font-size: 12px; color: var(--tenue); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda b { color: var(--texto); font-variant-numeric: tabular-nums; font-weight: 600; }
.leyenda .m { width: 7px; height: 7px; border-radius: 2px; background: var(--nulo); }
.leyenda .m.ok { background: var(--ok); }
.leyenda .m.aviso { background: var(--aviso); }
.leyenda .m.mal { background: var(--mal); }
.leyenda .m.nulo { background: #2c3644; }

.desglose { display: grid; grid-template-columns: repeat(2, auto); gap: 3px 22px; font-size: 12.5px; color: var(--tenue); }
.desglose b { color: var(--texto); font-variant-numeric: tabular-nums; font-weight: 600; }
.desglose div { white-space: nowrap; }

.alerta {
  grid-column: 1 / -1; margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 11px 14px; border-radius: 11px;
  background: var(--mal-suave); border: 1px solid #4a2226; color: #ffc7c3; font-size: 13px;
}
.alerta strong { color: #ff9b95; font-weight: 600; }
.alerta a { color: inherit; text-decoration: none; border-bottom: 1px dotted #ff9b9566; }

/* ---------- secciones ---------- */
.bloque { margin-top: 34px; }
.bloque h2 {
  display: flex; align-items: center; gap: 12px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--tenue); font-weight: 600; margin: 0 0 14px;
}
.bloque h2 em { font-style: normal; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--apagado); }
.bloque h2 i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--borde), transparent); }

.rejilla { display: grid; gap: 15px; grid-template-columns: repeat(auto-fill, minmax(345px, 1fr)); }

/* ---------- tarjetas ---------- */
.tarjeta {
  background: linear-gradient(180deg, var(--panel-alto), var(--panel));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 17px 19px 18px;
  position: relative; overflow: hidden;
  box-shadow: var(--sombra);
  transition: border-color .2s, transform .2s;
}
.tarjeta:hover { border-color: var(--borde-claro); }
.tarjeta::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--nulo); opacity: .85;
}
.tarjeta.ok::after { background: linear-gradient(90deg, var(--ok), rgba(70,209,127,.15)); }
.tarjeta.aviso::after { background: linear-gradient(90deg, var(--aviso), rgba(229,168,58,.15)); }
.tarjeta.mal::after { background: linear-gradient(90deg, var(--mal), rgba(244,99,92,.15)); }
.tarjeta.mal { border-color: #3d2126; }

.cabecera { display: flex; align-items: center; gap: 9px; }
.cabecera .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--nulo); flex: none; }
.ok .punto { background: var(--ok); box-shadow: 0 0 0 3px rgba(70,209,127,.14); }
.aviso .punto { background: var(--aviso); box-shadow: 0 0 0 3px rgba(229,168,58,.14); }
.mal .punto { background: var(--mal); box-shadow: 0 0 0 3px rgba(244,99,92,.16); animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .3; } }
.cabecera h3 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.cabecera .etiqueta {
  margin-left: auto; font-size: 11px; color: var(--apagado); font-family: var(--mono);
  background: #171e29; border: 1px solid var(--borde); padding: 2px 7px; border-radius: 6px;
}
.rol { color: var(--tenue); font-size: 12.5px; margin: 5px 0 15px; }

.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 13px; margin-bottom: 14px; }
.metrica .v { font-size: 18px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.metrica .v.largo { font-size: 15px; letter-spacing: -.01em; }
.metrica .k { font-size: 9.5px; color: var(--apagado); text-transform: uppercase; letter-spacing: .1em; margin-top: 3px; }
.barra { height: 3px; background: #1c2530; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--ok); border-radius: 2px; transition: width .6s ease; }
.barra i.aviso { background: var(--aviso); }
.barra i.mal { background: var(--mal); }

/* ---------- bloque en vivo (300 ms) ---------- */
.vivo {
  position: relative; margin: 0 0 15px;
  background: #0d1119; border: 1px solid var(--borde); border-radius: 11px;
  padding: 12px 14px 0; overflow: hidden;
}
.vivo-cab {
  display: flex; align-items: center; gap: 9px; margin-bottom: 11px;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: #4d5766;
  white-space: nowrap;
}
.vivo-techo { color: #3f4a5a; }
.vivo-enlace { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--apagado); }
.vivo-enlace .latido { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); animation: latir 1.2s ease-in-out infinite; }
@keyframes latir { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .3; transform: scale(.7); } }

.vivo-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.vivo-dato .cifra { display: flex; align-items: baseline; gap: 2px; }
.vivo-dato .n {
  font-size: 23px; font-weight: 650; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums; transition: color .3s;
}
.vivo-dato .u { font-size: 12px; color: var(--tenue); font-weight: 600; }
.vivo-dato .e { font-size: 9.5px; color: var(--apagado); text-transform: uppercase; letter-spacing: .1em; margin-top: 5px; }
.vivo-dato .barra { margin-top: 6px; }
.vivo-dato .barra i { transition: width .28s linear, background .3s; }

.chispa { display: block; width: calc(100% + 28px); height: 40px; margin: 10px -14px -1px; }
.chispa .linea { fill: none; stroke: var(--ok); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chispa .relleno { fill: rgba(70,209,127,.09); stroke: none; }

.vivo.caido .latido { background: var(--mal); animation: none; }
.vivo.caido .vivo-enlace { color: #ff9b95; }
.vivo.caido .chispa .linea { stroke: #3f4a5a; }
.vivo.caido .chispa .relleno { fill: rgba(90,100,116,.07); }
.vivo.caido .vivo-dato .n { color: var(--apagado); }

.grupo { margin-top: 9px; }
.grupo .titulo { font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: #4d5766; margin-bottom: 5px; }
.lista { display: flex; flex-wrap: wrap; gap: 5px; }
.pastilla {
  font-size: 11.5px; padding: 3px 9px; border-radius: 7px;
  background: #171e29; border: 1px solid var(--borde); color: #9aa5b4;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.pastilla::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--nulo); flex: none; }
.pastilla.ok { color: #c3cdda; }
.pastilla.ok::before { background: var(--ok); }
.pastilla.aviso { color: #e8cf9d; background: var(--aviso-suave); border-color: #453718; }
.pastilla.aviso::before { background: var(--aviso); }
.pastilla.mal { color: #ffbdb9; background: var(--mal-suave); border-color: #4a2226; }
.pastilla.mal::before { background: var(--mal); }

.avisos { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--borde); font-size: 12.5px; color: var(--aviso); }
.avisos.mal { color: #ff9b95; }
.avisos div { margin-top: 3px; }
.avisos div:first-child { margin-top: 0; }

/* ---------- dominios ---------- */
.dominios { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); }
.dominio {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 10px;
  font-size: 13px; text-decoration: none; color: var(--texto);
  transition: border-color .15s, background .15s, transform .15s;
}
.dominio:hover { border-color: var(--borde-claro); background: var(--panel-alto); transform: translateY(-1px); }
.dominio .punto { width: 7px; height: 7px; border-radius: 50%; background: var(--nulo); flex: none; }
.dominio.ok .punto { background: var(--ok); }
.dominio.aviso .punto { background: var(--aviso); }
.dominio.mal .punto { background: var(--mal); box-shadow: 0 0 0 3px rgba(244,99,92,.14); }
.dominio.mal { border-color: #3d2126; background: linear-gradient(90deg, var(--mal-suave), var(--panel) 60%); }
.dominio .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dominio .dato {
  margin-left: auto; color: var(--apagado); font-size: 11px; font-family: var(--mono);
  flex: none; letter-spacing: -.02em;
}
.dominio.mal .dato { color: #ff9b95; }
.dominio.apagado { opacity: .38; }

/* ---------- huecos ---------- */
.tarjeta.hueco { background: #0f131a; border-style: dashed; border-color: #232c39; box-shadow: none; }
.tarjeta.hueco::after { background: repeating-linear-gradient(90deg, #2c3644 0 8px, transparent 8px 16px); }
.tarjeta.hueco .cabecera h3 { color: #96a1b0; }
.tarjeta.hueco .etiqueta { color: #4d5766; }
.necesita { font-size: 12px; color: var(--apagado); margin-top: 12px; padding-top: 11px; border-top: 1px dashed #232c39; }
.necesita b { color: #8b96a5; font-weight: 600; }

@media (max-width: 780px) {
  main, .barra { padding: 15px; }
  .portada { grid-template-columns: auto 1fr; gap: 20px; padding: 20px; }
  .desglose { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
  .anillo { width: 96px; height: 96px; }
  .anillo .pct { font-size: 26px; }
}
@media (max-width: 520px) {
  .portada { grid-template-columns: 1fr; }
  .rejilla { grid-template-columns: 1fr; }
}
