.dem-placeholder {
    border: 1px dashed #c7d8ee;
    border-radius: 14px;
    background: #f8fbff;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #5e7591;
  }

  .dem-placeholder i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.6rem;
    color: #8aa1bd;
  }

  .dem-placeholder h6 {
    margin-bottom: 0.4rem;
    color: #16324f;
    font-weight: 700;
  }

  .dem-placeholder p {
    margin-bottom: 0;
    font-size: 0.9rem;
  }

  /* ── Democracy threats indicator ─────────────────────────── */
  .dem-threats-card {
    border: 1px solid #f3d8d8;
    border-left: 4px solid #dc3545;
    border-radius: 14px;
    background:
      linear-gradient(120deg, rgba(220, 53, 69, 0.04), rgba(255, 193, 7, 0.03)),
      #ffffff;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.06);
  }
  .dem-threats-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: .5rem; flex-wrap: wrap;
    padding: .9rem 1.2rem; border-bottom: 1px solid #f3e0e0;
  }
  .dem-threats-body { padding: 1.1rem 1.3rem; color: #1f2d3d; line-height: 1.55; }
  .dem-threats-title { font-weight: 800; color: #5a1117; margin-bottom: .9rem; }

  .dem-ai-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    background: linear-gradient(90deg, #0d6efd, #6610f2);
    color: #fff; font-size: .7rem; font-weight: 700;
    padding: .2rem .55rem; border-radius: 999px;
    letter-spacing: .04em; text-transform: uppercase;
  }
  .dem-threat-level-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .72rem; font-weight: 800;
    padding: .25rem .6rem; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .06em;
  }
  .dem-threat-low      { background: #d1e7dd; color: #0f5132; }
  .dem-threat-moderate { background: #fff3cd; color: #664d03; }
  .dem-threat-elevated { background: #ffe2cc; color: #7a3b0e; }
  .dem-threat-high     { background: #f8d7da; color: #842029; }

  /* Threat meter */
  .dem-meter { margin: .25rem 0 1.1rem; }
  .dem-meter-track {
    position: relative; height: 10px; border-radius: 999px;
    background: linear-gradient(90deg, #198754, #ffc107 45%, #fd7e14 75%, #dc3545);
    overflow: visible;
  }
  .dem-meter-marker {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; border: 3px solid #5a1117;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  }
  .dem-meter-labels {
    display: flex; justify-content: space-between;
    font-size: .68rem; color: #8aa1bd; font-weight: 700;
    margin-top: .35rem; letter-spacing: .04em; text-transform: uppercase;
  }

  .dem-threats-summary {
    color: #1f2d3d; font-size: .94rem; margin-bottom: 1rem;
  }
  .dem-threats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .6rem; margin-bottom: .25rem;
  }
  .dem-threat-item {
    display: flex; align-items: flex-start; gap: .65rem;
    border: 1px solid #f0e2e2; border-radius: 10px;
    background: #fdf7f7; padding: .65rem .8rem;
  }
  .dem-threat-item i {
    color: #b02a37; font-size: 1.15rem; margin-top: .1rem;
  }
  .dem-threat-item-title {
    font-weight: 700; color: #5a1117; font-size: .88rem;
  }
  .dem-threat-item-meta {
    color: #8a6064; font-size: .74rem; margin-top: .1rem;
  }

  .dem-threats-cta {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
    border-top: 1px dashed #f3d8d8; padding-top: .9rem; margin-top: .25rem;
  }

  /* ── Section divider ──────────────────────────────────────────
     The page leads with the search and the panels under it, so the
     democracy briefing needs a heading of its own to say where one part
     ends and the other begins. The .dem-* classes kept their names through
     the Demokrati → Djupdyk rename: they are internal, and the onboarding
     tour targets the ids they sit on. */
  .pol-djupdyk-section-head {
    margin: 0 0 var(--brand-space-4, 1rem);
    padding-top: var(--brand-space-2, 0.5rem);
    border-top: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  }
  .pol-djupdyk-section-title {
    margin: var(--brand-space-4, 1rem) 0 0.15rem;
    font-size: 1.05rem;
    font-weight: var(--brand-font-weight-bold, 700);
    color: var(--brand-color-heading, #0b1627);
  }
  .pol-djupdyk-section-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--brand-color-text-muted, #5d6c80);
  }

/* ════════════════════════════════════════════════════════════════════════
   The panels under the search (djupdyk.js): Dina partier just nu, På gång i
   riksdagen, Senaste besluten, Partiernas samsyn. Colour comes from the design
   tokens; a party's own colour is only ever a dot or a stripe, never text —
   party colours run from near-black to bright yellow, and none of them can
   carry a label on white.
   ════════════════════════════════════════════════════════════════════════ */

/* Loading: the same shimmer as the search's skeleton (keyframes in
   politics-search.css, which this page loads first). */
.dj-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.25rem 0;
}

.dj-skeleton span {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e8eff8 25%, #f0f6fd 50%, #e8eff8 75%);
  background-size: 200% 100%;
  animation: pol-search-shimmer 1.4s ease-in-out infinite;
}

.dj-skeleton span:nth-child(1) { width: 35%; }
.dj-skeleton span:nth-child(2) { width: 85%; }
.dj-skeleton span:nth-child(3) { width: 60%; }

@media (prefers-reduced-motion: reduce) {
  .dj-skeleton span {
    animation: none;
  }
}

/* The two panels that share a row scroll inside themselves, so the row stays
   about one screen tall however much is on its way. */
.dj-scroll {
  max-height: min(36rem, 75vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* A party's colour. The ring keeps the pale ones (SD's yellow) visible on white. */
.dj-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--party-color, #6c757d);
  box-shadow: 0 0 0 1px rgba(18, 32, 51, 0.18);
}

.dj-notice {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dj-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  border-radius: 999px;
  background: var(--brand-color-surface, #fff);
  color: var(--brand-color-text, #122033);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.dj-chip:hover {
  border-color: var(--brand-color-accent, #0f88f2);
  background: var(--brand-color-surface-muted, #f5f8fc);
  color: var(--brand-color-accent-strong, #1157bf);
}

.dj-chip:focus-visible,
.dj-heat-cell:focus-visible {
  outline: 2px solid var(--brand-color-text, #122033);
  outline-offset: 2px;
}

.dj-chip-n {
  font-size: 0.7rem;
  font-weight: var(--brand-font-weight-bold, 700);
  color: var(--brand-color-text-muted, #5d6c80);
}

/* ── Dina partier just nu ──────────────────────────────────────────────── */

.dj-party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

/* All eight, for a reader who follows none: narrower cards, so they still fit
   in two rows at xl. */
.dj-party-grid.is-all {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.dj-party {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  border-left: 4px solid var(--party-color, #6c757d);
  border-radius: 12px;
  background: var(--brand-color-surface, #fff);
}

.dj-party-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dj-party-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: var(--brand-font-weight-bold, 700);
  color: var(--brand-color-heading, #0b1627);
}

.dj-party-code {
  font-size: 0.75rem;
  font-weight: var(--brand-font-weight-bold, 700);
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
}

/* The number reads first, the label under it; the markup keeps dt before dd. */
.dj-kpi {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.1rem;
}

.dj-kpi dt {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-kpi dd {
  margin: 0;
  font-size: 1.35rem;
  font-weight: var(--brand-font-weight-bold, 700);
  font-variant-numeric: tabular-nums;
  color: var(--brand-color-heading, #0b1627);
}

.dj-win {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.dj-win-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-win-head strong {
  font-variant-numeric: tabular-nums;
  color: var(--brand-color-heading, #0b1627);
}

/* One magnitude on a fixed 0–100 track: a single sequential hue. */
.dj-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.dj-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #3987e5;
}

.dj-win-sub,
.dj-win.is-empty {
  margin: 0;
  font-size: 0.75rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-party-areas {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dj-party-label {
  font-size: 0.7rem;
  font-weight: var(--brand-font-weight-semibold, 600);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-party-note {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.78rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

/* Actions at the foot of every card, whatever is above them. */
.dj-party-actions {
  margin-top: auto;
}

/* ── På gång i riksdagen ───────────────────────────────────────────────── */

.dj-day + .dj-day {
  margin-top: 1.1rem;
}

.dj-day-title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: var(--brand-font-weight-semibold, 600);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-color-text-muted, #5d6c80);
}

/* Something one of the reader's parties has a reservation or an
   interpellation in. The chip on the card says which party, in words. */
.feedcard.dj-card-mine {
  --fc-accent: var(--brand-color-accent-strong, #1157bf);
  background:
    linear-gradient(90deg, rgba(15, 136, 242, 0.05), transparent 45%),
    var(--brand-color-surface, #fff);
}

/* ── Senaste besluten, and the votes under a samsyn cell ───────────────── */

.dj-legend-line {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-vote-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dj-vote {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  border-left: 3px solid var(--brand-color-accent, #0f88f2);
  border-radius: 10px;
  background: var(--brand-color-surface, #fff);
}

.dj-vote-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

/* "Knappt" carries its own icon and word, so the amber is never the only
   signal. */
.dj-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #fff3cd;
  color: #664d03;
  font-size: 0.7rem;
  font-weight: var(--brand-font-weight-bold, 700);
}

.dj-vote-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: var(--brand-font-weight-semibold, 600);
  line-height: 1.35;
  color: var(--brand-color-heading, #0b1627);
}

.dj-vote .doc-chain-votes {
  margin-bottom: 0;
}

.dj-positions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Won and lost look alike apart from the ✓ / ✗: the panel reports which side
   a party was on, it does not grade it. */
.dj-pos {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  border-radius: 999px;
  background: var(--brand-color-surface-muted, #f5f8fc);
  color: var(--brand-color-text, #122033);
  font-size: 0.72rem;
}

.dj-pos b {
  font-weight: var(--brand-font-weight-bold, 700);
}

.dj-pos.is-mine {
  border-color: rgba(18, 32, 51, 0.35);
  background: var(--brand-color-surface, #fff);
}

.dj-split {
  margin: 0;
  font-size: 0.8rem;
  color: var(--brand-color-text, #122033);
}

.dj-split-sep {
  margin: 0 0.2rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

/* ── Partiernas samsyn ─────────────────────────────────────────────────── */

.dj-agree-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.dj-periods {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: var(--brand-font-weight-semibold, 600);
}

/* The period: the rolling year, then riksmöten newest first. */
.dj-period-select.form-select {
  width: auto;
  min-width: 13rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 400;
}

.dj-agree-n {
  font-size: 0.8rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-agree-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

@media (min-width: 992px) {
  .dj-agree-grid {
    grid-template-columns: minmax(0, 28rem) minmax(0, 1fr);
    align-items: start;
  }
}

/* The tooltip is positioned against this, outside the scroller, so a table
   scrolled sideways on a phone never clips it. */
.dj-heat-wrap {
  position: relative;
  min-width: 0;
}

.dj-heat-scroll {
  overflow-x: auto;
}

/* A 2px surface gap between cells, so neighbouring shades never merge. */
.dj-heat {
  width: 100%;
  min-width: 19rem;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 2px;
}

.dj-heat th,
.dj-heat td {
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.dj-heat thead td:first-child {
  width: 2.9rem;
}

.dj-heat-head {
  padding: 0.25rem 0;
  font-size: 0.75rem;
  font-weight: var(--brand-font-weight-bold, 700);
  white-space: nowrap;
  color: var(--brand-color-text, #122033);
}

.dj-heat thead .dj-heat-head .dj-dot {
  display: block;
  margin: 0 auto 0.2rem;
}

.dj-heat tbody .dj-heat-head {
  padding-right: 0.35rem;
  text-align: left;
}

.dj-heat tbody .dj-heat-head .dj-dot {
  margin-right: 0.3rem;
  vertical-align: middle;
}

/* The reader's own parties, marked in the labels — the cells stay one scale. */
.dj-heat-head.is-mine {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.dj-heat-cell {
  display: block;
  width: 100%;
  min-height: 2rem;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: var(--brand-font-weight-bold, 700);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: box-shadow 0.1s;
}

.dj-heat-cell:hover {
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 2px var(--brand-color-accent-strong, #1157bf);
}

/* A ring that shows on every shade: white inside, ink outside. */
.dj-heat-cell.is-selected {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-color-text, #122033);
}

/* Too few shared voteringar to colour honestly: shown, but on the surface,
   dashed, and out of the scale. */
.dj-heat-cell.is-thin,
.dj-heat-swatch-thin {
  background: var(--brand-color-surface-muted, #f5f8fc);
  color: var(--brand-color-text-muted, #5d6c80);
  outline: 1px dashed rgba(18, 32, 51, 0.35);
  outline-offset: -3px;
}

.dj-heat-self,
.dj-heat-none {
  font-size: 0.8rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-heat-ramp {
  display: inline-flex;
  height: 0.6rem;
  overflow: hidden;
  border-radius: 3px;
}

.dj-heat-ramp span {
  display: block;
  width: 0.75rem;
  height: 100%;
}

.dj-heat-legend-thin {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.dj-heat-swatch-thin {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 3px;
  outline-offset: -2px;
}

.dj-agree-note {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--brand-color-text-muted, #5d6c80);
}

/* Value first, names after it. */
.dj-heat-tip {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: max-content;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--brand-color-text, #122033);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(17, 28, 45, 0.25);
  transform: translate(-50%, calc(-100% - 8px));
}

.dj-heat-tip[hidden] {
  display: none;
}

.dj-heat-tip strong {
  font-size: 0.9rem;
}

.dj-heat-tip-n {
  color: rgba(255, 255, 255, 0.78);
}

.dj-agree-detail {
  min-width: 0;
}

.dj-detail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: var(--brand-font-weight-bold, 700);
  color: var(--brand-color-heading, #0b1627);
}

/* "Jämför [parti] med [parti]" — the drill-down's pair, picked by name. */
.dj-detail-title label {
  font-weight: var(--brand-font-weight-semibold, 600);
}

.dj-compare-select.form-select {
  width: auto;
  min-width: 10rem;
  max-width: 100%;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* "Röstade olika / Röstade lika": which of the pair's shared voteringar the
   list shows. A segmented control; the pressed half is the white chip. */
.dj-mode-switch {
  display: inline-flex;
  margin: 0.35rem 0 0.5rem;
  padding: 3px;
  border: 1px solid var(--brand-color-border, rgba(18, 32, 51, 0.12));
  border-radius: 999px;
  background: var(--brand-color-surface-muted, #f5f8fc);
}

.dj-mode-switch button {
  padding: 0.3rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--brand-color-text-muted, #5d6c80);
  font-size: 0.8rem;
  font-weight: var(--brand-font-weight-semibold, 600);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.dj-mode-switch button:hover {
  color: var(--brand-color-text, #122033);
}

.dj-mode-switch button[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-color-heading, #0b1627);
  box-shadow: 0 1px 4px rgba(18, 32, 51, 0.15);
}

.dj-mode-switch button:focus-visible {
  outline: 2px solid var(--brand-color-accent-strong, #1157bf);
  outline-offset: 2px;
}

.dj-detail-sub {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--brand-color-text-muted, #5d6c80);
}

.dj-agree-detail .dj-vote-list {
  max-height: 30rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 575.98px) {
  .dj-heat-cell {
    font-size: 0.72rem;
  }

  .dj-kpi dd {
    font-size: 1.15rem;
  }
}
