:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #111827;
  --muted: #667085;
  --line: #d9e1ea;
  --line-strong: #b8c4d1;
  --ok: #148556;
  --ok-bg: #e7f6ee;
  --warn: #a15c07;
  --warn-bg: #fff1d6;
  --bad: #b42318;
  --bad-bg: #fde8e4;
  --unknown: #667085;
  --unknown-bg: #eceff3;
  --focus: #1f6feb;
  --hero: #17202a;
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.status-hero {
  min-height: 238px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: end;
  padding: 42px;
  color: #fff;
  background: var(--hero);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(22, 34, 48, 0.16);
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}

.summary {
  max-width: 650px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.7;
}

.status-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.status-panel strong {
  font-size: 18px;
}

.status-panel span:last-child {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--unknown);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.status-operational {
  background: var(--ok);
}

.status-degraded {
  background: var(--warn);
}

.status-failed,
.status-error {
  background: var(--bad);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 24px 0 16px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 58px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: #fff;
  background: var(--focus);
}

.refresh-note {
  color: var(--muted);
  font-size: 14px;
}

.notice {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #f3c56d;
  border-radius: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.monitor-card,
.empty,
.explain {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.monitor-card {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card-head h2,
.empty h2,
.explain h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.model {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  word-break: break-word;
}

.badge {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 6px 10px;
  text-align: center;
  border-radius: 999px;
  font-size: 13px;
  background: var(--unknown-bg);
  color: var(--unknown);
  border: 1px solid transparent;
}

.badge.operational {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.degraded {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.failed,
.badge.error {
  background: var(--bad-bg);
  color: var(--bad);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metrics div {
  min-width: 0;
}

.metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.metrics dd {
  margin: 5px 0 0;
  font-weight: 700;
  word-break: break-word;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(24, minmax(4px, 1fr));
  gap: 3px;
  min-height: 30px;
  align-items: stretch;
  margin: 14px 0;
}

.bar {
  min-height: 30px;
  border-radius: 3px;
  background: var(--unknown-bg);
}

.bar.operational {
  background: var(--ok);
}

.bar.degraded {
  background: #d89614;
}

.bar.failed,
.bar.error {
  background: var(--bad);
}

.detail-toggle {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.detail-toggle:hover {
  background: var(--surface-soft);
}

.detail-toggle:focus-visible,
.segmented button:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.24);
  outline-offset: 2px;
}

.model-detail {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  overflow-x: auto;
}

.detail-state {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.error-text {
  color: var(--bad);
}

.model-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.model-detail th,
.model-detail td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.model-detail th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.empty,
.explain {
  margin-top: 16px;
  padding: 22px;
}

.empty p,
.explain p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 12px;
  }

  .status-hero {
    grid-template-columns: 1fr;
    padding: 28px 22px;
  }

  h1 {
    font-size: 34px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
