:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #14161a;
  --ink-2: #4b5160;
  --ink-3: #858b97;
  --line: #e5e7eb;
  --accent: #1c1f24;
  --good: #17935e;
  --warn: #b8790a;
  --bad: #c23a2f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.05), 0 8px 24px rgba(16, 18, 22, 0.06);
}

* { box-sizing: border-box; }

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

a { color: inherit; }

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ chrome */

header.top {
  background: var(--accent);
  color: #fff;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 50;
}
header.top .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
header.top .eye {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 0 26%, #f2544b 27% 52%, #fff 53%);
}
header.top nav { display: flex; gap: 4px; margin-left: 12px; }
header.top nav a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
header.top nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
header.top nav a.on { background: rgba(255,255,255,.16); color: #fff; }
header.top .who { font-size: 13px; color: rgba(255,255,255,.6); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }
main.wide { max-width: 1500px; }

.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead .sub { color: var(--ink-3); font-size: 14px; margin-top: 3px; }
.crumb { font-size: 13px; color: var(--ink-3); text-decoration: none; display: inline-block; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }

/* ------------------------------------------------------------------ panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel > header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel > .body { padding: 16px; }
.panel.flush > .body { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); }
.stat { background: var(--panel); padding: 14px 16px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.stat .v { font-size: 23px; font-weight: 650; margin-top: 3px; letter-spacing: -0.02em; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); }

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #fafbfc; }

/* ------------------------------------------------------------------ pills */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.pill.good { background: #e7f6ee; color: var(--good); }
.pill.warn { background: #fdf3e0; color: var(--warn); }
.pill.bad { background: #fdeceb; color: var(--bad); }
.pill.flat { background: #f0f1f3; color: var(--ink-2); }

.bar { height: 6px; border-radius: 999px; background: #edeef1; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 999px; }

/* ---------------------------------------------------------------- controls */

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
button:hover, .btn:hover { background: #f7f8f9; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #33383f; }
button.danger { color: var(--bad); border-color: #f2d5d2; }
button.danger:hover { background: #fdf4f3; }
button.sm { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

input, textarea, select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid #cfd4dc; outline-offset: -1px; border-color: #cfd4dc; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.checks input { width: auto; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }

.codeblock {
  background: #14161a;
  color: #e8eaed;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
  max-width: 560px;
  width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(15,17,21,.5); }
dialog .dhead { padding: 18px 20px 0; }
dialog .dbody { padding: 16px 20px; }
dialog .dfoot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 200; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------- findings */

.finding { border-left: 3px solid var(--line); padding: 2px 0 2px 14px; margin-bottom: 16px; }
.finding.high { border-left-color: var(--bad); }
.finding.medium { border-left-color: var(--warn); }
.finding.low { border-left-color: var(--ink-3); }
.finding .what { font-weight: 600; }
.finding .ev { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.finding .t { font-size: 12px; color: var(--ink-3); font-family: ui-monospace, monospace; }

.aisummary { background: #f4f6fb; border: 1px solid #e2e8f4; border-radius: 10px; padding: 14px 16px; }
.aisummary .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5b6b8c; font-weight: 700; margin-bottom: 6px; }
