/* ── Detail view ─────────────────────────────────────────────────────────────── */
.detail-view {}

.detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.detail-title { font-size: 20px; font-weight: 700; margin-bottom: 3px; }
.detail-sub   { font-size: 13px; color: var(--muted); }
/* Detail progress bars */
.detail-progress-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-width: 320px; }
.detail-pbar { position: relative; height: 22px; background: rgba(0,0,0,.08); border-radius: 5px; overflow: hidden; }
.detail-pbar-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.detail-pbar-fill.green { background: #60d394; }
.detail-pbar-fill.blue  { background: #5ab8e5; }
.detail-pbar-text { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 8px; font-size: 11px; font-weight: 600; color: var(--text); }

.pdf-link {
  font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 6px 14px; border: 1.5px solid var(--accent);
  border-radius: 6px; white-space: nowrap; flex-shrink: 0;
  transition: background .12s, color .12s;
}
.pdf-link:hover { background: var(--accent); color: #fff; }

/* ── Party bars ──────────────────────────────────────────────────────────────── */
.party-bars { display: flex; flex-direction: column; }
.party-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  border-top: 1px solid rgba(0,0,0,.04);
}
.party-badge {
  width: 20px; height: 20px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 11px; flex-shrink: 0;
}
.party-badge.lg { width: 26px; height: 26px; font-size: 13px; border-radius: 5px; }
.party-label { flex: 0 0 120px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-wrap { flex: 1; height: 9px; background: rgba(0,0,0,.07); border-radius: 4px; overflow: hidden; }
.bar-wrap.lg { height: 12px; }
.bar  { height: 100%; border-radius: 4px; transition: width .4s ease; }
.party-pct { flex: 0 0 42px; text-align: right; font-size: 13px; font-weight: 700;
             font-variant-numeric: tabular-nums; }

/* Detail bars */
.detail-bars { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; box-shadow: var(--shadow); }
.detail-party-block { border-bottom: 1px solid rgba(0,0,0,.05); }
.detail-party-block:last-child { border-bottom: none; }
.detail-party-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px;
}
.detail-party-mandates {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 3px 14px 4px 14px;
}
.detail-party-winners {
  padding: 3px 14px 6px 14px; font-size: 12px; color: #555;
}
.detail-party-name  { flex: 0 0 160px; font-size: 14px; }
.detail-party-pct   { flex: 0 0 50px; text-align: right; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-party-votes { flex: 0 0 44px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.detail-party-mandates-count { flex: 0 0 34px; text-align: right; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-bars-hdr { display: flex; align-items: center; gap: 10px; padding: 3px 14px; border-bottom: 1px solid var(--border); }
.detail-bars-hdr .dbh-spacer { flex: 1; }
.detail-col-hdr  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; text-align: right; }
.detail-col-old  { flex: 0 0 44px; }
.detail-col-diff { flex: 0 0 44px; }
.detail-old-pct  { flex: 0 0 44px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.detail-diff     { flex: 0 0 44px; text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-diff-sep { border-left: 1px solid rgba(0,0,0,.15); margin-left: 8px; }
.detail-diff.pos { color: #2a9d5c; }
.detail-diff.neg { color: #c0392b; }
.mandates-wrap      { display: flex; flex-wrap: wrap; gap: 4px; }
.mandate-chip       { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; font-weight: 600; }
.mandate-votes      { margin-left: 5px; opacity: .75; font-weight: 400; }

/* Mandate cutoff & non-mandate rows */
.mandate-card-count {
  margin-left: auto; font-size: 11px; opacity: .75; font-weight: 400;
}
.cand-cutoff {
  height: 2px; background: rgba(0,0,0,.18);
}
.cand-no-mandate {
  position: relative;
}
.cand-no-mandate::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(0,0,0,.045); pointer-events: none;
}

/* Candidate grid */
.cand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.cand-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.cand-header {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  color: #fff; font-size: 13px; font-weight: 700;
}
.cand-header-badge {
  width: 20px; height: 20px; border-radius: 4px; background: rgba(0,0,0,.22);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.cand-row {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-top: 1px solid rgba(0,0,0,.05); font-size: 12px;
}
.cand-nr    { width: 18px; text-align: right; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.cand-name  { flex: 1; }
.cand-name.italic { font-style: italic; color: var(--muted); }
.cand-votes { width: 34px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.cand-row.elected .cand-name { font-weight: 700; }
.cand-row.list-row { opacity: .8; }
