:root {
  --brand: #2f7078;
  --brand-dark: #255a60;
  --brand-light: #3d8a94;
  --brand-teal-bg: #e8f1f2;
  --bg: #eef3f4;
  --text: #1a2e30;
  --muted: #5c7275;
  --operational: #2d9b6a;
  --instability: #d4a82a;
  --outage: #c44545;
  --nodata: #b8c0c2;
  --card-radius: 16px;
  --container: 1120px;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 55%, #1e4a50 100%);
  color: #fff;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 120%, rgba(255, 255, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 90% -20%, rgba(255, 255, 255, 0.06), transparent);
  pointer-events: none;
}

.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
  flex-wrap: wrap;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.site-header__brand img {
  height: 32px;
  width: auto;
  display: block;
}

.site-header__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 0.5rem;
}

.site-nav a {
  color: rgba(255, 255, 255, 0.92);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.site-nav a.is-active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Main */
.site-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  width: 100%;
  flex: 1;
}

.page-error {
  background: #fce8e8;
  color: #8b2e2e;
  border: 1px solid #e8bcbc;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.error-msg {
  color: #8b2e2e;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Banner */
.status-banner {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.35rem 1.5rem;
  border-radius: var(--card-radius);
  margin-bottom: 1.25rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-banner--ok {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
}

.status-banner--warn {
  background: linear-gradient(135deg, #b8891a, #8a6610);
}

.status-banner--danger {
  background: linear-gradient(135deg, #b83b3b, #8f2c2c);
}

.status-banner--info {
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
}

.status-banner--muted {
  background: linear-gradient(135deg, #6b7c7e, #4d5c5e);
}

.status-banner__icon svg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.status-banner__title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.status-banner__subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  opacity: 0.95;
  max-width: 52ch;
}

.status-banner__updated {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.88;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Cards */
.card {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e0e8e9;
  box-shadow: 0 1px 3px rgba(30, 60, 64, 0.06);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.card__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.card__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.period-select {
  border: 1px solid #cdd8da;
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
  min-width: 10.5rem;
}

/* Service rows */
.service-row {
  padding: 1.1rem 0;
  border-bottom: 1px solid #eef1f1;
}

.service-row:last-child {
  border-bottom: none;
}

.service-row__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem 1rem;
  align-items: start;
}

.service-row__icon {
  color: var(--brand);
  padding-top: 0.1rem;
}

.service-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.service-row__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.service-row__desc {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.service-row__history {
  margin-top: 0.65rem;
  padding-left: calc(28px + 0.85rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.daily-bars {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 120px;
  height: 28px;
  align-items: stretch;
}

.day-bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 3px;
}

.day-bar-up { background: var(--operational); }
.day-bar-degraded { background: var(--instability); }
.day-bar-down { background: var(--outage); }
.day-bar-nodata { background: var(--nodata); }

.history-insufficient {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.service-pct {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

.badge {
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
  align-self: start;
}

.badge-operational { background: #e3f5ec; color: #1d6b45; }
.badge-instability,
.badge-auto_issue { background: #faf3dd; color: #7a5f0c; }
.badge-outage { background: #fce8e8; color: var(--outage); }
.badge-nodata { background: #eceeef; color: #6a7375; }
.badge-maintenance { background: #dff0f2; color: var(--brand); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eef1f1;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.legend .leg-up { background: var(--operational); }
.legend .leg-degraded { background: var(--instability); }
.legend .leg-down { background: var(--outage); }
.legend .leg-nodata { background: var(--nodata); }

.legend-note {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--brand);
}

.legend-note a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Bottom grid */
.bottom-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
}

.occurrence-card h3,
.side-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.occurrence-block {
  padding: 0.85rem 0;
  border-bottom: 1px solid #eef1f1;
}

.occurrence-block:last-child {
  border-bottom: none;
}

.occurrence-block h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}

.occurrence-block p,
.occurrence-block .compact-list {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.compact-list {
  padding-left: 1.1rem;
}

.compact-list li {
  margin-bottom: 0.35rem;
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.global-availability {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.global-availability-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.page-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.incident-list li {
  margin-bottom: 0.75rem;
}

.incident-list.timeline li {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eef1f1;
}

/* Footer */
.site-footer {
  background: #fff;
  border-top: 1px solid #e0e8e9;
  padding: 1.5rem;
  margin-top: auto;
}

.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer__brand img {
  height: 28px;
  width: auto;
  opacity: 0.85;
}

.site-footer__links {
  display: flex;
  gap: 1.25rem;
}

.site-footer__external {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--brand);
  font-weight: 500;
}

/* Responsive */
@media (max-width: 900px) {
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .legend-note {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .service-row__head {
    grid-template-columns: auto 1fr;
  }

  .service-row__head .badge {
    grid-column: 2;
    justify-self: start;
  }

  .service-row__history {
    padding-left: 0;
  }

  .status-banner {
    flex-direction: column;
  }

  .site-footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .site-main {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .daily-bars {
    height: 22px;
  }
}
