:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c1e21;
  --muted: #666b75;
  --border: #e2e5ea;
  --row-hover: #f3f5f8;
  --accent: #364fc7;
  --accent-soft: #edf2ff;
  --ph: #5f3dc4;
  --ph-bg: #f3f0ff;
  --code-bg: #f1f3f5;
  --warn: #c2410c;
  --warn-bg: #fff4e6;
  --warn-border: #ffd8a8;
  --ok: #2b8a3e;
  --bar: #4c6ef5;
  --zero: #dee2e6;
  --new: #2b8a3e;
  --reappeared: #7048e8;
  --rising: #e8590c;
  --ongoing: #1971c2;
  --intermittent: #868e96;
  --quiet: #adb5bd;
  --regressed: #c92a2a;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s-other: #a3a9b3;
  --s-new: #2b8a3e;
  --avg: #1c1e21;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --panel: #1a1c20;
    --text: #e4e6eb;
    --muted: #9aa0ab;
    --border: #2d3037;
    --row-hover: #20232a;
    --accent: #91a7ff;
    --accent-soft: #1f2540;
    --ph: #b197fc;
    --ph-bg: #2a2140;
    --code-bg: #22252b;
    --warn: #ffa94d;
    --warn-bg: #2b1f12;
    --warn-border: #5c3b17;
    --ok: #69db7c;
    --bar: #6c87f5;
    --zero: #343a40;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s-other: #5c636e;
    --s-new: #40a95a;
    --avg: #e4e6eb;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--code-bg); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }

h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); padding: 5px 10px; border-radius: 6px; }
.nav a:hover { color: var(--text); background: var(--row-hover); text-decoration: none; }
.nav a[aria-current] { color: var(--text); background: var(--accent-soft); font-weight: 550; }
.quick-search { flex: 1; max-width: 360px; margin-left: auto; }
.quick-search input { width: 100%; }
.mcp-links { display: flex; gap: 14px; white-space: nowrap; font-size: 13px; }
.mcp-links a { color: var(--muted); }
.mcp-links a:hover { color: var(--text); }
.names { display: flex; }
.names button.icon { display: flex; background: none; border: 0; color: var(--muted); padding: 4px; }
.names button.icon:hover, .names button.icon[aria-pressed=true] { color: var(--text); }
.hide-names .private { filter: blur(6px); }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; padding-left: 14px; border-left: 1px solid var(--border); }

input, select, button {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .button {
  display: inline-block;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 550;
  cursor: pointer;
  border-radius: 6px;
  padding: 5px 12px;
}
.button { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.button:hover { background: var(--row-hover); text-decoration: none; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 400; }
button.link:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { button:not(.link) { color: #121316; } }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.head h1 a { color: inherit; }
.sub { font-weight: 400; color: var(--muted); font-size: 16px; }
.actions { display: flex; gap: 8px; }
.lede { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.none { color: var(--muted); font-style: italic; margin: 4px 0 8px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--panel); }
.seg a { padding: 5px 12px; color: var(--muted); border-left: 1px solid var(--border); }
.seg a:first-child { border-left: 0; }
.seg a:hover { color: var(--text); text-decoration: none; background: var(--row-hover); }
.seg a[aria-current] { background: var(--accent-soft); color: var(--text); font-weight: 550; }

.notice { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.warn-text { color: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--text);
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip:hover { text-decoration: none; border-color: var(--c); }
.chip b { font-variant-numeric: tabular-nums; }
.chip.empty { color: var(--muted); }
.new { --c: var(--new); }
.reappeared { --c: var(--reappeared); }
.rising { --c: var(--rising); }
.ongoing { --c: var(--ongoing); }
.intermittent { --c: var(--intermittent); }
.quiet { --c: var(--quiet); }
.regressed { --c: var(--regressed); }
.resolved { --c: var(--ok); }
.fix-badge { display: inline-block; font-size: 11.5px; font-weight: 550; padding: 0 6px; border-radius: 4px; background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.fix-badge.fix-regressed { background: var(--regressed); color: #fff; }
.fix-badge.fix-resolved, .fix-badge.fix-deployed { color: var(--ok); }
.fix-badge.fix-rolling_out { color: var(--ongoing); }
h2 .fix-badge { vertical-align: 2px; margin-left: 6px; }
section.fix { border-left: 3px solid var(--ongoing); scroll-margin-top: 72px; }
section.fix.fix-regressed { border-left-color: var(--regressed); }
section.fix.fix-resolved, section.fix.fix-deployed { border-left-color: var(--ok); }
section.fix p { margin: 4px 0 8px; }

.bucket { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: 8px; margin-bottom: 12px; }
.bucket > summary { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.bucket > summary::-webkit-details-marker { display: none; }
.bucket > summary::before { content: "▸"; color: var(--muted); width: 10px; }
.bucket[open] > summary::before { content: "▾"; }
.bucket > summary h2 { margin: 0; }
.bucket .count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.bucket .hint { color: var(--muted); font-size: 12.5px; }
.bucket > .scroll, .bucket > p { margin: 0 14px 12px; }
.after { color: var(--muted); }
.after p { margin: 4px 0; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
th a.sort { color: inherit; }
th a.sort:hover { color: var(--text); text-decoration: none; }
th[aria-sort] a.sort { color: var(--text); }
th[aria-sort=ascending] a.sort::after { content: " ↑"; }
th[aria-sort=descending] a.sort::after { content: " ↓"; }
th.num[aria-sort=ascending] a.sort::after, th.num[aria-sort=descending] a.sort::after { content: none; }
th.num[aria-sort=ascending] a.sort::before { content: "↑ "; }
th.num[aria-sort=descending] a.sort::before { content: "↓ "; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.id { white-space: nowrap; font-weight: 550; font-variant-numeric: tabular-nums; }
.when { white-space: nowrap; color: var(--muted); }
.nowrap { white-space: nowrap; }
.mutes .target { min-width: 220px; max-width: 320px; overflow-wrap: anywhere; }
.mutes .text { min-width: 220px; overflow-wrap: anywhere; }
.msg { width: 100%; min-width: 280px; }
.tmpl {
  color: var(--text);
  font-family: var(--mono); font-size: 12.5px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3;
  overflow: hidden; overflow-wrap: anywhere;
}
.msg:not(:has(.tmpl)) { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.companions { font-size: 12px; margin-top: 2px; color: var(--muted); }
.stores { font-size: 12.5px; min-width: 160px; }
.stores .n, .n { color: var(--muted); margin: 0 4px 0 3px; font-variant-numeric: tabular-nums; }
.ph { color: var(--ph); background: var(--ph-bg); border-radius: 3px; padding: 0 2px; }

.issues, .mutes { background: var(--panel); }
main > .scroll > table, main > .scroll > .mutes { border: 1px solid var(--border); border-radius: 8px; border-collapse: separate; border-spacing: 0; }
.bucket table { background: transparent; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; margin: 12px 0 16px; }
.filters label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
.filters label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; padding-bottom: 6px; }
.filters .grow { flex: 1; min-width: 240px; }

.badge { font-size: 11px; font-weight: 650; letter-spacing: 0.04em; color: #fff; background: #e03131; border-radius: 4px; padding: 2px 6px; vertical-align: middle; }
.logger { color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.template { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; }
.stack { background: var(--code-bg); border-radius: 8px; padding: 12px 14px; max-height: 420px; overflow: auto; white-space: pre; }

.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 16px 0; }
.facts div { display: flex; flex-direction: column; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font-weight: 550; }
.facts dd .muted { font-weight: 400; }

.chart { margin: 0 0 24px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px 14px 8px; }
.chart svg { display: block; width: 100%; height: 96px; }
.chart.tall svg { height: 160px; }
section > .chart { border: 0; padding: 0; margin: 0 0 10px; background: none; }
.chart .bar, .chart .s-known { fill: var(--bar); }
.chart .s1 { fill: var(--s1); }
.chart .s2 { fill: var(--s2); }
.chart .s3 { fill: var(--s3); }
.chart .s4 { fill: var(--s4); }
.chart .s5 { fill: var(--s5); }
.chart .s-other { fill: var(--s-other); }
.chart .s-new { fill: var(--s-new); }
.chart .today { opacity: 0.5; }
.chart .zero { fill: var(--zero); }
.chart .hatch { fill: var(--zero); }
.chart .avg { fill: none; stroke: var(--avg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0.8; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--text); fill-opacity: 0.07; }
.chart .build-line { stroke: var(--rising); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.quiet-badge { background: var(--quiet); color: #fff; text-transform: uppercase; }
.deploy-new { color: var(--rising); font-weight: 550; }
.build-chip a, .build-chip span { font-size: 12.5px; }
.chart figcaption { display: flex; justify-content: space-between; gap: 2px 12px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.chart figcaption span:first-child, .chart figcaption span:last-child { white-space: nowrap; }
.chart figcaption span:nth-child(2) { text-align: center; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.legend li { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.legend .key { flex: none; width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.legend .key.s1 { background: var(--s1); }
.legend .key.s2 { background: var(--s2); }
.legend .key.s3 { background: var(--s3); }
.legend .key.s4 { background: var(--s4); }
.legend .key.s5 { background: var(--s5); }
.legend .key.s-other { background: var(--s-other); }
.legend .key.s-known { background: var(--bar); }
.legend .key.s-new { background: var(--s-new); }
.legend .key.line { height: 2px; border-radius: 1px; background: var(--avg); }
.legend .key.hatch { background: repeating-linear-gradient(45deg, var(--zero) 0 2px, transparent 2px 5px); border: 1px solid var(--zero); }
.legend .id { min-width: 56px; }
.legend .ltext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .n { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 24px; font-weight: 600; line-height: 1.3; }
.tile-delta { font-size: 12.5px; color: var(--muted); }
.tile-delta.up { color: var(--warn); }
.tile-delta.down { color: var(--ok); }
.trend-table td, .trend-table th { padding-left: 8px; padding-right: 8px; }

section { margin: 0 0 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 24px; }
.ok-text { color: var(--ok); }
.stores-builds th:first-child { padding-left: 0; }
.grid section, main > section { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.compact td { padding: 6px 8px; }
.compact td:first-child { padding-left: 0; }
.compact td:last-child { padding-right: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }

.connect { scroll-margin-top: 72px; }
.connect:target { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.connect p { margin: 0 0 10px; max-width: 72ch; }
.endpoint { display: flex; gap: 10px; align-items: baseline; margin: 0 0 10px; }
.endpoint dt { color: var(--muted); font-size: 12px; }
.endpoint dd { margin: 0; }
.command { background: var(--code-bg); border-radius: 8px; padding: 12px 14px; -webkit-user-select: all; user-select: all; }

.form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px; }
.form > label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
.form textarea, .form input:not([type=radio]), .form select { font-weight: 400; }
.form select { align-self: flex-start; }
.form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.form legend { font-weight: 550; font-size: 13px; margin-bottom: 6px; }
.choice { display: grid; grid-template-columns: auto 200px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13.5px; }
.target-preview { margin: -2px 0 4px 26px; padding: 8px 10px; background: var(--code-bg); border-radius: 6px; font-size: 12.5px; }
.target-preview pre { font-size: 12.5px; }
.help { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.form-actions { display: flex; align-items: center; gap: 14px; }
textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; resize: vertical; }
button.secondary { background: var(--panel); color: var(--text); border-color: var(--border); font-weight: 450; padding: 3px 10px; }
button.secondary:hover { background: var(--row-hover); }
@media (prefers-color-scheme: dark) { button.secondary { color: var(--text); } }
.edit { margin-top: 4px; font-size: 12.5px; }
.edit summary { color: var(--accent); cursor: pointer; }
.edit form { display: flex; gap: 6px; margin-top: 6px; }
.edit input { flex: 1; min-width: 160px; }
.quiet-link { color: var(--muted); margin-left: 6px; }
tr:target td { background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.events li:last-child { border-bottom: 0; }
main > .events { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 14px; }
.event-meta { font-size: 12.5px; color: var(--text); margin-bottom: 4px; overflow-wrap: anywhere; }
.message { font-size: 12.5px; color: var(--text); max-height: 12em; overflow: auto; }

.foot { max-width: 1240px; margin: 0 auto; padding: 8px 24px 32px; color: var(--muted); font-size: 12.5px; }
.ok-dot, .warn-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 4px; vertical-align: 1px; }
.warn-dot { background: var(--warn); }

.live {
  position: fixed; right: 20px; bottom: 20px; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 10px 12px 10px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
}
.live[hidden] { display: none; }
.live #live-close { font-size: 18px; line-height: 1; color: var(--muted); padding: 0 2px; }
@media (max-width: 760px) { .live { left: 16px; right: 16px; bottom: 16px; } }

.error-page { max-width: 560px; margin: 48px auto; text-align: center; }
.error-page p { color: var(--muted); }

body.bare { display: grid; min-height: 100vh; place-items: center; }
body.bare main { width: 100%; max-width: 380px; padding: 16px; }
.login { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.login h1 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.login > p { margin: 8px 0 18px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
.login input { padding: 8px 10px; }
.login button { padding: 8px 12px; margin-top: 4px; }

@media (max-width: 1020px) {
  .top { flex-wrap: wrap; gap: 8px 16px; }
  .quick-search { order: 3; max-width: none; flex-basis: 100%; }
  .mcp-links { margin-left: auto; }
}

@media (max-width: 760px) {
  .top { gap: 8px 12px; padding: 10px 16px; }
  .mcp-links { order: 4; margin-left: 0; gap: 12px; }
  .user { order: 5; margin-left: auto; gap: 8px; padding-left: 0; border-left: 0; font-size: 13px; }
  main { padding: 16px; }
  .hide-sm { display: none; }
  .msg { min-width: 200px; }
  .grid { grid-template-columns: 1fr; }
  .chart figcaption { flex-wrap: wrap; }
  .chart figcaption span:nth-child(2) { order: 3; flex-basis: 100%; }
  .choice { grid-template-columns: auto 1fr; }
  .choice input:not([type=radio]) { grid-column: 2; }
  .foot { padding: 8px 16px 24px; }
}
