/* EDG Comité — design system (institutionnel sobre, thème clair).
   Un seul fichier partagé par toutes les pages (staff/admin et candidat). */

:root {
  /* Couleurs */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1f2733;
  --muted: #5b6472;
  --faint: #8a93a3;
  --border: #e4e8ef;
  --border-strong: #d4dae3;

  --primary: #2e5bff;
  --primary-dark: #1e46e0;
  --primary-weak: #eef2ff;
  --primary-border: #cdd8ff;

  --danger: #d23b30;
  --danger-dark: #b52d24;
  --danger-weak: #fdecea;
  --danger-border: #f4c7c2;

  --success: #2e8b45;
  --success-weak: #e9f6ec;
  --warning: #b7791f;

  /* Rayons, ombres, transitions */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --ring: 0 0 0 3px rgba(46, 91, 255, .18);
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.container { max-width: 76rem; margin: 0 auto; padding: 0 1.25rem 4rem; }
.container.narrow { max-width: 34rem; }

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; margin: 1.6rem 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 650; margin: 2.4rem 0 1rem; }
p { margin: .6rem 0; }
.lead { color: var(--muted); max-width: 48rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.link-back {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--muted); font-size: .9rem; margin: 0 0 1rem;
}
.link-back:hover { color: var(--primary); }
/* The committee detail page offers two ways back, so .link-back now wraps
   links rather than being one: they inherit its muted tone. */
.link-back a { color: inherit; }
.link-back a:hover { color: var(--primary); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
/* One line: the bar never wraps on a desktop width. The nav takes the space
   left by the brand and the account. No overflow clipping on the nav -- the
   folded "Administration" panel is positioned out of it and would be cut. */
.site-header .bar {
  max-width: 76rem; margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: nowrap;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); flex: 0 0 auto; white-space: nowrap; }
.brand .dot {
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak);
}
.site-header nav { display: flex; gap: 0; flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
@media (max-width: 700px) {
  .site-header .bar { flex-wrap: wrap; }
  .site-header nav { flex-wrap: wrap; }
}
.site-header nav a {
  color: var(--muted); font-size: .88rem; font-weight: 500; white-space: nowrap;
  padding: .35rem .45rem; border-radius: var(--radius-pill); text-decoration: none;
  transition: background .15s, color .15s;
}
.site-header nav a:hover { background: var(--primary-weak); color: var(--primary-dark); }
.site-header nav a.active { background: var(--primary-weak); color: var(--primary-dark); }
.site-header .me { color: var(--faint); font-size: .85rem; flex: 0 0 auto; white-space: nowrap; }

/* Folded "Administration" entry: a <details> styled like its siblings, its
   panel absolutely positioned under the summary. Closed by a click elsewhere
   or Escape (see base.html). */
.nav-menu { position: relative; flex: 0 0 auto; }
.nav-menu > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: .88rem; font-weight: 500;
  white-space: nowrap; padding: .35rem .45rem; border-radius: var(--radius-pill);
  transition: background .15s, color .15s;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::after { content: " ▾"; font-size: .8em; color: var(--faint); }
.nav-menu > summary:hover, .nav-menu[open] > summary, .nav-menu > summary.active { background: var(--primary-weak); color: var(--primary-dark); }
.nav-dropdown {
  position: absolute; top: calc(100% + .35rem); left: 0; z-index: 30; min-width: 12rem;
  display: flex; flex-direction: column; gap: .1rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.nav-dropdown a { border-radius: var(--radius-sm); }
/* Below this width the admin nav (eight entries) would start scrolling: drop the
   role reminder rather than clip a destination. */
@media (max-width: 1200px) { .site-header .me .role { display: none; } }
.site-header .me a { color: var(--muted); }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.4rem;
  margin: 1rem 0;
}
.card.pad-lg { padding: 1.6rem 1.8rem; }

.panel {
  background: var(--primary-weak);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.panel .sep { color: var(--primary-border); margin: 0 .5rem; }

/* ---------- Matching result: prominent solve time + teaching panel ---------- */
.solve-time {
  text-align: center;
  background: var(--success-weak);
  border: 1px solid #bfe2c8;
  border-radius: var(--radius);
  padding: 1.4rem 1rem 1.1rem;
  margin: 1.2rem 0;
}
.solve-time-value {
  font-size: clamp(2.8rem, 9vw, 4.4rem);
  font-weight: 800;
  line-height: 1;
  color: var(--success);
  letter-spacing: -0.02em;
}
.solve-time-label { margin-top: .5rem; color: var(--muted); font-size: .95rem; }

/* ---------- Wish distribution (tiles, dark→light green by rank) ---------- */
.dist { margin: 1.2rem 0; }
.dist > h2 { margin-bottom: .55rem; }
.dist-tiles { display: flex; flex-wrap: wrap; gap: .6rem; }
.dist-tile { flex: 1 1 96px; min-width: 88px; border-radius: var(--radius-sm); padding: .6rem .7rem; text-align: center; line-height: 1.15; box-shadow: var(--shadow-sm); }
.dist-tile-label { font-size: .82rem; font-weight: 600; }
.dist-tile-label sup { font-size: .72em; }
.dist-tile-count { font-size: 1.55rem; font-weight: 800; margin: .12rem 0; }
.dist-tile-pct { font-size: .82rem; opacity: .92; }
/* Affectations table: each row is tinted with its rank colour code (same as the
   tiles); the candidate number is bold, and "Échanger" is a light pill button so
   it stays legible on any row colour. */
.cell-wish { font-weight: 700; }
.btn-swap {
  display: inline-block; padding: .25rem .65rem; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--primary-dark); border: 1px solid var(--primary-border);
  font-size: .82rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn-swap:hover { background: var(--primary-weak); text-decoration: none; }

/* ---------- Danger callout ---------- */
.callout-danger {
  background: var(--danger-weak); border: 1px solid var(--danger-border);
  border-left: 4px solid var(--danger); color: var(--danger-dark);
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 1.3rem 0; line-height: 1.45;
}

.edu { margin: 1.4rem 0; }
.edu > h2 { margin-bottom: .6rem; }
.edu-scale { border-top: 1px dashed var(--border-strong); padding-top: .7rem; color: var(--text); }
.edu-text sup { font-size: .7em; }
.edu-body { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: flex-start; }
.edu-text { flex: 1 1 320px; }
.edu-text p { margin: 0 0 .7rem; }
.edu-graphic { flex: 1 1 360px; margin: 0; }
.edu-graphic svg { width: 100%; height: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.edu-graphic figcaption { margin-top: .4rem; color: var(--faint); font-size: .82rem; text-align: center; }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem; margin: 1.2rem 0;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.2rem;
}
.stat .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.stat .value small { font-size: 1rem; color: var(--faint); font-weight: 500; }

/* Progress bar */
.progress { background: #e9edf4; border-radius: var(--radius-pill); height: .55rem; overflow: hidden; margin-top: .5rem; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress.complete > span { background: var(--success); }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto; margin: 1rem 0;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
/* A wide roster scrolls inside .table-wrap rather than folding a badge over
   four lines: cells that carry a status or a committee name never wrap. */
td.nowrap { white-space: nowrap; }
thead th {
  background: var(--surface-2); color: var(--muted);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-warn { color: var(--danger); font-weight: 600; }

/* Sortable / filterable tables (table-tools.js). The classes below are only
   ever added by that script, so a browser without it sees the plain table. */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th.sortable:focus-visible { outline: none; box-shadow: var(--ring); }
/* The caret is a pseudo-element so it never lands in textContent -- the sort
   comparator and the column filters both read cell text. */
thead th.sortable::after { content: "\2195"; opacity: .35; margin-left: .35em; font-size: .9em; }
thead th[aria-sort="ascending"]::after { content: "\2191"; opacity: 1; }
thead th[aria-sort="descending"]::after { content: "\2193"; opacity: 1; }

thead tr.filter-row th, thead tr.filter-row td {
  background: var(--surface-2); padding: .35rem .5rem;
  border-bottom: 1px solid var(--border);
}
.column-filter {
  width: 100%; min-width: 4rem; box-sizing: border-box;
  padding: .3rem .45rem; font-size: .82rem; font-weight: 400;
  text-transform: none; letter-spacing: normal;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.column-filter:focus-visible { outline: none; box-shadow: var(--ring); }
.table-count { margin: -.5rem 0 1rem; }

/* scroll container inside a full-width block, no card chrome */
.scroll-box { max-height: 22rem; overflow-y: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.05rem; font-size: .92rem; font-weight: 600; line-height: 1;
  background: var(--primary); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-dark); }
.btn.sm { padding: .35rem .7rem; font-size: .82rem; }

.actions { margin-top: 1.4rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Inline delete forms + action cells in tables */
form.inline { display: inline; }
.row-actions { display: inline-flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 1.2rem; }
.inline-form { margin: 0; display: inline; }
.panel.notice { background: var(--primary-weak); border-color: var(--primary-border); color: var(--primary-dark); }
/* Whole-row links (matching history): the row navigates on click. */
.rows-linked tbody tr { cursor: pointer; }
.rows-linked tbody tr:hover { background: var(--surface-2); }

/* ---------- Forms ---------- */
.form { max-width: 26rem; }
.form.form-wide { max-width: 46rem; }
.form.form-wide > input[type="text"], .form.form-wide > input[type="number"] { max-width: 26rem; }
label { display: block; margin: 1rem 0 .3rem; font-weight: 600; font-size: .88rem; }
input, select, textarea {
  width: 100%; padding: .5rem .6rem; font-size: .95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
label.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin-top: 1rem; }
label.checkbox input { width: auto; }
.hint { margin: 1.2rem 0 .2rem; font-size: .85rem; color: var(--muted); }

/* ---------- Alerts / badges ---------- */
.errors, .alert {
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem;
  border: 1px solid var(--danger-border); background: var(--danger-weak); color: #8a2018;
}
.errors ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alert.info { background: var(--primary-weak); border-color: var(--primary-border); color: var(--primary-dark); }
.alert.success { background: var(--success-weak); border-color: #bfe3c6; color: #1d5e2c; }

.badge {
  display: inline-block; padding: .12rem .55rem; border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.badge.primary { background: var(--primary-weak); color: var(--primary-dark); border-color: var(--primary-border); }
.badge.success { background: var(--success-weak); color: #1d5e2c; border-color: #bfe3c6; }

/* ---------- Public (candidate) shell ---------- */
.public { max-width: 60rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.public-centered { max-width: 34rem; margin: 0 auto; padding: 5rem 1.25rem; text-align: center; }
.public-header { margin-bottom: 1.5rem; }
.public-header .brand { font-size: 1.05rem; }

/* ---------- Committee drag-and-drop ranking (wishes) ---------- */
.rank-list { list-style: none; padding: 0; margin: 1.2rem 0; counter-reset: rank; }
.committee {
  display: flex; align-items: center; gap: .9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: .7rem .9rem; margin-bottom: .6rem;
  transition: box-shadow .15s, border-color .15s, transform .05s;
}
.committee:hover { box-shadow: var(--shadow); }
.committee.dragging { opacity: .55; }
.committee.drop-target { border-color: var(--primary); box-shadow: var(--ring); }
.rank-badge {
  flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
}
.grip { flex: 0 0 auto; cursor: grab; color: var(--faint); font-size: 1.25rem; user-select: none; line-height: 1; }
.grip:active { cursor: grabbing; }
.committee-label { flex: 1 1 auto; min-width: 8rem; font-weight: 500; }

/* Per-committee flat colour emblem (see web/emblems.py). Large on the wish
   cards (postcard-like), small inline in tables and headings. */
.committee-emblem { display: inline-block; vertical-align: middle; }
.committee > .committee-emblem {
  flex: 0 0 auto; width: 3.25rem; height: 3.25rem; border-radius: 11px;
  box-shadow: var(--shadow-sm);
}
td .committee-emblem, th .committee-emblem, h1 .committee-emblem {
  width: 1.6em; height: 1.6em; border-radius: 5px;
  vertical-align: -0.4em; margin-right: .45em;
}
.committee-fields { flex: 0 0 auto; display: flex; gap: .7rem; flex-wrap: wrap; }

/* ---------- Podium: most-demanded committees ---------- */
.podium-wrap { margin: 1.6rem 0; }
.podium-scroll { overflow-x: auto; padding-bottom: .3rem; }
.podium {
  list-style: none; margin: .8rem auto 0; padding: 0;
  display: flex; align-items: flex-end; justify-content: center; gap: .8rem;
  min-width: min-content;
}
.podium-col { display: flex; flex-direction: column; align-items: center; width: 8.5rem; flex: 0 0 auto; }
.podium-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: .7rem .6rem; text-align: center; width: 100%;
  color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
a.podium-card:hover {
  border-color: var(--primary-border); box-shadow: var(--shadow-md);
  text-decoration: none; transform: translateY(-1px);
}
a.podium-card:focus-visible { outline: none; box-shadow: var(--ring); }
a.podium-card:hover .podium-name { color: var(--primary-dark); }
.podium-medal { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.podium-card .committee-emblem { width: 2.6rem; height: 2.6rem; border-radius: 8px; display: block; margin: .35rem auto; }
.podium-name { display: block; font-weight: 650; font-size: .92rem; color: var(--text); }
.podium-avg { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.podium-step { width: 100%; margin-top: .5rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.podium-col-1 .podium-step { height: 3.6rem; background: linear-gradient(#f6d365, #e0a93a); }
.podium-col-2 .podium-step { height: 2.8rem; background: linear-gradient(#e2e8f0, #b9c3ce); }
.podium-col-3 .podium-step { height: 2.1rem; background: linear-gradient(#e9c8a3, #c98f56); }
/* 4th/5th: no medal, so no metal -- a flat warm sand, deliberately far from the
   cool grey-blue of silver, and lighter than any of the three metals. */
.podium-col-4 .podium-step, .podium-col-5 .podium-step { height: 1.4rem; background: #ece6da; }
.podium-col-1 .podium-card { border-color: #e6b422; }
.committee-fields label { margin: 0; font-weight: 500; font-size: .75rem; color: var(--muted); }
.committee-fields select { min-width: 9rem; padding: .35rem .5rem; font-size: .88rem; }
.move-buttons { flex: 0 0 auto; display: flex; flex-direction: column; gap: .15rem; }
.move-buttons button {
  width: auto; padding: .05rem .45rem; font-size: .7rem; line-height: 1.3; cursor: pointer;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 5px;
}
.move-buttons button:hover { background: var(--primary-weak); color: var(--primary-dark); border-color: var(--primary-border); }

@media (max-width: 640px) {
  .committee { flex-wrap: wrap; }
  .committee-fields { width: 100%; }
}

/* Easter egg : texte de la couleur du fond de carte, donc illisible tant qu'on ne le
   surligne pas. Le `::selection` explicite est indispensable — avec `color: transparent`
   ou sans cette règle, la sélection ne rend pas forcément le texte lisible selon le
   navigateur. Masqué aux lecteurs d'écran (aria-hidden côté gabarit), d'où le lien
   volontairement hors du parcours clavier (tabindex="-1") pour ne pas laisser un élément
   focalisable invisible. */
.easter-egg {
  color: var(--surface);
  font-size: .8rem;
  line-height: 1.5;
  margin: 1.75rem 0 0;
}
.easter-egg a { color: inherit; text-decoration: none; }
.easter-egg::selection, .easter-egg *::selection {
  color: var(--text);
  background: var(--primary-weak);
}

/* ---------- List / tile view switch (committees) ---------- */
.view-switch {
  display: inline-flex; margin-left: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: var(--surface); overflow: hidden;
}
.view-switch a {
  padding: .4rem .85rem; font-size: .85rem; font-weight: 600;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.view-switch a:hover { background: var(--surface-2); text-decoration: none; }
.view-switch a.active { background: var(--primary-weak); color: var(--primary-dark); }

/* ---------- Committee tiles ---------- */
.tile-grid {
  display: grid; gap: .9rem; margin: 1rem 0;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.tile {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: .9rem 1rem;
}
.tile-head { display: block; color: inherit; text-decoration: none; }
.tile-head:hover { text-decoration: none; }
.tile-head:hover .tile-name { color: var(--primary-dark); }
.tile-head .committee-emblem { width: 3rem; height: 3rem; border-radius: 10px; display: block; }
.tile-name { display: block; margin-top: .5rem; font-weight: 650; line-height: 1.25; }
.tile-number { display: block; font-size: .78rem; color: var(--faint); }
.tile-facts { margin: .7rem 0 0; font-size: .85rem; }
.tile-facts > div { display: flex; gap: .5rem; padding: .15rem 0; }
.tile-facts dt { color: var(--muted); flex: 0 0 6.5rem; }
.tile-facts dd { margin: 0; }
.tile-actions {
  display: flex; gap: .6rem; align-items: center;
  margin-top: auto; padding-top: .8rem; font-size: .85rem;
}

/* ---------- Settings: labelled checkbox rows ---------- */
.switch-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.switch-list > li { border-top: 1px solid var(--border); }
.switch-list > li:first-child { border-top: none; }
.switch {
  display: flex; align-items: flex-start; gap: .7rem;
  margin: 0; padding: .8rem .2rem; font-weight: 400; cursor: pointer;
}
.switch input { width: auto; margin: .15rem 0 0; flex: 0 0 auto; }
.switch small { display: block; color: var(--muted); font-size: .84rem; margin-top: .1rem; }

/* ---------- Dataviz (committee detail) ----------
   Marks stay thin and quiet: hairline tracks, 4px rounded data-ends, a 2px
   surface gap between touching segments; text never wears the series colour. */
.viz { margin: 1.6rem 0; }
.viz h2 { margin-bottom: .3rem; }
.viz h3 { font-size: .95rem; margin: 0 0 .5rem; }
.viz .lead { margin-top: 0; }
.viz-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem 2rem; }

/* Column chart: one column per rank, height = share of the tallest column. */
.viz-columns {
  display: flex; align-items: flex-end; gap: .35rem;
  padding: .6rem .8rem .4rem; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.viz-col { flex: 1 1 0; min-width: 1.6rem; max-width: 3.4rem; text-align: center; }
.viz-col-value { height: 1.1rem; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz-col-plot { height: 9rem; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--border-strong); }
.viz-col-plot > span { display: block; width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; min-height: 0; }
.viz-col-axis { font-size: .78rem; color: var(--muted); padding-top: .25rem; font-variant-numeric: tabular-nums; }

/* Stacked horizontal bar (part-to-whole) + legend. */
.viz-stack { display: flex; height: 1.5rem; gap: 2px; border-radius: 4px; overflow: hidden; }
.viz-seg { display: flex; align-items: center; justify-content: center; min-width: 0; color: #fff; font-size: .78rem; }
.viz-seg:first-child { border-radius: 4px 0 0 4px; }
.viz-seg:last-child { border-radius: 0 4px 4px 0; }
.viz-legend { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .82rem; }
.viz-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }

/* Horizontal magnitude bars: label · track · value at the tip. */
.viz-hbars { display: flex; flex-direction: column; gap: .4rem; }
.viz-hbar { display: grid; grid-template-columns: 8rem 1fr 2.5rem; align-items: center; gap: .6rem; font-size: .85rem; }
.viz-hbar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-hbar-track { display: block; height: .8rem; background: var(--surface-2); border-radius: 4px; }
.viz-hbar-track > span { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.viz-hbar-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* Capacity meter: fill = assigned / max; the state (under / within / over
   capacity) picks the hue, and the figure beside it says the same thing. */
.meter { background: #e9edf4; border-radius: var(--radius-pill); height: .55rem; overflow: hidden; margin-top: .5rem; }
.meter > span { display: block; height: 100%; border-radius: inherit; }
.meter-ok > span { background: var(--success); }
.meter-under > span { background: var(--warning); }
.meter-over > span { background: var(--danger); }

/* Honoured-wish chip in the assignment table: the rank's own colour. */
.rank-chip {
  display: inline-block; min-width: 1.8rem; padding: .1rem .45rem; border-radius: var(--radius-pill);
  font-size: .8rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}

.viz-tables { margin: 1rem 0; }
.viz-tables > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.viz-tables > summary:hover { color: var(--primary-dark); }

/* ---------- Checkbox list in a form (tutored committees) ---------- */
fieldset.checks { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .9rem .8rem; margin: 1.2rem 0 0; }
fieldset.checks > legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
fieldset.checks .hint { margin: .2rem 0 .6rem; }
fieldset.checks label.checkbox { margin-top: .35rem; font-size: .92rem; }
fieldset.checks .committee-emblem { width: 1.3rem; height: 1.3rem; border-radius: 4px; }

/* Inline committee chip (CPG accounts list) */
.chip {
  display: inline-flex; align-items: center; gap: .3rem; margin: .1rem .3rem .1rem 0;
  padding: .1rem .5rem .1rem .25rem; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--primary-border); color: var(--primary-dark); text-decoration: none; }
.chip .committee-emblem { width: 1.1rem; height: 1.1rem; border-radius: 3px; }

/* A tile that is entirely a link (the CPG's tutored committees) */
.tile-link { color: inherit; text-decoration: none; }
.tile-link:hover { text-decoration: none; border-color: var(--primary-border); box-shadow: var(--shadow-md); }
.tile-link .committee-emblem { width: 3rem; height: 3rem; border-radius: 10px; display: block; }

/* ---------- Quota grid (committee form) and matching parameters page ---------- */
.quota-table { max-width: none; }
.quota-grid input[type="number"], .params-grid input[type="number"] { width: 5.5rem; padding: .3rem .45rem; font-size: .9rem; text-align: right; }
.quota-grid td, .params-grid td { padding: .35rem .6rem; }
.params-grid .committee-emblem { width: 1.3rem; height: 1.3rem; border-radius: 4px; margin-right: .35rem; }
.params-grid td.name { white-space: nowrap; }
.params-grid td.quotas { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.params-grid td.check { text-align: center; }
.params-grid td.check input { width: 1.1rem; height: 1.1rem; }
.params-grid tfoot td { border-top: 2px solid var(--border-strong); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.params-grid tr.totals-bad td { background: var(--danger-weak); }
