:root {
  color-scheme: light;
  --ink: #17202b;
  --muted: #687386;
  --line: #dfe4ea;
  --line-soft: #edf0f3;
  --surface: #ffffff;
  --canvas: #f3f5f7;
  --blue: #1f5fbf;
  --blue-dark: #174b98;
  --green: #157347;
  --green-bg: #e9f7ef;
  --red: #b42318;
  --red-bg: #fff0ef;
  --amber: #8a5d00;
  --amber-bg: #fff7df;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--blue-dark); }
button:disabled { cursor: not-allowed; opacity: .52; }
button.secondary { background: #fff; color: #344054; border-color: #cbd3dc; }
button.secondary:hover { background: #f7f9fb; border-color: #aeb8c4; }
button.danger { background: #fff; color: var(--red); border-color: #e5aaa5; }
button.danger:hover { background: var(--red-bg); border-color: #d47a73; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #d9e8ff;
  outline-offset: 1px;
}

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-panel {
  width: min(380px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px rgb(23 32 43 / 8%);
}
.login-panel .brand-mark { margin-bottom: 15px; }
.login-panel h1 { margin: 0 0 24px; font-size: 20px; }
.login-panel label, .field-label { display: block; margin-bottom: 6px; color: #344054; font-size: 12px; font-weight: 650; }
.login-panel input {
  width: 100%;
  height: 42px;
  margin-bottom: 12px;
  padding: 0 11px;
  border: 1px solid #c8d0da;
  border-radius: 6px;
  color: var(--ink);
}
.login-panel button { width: 100%; height: 42px; }
.inline-status { min-height: 20px; margin-top: 10px; color: var(--red); font-size: 12px; }

.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: #fff; }
.topbar-inner { max-width: 1540px; margin: auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 7px; background: #182230; color: #fff; font-size: 17px; font-weight: 750; }
h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.eyebrow { margin-top: 2px; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.service-state { display: flex; align-items: center; gap: 7px; color: #425466; font-size: 12px; white-space: nowrap; }
.service-state i { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 3px #def7eb; }

main { max-width: 1540px; margin: auto; padding: 18px 20px 28px; }
.panel, .results-band { margin-bottom: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.panel-heading, .results-heading { min-height: 52px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line-soft); }
.panel-heading h2, .results-heading h2 { margin: 0; font-size: 14px; font-weight: 700; }
.selection-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.source-body { padding: 14px; }
.muted { color: var(--muted); font-size: 12px; }
textarea {
  display: block;
  width: 100%;
  min-height: 82px;
  padding: 10px 11px;
  resize: vertical;
  border: 1px solid #c8d0da;
  border-radius: 6px;
  background: #fbfcfd;
  color: #1f2937;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}
textarea:focus { border-color: #4f86d9; background: #fff; }
.source-list { min-height: 0; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.source-pill { max-width: 100%; padding: 4px 7px; display: inline-flex; align-items: center; border: 1px solid #dfe6ed; border-radius: 5px; background: #f4f7fa; font-size: 11px; }
.source-list a { max-width: 100%; overflow: hidden; color: #245da8; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.source-list a:hover { text-decoration: underline; }
.toolbar { margin-top: 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.toolbar-spacer { flex: 1; }
.status { margin-top: 10px; padding: 9px 11px; display: flex; align-items: flex-start; gap: 8px; border: 1px solid #d8e5f6; border-radius: 6px; background: #f2f7fd; color: #315b8d; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.status::before { content: ""; width: 7px; height: 7px; flex: none; margin-top: 5px; border-radius: 50%; background: #4f86d9; }
.status.bad { border-color: #f0c7c3; background: var(--red-bg); color: var(--red); }
.status.bad::before { background: #d04437; }
.status.good { border-color: #c9e7d5; background: var(--green-bg); color: var(--green); }
.status.good::before { background: #2e9b67; }

.results-heading { align-items: flex-start; }
.results-title { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.results-title #meta { line-height: 1.6; }
.view-controls { display: flex; align-items: center; gap: 12px; }
.sort-control, .search-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sort-control select, .search-control input { height: 32px; border: 1px solid #cbd3dc; border-radius: 6px; background: #fff; color: #344054; }
.sort-control select { padding: 0 28px 0 9px; }
.search-control input { width: 176px; padding: 0 9px; }
.table-wrap { max-height: 68vh; overflow: auto; scrollbar-color: #c8d0da transparent; scrollbar-width: thin; }
table { width: 100%; min-width: 1120px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; height: 38px; border-bottom-color: #d8dee5; background: #f7f9fb; color: #526072; font-size: 11px; font-weight: 700; }
tbody tr { background: #fff; transition: background .12s; }
tbody tr:hover { background: #f8fafc; }
tbody tr.recommended { background: #fbfefc; }
tbody tr.recommended:hover { background: #f0f9f4; }
tbody tr.recommended td:first-child { box-shadow: inset 3px 0 0 #2e9b67; }
tbody tr:last-child td { border-bottom: 0; }
input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--blue); }
.wrap { min-width: 180px; max-width: 310px; line-height: 1.45; white-space: normal; }
.tag { display: inline-block; padding: 2px 6px; border-radius: 4px; background: #edf1f5; color: #4b5563; font-size: 11px; font-weight: 650; }
.tag.residential, .tag.mobile { background: var(--green-bg); color: var(--green); }
.tag.hosting { background: var(--red-bg); color: #9f2d24; }
.tag.isp { background: var(--amber-bg); color: var(--amber); }
.flagged { color: var(--red); font-weight: 650; }
td:nth-child(4), td:nth-child(5), td:nth-child(6) { font-variant-numeric: tabular-nums; }
.empty { padding: 28px 12px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .topbar-inner { padding: 10px 12px; }
  .service-state { display: none; }
  main { padding: 10px 8px 20px; }
  .panel, .results-band { margin-bottom: 10px; border-radius: 6px; }
  .panel-heading, .results-heading { padding: 10px 11px; align-items: stretch; flex-direction: column; gap: 8px; }
  .source-body { padding: 11px; }
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-spacer { display: none; }
  .toolbar button { width: 100%; padding: 0 8px; }
  .results-title { display: block; }
  .results-title #meta { margin-top: 4px; }
  .view-controls { display: grid; grid-template-columns: 1fr; gap: 7px; }
  .sort-control, .search-control { justify-content: space-between; }
  .sort-control select, .search-control input { width: 70%; min-width: 0; }
  .table-wrap { max-height: 64vh; }
  table { min-width: 1040px; }
}
