:root {
  color-scheme: light;
  font-family: Inter, "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182136;
  background: #f5f7fb;
  --muted: #52617a;
  --border: #dfe5ef;
  --accent: #5942ce;
  --ok: #12694b;
  --ok-bg: #e6f6ee;
  --down: #9e2840;
  --down-bg: #fcebf0;
  --stale: #80500b;
  --stale-bg: #fff1d9;
  --unknown: #45536b;
  --unknown-bg: #eaf0f7;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 280px; }

h1, h2, h3, p, ol, dl, dd { margin: 0; }

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 3px solid #7865eb; outline-offset: 4px; }

.frame { width: min(1184px, calc(100% - 88px)); margin-inline: auto; }

.topbar { background: #fff; border-bottom: 1px solid var(--border); }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
}

.topbar-start { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; }
.dashboard-nav { display: flex; gap: 5px; }
.dashboard-nav a { padding: 6px 9px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
.dashboard-nav a:hover { background: #f0f1f8; }
.dashboard-nav a[aria-current="page"] { background: #eeebfd; color: #4935ab; }

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -.055em;
}

.brand-accent { color: var(--accent); }

.brand-mark {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 7px 0;
  border-radius: 9px;
  background: #5a43d1;
}

.brand-mark i { width: 4px; border-radius: 2px; background: #fff; }
.brand-mark i:nth-child(1) { height: 7px; opacity: .65; }
.brand-mark i:nth-child(2) { height: 11px; opacity: .8; }
.brand-mark i:nth-child(3) { height: 16px; }

.demo-tag, .status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.3;
}

.demo-tag { color: #694c17; background: #fff3dc; padding: 7px 11px; }
.demo-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.demo-tag[data-source="live"] { color: #1c5865; background: #e3f1f5; }
.source { display: flex; align-items: center; justify-content: flex-end; gap: 7px 11px; flex-wrap: wrap; }
.source time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

main.frame { padding-block: 18px 44px; }

[data-panel] [hidden], [data-panel] .scenario-panel { display: none !important; }
.panel-login { max-width: 420px; margin-top: 38px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.panel-login h1 { font-size: 25px; }
.panel-login form { display: grid; gap: 8px; margin-top: 16px; }
.panel-login label { font-size: 13px; color: var(--muted); }
.panel-login input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; font: inherit; }
#login-status { margin-top: 8px; color: var(--down); font-size: 13px; }
.panel-login button, .panel-refresh button {
  width: fit-content;
  padding: 7px 11px;
  border: 1px solid #d8d0fb;
  border-radius: 7px;
  background: #eeebfd;
  color: #4935ab;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.panel-login button:disabled, .panel-refresh button:disabled { color: var(--muted); cursor: wait; }
.panel-refresh { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px 16px; margin-top: 14px; }
.panel-refresh strong { font-size: 14px; }
#refresh-detail { margin-top: 3px; }

.page-heading, .route-header, .node-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-heading { margin-bottom: 12px; }
.page-heading h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.045em; }
.scenario-panel { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.scenario-panel select {
  font: inherit;
  color: #28354c;
  background: #fff;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.route { border-radius: 16px; background: #1c263d; padding: 15px; color: #fff; }
.route-header h2 { font-size: 17px; letter-spacing: -.02em; }
.route-status { padding: 5px 10px; }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

[data-state="ok"] { --state-color: var(--ok); --state-background: var(--ok-bg); --route-color: #a8ebcd; }
[data-state="down"] { --state-color: var(--down); --state-background: var(--down-bg); --route-color: #ffc0cb; }
[data-state="stale"] { --state-color: var(--stale); --state-background: var(--stale-bg); --route-color: #fcd595; }
[data-state="unknown"] { --state-color: var(--unknown); --state-background: var(--unknown-bg); --route-color: #d8e0f2; }

.status { color: var(--state-color); background: var(--state-background); }
.route-stages, .node-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 23px; }
.route-stages { list-style: none; padding: 0; margin-top: 12px; }
.route-node {
  position: relative;
  min-width: 0;
  padding: 12px;
  border: 1px solid #ffffff29;
  background: #ffffff0d;
  border-radius: 10px;
}
.route-node + .route-node::before {
  content: "→";
  position: absolute;
  left: -18px;
  top: 16px;
  color: #b1bbcf;
  font-size: 14px;
}
.route-node-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.route-node-name { font-size: 17px; }
.route-node-status { color: var(--route-color); font-size: 12px; font-weight: 680; }
.route-node-results { list-style: none; padding: 0; margin: 8px 0 0; }
.route-node-results li {
  border-top: 1px solid #ffffff21;
  padding-block: 5px;
  font-size: 13px;
  line-height: 1.35;
}
.route-node-results strong { font-weight: 630; color: var(--route-color); }
.route-node-results small, .route-note { display: block; margin-top: 2px; color: #cbd5e8; font-size: 11px; line-height: 1.35; }
.route-note { margin-top: 4px; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
h2.section-heading, .section-heading h2 { font-size: 18px; letter-spacing: -.025em; }
.section-heading { margin-block: 15px 8px; }
.section-heading p, .muted { color: var(--muted); font-size: 12px; }
.node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.node-card, .diagnostics { background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.node-card { padding: 11px 14px; }
.node-heading h3 { font-size: 15px; }
.node-heading .status { padding: 4px 8px; font-size: 11px; }
.node-time { margin-top: 4px; }
.node-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.node-metrics > div { padding-top: 7px; border-top: 1px solid #edf0f6; }
.node-metrics dt { color: var(--muted); font-size: 11px; }
.node-metrics dd { margin-top: 3px; font-size: 17px; font-weight: 690; font-variant-numeric: tabular-nums; }
.node-metrics small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.node-metrics small:empty { display: none; }

.diagnostics { margin-top: 13px; }
.diagnostics summary { cursor: pointer; padding: 10px 14px; font-size: 13px; font-weight: 670; }
.diagnostics-content { padding: 0 14px 12px; }
.interface-table { width: 100%; min-width: 860px; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.interface-table th, .interface-table td { padding: 9px 10px; border-top: 1px solid #edf0f6; vertical-align: top; text-align: left; }
.interface-table thead th { background: #fafbfe; font-size: 12px; }
.interface-table td { font-variant-numeric: tabular-nums; }
.interface-table small { display: block; margin-top: 3px; font-weight: normal; font-size: 11px; color: var(--muted); }
.sources { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin-top: 12px; font-size: 12px; }
.sources dt { font-weight: 670; }
.sources dd { color: var(--muted); }
.notice { margin-bottom: 15px; color: var(--down); }

.peer-panel { border: 1px solid var(--border); border-radius: 15px; background: #fff; }
.peer-summary { padding: 13px 17px; color: var(--muted); font-size: 13px; }
.peer-summary[data-state="stale"] { color: var(--stale); background: var(--stale-bg); border-radius: 14px 14px 0 0; }
.peer-scroll { overflow-x: auto; border-radius: 0 0 14px 14px; }
.peer-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.peer-table th, .peer-table td { padding: 11px 17px; border-top: 1px solid #edf0f6; text-align: left; }
.peer-table thead th { color: var(--muted); background: #fafbfe; font-size: 12px; font-weight: 650; }
.peer-table tbody th { font-weight: 680; }
.metric-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.peer-table time, .peer-table td:nth-last-child(-n+2) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.peer-table .status { padding: 5px 8px; white-space: nowrap; }

.report-snapshot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.report-snapshot .status { padding: 4px 8px; }
.report-snapshot time { font-variant-numeric: tabular-nums; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr); gap: 12px; margin-top: 12px; align-items: start; }
.report-card { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.report-heading { padding: 12px 14px; }
.report-heading h2 { font-size: 17px; letter-spacing: -.025em; }
.report-heading p, .report-empty { color: var(--muted); font-size: 12px; line-height: 1.4; }
.report-heading p { margin-top: 4px; }
.report-empty { padding: 0 14px 12px; }
.report-scroll { overflow-x: auto; border-radius: 0 0 12px 12px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td { padding: 8px 12px; border-top: 1px solid #edf0f6; vertical-align: middle; }
.report-table th { text-align: left; font-weight: 650; overflow-wrap: anywhere; }
.report-table td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-table thead th { color: var(--muted); background: #fafbfe; font-size: 12px; }
.report-table thead th:not(:first-child) { text-align: right; }
.report-table .report-group th { color: var(--muted); background: #f4f6fa; font-size: 12px; }
.report-table .metric-detail { font-size: 11px; }
.traffic-table th[scope="row"] { width: 46%; }
.traffic-table td:nth-child(2) { font-weight: 690; }
.traffic-table meter { display: block; width: 100%; height: 6px; margin-top: 5px; }
.traffic-table meter::-webkit-meter-bar { background: #ebeaf5; border: none; }
.traffic-table meter::-webkit-meter-optimum-value { background: var(--accent); }
.traffic-table meter::-moz-meter-bar { background: var(--accent); }
.traffic-history { margin-top: 12px; }
.history-heading { display: flex; justify-content: space-between; align-items: start; gap: 8px 12px; flex-wrap: wrap; }
.history-periods { display: flex; gap: 4px; }
.history-periods button {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.history-periods button[aria-pressed="true"] { background: #eeebfd; border-color: #d8d0fb; color: #4935ab; }
.history-content { padding: 0 14px 12px; }
.history-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 9px 0 2px; list-style: none; color: var(--muted); font-size: 12px; }
.history-legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; }
.history-rx::before { background: #5942ce; }
.history-tx::before { background: #087968; }
.history-gap::before { background: #fff1d9; outline: 1px dashed #a46b1a; }
#history-chart { display: block; width: 100%; height: 144px; }
#history-focus { min-height: 1em; margin: 4px 0; }
#history-details { margin-top: 7px; }
#history-details summary { cursor: pointer; width: fit-content; color: var(--accent); font-size: 12px; }
.history-table { min-width: 500px; margin-top: 6px; }
.history-table [data-interval="gap"] td { color: var(--stale); }
.report-audit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-node { padding: 9px 14px; border-top: 1px solid #edf0f6; font-size: 13px; }
.report-node header { display: flex; gap: 5px 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.report-node h3 { font-size: 13px; }
.report-node .status { padding: 3px 7px; font-size: 11px; }
.report-node-result { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.report-node details { margin-top: 5px; }
.report-node summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.report-node-details { display: grid; gap: 3px; margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
.incident-card { margin-top: 12px; }
.incident-nodes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
.incident-node { padding: 8px 14px; border-top: 1px solid #edf0f6; font-size: 13px; }
.incident-node + .incident-node { border-left: 1px solid #edf0f6; }
.incident-node strong { margin-right: 8px; }
.incident-node .status { padding: 3px 7px; font-size: 11px; }
.incident-node small, .incident-table small { display: block; margin-top: 3px; color: var(--muted); }
.incident-table { min-width: 560px; }
.incident-table td, .incident-table thead th:not(:first-child) { text-align: left; }
.incident-table td:last-child { white-space: normal; }
.incident-table [data-event="failure"] { color: var(--down); }


@media (max-width: 920px) {
  .frame { width: calc(100% - 40px); }
}

@media (max-width: 800px) {
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 690px) {
  .frame { width: calc(100% - 28px); }
  .topbar-inner { min-height: 54px; flex-wrap: wrap; gap: 4px 12px; padding-block: 5px; }
  main.frame { padding-top: 16px; }
  .route { padding: 12px; }
  .route-stages, .node-grid { grid-template-columns: 1fr; gap: 8px; }
  .route-node + .route-node::before { content: none; }
  .sources { grid-template-columns: 1fr; }
  .sources dd + dt { margin-top: 5px; }
  .incident-nodes { grid-template-columns: 1fr; }
  .incident-node + .incident-node { border-left: 0; }
  .report-table th, .report-table td { padding-inline: 8px; }
}
