:root {
  color-scheme: light;
  --surface: #fff;
  --canvas: #f6f7fb;
  --ink: #17203a;
  --muted: #555f75;
  --line: #e0e4ee;
  --accent: #4b3ac7;
  --accent-light: #eeebff;
  --alert: #a12c3c;
  --alert-light: #fff0f2;
  --good: #167354;
  font: 100%/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; }
html:has(.challenge-dialog[open]) { overflow: hidden; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
:focus-visible { outline: 3px solid #7863f3; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.shell { width: min(100% - 64px, 1240px); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 66px; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-weight: 750; text-decoration: none; }
.mark { height: 31px; width: 31px; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: end; justify-content: center; gap: 3px; padding-bottom: 8px; }
.mark i { width: 3px; border-radius: 2px; background: white; height: 7px; }
.mark i:nth-child(2) { height: 11px; }
.mark i:nth-child(3) { height: 15px; }
.snapshot { color: var(--muted); font-size: .875rem; text-align: right; }
main { padding-block: 35px 44px; }
.intro h1 { font-size: clamp(1.9rem, 4vw, 2.65rem); letter-spacing: -.055em; line-height: 1.13; }
.intro p { color: var(--muted); margin-top: 8px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-block: 22px 20px; }
label { display: grid; gap: 5px; color: var(--muted); font-weight: 625; font-size: .875rem; }
input, select { min-height: 42px; min-width: 0; border: 1px solid #c9cfdf; border-radius: 8px; padding: 8px 11px; background: var(--surface); color: var(--ink); }
select { min-width: 156px; appearance: none; padding-right: 32px; background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 15px center / 5px 5px no-repeat, linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 10px center / 5px 5px no-repeat, var(--surface); }
.search { min-width: 150px; flex: 1 1 155px; max-width: 260px; }
.primary, .plain { min-height: 42px; border-radius: 8px; padding: 8px 15px; font-size: .875rem; font-weight: 700; }
.primary { color: #fff; border: 1px solid var(--accent); background: var(--accent); }
.primary:hover { background: #3b2baf; }
.plain { border: 1px solid transparent; background: transparent; color: var(--accent); }
.plain:hover { background: var(--accent-light); }
.status { margin-block: 12px; color: var(--muted); }
.status:empty { margin: 0; }
.status.error { color: var(--alert); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 2px 5px #17203a06; min-width: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric { padding: 17px 20px 18px; }
.metric h2 { display: flex; align-items: center; gap: 9px; font-size: .875rem; color: var(--muted); }
.metric-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 7px; background: var(--accent-light); color: var(--accent); font-weight: 800; }
.reliability { background: #e8f3fc; color: #215e94; }
.warning { background: var(--alert-light); color: var(--alert); }
.metric strong { display: block; margin-block: 7px 1px; font-size: clamp(1.8rem, 4vw, 2.25rem); letter-spacing: -.055em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric p, .panel-head p { color: var(--muted); font-size: .875rem; }
.analytics { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; gap: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.panel-head h2 { font-size: 1.1rem; letter-spacing: -.02em; }
.panel-head p { margin-top: 2px; }
.switch { flex-shrink: 0; display: flex; background: var(--canvas); border: 1px solid var(--line); padding: 3px; border-radius: 8px; }
.switch button { border: 0; padding: 5px 9px; border-radius: 5px; font-size: .875rem; color: var(--muted); background: transparent; }
.switch button[aria-pressed="true"] { color: var(--accent); background: white; box-shadow: 0 1px 4px #17203a20; font-weight: 700; }
.chart-wrap { height: 203px; position: relative; margin-inline: 14px 20px; }
canvas { display: block; width: 100%; height: 100%; }
.chart-tip { position: absolute; z-index: 1; pointer-events: none; min-width: 115px; padding: 7px 10px; border-radius: 7px; background: var(--ink); color: #fff; font-size: .8125rem; white-space: pre-line; }
.chart-footer { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .8125rem; margin: 7px 20px 10px; }
.key-line, .key-gap { display: inline-block; vertical-align: middle; width: 15px; height: 3px; margin-right: 4px; border-radius: 2px; background: var(--accent); }
.key-gap { height: 9px; background: #f5dcae; }
.daily-details, .alert-rule { border-top: 1px solid var(--line); padding: 9px 20px 12px; color: var(--muted); font-size: .875rem; }
.daily-details[open] .table-wrap { max-height: 264px; }
.alerts { display: grid; gap: 11px; padding: 0 18px 14px; }
.signal { background: #fff5f5; border: 1px solid #f1dce2; border-left: 3px solid #bf4757; padding: 12px; border-radius: 9px; }
.signal strong { display: block; margin-bottom: 4px; }
.signal p { font-size: .875rem; color: #592d36; }
.signal .impact { margin-block: 6px; }
.signal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 9px; }
.signal-actions .service-link { min-height: 44px; font-size: .875rem; }
.challenge-trigger {
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid #d4ccf9;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: .875rem;
  font-weight: 700;
}
.challenge-trigger:hover { background: var(--accent-light); }
.challenge-dialog {
  width: min(860px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 55px #17203a4d;
}
.challenge-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.challenge-dialog::backdrop { background: #141a34a6; }
.challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
}
.challenge-header h2 { font-size: clamp(1.15rem, 3vw, 1.4rem); letter-spacing: -.03em; overflow-wrap: anywhere; }
.challenge-close { min-height: 44px; }
.challenge-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  padding: 22px;
  overflow: auto;
  overscroll-behavior: contain;
}
.challenge-content:focus-visible { outline-offset: -4px; }
.challenge-verdict {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--muted);
  background: var(--canvas);
  font-size: .875rem;
  font-weight: 750;
}
.challenge-verdict.holds { color: var(--alert); background: var(--alert-light); }
.challenge-verdict.clears { color: var(--good); background: #e9f6ef; }
.challenge-note { margin-top: 9px; color: var(--muted); font-size: .9375rem; }
.challenge-comparisons { display: grid; gap: 8px; margin: 15px 0 0; }
.challenge-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
  color: var(--muted);
  font-size: .875rem;
}
.challenge-result dt { font-weight: 650; }
.challenge-values { margin: 0; }
.challenge-values strong { display: block; color: var(--ink); font-variant-numeric: tabular-nums; }
.challenge-values span { font-size: .8125rem; }
.challenge-evidence table { table-layout: fixed; font-size: .875rem; }
.challenge-evidence caption { padding-bottom: 7px; text-align: left; }
.challenge-evidence caption span { display: block; color: var(--muted); font-size: .8125rem; }
.challenge-evidence th, .challenge-evidence td {
  padding: 5px 7px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.evidence-date, .evidence-count { display: block; }
.evidence-date { font-weight: 650; }
.evidence-count { color: var(--muted); }
.challenge-evidence .removed-day { background: #f7f5ff; }
.service-link { border: 0; padding: 0; background: transparent; color: var(--accent); text-align: left; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.service-link:hover { color: #302099; }
.alert-rule p { margin-top: 7px; }
.count { border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px; font-size: .875rem; color: var(--muted); white-space: nowrap; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 9px 13px; white-space: nowrap; }
thead { background: #f7f8fc; color: var(--muted); }
th:first-child, td:first-child { text-align: left; padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td { border-top: 1px solid var(--line); }
td.empty { text-align: center; padding: 18px; color: var(--muted); }
.bad { color: var(--alert); font-weight: 750; }
.good { color: var(--good); }
.quality { margin-top: 15px; padding: 10px 14px; color: var(--muted); font-size: .875rem; }
.quality p, .quality ul { margin-block: 8px; }
@media (max-width: 850px) {
  .analytics { grid-template-columns: 1fr; }
  .shell { width: calc(100% - 36px); }
}
@media (max-width: 650px) {
  .challenge-content { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 16px; }
  .challenge-header { padding-inline: 16px; }
}
@media (max-width: 520px) {
  main { padding-top: 24px; }
  .topbar-inner { min-height: 60px; }
  .brand { font-size: .875rem; }
  .snapshot { font-size: .75rem; }
  .filters > label { flex: 1 1 calc(50% - 12px); max-width: none; min-width: 0; }
  select { min-width: 0; width: 100%; }
  .metrics { grid-template-columns: 1fr; gap: 8px; }
  .metric { padding: 12px 15px; }
  .panel-head { flex-wrap: wrap; padding-inline: 15px; }
  .chart-wrap { margin-inline: 9px 12px; }
}
