/* Página pública de estado (status.php). Usa las variables de styles.css (oscuro/claro). */

.status-page {
  --st-ok: #3fb36a;
  --st-warn: var(--accent);
  --st-bad: var(--danger);
  --st-card: var(--panel);
  --st-fill: color-mix(in srgb, var(--ink) 8%, transparent);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--deep);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
}

.status-page.theme-light {
  --st-card: #ffffff;
}

.st-wrap {
  width: min(100% - 2rem, 52rem);
  margin: 0 auto;
}

.st-top {
  border-bottom: 1px solid var(--line);
}

.st-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
}

.st-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.st-brand img {
  width: auto;
  height: 2.1rem;
}

.st-brand em {
  margin-left: 0.3rem;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.st-top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-page .theme-toggle {
  min-height: 2.2rem;
  padding: 0.3rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.st-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.3rem 0.95rem;
  color: #121110;
  background: var(--accent);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.st-btn:hover {
  filter: brightness(1.06);
}

.st-main {
  padding: 2.2rem 0 3rem;
}

/* Banner */
.st-banner {
  display: grid;
  gap: 0.2rem;
  padding: 1.15rem 1.35rem;
  color: #fff;
  border-radius: 10px;
}

.st-banner strong {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 800;
}

.st-banner span {
  font-size: 0.88rem;
  opacity: 0.9;
}

.st-banner.is-ok {
  background: color-mix(in srgb, var(--st-ok) 88%, #000);
}

.st-banner.is-warn {
  color: #121110;
  background: var(--st-warn);
}

.st-banner.is-bad {
  background: var(--st-bad);
}

.st-legend {
  margin: 2.2rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

/* Servicios */
.st-list {
  background: var(--st-card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.st-item {
  padding: 1.1rem 1.3rem 1rem;
  border-top: 1px solid var(--line);
}

.st-item:first-child {
  border-top: 0;
}

.st-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.st-item-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0;
  max-width: none;
}

.st-state {
  font-size: 0.82rem;
  font-weight: 600;
}

.st-state.is-ok { color: var(--st-ok); }
.st-state.is-warn { color: var(--accent-ink); }
.st-state.is-bad { color: var(--st-bad); }

.st-message {
  margin: -0.2rem 0 0.8rem;
  padding: 0.6rem 0.8rem;
  color: var(--ink);
  background: var(--st-fill);
  border-left: 3px solid var(--st-warn);
  border-radius: 6px;
  font-size: 0.86rem;
}

/* Barras de 90 días */
.st-bars {
  display: flex;
  gap: 2px;
  height: 2.2rem;
}

.st-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  background: var(--st-ok);
  border-radius: 2px;
  outline: none;
  transition: transform 120ms ease, filter 120ms ease;
}

.st-bar.is-maintenance { background: var(--st-warn); }
.st-bar.is-error { background: var(--st-bad); }
.st-bar.is-nodata { background: var(--st-fill); }

.st-bar:hover,
.st-bar:focus-visible {
  z-index: 2;
  filter: brightness(1.15);
  transform: scaleY(1.08);
}

.st-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  padding: 0.4rem 0.6rem;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  display: none;
  pointer-events: none;
}

.st-bar:hover::after,
.st-bar:focus-visible::after {
  display: block;
}

/* Los extremos no deben salirse de la pantalla */
.st-bar:nth-child(-n + 12)::after {
  left: 0;
  transform: none;
}

.st-bar:nth-last-child(-n + 12)::after {
  right: 0;
  left: auto;
  transform: none;
}

.st-axis {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.st-axis-line {
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

/* Incidentes */
.st-events {
  margin-top: 2.4rem;
}

.st-events h2 {
  margin: 0 0 0.8rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  max-width: none;
}

.st-events ul {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--st-card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.st-events li {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  border-top: 1px solid var(--line);
}

.st-events li:first-child {
  border-top: 0;
}

.st-events li > div {
  flex: 1;
  min-width: 0;
}

.st-events strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.st-events p {
  margin: 0.2rem 0 0;
  color: var(--text);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.st-events time {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.st-dot {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0.4rem;
  background: var(--st-ok);
  border-radius: 50%;
}

.st-dot.is-warn { background: var(--st-warn); }
.st-dot.is-bad { background: var(--st-bad); }

.st-empty {
  margin: 0;
  padding: 1.2rem 1.3rem;
  color: var(--muted);
  background: var(--st-card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.st-list .st-empty {
  border: 0;
}

.st-note {
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.st-foot {
  padding: 1.5rem 0 2.2rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.st-foot .st-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.st-foot a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .st-brand span {
    font-size: 0.95rem;
  }

  .st-brand em {
    display: block;
    margin: 0;
  }

  .st-btn {
    display: none;
  }

  .st-legend {
    text-align: left;
  }

  .st-item {
    padding: 1rem;
  }

  .st-bars {
    height: 1.9rem;
    gap: 1px;
  }

  .st-axis {
    font-size: 0.68rem;
    gap: 0.4rem;
  }

  .st-events li {
    flex-wrap: wrap;
  }

  .st-events time {
    margin-left: 1.4rem;
    width: 100%;
  }
}

.st-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 2rem 0 0.7rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  max-width: none;
}

.st-group span {
  padding: 0.05rem 0.55rem;
  color: var(--muted);
  background: var(--st-fill);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.st-group-note {
  margin: -0.4rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.st-legend + .st-group {
  margin-top: 0.6rem;
}

.st-meta {
  margin: -0.3rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Resumen conjunto de los sitios de clientes */
.st-agg .st-item-head h3 {
  font-size: 1rem;
}

.st-more {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.st-more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.st-more summary::-webkit-details-marker {
  display: none;
}

.st-more summary::before {
  content: "›";
  display: inline-block;
  transition: transform 150ms ease;
}

.st-more[open] summary::before {
  transform: rotate(90deg);
}

.st-more ul {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}

.st-more li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.st-more li:first-child {
  border-top: 0;
}

.st-more-name {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
}

.st-more-up {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.st-more .st-dot {
  margin-top: 0;
}
