/* Kantzen semantics, with the same quiet dark palette as private-collections. */
:root.dark {
  color-scheme: dark;
  --kui-surface-canvas: #000;
  --kui-surface-panel: #0b0b0b;
  --kui-surface-hover: #151515;
  --kui-text: #ededed;
  --kui-text-secondary: #b8b8b8;
  --kui-text-muted: #858585;
  --kui-line-soft: #202020;
  --kui-line: #303030;
  --kui-radius: 4px;
  --health: #8fbc98;
  --failure: #e58b8b;
  --warning: #d3ad70;
  --unknown: #4d4d4d;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
/* Only readable content starts a selection; dragging UI surfaces stays inert. */
body { -webkit-user-select: none; user-select: none; }
h1, h2, h3, p, th, td, .section-heading > span, .axis-caption > span,
.legend > span, footer > span, .notice, #day-incidents {
  -webkit-user-select: text;
  user-select: text;
}
button, select, svg, .status-dot, .legend i, .section-number {
  -webkit-user-select: none;
  user-select: none;
}
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; background: var(--kui-surface-canvas); color: var(--kui-text); font-size: 14px; line-height: 1.6; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -1.1px; font-weight: 600; overflow-wrap: anywhere; }
h2 { font-size: 20px; line-height: 1.4; letter-spacing: -.4px; font-weight: 550; }
a { color: inherit; text-decoration: none; }
button, select { min-height: var(--kui-control-height); padding: 0 12px; border: 1px solid var(--kui-line); border-radius: var(--kui-radius); background: transparent; color: var(--kui-text-secondary); font-family: inherit; font-size: 12px; font-weight: 400; line-height: 1.3; cursor: pointer; transition: background 140ms ease, border-color 140ms ease, color 140ms ease; }
button:hover, select:hover { color: var(--kui-text); border-color: #505050; background: var(--kui-surface-hover); }
button:active { background: #202020; }
button:disabled { opacity: .5; cursor: wait; }
select { min-width: 144px; padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23b8b8b8' stroke-width='1.2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
option { color: var(--kui-text); background: var(--kui-surface-panel); }
:focus-visible { outline: 2px solid #aaa; outline-offset: 5px; }
::selection { color: #fff; background: #383838; }
.shell { width: min(960px, calc(100% - 96px)); margin-inline: auto; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 44px; }
.intro h1 { min-width: 0; }
.intro button { min-width: 82px; flex-shrink: 0; }
.status-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 0; }
.status-copy { display: flex; align-items: flex-start; gap: 14px; }
.status-copy h2 { font-size: 15px; letter-spacing: 0; font-weight: 450; }
.status-copy p { margin-top: 5px; color: var(--kui-text-muted); font-size: 12px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 6px; }
.healthy { background: var(--health); }
.error, .unavailable, .configuration_error { background: var(--failure); }
.degraded { background: var(--warning); }
.unknown { background: var(--unknown); }
.status-detail[data-status="degraded"] { color: var(--warning); }
.status-detail[data-status="unknown"] { color: var(--kui-text-secondary); }
.status-detail { color: var(--failure); font-size: 13px; padding-bottom: 22px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 0 40px; }
.metrics > div { padding-right: 22px; }
.metrics > div + div { border-left: 1px solid var(--kui-line-soft); padding-left: 28px; }
.metrics h3 { color: var(--kui-text-secondary); font-size: 12px; font-weight: 400; }
.metrics p { margin-top: 4px; font-size: 28px; letter-spacing: -.7px; font-weight: 450; font-variant-numeric: tabular-nums; line-height: 1.4; }
.numbered-section { position: relative; border-top: 1px solid var(--kui-line-soft); padding: 30px 0 30px 56px; }
.section-number { position: absolute; top: 35px; left: 0; color: var(--kui-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; min-height: 32px; }
.section-heading > span { color: var(--kui-text-muted); font-size: 12px; white-space: nowrap; }
.history { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 9px; }
.history button { min-height: 0; height: 44px; width: 100%; padding: 0; border: none; border-radius: 1px; position: relative; }
.history button:hover { filter: brightness(1.22); }
.history button.partial::after { content: ''; position: absolute; inset: auto 0 0; height: 5px; background: var(--unknown); }
.axis-caption { display: flex; justify-content: space-between; margin-top: 10px; color: var(--kui-text-muted); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 20px; margin-top: 16px; color: var(--kui-text-secondary); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.chart-wrap { position: relative; min-height: 154px; margin-left: -56px; }
.chart-wrap svg { display: block; width: 100%; height: 154px; overflow: visible; }
.chart-wrap svg text { font-family: var(--font); font-size: 11px; fill: var(--kui-text-muted); }
.chart-wrap .grid { stroke: var(--kui-line-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-wrap .chart-line { stroke: var(--health); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--health); }
.chart-guide { stroke: var(--kui-text-muted); stroke-dasharray: 3 3; pointer-events: none; }
.chart-tooltip { position: absolute; top: -28px; z-index: 2; max-width: 100%; padding: 8px 10px; border: 1px solid var(--kui-line); border-radius: 4px; background: var(--kui-surface-panel); color: var(--kui-text); font-size: 11px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; pointer-events: none; font-variant-numeric: tabular-nums; }
.chart-wrap > p { position: absolute; inset: 44px 10px auto 60px; padding: 8px; text-align: center; color: var(--kui-text-muted); background: var(--kui-surface-canvas); font-size: 13px; }
.events-section .section-heading { margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; table-layout: fixed; }
th { color: var(--kui-text-muted); font-weight: 400; padding: 0 18px 12px 0; }
td { border-top: 1px solid var(--kui-line-soft); padding: 15px 18px 15px 0; vertical-align: top; color: var(--kui-text-secondary); overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 1px solid var(--kui-line-soft); }
th:first-child { width: 23%; }
th:nth-child(2) { width: 29%; }
th:last-child, td:last-child { padding-right: 0; }
td:first-child { font-variant-numeric: tabular-nums; }
td:nth-child(2) { color: var(--kui-text); }
.event-date { display: block; color: var(--kui-text-muted); font-size: 10px; margin-top: 3px; }
.empty { padding: 30px 0; text-align: center; color: var(--kui-text-muted); }
.more { display: block; margin: 20px auto 0; }
.notice { margin-top: 26px; padding: 10px 12px; border-left: 2px solid var(--failure); background: var(--kui-surface-panel); color: var(--failure); font-size: 12px; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; border-top: 1px solid var(--kui-line-soft); margin-top: 10px; padding-top: 24px; color: var(--kui-text-muted); font-size: 11px; }
.monitoring-note { margin: 12px 0 40px; color: var(--kui-text-muted); font-size: 11px; }
dialog { width: min(560px, calc(100% - 40px)); max-height: calc(100dvh - 48px); padding: 28px; border: 1px solid var(--kui-line); border-radius: var(--kui-radius); color: var(--kui-text); background: var(--kui-surface-panel); box-shadow: var(--kui-overlay-shadow); }
dialog::backdrop { background: rgb(0 0 0 / .78); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
dialog p, #day-incidents { color: var(--kui-text-secondary); font-size: 13px; line-height: 1.85; }
#day-incidents { margin-top: 20px; }
dialog article { border-top: 1px solid var(--kui-line-soft); padding-top: 18px; margin-top: 18px; }
dialog h3 { font-size: 14px; font-weight: 500; color: var(--kui-text); margin-bottom: 6px; }
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 100; padding: 10px 16px; background: var(--kui-text); color: #000; border-radius: 4px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .shell { width: calc(100% - 48px); }
  .intro { padding-top: 34px; }
  h1 { font-size: 29px; }
  h2 { font-size: 18px; }
  button, select { min-height: 36px; }
  .status-band { align-items: flex-start; flex-direction: column; gap: 12px; padding: 26px 0; }
  .metrics { padding-bottom: 30px; }
  .metrics > div { padding-right: 8px; }
  .metrics > div + div { padding-left: 10px; }
  .metrics h3 { font-size: 11px; }
  .metrics p { font-size: clamp(20px, 5.6vw, 26px); }
  .numbered-section { padding: 24px 0 26px; }
  .section-number { display: none; }
  .section-heading { gap: 12px; margin-bottom: 22px; }
  .section-heading > span { font-size: 10px; }
  .section-heading select { min-width: 124px; font-size: 11px; }
  .history { gap: 4px; }
  .history button { height: 40px; }
  .legend { gap: 16px; }
  .chart-wrap { margin-left: 0; }
  table { font-size: 11px; }
  th, td { padding-right: 12px; }
  th:first-child { width: 25%; }
  th:nth-child(2) { width: 28%; }
  .event-date { font-size: 9px; }
  footer { margin-top: 0; font-size: 10px; }
  .monitoring-note { font-size: 10px; }
  dialog { padding: 20px; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 32px); }
  .latency-section .section-heading { align-items: flex-start; flex-direction: column; }
  .history { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.chart-caption { color: var(--kui-text-muted); font-size: 11px; margin: -12px 0 20px; }
.incident-chart-wrap svg { height: 224px; }
.incident-bar { fill: var(--health); }
.incident-bar.degraded { fill: var(--warning); }
.incident-bar.error { fill: var(--failure); }
.incident-bar.unknown { fill: var(--unknown); }
.incident-bar.selected { stroke: var(--kui-text); stroke-width: 1; }
@media (max-width: 360px) {
  .incident-section .section-heading { align-items: flex-start; flex-direction: column; }
}
