/* ==================== VOTES PAGE REDESIGN CSS ==================== */

/* ── CSS Variables ── */
:root {
  --orange: #ffa600;
  --orange-dk: #e69500;
  --blue: #163980;
  --blue-dk: #0e2560;
  --for: #7AB800;
  --against: #D0006F;
  --abstain: #00C1F0;
  --didnot: #B6B6B6;
  --bg: #f4f6fa;
  --card: #fff;
  --ink: #1a1a2e;
  --ink-2: #444;
  --ink-3: #888;
  --line: #e4e8f0;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,.10);
  --shadow-hover: 0 8px 32px rgba(0,0,0,.16);
}

/* ── Unified top navigation strip ───────────────────────────────────────
   Used on /votes/detail/* and /votes/detail/*/group/* pages to match the
   look of /votes/html, /speeches, /speeches/compare and /about. Same
   visual as .votes-page .voting-header but works without a body class so
   it doesn't conflict with the legacy orange .voting-header banner those
   pages still render below for the vote title/date/eurovoc content. */
.csv-unified-header {
  background: var(--orange);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(255, 166, 0, 0.35);
}
.csv-unified-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 80px;
}
.csv-unified-logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.csv-unified-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  margin: 4px 0;
}
.csv-unified-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}
/* The csv-navbar (language_selector.html) inside the unified strip should
   sit transparently next to the logo, NOT as the standalone fixed dark blue
   bar it defaults to. */
.csv-unified-header .csv-navbar {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  flex: 1;
  min-width: 0;
  position: static !important;
  overflow: visible;
}
.csv-unified-header .csv-navbar-inner {
  padding: 0 !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
}
.csv-unified-header .csv-nav-link {
  color: rgba(255, 255, 255, 0.92) !important;
}
.csv-unified-header .csv-nav-link:hover,
.csv-unified-header .csv-nav-link.csv-nav-active {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}
.csv-unified-header .csv-lang-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
}
.csv-unified-header .csv-lang-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}
.csv-unified-header .csv-lang-current,
.csv-unified-header .csv-lang-chevron path {
  color: #fff !important;
  fill: #fff;
}
.csv-unified-header .csv-burger-line {
  background: #fff !important;
}
@media (max-width: 767px) {
  .csv-unified-inner { padding: 4px 14px; height: 64px; }
  .csv-unified-logo { height: 40px; }
}

/* ── Scope all redesign styles to votes-page class ── */
.votes-page {
  background: var(--bg) !important;
  overflow-x: hidden;
}

/* ── Compact sticky header ── */
.votes-page .voting-header {
  min-height: auto !important;
  padding: 0 !important;
  background: var(--orange) !important;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(255,166,0,.35);
}

.votes-page .hdr-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 80px;
}

.votes-page .hdr-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  /* Small visual padding so the logo never sits flush against the nav bar above
     or the orange band's bottom edge. */
  margin: 4px 0;
}

.votes-page .hdr-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.35);
  flex-shrink: 0;
}

/* ── Constrain flag images in language selector ── */
.votes-page .voting-header .csv-lang-flag-img,
.speeches-page .voting-header .csv-lang-flag-img {
  width: 20px !important;
  height: 14px !important;
  max-width: 20px !important;
  max-height: 14px !important;
  min-width: unset !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}

/* Override csv-navbar inside the new compact header */
.votes-page .voting-header .csv-navbar {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  flex: 1;
  min-width: 0;
  position: static !important;
  overflow: visible;
}

.votes-page .voting-header .csv-navbar-inner {
  padding: 0 !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
}

.votes-page .voting-header .csv-navbar-links {
  gap: 4px;
  align-items: center;
}

.votes-page .voting-header .csv-nav-link {
  padding: 8px 16px !important;
  border-radius: 999px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,.85) !important;
  background: transparent !important;
  border: none !important;
  gap: 6px !important;
  transition: background .15s, color .15s !important;
}

.votes-page .voting-header .csv-nav-link:hover {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}

.votes-page .voting-header .csv-nav-link.csv-nav-active {
  background: #fff !important;
  color: var(--orange) !important;
}

.votes-page .voting-header .csv-nav-link.csv-nav-active svg,
.votes-page .voting-header .csv-nav-link.csv-nav-active path {
  fill: var(--orange) !important;
}

.votes-page .voting-header .csv-lang-btn {
  background: rgba(255,255,255,.2) !important;
  border: 1.5px solid rgba(255,255,255,.4) !important;
  color: #fff !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
}

.votes-page .voting-header .csv-lang-btn:hover {
  background: rgba(255,255,255,.3) !important;
}

.votes-page .voting-header .csv-lang-current {
  color: #fff !important;
}

.votes-page .voting-header .csv-lang-chevron path {
  fill: rgba(255,255,255,.85) !important;
}

.votes-page .voting-header .csv-lang-menu {
  top: 100% !important;
  background: var(--blue) !important;
  border: none !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.2) !important;
}

.votes-page .voting-header .csv-lang-option {
  color: rgba(255,255,255,.85) !important;
}

.votes-page .voting-header .csv-lang-option:hover,
.votes-page .voting-header .csv-lang-option.csv-lang-selected {
  background: rgba(255,255,255,.12) !important;
  color: #fff !important;
}

.votes-page .voting-header .csv-burger-line {
  background: #fff !important;
}

.votes-page .voting-header .csv-mobile-menu {
  background: var(--blue) !important;
}

.votes-page .voting-header .csv-mobile-link {
  color: rgba(255,255,255,.85) !important;
  border-bottom-color: rgba(255,255,255,.1) !important;
}

.votes-page .voting-header .csv-mobile-link:hover,
.votes-page .voting-header .csv-mobile-link.csv-nav-active {
  background: rgba(255,255,255,.1) !important;
  color: #fff !important;
}

/* ── Mobile member info card ── */
.mob-mep-wrap {
  background: var(--bg);
  padding: 12px 14px 0;
}

.mob-mep-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
}

/* Blue hero section INSIDE the mobile card. Carries the "How [name] voted."
   headline that used to live in the separate .page-hero-redesign element —
   merging them into one visual element. */
.mob-mep-hero {
  background: var(--blue);
  color: #fff;
  padding: 12px 14px 10px;
}
.mob-mep-hero-kicker {
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 600;
  margin-bottom: 3px;
}
.mob-mep-hero-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.mob-mep-hero-title em {
  font-style: italic;
  color: var(--orange);
}

/* The flex row (photo + info) used to be applied directly on .mob-mep-card,
   but the hero above is a vertical sibling now — so we wrap the row in
   .mob-mep-body to keep its own flex layout. */
.mob-mep-body {
  display: flex;
  align-items: stretch;
}

/* On phones, hide the standalone hero banner above — its content now lives
   inside the mobile card via .mob-mep-hero. */
@media (max-width: 767px) {
  .votes-page .page-hero-redesign {
    display: none !important;
  }
}

.mob-mep-photo-col {
  flex-shrink: 0;
  width: 72px;             /* balanced: smaller than the original 76px but
                              still recognisable; 60px was too tiny. */
  overflow: hidden;
}

.mob-mep-photo {
  width: 72px;
  height: 100%;
  min-height: 86px;
  /* `cover` + top-aligned crop = nicely framed face instead of letterboxed thumbnail */
  object-fit: cover;
  object-position: center top;
  display: block;
}

.mob-mep-photo-placeholder {
  background: linear-gradient(135deg, #dde1ea, #c5ccd8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8899bb;
  min-height: 86px;
}

.mob-mep-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.mob-mep-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Whole name acts as the MEP picker trigger — visually it's the same as the
   plain name, but with a small chevron and pointer cursor so users know they
   can tap to switch. The hidden <select> below is the real Select2 source. */
.mob-mep-name-trigger {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: inherit;
  text-align: left;
  font: inherit;
  min-width: 0;
  width: 100%;
  border-radius: 4px;
}
.mob-mep-name-trigger:hover .mob-mep-name,
.mob-mep-name-trigger:focus-visible .mob-mep-name {
  color: var(--blue);
}
.mob-mep-name-trigger:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.mob-mep-name-trigger .mob-mep-name {
  flex: 1 1 auto;
  min-width: 0;
}
.mob-mep-name-chev {
  width: 12px;
  height: 12px;
  color: var(--ink-3);
  flex-shrink: 0;
  transition: transform .15s;
}
.mob-mep-name-trigger:hover .mob-mep-name-chev {
  color: var(--blue);
}

/* Visually hide the Select2 wrap by parking it OFF-SCREEN at full size,
   not collapsing it. Select2 reads the source <select>'s offsetWidth when
   it opens; if that's 0px the dropdown thinks it's invisible and bails.
   Keeping width unconstrained + a real height fixes that while still
   keeping the widget invisible. */
.mob-mep-select-wrap-hidden {
  position: absolute !important;
  left: -9999px !important;
  top: 0;
  /* width/height inherit naturally — Select2 sees a real <select> with
     a real measurement, just located way off the left edge. */
  pointer-events: none;
}
/* While the dropdown is OPEN, the user expects it to be interactive.
   Re-enable pointer events on the document body when Select2 opens it. */
body:has(.select2-container.select2-container--open.select2-mob-mep-container) .mob-mep-select-wrap-hidden {
  pointer-events: auto;
}

.mob-mep-role {
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

.mob-mep-group {
  margin-top: 4px;
  display: flex;
  align-items: center;
}

/* Combined meta row: flag + country name + group logo on a single line.
   Replaces both the "MEP · GERMANY" line and the duplicate stats-grid
   Country/Group cells that used to render below. */
.mob-mep-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  min-width: 0;
}
.mob-mep-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.mob-mep-country {
  text-transform: uppercase;
  letter-spacing: .05em;
}
.mob-mep-meta-sep {
  color: var(--ink-3);
  opacity: 0.45;
}
.mob-mep-group-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: -13px;
  margin-bottom: -14px;
  z-index: 10;
}
.mob-mep-group-text {
  font-weight: 700;
  color: var(--ink);
}

.mob-mep-select-wrap {
  margin-bottom: 10px;
}

.mob-mep-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23888' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Stats grid */
.mob-mep-stats {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 10px;
  overflow: hidden;
}

.mob-mep-stat {
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mob-mep-stat:nth-child(2n) { border-right: none; }
.mob-mep-stat:nth-last-child(-n+2) { border-bottom: none; }

.mob-mep-stat-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 600;
}

.mob-mep-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 5px;
}

.mob-speeches-link {
  color: var(--blue) !important;
  text-decoration: underline;
}

/* Voting pattern section */
.mob-mep-votes-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 14px;
  margin-bottom: 12px;
}

/* Mini-stats row inside the voting card. Two equal cells (Speeches, Mandate)
   sitting just above the voting-pattern title — keeps everything that's
   "MEP at a glance" in one card instead of two. */
.mob-mep-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.mob-mep-mini-stat {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}
.mob-mep-mini-stat-link:hover,
.mob-mep-mini-stat-link:active {
  background: #e8eef9;
  color: inherit;
  text-decoration: none;
}
.mob-mep-mini-stat-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 600;
}
.mob-mep-mini-stat-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.mob-mep-mini-stat-link .mob-mep-mini-stat-value {
  color: var(--blue);
}

.mob-mep-votes-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}

.mob-mep-votes-total {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.mob-mep-loading {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.mob-mep-votes-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mob-vote-row {
  display: grid;
  /* icon (22px) | bar (1fr) | absolute n | percentage */
  grid-template-columns: 22px 1fr 28px 40px;
  align-items: center;
  gap: 8px;
}

/* Coloured circular icon that signals the vote position. The SVG inside
   carries the symbol (+ × / —); the circle background colour matches the
   vote-track fill so both signals (shape + colour) reinforce each other. */
.mob-vote-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.mob-vote-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.mob-vote-icon-for     { background: var(--for); }
.mob-vote-icon-against { background: var(--against); }
.mob-vote-icon-abstain { background: var(--abstain); }
.mob-vote-icon-didnot  { background: var(--didnot, #9aa3b2); }

.mob-vote-track {
  height: 5px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.mob-vote-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

.mob-for-fill    { background: var(--for); }
.mob-against-fill { background: var(--against); }
.mob-abstain-fill { background: var(--abstain); }
.mob-didnot-fill  { background: var(--didnot, #b6b6b6); }

.mob-vote-n {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.mob-vote-pct {
  font-size: 10px;
  color: var(--ink-3);
  text-align: right;
}

.mob-mep-error {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  padding: 6px 0;
}

/* ── Shell layout ── */
.votes-page .shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 80px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── Sidebar ──
   Defined BEFORE the mobile media query below so that the `display: none`
   override actually wins on phones. Previously the desktop rule came after
   the media query and silently re-enabled the sidebar on mobile, causing
   the MEP profile to render twice (desktop card under the mobile card). */
.votes-page .sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 88px;
}

@media (max-width: 980px) {
  .votes-page .shell {
    grid-template-columns: 1fr;
    padding: 16px 16px 60px;
  }
  .votes-page .sidebar {
    display: none !important; /* belt-and-braces: stays hidden even if a later rule re-enables it */
  }
}

/* ── MEP Card ── */
.mep-card-redesign {
  background: var(--card);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
  border: none !important;
}

.mep-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #dde1ea;
  max-height: 300px;
}

.mep-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.mep-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dde1ea, #c5ccd8);
  color: #8899bb;
}

.mep-photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent 20%, rgba(22,57,128,.92));
  padding: 24px 16px 14px;
}

.mep-photo-overlay h2 {
  color: #fff !important;
  font-size: 19px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  margin-bottom: 3px !important;
  text-shadow: none !important;
}

.mep-photo-overlay .mep-role-text {
  color: rgba(255,255,255,.8) !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  display: block;
  margin-bottom: 5px;
}

.mep-grp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--orange);
  color: #fff !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  padding: 3px 9px !important;
  border-radius: 999px !important;
  text-decoration: none;
  margin-bottom: 2px;
}

.mep-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 12px 14px;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.mep-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mep-meta-label {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
}

.mep-meta-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.mep-member-select-row {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.mep-member-select-row .form-select,
.mep-member-select-row .select2-container--bootstrap-5 .select2-selection {
  border-radius: 8px !important;
  border: 1.5px solid var(--line) !important;
  font-size: 12.5px !important;
  background: #fff !important;
}

.mep-member-select-row .select2-container {
  width: 100% !important;
}

/* Prominent solid-blue CTA so the speeches link stands out as the primary
   action of the card (was a subtle light-grey link before). */
.mep-speeches-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 15px 16px;
  background: var(--blue) !important;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff !important;
  text-decoration: none !important;
  transition: background .15s, transform .1s;
  cursor: pointer;
  border: none;
  width: 100%;
}
.mep-speeches-btn svg { width: 16px; height: 16px; }

.mep-speeches-btn:hover {
  background: #1741b8 !important;
  color: #fff !important;
  text-decoration: none !important;
}
.mep-speeches-btn:active { transform: translateY(1px); }

/* ── Pattern Card ── */
.pattern-card-redesign {
  background: var(--card);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 18px;
  border: none !important;
  /* mep-card and pattern-card are stacked siblings inside the same wrapper
     div (not a flex container), so add explicit separation between them. */
  margin-top: 16px;
}

.sc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.sc-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.sc-total-text {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}

.sc-total-text strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-left: 3px;
}

.pattern-chart-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.pattern-chart-wrap canvas {
  width: 110px !important;
  height: 110px !important;
}

.pattern-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pattern-bar-row {
  display: grid;
  /* icon | track | absolute n | percentage */
  grid-template-columns: 22px 1fr 34px 42px;
  align-items: center;
  gap: 8px;
}

/* Legacy coloured dot — kept for any older callers; new code uses
   .pattern-bar-icon below. */
.pattern-bar-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* SVG-symbol icon (+ × / —) on a coloured circle. Used in both mobile
   member_info_mobile.html and desktop member_info_desktop.html so the two
   breakpoints look consistent. */
.pattern-bar-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.pattern-bar-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.pattern-bar-icon-for     { background: var(--for); }
.pattern-bar-icon-against { background: var(--against); }
.pattern-bar-icon-abstain { background: var(--abstain); }
.pattern-bar-icon-didnot  { background: var(--didnot, #9aa3b2); }

.pattern-bar-track {
  height: 6px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.pattern-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}

.pattern-bar-for { background: var(--for); }
.pattern-bar-against { background: var(--against); }
.pattern-bar-abstain { background: var(--abstain); }
.pattern-bar-didnot { background: var(--didnot); }

.pattern-bar-n {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.pattern-bar-pct {
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
}

.legend-list-redesign {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.legend-row-redesign {
  display: grid;
  grid-template-columns: 10px 1fr 42px 46px;
  gap: 7px;
  align-items: center;
  font-size: 12px;
  padding: 3px 4px;
  border-radius: 6px;
  transition: background .1s;
}

.legend-row-redesign:hover {
  background: var(--bg);
}

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

.legend-pct {
  text-align: right;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}

.legend-count {
  text-align: right;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--ink);
}

/* ── Main column ── */
.votes-page .main-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ── Page hero ── */
.page-hero-redesign {
  background: var(--blue) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 22px 26px 18px !important;
  color: #fff !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-end !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
  border: none !important;
}

.page-hero-redesign .kicker {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.62);
  font-weight: 600;
  margin-bottom: 7px;
}

.page-hero-redesign h1 {
  font-size: 28px !important;
  font-weight: 800 !important;
  line-height: 1.08 !important;
  letter-spacing: -.02em !important;
  color: #fff !important;
  margin: 0 !important;
}

.page-hero-redesign h1 em {
  font-style: italic;
  color: var(--orange);
}

.page-hero-pill {
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Filter bar (behavior chips + search) ── */
.filter-bar-redesign {
  background: var(--card);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 10px 12px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  border: none !important;
}

.search-wrap-redesign {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  background: var(--bg);
  transition: border-color .15s;
}

.search-wrap-redesign:focus-within {
  border-color: var(--orange);
}

.search-wrap-redesign svg {
  color: var(--ink-3);
  flex-shrink: 0;
}

.search-wrap-redesign input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font: inherit !important;
  font-size: 13.5px !important;
  color: var(--ink) !important;
  width: 100%;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Behavior chips */
.bchip-vote {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 12px !important;
  border: 1.5px solid var(--line) !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  background: var(--card) !important;
  transition: .15s !important;
  color: var(--ink) !important;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
}

.bchip-vote:hover {
  border-color: var(--ink-3) !important;
  text-decoration: none !important;
  color: var(--ink) !important;
}

.bchip-vote.chip-active {
  background: var(--blue) !important;
  color: #fff !important;
  border-color: var(--blue) !important;
}

.bchip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Advanced filters collapse (existing, restyled) ── */
.votes-page .filter-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
}

.filter-toggle-btn:hover {
  border-color: var(--ink-3);
}

.filter-toggle-btn.has-filter {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.votes-page .votes-filter-bar {
  background: var(--card) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  border: none !important;
  padding: 14px !important;
}

.votes-page .votes-filter-bar .form-label {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
}

.votes-page .votes-filter-bar .form-control,
.votes-page .votes-filter-bar .form-select {
  border: 1.5px solid var(--line) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  background: var(--bg) !important;
}

.votes-page .votes-filter-bar .form-control:focus,
.votes-page .votes-filter-bar .form-select:focus {
  border-color: var(--orange) !important;
  box-shadow: none !important;
}

.votes-page .votes-filter-bar .btn-primary {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  border-radius: 8px !important;
}

.votes-page .votes-filter-bar .btn-primary:hover {
  background: var(--blue-dk) !important;
  border-color: var(--blue-dk) !important;
}

/* ── Vote cards redesign ── */
.votes-list-redesign {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.vote-card-redesign {
  background: var(--card) !important;
  border-radius: var(--radius) !important;
  /* Shadow removed — replaced by a flat 1px border so the card still reads as
     a distinct surface against the page background without the heavy drop. */
  box-shadow: none !important;
  border: 1px solid var(--line, #e6e6e6) !important;
  display: grid !important;
  grid-template-columns: 78px 1fr 190px !important;
  gap: 0 !important;
  transition: border-color .2s, transform .2s !important;
  cursor: pointer;
  overflow: hidden;
  border-top: 4px solid transparent !important;
  text-decoration: none !important;
  color: inherit !important;
  width: 100%;
  max-width: 100%;
  height: auto !important;
  flex-shrink: unset !important;
}

.vote-card-redesign:hover {
  /* Subtle lift on hover without a drop shadow. */
  box-shadow: none !important;
  border-color: var(--ink-3, #b8b8b8) !important;
  transform: translateY(-2px);
  text-decoration: none !important;
  color: inherit !important;
}

.vote-card-redesign.vote-adopted {
  border-top-color: var(--for) !important;
}

.vote-card-redesign.vote-rejected {
  border-top-color: var(--against) !important;
}

/* Date column */
.vc-date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 8px 18px 12px;
  border-right: 1px solid var(--line);
  min-height: 100px;
  flex-shrink: 0;
}

.vc-day {
  font-size: 30px;
  font-weight: 800;
  line-height: .9;
  color: var(--blue);
}

.vc-month {
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 5px;
}

.vc-year {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 2px;
}

/* Body column */
.vc-body-col {
  padding: 15px 16px;
  min-width: 0;
}

.vc-geo-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.vc-geo-tag {
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none !important;
  transition: .12s;
}

.vc-geo-tag:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.vc-title {
  font-size: 14.5px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  margin-bottom: 9px !important;
  color: var(--ink) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-decoration: none !important;
}

.vc-title a {
  color: inherit !important;
  text-decoration: none !important;
}

.vc-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.vc-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.vc-result-badge.vc-adopted {
  background: rgba(122,184,0,.12);
  color: #4a7300;
}

.vc-result-badge.vc-rejected {
  background: rgba(208,0,111,.1);
  color: #8a0048;
}

.vc-result-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.vc-ref-code {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--ink-2);
  font-family: ui-monospace, monospace;
}

/* EuroVoc topic tags on vote cards */
.vc-eurovoc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.vc-eurovoc-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 91, 187, 0.08);
  color: var(--blue);
  text-decoration: none !important;
  transition: background .15s, color .15s;
  white-space: nowrap;
  letter-spacing: .02em;
}

.vc-eurovoc-tag:hover {
  background: rgba(0, 91, 187, 0.16);
  color: var(--blue) !important;
  text-decoration: none !important;
}

.vc-eurovoc-more {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-3);
}

/* Chart column */
.vc-chart-col {
  padding: 14px 12px 14px 10px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
}

.vc-my-vote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
}

.vc-my-vote-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.mv-for   { background: rgba(122,184,0,.14); color: #4a7300; }
.mv-against { background: rgba(208,0,111,.1); color: #8a0048; }
.mv-abstain { background: rgba(0,193,240,.12); color: #006a87; }
.mv-didnot  { background: rgba(182,182,182,.18); color: #555; }

.vc-donut-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Variant used after the legend bars were removed: donut sits centered in the
   card instead of left-aligned next to (now absent) bars. */
.vc-donut-row-centered {
  justify-content: center;
  gap: 0;
}

.vc-mini-canvas-wrap {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  position: relative; /* anchors the centered "For N" overlay */
}

.vc-mini-canvas-wrap canvas {
  width: 64px !important;
  height: 64px !important;
  max-width: 64px !important;
  max-height: 64px !important;
}

/* "Für N" overlay rendered inside the donut hole. */
.vc-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
}
.vc-donut-center-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3, #777);
  font-weight: 700;
  margin-bottom: 2px;
}
.vc-donut-center-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--for, #7AB800);
}
/* Tint the centered number by the dominant category it represents. */
.vc-donut-center-value.vc-center-for     { color: var(--for, #7AB800); }
.vc-donut-center-value.vc-center-against { color: var(--against, #D0006F); }
.vc-donut-center-value.vc-center-abstain { color: var(--abstain, #00C1F0); }
.vc-donut-center-value.vc-center-didnot  { color: var(--didnot, #9aa3b2); }

.vc-mini-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.vc-bar-row {
  display: grid;
  grid-template-columns: 7px 1fr 28px;
  gap: 4px;
  align-items: center;
}

.vc-bar-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}

.vc-bar-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.vc-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.vc-bar-n {
  text-align: right;
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-3);
}

.vc-bar-row.vc-highlight .vc-bar-n {
  color: var(--ink-2);
  font-weight: 700;
}

/* ── Pagination redesign ── */
.pager-wrap {
  background: var(--card);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 12px 18px;
  border: none !important;
}

.pager-wrap .pagination {
  margin: 0;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
}

.pager-wrap .page-link {
  border-radius: 8px !important;
  border: 1.5px solid transparent !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink-2) !important;
  transition: .15s;
  min-width: 34px;
  text-align: center;
  padding: 5px 10px;
}

.pager-wrap .page-link:hover {
  background: var(--bg) !important;
  border-color: var(--line) !important;
}

.pager-wrap .page-item.active .page-link {
  background: var(--blue) !important;
  color: #fff !important;
  border-color: var(--blue) !important;
}

.pager-wrap .page-item.disabled .page-link {
  color: var(--ink-3) !important;
  opacity: 0.5;
}

/* ── Shown-of text ── */
.shown-of-wrap {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 0 8px;
}

/* ── Footer ── */
.votes-page footer.site-footer-mt0 {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 28px 36px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--ink-3);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 0;
}

.votes-page footer.site-footer-mt0 a {
  color: var(--ink-3);
}

.votes-page footer.site-footer-mt0 a:hover {
  color: var(--orange);
}

/* ── Mobile adjustments ──
   On phones we collapse the 3-column card to a single column and let the
   chart column flow below the title. The donut + bars stay visible (only
   slightly smaller) so each vote still shows its outcome at a glance. */
@media (max-width: 600px) {
  .vote-card-redesign {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
  }
  .votes-page .hdr-inner {
    padding: 0 14px;
  }
}

/* ── Member alert ── */
.votes-page .member-missing-alert {
  background: rgba(255,166,0,.12);
  border: 1px solid rgba(255,166,0,.3);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #7a4800;
}

/* ==================== SPEECHES PAGE REDESIGN CSS ==================== */

.speeches-page {
  background: var(--bg) !important;
  overflow-x: hidden;
}

/* ── Compact sticky header (same pattern as votes-page) ── */
.speeches-page .voting-header {
  min-height: auto !important;
  padding: 0 !important;
  background: var(--orange) !important;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(255,166,0,.35);
}

.speeches-page .hdr-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 28px; /* extra vertical breathing room around the logo */
  display: flex;
  align-items: center;
  gap: 16px;
  height: 80px;       /* matches .votes-page for a consistent banner height */
}

.speeches-page .hdr-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  /* Small visual padding so the logo never sits flush against the nav bar above
     or the orange band's bottom edge. */
  margin: 4px 0;
}

.speeches-page .hdr-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.35);
  flex-shrink: 0;
}

.speeches-page .voting-header .csv-navbar {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  flex: 1;
  min-width: 0;
  position: static !important;
  overflow: visible;
}

.speeches-page .voting-header .csv-navbar-inner {
  padding: 0 !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
}

.speeches-page .voting-header .csv-navbar-links {
  gap: 4px;
  align-items: center;
}

.speeches-page .voting-header .csv-nav-link {
  padding: 8px 16px !important;
  border-radius: 999px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,.85) !important;
  background: transparent !important;
  border: none !important;
  gap: 6px !important;
  transition: background .15s, color .15s !important;
}

.speeches-page .voting-header .csv-nav-link:hover {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}

.speeches-page .voting-header .csv-nav-link.csv-nav-active {
  background: #fff !important;
  color: var(--orange) !important;
}

.speeches-page .voting-header .csv-nav-link.csv-nav-active svg,
.speeches-page .voting-header .csv-nav-link.csv-nav-active path {
  fill: var(--orange) !important;
}

.speeches-page .voting-header .csv-lang-btn {
  background: rgba(255,255,255,.2) !important;
  border: 1.5px solid rgba(255,255,255,.4) !important;
  color: #fff !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
}

.speeches-page .voting-header .csv-lang-btn:hover {
  background: rgba(255,255,255,.3) !important;
}

.speeches-page .voting-header .csv-lang-current {
  color: #fff !important;
}

.speeches-page .voting-header .csv-lang-chevron path {
  fill: rgba(255,255,255,.85) !important;
}

.speeches-page .voting-header .csv-lang-menu {
  top: 100% !important;
  background: var(--blue) !important;
  border: none !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.2) !important;
}

.speeches-page .voting-header .csv-lang-option {
  color: rgba(255,255,255,.85) !important;
}

.speeches-page .voting-header .csv-lang-option:hover,
.speeches-page .voting-header .csv-lang-option.csv-lang-selected {
  background: rgba(255,255,255,.12) !important;
  color: #fff !important;
}

.speeches-page .voting-header .csv-burger-line {
  background: #fff !important;
}

.speeches-page .voting-header .csv-mobile-menu {
  background: var(--blue) !important;
}

.speeches-page .voting-header .csv-mobile-link {
  color: rgba(255,255,255,.85) !important;
  border-bottom-color: rgba(255,255,255,.1) !important;
}

.speeches-page .voting-header .csv-mobile-link:hover,
.speeches-page .voting-header .csv-mobile-link.csv-nav-active {
  background: rgba(255,255,255,.1) !important;
  color: #fff !important;
}

.speeches-page {
  --radius: 10px;
}

/* ── Speeches shell ── */
.sp-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ── Hero ── */
.sp-hero {
  display: grid;
  grid-template-columns: 190px 1fr 320px;
  gap: 20px;
  margin-bottom: 32px;
  align-items: stretch;
}

.sp-hero-text-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* MEP photo card in hero — stretches to the hero row height so its bottom edge
   lines up with the bottom of the banner/filter column. */
.sp-hero-mep {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 170px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.sp-hero-mep img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.sp-hero-mep-placeholder {
  width: 100%;
  height: 100%;
  min-height: 210px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.25);
}

.sp-hero-mep-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 14px 14px;
  background: linear-gradient(to bottom, transparent 0%, rgba(8,24,72,0.93) 100%);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sp-hero-mep-name {
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
}

.sp-hero-mep-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.65);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Higher specificity than `.sp-hero-mep img` (which is width/height:100% for
   the portrait) so the small inline flag isn't blown up to fill the card. */
.sp-hero-mep .sp-hero-mep-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.4);
  flex-shrink: 0;
  display: inline-block;
}

.sp-hero-text {
  background: var(--blue);
  border-radius: var(--radius);
  padding: 22px;
  color: #fff;
  box-shadow: var(--shadow);
}

.sp-hero-search {
  display: flex;
}

.sp-search-wrap.sp-search-wrap-hero {
  width: 100%;
  background: var(--card);
}

.sp-hero-controls {
  display: flex;
  flex-wrap: nowrap;        /* ranking + date + the 4 filters all on ONE row */
  gap: 8px;
  align-items: center;
}

.sp-hero-controls .sp-seg {
  background: var(--card);
  flex-shrink: 0;
}
.sp-hero-controls .filter-toggle-btn { flex-shrink: 0; }

.sp-kicker {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  font-weight: 600;
  margin-bottom: 10px;
}

.sp-kicker-short {
  display: none;
}

.sp-kicker-full {
  display: block;
}

.sp-hero-text h1 {
  font-size: 30px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  color: #fff !important;
  margin-bottom: 10px !important;
  letter-spacing: -.02em !important;
}

.sp-hero-text h1 em {
  font-style: italic;
  color: var(--orange);
}

.sp-hero-text p {
  color: rgba(255,255,255,.75);
  font-size: 14px;
  line-height: 1.6;
  max-width: 52ch;
  margin: 0;
}

.sp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--orange);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none !important;
}

.sp-back-link:hover { color: var(--orange-dk) !important; text-decoration: none !important; }

/* Short blurb in the blue banner advertising the speech-compare tool. */
.sp-hero-compare-note {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.45;
  max-width: 52ch;
}

/* Action row in the banner: "back to votes" link + "compare speeches" button. */
.sp-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 12px;
}

.sp-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none !important;
  transition: background .15s;
}
.sp-hero-cta:hover { background: var(--orange-dk); color: #fff !important; }

/* Stats grid — three equal rows so the cards distribute the column height
   evenly (the activity card never balloons). Its total height is capped to the
   banner/filter column by JS (alignHeroRight) so all three hero columns end on
   the same bottom line as the filter row. */
.sp-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.sp-stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 13px 16px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}

.sp-sl {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}

.sp-sv {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--blue);
}

.sp-sv span { font-size: 15px; font-weight: 600; color: var(--ink-3); }

.sp-su {
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 3px;
}

.sp-spark-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Chart fills the (JS-sized) activity card on desktop; capped on mobile. */
.sp-spark-chart { flex: 1; min-height: 0; }

.sp-spark-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.sp-st {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.sp-ss {
  font-size: 11px;
  color: var(--ink-3);
}

/* ── Main grid ── */
.sp-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.sp-side-col {
  display: none;
}

.sp-content-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ── MEP mini card ── */
.sp-mep-mini {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sp-mep-mini-photo {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  max-height: 200px;
}

.sp-mep-mini-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.sp-mep-mini-body {
  padding: 14px 16px 10px;
}

.sp-mep-mini-body h3 {
  font-size: 16px !important;
  font-weight: 800 !important;
  margin-bottom: 2px !important;
  color: var(--ink) !important;
}

.sp-mep-role {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}

.sp-grp-badge {
  display: inline-flex;
  align-items: center;
  background: var(--orange);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.sp-votes-link {
  display: block;
  text-align: center;
  padding: 10px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue) !important;
  text-decoration: none !important;
  transition: background .15s;
}

.sp-votes-link:hover { background: #e8ecf8; color: var(--blue) !important; text-decoration: none !important; }

/* ── Topics card ── */
.sp-topics-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.sp-topics-card h4 {
  font-size: 14px !important;
  font-weight: 800 !important;
  margin-bottom: 14px !important;
  color: var(--ink) !important;
}

.sp-topic-item {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 3px 6px;
  margin-bottom: 10px;
  cursor: pointer;
}

.sp-topic-item .sp-tn {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  transition: color .12s;
}

.sp-topic-item:hover .sp-tn { color: var(--orange); }

.sp-topic-item .sp-tc {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: right;
}

.sp-topic-track {
  grid-column: span 2;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.sp-topic-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 2px;
}

/* ── Filter bar ── */
.sp-filter-bar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
}

.sp-search-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--bg);
  transition: border-color .15s;
}

.sp-search-wrap:focus-within { border-color: var(--orange); }

.sp-search-wrap svg { color: var(--ink-3); flex-shrink: 0; }

.sp-search-wrap input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font: inherit !important;
  font-size: 13.5px !important;
  color: var(--ink) !important;
  width: 100%;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Segmented control */
.sp-seg {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  flex-wrap: nowrap;
  gap: 6px;
  padding: 2px;
}

.sp-seg button {
  padding: 7px 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  border-radius: 8px;
}
.sp-seg button + button { border-left: none; }
.sp-seg button.on { background: var(--blue); color: #fff; }
.sp-seg button:hover:not(.on) { background: var(--bg); }

/* Date filter card */
.sp-date-filter-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.sp-date-filter-card .form-label {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
}

.sp-date-filter-card .form-control {
  border: 1.5px solid var(--line) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  background: var(--bg) !important;
}

.sp-date-filter-card .form-control:focus {
  border-color: var(--orange) !important;
  box-shadow: none !important;
}

.sp-date-filter-card .btn-primary {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  border-radius: 8px !important;
}

/* ── Speech cards ── */
.sp-speeches-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-speech-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 0;
  transition: box-shadow .2s, transform .2s;
  overflow: hidden;
}

.sp-speech-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.sp-sc-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding: 16px 8px;
  border-right: 1px solid var(--line);
}

.sp-sc-date .sp-dd {
  font-size: 28px;
  font-weight: 800;
  line-height: .9;
  color: var(--blue);
}

.sp-sc-date .sp-dm {
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 5px;
}

.sp-sc-date .sp-dy {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 2px;
}

.sp-sc-body {
  padding: 16px 18px;
  min-width: 0;
  position: relative;
}

/* The whole body is the expand trigger now (the old "More" button is gone). */
.sp-sc-body.sp-sc-clickable { cursor: pointer; }
.sp-sc-body.sp-sc-clickable:hover h3 { color: var(--blue); }

/* Caret sits centered below the text (clears the floated video button). */
.sp-expand-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  clear: both;
  margin-top: 8px;
  color: var(--ink-3);
  pointer-events: none;
}
.sp-expand-caret svg { transition: transform .3s ease; }
.sp-sc-body.sp-sc-clickable:hover .sp-expand-caret { color: var(--blue); }
/* Flip the caret to point up while the speech is expanded. */
.sp-speech-card.sp-expanded .sp-expand-caret svg { transform: rotate(180deg); }

.sp-sc-body h3 {
  font-size: 14.5px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  margin-bottom: 8px !important;
  color: var(--ink) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

/* Single speech-text element. Collapsed it's clamped to a few lines; clicking
   the body grows it to full height (max-height animated by JS). No separate
   preview block, so the opening lines are never duplicated. */
.sp-sc-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sp-sc-text-clamp {
  position: relative;
  max-height: 4.6em; /* ~3 lines while collapsed */
  overflow: hidden;
  transition: max-height .35s ease;
}

/* Fade the bottom edge while collapsed so the cut-off reads as "there's more". */
.sp-sc-text-clamp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.6em;
  background: linear-gradient(transparent, var(--card));
  pointer-events: none;
  transition: opacity .2s;
}
.sp-speech-card.sp-expanded .sp-sc-text-clamp::after { opacity: 0; }

/* Video button floats top-right inside the body; title + text wrap under it. */
.sp-play-btn-inline {
  float: right;
  margin: 0 0 8px 14px;
}

.sp-sc-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 10px;
  width: 100%;
}

.sp-kind-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-2);
}

.sp-kind-badge .sp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

.sp-kind-badge.committee .sp-dot { background: var(--blue); }
.sp-kind-badge.explanation .sp-dot { background: #7AB800; }

.sp-sc-ref {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--ink-2);
  font-family: ui-monospace, monospace;
}

.sp-sc-right {
  padding: 14px 12px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sp-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff !important;
  border: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none !important;
  transition: background .15s;
  cursor: pointer;
  text-align: center;
}

.sp-play-btn:hover { background: var(--blue-dk); color: #fff !important; }

.sp-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s;
}

.sp-expand-btn:hover { border-color: var(--ink-3); }


/* ── Pager ── */
.sp-pager-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 18px;
}

.sp-pager-wrap .pagination {
  margin: 0;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
}

.sp-pager-wrap .page-link {
  border-radius: 8px !important;
  border: 1.5px solid transparent !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--ink-2) !important;
  transition: .15s;
  min-width: 34px;
  text-align: center;
  padding: 5px 10px;
}

.sp-pager-wrap .page-link:hover {
  background: var(--bg) !important;
  border-color: var(--line) !important;
}

.sp-pager-wrap .page-item.active .page-link {
  background: var(--blue) !important;
  color: #fff !important;
  border-color: var(--blue) !important;
}

.sp-pager-wrap .page-item.disabled .page-link {
  color: var(--ink-3) !important;
  opacity: 0.5;
}

/* ── Fix: custom.css sets #main-content { width: 100vw } which causes overflow ── */
.votes-page #main-content,
.speeches-page #main-content {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* ── Search status ── */
#search-status {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  min-height: 18px;
}

/* Mobile-only duplicate ranking toggle (shown next to the date filter ≤680px). */
.sp-rank-mobile { display: none; }

/* Desktop: the date-range ("Zeitraum") toggle lives in the hero controls next
   to the ranking button, and the standalone .sp-filter-bar row is hidden. On
   mobile (≤680px, handled below) it's the reverse. */
.sp-zeit-desktop { display: inline-flex; }
@media (min-width: 681px) {
  .speeches-page .sp-filter-bar { display: none; }
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .sp-hero { grid-template-columns: 140px 1fr; }
  .sp-stats-grid { grid-column: 1 / -1; }
  .sp-shell { padding: 20px 16px 60px; }
}

@media (max-width: 680px) {
  /* Flatten the hero wrappers (display:contents lifts their children up to be
     direct grid items of .sp-hero) and lay everything out with an explicit
     3-column grid:
        col1 = MEP image (spans the two top rows, so it's a tall portrait)
        col2+col3 = blue box on top, then "Alle Reden" | "Redezeit" beneath it
                    (together exactly as wide as the blue box)
        full-width rows below: activity, search, 4 category filters.
     The Reden-Ranking button is hidden here — on mobile it lives next to the
     date filter (see .sp-filter-bar below). */
  .sp-hero {
    display: grid;
    grid-template-columns: 124px 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    align-items: start;
  }
  .sp-hero-text-col,
  .sp-hero-controls,
  .sp-stats-grid {
    display: contents;
  }

  /* MEP image — left column, spans the blue box + stats rows (tall portrait) */
  .sp-hero-mep {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: stretch;
    min-height: 130px;
    max-height: none;
    width: 124px;
  }

  /* Hide the explanatory blurb on mobile so the banner stays compact (and the
     MEP image can be a bit wider). */
  .sp-hero-compare-note { display: none; }
  .sp-hero-mep img { height: 100%; }
  .sp-hero-mep-overlay { padding: 16px 5px 5px; }
  .sp-hero-mep-name { font-size: 10.5px; }
  .sp-hero-mep-sub { display: none; }
  .sp-grp-badge { font-size: 9px; padding: 2px 4px; }

  /* Blue box — top, spanning both right columns (full banner width) */
  .sp-hero-text {
    grid-column: 2 / 4;
    grid-row: 1;
    min-width: 0;
    padding: 9px 11px;
    margin: 0;
  }
  .sp-hero-text h1 { font-size: 15px !important; margin-bottom: 2px !important; line-height: 1.18 !important; }
  .sp-hero-text .sp-kicker { font-size: 7.5px; margin-bottom: 2px; }
  .sp-hero-text .sp-kicker-full { display: none; }
  .sp-hero-text .sp-kicker-short { display: block; }
  /* tighter gap between the h1 and the "back to votes" link */
  .sp-hero-text .sp-back-link { font-size: 9.5px; margin-top: 2px !important; display: inline-block; }

  /* Alle Reden + Redezeit — directly under the blue box, 50/50 of its width.
     Durchschnitt is hidden on mobile. */
  .sp-stat-card { padding: 9px 10px; gap: 0; }
  .sp-stat-card:nth-child(1) { grid-column: 2; grid-row: 2; }
  .sp-stat-card:nth-child(2) { grid-column: 3; grid-row: 2; }
  .sp-stat-card:nth-child(3) { display: none; }
  .sp-sl { font-size: 8px; margin-bottom: 3px; }
  .sp-sv { font-size: 20px; }
  .sp-sv span { font-size: 10px; }
  .sp-su { font-size: 8px; margin-top: 1px; }

  /* Hero ranking button is replaced on mobile by the one in the filter bar */
  .sp-hero-controls .filter-toggle-btn { display: none; }

  /* Activity chart — full-width row, with a capped (shorter) chart height */
  .sp-spark-card {
    grid-column: 1 / 4;
    grid-row: 3;
    padding: 10px;
  }
  .sp-spark-head { margin-bottom: 4px; }
  .sp-st { font-size: 11px; }
  .sp-ss { font-size: 8px; }
  .sp-spark-chart { flex: none; height: 78px; }

  /* Full-width search bar (second-to-last before the speeches) */
  .sp-hero-search {
    grid-column: 1 / 4;
    grid-row: 4;
    width: 100%;
    margin: 0;
    gap: 3px;
  }
  .sp-search-wrap.sp-search-wrap-hero { width: 100%; padding: 5px 8px; }
  .sp-search-wrap.sp-search-wrap-hero input { font-size: 12px; padding: 4px 8px; }
  .sp-search-wrap.sp-search-wrap-hero button { font-size: 11px; padding: 5px 10px; }

  /* The 4 category filters in ONE row (last before the speeches) */
  .sp-seg {
    grid-column: 1 / 4;
    grid-row: 5;
    display: flex;
    width: 100%;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    margin: 0;
  }
  .sp-seg button {
    flex: 1 1 0;
    min-width: 0;
    font-size: 9px !important;
    padding: 7px 3px !important;
    white-space: nowrap;
    text-align: center;
  }

  /* Tighten vertical rhythm around the controls/speeches on mobile. */
  .sp-hero { margin-bottom: 10px; }
  .sp-content-col { gap: 10px; }
  /* The leaderboard wrapper + an empty search-status would otherwise leave
     phantom flex gaps above/below the filter row. display:contents drops the
     wrapper from the flow (its collapsed child is display:none → no gap), and
     an empty status box is hidden entirely. */
  .sp-rank-wrap { display: contents; }

  /* Filter bar: date filter + ranking toggle as a full-width 50/50 row that
     matches the width of the other cards on the page. Strip the card chrome so
     the two buttons read as the row itself. */
  .sp-rank-mobile { display: inline-flex; }
  .sp-zeit-desktop { display: none; } /* mobile uses the filter-bar date toggle */
  .sp-filter-bar {
    display: flex;
    width: 100%;
    gap: 8px;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    flex-wrap: nowrap;
  }
  .sp-filter-bar .filter-toggle-btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
    font-size: 11px;
    padding: 9px 6px;
  }

  .sp-shell { padding: 10px 10px 60px; }
}

/* Hide the search-status box while it's empty so it doesn't add a flex gap. */
#search-status:empty { display: none; }

@media (max-width: 600px) {
  /* Speech cards: single column, the card itself is the positioning context
     for the absolutely-placed "Watch" button. */
  .sp-speech-card {
    grid-template-columns: 1fr;
    gap: 0;
    display: block;
    position: relative;
  }

  /* Meta bar: date · category · language all on ONE subtle low line. The day
     number is no longer highlighted — everything reads as quiet grey text.
     Right side is reserved for the absolutely-positioned Watch button. */
  .sp-sc-date {
    display: flex;
    flex-direction: row !important;
    align-items: baseline;
    gap: 7px;
    padding: 7px 88px 7px 12px;
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
    border-right: none !important;
  }
  .sp-sc-date .sp-dd,
  .sp-sc-date .sp-dm,
  .sp-sc-date .sp-dy {
    font-size: 10.5px !important;
    font-weight: 600 !important;
    color: var(--ink-3) !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: uppercase;
    margin: 0 !important;
    flex-shrink: 0;
  }
  .sp-sc-meta {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    margin-left: 2px;
    flex-shrink: 0;
  }
  /* subtle dot separator before the category badge */
  .sp-sc-meta::before {
    content: "·";
    color: var(--ink-3);
    margin-right: 1px;
  }
  .sp-kind-badge { font-size: 9px; padding: 2px 5px; }
  .sp-sc-ref { font-size: 9px; font-weight: 600; color: var(--ink-3); }

  /* Watch button: top-right, on the same line as the meta bar. */
  .sp-play-btn-inline {
    position: absolute;
    top: 5px;
    right: 10px;
    float: none;
    margin: 0;
    font-size: 10px;
    padding: 5px 9px;
    z-index: 2;
  }

  /* Body: full width below the meta bar, heading first. position:static so the
     Watch button anchors to the card (top-right), not the body. */
  .sp-sc-body {
    padding: 12px;
    border-radius: 0 0 var(--radius) var(--radius);
    position: static;
  }
  .sp-sc-body h3 { font-size: 14px; margin: 0 0 8px; line-height: 1.3; }
  .sp-sc-text { font-size: 12px; line-height: 1.5; }
  .sp-sc-text-clamp { max-height: 3.6em; }
  .sp-expand-caret { margin-top: 6px; }

  .sp-shell { padding: 10px 10px 60px; }
  .speeches-page .hdr-inner { padding: 0 14px; }
}

/* ── Mobile Voting Stats Redesign: Unified Stacked Bar & Legend ── */
.mob-mep-votes-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.mob-stacked-bar {
  display: flex;
  width: 100%;
  height: 22px;
  border-radius: 11px;
  overflow: hidden;
  background-color: var(--bg);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
  margin-top: 4px;
}

.mob-stacked-segment {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.mob-bar-pct {
  font-size: 9.5px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  pointer-events: none;
  padding: 0 3px;
  opacity: 0.95;
}

/* Horizontal legend layout */
.mob-votes-legend-horizontal {
  display: flex;
  flex-wrap: nowrap;          /* all categories on ONE line */
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px;
  font-size: 10.5px;          /* base size; JS shrinks it to fit (fitMobLegend) */
}

/* Each legend entry is a filter button (reset native button styling). */
.mob-legend-item-horizontal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 0 1 auto;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.mob-legend-item-horizontal:hover { background: var(--bg); }
.mob-legend-item-horizontal.mob-legend-active {
  background: var(--bg);
  border-color: var(--line);
}
/* When one filter is active, dim the others slightly. */
.mob-votes-legend-horizontal:has(.mob-legend-active) .mob-legend-item-horizontal:not(.mob-legend-active) {
  opacity: .5;
}

.mob-legend-dot-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mob-legend-dot-swatch.mob-vote-icon-for     { background: var(--for); }
.mob-legend-dot-swatch.mob-vote-icon-against { background: var(--against); }
.mob-legend-dot-swatch.mob-vote-icon-abstain { background: var(--abstain); }
.mob-legend-dot-swatch.mob-vote-icon-didnot  { background: var(--didnot, #9aa3b2); }

.mob-legend-label-horizontal {
  font-size: 1em;            /* inherits the container size that JS tunes */
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;       /* never wrap; never truncate — JS shrinks instead */
}

/* ── Mobile Filters Layout: Prevent horizontal overflow and wrap inputs ── */
@media (max-width: 991px) {
  /* The per-position category chips are redundant on mobile — the stacked-bar
     legend filters instead. Drop them so the quick filter bar stays one line
     (search + "toggle filters" + reset). */
  .bchip-category { display: none !important; }
  .filter-bar-redesign {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .filter-bar-redesign .bchip-vote {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .votes-page .votes-filter-bar form {
    flex-wrap: wrap !important;
    gap: 12px 8px !important;
  }
  
  .votes-page .votes-filter-bar form > div {
    min-width: 100% !important;
    width: 100% !important;
  }

  .votes-page .votes-filter-bar form .d-flex {
    width: 100% !important;
  }

  .votes-page .votes-filter-bar form > div.d-flex {
    min-width: 100% !important;
    width: 100% !important;
    justify-content: stretch;
    gap: 8px !important;
  }
  
  .votes-page .votes-filter-bar form > div.d-flex button {
    flex: 1;
  }
}

/* ── Mobile Vote Card Redesign: Simplified Date and Shaded Vote Footer ── */
@media (min-width: 601px) {
  .mob-only {
    display: none !important;
  }
}
@media (max-width: 600px) {
  .desk-only {
    display: none !important;
  }
}

/* Mobile inline header */
.vc-mob-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.vc-mob-date {
  color: var(--blue);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .05em;
}

.vc-mob-ref {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: ui-monospace, monospace;
}

.vc-mob-meta-sep {
  opacity: 0.45;
}

/* Mobile dedicated footers for highlight */
.vc-mob-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.vc-mob-footer-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.vc-mob-footer-lbl {
  color: var(--ink-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.vc-mob-footer-val {
  font-size: 12px;
}

.vc-mob-footer-counts {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 3px;
}

/* Shaded background rows for MEPS vote position */
.vc-mob-footer.mf-for {
  background-color: rgba(122, 184, 0, 0.07) !important;
}
.vc-mob-footer.mf-against {
  background-color: rgba(208, 0, 111, 0.05) !important;
}
.vc-mob-footer.mf-abstain {
  background-color: rgba(0, 193, 240, 0.06) !important;
}
.vc-mob-footer.mf-didnot {
  background-color: rgba(182, 182, 182, 0.1) !important;
}

/* Text helper colors for mobile */
.fg-for {
  color: #4a7300 !important;
}
.fg-against {
  color: #8a0048 !important;
}
.fg-abstain {
  color: #006a87 !important;
}
.fg-didnot {
  color: #555 !important;
}

/* Mobile "My vote" position rendered as a compact colored icon. The colour
   comes from the fg-* class (currentColor), matching the vote-behaviour palette. */
.vc-mob-vote-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vc-mob-vote-icon svg { display: block; }


