:root {
  color-scheme: light;
  font-family: Geist, Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #232720;
  background: #f8f7f3;
  --paper: #fffefa;
  --line: #e7e3da;
  --line-strong: #d8d3c8;
  --muted: #62665e;
  --subtle: #f7f5ee;
  --hover: #f8f6f0;
  --brand: #8b5037;
  --focus: #236c58;
  --green: #228e70;
  --amber: #c68a1a;
  --red: #ca554e;
  --gray: #e0ddd4;
  --healthy-text: #256451;
  --slow-text: #7c5215;
  --error-text: #9d3934;
  --radius: 14px;
  --inset: clamp(13px, 3.1vw, 22px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 16px; font-weight: 680; }
h3 { font-size: 14px; font-weight: 630; }
button { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page { width: min(calc(100% - 40px), 784px); margin-inline: auto; }
.masthead {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wordmark { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-name { font-size: 22px; font-weight: 720; letter-spacing: -.035em; white-space: nowrap; }
.brand-name b { color: var(--brand); }
.brand-label {
  padding-inline-start: 13px;
  border-inline-start: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.quiet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-inline: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
}

.preview-note {
  margin: -7px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.incident-panel, .system-panel, .history-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.incident-panel { border-color: #e8d7ad; }
.incident-heading {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 11px var(--inset);
  border-block-end: 1px solid #eee1c4;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  color: #634312;
  background: #fbf0d9;
}
.state-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8d5d12;
  color: #fffdfa;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.event-summary, .calculation summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.event-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  align-items: center;
  padding: 14px var(--inset) 15px;
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
}
.event-summary:focus-visible { outline-offset: -3px; }
details[open] > .event-summary { border-radius: 0; }
.event-title { display: block; font-size: 15px; font-weight: 660; line-height: 1.45; }
.event-description {
  display: block;
  margin-top: 4px;
  color: #50564d;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.event-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 11px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.event-description + .event-meta, .event-title + .event-meta { margin-top: 8px; }
.event-update {
  padding: 11px var(--inset) 14px;
  border-block-start: 1px solid var(--line);
  color: #50564d;
  font-size: 14px;
}
.event-provider { color: var(--slow-text); font-weight: 650; }
.chevron {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  margin-inline: 3px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
details[open] > summary .chevron, button[aria-expanded="true"] .chevron { transform: rotate(45deg); }

[data-state="healthy"] { --status: var(--green); --state-text: var(--healthy-text); }
[data-state="slow"], [data-state="partial-slow"], [data-state="partial-error"] {
  --status: var(--amber);
  --state-text: var(--slow-text);
}
[data-state="error"] { --status: var(--red); --state-text: var(--error-text); }
[data-state="empty"] { --status: var(--gray); --state-text: var(--muted); }
.phase, .probe-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--state-text);
  font-weight: 620;
}
.phase::before, .legend-dot, .status-dot {
  content: "";
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status);
}
.legend-dot { border-radius: 2px; }
.status-dot[data-state="empty"], .legend-dot[data-state="empty"] { box-shadow: inset 0 0 0 1px #b8b3a9; }

.system-panel { margin-top: 22px; }
.system-heading, .system-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px 12px;
  padding-inline: var(--inset);
}
.system-heading { padding-block: 10px; border-block-end: 1px solid var(--line); }
.window-control {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f2efe7;
}
.window-control button {
  min-width: 47px;
  min-height: 32px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}
.window-control button[aria-pressed="true"] {
  border-color: var(--line-strong);
  background: var(--paper);
  color: #282a25;
  font-weight: 670;
  box-shadow: 0 1px 1px #3e372112;
}
.provider + .provider { border-block-start: 1px solid var(--line); }
.provider-main { padding: 12px var(--inset) 8px; }
.provider-header, .group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 12px;
  margin-bottom: 8px;
}
.provider-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 31px;
  max-width: 100%;
  margin-inline-start: -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: start;
}
.provider-identity { display: inline-flex; align-items: center; gap: 6px; }
.provider-name strong { font-size: 16px; font-weight: 660; }
.group-count, .rate-label { color: var(--muted); font-size: 12px; }
.provider-meta { margin-top: -2px; padding-inline-start: 15px; line-height: 1.4; }
.provider-meta .probe-state, .group-title .probe-state { font-size: 12px; }
.provider-meta .probe-state .status-dot, .group-title .probe-state .status-dot { display: none; }
.rate { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-actions {
  display: grid;
  justify-items: end;
  gap: 2px;
}
.provider-header .chart-actions { padding-block-start: 2px; }
.rate b { font-size: 15px; font-weight: 670; }
.timeline { display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: clamp(1px, .19vw, 2.5px); }
.cell {
  display: block;
  width: 100%;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 2.5px;
  background: var(--status);
}
.cell[data-state="empty"] { background: #efede6; box-shadow: inset 0 0 0 1px #dfdcd1; }
.cell:focus-visible, .cell.is-previewed { position: relative; z-index: 1; outline: 1px solid #3c4139; outline-offset: 2px; }
.axis {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-block-start: 4px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.history-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 27px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: #505b52;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
}
.history-icon {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.history-icon::after {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 4px;
  width: 3px;
  height: 4px;
  border-inline-start: 1px solid currentColor;
  border-block-end: 1px solid currentColor;
  content: "";
}
.child-groups {
  padding: 0 var(--inset) 3px calc(var(--inset) + 13px);
  border-block-start: 1px solid var(--line);
  background: #faf8f3;
}
.group { padding-block: 12px 6px; }
.group + .group { border-block-start: 1px solid var(--line); }
.group-header { margin-bottom: 7px; }
.group-title { display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 0 8px; }
.group-title > .status-dot { grid-row: 1; margin-top: .46em; }
.group-title h3 { grid-column: 2; overflow-wrap: anywhere; }
.group-title > .probe-state { grid-column: 2; }
.group .rate b { font-size: 14px; }
.group .cell { height: 14px; }

.system-footer { flex-wrap: wrap; border-block-start: 1px solid var(--line); padding-block: 10px; color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 13px; list-style: none; margin: 0; padding: 0; }
.legend li { display: inline-flex; align-items: center; gap: 5px; }
.timezone { white-space: nowrap; }
.monitor-notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 10px;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}
#as-of { padding-block: 6px; font-variant-numeric: tabular-nums; }
.calculation { display: contents; }
.calculation summary { padding: 6px; border-radius: 6px; text-decoration: underline dotted; text-underline-offset: 3px; white-space: nowrap; }
.calculation p {
  grid-column: 1 / -1;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 13px;
}
.history-panel { margin-top: 18px; scroll-margin-top: 16px; }
.history-panel > h2 { padding: 11px var(--inset); border-block-end: 1px solid var(--line); }
.site-footer { display: flex; justify-content: space-between; gap: 6px 12px; padding: 14px 0 24px; color: var(--muted); font-size: 12px; }

.history-popover, .history-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: inherit;
  box-shadow: 0 9px 24px #30291c24, 0 2px 5px #30291c0b;
}
.history-popover {
  position: fixed;
  z-index: 3;
  width: min(362px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  overscroll-behavior: contain;
}
.history-popover:not([hidden]) { animation: appear 125ms ease-out both; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.probe-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
  padding: 10px 14px;
  background: var(--subtle);
  font-size: 14px;
}
.probe-summary > .probe-state { font-weight: 670; }
.probe-available { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.probe-rows { list-style: none; margin: 0; padding: 0 14px; border-block-start: 1px solid var(--line); }
.probe-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 12px;
  padding: 9px 0;
}
.probe-row + .probe-row { border-block-start: 1px solid var(--line); }
.probe-row strong { font-size: 13px; font-weight: 640; overflow-wrap: anywhere; }
.probe-row .probe-state { justify-self: end; font-size: 12px; }
.probe-row small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.probe-time, .empty-probe { padding: 9px 14px; border-block-start: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.probe-time { display: flex; flex-wrap: wrap; gap: 0 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }

.history-dialog {
  width: min(424px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  max-height: min(calc(100% - 24px), calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
}
.history-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
body:has(.history-dialog[open]) { overflow: hidden; }
.history-dialog::backdrop { background: #231f195c; }
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 4px 14px;
  border-block-end: 1px solid var(--line);
}
.dialog-heading h2 { overflow-wrap: anywhere; }
.close-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5148;
  font-size: 23px;
  line-height: 1;
}
#history-dialog-content { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.dialog-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 8px 14px; border-block-start: 1px solid var(--line); }
.dialog-navigation button { min-height: 44px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); font-size: 13px; white-space: nowrap; }
.dialog-navigation button:disabled { border-color: var(--line); color: #77796f; background: #f6f4ee; }
.dialog-position { color: var(--muted); white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }

@media (hover: hover) {
  .quiet-link:hover, .event-summary:hover, .provider-name:hover, .history-button:hover, .calculation summary:hover,
  .close-button:hover, .dialog-navigation button:not(:disabled):hover { background: var(--hover); }
  .window-control button:not([aria-pressed="true"]):hover { color: #282a25; background: #ebe8df; }
}

@media (max-width: 520px) {
  .page { width: calc(100% - 24px); }
  .masthead { min-height: 68px; }
  .wordmark { gap: 8px; }
  .brand-name { font-size: 19px; }
  .brand-label { padding-inline-start: 8px; font-size: 12px; }
  .quiet-link { padding-inline: 8px; font-size: 12px; }
  .system-panel { margin-top: 17px; }
  .window-control button { min-width: 42px; }
  .provider-name {
    display: inline-grid;
    grid-template-areas: "identity disclosure" "count count";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 7px;
    padding-block: 3px;
  }
  .provider-identity { grid-area: identity; }
  .provider-name .chevron { grid-area: disclosure; }
  .provider-name strong { font-size: 15px; }
  .provider-name .group-count { grid-area: count; padding-inline-start: 13px; }
  .provider-meta { margin-top: 0; padding-inline-start: 13px; }
  .group-count, .rate-label { font-size: 11px; }
  .rate { gap: 3px; }
  .provider-main { padding-block: 10px 9px; }
  .timeline { gap: 1px; }
  .cell { height: 18px; border-radius: 2px; }
  .group .cell { height: 14px; }
  .history-button { min-height: 37px; padding-inline: 7px; }
  .system-footer { column-gap: 8px; }
  .legend { column-gap: 8px; }
  .probe-time { font-size: 11px; }
  .child-groups { padding-inline-start: calc(var(--inset) + 5px); }
  .history-dialog .probe-row { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .history-dialog .probe-row .probe-state { justify-self: start; white-space: nowrap; }
  .history-dialog .probe-row small { text-align: start; }
}
@media (pointer: coarse) {
  .quiet-link, .window-control button, .provider-name, .history-button, .calculation summary { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.status-notice { padding: 14px var(--inset); color: var(--muted); font-size: 14px; }
.incident-heading[data-health="healthy"] { color: #256451; background: #edf7f1; border-color: #dfeee5; }
.incident-heading[data-health="healthy"] .state-icon { background: #256451; }
.incident-heading[data-health="error"] { color: #9d3934; background: #fbece9; border-color: #f1ded9; }
.incident-heading[data-health="error"] .state-icon { background: #9d3934; }
.incident-heading[data-health="empty"] { color: #52574f; background: #f4f2ec; border-color: var(--line); }
.incident-heading[data-health="empty"] .state-icon { background: #666b63; }
.incident-panel:has([data-health]) { border-color: var(--line); }

[data-state="configuration-error"] { --status: #8d6bb1; --state-text: #6d488f; }
.cell[data-state="configuration-error"] { background: repeating-linear-gradient(135deg, #8d6bb1 0 3px, #b6a1cc 3px 5px); }
.model { padding-block: 10px; }
.model + .model { border-block-start: 1px solid var(--line); }
.model-header { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; }
.model-header h4 { margin: 0; min-width: 0; flex: 1; }
.model-name { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; min-height: 36px; max-width: 100%; padding: 3px 5px; margin-inline-start: -5px; border: 0; border-radius: 6px; background: transparent; text-align: start; }
.model-name > span:not(.chevron):not(.status-dot) { overflow-wrap: anywhere; }
.model-status { flex: none; font-size: 12px; }
.model-overview { display: flex; align-items: center; flex: none; gap: 8px; }
.model-kind { font-size: 10px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); font-weight: 500; }
.model-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding-top: 7px; }
.model-groups .group { min-width: 0; padding: 11px 10px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.model-groups .group + .group { border-block-start: 1px solid var(--line); }
.model-groups .group-header { display: block; margin: 0 0 6px; }
.group-title h5 { grid-column: 2; margin: 0; font-size: 13px; font-weight: 630; overflow-wrap: anywhere; }
.model-groups .chart-actions { justify-items: start; gap: 4px; margin-bottom: 10px; }
.latency { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.model-groups .timeline { gap: 1px; }
.model-groups .cell { min-width: 0; height: 15px; border-radius: 1px; }
.model-groups .axis { font-size: 10px; }
@media (hover: hover) { .model-name:hover { background: var(--hover); } }
@media (max-width: 620px) {
  .model-groups { grid-template-columns: 1fr; }
  .model-groups .chart-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 9px; }
  .model-status { display: none; }
  .model-header { align-items: start; }
  .model-overview .rate b { font-size: 13px; }
}
@media (pointer: coarse) { .model-name { min-height: 44px; } }

.model-detail { padding-top: 6px; }
.model-history { padding: 1px 0 3px; }
.model-history .cell { height: 14px; }
.model-groups .chart-actions { margin-bottom: 0; }
[data-state="stale"].status-dot { background: var(--line-strong); }
