:root {
  color-scheme: light dark;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --text: #1f2421;
  --muted: #68736d;
  --line: #d9ded9;
  --green: #18794e;
  --red: #b42318;
  --amber: #b76e00;
  --blue: #2563a8;
  --ink: #111816;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111412;
    --panel: #1a1f1c;
    --text: #edf1ed;
    --muted: #a7b0aa;
    --line: #303832;
    --green: #4ade80;
    --red: #fb7185;
    --amber: #fbbf24;
    --blue: #60a5fa;
    --ink: #f7faf7;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 30px;
  font-weight: 760;
}

h2 {
  font-size: 16px;
  font-weight: 720;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.icon-link {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

.icon-button:hover,
.icon-link:hover {
  border-color: var(--blue);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 40px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric.primary {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
}

.metric-label,
.small-label,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
}

.metric-hint {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.uneven {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.checks,
.signals,
.rank-list,
.recent-list {
  display: grid;
  gap: 10px;
}

.check-row,
.signal-row,
.rank-row,
.recent-row {
  display: grid;
  align-items: center;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.check-row {
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.5fr) 72px 86px;
  gap: 12px;
}

.signal-row {
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
}

.rank-row {
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 12px;
}

.recent-row {
  gap: 4px;
}

.path,
.recent-row a,
.rank-row a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path,
.status-code {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.ok {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
}

.warn {
  background: color-mix(in srgb, var(--amber) 18%, transparent);
  color: var(--amber);
}

.bad {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  color: var(--red);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.content-grid div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.content-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.views {
  text-align: right;
  font-weight: 750;
}

.bar {
  width: 100%;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 75%, transparent);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .status-strip,
  .grid.two,
  .grid.uneven {
    grid-template-columns: 1fr;
  }

  .check-row {
    grid-template-columns: 1fr 72px;
  }

  .check-row .path,
  .check-row .status-code {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 25px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}
