:root {
  /* Where background-image arrows sit: the reading end of the control. */
  --arrow-select: calc(100% - 11px) center;
  --arrow-menu: calc(100% - 9px) center;
  --bg: #f4f6f9;
  --card: #ffffff;
  --card-2: #fafbfc;          /* table headers, inset panels */
  --border: #e3e6ea;
  --border-strong: #cfd5dd;
  --text: #14181f;
  --muted: #6b7280;
  --accent: #16a34a;
  --primary: #2563eb;
  --primary-soft: #eff4ff;
  --danger: #b91c1c;
  --warn: #b45309;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 4px 16px rgba(16, 24, 40, .08);
  --ring: 0 0 0 3px rgba(37, 99, 235, .18);
  /* Page widths. Reading pages stay narrow enough to read; pages whose point
     is a nine-column table get the room they need. */
  --page: 1100px;
  --page-wide: 1480px;
}

[dir="rtl"] { --arrow-select: 11px center; --arrow-menu: 9px center; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --card: #171b21;
    --card-2: #1c212a;
    --border: #2a3038;
    --border-strong: #3a424e;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --primary-soft: #172033;
    --danger: #f87171;
    --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 4px 18px rgba(0, 0, 0, .45);
    --ring: 0 0 0 3px rgba(59, 130, 246, .3);
  }
}

* { box-sizing: border-box; }

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

a { color: var(--primary); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 800; font-size: 17px; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { text-decoration: none; font-weight: 600; font-size: 14px; }
.inline { display: inline; margin: 0; }

main { max-width: var(--page); margin: 0 auto; padding: 26px 22px 60px; }
/* Pages built around a wide table ask for the extra room themselves. */
main.wide { max-width: var(--page-wide); }

h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 17px; letter-spacing: -.01em; }

.section-title {
  margin: 28px 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title.accent, .accent { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-narrow { max-width: 360px; margin: 40px auto; }

.muted { color: var(--muted); }

/* Stats */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 108px;
}
.stat.wide { flex: 1; min-width: 240px; }
.stat-num { display: block; font-size: 26px; font-weight: 800; }
.stat-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
}
.stat-sub { display: block; font-size: 13px; margin-top: 5px; }

/* Listings */
.listings { display: grid; gap: 12px; }

.listing {
  display: flex;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.listing-new { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.thumb {
  width: 132px;
  height: 100px;
  object-fit: cover;
  border-radius: 7px;
  flex-shrink: 0;
  background: var(--bg);
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--border);
}

.listing-body { min-width: 0; }
.listing-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price { font-size: 18px; font-weight: 800; }
.badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 10px;
}
.addr { font-size: 14px; margin-top: 3px; }
.meta { font-size: 12.5px; color: var(--muted); }
.link { display: inline-block; margin-top: 7px; font-size: 13px; font-weight: 600; text-decoration: none; }

/* Forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.mt { margin-top: 16px; }

/* One rule for every control. `date`, `search` and `email` were missing, so
   those boxes kept the browser's own styling and sat at a different height
   and colour from the ones beside them. */
input[type=text], input[type=number], input[type=password], input[type=date],
input[type=search], input[type=email], input[type=tel], input[type=url],
textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  transition: border-color .12s, box-shadow .12s;
}
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--border-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
/* A native date field renders its own dark-on-dark calendar glyph otherwise. */
@media (prefers-color-scheme: dark) {
  input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.75); }
}
select {
  appearance: none;
  padding-inline-end: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--arrow-select);
}

small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

form section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
form section:last-of-type { border-bottom: 0; }
form h2 {
  margin: 0 0 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 400;
  font-size: 13.5px;
  margin: 0;
}
.check input { margin: 0; }
.switch-cell { display: flex; flex-direction: column; gap: 10px; justify-content: center; }

/* Per-source city/type groups are rendered from the global selection, so they
   show what is in effect without inviting an edit that would be overwritten. */
.checks.derived .check { opacity: .72; cursor: default; }
.checks.derived .check input { cursor: default; }
.all-hint.from-global { font-weight: 400; color: var(--muted); }

.global-block h2 { margin-bottom: 4px; }
.coverage { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.coverage-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.coverage table { width: 100%; border-collapse: collapse; font-size: 13px; }
.coverage th, .coverage td { text-align: start; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.coverage th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.coverage tr:last-child td { border-bottom: 0; }
.coverage tr.blind td { color: #b45309; }
@media (prefers-color-scheme: dark) { .coverage tr.blind td { color: #fbbf24; } }
.coverage small { display: block; margin-top: 8px; }

.btn {
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.actions { margin-top: 4px; }

.status {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.status.ok { border-color: var(--accent); }
.status.warn { border-color: #d97706; }
code { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.flash {
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 14px; border: 1px solid transparent;
}
.flash-success { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.flash-error { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
/* These were fixed light values with no dark counterpart, so in dark mode a
   flash was dark text on a pale block — the one element on the page that did
   not follow the theme. */
@media (prefers-color-scheme: dark) {
  .flash-success { background: #0d2818; color: #86efac; border-color: #14532d; }
  .flash-error { background: #2a1215; color: #fca5a5; border-color: #7f1d1d; }
}

/* Runs table */
.runs { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); }
.runs th, .runs td {
  text-align: start;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
}
.runs th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.runs .err { color: #b91c1c; max-width: 260px; }

footer {
  text-align: center;
  padding: 22px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 560px) {
  .listing { flex-direction: column; }
  .thumb { width: 100%; height: 150px; }
}

/* Multi-source grouping */
.group-title {
  margin: 34px 0 4px;
  font-size: 18px;
  font-weight: 800;
  border-bottom: 2px solid var(--text);
  padding-bottom: 7px;
}
.group-title .muted { font-size: 12px; font-weight: 500; }
.section-title { margin-top: 18px; }

/* How each site is read, beside its settings. The dashboard shows the same
   label but hides it in the narrow sidebar, so this is where it is legible. */
.source-block .source-tag-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 6px 0 8px;
}
.tech-meta { text-transform: uppercase; letter-spacing: .03em; }
.tech-link { font-size: 11.5px; color: var(--muted); text-decoration: none; }
.tech-link:hover { text-decoration: underline; }

.source-block { border-top: 2px solid var(--border); padding-top: 20px; }
.source-head { margin-bottom: 2px !important; text-transform: none !important;
  font-size: 15px !important; letter-spacing: 0 !important; color: var(--text) !important; }
.source-head .check { font-weight: 800; font-size: 15px; }
small.mb { margin-bottom: 14px; }


/* Source attribution on listing cards */
.source-tag-row { margin-top: 6px; }
.source-tag {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9px;
}
@media (prefers-color-scheme: dark) {
  .source-tag { background: #262c4a; color: #c7d2fe; }
}

/* Unsubscribed addresses */
.optout {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.optout-head { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.optout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.optout-row:last-child { border-bottom: 0; }
.btn-small { padding: 4px 10px; font-size: 12px; }

.listed-date { font-size: 11.5px; color: var(--muted); margin-inline-start: 7px; }


/* Results toolbar */
.toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.tb-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.tb-row + .tb-row { margin-top: 12px; }
.tb-field { display: flex; flex-direction: column; min-width: 132px; }
.tb-field.grow { flex: 1; min-width: 180px; }
.tb-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 4px;
}
.tb-field input, .tb-field select { padding: 7px 9px; font-size: 13.5px; }
.tb-sources { align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.tb-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 700;
}
.tb-summary {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.rate-note { margin-inline-start: auto; font-size: 11.5px; }
.usd { font-size: 12.5px; color: var(--muted); font-weight: 600; }
input:disabled { opacity: .6; }


/* `.listing` sets display:flex, an author rule, which overrides the browser's
   [hidden] { display: none }. Without this, hiding a card does nothing. */
.listing[hidden], [hidden] { display: none !important; }


/* Contact details, technology label and row actions */
.contact {
  margin-top: 6px;
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.contact a { text-decoration: none; font-weight: 600; }
.contact .wa { color: #16a34a; }
.tech-tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9px;
  margin-inline-start: 6px;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.save-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }


/* Sites searched — one per line, so ten sites stay readable */
.site-summary { padding: 16px 18px; margin-bottom: 16px; }
.site-summary-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.site-list { list-style: none; margin: 0; padding: 0; }
.site-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding-block: 7px; padding-inline: 18px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  position: relative;
}
.site-list li:last-child { border-bottom: 0; }
.site-list li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 2px;
  color: var(--primary);
  font-weight: 800;
}
.site-name { font-weight: 700; min-width: 190px; }
.site-count { font-size: 13px; }

/* Site filters: a wrapped column reads better than one long row */
.tb-sources { align-items: flex-start; }
.tb-sources .check { flex: 0 0 auto; min-width: 210px; }
@media (max-width: 620px) {
  .site-name { min-width: 0; }
  .tb-sources .check { min-width: 100%; }
}

.site-url { font-size: 12.5px; text-decoration: none; }
.site-url:hover { text-decoration: underline; }

.site-toggle { gap: 9px; margin: 0; }
.site-toggle .site-name { font-weight: 700; }
.site-summary-head .muted { font-weight: 500; text-transform: none; letter-spacing: 0; }
.site-list li.excluded { opacity: .45; }


/* Listings vs projects tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tab {
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-note { font-size: 11.5px; margin-inline-start: auto; }

/* Sites checked but not supported */
.unsupported-head { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.site-list.unsupported li { opacity: .5; }
.site-list.unsupported li::before { color: var(--muted); content: "○"; }
.site-list.unsupported .site-count { font-style: italic; }

/* Unsupported sites that were verified reachable read less "dead" than the
   ones that are actually blocked. */
.site-list.unsupported li.ready { opacity: .8; }
.site-list.unsupported li.ready::before { content: "◐"; color: var(--primary); }
.ready-tag {
  background: #eef2ff;
  color: #3730a3;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9px;
}
@media (prefers-color-scheme: dark) { .ready-tag { background: #262c4a; color: #c7d2fe; } }

/* Two-column layout: sites on the left, results on the right */
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.layout-side { position: sticky; top: 16px; }
.layout-side .site-summary { margin-bottom: 0; padding: 14px 15px; }
.layout-side .site-list li {
  padding-inline-start: 16px;
  gap: 3px 8px;
  font-size: 12.5px;
}
.layout-side .site-name { min-width: 0; font-size: 12.5px; }
.layout-side .site-count,
.layout-side .site-url { font-size: 11.5px; }
.layout-side .tech-tag { display: none; }   /* too cramped in a narrow column */
.layout-main { min-width: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .layout-side { position: static; }
  .layout-side .tech-tag { display: inline-block; }
}

/* The sites panel scrolls on its own: 18 sites plus the unsupported notes are
   far taller than the viewport, and the results must stay scrollable
   independently. */
.layout-side {
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}
.layout-side .site-summary {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.site-scroll {
  overflow-y: auto;
  min-height: 0;
  /* room for the scrollbar so rows are not clipped */
  padding-inline-end: 4px;
  scrollbar-width: thin;
}
.site-scroll::-webkit-scrollbar { width: 8px; }
.site-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.site-summary-head { flex-shrink: 0; }

@media (max-width: 900px) {
  /* Stacked, the panel should grow with the page rather than trap a scrollbar */
  .layout-side { max-height: none; }
  .site-scroll { overflow: visible; max-height: none; }
}

/* "nothing ticked = every type" — makes an empty filter read as deliberate
   rather than as a save that failed. */
.all-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 11.5px;
  margin-inline-start: 6px;
}

/* Exchange-rate analysis page. */
.fx-chart { width: 100%; height: 260px; display: block; }
.fx-axis {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.stat.up strong, .up { color: #b91c1c; }      /* pound weaker = rate up */
.stat.down strong, .down { color: #15803d; }  /* pound stronger = rate down */
@media (prefers-color-scheme: dark) {
  .stat.up strong, .up { color: #f87171; }
  .stat.down strong, .down { color: #4ade80; }
}

/* Analysis page: legend swatches next to the finish buckets. */
.swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-inline-end: 5px; vertical-align: baseline;
}

/* Sites overview: a switched-off row recedes, good coverage stands out. */
.admin-table tr.off td { opacity: .55; }
.admin-table td.good { color: var(--accent); font-weight: 700; }

/* ---------------------------------------------------------- sites table */

.table-card { padding: 0; overflow: hidden; }

.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  text-align: start; font-size: 11px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.grid-table th.s { cursor: pointer; user-select: none; }
.grid-table th.s:hover { color: var(--text); }
.grid-table th.s::after { content: "↕"; opacity: .25; margin-inline-start: 5px; font-size: 10px; }
.grid-table th.s.asc::after  { content: "↑"; opacity: 1; color: var(--primary); }
.grid-table th.s.desc::after { content: "↓"; opacity: 1; color: var(--primary); }
.grid-table th.num, .grid-table td.num { text-align: end; }

.grid-table td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.grid-table tbody tr:hover { background: var(--bg); }
.grid-table tbody tr:last-child td { border-bottom: 0; }
.grid-table tr.off td { opacity: .5; }

.site-name { font-weight: 700; }
.grid-table .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.grid-table .sub a { color: var(--muted); text-decoration: none; }
.grid-table .sub a:hover { text-decoration: underline; }
.grid-table .big { font-weight: 700; font-size: 14px; }
.grid-table .dash { color: var(--muted); }

/* A dot beats a column of words for "is this site pulling its weight". */
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-inline-end: 6px; vertical-align: 1px;
}
.dot.good { background: #16a34a; }
.dot.warn { background: #d97706; }
.dot.poor { background: #b91c1c; }
.dot.none { background: var(--border); }

.pill-tag {
  display: inline-block; margin-inline-start: 5px; padding: 1px 7px;
  border-radius: 999px; border: 1px solid var(--border);
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
}
.pill-tag.bad { border-color: #b91c1c; color: #b91c1c; }

.cur { display: block; font-weight: 600; }
.cur i { font-style: normal; color: var(--muted); font-weight: 400; margin-inline-start: 4px; }

/* Percentage as a bar, because 28% next to 97% should be visible at a glance. */
.cov { display: flex; align-items: center; gap: 7px; justify-content: flex-end; }
.cov-bar {
  display: block; width: 46px; height: 6px; border-radius: 3px;
  background: var(--border); overflow: hidden; flex: 0 0 auto;
}
.cov-bar i { display: block; height: 100%; border-radius: 3px; }
.cov-bar i.blue  { background: var(--primary); }
.cov-bar i.green { background: #16a34a; }
.cov-bar i.grey  { background: var(--muted); }
.cov-num { font-variant-numeric: tabular-nums; min-width: 2.4rem; text-align: end; }

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 20px;
  font-size: 12px; margin: 12px 2px 26px;
}
.rejects td { padding: 9px 10px; vertical-align: top; }
.rejects td:first-child { width: 15rem; }

@media (max-width: 720px) {
  .grid-table { font-size: 12px; }
  .cov-bar { width: 28px; }
}
/* The 30-day figure sits under the lifetime bar; it should read as a footnote
   to it, not compete with it. */
.grid-table .sub.recent { text-align: end; font-variant-numeric: tabular-nums; }

/* ---- Archive table ------------------------------------------------------ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.archive-table td { vertical-align: top; }
.archive-table .thumb-col { width: 64px; padding-inline-end: 0; }
.row-thumb {
  display: block; width: 56px; height: 44px; object-fit: cover;
  border-radius: 5px; border: 1px solid var(--border); background: var(--bg);
}
/* An advert with no photo still needs to occupy the column, or every row in
   the table sits at a different height and the eye loses the line. */
.row-thumb-empty { background: var(--border); opacity: .4; }

.archive-table .listing-cell { min-width: 240px; max-width: 380px; }
.archive-table .listing-title {
  font-weight: 600; text-decoration: none; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.archive-table .listing-title:hover { color: var(--primary); text-decoration: underline; }
.archive-table .sub .pill-tag { margin-inline-start: 0; margin-inline-end: 4px; }
.pill-tag.rent { border-color: #7c3aed; color: #7c3aed; }
.pill-tag.sale { border-color: var(--border); }

/* The sort is done in SQL over every matching row, so these are links rather
   than the in-page sorter the sites table uses. */
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--text); }
.sort-link .caret { opacity: .25; margin-inline-start: 5px; font-size: 10px; }
.sort-link.on { color: var(--primary); }
.sort-link.on .caret { opacity: 1; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 18px 0 6px;
}
.pager a {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); font-size: 13px; font-weight: 600;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 820px) {
  .archive-table .thumb-col { display: none; }
}

/* Used by the archive, sites and analysis headers. It had no rule at all, so
   the heading and whatever sits beside it were simply stacking. */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 6px;
}
.section-head h1 { margin: 0; }
.result-head { margin: 18px 0 8px; }
.result-head p { margin: 0; }

/* ==========================================================================
   Refresh layer. Overrides earlier rules deliberately: the base sheet grew a
   page at a time and the pieces had drifted apart — three table styles, two
   button sizes, controls that skipped whole input types.
   ========================================================================== */

/* ---- Chrome -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: 12px 22px;
  box-shadow: var(--shadow);
}
.topbar nav { gap: 4px; flex-wrap: wrap; }
.topbar nav > a {
  padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted);
  transition: background .12s, color .12s;
}
.topbar nav > a:hover { background: var(--bg); color: var(--text); }
/* Which page you are on was not shown anywhere. */
.topbar nav > a.on { background: var(--primary-soft); color: var(--primary); }
.brand { letter-spacing: -.02em; margin-inline-end: 6px; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary, .btn-primary:hover {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-small { padding: 5px 10px; font-size: 12.5px; }

/* ---- Surfaces ------------------------------------------------------------ */
.card { box-shadow: var(--shadow); }
.section-head { margin-bottom: 10px; }
.status {
  border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px;
  border-inline-start-width: 3px;
}
.status.warn { border-inline-start-color: var(--warn); }
.status.ok { border-inline-start-color: var(--accent); }
.stat { box-shadow: var(--shadow); }

/* ---- Tables -------------------------------------------------------------- */
/* Shared by the archive and the sites table. Column widths come from a
   <colgroup> in each template rather than from the content, so a long Arabic
   title cannot squeeze the price column down to one digit per line. */
.table-card { border-radius: var(--radius); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.grid-table { table-layout: fixed; }
.grid-table thead th {
  background: var(--card-2);
  border-bottom: 1px solid var(--border-strong);
  padding: 10px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
.grid-table td { padding: 11px 12px; vertical-align: top; }
/* Fixed layout means a cell no longer stretches to fit, so anything that
   cannot be broken would spill over its neighbour: a long Arabic title, a
   site URL with no spaces in it. */
.grid-table td { overflow-wrap: anywhere; }
.grid-table td.num { overflow-wrap: normal; }
.grid-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--card-2) 55%, transparent); }
.grid-table tbody tr:hover { background: var(--primary-soft); }
/* Figures line up only if the digits are the same width. */
.grid-table .num, .grid-table .big, .cov-num, .stat-num { font-variant-numeric: tabular-nums; }

/* Long text truncates rather than forcing the table wider than the screen. */
.cell-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-wrap { overflow-wrap: anywhere; }

/* ---- Empty states -------------------------------------------------------- */
.empty {
  text-align: center; padding: 34px 20px; border: 1px dashed var(--border);
  background: transparent; box-shadow: none;
}

/* ---- Print --------------------------------------------------------------- */
@media print {
  .topbar, .toolbar, .pager, .btn, form { display: none !important; }
  main { max-width: none; padding: 0; }
  .card, .table-card { box-shadow: none; border: 0; }
  .grid-table thead th { position: static; }
}

/* ---- Narrow screens ------------------------------------------------------ */
@media (max-width: 720px) {
  main { padding: 18px 14px 44px; }
  .topbar { padding: 10px 14px; }
  .topbar nav { gap: 2px; }
  .topbar nav > a { padding: 5px 8px; font-size: 13px; }
  h1 { font-size: 21px; }
  .grid { grid-template-columns: 1fr; }
}

/* Respect a reduced-motion preference: every transition above is decorative. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Navigation ---------------------------------------------------------- */
/* Two groups, divided: what the watcher found for you, and the market as a
   whole. Account business lives in a menu rather than in the row. */
.topbar { gap: 10px; }
.topbar nav { flex: 1; min-width: 0; }
.nav-group { display: flex; align-items: center; gap: 2px; }
.nav-sep {
  width: 1px; align-self: stretch; margin: 4px 8px;
  background: var(--border);
}
.nav-spacer { flex: 1 1 auto; }

/* The account menu. <details>/<summary> so it needs no script. */
.menu { position: relative; }
.menu > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding-block: 6px; padding-inline: 10px 26px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; color: var(--muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: var(--arrow-menu);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background-color: var(--bg); color: var(--text); }
.menu > summary.on { background-color: var(--primary-soft); color: var(--primary); }
.menu[open] > summary { background-color: var(--bg); color: var(--text); }

.menu-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 232px; padding: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-panel a {
  display: block; padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: 14px; font-weight: 600;
}
.menu-panel a:hover { background: var(--bg); }
.menu-panel a small { font-weight: 400; margin-top: 1px; }
.menu-panel form {
  margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border);
}
.menu-panel form button { width: 100%; }

@media (max-width: 860px) {
  /* The divider and the push-right both stop making sense once the row wraps. */
  .nav-sep, .nav-spacer { display: none; }
  .topbar nav { gap: 6px; }
}

/* A duplicate is kept and labelled rather than hidden — the label links to
   the original. Amber rather than red: it is not an error, it is the same
   property legitimately advertised in more than one place. */
.pill-tag.dupe {
  border-color: var(--warn); color: var(--warn);
  text-decoration: none; cursor: pointer;
}
.pill-tag.dupe:hover { background: var(--warn); color: #fff; }
