/* ==========================================================================
   AllSeeingOFSTED, Redesigned Stylesheet
   ========================================================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Source+Sans+3:wght@400;500;600&display=swap');

/* --- Custom Properties --- */
:root {
  /* Core palette */
  --navy:        #1a1f36;
  --navy-light:  #2d3352;
  --navy-muted:  #4a5072;
  --accent:      #c5922e;
  --accent-light:#f5e6c4;
  --accent-hover:#b38326;

  /* Judgement colours, Ofsted official tones */
  --outstanding:  #00703C;
  --good:         #2e8540;
  --ri:           #c44a09;
  --inadequate:   #c41e03;

  /* New framework descriptors */
  --exceptional:     #1e5298;
  --strong:          #1a5229;
  --expected:        #3b8c2a;
  --needs-attention: #c47325;
  --urgent:          #b02418;

  /* Neutrals */
  --white:        #ffffff;
  --off-white:    #f7f8fa;
  --gray-50:      #f1f3f6;
  --gray-100:     #e4e7ec;
  --gray-200:     #c8cdd6;
  --gray-400:     #8b95a5;
  --gray-500:     #6b7280;
  --gray-600:     #5b6478;
  --gray-800:     #2e3444;
  --black:        #111318;

  /* Layout */
  --container-max: 1180px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(26,31,54,.06);
  --shadow-md:  0 4px 12px rgba(26,31,54,.08);
  --shadow-lg:  0 8px 30px rgba(26,31,54,.10);
  --shadow-card:0 2px 8px rgba(26,31,54,.06);

  /* Typography scale */
  --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Source Sans 3', 'Roboto', -apple-system, sans-serif;
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base:1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.75rem;
}

/* --- Reset / Base --- */
*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-y: scroll;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--off-white);
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--navy);
  margin-top: 0;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color .15s ease;
}

img { max-width: 100%; height: auto; }

/* --- Container --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 12px 24px 32px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}

/* --- Header / Logo Bar --- */
.site-logo { margin: 0; }
.site-logo img {
  display: block;
  width: 140px;
  height: auto;
  max-width: 100%;
  transform: none;
}

/* --- Framework Toggle (segmented control) --- */
.fw-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  font: 500 13px/1.2 var(--font-display);
  background: var(--gray-100);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
}

.fw-label {
  user-select: none;
  color: var(--gray-500);
  font-size: var(--text-sm);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 150ms ease;
  position: relative;
  z-index: 1;
}

/* Active label: Old Framework (default, unchecked) */
.fw-label:first-child {
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.fw-label:last-child {
  background: transparent;
  color: var(--gray-500);
  font-weight: 500;
}

/* When checked: New Framework active */
.fw-toggle:has(input:checked) .fw-label:first-child {
  background: transparent;
  color: var(--gray-500);
  font-weight: 500;
  box-shadow: none;
}
.fw-toggle:has(input:checked) .fw-label:last-child {
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.fw-switch { position: relative; display: inline-block; width: 0; height: 0; overflow: hidden; }
.fw-switch input { opacity: 0; width: 0; height: 0; }

/* View hooks */
html[data-framework="legacy"] .view-new  { display: none !important; }
html[data-framework="new"]    .view-legacy { display: none !important; }
html[data-framework="schools"] .view-legacy { display: none !important; }

/* ==========================================================================
   HERO / FULL-WIDTH BOX (Homepage)
   ========================================================================== */

.full-width-box {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 48px 32px 36px;
  width: 100%;
  margin-bottom: 32px;
  border: none;
  position: relative;
  overflow: hidden;
}

/* Subtle top-right geometric accent */
.full-width-box::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(197,146,46,.12) 0%, transparent 70%);
  pointer-events: none;
}

.full-width-box h1 {
  color: var(--white);
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  margin: 0 0 12px 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-shadow: none;
}

.full-width-box h2 {
  color: var(--white);
  font-family: var(--font-display);
}

.full-width-box p {
  color: rgba(255,255,255,.85);
  font-size: var(--text-lg);
  margin: 0;
}

/* --- Hero Search --- */
.hero-search-wrap {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 28px 24px 20px;
  margin-top: 24px;
}

.hero-search-wrap h3 {
  color: var(--white) !important;
  text-align: center;
  margin-bottom: 16px;
  font-size: var(--text-xl);
  font-weight: 600;
}

#search {
  width: 100%;
  padding: 14px 48px 14px 20px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  border: 2px solid var(--gray-100);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: var(--white);
  box-sizing: border-box;
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(197,146,46,.15);
}

#search::placeholder {
  color: var(--gray-400);
  font-style: normal;
}

/* --- Hero Feature Cards (4-up) --- */
.hero-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}

.hero-feature-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  transition: background .2s;
}
.hero-feature-card:hover {
  background: rgba(255,255,255,.1);
}

.hero-feature-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(197,146,46,.2);
  border-radius: 50%;
}

.hero-feature-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-feature-card strong {
  display: block;
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.hero-feature-card small {
  color: rgba(255,255,255,.65);
  font-size: var(--text-xs);
}

/* --- AI Promo Banner --- */
.ai-promo-banner {
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy) 100%);
  border: 1px solid rgba(197,146,46,.25);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  margin: 24px 0 0;
  position: relative;
  overflow: hidden;
}

.ai-promo-banner::before { content: none; }

.ai-promo-banner h3 {
  color: var(--white);
  font-size: var(--text-xl);
  margin: 0 0 8px 0;
}

.ai-promo-banner p {
  color: rgba(255,255,255,.8);
  font-size: var(--text-sm);
}

.ai-new-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--navy);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
  animation: none;
}

.ai-badge-card {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--navy);
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 2;
}

.ai-promo-cta {
  display: inline-block;
  background: var(--accent);
  color: var(--navy);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  border: none;
  transition: background .2s;
  margin-top: 12px;
}
.ai-promo-cta:hover { background: var(--accent-hover); }

.ai-promo-cta.ai-promo-cta-blue,
.ai-promo-cta.ai-promo-cta-blue:visited {
  background: var(--navy);
  color: #fff !important;
}
.ai-promo-cta.ai-promo-cta-blue:hover {
  background: var(--navy-light);
  color: #fff !important;
}

.ai-promo-features {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.ai-promo-features span {
  color: rgba(255,255,255,.8);
  font-size: var(--text-sm);
}

.ai-promo-features span::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* --- AI Preview Section (Inspector page) --- */
.ai-preview-section {
  background: var(--off-white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 28px 0 20px;
  text-align: center;
}

.ai-preview-grid {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: 12px 48px;
  margin-top: 14px;
  text-align: left;
}

.ai-preview-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--navy);
}

.ai-preview-item::before,
.ai-preview-item span::before,
.ai-promo-banner span::before {
  content: none !important;
  display: none !important;
}

/* ==========================================================================
   CONTENT SECTIONS (below hero)
   ========================================================================== */

.content-section {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 36px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}

/* --- "How it works" steps --- */
.three-step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.step-card {
  text-align: center;
  padding: 24px 16px;
  background: var(--off-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  margin: 0 auto 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
}

.step-card h4 {
  font-size: var(--text-base);
  margin-bottom: 8px;
  color: var(--navy);
}

.step-card p {
  font-size: var(--text-sm);
  color: var(--gray-600);
  margin: 0;
}

/* --- Early Years Grid (2-col spread) --- */
.early-years-grid {
  width: 100%;
  padding: 0 16px;
}
.early-years-grid > div:last-child {
  text-align: right;
}
.early-years-grid > div:last-child ul {
  list-style-position: inside;
}

/* --- Stats bar --- */
.time-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  text-align: center;
}

.stat-item { padding: 12px; }

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--gray-600);
  margin-top: 4px;
}

/* --- Homepage features grid (5-up) --- */
.homepage-features {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.homepage-features h3 {
  font-size: var(--text-sm);
  margin-bottom: 6px;
}

.homepage-features h3 a { color: var(--navy); }
.homepage-features h3 a:hover { color: var(--accent); }

.homepage-features p {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0;
  line-height: 1.5;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

thead th {
  font-family: var(--font-display);
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  font-size: var(--text-sm);
  background: var(--navy);
  color: var(--white);
  border-bottom: none;
}

tbody td {
  font-family: var(--font-body);
  font-weight: 500;
  padding: 10px 12px;
  font-size: var(--text-sm);
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  background: var(--white);
  color: var(--gray-800);
}

tbody tr:hover td {
  background: var(--gray-50);
}

/* Remove green checkmark from all generic spans */
span::before {
  content: none;
  display: none;
}

/* Only add checkmarks where explicitly wanted */
.has-check::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--good);
  color: var(--white);
  border-radius: 50%;
  font-size: 11px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   TABLE WRAPPER — clip overflow, never scroll
   ========================================================================== */

.table-wrapper {
  -webkit-overflow-scrolling: touch;
  overflow: hidden;        /* CHANGED: was visible — clip instead of scroll */
  max-width: 100%;
  min-width: 0;
}

/* Also protect these wrappers if they sit in flex parents */
.recent-inspections-wrapper,
.view-new {
  min-width: 0;
  max-width: 100%;         /* ADDED: prevent blowout */
  overflow: hidden;         /* ADDED: clip any overhang */
}

/* ==========================================================================
   RECENT INSPECTIONS TABLE (NO SCROLL, NO CUTOFF)
   ========================================================================== */

.recent-inspections-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;       /* let browser size columns naturally */
}

.recent-inspections-table th,
.recent-inspections-table td {
  padding: 9px 10px;
  text-align: left;
  white-space: normal;       /* allow normal wrapping */
  word-break: normal;        /* DO NOT break every letter */
  overflow-wrap: normal;     /* DO NOT wrap anywhere */
}

/* Keep dates tidy */
.recent-inspections-table th:nth-child(1),
.recent-inspections-table td:nth-child(1),
.recent-inspections-table th:nth-child(2),
.recent-inspections-table td:nth-child(2) {
  white-space: nowrap;
  width: 92px;
}

/* Inspector name columns — NO min-width, let them size naturally */
.recent-inspections-table th:nth-child(3),
.recent-inspections-table td:nth-child(3),
.recent-inspections-table th:nth-child(4),
.recent-inspections-table td:nth-child(4) {
  /* min-width REMOVED — was 140-150px, caused overflow */
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Descriptor columns — NO min-width, can wrap */
.recent-inspections-table th:nth-child(5),
.recent-inspections-table td:nth-child(5),
.recent-inspections-table th:nth-child(6),
.recent-inspections-table td:nth-child(6) {
  /* min-width REMOVED — was 120-140px, caused overflow */
  text-align: center;
  font-size: 12px;
  padding: 8px 6px;
  line-height: 1.2;
  white-space: normal;
}

/* links */
.recent-inspections-table a {
  color: var(--navy);
  font-weight: 600;
}
.recent-inspections-table a:hover {
  color: var(--accent);
}

/* date-field helper */
.recent-inspections-table .date-field {
  white-space: nowrap;
}

/* ==========================================================================
   CARDS / GRID LAYOUT
   ========================================================================== */

.grid-container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
  overflow-x: hidden;
}

.stats-map-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
  align-items: flex-start;
}

.stats-map-wrapper .card {
  flex: 1 1 48%;
  min-width: 0;
}

.card {
  flex: 1 1 100%;
  min-width: 0;
  overflow: visible;
  align-self: stretch;
}

.card h2 {
  font-size: var(--text-xl);
  margin-top: 0;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-100);
}

.card * { white-space: normal !important; }

/* --- Stats section --- */
.stats {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 20px;
  flex: 1;
  width: 100%;
}

.stats h2, .map h2 {
  color: var(--navy);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: 16px;
}

.stats p, .map p {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
}

.stats p strong, .map p strong {
  color: var(--navy);
}

/* ==========================================================================
   REGIONAL STATS
   ========================================================================== */

.regional-stats { flex: 1; margin-top: 28px; }

.regions-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 14px;
  margin-top: 14px;
  width: 100%;
}

.region-box {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: box-shadow .2s;
  position: relative;
  overflow: hidden;
}

.region-box:hover { box-shadow: var(--shadow-md); }

.region-box span::before {
  content: none;
  display: none;
}

.region-box h3 {
  margin: 0 0 10px 0;
  color: var(--navy);
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
  font-weight: 600;
}

/* ==========================================================================
   INSPECTOR PAGE, Profile Header
   ========================================================================== */

.inspector-header {
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.inspector-header h1 {
  font-size: var(--text-3xl);
  color: var(--navy);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.inspector-subtitle {
  font-size: var(--text-sm);
  color: var(--gray-600);
  font-weight: 400;
}

.inspector-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.recency-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
}

.recency-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
}

.recency-badge.recent {
  background: #ecfdf5;
  color: #065f46;
}

.recency-badge.recent::before { background: #10b981; }

.recency-badge.activity {
  background: #eff6ff;
  color: #1e40af;
}

.recency-badge.activity::before { background: #3b82f6; }

/* --- Quick stats bar on inspector page --- */
.inspector-stats-bar {
  background: var(--off-white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 10px;
  margin: 16px 0 20px;
}

.inspector-stats-bar .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  text-align: center;
}

.inspector-stats-bar .stat-value {
  font-size: var(--text-3xl);
  color: var(--navy);
  font-weight: 700;
}

.inspector-stats-bar .stat-label {
  font-size: var(--text-xs);
  color: var(--gray-600);
}

/* ==========================================================================
   PACKAGE SELECTION / PRICING
   ========================================================================== */

.package-selection-container {
  background: var(--off-white);
  border: 1px solid var(--gray-100);
  padding: 28px 20px;
  border-radius: var(--radius-md);
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}

.package-title {
  color: var(--navy);
  text-align: center;
  font-size: var(--text-2xl);
  font-family: var(--font-display);
  margin-bottom: 6px;
  font-weight: 700;
}

.package-subtitle {
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 24px;
  font-size: var(--text-sm);
}

.package-options {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 900px;
}

.package-card {
  background: var(--white);
  padding: 24px 18px;
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  border: 2px solid var(--gray-100);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.package-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--navy);
}

.package-card.popular {
  border-color: var(--accent);
  border-width: 2px;
}

.package-card.popular:hover { transform: translateY(-4px); }

.popular-badge {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--navy);
  padding: 3px 14px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.package-card h4 {
  margin: 10px 0 6px;
  color: var(--navy);
  font-size: var(--text-lg);
  font-weight: 700;
}

.package-description {
  color: var(--gray-600);
  font-size: 13px;
  margin: 6px 0 14px;
  line-height: 1.5;
}

.package-price {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
  line-height: 1;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--navy);
}

.package-price::before {
  content: "£";
  font-size: 0.55em;
  margin-right: 2px;
  opacity: .6;
}

.select-package-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background .2s, transform .15s;
  width: 100%;
  margin-top: auto;
}

.select-package-btn:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
}

.package-card.popular .select-package-btn {
  background: var(--accent);
  color: var(--navy);
}
.package-card.popular .select-package-btn:hover {
  background: var(--accent-hover);
}

/* --- AI Package card (full-width) --- */
.package-card.ai-package {
  border-color: var(--accent) !important;
  border-width: 2px !important;
  background: var(--white) !important;
  animation: none;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 20px;
  text-align: left;
  min-height: auto;
  padding: 22px 28px;
}

.package-card.ai-package h4 { grid-column: 1; grid-row: 1; margin: 0; }
.package-card.ai-package .package-description { grid-column: 1; margin: 0; }
.package-card.ai-package .package-price { grid-column: 2; grid-row: 1 / 3; font-size: 40px; }
.package-card.ai-package .select-package-btn {
  grid-column: 3; grid-row: 1 / 3;
  background: var(--accent) !important;
  color: var(--navy) !important;
  width: auto;
  padding: 14px 28px;
  font-size: var(--text-sm);
}
.package-card.ai-package .select-package-btn:hover {
  background: var(--accent-hover) !important;
}

/* --- Unavailable packages --- */
.package-card.unavailable {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
  background: var(--gray-50);
}

.package-card.unavailable .select-package-btn { background: var(--gray-200); }

/* --- Voucher --- */
.voucher-section {
  background: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  text-align: center;
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 480px;
  margin: 0 auto 16px;
}

.voucher-title {
  color: var(--navy);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.voucher-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voucher-section .input-box-voucher {
  padding: 8px 14px;
  border: 2px solid var(--gray-100);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: border-color .2s;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 1px;
  background: var(--white);
  color: var(--gray-800);
  width: 160px;
}

.voucher-section .input-box-voucher:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(197,146,46,.1);
}

.voucher-info {
  margin: 0;
  font-size: 11px;
  color: var(--gray-400);
  flex-basis: 100%;
}

.package-card.loading { pointer-events: none; opacity: .5; }
.package-card.loading .select-package-btn { background: var(--gray-200); cursor: not-allowed; }

/* ==========================================================================
   COMPARISON / ANALYSIS TABLES
   ========================================================================== */

.comparison-grid {
  width: 100%;
  margin: 10px 0;
  padding: 0;
}

.comparison-box {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 16px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}

.comparison-table th {
  padding: 10px;
  font-size: var(--text-sm);
  text-align: left;
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
}

.comparison-table td {
  padding: 10px;
  font-size: var(--text-sm);
  text-align: left;
  border: 1px solid var(--gray-100);
  word-break: break-word;
  vertical-align: top;
  white-space: normal !important;
}

.comparison-table td:nth-child(4),
.comparison-table th:nth-child(4) {
  text-align: center;
  white-space: nowrap !important;
  width: 20% !important;
  font-size: 13px;
}

.comparison-table th:nth-child(1),
.comparison-table td:nth-child(1) { width: 50% !important; }

/* ==========================================================================
   INSPECTOR CARDS (Most Reserved / Most Generous)
   ========================================================================== */

.inspector-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 20px;
  margin-top: 24px;
}

.inspector-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MAP + RECENT INSPECTIONS (side-by-side on inspector page)
   ========================================================================== */

.map-inspections-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.inspections-col {
  flex: 1;
  min-width: 0;
  order: 1;
}

.map-col {
  flex: 0 1 380px;
  max-width: 425px;
  min-width: 320px;
}

.map-col h2 {
  font-size: 1.1rem;
  margin-top: 0;
}

.map-col .map-section img {
  width: 100%;
  height: auto;
}

.map-section {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.map-section img {
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
}

#map {
  width: 100%;
  height: 600px;
  border-radius: var(--radius-md);
}

.map-table-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.map-table-row > .map-table-col {
  flex: 1 1 0;
  min-width: 0;
}
.map-table-row > .map-table-col.map-col {
  flex: 0 0 40%;
  max-width: 40%;
}
.map-table-row > .map-table-col.table-col {
  flex: 1 1 60%;
}

/* ==========================================================================
   BACK BUTTON
   ========================================================================== */

.back-button {
  display: inline-flex;
  align-items: center;
  color: var(--navy);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color .2s;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
}

.back-button:hover {
  background: var(--gray-100);
  color: var(--accent);
}

.back-button svg {
  margin-right: 6px;
  width: 14px; height: 14px;
}

/* ==========================================================================
   SEARCH RESULTS
   ========================================================================== */

.search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.search-item {
  position: relative;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
  cursor: pointer;
  width: 170px;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sm);
}

.search-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.search-item-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ==========================================================================
   ALERT (recent report)
   ========================================================================== */

.alert {
  background: #fef3cd;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  color: #856404;
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ==========================================================================
   FAQ ACCORDION
   ========================================================================== */

.faq-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}

.faq-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--navy);
  margin: 0 0 14px;
  font-weight: 600;
}

.faq-item {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--white);
  overflow: hidden;
  padding: 5px;
}

.faq-item:first-of-type { margin-top: 12px; }

.faq-item summary {
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background .15s ease;
}

.faq-item summary:hover { background: var(--off-white); }

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--gray-400);
  transition: transform .2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.faq-item[open] summary::after {
  content: "−";
  color: var(--accent);
}

.faq-item[open] summary { border-bottom: 1px solid var(--gray-100); }

.faq-item p {
  padding: 14px 16px;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.6;
}

/* ==========================================================================
   TRUST BLOCK
   ========================================================================== */

.trust-block {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 20px;
  margin-top: 32px;
  text-align: center;
  color: var(--gray-400);
  font-size: 12px;
}

.trust-block span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trust-block span::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--gray-200);
  border-radius: 50%;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
  background: var(--navy);
  color: var(--white);
  padding: 32px 20px;
  margin-top: 40px;
  text-align: center;
}

footer a {
  color: var(--accent-light);
  text-decoration: underline;
}

footer a:hover { color: var(--accent); }

/* ==========================================================================
   GRADE BADGES (New Framework)
   ========================================================================== */

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.2;
  text-align: center;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

.desktop-table-view { display: block; }
.mobile-card-view   { display: none; }

@media (max-width: 1200px) {
  .homepage-features { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 1024px) {
  .regions-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .stats-map-wrapper { flex-direction: column; }
  .stats-map-wrapper .card { flex: 1 1 100%; }

  .map-table-row { flex-direction: column; }
  .map-table-row > .map-table-col.map-col { flex: 1 1 100%; max-width: 100%; }
  .map-table-row > .map-table-col.table-col { flex: 1 1 100%; }

  /* Hide the "Inspection" date column on tablet */
  .recent-inspections-table .hide-tablet { display: none !important; }

  .recent-inspections-table th:nth-child(2),
  .recent-inspections-table td:nth-child(2) {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .homepage-features { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 860px) {
  /* Hide joint inspector column */
  .recent-inspections-table th:nth-child(4),
  .recent-inspections-table td:nth-child(4) {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .container { padding: 10px 14px 20px; }

  .full-width-box { padding: 32px 18px 24px; }
  .full-width-box h1 { font-size: var(--text-3xl) !important; }
  .full-width-box p { font-size: var(--text-base) !important; }

  .hero-features { grid-template-columns: repeat(2, 1fr); }

  .three-step-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .time-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .package-options  { grid-template-columns: 1fr; gap: 12px; }

  .package-card.ai-package {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }
  .package-card.ai-package h4,
  .package-card.ai-package .package-description,
  .package-card.ai-package .package-price,
  .package-card.ai-package .select-package-btn {
    grid-column: 1; grid-row: auto;
  }
  .package-card.ai-package .select-package-btn { width: 100%; }

  .stats-map-wrapper {
    flex-direction: column;
    gap: 16px !important;
  }
  .stats-map-wrapper .card { flex: none !important; }

  .regions-grid { grid-template-columns: 1fr !important; }

  .inspector-cards-grid { grid-template-columns: 1fr !important; }

  .ai-preview-grid { grid-template-columns: 1fr; }

  .map-inspections-row { flex-direction: column; }
  .map-col { flex: none; max-width: 100%; }

  .desktop-table-view { display: none !important; }
  .mobile-card-view   { display: block !important; }

  .regional-stats { margin-top: 0 !important; }

  /* Recent inspections mobile cards */
  .recent-inspections-table thead { display: none; }
  .recent-inspections-table tbody {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .recent-inspections-table tbody tr {
    display: block;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: 12px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
  }
  .recent-inspections-table td {
    display: block;
    padding: 4px 0;
    border: none;
    font-size: 13px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .recent-inspections-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: var(--gray-400);
    font-size: 11px;
    margin-bottom: 2px;
    text-transform: uppercase;
  }
  .recent-inspections-table td.empty-field { display: none; }
  .recent-inspections-table td[data-label="Judgement"]::before { display: none; }
  .recent-inspections-table td[data-label="Judgement"] {
    margin-top: 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    padding: 6px;
  }

  .early-years-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 760px) {
  .recent-inspections-table th,
  .recent-inspections-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 600px) {
  .homepage-features { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .full-width-box h1 { font-size: 1.65rem !important; }
  .hero-features { grid-template-columns: 1fr; }
  .time-stats-grid { grid-template-columns: 1fr !important; }
  .recent-inspections-table tbody { grid-template-columns: 1fr !important; }
}

/* Touch-friendly */
@media (pointer: coarse) {
  .select-package-btn { min-height: 44px; }
}

@media (hover: none) {
  .package-card:hover { transform: none; box-shadow: none; }
}

/* ==========================================================================
   LAZY LOAD
   ========================================================================== */

[data-lazy-load] {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/* Mobile stacked bars for region stats */
.region-stacked-bar { display: none; }
.region-stats-compact { display: block; }

@media (max-width: 768px) {
  .region-stats-compact { display: none; }
  .region-stacked-bar { display: block; margin-bottom: 12px; }

  .stacked-bar-container {
    height: 36px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    margin-bottom: 8px;
  }

  .stacked-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 10px;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
  }

  .seg-outstanding     { background: var(--outstanding); }
  .seg-good            { background: var(--good); }
  .seg-requires-improvement { background: var(--ri); }
  .seg-inadequate      { background: var(--inadequate); }

  .stacked-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 10px;
  }

  .legend-item { display: flex; align-items: center; gap: 3px; white-space: nowrap; }

  .legend-color {
    width: 10px; height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   MISC / OVERRIDES
   ========================================================================== */

/* Kill leftover Foundry font references, DM Sans takes over */
.full-width-box h1,
.fonts-loaded .full-width-box h1 {
  font-family: var(--font-display) !important;
}

/* Noticeboxes */
.notice-box {
  background: var(--off-white);
  border: 1px solid var(--gray-100);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 12px 0;
  font-size: var(--text-sm);
  color: var(--gray-800);
}

/* Input styling */
.input-box-voucher {
  background: var(--white);
  color: var(--gray-800);
  padding: 10px 16px;
  border: 2px solid var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  outline: none;
  transition: border-color .2s;
}
.input-box-voucher:focus { border-color: var(--accent); }

/* Print */
@media print {
  .full-width-box { background: var(--white) !important; color: var(--black) !important; }
  .full-width-box h1, .full-width-box p { color: var(--black) !important; }
  .container { box-shadow: none; }
  footer { display: none; }
}

.blurred-content {
  filter: blur(5px);
  pointer-events: none;   /* prevents interaction */
  user-select: none;       /* prevents copy/paste */
}

/* Clickable row hint */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #f0f4ff; }

/* Overlay */
.inspection-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Popup card */
.inspection-popup {
    background: #fff;
    border-radius: 14px;
    max-width: 480px;
    width: 100%;
    padding: 28px 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: popIn 0.2s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes popIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.popup-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}
.popup-close:hover { color: #333; }

/* Header */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 18px;
    gap: 12px;
}
.popup-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1a1a2e;
}
.popup-date {
    font-size: 13px;
    color: #777;
    white-space: nowrap;
}

/* Labels */
.popup-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
    margin: 0 0 10px 0;
    font-weight: 600;
}

/* Grade pills */
.grade-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}
.grade-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* Grading rows (unlocked) */
.grading-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.grading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}
.grading-area {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}
.grading-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
}

/* Locked/blurred section */
.popup-detail-locked {
    position: relative;
    margin-bottom: 20px;
}
.locked-blur {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.locked-blur .grading-badge {
    background: #ccc;
    color: #ccc;
}
.locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #555;
    gap: 8px;
}
.locked-overlay p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    max-width: 260px;
    line-height: 1.4;
}

/* CTA Button */
.popup-cta {
    text-align: center;
}
.btn-inspector-report {
    display: inline-block;
    padding: 14px 28px;
    background: rgb(247, 248, 250);
    border: 2px solid rgb(197, 146, 46);
    color: #5b6478;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-inspector-report:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px #fff;
}
.price-tag {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    font-size: 13px;
}

button.btn-inspector-report {
    cursor: pointer;
    font-family: inherit;
}