:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1d4ed8;
  --good: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --panel: #151b26;
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --line: #263041;
    --accent: #7ea2ff;
    --good: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -.01em; }
.brand .mark {
  width: 12px; height: 12px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--good));
}

nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
nav button {
  background: none; border: 1px solid transparent; color: var(--muted);
  padding: .4rem .75rem; border-radius: 8px; cursor: pointer; font: inherit;
}
nav button:hover { color: var(--ink); background: var(--bg); }
nav button.active { color: var(--ink); border-color: var(--line); background: var(--bg); font-weight: 600; }

.who { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.who button {
  font: inherit; font-size: .82rem; padding: .3rem .6rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer;
}
.who button:hover { border-color: var(--accent); }

.signin {
  max-width: 27rem; margin: 3rem auto; padding: 1.6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .9rem;
}
.signin h1 { margin: 0; font-size: 1.25rem; }
.signin label { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; color: var(--muted); }
.signin input {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--ink);
}
.signin .hint { margin: 0; }
.signin button[disabled] { opacity: .6; cursor: progress; }

main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.view.hidden { display: none; }

.toolbar {
  display: flex; gap: .9rem; align-items: end; flex-wrap: wrap;
  padding: .9rem 1rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem;
}
.toolbar label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.toolbar select, .toolbar input {
  font: inherit; padding: .38rem .5rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 8rem;
}
button.primary {
  font: inherit; font-weight: 600; padding: .45rem .95rem; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
button.ghost {
  font: inherit; padding: .3rem .6rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: .82rem;
}

.hint {
  color: var(--muted); font-size: .87rem; margin: 0 0 1.1rem;
  padding-left: .8rem; border-left: 3px solid var(--line);
}

.cards { display: flex; flex-direction: column; gap: .85rem; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.card h3 { margin: 0 0 .35rem; font-size: 1.02rem; line-height: 1.35; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }

.scores { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.score {
  display: inline-flex; align-items: baseline; gap: .35rem;
  border: 1px solid var(--line); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem;
}
.score b { font-size: .95rem; }
.score.match b { color: var(--accent); }
.score.conf b { color: var(--good); }
.score.conf.low b { color: var(--warn); }

.meta { color: var(--muted); font-size: .83rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.meta span:not(:last-child)::after { content: "·"; margin-left: .6rem; opacity: .5; }

.cost {
  margin: .6rem 0; padding: .55rem .7rem; background: var(--bg);
  border-radius: 9px; font-size: .87rem; display: flex; gap: .8rem; flex-wrap: wrap;
}
.cost b { font-variant-numeric: tabular-nums; }

.evidence { margin-top: .55rem; display: flex; flex-direction: column; gap: .2rem; font-size: .83rem; }
.evidence .ok { color: var(--good); }
.evidence .warn { color: var(--warn); }
.evidence .missing { color: var(--muted); }

/* Inferred values render differently from observed ones. This single choice is
   what makes buyers trust the numbers. */
.inferred {
  border-bottom: 1px dashed var(--warn); cursor: help;
}

.actions { margin-top: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem; cursor: pointer;
}
.stat b { display: block; font-size: 1.55rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .8rem; }
.stat.degraded b { color: var(--warn); }
.stat.unsupported b { color: var(--bad); }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: .75rem; color: var(--muted);
}
.pill.live { color: var(--good); border-color: var(--good); }
.pill.status-monitored { color: var(--good); }
.pill.status-degraded { color: var(--warn); }
.pill.status-unsupported { color: var(--bad); }

.empty { color: var(--muted); text-align: center; padding: 2.5rem 1rem; }

footer {
  border-top: 1px solid var(--line); padding: 1.1rem 1.25rem;
  display: flex; gap: 1.2rem; flex-wrap: wrap;
  color: var(--muted); font-size: .82rem; background: var(--panel);
}
footer a { color: var(--muted); }
