:root {
  color-scheme: light;
  --canvas: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe3ef;
  --healthy: #22c55e;
  --healthy-text: #15803d;
  --degraded: #eab308;
  --outage: #ef4444;
  --unknown: #dbe3ea;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

.header-inner {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

nav a:hover {
  background: #f1f5f9;
  color: var(--text);
}

a:focus-visible,
summary:focus-visible,
.rail:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

main {
  padding: 48px 0 72px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.045em;
  line-height: 1;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
}

.overall-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--healthy-text);
  font-weight: 650;
  white-space: nowrap;
}

.overall-status::before {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  content: "";
  border-radius: 999px;
  background: var(--healthy);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--healthy) 16%, transparent);
}

.overall-status.outage-status {
  color: #dc2626;
}

.overall-status.outage-status::before {
  background: var(--outage);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--outage) 16%, transparent);
}

.overall-status.degraded-status {
  color: #a16207;
}

.overall-status.degraded-status::before {
  background: var(--degraded);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--degraded) 16%, transparent);
}

.overall-status.loading-status {
  color: var(--muted);
}

.overall-status.loading-status::before {
  background: var(--unknown);
  box-shadow: none;
}

.message {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.message.error {
  border-color: color-mix(in srgb, var(--outage) 35%, var(--border));
  color: #b91c1c;
}

.group {
  overflow: hidden;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.group summary {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  cursor: pointer;
  list-style: none;
}

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

.group[open] summary {
  border-bottom: 1px solid var(--border);
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
}

.group-title::before {
  content: "›";
  color: var(--muted);
  font-size: 18px;
  transform: rotate(0deg);
  transition: transform 140ms ease;
}

.group[open] .group-title::before {
  transform: rotate(90deg);
}

.group-health,
.service-status {
  color: var(--healthy-text);
  font-size: 14px;
  font-weight: 650;
}

.group-health.outage,
.service-status.outage {
  color: #dc2626;
}

.group-health.degraded {
  color: #a16207;
}

.service {
  padding: 22px 24px 20px;
}

.service + .service {
  border-top: 1px solid var(--border);
}

.service-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.service-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.rail {
  height: 44px;
  display: grid;
  grid-template-columns: repeat(90, minmax(2px, 1fr));
  gap: clamp(2px, 0.35vw, 5px);
  border-radius: 3px;
}

.day {
  min-width: 2px;
  border-radius: 2px;
  background: var(--healthy);
  cursor: help;
  transition:
    filter 120ms ease,
    transform 120ms ease;
}

.day:hover {
  z-index: 1;
  filter: saturate(1.12);
  transform: translateY(-2px) scaleY(1.08);
}

.day.degraded,
.legend i.degraded {
  background: var(--degraded);
}

.day.outage,
.legend i.outage {
  background: var(--outage);
}

.day.no-data,
.legend i.no-data {
  background: var(--unknown);
}

.timeline-labels {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}

.rule {
  height: 1px;
  background: var(--border);
}

.uptime {
  color: #334155;
  font-weight: 650;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 8px;
  height: 8px;
  display: block;
  border-radius: 2px;
  background: var(--healthy);
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
}

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(260px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .header-inner,
  main {
    width: min(100% - 24px, 1180px);
  }

  .header-inner {
    min-height: 72px;
  }

  .brand {
    font-size: 20px;
  }

  .brand img {
    width: 40px;
    height: 40px;
  }

  nav a {
    padding: 0 8px;
    font-size: 13px;
  }

  nav a:last-child {
    display: none;
  }

  main {
    padding-top: 32px;
  }

  .page-heading {
    display: block;
  }

  .overall-status {
    margin-top: 18px;
  }

  .group summary {
    padding: 0 16px;
  }

  .service {
    padding: 20px 16px 18px;
  }

  .rail {
    grid-template-columns: repeat(90, minmax(1px, 1fr));
    height: 36px;
    gap: 1px;
  }

  .day {
    min-width: 1px;
  }

  .timeline-labels {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .timeline-labels .rule {
    display: none;
  }

  .uptime {
    text-align: center;
    white-space: normal;
  }

  .page-footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .day,
  .group-title::before {
    transition: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #080d16;
    --surface: #0f172a;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #273449;
    --unknown: #334155;
    --healthy-text: #4ade80;
    --shadow: none;
  }

  .site-header {
    background: rgba(15, 23, 42, 0.94);
  }

  nav a:hover {
    background: #1e293b;
  }

  .uptime {
    color: #cbd5e1;
  }
}
