:root {
  --lab: #e4003b;
  --con: #00adef;
  --ld: #ff6400;
  --ruk: #13bfd7;
  --green: #00a85a;
  --snp: #fff685;
  --pc: #005b54;
  --others: #626a6e;
  --brand: #006548;
  --app-font: "Barlow", Arial, sans-serif;
}

.app-body {
  background: #f3f2f1;
  font-family: var(--app-font);
}

[hidden] { display: none !important; }

/* Include GOV.UK components, form controls and SVG chart labels in the site's
   typography. Component-specific sizes and weights retain their existing rules. */
.app-body * {
  font-family: var(--app-font);
}

.app-brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
}

.app-brand__logo {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex: 0 0 auto;
}

.govuk-service-navigation__container {
  align-items: center;
}

.govuk-service-navigation__service-name {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.govuk-service-navigation__list {
  align-items: center;
}

.govuk-service-navigation__link[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.app-nav-refresh {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

html:not([data-page="projection"]) .app-view--projection:not(.app-view--map),
html:not([data-page="polls"]) .app-view--polls,
html:not([data-page="seats"]) .app-view--seats,
html[data-page="polls"] .app-balanced-row,
html[data-page="seats"] .app-balanced-row,
html[data-page="projection"] .app-map-column {
  display: none !important;
}

html[data-page="projection"] .app-balanced-row,
html[data-page="map"] .app-balanced-row {
  grid-template-columns: minmax(0, 1fr);
}

.app-hero {
  border-bottom: 10px solid #1d70b8;
  background: #0b0c0c;
  color: #ffffff;
  padding: 20px 0 16px;
}

.app-hero .govuk-caption-l,
.app-hero .govuk-heading-xl,
.app-hero .govuk-body-l,
.app-hero .govuk-body,
.app-hero .app-commons-majority-copy {
  color: #ffffff;
}

.app-hero .govuk-heading-xl {
  max-width: 780px;
  font-size: clamp(2.35rem, 4.05vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.025em;
}

.app-hero--commons .app-section__heading {
  display: block;
  text-align: center;
  margin-bottom: 24px;
}

.app-hero--commons h1 {
  margin-left: auto;
  margin-right: auto;
}

.app-hero--commons #commons-strip-summary {
  margin-top: 14px;
}

.app-hero__layout {
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.95fr);
  align-items: end;
}

.app-top-stats {
  display: grid;
  gap: 15px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-top-stats .app-top-stat:last-child {
  grid-column: 1 / -1;
}

.app-refresh-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #1d70b8;
  padding: 4px 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-refresh-control:hover {
  color: #003078;
}

.app-refresh-control:focus-visible {
  outline: 3px solid #ffdd00;
  background: #ffdd00;
  color: #0b0c0c;
  text-decoration: none;
}

.app-refresh-control:disabled {
  color: #505a5f;
  cursor: wait;
}

.app-top-stat {
  border: 1px solid #b1b4b6;
  border-left: 5px solid #006548;
  background: #ffffff;
  padding: 12px 16px;
  min-width: 0;
}

.app-stat-label {
  display: block;
  margin-bottom: 4px;
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 700;
}

.app-stat-value {
  display: block;
  color: #0b0c0c;
  font-family: var(--app-font);
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.05;
  font-weight: 700;
}

.app-stat-value--compact {
  font-size: clamp(1.1rem, 1.5vw, 1.45rem);
  line-height: 1.15;
}

.app-stat-note {
  display: block;
  margin-top: 6px;
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
}

.app-status {
  margin-top: 30px;
}

.app-what-this-means {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid #b1b4b6;
  border-top: 0;
  background: #ffffff;
  padding: 20px 24px;
  margin-bottom: 30px;
}



.app-seat-range {
  display: block;
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 700;
}


.app-section {
  border: 1px solid #b1b4b6;
  background: #ffffff;
  padding: 30px;
  margin-bottom: 30px;
}

.app-section--tight {
  height: 100%;
}

.app-section__heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.app-section__heading--tight {
  margin-bottom: 14px;
}

.app-section-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.app-map-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2fr);
  grid-template-areas: "controls map" "info info";
  gap: 24px;
  align-items: start;
}

.app-map-sidebar {
  grid-area: controls;
  min-width: 0;
}

.app-commons-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "lead majority trail";
  align-items: end;
  margin: 2px 0 8px;
}

.app-commons-party--lead {
  grid-area: lead;
}

.app-commons-majority-copy {
  grid-area: majority;
}

.app-commons-party--trail {
  grid-area: trail;
}

.app-commons-party {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.app-commons-party--trail {
  justify-content: flex-end;
  text-align: right;
}


.app-commons-party__name {
  font-family: var(--app-font);
  font-size: 1.1875rem;
  line-height: 1.25;
  font-weight: 400;
}

.app-commons-party__value {
  font-family: var(--app-font);
  font-size: clamp(2.15rem, 4vw, 4rem);
  line-height: 0.95;
  font-weight: 700;
}

.app-hero .app-seat-range {
  color: #f3f2f1;
  flex-basis: 100%;
}

.app-commons-majority-copy {
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.3;
  color: #505a5f;
  text-align: center;
  white-space: nowrap;
}

.app-commons-bar-shell {
  position: relative;
  padding: 31px 0 6px;
}

.app-commons-majority-marker {
  position: absolute;
  top: 30px;
  bottom: 5px;
  left: calc((326 / 650) * 100%);
  width: 3px;
  transform: translateX(-50%);
  background: #ffffff;
  box-shadow: 0 0 0 1px #0b0c0c;
  z-index: 2;
}

.app-commons-majority-marker::before {
  content: "326";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 3px;
  background: #ffffff;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.15;
  font-weight: 700;
  color: #0b0c0c;
}

.app-commons-majority-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #ffffff;
}

.app-commons-bar {
  display: flex;
  height: 26px;
  border: 1px solid #0b0c0c;
  background: #f3f2f1;
  overflow: hidden;
}

.app-hero--commons .app-commons-bar {
  border-color: #ffffff;
}

.app-commons-segment {
  box-sizing: border-box;
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-family: var(--app-font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.app-commons-segment__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-commons-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 8px;
}

.app-commons-legend-item {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: #ffffff;
  margin-bottom: 0;
  white-space: nowrap;
  line-height: 1.2;
}

.app-commons-legend .app-chart-swatch {
  border-color: #ffffff;
}

.app-map-toggle {
  padding-bottom: 10px;
}

.app-map-stage {
  grid-area: map;
  min-width: 0;
  position: relative;
  border: 1px solid #b1b4b6;
  background: #ffffff;
  padding: 16px;
}

#constituency-map {
  width: 100%;
  height: min(84vh, 980px);
}

.constituency {
  stroke: #505a5f;
  stroke-width: 0.45;
  transition:
    fill 120ms ease,
    stroke-width 120ms ease;
}

.constituency:hover,
.constituency.is-selected {
  stroke: #0b0c0c;
  stroke-width: 1.15;
}

.app-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 16px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.legend-chip__swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #0b0c0c;
}

.app-card {
  border: 1px solid #b1b4b6;
  background: #f8f8f8;
}

.app-card--padded {
  padding: 20px;
}

.app-balanced-row {
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: stretch;
  margin-right: 0;
  margin-bottom: 30px;
  margin-left: 0;
}

.app-balanced-row > [class*="govuk-grid-column"] {
  float: none;
  width: auto;
  padding-right: 0;
  padding-left: 0;
}

.app-balanced-row .app-section {
  box-sizing: border-box;
  height: 100%;
  margin-bottom: 0;
}

.app-analysis-stack {
  display: grid;
  gap: 30px;
  margin-bottom: 30px;
}

.app-analysis-stack .app-section {
  box-sizing: border-box;
  margin-bottom: 0;
}

.app-majority-note {
  border: 1px solid #b1b4b6;
  background: #f3f2f1;
  padding: 8px 12px;
}

.app-government-assumptions {
  border-left: 5px solid #006548;
  background: #f3f2f1;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.app-government-paths {
  display: grid;
  gap: 12px;
}

.app-government-path {
  border-top: 1px solid #b1b4b6;
  padding-top: 16px;
  padding-bottom: 6px;
}

.app-government-path:first-child {
  border-top: 0;
  padding-top: 0;
}

.app-government-path__main {
  min-width: 0;
}

.app-government-path__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.app-government-path__title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  line-height: 1.25;
}

.app-coalition-plus {
  font-weight: 700;
}

.app-government-path__group {
  display: inline-block;
  margin-bottom: 4px;
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.2;
  font-weight: 700;
}

.app-government-path__seats {
  font-family: var(--app-font);
  font-size: 1.25rem;
  line-height: 1.1;
  white-space: nowrap;
}

.app-government-path__bar {
  position: relative;
  height: 20px;
  border: 1px solid #505a5f;
  background: #f3f2f1;
}

.app-government-path__fill {
  display: flex;
  height: 100%;
  width: 100%;
}

.app-government-path__fill span {
  display: block;
  height: 100%;
}

.app-government-path__marker {
  position: absolute;
  left: calc((326 / 650) * 100%);
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: #0b0c0c;
  box-shadow: 0 0 0 1px #ffffff;
}

.app-government-path__marker::before {
  content: "326";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  color: #0b0c0c;
  font-family: var(--app-font);
  font-size: 0.75rem;
  font-weight: 700;
}

.app-method-flow {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.app-method-flow li {
  position: relative;
  border: 1px solid #b1b4b6;
  background: #f3f2f1;
  padding: 9px 12px;
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
}

.app-method-flow li:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 12px;
  bottom: -17px;
  color: #006548;
  font-weight: 700;
}

.app-method-flow-card {
  display: flex;
  flex-direction: column;
}

.app-method-collapse,
.app-chart-method-details {
  margin-bottom: 16px;
}

.app-method-collapse .govuk-details__summary,
.app-chart-method-details .govuk-details__summary {
  font-family: var(--app-font);
  font-weight: 700;
}

.app-method-detail {
  border-top: 1px solid #b1b4b6;
  margin-top: 18px;
  padding-top: 16px;
}

.app-method-detail--warning {
  border-left: 5px solid #006548;
  border-top: 0;
  background: #f3f2f1;
  margin-top: auto;
  padding: 14px 14px 14px 16px;
}

.app-method-audit {
  border-top: 1px solid #b1b4b6;
  margin-top: 18px;
  padding-top: 16px;
}

.app-method-plain {
  border-left: 5px solid #006548;
  background: #f3f2f1;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.app-audit-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.app-audit-list div {
  border-left: 4px solid #006548;
  background: #f3f2f1;
  padding: 8px 10px;
}

.app-audit-list dt {
  color: #0b0c0c;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 700;
}

.app-audit-list dd {
  margin: 2px 0 0;
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.35;
}

.app-method-poll-window {
  border: 1px solid #b1b4b6;
}

.app-method-poll-window .govuk-table__header,
.app-method-poll-window .govuk-table__cell {
  font-size: 0.875rem;
  line-height: 1.3;
}

.app-inspector-tag {
  display: inline-flex;
  margin-bottom: 15px;
}

.app-muted {
  color: #505a5f;
}

.app-summary-list {
  margin-bottom: 20px;
}

.app-summary-list .govuk-summary-list__key,
.app-summary-list .govuk-summary-list__value {
  font-size: 1rem;
}

.app-map-inspector[hidden] {
  display: none;
}

.app-share-stack,
.app-source-list {
  display: grid;
  gap: 14px;
}

.app-share-row,
.app-poll-row {
  display: grid;
  gap: 6px;
}

.app-share-heading {
  font-weight: 700;
  margin: 0 0 10px;
}

.app-share-row__top,
.app-leader-metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.app-share-row__label,
.app-poll-party,
.app-seat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-track,
.app-share-row__track {
  height: 12px;
  border: 1px solid #b1b4b6;
  background: #f3f2f1;
}

.app-fill,
.app-share-row__fill {
  height: 100%;
}


.app-breakdown-list {
  display: grid;
  gap: 8px;
}

.app-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-left: 4px solid #626a6e;
  background: #f3f2f1;
  padding: 7px 10px;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
}

.app-seat-waffle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12px, 12px));
  grid-auto-rows: 12px;
  width: 100%;
  justify-content: space-between;
  gap: 4px;
  overflow: hidden;
}

.app-seat-cell {
  width: 12px;
  height: 12px;
  border: 1px solid #ffffff;
  box-sizing: border-box;
}

.app-majority-line {
  position: relative;
  height: 12px;
  border: 1px solid #b1b4b6;
  background: #f3f2f1;
}

.app-majority-line span {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: calc((326 / 650) * 100%);
  width: 2px;
  background: #0b0c0c;
}

.app-tag {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border: 0;
  color: #ffffff;
  letter-spacing: 0;
}

.app-tag--lab {
  background: var(--lab);
}

.app-tag--con {
  background: var(--con);
  color: #0b0c0c;
}

.app-tag--ld {
  background: var(--ld);
  color: #0b0c0c;
}

.app-tag--ruk {
  background: var(--ruk);
  color: #0b0c0c;
}

.app-tag--green {
  background: var(--green);
  color: #0b0c0c;
}

.app-tag--snp {
  background: var(--snp);
  color: #0b0c0c;
}

.app-tag--pc {
  background: var(--pc);
}

.app-tag--others {
  background: #626a6e;
}

.app-tag-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid #0b0c0c;
  background: currentColor;
}

.app-party-name {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  vertical-align: middle;
}

.app-party-name--inline {
  margin-right: 2px;
}

.app-party-name__text {
  min-width: 0;
}

.app-party-logo {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 1px solid #b1b4b6;
  background: #ffffff;
  object-fit: contain;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.app-party-logo--tag {
  width: 18px;
  height: 18px;
  border: 0;
}

.app-commons-party__name .app-party-logo {
  width: 30px;
  height: 30px;
}

.app-commons-legend .app-party-logo,
.app-chart-legend .app-party-logo,
.legend-chip .app-party-logo,
.govuk-table .app-party-logo {
  width: 18px;
  height: 18px;
}

.app-leader-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.app-leader-card {
  border: 1px solid #b1b4b6;
  background: #ffffff;
}

.app-leader-media,
.app-leader-media--double {
  position: relative;
  background: #f3f2f1;
}

.app-leader-stamp {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  border: 2px solid #ffffff;
  border-radius: 3px;
  background: #006548;
  color: #ffffff;
  padding: 6px 9px;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.app-leader-standing {
  display: table;
  margin-bottom: 10px;
  border-left: 4px solid #006548;
  background: #e8f3ee;
  padding: 5px 8px;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.2;
  font-weight: 700;
}

.app-leader-media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}

.app-leader-placeholder {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--app-font);
  font-size: 3rem;
  line-height: 1;
  font-weight: 700;
  color: #505a5f;
}

.app-leader-media--double {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-leader-copy {
  padding: 20px;
}

.app-poll-row {
  border-top: 1px solid #b1b4b6;
  padding-top: 14px;
}

.app-poll-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.app-chart-panel {
  border: 1px solid #b1b4b6;
  background: #ffffff;
  padding: 10px 10px 0;
  margin-bottom: 15px;
}

.app-section--polls .app-chart-panel {
  margin-top: 20px;
}

#poll-chart {
  width: 100%;
  height: 480px;
}

.app-chart-grid {
  stroke: #d8dbdc;
  stroke-width: 1;
}

.app-chart-axis {
  stroke: #505a5f;
  stroke-width: 1;
}

.app-chart-label {
  font-family: var(--app-font);
  font-size: 14px;
  fill: #505a5f;
}

.app-chart-series {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-chart-dot {
  opacity: 0.35;
}

.app-chart-dot:hover,
.app-chart-dot:focus {
  opacity: 1;
  outline: 2px solid #0b0c0c;
  outline-offset: 2px;
}

.app-chart-dot:focus {
  stroke: #0b0c0c;
  stroke-width: 3px;
  r: 6px;
}

.app-map-zoom-controls, .app-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.app-map-zoom-controls .govuk-button { margin-bottom: 12px; }
.app-close-seats { margin: 24px 0; padding: 20px; border-left: 5px solid #006548; background: #f3f2f1; }
.app-footer-links { border-top: 1px solid #b1b4b6; padding-top: 20px; margin-top: 24px; }
.app-legal-content { max-width: 48rem; }

.app-chart-marker {
  stroke: #505a5f;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.app-chart-legend,
.app-poll-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 15px;
}

.app-chart-legend {
  margin-bottom: 15px;
}

.app-chart-legend-item,
.app-poll-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-chart-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #0b0c0c;
}

.app-chart-swatch--key {
  flex: 0 0 auto;
}

.app-poll-top {
  display: grid;
  gap: 12px;
  align-items: center;
  grid-template-columns: minmax(130px, 1fr) minmax(0, 1.4fr) auto auto;
}

.app-poll-value,
.app-poll-delta {
  white-space: nowrap;
}

.app-poll-delta.is-up {
  color: #00703c;
}

.app-poll-delta.is-down {
  color: #d4351c;
}

.app-poll-sparkline {
  width: 100%;
  height: 32px;
}

.app-raw-polls {
  margin-top: 20px;
  margin-bottom: 0;
}

.app-source-list {
  display: grid;
  gap: 16px 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.app-source-item {
  margin: 0;
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.45;
}

.app-method-panel .govuk-inset-text {
  margin-bottom: 0;
}

.app-footer {
  border-top: 10px solid #1d70b8;
  background: #f3f2f1;
  padding: 32px 0 40px;
}

.app-footer__top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.app-footer .govuk-caption-m,
.app-footer .govuk-heading-m,
.app-footer .govuk-link {
  font-family: var(--app-font);
}

.app-controls {
  margin-bottom: 20px;
}

.app-empty-state {
  border: 1px solid #b1b4b6;
  border-left: 5px solid #d4351c;
  background: #f3f2f1;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.app-table-wrap {
  overflow: auto;
}

.app-seat-table {
  margin-bottom: 0;
}

.app-seat-table tbody tr:hover,
.app-seat-table tbody tr.is-selected {
  background: #f3f2f1;
}

.app-seat-expand {
  border: 0;
  background: none;
  padding: 0;
  color: #1d70b8;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.app-seat-expand:hover {
  color: #003078;
}

.app-seat-expand:focus-visible {
  outline: 3px solid #ffdd00;
  background: #ffdd00;
  color: #0b0c0c;
  text-decoration: none;
}

.app-seat-expand span {
  display: inline-block;
  margin-left: 4px;
}

.app-seat-expanded-row > td {
  background: #f3f2f1;
  padding: 16px 20px;
}

.app-seat-expanded-content {
  max-width: 560px;
}

.app-seat-card__detail {
  border-top: 1px solid #b1b4b6;
  margin-top: 16px;
  padding-top: 16px;
}

.app-seat-cards {
  display: none;
}

.app-seat-card {
  border: 1px solid #b1b4b6;
  border-left: 5px solid #006548;
  background: #ffffff;
  padding: 16px;
  cursor: pointer;
}

.app-seat-card + .app-seat-card {
  margin-top: 12px;
}

.app-seat-card:hover,
.app-seat-card.is-selected {
  background: #f3f2f1;
}

.app-seat-card__top {
  margin-bottom: 12px;
}

.app-seat-card__facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.app-seat-card__facts div {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(96px, 0.6fr) minmax(0, 1fr);
  border-top: 1px solid #b1b4b6;
  padding-top: 10px;
}

.app-seat-card__facts dt {
  color: #505a5f;
  font-family: var(--app-font);
  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 700;
}

.app-seat-card__facts dd {
  margin: 0;
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.25;
}

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: 260px;
  border: 1px solid #0b0c0c;
  background: #ffffff;
  box-shadow: 0 4px 0 #0b0c0c;
  padding: 10px 12px;
  pointer-events: none;
}

.tooltip--seat-detail {
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  max-height: min(78vh, 720px);
  overflow: hidden;
  border-width: 2px;
  box-shadow: 0 6px 0 #006548;
  padding: 16px;
}

.tooltip--seat-detail .app-summary-list {
  margin-bottom: 12px;
}

.tooltip--seat-detail .govuk-summary-list__row {
  display: grid;
  grid-template-columns: minmax(132px, 0.55fr) minmax(0, 1fr);
}

.tooltip--seat-detail .govuk-summary-list__key,
.tooltip--seat-detail .govuk-summary-list__value {
  display: block;
  width: auto;
  min-width: 0;
  padding-top: 8px;
  padding-bottom: 8px;
  word-break: normal;
  overflow-wrap: normal;
}

.tooltip--seat-detail .app-share-stack {
  gap: 9px;
}

.tooltip strong,
.tooltip div {
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.35;
}

.app-body--modal-open {
  overflow: hidden;
}

.app-disclaimer[hidden] {
  display: none;
}

.app-disclaimer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.app-disclaimer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 12, 12, 0.58);
  backdrop-filter: blur(2px);
}

.app-disclaimer__panel {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: min(82vh, 640px);
  overflow: auto;
  border: 1px solid #505a5f;
  border-top: 6px solid #006548;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(11, 12, 12, 0.22);
  padding: 26px;
}

.app-disclaimer__section {
  border-top: 1px solid #b1b4b6;
  padding-top: 15px;
  margin-top: 15px;
}

.app-disclaimer__section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.app-disclaimer__details {
  margin-bottom: 20px;
}

@media (max-width: 60em) {
  .app-hero__layout,
  .app-top-stats,
  .app-what-this-means,
  .app-balanced-row,
  .app-section__heading {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: start;
  }

  .app-hero {
    padding: 20px 0;
  }

  .app-footer__top {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: start;
  }

  .app-commons-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "majority majority"
      "lead trail";
  }

  .app-commons-party--trail {
    justify-content: flex-end;
    text-align: right;
  }

  .app-section-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 48em) {
  .app-commons-party {
    display: grid;
    grid-template-rows: auto auto;
    gap: 3px;
    align-content: start;
  }


  .app-commons-party__value {
    grid-row: 1;
  }

  .app-commons-party__name {
    grid-row: 2;
  }

  .app-commons-party--trail {
    justify-items: end;
  }

  .govuk-service-navigation__container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .govuk-service-navigation__service-name {
    width: 100%;
    justify-content: center;
  }

  .govuk-service-navigation__wrapper {
    flex: 1 1 auto;
    width: auto;
  }

  .app-map-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "controls" "info" "map";
  }

  .app-section {
    padding: 20px;
  }

  .app-poll-top {
    grid-template-columns: 1fr;
  }

  .app-seat-table {
    min-width: 660px;
  }

  .app-table-wrap:has(.app-seat-table) {
    display: none;
  }

  .app-seat-cards {
    display: grid;
  }

  #constituency-map {
    height: min(56vh, 520px);
  }

  .app-commons-bar-shell {
    padding-top: 16px;
  }

  .app-commons-meta {
    gap: 6px;
  }

  .app-commons-legend {
    gap: 6px 10px;
  }

  .app-commons-segment {
    padding: 0 4px;
    font-size: 0.875rem;
  }

  .app-disclaimer {
    padding: 15px;
  }

  .app-disclaimer__panel {
    max-height: 86vh;
    padding: 20px;
  }
}

/* Compact projection context and readable totals on the dark hero. */
.app-projection-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 24px;
}
.app-projection-context > p { flex: 1 1 100%; }
.app-projection-freshness { display: grid; gap: 5px; flex: 1 1 auto; }
.app-commons-legend-total { color: #c5cbd0; font-weight: 700; }
.app-range-explanation { grid-column: 1 / -1; }
.app-map-inspector .govuk-summary-list__row { display: block; }
.app-map-inspector .govuk-summary-list__key,
.app-map-inspector .govuk-summary-list__value {
  display: block;
  width: auto;
  padding: 7px 0;
  word-break: normal;
  overflow-wrap: normal;
}
.app-map-inspector .govuk-summary-list__value { padding-top: 0; }
.app-map-search-status { margin: 8px 0; font-size: 1rem; }
.app-map-search-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px;
  border: 1px solid #b1b4b6;
  background: #fff;
  color: #1d70b8;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.app-map-search-result:focus-visible {
  outline: 3px solid #ffdd00;
  background: #ffdd00;
  color: #0b0c0c;
}
.constituency:focus-visible { outline: none; stroke: #ffdd00; stroke-width: 3; }
.app-view-on-map { display: inline-block; margin-top: 16px; }
.app-map-inspector .app-view-on-map { display: none; }
.app-held-result { border-left: 4px solid #006548; padding-left: 10px; }
.app-held-label { display: block; color: #006548; margin-top: 5px; }
.tooltip--seat-detail { box-sizing: border-box; }

.app-commons-party-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.app-commons-party-button:hover { text-decoration-thickness: 2px; }
.app-commons-party-button:focus-visible {
  outline: 3px solid #ffdd00;
  outline-offset: 3px;
}
.app-commons-party-details {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 10px;
  box-sizing: border-box;
  width: min(24rem, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 16px;
  border: 2px solid #b1b4b6;
  border-radius: 3px;
  background: #fff;
  color: #0b0c0c;
  box-shadow: 0 4px 16px #0004;
  white-space: normal;
  text-align: left;
  font-family: var(--app-font);
  font-size: 1rem;
  line-height: 1.4;
}
.app-commons-party-details[hidden] { display: none; }
.app-commons-party-details__title { font-size: 1.125rem; }
.app-commons-party-details__range { font-weight: 700; }


/* The selected result spans the full desktop map layout. */
.app-map-inspector { grid-area: info; min-width: 0; }
.app-map-inspector .app-seat-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 32px;
  align-items: start;
}
.app-seat-detail__summary,
.app-seat-detail__shares { min-width: 0; }
.app-map-inspector .app-summary-list { margin-bottom: 0; }
@media (max-width: 48em) {
  .app-map-inspector .app-seat-detail { grid-template-columns: 1fr; gap: 24px; }
}


.app-constituency-search { display: flex; gap: 8px; align-items: start; }
.app-constituency-search .govuk-input { flex: 1; min-width: 0; }
.app-constituency-search .govuk-button { margin: 0; flex: none; width: auto; white-space: nowrap; }
