:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --border: #dde3ee;
  --border-strong: #cfd7e4;
  --text: #1d2733;
  --muted: #667487;
  --muted-strong: #465162;
  --good: #23c19e;
  --warn: #f5b83d;
  --bad: #ef6d5f;
  --critical: #ef5d5d;
  --local: #23262d;
  --unknown: #c2c8d3;
  --banner-good: #dff6ef;
  --banner-warn: #fff2d9;
  --banner-bad: #ffe3df;
  --banner-unknown: #eef1f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(35, 193, 158, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(245, 184, 61, 0.08), transparent 22%),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 100%);
}

button,
summary {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

.page {
  width: min(860px, calc(100% - 20px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 12px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.header-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.updated-at {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted-strong);
  box-shadow: 0 8px 22px rgba(20, 30, 50, 0.04);
}

.updated-at {
  font-size: 12px;
}

.banner,
.card,
.detail-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(34, 52, 80, 0.06);
}

.banner {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.banner-loading {
  background: var(--banner-unknown);
}

.banner-operational {
  background: var(--banner-good);
}

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

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

.banner-unknown {
  background: var(--banner-unknown);
}

.banner-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--border);
}

.status-operational {
  color: var(--good);
}

.status-degraded {
  color: #d99212;
}

.status-major {
  color: var(--critical);
}

.status-local {
  color: #111318;
}

.status-unknown {
  color: var(--unknown);
}

.banner-copy h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.1;
}

.banner-copy p {
  margin: 0;
  max-width: 75ch;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.card,
.detail-card {
  padding: 12px 14px;
  margin-bottom: 14px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.bucket-range {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.components {
  display: block;
}

.component-group {
  border-top: 1px solid var(--border);
  background: transparent;
  overflow: hidden;
}

.component-group:first-child {
  border-top: 0;
}

.component-group[open] {
  border-color: var(--border-strong);
}

.component-group > summary {
  list-style: none;
}

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

.component-row {
  display: grid;
  gap: 8px;
  align-items: start;
  padding: 10px 2px 12px;
  cursor: pointer;
}

.component-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  gap: 12px;
  align-items: start;
}

.component-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.component-namewrap {
  min-width: 0;
}

.component-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.component-icon.status-operational {
  background: var(--good);
}

.component-icon.status-degraded {
  background: #f0b94b;
}

.component-icon.status-major {
  background: var(--critical);
}

.component-icon.status-local {
  background: #2b2f36;
}

.component-icon.status-unknown {
  background: var(--unknown);
}

.component-name {
  font-size: 13px;
  font-weight: 700;
}

.component-meta {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.component-history {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 0;
  scrollbar-width: thin;
}

.history-block {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--unknown);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0;
}

.history-block.status-operational {
  background: var(--good);
}

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

.history-block.status-major {
  background: var(--critical);
}

.history-block.status-local {
  background: var(--local);
}

.history-block.status-unknown {
  background: var(--unknown);
}

.history-block.is-selected {
  outline: 2px solid rgba(29, 39, 51, 0.35);
  outline-offset: 1px;
}

.history-block.is-empty {
  cursor: default;
  opacity: 0.5;
}

.status-tooltip {
  position: fixed;
  z-index: 1200;
  width: clamp(260px, 32vw, 340px);
  max-width: calc(100vw - 24px);
  padding: 12px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(20, 30, 50, 0.16);
  color: var(--text);
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  pointer-events: none;
}

.status-tooltip.visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.status-tooltip[data-placement="top"] {
  transform: translateY(-2px);
}

.tooltip-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 8px;
}

.tooltip-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tooltip-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tooltip-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.tooltip-icon.status-operational {
  background: var(--good);
}

.tooltip-icon.status-degraded {
  background: #f0b94b;
}

.tooltip-icon.status-major {
  background: var(--critical);
}

.tooltip-icon.status-local {
  background: #2b2f36;
}

.tooltip-icon.status-unknown {
  background: var(--unknown);
}

.tooltip-text {
  min-width: 0;
}

.tooltip-message {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.tooltip-counts {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.tooltip-extra {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.component-summary {
  text-align: right;
}

.component-summary-value {
  font-size: 13px;
  font-weight: 700;
}

.component-summary-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.component-toggle {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  transition: transform 120ms ease;
}

.component-group[open] .component-toggle {
  transform: rotate(180deg);
}

.component-expanded {
  border-top: 1px solid var(--border);
  padding: 10px 2px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.expand-grid,
.detail-grid,
.diagnostic-grid {
  display: grid;
  gap: 10px;
}

.expand-section {
  display: grid;
  gap: 10px;
}

.expand-head h3,
.detail-section-head h3 {
  margin: 0;
  font-size: 13px;
}

.expand-head p,
.detail-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.endpoint-list {
  display: grid;
  gap: 8px;
}

.endpoint-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr);
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.endpoint-left,
.endpoint-right {
  min-width: 0;
}

.endpoint-name {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 12px;
}

.endpoint-url {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.endpoint-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-content: start;
}

.endpoint-ok,
.endpoint-meta,
.endpoint-error {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 11px;
}

.endpoint-ok.is-ok {
  color: var(--good);
}

.endpoint-ok.is-fail {
  color: var(--critical);
}

.endpoint-error {
  width: 100%;
  color: var(--critical);
  white-space: normal;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-tile,
.diagnostic-block,
.detail-tile {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.detail-tile {
  display: grid;
  gap: 6px;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
}

.detail-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-secondary {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.diagnostic-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diagnostic-block strong,
.mini-tile strong,
.detail-tile strong {
  font-size: 14px;
  line-height: 1.35;
}

.diagnostic-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.dns-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.dns-list li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.dns-list strong {
  font-size: 12px;
}

.dns-list span {
  color: var(--muted);
  font-size: 11px;
}

.events {
  display: grid;
  gap: 6px;
}

.footer {
  margin-top: 8px;
  padding: 8px 4px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--muted-strong);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover,
.footer a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

.event-item {
  display: grid;
  grid-template-columns: 140px 150px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.event-item:hover,
.history-block:hover,
.history-block:focus-visible,
.component-group > summary:hover {
  background-color: rgba(35, 193, 158, 0.05);
}

.event-status {
  font-weight: 700;
  font-size: 12px;
}

.event-time {
  color: var(--muted);
  font-size: 11px;
}

.event-summary {
  color: var(--muted-strong);
  font-size: 11px;
}

.empty-state {
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.empty-state.small {
  padding: 10px 10px;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.detail-card {
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

.cycle-panel[hidden] {
  display: none;
}

.collapsible {
  padding-top: 0;
}

.collapsible > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 0 0 2px;
}

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

.collapsible > summary h2 {
  margin: 0;
  font-size: 15px;
}

.collapsible > summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.summary-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

@media (max-width: 980px) {
  .header {
    flex-direction: column;
  }

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

  .component-row,
  .event-item,
  .endpoint-row,
  .detail-grid,
  .diagnostic-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .component-row-top {
    grid-template-columns: 1fr auto;
  }

  .header-meta {
    align-items: flex-start;
  }

  .component-row {
    align-items: start;
  }

  .component-summary {
    text-align: left;
  }

  .component-toggle {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .banner,
  .card,
  .detail-card {
    border-radius: 14px;
    padding: 11px 12px;
  }

  .banner-copy h2 {
    font-size: 18px;
  }

  .banner-copy p {
    font-size: 13px;
  }

  .component-row {
    gap: 8px;
  }

  .component-row-top {
    gap: 10px;
  }

  .component-history {
    padding-bottom: 0;
  }

  .event-item {
    gap: 10px;
  }
}
