.row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  animation: rowFadeIn 0.3s ease-out both;
}

.row:hover {
  box-shadow: 0 2px 8px rgba(var(--shadow-rgb), 0.06);
}

/* Phase border colours */
.phaseSecondary  { border-left-color: var(--phase-secondary); }
.phaseAllThrough { border-left-color: var(--phase-all-through); }
.phasePost16     { border-left-color: var(--phase-post16); }

.rowInCompare {
  border-left-color: var(--brand);
  background: var(--bg-secondary);
}

@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Left content column ─────────────────────────────── */
.rowContent {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Line 1: name + ofsted */
.line1 {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  min-width: 0;
}

.schoolName {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.schoolName:hover {
  color: var(--brand);
}

/* Line 2: context tags */
.line2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Quiet chip — one shared size/weight for every attribute (Ages, type, etc.);
   the phase pill keeps its colour but matches this sizing. */
.attr {
  display: inline-block;
  padding: 0.0625rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 4px;
  white-space: nowrap;
  background: rgba(var(--shadow-rgb), 0.05);
  color: var(--text-secondary);
}

/* Line 3: KS4 stats */
.line3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.statValueLarge {
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.statValue {
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.statLabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.delta {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.deltaPositive { color: var(--status-above); }
.deltaNegative { color: var(--status-below); }

/* Line 4: location + distance */
.line4 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.line4 span:not(:last-child)::after {
  content: '·';
  margin: 0 0.4rem;
  color: var(--border);
}

.distanceBadge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--brand);
  color: var(--brand-on);
  border-radius: 3px;
}

/* Phase label pill */
.phaseLabel {
  display: inline-block;
  padding: 0.0625rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 4px;
  white-space: nowrap;
}

.phaseLabelSecondary  { background: var(--phase-secondary-bg); color: var(--phase-secondary-text); }
.phaseLabelAllThrough { background: var(--phase-all-through-bg); color: var(--phase-all-through-text); }
.phaseLabelPost16     { background: var(--phase-post16-bg); color: var(--phase-post16-text); }

.provisionTag {
  display: inline-block;
  padding: 0.0625rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  background: rgba(var(--shadow-rgb), 0.05);
  color: var(--text-secondary);
  border-radius: 4px;
  white-space: nowrap;
}

.selectiveTag {
  background: rgba(var(--status-below-rgb), 0.1);
  color: var(--status-below);
}

/* ── Ofsted badge ────────────────────────────────────── */
.ofstedBadge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.ofstedDate {
  font-weight: 400;
}

.ofsted1 { background: var(--status-above-bg); color: var(--status-above); }
.ofsted2 { background: rgba(var(--status-above-rgb), 0.12); color: var(--status-above); }
.ofsted3 { background: var(--status-below-bg); color: var(--status-below); }
.ofsted4 { background: var(--status-below); color: var(--text-inverse); }

/* ── Ofsted badge variants ──────────────────────────────────────────────── */
.ofstedRc      { background: var(--phase-secondary-text); color: var(--text-inverse); }
/* Inspected but with no overall grade (OEIF post-Sept-2024) — neutral slate,
   distinct from the grey "Not yet inspected" pending state. */
.ofstedInspected { background: var(--phase-primary-bg); color: var(--phase-primary-text); }
.ofstedPending { background: var(--border); color: var(--text-muted); }

/* ── Right actions column ────────────────────────────── */
.rowActions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rowActions > * {
  height: 2rem;
  line-height: 1;
  font-family: inherit;
  box-sizing: border-box;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .row {
    flex-wrap: wrap;
    padding: 0.875rem;
    gap: 0.625rem;
  }

  .rowContent {
    flex-basis: 100%;
  }

  .schoolName {
    white-space: normal;
  }

  /* Promote the headline metric (Attainment 8) onto its own line so
     the secondary stats — delta vs LA, pupils — wrap below it with
     visible row gap instead of crowding the same row. */
  .line3 {
    row-gap: 0.25rem;
    column-gap: 1rem;
  }
  .line3 > .stat:first-child {
    flex-basis: 100%;
  }

  .rowActions {
    width: 100%;
    gap: 0.375rem;
  }

  .rowActions > * {
    flex: 1;
    justify-content: center;
  }
}

.closingTag {
  background: var(--status-below-bg);
  color: var(--status-below);
  border: 1px solid var(--status-below-bg);
}
