*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-light: #f5f5f4;
  --text-primary: #0c0a09;
  --text-secondary: #57534e;
  --text-tertiary: #a8a29e;
  --radius: 12px;
  --radius-sm: 8px;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
}

body {
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
}

.brand {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.header-meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-family: "DM Mono", monospace;
}

/* Status Banner */
.status-banner {
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  border: 1px solid;
}

.status-banner .status-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.875rem;
}

.status-banner h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.status-banner .status-sub {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* Services */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.overall-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.overall-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.services-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.service {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
}

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

.service-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.service-row:hover { background: #fafaf9; }

/* Chevron */
.chevron {
  display: flex;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.expand-toggle:checked ~ .service-row .chevron {
  transform: rotate(90deg);
}

/* Expandable detail panel */
.service-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.25rem;
}

.expand-toggle:checked ~ .service-detail {
  max-height: 600px;
  padding: 0 1.25rem 1rem;
}

/* Uptime range sections inside expanded panel */
.uptime-range {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-light);
}

.uptime-range:first-child { border-top: none; }

.uptime-range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.uptime-range-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Sparkline (today's latency chart, always visible) */
.sparkline-container {
  padding: 0.25rem 1.25rem 0.75rem;
}

.sparkline-svg {
  width: 100%;
  height: 48px;
  display: block;
  overflow: visible;
}

.sparkline-hover {
  cursor: crosshair;
}

.sparkline-hover:hover + .sparkline-hover,
.sparkline-hover:hover {
  fill: var(--text-tertiary);
  fill-opacity: 0.3;
}

.sparkline-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.sparkline-avg {
  font-family: "DM Mono", monospace;
  font-weight: 500;
  color: var(--text-secondary);
}

.service-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.service-dot.operational::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.2; transform: scale(1); }
}

.service-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.service-name {
  font-size: 0.9375rem;
  font-weight: 500;
}

.service-url {
  font-family: "DM Mono", monospace;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.service-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.service-response {
  font-family: "DM Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.service-status-label {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Uptime Bars */
.uptime-section {
  margin-top: 0.75rem;
}

.uptime-bars {
  display: flex;
  gap: 1.5px;
  height: 28px;
  align-items: stretch;
}

.uptime-bar {
  flex: 1;
  border-radius: 2px;
  min-width: 2px;
  transition: opacity 0.15s ease;
  cursor: default;
}

.uptime-bar:hover { opacity: 0.7; }

.uptime-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.uptime-percent {
  font-family: "DM Mono", monospace;
  font-weight: 500;
}

.uptime-percent.good { color: var(--green); }
.uptime-percent.warn { color: var(--yellow); }
.uptime-percent.bad { color: var(--red); }

/* Incidents */
.incidents-section { margin-bottom: 2.5rem; }

.incident {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.incident-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.incident-title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.incident-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid;
  flex-shrink: 0;
}

.incident-body { padding: 0 1.25rem 1rem; }

.incident-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.incident-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

.incident-status-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: #f5f5f4;
  color: var(--text-secondary);
}

.incident-updates { border-top: 1px solid var(--border-light); }

.incident-update {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 0.75rem;
}

.incident-update:last-child { border-bottom: none; }

.update-timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.125rem;
}

.update-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.update-dot.resolved { background: var(--green); }
.update-dot.identified { background: var(--yellow); }
.update-dot.investigating { background: var(--orange); }
.update-dot.monitoring { background: #60a5fa; }

.update-line {
  width: 1px;
  flex: 1;
  background: var(--border-light);
  margin: 4px 0;
}

.update-content { flex: 1; min-width: 0; }

.update-status {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 0.125rem;
}

.update-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.update-time {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* Empty state */
.empty-services {
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Footer */
footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border-light);
}

.footer-text {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.footer-text a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.footer-text a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 600px) {
  .page { padding: 0 1rem; }
  .status-banner { padding: 1.5rem 1rem; }
  .status-banner h2 { font-size: 1.125rem; }
  .service { padding: 0.875rem 1rem; }
  .uptime-bars { height: 22px; }
  .service-response { display: none; }
  .incident-header { flex-direction: column; gap: 0.5rem; }
}
