/**** -- Tokens */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --ink-soft: #475467;
  --ink-faint: #98a2b3;
  --line: #e4e7ec;
  --line-soft: #f2f4f7;
  --accent: #1a56db;
  --accent-soft: #eef4ff;
  --sidebar: #101828;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08);

  --rank-top3: #067647;
  --rank-top7: #4ca30d;
  --rank-top10: #b54708;
  --rank-top15: #c4320a;
  --rank-low: #b42318;
  --rank-none: #667085;

  --good: #067647;
  --bad: #b42318;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 25px; margin: 0; letter-spacing: -.4px; }
h2 { font-size: 16px; margin: 0 0 3px; letter-spacing: -.2px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--ink-soft); }
p { margin: 0 0 10px; }

/**** -- App shell */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100%; }
/* A shared report has no sidebar: it is one page for someone with no account. */
.app.shared { grid-template-columns: minmax(0, 1fr); }
.app.shared .content { max-width: 900px; margin: 0 auto; }

.sidebar {
  background: var(--sidebar); color: #fff; padding: 0 0 30px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px; height: 58px;
  padding: 0 18px; font-weight: 650; letter-spacing: -.2px; color: #fff;
  border-bottom: 1px solid #1d2939;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand .dot {
  width: 9px; height: 9px; border-radius: 50%; background: #12b76a; flex: none;
}
.sidebar nav { padding: 12px 10px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px;
  color: #667085; font-weight: 650; padding: 14px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 7px; color: #d0d5dd; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: #1d2939; color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-client { font-size: 11px; color: #667085; font-weight: 650;
  padding: 12px 10px 3px; text-transform: uppercase; letter-spacing: .5px; }
.nav-sub { padding-left: 10px; }
.nav-sub .nav-item { font-size: 13.5px; padding: 6px 10px; }
.nav-add {
  display: block; margin: 12px 8px 0; padding: 8px; text-align: center;
  border: 1px dashed #344054; border-radius: 7px; color: #98a2b3; font-size: 13px;
}
.nav-add:hover { border-color: #475467; color: #fff; text-decoration: none; }
.sidebar-foot { padding: 16px 18px 0; font-size: 11.5px; color: #475467; }

.content { padding: 26px 30px 90px; max-width: 1240px; }

/**** -- Page header */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .lede { color: var(--ink-soft); font-size: 14px; margin: 5px 0 0; max-width: 68ch; }
.crumbs { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 8px; }
.crumbs a { color: var(--ink-soft); }

/**** -- Tabs */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs a {
  padding: 9px 14px; font-size: 14px; font-weight: 550; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/**** -- Panels */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.panel.tight { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.panel.tight .panel-head { padding: 18px 20px 0; margin-bottom: 12px; }
.panel-foot { padding: 16px 20px; border-top: 1px solid var(--line); background: #fcfcfd; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-side { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 18px; }
@media (max-width: 1000px) { .grid2, .grid-side { grid-template-columns: 1fr; } }

/**** -- Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-faint); font-weight: 650; padding: 10px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: #fcfcfd;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfcfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
tr.is-target td { background: var(--accent-soft) !important; font-weight: 600; }
.rowlink { font-weight: 600; color: var(--ink); }
.rowlink:hover { color: var(--accent); }
.cell-sub { font-size: 12.5px; color: var(--ink-faint); font-weight: 400; margin-top: 1px; }

/**** -- Forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=url], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--accent-soft); border-color: var(--accent);
}
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 14px; }
.field .help { font-size: 12.5px; color: var(--ink-faint); margin: 5px 0 0; font-weight: 400; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }

button, .btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px;
  border-radius: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
  white-space: nowrap;
}
button:hover, .btn:hover { background: #1546b4; border-color: #1546b4; text-decoration: none; color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f9fafb; color: var(--ink); border-color: #d0d5dd; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-link {
  background: none; border: none; color: var(--ink-faint); padding: 4px 6px;
  font-size: 13px; cursor: pointer;
}
.btn-link:hover { background: none; color: var(--bad); border: none; }
.inline-form { display: inline; }
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

/**** -- Choice cards (scan area presets) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: block; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; height: 100%; background: #fff;
}
.choice > span:hover { border-color: #b2c5f0; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { outline: 3px solid var(--accent-soft); }
.choice .name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.choice .facts { display: block; font-size: 13px; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.choice .blurb { display: block; font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; line-height: 1.45; }

/**** -- Checkbox list */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.check {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: 7px; font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer;
}
.check:hover { background: var(--line-soft); }
.check input { width: auto; flex: none; }

/**** -- Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; }
.stat .k { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.stat .v {
  font-size: 29px; font-weight: 650; letter-spacing: -.8px; margin-top: 3px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .d { font-size: 12.5px; margin-top: 3px; color: var(--ink-faint); }
.stat .code { font-size: 10.5px; color: var(--ink-faint); font-weight: 600; letter-spacing: .4px; }
.up { color: var(--good); font-weight: 650; }
.down { color: var(--bad); font-weight: 650; }
.flat { color: var(--ink-faint); font-weight: 600; }

/**** -- Rank display */
.chip-rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 26px; padding: 0 8px; border-radius: 7px;
  color: #fff; font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.band-top3  { background: var(--rank-top3); }
.band-top7  { background: var(--rank-top7); }
.band-top10 { background: var(--rank-top10); }
.band-top15 { background: var(--rank-top15); }
.band-low   { background: var(--rank-low); }
.band-none  { background: var(--rank-none); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-soft); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.pin {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; color: #fff;
  font-size: 12px; font-weight: 700; border: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 1px 4px rgba(0,0,0,.35); font-variant-numeric: tabular-nums;
}
#map { height: 540px; border-radius: var(--radius); z-index: 0; }

.gridtable { border-collapse: separate; border-spacing: 4px; width: auto; margin: 4px auto 14px; }
.gridtable td {
  width: 40px; height: 40px; padding: 0; border: none; text-align: center;
  color: #fff; font-weight: 700; font-size: 13px; border-radius: 6px;
  font-variant-numeric: tabular-nums; background: transparent;
}

/**** -- Misc */
.pill {
  display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px;
  border-radius: 999px; background: var(--line-soft); color: var(--ink-soft);
}
.pill.ok { background: #dcfae6; color: #067647; }
.pill.err { background: #fee4e2; color: #b42318; }
.pill.run { background: #fef0c7; color: #b54708; }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.muted { color: var(--ink-faint); }
code {
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(16,24,40,.07); padding: 1px 5px; border-radius: 4px;
}
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.empty { padding: 44px 26px; text-align: center; color: var(--ink-soft); }
.empty h2 { color: var(--ink); }
.empty p { max-width: 46ch; margin: 0 auto 16px; color: var(--ink-faint); font-size: 14px; }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

.callout {
  background: var(--accent-soft); border: 1px solid #c7d7fe; border-radius: var(--radius);
  padding: 13px 16px; font-size: 13.5px; color: #1c3f9c; margin-bottom: 18px;
}
.callout strong { color: #17337d; }
.callout.warn { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.callout.warn strong { color: #7a2e0e; }

details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-soft); }
details summary:hover { color: var(--ink); }
details[open] summary { margin-bottom: 14px; }

.spark { display: block; width: 100px; height: 26px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { padding-bottom: 6px; }
  .content { padding: 20px 16px 70px; }
}

/**** -- Print */
@media print {
  .sidebar, .no-print, .tabs { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .content { max-width: none; padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}
