:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #5b6472;
  --border: #e3e6eb;
  --brand: #1d3a5f;
  --brand-2: #2f6fed;
  --notice-bg: #fff8e6;
  --notice-border: #f0d98c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--brand);
  color: #fff;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.site-header .logo {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
}
.site-header nav a {
  color: #cfe0ff;
  text-decoration: none;
  font-size: 0.95rem;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 20px 0 8px;
}
.breadcrumb a { color: var(--muted); }

h1 {
  font-size: 1.7rem;
  margin: 0 0 12px;
  color: var(--brand);
}

.lede {
  color: var(--muted);
  max-width: 62ch;
}

.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 20px 0 28px;
  font-size: 0.92rem;
}
.notice a { color: var(--brand); }

.company-list {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.company-card h2 {
  font-size: 1.02rem;
  margin: 0 0 6px;
  color: var(--text);
}
.company-card .address {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 12px;
  min-height: 2.6em;
}
.verify-btn {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-2);
  text-decoration: none;
  border: 1px solid var(--brand-2);
  border-radius: 6px;
  padding: 6px 10px;
}
.verify-btn:hover { background: var(--brand-2); color: #fff; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 40px;
  font-size: 0.8rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer .legal-links { margin-top: 6px; }

.site-header nav a { margin-left: 16px; }
.site-header nav a:first-child { margin-left: 0; }

.content-page {
  max-width: 68ch;
  padding-bottom: 40px;
}
.content-page h2 {
  color: var(--brand);
  font-size: 1.15rem;
  margin: 32px 0 8px;
}
.content-page p, .content-page li {
  color: var(--text);
  font-size: 0.95rem;
}
.content-page ul { padding-left: 20px; }
.content-page a { color: var(--brand-2); }

.index-list {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  columns: 2;
  column-gap: 32px;
}
.index-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  break-inside: avoid;
}
.index-list a { color: var(--text); font-weight: 600; text-decoration: none; }
.index-list a:hover { color: var(--brand-2); }
.index-list .muted { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

@media (max-width: 600px) {
  .index-list { columns: 1; }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 0 0 44px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.pagination a {
  color: var(--brand-2);
  text-decoration: none;
  font-weight: 600;
}
.pagination a:hover { text-decoration: underline; }
.pagination .disabled { color: var(--border); font-weight: 600; }
.pagination .page-indicator { color: var(--muted); }

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.filter-chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.filter-chip .count { color: var(--muted); font-weight: 400; }
.filter-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.filter-chip.is-active .count { color: #cfe0ff; }
.filter-empty { color: var(--muted); font-size: 0.9rem; }

.category-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.category-tag.category-mortgage { background: #e2ecff; color: #1d3a8a; }
.category-tag.category-insurance { background: #e6f4ea; color: #1e6b3a; }
.category-tag.category-general { background: #f1eef7; color: #5a3d8a; }

@media (prefers-color-scheme: dark) {
  .category-tag.category-mortgage { background: #16233f; color: #a9c4ff; }
  .category-tag.category-insurance { background: #113322; color: #8fe0ac; }
  .category-tag.category-general { background: #241f38; color: #c9b7f2; }
}

/* Homepage */
.hero {
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 72px 0 56px;
}
.hero-inner { text-align: center; }
.hero h1 {
  font-size: 2.2rem;
  margin: 0 0 12px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero-sub {
  font-size: 1.05rem;
  margin: 0 0 28px;
  color: #f0f3f8;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}

.town-search {
  position: relative;
  max-width: 480px;
  margin: 0 auto 18px;
  display: flex;
  gap: 8px;
}
.town-search input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
}
.town-search button {
  font: inherit;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  background: var(--brand-2);
  color: #fff;
  cursor: pointer;
}
.town-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  list-style: none;
  margin: 0;
  padding: 6px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 5;
}
.town-search-results li a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}
.town-search-results li a:hover { background: var(--bg); }

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.quick-picks a {
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  text-decoration: none;
}
.quick-picks a:hover { background: rgba(255,255,255,.15); }

.trust-badges {
  list-style: none;
  margin: 40px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.trust-badges li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.trust-badges strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.trust-badges span { display: block; font-size: 0.82rem; color: var(--muted); }

.section-title { color: var(--brand); margin: 40px 0 4px; }
.section-sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 18px; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.featured-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
}
.featured-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.featured-card-body { padding: 12px 14px; }
.featured-card-body h3 { margin: 0 0 2px; font-size: 1.02rem; color: var(--text); }
.featured-card-body span { font-size: 0.85rem; color: var(--muted); }

.notice-callout { font-size: 0.95rem; }

.is-isnt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 36px 0 48px;
}
.is-isnt h2 { font-size: 1.05rem; color: var(--brand); margin: 0 0 10px; }
.is-isnt ul { margin: 0; padding-left: 20px; font-size: 0.92rem; color: var(--text); }
.is-isnt li { margin-bottom: 6px; }

.demand-table-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.demand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
}
.demand-table th, .demand-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.demand-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.demand-table tr:last-child td { border-bottom: none; }
.demand-table td:nth-child(2) { font-weight: 600; color: var(--brand-2); }

.faq-list { margin: 0 0 40px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 16px;
  margin-bottom: 10px;
}
.faq-item summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--brand-2);
  font-weight: 700;
}
.faq-item[open] summary::before { content: "\2212"; }
.faq-item p {
  margin: 0 0 14px 1.1em;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 65ch;
}

/* Broker profiles */
.company-card h2 a { color: inherit; text-decoration: none; }
.company-card h2 a:hover { color: var(--brand-2); text-decoration: underline; }

.profile-grid {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.profile-tile {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-2);
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.profile-tile:hover { border-color: var(--brand-2); }
.profile-tile strong { display: block; font-size: 0.95rem; }
.profile-tile span { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

.profile-head {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin: 8px 0 28px;
}
.profile-id { display: flex; gap: 16px; align-items: flex-start; }
.avatar {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #e2ecff;
  color: #1d3a8a;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.5rem;
}
.profile-id h1 { margin: 0 0 4px; font-size: 1.5rem; }
.profile-meta { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.contact-card {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.contact-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.contact-line { color: var(--text); font-weight: 600; text-decoration: none; }
.btn-primary {
  display: block;
  text-align: center;
  background: var(--brand-2);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 8px;
  padding: 10px 14px;
  overflow-wrap: anywhere;
}
.btn-primary:hover { filter: brightness(1.08); }

.profile-layout { display: grid; grid-template-columns: 1fr 280px; gap: 28px; }
.profile-main h2 { color: var(--brand); font-size: 1.15rem; margin: 0 0 8px; }
.profile-main > * + h2 { margin-top: 28px; }
.profile-main p { font-size: 0.93rem; }
.question-list { margin: 0; padding-left: 22px; font-size: 0.93rem; }
.question-list li { margin-bottom: 8px; }
.aside-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.aside-card h2 { font-size: 1rem; margin: 0 0 10px; color: var(--brand); }
.aside-card a { color: var(--brand-2); }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.link-list { list-style: none; margin: 0 0 10px; padding: 0; }
.link-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.notice-small { font-size: 0.82rem; color: var(--muted); margin: 32px 0 40px; }

@media (max-width: 760px) {
  .profile-head, .profile-layout { grid-template-columns: 1fr; }
}
@media (prefers-color-scheme: dark) {
  .avatar { background: #16233f; color: #a9c4ff; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141c;
    --surface: #171d29;
    --text: #e8ecf3;
    --muted: #9aa5b6;
    --border: #262e3d;
    --brand: #cfe0ff;
    --brand-2: #6ea1ff;
    --notice-bg: #2a2410;
    --notice-border: #5c4f1c;
  }
  .site-header { background: #0c1a2e; }
}

/* Company cards: age and published contact details */
.card-meta { margin: -6px 0 10px; font-size: 0.8rem; color: var(--muted); }
.card-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 12px; font-size: 0.85rem; }
.card-contact a { color: var(--brand-2); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.card-contact a:hover { text-decoration: underline; }
.confirmed-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e6f4ea;
  color: #1e6b3a;
}
@media (prefers-color-scheme: dark) {
  .confirmed-tag { background: #113322; color: #8fe0ac; }
}

/* Header logo and navigation */
.site-header .logo { display: inline-flex; align-items: center; gap: 10px; }
.site-header .logo img { display: block; width: 34px; height: 34px; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; }
.site-header nav a { margin-left: 0; }
@media (max-width: 680px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-header nav { justify-content: flex-start; }
}
.risk-warning { font-weight: 600; color: var(--text); margin: 0 0 6px; }
.town-links { list-style: none; padding: 0; margin: 0 0 40px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.9rem; }
.town-links a { color: var(--brand-2); font-weight: 600; text-decoration: none; }
.town-links a:hover { text-decoration: underline; }

/* Calculators */
.calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin: 18px 0 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.field-label { font-weight: 600; }
.field small { color: var(--muted); font-size: 0.78rem; }
.input-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.input-wrap input, .field select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
}
.field select { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.affix { padding: 0 10px; color: var(--muted); font-weight: 600; }
.field-check { flex-direction: row; align-items: center; align-self: end; gap: 8px; }
.calc-result { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand-2); border-radius: 12px; padding: 8px 18px; margin: 0 0 24px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.calc-row:last-child { border-bottom: 0; }
.calc-main strong { font-size: 1.35rem; color: var(--brand-2); }
.calc-note { color: var(--muted); font-size: 0.85rem; }
.calc-table { margin: 8px 0 12px; }
.tool-list { list-style: none; padding: 0; margin: 18px 0 8px; display: grid; gap: 12px; }
.tool-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tool-list a { font-weight: 700; color: var(--brand-2); text-decoration: none; }
.tool-list span { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

/* Guides */
.guide-date { font-size: 0.82rem; margin-top: -6px; }
.guide-towns { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 12px 0 28px; }
.guide-town { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 0.88rem; }
.guide-town h3 { margin: 0 0 6px; font-size: 0.98rem; }
.guide-town h3 a, .guide-town a { color: var(--brand-2); text-decoration: none; }

/* Activity tags on company cards */
.activity-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #eef1f5;
  color: #3b4656;
}
.activity-mortgage { background: #e2ecff; color: #1d3a8a; }
.activity-advice { background: #fff1dc; color: #7a4a00; }
.activity-insurance { background: #e6f4ea; color: #1e6b3a; }
.activity-business_finance { background: #e4f3f5; color: #1c5d66; }
.activity-lending, .activity-debt, .activity-claims { background: #f7ece4; color: #7a3f16; }
.activity-payments, .activity-tech { background: #f1eef7; color: #5a3d8a; }
.activity-investment { background: #eaf2e3; color: #3f5f1f; }
.activity-accountancy, .activity-property { background: #f3f1ea; color: #5c5230; }
@media (prefers-color-scheme: dark) {
  .activity-tag { background: #232a36; color: #c3cbd8; }
  .activity-mortgage { background: #16233f; color: #a9c4ff; }
  .activity-advice { background: #3a2a10; color: #f2c47a; }
  .activity-insurance { background: #113322; color: #8fe0ac; }
  .activity-business_finance { background: #103036; color: #8ad3dd; }
  .activity-lending, .activity-debt, .activity-claims { background: #3a2415; color: #f0b58c; }
  .activity-payments, .activity-tech { background: #241f38; color: #c9b7f2; }
  .activity-investment { background: #22301a; color: #b5d98f; }
  .activity-accountancy, .activity-property { background: #2f2c22; color: #d9ceaa; }
}

/* Local house prices on town pages */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 14px; }
.price-grid div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.price-grid span { display: block; font-size: 0.78rem; color: var(--muted); }
.price-grid strong { font-size: 1.05rem; color: var(--text); }
.data-source { font-size: 0.78rem; color: var(--muted); margin: 0 0 28px; max-width: 75ch; }

.tool-list-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* Evidence tags on town page cards */
.confirmed-tag.evidence-website_also { background: #fff1dc; color: #7a4a00; }
.confirmed-tag.evidence-name { background: #eef1f5; color: #3b4656; }
@media (prefers-color-scheme: dark) {
  .confirmed-tag.evidence-website_also { background: #3a2a10; color: #f2c47a; }
  .confirmed-tag.evidence-name { background: #232a36; color: #c3cbd8; }
}
