/* vpsmon · estilo inspirado en las guías de interfaz de Apple: tipografía del sistema,
   superficies limpias, vidrio en la barra, movimiento suave con curvas tipo resorte. */
:root {
  color-scheme: light;
  --fondo: #f5f5f7;
  --tarjeta: #ffffff;
  --elevada: #ffffff;
  --texto: #1d1d1f;
  --texto2: #6e6e73;
  --texto3: #86868b;
  --linea: #e7e7e7;
  --pista: #ececf0;
  --seg: rgba(118, 118, 128, .12);
  --acento: #0071e3;
  --acento-sobre: #0077ed;
  --s1: #257de0;
  --s1-suave: #9dc8f7;
  --s2: #f47230;
  --bien: #0aac23;
  --alerta: #fbb315;
  --serio: #f18a59;
  --critico: #dc3c3d;
  --vidrio: rgba(255, 255, 255, .72);
  --sombra: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .05);
  --sombra-alta: 0 2px 4px rgba(0, 0, 0, .05), 0 16px 40px rgba(0, 0, 0, .09);
  --resorte: cubic-bezier(.32, 1.28, .46, 1);
  --suave: cubic-bezier(.22, 1, .36, 1);
  --radio: 22px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fondo: #000000;
    --tarjeta: #191919;
    --elevada: #3a3a3c;
    --texto: #f5f5f7;
    --texto2: #a1a1a6;
    --texto3: #86868b;
    --linea: #303030;
    --pista: #2c2c2e;
    --seg: rgba(118, 118, 128, .24);
    --acento: #2997ff;
    --acento-sobre: #47a6ff;
    --s1: #338ced;
    --s1-suave: #1757ac;
    --s2: #e76624;
    --vidrio: rgba(22, 22, 23, .72);
    --sombra: 0 0 0 1px rgba(255, 255, 255, .05);
    --sombra-alta: 0 0 0 1px rgba(255, 255, 255, .09), 0 16px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 0;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4.2vw, 40px); font-weight: 700; letter-spacing: -.028em; line-height: 1.1; }
h2 { font-size: 28px; font-weight: 700; letter-spacing: -.022em; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--acento); text-decoration: none; }
.oculto { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: -.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ───────── barra superior (vidrio) ───────── */
.barra {
  position: sticky; top: 0; z-index: 20;
  background: var(--vidrio); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid color-mix(in srgb, var(--linea) 70%, transparent);
}
.barra-in { max-width: 1240px; margin: 0 auto; padding: 10px 22px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; min-width: 0; }
.marca img { border-radius: 7px; flex: none; }
.marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acciones { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.acciones form { margin: 0; }
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; color: var(--texto);
  background: var(--seg); padding: 6px 13px; border-radius: 980px; display: inline-block;
  transition: background .25s, transform .35s var(--resorte);
}
.btn:hover { background: color-mix(in srgb, var(--seg) 60%, var(--texto3) 30%); }
.btn:active { transform: scale(.95); }
.vivo { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--texto2); margin-right: 4px; white-space: nowrap; }
.vivo i { width: 8px; height: 8px; border-radius: 50%; background: var(--texto3); position: relative; flex: none; transition: background .4s; }
.vivo.ok i { background: var(--bien); }
.vivo.ok i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--bien); animation: pulso 2.4s var(--suave) infinite; }
.vivo.mal i { background: var(--critico); }

/* control segmentado con pulgar deslizante */
.segmentos { position: relative; display: inline-flex; background: var(--seg); border-radius: 11px; padding: 2px; isolation: isolate; }
.segmentos button {
  appearance: none; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--texto); padding: 6px 18px; border-radius: 9px; position: relative; z-index: 1; white-space: nowrap;
  transition: color .3s, opacity .3s; opacity: .72;
}
.segmentos button[aria-selected="true"] { opacity: 1; font-weight: 600; }
.segmentos .pulgar {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 9px; background: var(--elevada);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .06);
  transition: transform .5s var(--resorte), width .5s var(--resorte);
}
.segmentos.chico button { font-size: 12.5px; padding: 4px 13px; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ───────── estructura ───────── */
main { max-width: 1240px; margin: 0 auto; padding: 30px 22px 10px; }
.vista { display: none; }
.vista.activa { display: block; }
.vista.activa > * { animation: entra .75s var(--suave) both; }
.vista.activa > :nth-child(2) { animation-delay: .05s; }
.vista.activa > :nth-child(3) { animation-delay: .1s; }
.vista.activa > :nth-child(4) { animation-delay: .15s; }
.vista.activa > :nth-child(5) { animation-delay: .2s; }
.vista.activa > :nth-child(6) { animation-delay: .25s; }
.vista.activa > :nth-child(n+7) { animation-delay: .3s; }
.cabecera { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 2px 20px; }
.rejilla { display: grid; gap: 16px; margin-bottom: 16px; }
.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tarjeta {
  background: var(--tarjeta); border-radius: var(--radio); padding: 20px 22px 22px; box-shadow: var(--sombra); min-width: 0;
  transition: transform .5s var(--suave), box-shadow .5s var(--suave);
}
.tarjeta:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); }
.vista > .tarjeta { margin-bottom: 16px; }
.tarjeta > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.nota { font-size: 12.5px; color: var(--texto3); }
.valor { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sub-t { font-size: 12px; font-weight: 600; color: var(--texto3); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 8px; }
.vacio { color: var(--texto3); font-size: 13.5px; padding: 18px 0; text-align: center; }

/* ───────── resumen ───────── */
.heroe { display: flex; align-items: center; gap: 18px; margin: 10px 2px 26px; }
.heroe p { color: var(--texto2); font-size: 16px; margin-top: 6px; }
.estado-icono { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--texto3); transition: background .6s var(--suave), transform .7s var(--resorte); }
.estado-icono svg { width: 30px; height: 30px; }
.estado-icono.bien { background: var(--bien); }
.estado-icono.alerta { background: var(--alerta); color: #3b2a00; }
.estado-icono.critico { background: var(--critico); }
.estado-icono.cambia { transform: scale(1.12); }
.avisos { display: grid; gap: 10px; margin-bottom: 16px; }
.avisos:empty { display: none; }
.aviso { display: flex; gap: 12px; align-items: center; background: var(--tarjeta); border-radius: 16px; padding: 13px 16px; box-shadow: var(--sombra); animation: entra .6s var(--suave) both; }
.aviso svg { width: 22px; height: 22px; flex: none; }
.aviso.critical svg { color: var(--critico); }
.aviso.warning svg { color: var(--alerta); }
.aviso.info svg { color: var(--acento); }
.aviso b { font-weight: 600; display: block; }
.aviso small { color: var(--texto2); font-size: 13px; }
.aviso .etq { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--texto2); background: var(--seg); padding: 3px 9px; border-radius: 980px; white-space: nowrap; }

.centro { text-align: center; padding: 24px 16px 20px; }
.anillo-caja { position: relative; width: 128px; margin: 0 auto 14px; }
.anillo { width: 128px; height: 128px; display: block; }
.anillo-f { fill: none; stroke: var(--pista); stroke-width: 11; }
.anillo-v { fill: none; stroke: var(--s1); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--suave), stroke .5s; }
.anillo-v.alto { stroke: var(--alerta); }
.anillo-v.critico { stroke: var(--critico); }
.anillo-centro { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 44px; gap: 2px; }
.anillo-n { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.anillo-u { font-size: 14px; font-weight: 600; color: var(--texto2); }
.anillo-c { color: var(--texto2); font-size: 13px; margin-top: 4px; }
.anillo-e { font-size: 12px; font-weight: 600; color: var(--texto3); margin-top: 6px; }

.tile { padding: 18px 20px 16px; display: flex; flex-direction: column; min-height: 132px; }
.tile .eti { font-size: 13px; color: var(--texto2); font-weight: 500; }
.tile .cifra { font-size: 34px; font-weight: 700; letter-spacing: -.035em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12.5px; color: var(--texto3); margin-top: 2px; }
.tile .chispa { margin-top: auto; padding-top: 10px; height: 38px; display: flex; align-items: flex-end; gap: 2px; }
.tile .chispa:empty { display: none; }
#tiles-seg .tile { min-height: 0; }
.tile .chispa i { flex: 1; min-height: 2px; background: var(--s1); border-radius: 2px 2px 0 0; opacity: .85; transform-origin: bottom; animation: crece .8s var(--suave) both; }

/* ───────── listas, barras horizontales, tablas ───────── */
.lista { display: grid; gap: 2px; }
.fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.fila:last-child { border-bottom: 0; }
.fila .izq { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .der { color: var(--texto2); font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }
.fila small { color: var(--texto3); font-size: 12.5px; margin-left: 8px; }
.hbar { padding: 7px 0; }
.hbar .txt { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 5px; }
.hbar .txt span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .txt b { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .txt small { color: var(--texto3); margin-left: 8px; font-size: 12px; }
.pista { height: 6px; border-radius: 3px; background: var(--pista); overflow: hidden; display: flex; gap: 2px; }
.pista i { display: block; height: 100%; width: 0; background: var(--s1); border-radius: 3px; transition: width 1s var(--suave); }
.pista i.suave { background: var(--s1-suave); }
.pista.gruesa { height: 12px; border-radius: 6px; }
.pista.gruesa i { border-radius: 4px; }
.punto-e { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texto2); white-space: nowrap; }
.punto-e::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--texto3); }
.punto-e.bien::before { background: var(--bien); }
.punto-e.critico::before { background: var(--critico); }
.punto-e.alerta::before { background: var(--alerta); }
.tabla-caja { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--texto3); text-transform: uppercase; letter-spacing: .05em; padding: 6px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 9px 6px; border-bottom: 1px solid var(--linea); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .25s; }
tbody tr:hover { background: color-mix(in srgb, var(--seg) 45%, transparent); }
td small { color: var(--texto3); display: block; font-size: 12px; }
.etiqueta { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 980px; background: var(--seg); color: var(--texto2); margin-left: 8px; }
.etiqueta.nueva { background: color-mix(in srgb, var(--alerta) 28%, transparent); color: var(--texto); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--seg); border-radius: 980px; padding: 4px 11px; font-size: 12.5px; animation: entra .5s var(--suave) both; }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; margin: 0; }
.datos dt { font-size: 12px; color: var(--texto3); margin-bottom: 2px; }
.datos dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.leyenda { display: flex; gap: 16px; font-size: 12.5px; color: var(--texto2); flex-wrap: wrap; }
.leyenda > span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda b { color: var(--texto); font-weight: 600; font-variant-numeric: tabular-nums; }
.muestra { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; background: var(--texto3); }
.muestra.s1 { background: var(--s1); }
.muestra.s2 { background: var(--s2); }
.muestra.suave { background: var(--s1-suave); }
.muestra.libre { background: var(--pista); }
.desglose { display: grid; gap: 8px; margin-top: 14px; }
.desglose div { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.desglose b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.postura { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 28px; }
.postura .fila { grid-template-columns: auto minmax(0, 1fr) auto; }
.postura svg { width: 19px; height: 19px; }
.postura .bien svg { color: var(--bien); }
.postura .alerta svg { color: var(--alerta); }
.postura .critico svg { color: var(--critico); }

/* ───────── gráficos ───────── */
.grafico { height: 210px; position: relative; }
.grafico.bajo { height: 150px; }
.grafico svg { display: block; overflow: visible; touch-action: pan-y; }
.rejilla-l { stroke: var(--linea); stroke-width: 1; stroke-dasharray: 2 4; }
.eje-l { stroke: var(--linea); stroke-width: 1; }
.eje-t { fill: var(--texto3); font-size: 11px; font-variant-numeric: tabular-nums; }
.eje-t.halo { paint-order: stroke; stroke: var(--tarjeta); stroke-width: 4px; stroke-linejoin: round; }
.traza { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.traza.s1 { stroke: var(--s1); }
.traza.s2 { stroke: var(--s2); }
.traza.dibuja { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dibuja 1.3s var(--suave) forwards; }
.area { opacity: .16; }
.area.s1 { fill: var(--s1); }
.area.dibuja { animation: aparece 1.2s .25s var(--suave) both; }
.cursor-l { stroke: var(--texto3); stroke-width: 1; }
.punto { stroke: var(--tarjeta); stroke-width: 2; }
.punto.s1 { fill: var(--s1); }
.punto.s2 { fill: var(--s2); }
.barra-g { fill: var(--s1); transition: opacity .25s; transform-box: fill-box; transform-origin: 50% 100%; }
.barra-g.crece { animation: crece .8s var(--suave) both; }
svg.con-foco .barra-g { opacity: .4; }
svg.con-foco .barra-g.sobre { opacity: 1; }
.zona { fill: transparent; }
.tip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 120px; max-width: 280px;
  background: var(--vidrio); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-radius: 12px; padding: 9px 12px; box-shadow: var(--sombra-alta); font-size: 12.5px;
  animation: tip .18s var(--suave) both;
}
.tip-t { color: var(--texto2); margin-bottom: 4px; }
.tip-r { display: flex; align-items: center; gap: 7px; }
.tip-r b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.pie { max-width: 1240px; margin: 0 auto; padding: 14px 22px 40px; color: var(--texto3); font-size: 12.5px; text-align: center; }

/* ───────── acceso ───────── */
body.acceso { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--acento) 14%, transparent), transparent 70%), var(--fondo); }
.acceso-caja { width: 100%; max-width: 380px; text-align: center; background: var(--tarjeta); border-radius: 28px; padding: 38px 30px 28px; box-shadow: var(--sombra-alta); animation: entra .9s var(--suave) both; }
.acceso-icono { border-radius: 16px; box-shadow: 0 8px 22px color-mix(in srgb, var(--acento) 35%, transparent); margin-bottom: 18px; animation: flota 1s var(--resorte) both; }
.acceso-caja h1 { font-size: 26px; }
.acceso-sub { color: var(--texto2); margin: 8px 0 22px; }
.campos { border: 1px solid var(--linea); border-radius: 14px; overflow: hidden; text-align: left; transition: border-color .3s, box-shadow .3s; }
.campos:focus-within { border-color: var(--acento); box-shadow: 0 0 0 4px color-mix(in srgb, var(--acento) 18%, transparent); }
.campos label { display: grid; grid-template-columns: 96px 1fr; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--linea); }
.campos label:last-child { border-bottom: 0; }
.campos span { font-size: 14px; color: var(--texto2); }
.campos input { border: 0; outline: 0; background: none; color: var(--texto); font: inherit; font-size: 16px; padding: 13px 0; width: 100%; min-width: 0; }
.boton-principal {
  appearance: none; border: 0; width: 100%; margin-top: 18px; padding: 13px; border-radius: 14px; cursor: pointer;
  background: var(--acento); color: #fff; font: inherit; font-size: 16px; font-weight: 600;
  transition: background .25s, transform .4s var(--resorte);
}
.boton-principal:hover { background: var(--acento-sobre); }
.boton-principal:active { transform: scale(.97); }
.error { background: color-mix(in srgb, var(--critico) 12%, transparent); color: var(--texto); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; animation: sacude .5s var(--suave); }
.acceso-pie { color: var(--texto3); font-size: 12px; margin-top: 22px; }
.acceso-enlace { display: inline-block; margin-top: 16px; font-size: 14px; }
.fuerza { height: 4px; border-radius: 2px; background: var(--pista); margin-top: 12px; overflow: hidden; }
.fuerza i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; border-radius: 2px; background: var(--critico); transition: transform .5s var(--suave), background .4s; }
.fuerza i.media { background: var(--alerta); }
.fuerza i.fuerte { background: var(--bien); }
.pista-t, #pista { background: none; height: auto; display: block; color: var(--texto3); font-size: 12.5px; margin-top: 8px; text-align: left; }

/* ───────── movimiento ───────── */
@keyframes entra { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { opacity: 0; } to { opacity: .16; } }
@keyframes dibuja { to { stroke-dashoffset: 0; } }
@keyframes crece { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pulso { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.8); opacity: 0; } }
@keyframes tip { from { opacity: 0; transform: translateY(4px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes flota { from { opacity: 0; transform: translateY(10px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes sacude { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ───────── pantallas chicas ───────── */
@media (max-width: 1000px) {
  .r4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .barra-in { grid-template-columns: 1fr auto; padding: 10px 14px; row-gap: 10px; }
  .barra-in .segmentos { grid-row: 2; grid-column: 1 / -1; display: flex; }
  .barra-in .segmentos button { flex: 1; padding: 7px 6px; }
  .vivo span { display: none; }
  main { padding: 20px 14px 6px; }
  .r2, .r3 { grid-template-columns: minmax(0, 1fr); }
  #tiles-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 15px 15px 14px; }
  .centro { padding: 20px 10px 16px; }
  .tarjeta { padding: 18px 16px 18px; border-radius: 20px; }
  .tarjeta:hover { transform: none; }
  .heroe { gap: 14px; }
  .estado-icono { width: 48px; height: 48px; }
  .grafico { height: 180px; }
  .tile .cifra { font-size: 28px; }
  .anillo-caja, .anillo { width: 108px; height: auto; }
  .anillo-centro { padding-top: 37px; }
  .anillo-n { font-size: 25px; }
}
