/* CapZero Horlogerie : système de design « pétrole / Strates » (repris de CapZéro).
   Toujours utiliser les variables, jamais de hex en dur dans les vues (sinon dark casse). */

/* Les trois polices de la charte sont declarees dans `css/fonts.css`, servi par
   l'application (voir base.html). Elles venaient de Google Fonts : la CSP de l'app
   (style-src / font-src 'self') bloquait cet import, donc aucune ne se chargeait. */

:root,
:root[data-theme="bright"] {
  --p: #1B4965; --ps: #15384f; --pp: #e8f0f4; --brand: #1B4965;
  --tx: #152430; --tx2: #51646F; --tx3: #7E929D;
  --bg: #F5F6F6; --srf: #ffffff; --srf2: #F1F3F2; --srf3: #E2E5E6;
  --line: #dfe4e5;
  --scope1: #2D6A4F; --scope2: #8D6E33; --scope3: #565A7C;
  --d: #C24D3A; --w: #8D6E33; --ok: #2D6A4F;
  --notif: #E5484D; --notif-fg: #ffffff;
  --g1: #3E8E68; --g2: #2E6F9B; --g3: #B58C3E; --g4: #7B81B0; --g5: #64766E; --g6: #AB5F7E;
  /* Contours de provenance des fournisseurs (vifs, pour distinguer nettement chaque type). */
  --prov-acv: #12A150; --prov-plat: #2563EB; --prov-maison: #0F172A;
  --r-xs: 7px; --r-sm: 10px; --r-md: 14px; --r-lg: 16px;
  --shadow: 0 10px 30px rgba(13,27,38,.08);
  /* Alias pour les composants portés de CapZéro */
  --ln: var(--line); --ln2: rgba(27,48,62,.25); --shadow-soft: 0 3px 12px rgba(13,27,38,.05);
  --s: var(--scope1); --bg2: #ECEEED; --surface-mint: #F1F7F3;
}

:root[data-theme="dark"] {
  --p: #4F93B8; --ps: #6aa7c9; --pp: #17303d; --brand: #5aa0c4;
  --tx: #E7EDF0; --tx2: #A9BCC6; --tx3: #7C919C;
  --bg: #0E1A22; --srf: #14232D; --srf2: #182b36; --srf3: #21323d;
  --line: #263843;
  --scope1: #4C9E78; --scope2: #C1954A; --scope3: #8288AE;
  --d: #D9694F; --w: #C1954A; --ok: #4C9E78;
  --notif: #F2555A; --notif-fg: #ffffff;
  --g1: #4C9E78; --g2: #3E88BC; --g3: #C1954A; --g4: #9096C4; --g5: #7E9088; --g6: #C0728F;
  --prov-acv: #2FD07A; --prov-plat: #5C9DFF; --prov-maison: #E7EDF0;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --ln: var(--line); --ln2: rgba(232,238,242,.2); --shadow-soft: 0 3px 12px rgba(0,0,0,.25);
  --s: var(--scope1); --bg2: #161A1C; --surface-mint: #F1F7F3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Onest', system-ui, sans-serif;
  background: radial-gradient(circle at 18% 8%, var(--bg2) 0%, var(--bg) 52%); color: var(--tx);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 650; color: var(--tx); margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.12rem; }
a { color: var(--p); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, .num { font-family: 'IBM Plex Mono', monospace; font-feature-settings: "tnum"; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.page { padding: 26px 0 60px; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--tx2); }
.small { font-size: .86rem; }
.tx3 { color: var(--tx3); }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; gap: 14px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ── Header applicatif ──────────────────────────────────────────────── */
.appbar { position: sticky; top: 0; z-index: 40; background: var(--srf); border-bottom: 1px solid var(--line); }
.appbar-in { display: flex; align-items: center; gap: 18px; height: 58px; max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.16rem; color: var(--tx); }
.brand:hover { text-decoration: none; }
.brand .bmk { width: 20px; height: 20px; color: var(--brand); flex: none; }
.brand .wm .z { color: var(--brand); }
.brand .suffix { font-style: italic; font-weight: 500; color: var(--tx2); font-size: .95rem; }
/* Onglets du header (maison / admin) : même forme que les onglets du bilan (.acv-tab) : soulignés, pas de pastille. */
.navtabs { display: flex; gap: 0; align-items: stretch; height: 100%; overflow-x: auto; }
.navtabs a { display: inline-flex; align-items: center; padding: 0 4px; margin: 0 12px; border-radius: 0; border-bottom: 2px solid transparent; color: var(--tx2); font-weight: 500; font-size: .92rem; white-space: nowrap; }
.navtabs a:hover { background: transparent; color: var(--tx); text-decoration: none; }
.navtabs a.active { color: var(--brand); background: transparent; border-bottom-color: var(--brand); font-weight: 600; }
.appbar .actions { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--pp); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
a.avatar:hover { text-decoration: none; }
.avatar-img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: block; }

/* ── Cartes ─────────────────────────────────────────────────────────── */
.card { background: var(--srf); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow); }
.card.pad-lg { padding: 24px; }
.card h3 { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

/* ── KPI ────────────────────────────────────────────────────────────── */
.kpi { background: var(--srf); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.kpi .label { color: var(--tx2); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-family: 'IBM Plex Mono', monospace; font-size: 1.72rem; font-weight: 600; color: var(--tx); margin-top: 4px; }
.kpi .value.small { font-size: 1.25rem; }
.kpi .sub { color: var(--tx3); font-size: .82rem; margin-top: 2px; }

/* ── Boutons ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: .92rem; font-weight: 600;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--srf); color: var(--tx); cursor: pointer; transition: .12s; }
.btn:hover { background: var(--srf2); text-decoration: none; }
.btn.primary { background: var(--p); border-color: var(--p); color: #fff; }
.btn.primary:hover { background: var(--ps); }
.btn.danger { background: var(--srf); border-color: var(--d); color: var(--d); }
.btn.danger:hover { background: var(--d); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: .84rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--srf2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--srf2); color: var(--tx2); border: 1px solid var(--line); }
.badge.s1 { background: color-mix(in srgb, var(--scope1) 14%, transparent); color: var(--scope1); border-color: transparent; }
.badge.s2 { background: color-mix(in srgb, var(--scope2) 14%, transparent); color: var(--scope2); border-color: transparent; }
.badge.s3 { background: color-mix(in srgb, var(--scope3) 16%, transparent); color: var(--scope3); border-color: transparent; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); border-color: transparent; }
.badge.warn { background: color-mix(in srgb, var(--w) 16%, transparent); color: var(--w); border-color: transparent; }
.badge.danger { background: color-mix(in srgb, var(--d) 15%, transparent); color: var(--d); border-color: transparent; }
.badge.q-acv { background: color-mix(in srgb, var(--scope1) 15%, transparent); color: var(--scope1); border-color: transparent; }
.badge.q-acv_interne { background: color-mix(in srgb, var(--scope3) 16%, transparent); color: var(--scope3); border-color: transparent; }
.badge.q-questionnaire { background: color-mix(in srgb, var(--scope2) 16%, transparent); color: var(--scope2); border-color: transparent; }
.badge.q-spend { background: var(--srf3); color: var(--tx2); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.mtable { width: 100%; border-collapse: collapse; }
.mtable th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tx3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
/* Unité (tCO₂e / kgCO₂e) : jamais capitalisée, même dans un en-tête en majuscules. */
.nocaps { text-transform: none; }
.mtable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mtable tr:last-child td { border-bottom: none; }
.mtable tr:hover td { background: var(--srf2); }
.mtable .num { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ── Formulaires ────────────────────────────────────────────────────── */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--tx2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; font-family: inherit; font-size: .94rem; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--srf); color: var(--tx); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px var(--pp); }
.field { margin-bottom: 14px; }
.field .hint { font-size: .8rem; color: var(--tx3); margin-top: 4px; font-weight: 400; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2351646F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* ── Calendrier (composant .dp, cf. static/js/date-picker.js) ───────────────
   Le sélecteur natif de <input type=date> appartient au navigateur : apparence variable d'un
   poste à l'autre, insensible à nos variables de thème, et incapable de dire quelles dates
   portent une donnée. On le remplace par un bouton et un popup à nous. */
.dp { position: relative; display: inline-flex; }
.dp-btn {
  display: inline-flex; align-items: center; gap: 9px; font-family: inherit; font-size: .94rem;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--srf); color: var(--tx); font-variant-numeric: tabular-nums;
  cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dp-btn:hover { border-color: var(--ln2); }
.dp-btn:focus-visible { outline: none; border-color: var(--p); box-shadow: 0 0 0 3px var(--pp); }
.dp-btn .pi { font-size: .88rem; color: var(--tx3); transition: color .15s; }
.dp-btn:hover .pi, .dp[aria-expanded] .dp-btn[aria-expanded="true"] .pi { color: var(--p); }

/* Posé sur <body> en position fixe : dans le flux, la carte le rognerait et les rangées
   suivantes passeraient au-dessus (chacune ouvre son propre contexte d'empilement). */
.dp-pop {
  position: fixed; z-index: 200; width: 268px; padding: 14px;
  background: var(--srf); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg, var(--shadow)); animation: dpIn .14s ease-out; }
@keyframes dpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-mois { font-weight: 600; font-size: .92rem; color: var(--tx); text-transform: capitalize; }
.dp-nav {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 1px solid transparent; border-radius: 8px; background: none; color: var(--tx2);
  cursor: pointer; transition: .12s; font-size: .78rem; }
.dp-nav:hover:not(:disabled) { background: var(--srf2); color: var(--brand); }
.dp-nav:disabled { opacity: .3; cursor: default; }

.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow {
  text-align: center; font-size: .7rem; font-weight: 700; color: var(--tx3);
  text-transform: uppercase; letter-spacing: .04em; padding-bottom: 6px; }
.dp-d {
  aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: none;
  font-family: inherit; font-size: .82rem; cursor: pointer; position: relative;
  transition: .12s; padding: 0; }
/* Un jour relevé se lit d'un coup d'œil : plein, contrasté, cliquable. */
.dp-d.dispo { background: var(--srf2); color: var(--tx); font-weight: 600; }
.dp-d.dispo:hover { background: color-mix(in srgb, var(--p) 14%, var(--srf)); color: var(--brand); }
/* Jour sans relevé : rien n'a été mesuré, donc rien à comparer. Éteint et non cliquable. */
.dp-d.vide { color: var(--tx3); opacity: .38; cursor: default; }
.dp-d.autre.vide { opacity: .22; }
.dp-d.auj { text-decoration: underline; text-underline-offset: 3px; }
.dp-d.on { background: var(--p); color: #fff; font-weight: 700; }
.dp-d.on:hover { background: var(--p); color: #fff; }
.dp-d:focus-visible { outline: none; border-color: var(--p); }
.dp-foot { margin: 10px 0 0; font-size: .72rem; line-height: 1.4; color: var(--tx3); }
@media (prefers-reduced-motion: reduce) { .dp-pop { animation: none; } }

/* ── Strates (accueil modules) ──────────────────────────────────────── */
.strates { display: flex; flex-direction: column; gap: 8px; }
.strate { display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: var(--r-md); color: #fff; text-decoration: none; position: relative; overflow: hidden; transition: .15s; }
.strate:hover { transform: translateX(3px); text-decoration: none; }
.strate .st-num { font-family: 'IBM Plex Mono', monospace; font-size: .82rem; opacity: .8; }
.strate .st-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 650; font-size: 1.15rem; }
.strate .st-desc { opacity: .85; font-size: .88rem; }
.strate .st-body { flex: 1; }
.strate .st-meta { font-family: 'IBM Plex Mono', monospace; font-size: .78rem; opacity: .9; white-space: nowrap; }
.strate.locked { background: var(--srf2); color: var(--tx3); border: 1px dashed var(--line); cursor: pointer; padding: 13px 22px; }
.strate.locked .st-title { font-size: .98rem; color: var(--tx2); }
.strate .lock-ic { width: 16px; height: 16px; }

/* ── Barres par étape / segments ────────────────────────────────────── */
.segbar { display: flex; height: 26px; border-radius: var(--r-xs); overflow: hidden; background: var(--srf2); }
.segbar > span { display: block; height: 100%; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: .82rem; }
.seg-legend .it { display: flex; align-items: center; gap: 6px; color: var(--tx2); }
.seg-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.g1{background:var(--g1)} .g2{background:var(--g2)} .g3{background:var(--g3)} .g4{background:var(--g4)} .g5{background:var(--g5)} .g6{background:var(--g6)}
.bar-track { height: 10px; border-radius: 999px; background: var(--srf3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--p); }

/* ── Modales ────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,28,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: var(--srf); border-radius: var(--r-lg); padding: 26px; max-width: 560px; width: 100%; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }

/* ── Divers ─────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--tx3); }
.empty .cap { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .5; }
.flash { padding: 11px 16px; border-radius: var(--r-sm); margin-bottom: 16px; font-size: .9rem; font-weight: 500; }
.flash.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.flash.err { background: color-mix(in srgb, var(--d) 12%, transparent); color: var(--d); }
.flash.scenario { background: color-mix(in srgb, var(--p) 10%, transparent); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.pill-tabs { display: inline-flex; gap: 4px; background: var(--srf2); padding: 4px; border-radius: var(--r-sm); }
.pill-tabs a { padding: 6px 14px; border-radius: var(--r-xs); font-size: .88rem; font-weight: 600; color: var(--tx2); }
.pill-tabs a.active { background: var(--srf); color: var(--brand); box-shadow: var(--shadow); }
.pill-tabs a:hover { text-decoration: none; }
.sv-ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.list-reset { list-style: none; padding: 0; margin: 0; }

/* ── Transitions de page (View Transitions cross-document ; no-op si non supporté) ── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: czVtOut .14s ease both; }
::view-transition-new(root) { animation: czVtIn .2s ease both; }
@keyframes czVtOut { to { opacity: 0; } }
@keyframes czVtIn { from { opacity: 0; transform: translateY(6px); } }

/* ── Apparitions staggerées ── */
@keyframes czIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
.ai { opacity: 0; animation: czIn .5s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--i, 0) * 55ms); }

/* ── Chips de filtre ── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--srf); color: var(--tx2); border-radius: 999px; padding: 6px 14px; font-size: .86rem; font-weight: 600; cursor: pointer; transition: .15s; font-family: inherit; }
.chip:hover { border-color: var(--p); color: var(--p); }
.chip.on, .chip.active { background: var(--pp); border-color: var(--p); color: var(--brand); }

/* ── Appbar mode module (espace fournisseur) ── */
.modnav { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mod-back { display: inline-flex; align-items: center; gap: 5px; color: var(--tx2); font-weight: 600; font-size: .88rem; padding: 6px 10px; border-radius: var(--r-sm); }
.mod-back:hover { background: var(--srf2); text-decoration: none; }
.mod-sep { width: 1px; height: 20px; background: var(--line); }
.mod-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1rem; color: var(--tx); white-space: nowrap; }

/* ── Recherche de facteurs d'émission (ACV + bilan) ── */
.fx-bar { display: flex; gap: 8px; align-items: center; }
.fx-bar input[type=search] { flex: 1; min-width: 0; }
.fx-bar select { width: auto; min-width: 148px; flex: none; font-size: .86rem; padding: 9px 30px 9px 10px; }
.fx-res { max-height: 210px; overflow-y: auto; margin-top: 6px; border-radius: var(--r-sm); }
.fx-res:not(:empty) { border: 1px solid var(--line); }
.fx-item { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.fx-item:last-child { border-bottom: none; }
.fx-item:hover { background: var(--srf2); }
.fx-lbl { font-weight: 500; font-size: .9rem; line-height: 1.3; }
.fx-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: .74rem; color: var(--tx3); }
.fx-tag { font-family: 'IBM Plex Mono', monospace; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 5px;
  background: color-mix(in srgb, var(--p) 12%, transparent); color: var(--brand); }
.fx-sel:not(:empty) { margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--srf2); border: 1px solid var(--line); }
.fx-pg { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.fx-pg:empty { display: none; }
.fx-count { font-family: 'IBM Plex Mono', monospace; font-size: .72rem; color: var(--tx3); }

/* ── Modale d'arborescence des facteurs ── */
.fb-modal { max-width: 560px; width: 92vw; }
.fb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fb-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 10px; font-size: .8rem; }
.fb-crumb .fb-bc { background: none; border: none; color: var(--p); cursor: pointer; font-size: .8rem; padding: 2px 4px; font-weight: 600; }
.fb-crumb .fb-bc:hover { text-decoration: underline; }
.fb-crumb .fb-sep { color: var(--tx3); }
.fb-list { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.fb-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.fb-row:last-child { border-bottom: none; }
.fb-row:hover { background: var(--srf2); }
.fb-row .fb-nm { font-weight: 500; font-size: .9rem; flex: 1; }
.fb-row .fb-meta { display: flex; align-items: center; gap: 8px; font-size: .72rem; color: var(--tx3); }
.fb-cat .fb-chev { width: 15px; height: 15px; color: var(--tx3); flex: none; }

/* ── Catalogue : barre d'outils, chips de catégorie, pagination ── */
.cat-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; }
.cat-toolbar input[type=search] { flex: 1; min-width: 200px; }
.cat-toolbar select { width: auto; flex: none; font-size: .86rem; padding: 9px 30px 9px 10px; }
.cat-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-chips .chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--srf); color: var(--tx2); text-decoration: none; font-size: .8rem; transition: .15s; }
.cat-chips .chip:hover { border-color: color-mix(in srgb, var(--p) 40%, var(--line)); }
.cat-chips .chip.on { border-color: var(--p); background: color-mix(in srgb, var(--p) 10%, var(--srf)); color: var(--brand); font-weight: 600; }
.cat-pg { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }

/* ── Choix du mode de saisie ACV (plateforme / déclarée) ── */
.mode-choice { display: flex; flex-direction: column; gap: 8px; }
.mode-opt { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.mode-opt:hover { border-color: color-mix(in srgb, var(--p) 40%, var(--line)); }
.mode-opt input { margin-top: 3px; flex: none; }
.mode-opt span { display: flex; flex-direction: column; gap: 2px; }
.mode-opt:has(input:checked) { border-color: var(--p); background: color-mix(in srgb, var(--p) 6%, var(--srf)); }

/* Badge de source dans les tableaux de lignes (traçabilité) */
.src-tag { font-family: 'IBM Plex Mono', monospace; font-size: .68rem; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  background: var(--srf3); color: var(--tx2); white-space: nowrap; }

/* ── Pulse (attirer l'œil sur une carte) ── */
@keyframes czPulse { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--p) 28%, transparent); } }
.pulse { animation: czPulse 1.1s ease 2; }

/* ── Sélecteur de langue ────────────────────────────────────────────────────────── */
.lang { position: relative; display: inline-block; }
.lang-btn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--srf); color: var(--tx2); cursor: pointer;
  font-family: inherit; font-size: .8rem; transition: border-color .15s, background .15s; }
.lang-btn:hover { border-color: color-mix(in srgb, var(--p) 40%, var(--line)); background: var(--srf2); }
.lang-code { font-family: 'IBM Plex Mono', monospace; font-weight: 600; letter-spacing: .02em; }
.dr { width: 22px; height: 22px; flex: none; display: block; }
/* Le liseré et la coupure sont dessinés APRÈS les deux moitiés : ils recouvrent la jointure,
   où l'anticrénelage laisse sinon un fil clair entre les deux demi-disques. */
.dr-sep { stroke: var(--srf); stroke-width: 1.1; fill: none; opacity: .55; }
.dr-bord { fill: none; stroke: color-mix(in srgb, var(--tx) 22%, transparent); stroke-width: 1.2; }
.lang-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 90; min-width: 178px;
  padding: 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--srf);
  box-shadow: var(--shadow); display: none; }
.lang-pop.on { display: block; }
.lang-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--tx2); text-decoration: none; font-size: .88rem; }
.lang-opt:hover { background: var(--srf2); }
.lang-opt.on { background: color-mix(in srgb, var(--p) 10%, var(--srf)); color: var(--brand); font-weight: 600; }

/* ── Boussole CadranZero (marque) : cadran 12 index + aiguille losange ──────────────
   Rendu par la macro `partials/boussole.html`. Tout est en `currentColor` : la couleur
   se règle sur le parent. `--bz-trait` fixe l'épaisseur des traits DANS le viewBox (56),
   donc elle se met à l'échelle avec le SVG : une grande boussole veut une valeur plus
   petite qu'une petite (sinon le cadran devient une bague épaisse). */
.bz { --bz-trait: 1.4; width: 1em; height: 1em; flex: none; }
.bz-cadran { fill: none; stroke: currentColor; stroke-width: var(--bz-trait); opacity: .3; }
.bz-idx { stroke: currentColor; stroke-width: calc(var(--bz-trait) * .8); opacity: .3; }
.bz-idx.card { stroke-width: calc(var(--bz-trait) * 1.5); opacity: .55; }
.bz.simple .bz-idx:not(.card) { display: none; }  /* sous ~30 px, 12 index virent à la bouillie */
.bz-aiguille { fill: currentColor; transform-box: view-box; transform-origin: 50% 50%; }

/* L'aiguille part du SUD-OUEST et remonte au NORD dans le sens ANTI-HORAIRE : les rotations
   décroissent (225° → 0°), elle passe donc par le sud, l'est puis le nord-est. Elle dépasse
   le nord avant de s'y stabiliser en deux oscillations, comme une vraie aiguille aimantée
   qu'on relâche. Chaque palier porte sa propre courbe : lancé long, puis retours amortis. */
@keyframes bzNord {
  0%   { transform: rotate(225deg); animation-timing-function: cubic-bezier(.24,.86,.3,1); }
  58%  { transform: rotate(-13deg); animation-timing-function: ease-in-out; }
  74%  { transform: rotate(5.5deg); animation-timing-function: ease-in-out; }
  87%  { transform: rotate(-2deg);  animation-timing-function: ease-in-out; }
  100% { transform: rotate(0deg); }
}
.bz-nord .bz-aiguille { animation: bzNord var(--bz-duree, 1.4s) var(--bz-retard, 0s) both; }

@media (prefers-reduced-motion: reduce) {
  .ai { animation: none; opacity: 1; }
  .pulse { animation: none; }
  .bz-nord .bz-aiguille { animation: none; }  /* l'aiguille reste au nord, sa position naturelle */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
