/*
 * Application styles — hand-written vanilla CSS (no framework).
 * Design system: « Calme » — a quiet, editorial green/paper palette.
 * Served as-is by Propshaft. Organized: tokens → base → layout → components.
 */

/* ----------------------------------------------------------------------------
 * Design tokens
 * ------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #f2f4ee;            /* page */
  --bg-alt: #ebefe6;        /* footer / alternate bands */
  --surface: #ffffff;       /* cards */
  --surface-sunk: #f2f5ef;  /* inset blocks (modalités, etc.) */

  /* Greens */
  --green: #3a5a43;         /* primary action / accents */
  --green-title: #2c4233;   /* serif titles */
  --green-body: #3c4f43;    /* dark body copy */

  /* Text */
  --text: #26352b;
  --text-2: #5e7064;        /* secondary */
  --muted: #7a8a7e;         /* tertiary */
  --muted-2: #8a988c;       /* faint */
  --placeholder: #9aa89d;

  /* Lines */
  --border: #e0e6da;        /* separators */
  --border-soft: #dde4d7;   /* field borders */
  --border-faint: #eef1ea;  /* internal list rows */
  --border-outline: #cfdac8;/* outline buttons / card hover */

  /* Chips & dots */
  --chip-bg: #e7efe3;
  --chip-bg-2: #e3e9dd;
  --chip-hover: #eef3ea;
  --dot-active: #5b8c5a;
  --dot-soft: #9bb59a;

  /* States */
  --amber: #a07d2c;         /* RS / expiring */
  --amber-bg: #f3ead6;

  /* Type */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --radius-card: 14px;
  --radius-panel: 16px;
  --radius-field: 10px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow: 0 4px 20px rgba(42, 66, 49, 0.06);
  --shadow-soft: 0 2px 8px rgba(42, 66, 49, 0.05);
  --shadow-hover: 0 6px 22px rgba(42, 66, 49, 0.08);
  --shadow-pop: 0 12px 34px rgba(42, 66, 49, 0.14);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  --container: 1180px;
  --header-h: 64px;
}

/* ----------------------------------------------------------------------------
 * Base / reset
 * ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::placeholder { color: var(--placeholder); opacity: 1; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
  color: var(--green-title);
  margin: 0 0 var(--space-3);
  text-wrap: pretty;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 var(--space-3); }

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

ul, ol { margin: 0 0 var(--space-3); padding-left: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

img, svg { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 3px;
}
input:focus, select:focus, textarea:focus { outline: none; }

/* Shared micro-label (IBM Plex Mono, uppercase) — used for section eyebrows. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }

/* ----------------------------------------------------------------------------
 * Layout
 * ------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
}

main { display: block; min-height: 60vh; }

/* The certifications pages render full-bleed bands themselves, so the global
 * <main><div class="container"> wrapper would double-pad them. Pages opt out
 * of the default block padding with a body/section modifier where needed. */
.page { padding-block: var(--space-6); }

/* ---- Akta strip + contextual buttons ------------------------------------- */
/* The publisher line: discreet on purpose, the tool has to read as neutral. */
.akta-strip {
  background: var(--chip-bg);
  border-bottom: 1px solid var(--border-soft);
  padding: 6px 16px;
  text-align: center;
  font-size: 0.75rem;
}
.akta-strip__link { color: var(--muted); }
.akta-strip__link:hover { color: var(--green); }

.akta-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: var(--space-3) 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand__dot { width: 20px; height: 20px; border-radius: var(--radius-pill); background: var(--green); flex: none; }
.brand__name { font-family: var(--font-serif); font-weight: 500; font-size: 1.3125rem; color: var(--green-title); }
.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.topnav { display: flex; align-items: center; gap: 30px; font-size: 0.875rem; }
.topnav a, .topnav .topnav__link {
  color: var(--text-2);
  font-weight: 400;
}
.topnav button {
  font: inherit;
  font-size: 0.875rem;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.topnav button:hover { color: var(--green-title); }
.topnav a:hover { color: var(--green-title); text-decoration: none; }
.topnav a.is-active { color: var(--green-title); font-weight: 500; }
/* button_to wraps its <button> in a <form>, which would otherwise land in the flex
 * row as a block with UA margins. The button itself is styled by `.topnav button`. */
.topnav__logout { display: inline-flex; margin: 0; }
.topbar__menu-btn { display: none; }

/* "Parcourir" disclosure — a native <details> menu grouping the browse pages.
 * Works without JS; disclosure_controller only adds close-on-outside-click. */
.navmenu { position: relative; display: inline-flex; }
.navmenu__summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: var(--text-2);
}
.navmenu__summary::-webkit-details-marker { display: none; }
.navmenu__summary:hover { color: var(--green-title); }
.navmenu__summary.is-active { color: var(--green-title); font-weight: 500; }
.navmenu__caret { font-size: 0.6875rem; color: var(--placeholder); transition: transform 0.15s ease; }
.navmenu[open] .navmenu__caret { transform: rotate(180deg); }
.navmenu__panel {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 12px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 80;
}
.navmenu__panel a {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--green-body);
  white-space: nowrap;
}
.navmenu__panel a:hover { background: var(--chip-hover); color: var(--green-title); text-decoration: none; }

@media (max-width: 820px) {
  .topnav { gap: 18px; }
  .topnav__extra { display: none; }
}
@media (max-width: 560px) {
  .topbar__inner { padding-inline: var(--space-4); }
  .brand__tag { display: none; }
  .topnav { gap: 16px; font-size: 0.8125rem; }
}

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: var(--space-8);
}
.site-footer__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.site-footer__brand { display: inline-flex; align-items: center; gap: 10px; }
.site-footer__brand .brand__dot { width: 16px; height: 16px; }
.site-footer__brand .brand__name { font-size: 1.0625rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 26px; font-size: 0.8125rem; color: var(--muted); }
.site-footer__links a { color: var(--muted); }
.site-footer__links a:hover { color: var(--green-title); }
.site-footer__legal { flex-basis: 100%; font-size: 0.8125rem; color: var(--muted); line-height: 1.6; max-width: 90ch; }
.site-footer__legal a { color: var(--green); }
/* Discreet admin sign-in — the only auth affordance for anonymous visitors. */
.site-footer__legal .site-footer__admin { margin-left: 8px; color: var(--muted-2); text-decoration: underline; text-underline-offset: 2px; }
.site-footer__legal .site-footer__admin:hover { color: var(--green-title); }

/* ----------------------------------------------------------------------------
 * Flash messages
 * ------------------------------------------------------------------------- */
.flash {
  max-width: var(--container);
  margin: var(--space-4) auto 0;
  border-radius: var(--radius-field);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  font-size: 0.925rem;
}
.flash--notice { background: var(--chip-bg); color: #2f5a3c; border-color: var(--border-outline); }
.flash--alert { background: var(--amber-bg); color: #8a5a1e; border-color: #e6d3a6; }

/* ----------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.2;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-field);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--green); color: var(--bg); }
.btn--primary:hover { background: #32503b; color: var(--bg); }
.btn--outline { background: transparent; color: var(--green); border-color: var(--border-outline); }
.btn--outline:hover { background: var(--chip-hover); color: var(--green); }
.btn--ghost { background: var(--chip-bg); color: var(--green); }
.btn--ghost:hover { background: var(--chip-hover); color: var(--green); }
.btn--pill { border-radius: var(--radius-pill); }
.btn--block { width: 100%; }
.btn--sm { padding: 0.6rem 1rem; font-size: 0.8125rem; }
/* Backwards-compat aliases for older views */
.btn--secondary { background: var(--surface); color: var(--green-body); border-color: var(--border-soft); }
.btn--secondary:hover { background: var(--chip-hover); color: var(--green-body); }

/* Rails button_to renders a <form>; keep it inline */
form.button_to { display: inline; margin: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--muted);
}
.back-link:hover { color: var(--green-title); text-decoration: none; }

.text-link {
  color: var(--green);
  border-bottom: 1px solid var(--border-outline);
  cursor: pointer;
}
.text-link:hover { text-decoration: none; border-bottom-color: var(--green); }

/* ----------------------------------------------------------------------------
 * Cards & generic surfaces
 * ------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card__header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-faint); }
.card__header h2 { margin: 0; }
.card__header h2 .count { font-family: var(--font-sans); font-weight: 400; font-size: 0.9rem; color: var(--muted); }
.card__body { padding: var(--space-5); }
.card__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-faint); }

.page-header { margin-bottom: var(--space-5); }
.page-header h1 { margin-bottom: var(--space-2); }
.page-header__subtitle { color: var(--text-2); margin: 0; }

/* ----------------------------------------------------------------------------
 * Forms (shared)
 * ------------------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field__label, label.field__label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--green-body);
  margin-bottom: var(--space-2);
}
.field__hint { font-size: 0.8125rem; color: var(--muted); margin: var(--space-2) 0 0; }

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-field);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(58, 90, 67, 0.14);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--green-body);
}
.checkbox input { width: 1rem; height: 1rem; accent-color: var(--green); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.form-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.search .full { grid-column: 1 / -1; }

/* ----------------------------------------------------------------------------
 * Badges / chips
 * ------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  line-height: 1.4;
  background: var(--chip-bg);
  color: var(--green);
}
.badge--code { font-family: var(--font-mono); background: var(--chip-bg); color: var(--green); }
.badge--code-rs { font-family: var(--font-mono); background: var(--amber-bg); color: var(--amber); }
.badge--neutral { background: var(--chip-bg-2); color: var(--green-body); }
.badge--level { background: var(--chip-bg); color: var(--green); }
.badge--active { background: var(--chip-bg); color: var(--green); }
.badge--inactive { background: var(--amber-bg); color: var(--amber); }
.badge--rncp { background: var(--chip-bg); color: var(--green); }
.badge--rs { background: var(--amber-bg); color: var(--amber); }
.badge-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* Status pill with a leading dot */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}
.status__dot { width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--dot-active); flex: none; }
.status__dot--warn { background: var(--amber); }
.status__dot--off { background: var(--muted-2); }

/* ----------------------------------------------------------------------------
 * Search page — hero
 * ------------------------------------------------------------------------- */
.hero { border-bottom: 1px solid var(--border); }
.hero__inner { max-width: var(--container); margin-inline: auto; padding: 56px var(--space-6) 44px; }
.hero__title {
  font-family: var(--font-serif);
  font-size: 2.875rem;
  line-height: 1.12;
  color: var(--green-title);
  margin: 14px 0 0;
  max-width: 680px;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 720px;
  margin-top: 28px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 7px 7px 7px 24px;
  box-shadow: 0 4px 20px rgba(42, 66, 49, 0.07);
}
.searchbar__icon { color: var(--placeholder); font-size: 1.0625rem; }
.searchbar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  padding: 0;
  min-width: 0;
}
.searchbar input:focus { box-shadow: none; }
.searchbar__submit {
  border: none;
  background: var(--green);
  color: var(--bg);
  padding: 13px 28px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  flex: none;
}
.searchbar__submit:hover { background: #32503b; }
.suggest { display: flex; gap: 18px; margin-top: 18px; font-size: 0.8125rem; color: var(--muted); align-items: center; flex-wrap: wrap; }
.suggest a, .suggest button {
  font: inherit;
  font-size: 0.8125rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 1px solid var(--border-outline);
}
.suggest a:hover, .suggest button:hover { color: var(--green-title); text-decoration: none; }

@media (max-width: 640px) {
  .hero__inner { padding: 36px var(--space-4) 28px; }
  .hero__title { font-size: 1.875rem; }
  .searchbar { padding: 6px 6px 6px 18px; }
  .searchbar__submit { padding: 11px 18px; }
}

/* ----------------------------------------------------------------------------
 * Search page — results region (sidebar + list)
 * ------------------------------------------------------------------------- */
.results-region {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-6) var(--space-6) 80px;
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 40px;
  align-items: start;
}

/* ---- Filter sidebar ---- */
.filters { position: sticky; top: calc(var(--header-h) + 24px); }
.filters__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.filters__reset { font-size: 0.75rem; }
.filter { margin-bottom: 18px; }
.filter__label { font-size: 0.8125rem; font-weight: 600; color: var(--green-body); margin-bottom: 8px; }
.filter__sheet-header, .filters__handle, .filters__footer { display: none; }

/* Segmented toggle (État, etc.) */
.segmented { display: flex; gap: 8px; }
.segmented label {
  flex: 1;
  text-align: center;
  font-size: 0.8125rem;
  padding: 8px 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: var(--chip-bg-2);
  color: #4a5e4f;
  transition: background-color 0.12s, color 0.12s;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span,
.segmented label:has(input:checked) { /* fallback handled below */ }
.segmented label:has(input:checked) { background: var(--green); color: var(--bg); }

/* Checkbox list (Type de répertoire) */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-2);
}
.check-list input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-list .box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid #c2cdbd;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 11px;
  flex: none;
  transition: background-color 0.12s, border-color 0.12s;
}
.check-list label:has(input:checked) .box { background: var(--green); border-color: var(--green); color: #fff; }
.check-list label:has(input:checked) { color: var(--green-body); }

/* ---- Searchable dropdown / autocomplete ---- */
.dropdown { position: relative; }
.dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-field);
  padding: 11px 14px;
  cursor: pointer;
  width: 100%;
  font: inherit;
  text-align: left;
}
.dropdown__value {
  font-size: 0.875rem;
  color: var(--placeholder);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown__value.is-set { color: var(--green-title); }
.dropdown__caret { font-size: 0.6875rem; color: var(--placeholder); flex: none; }
.dropdown__panel {
  position: absolute;
  left: 0; right: 0; top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 80;
}
.dropdown[hidden], [hidden] { display: none !important; }
.dropdown__search {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 6px;
}
.dropdown__search input { border: none; background: transparent; font-size: 0.8125rem; padding: 0; }
.dropdown__search input:focus { box-shadow: none; }
.dropdown__list { max-height: 220px; overflow: auto; }
.dropdown__opt {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--green-body);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
}
.dropdown__opt:hover, .dropdown__opt.is-active { background: var(--chip-hover); }
.dropdown__opt[hidden] { display: none; }
.dropdown__empty { padding: 9px 11px; font-size: 0.8125rem; color: var(--muted); }

/* Custom scrollbar for dropdown lists */
.dropdown__list::-webkit-scrollbar { width: 8px; }
.dropdown__list::-webkit-scrollbar-thumb { background: #d6ded0; border-radius: 8px; }

/* ---- Results column ---- */
.results__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.results__count { font-size: 0.9375rem; color: var(--text-2); }
.results__count strong { color: var(--green-title); font-family: var(--font-serif); font-size: 1.25rem; font-weight: 500; }
.results__tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.results__sort { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-2); }
.results__sort label { font-size: 0.8125rem; color: var(--text-2); }
.results__sort select {
  width: auto;
  border: none;
  background: transparent;
  padding: 4px 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--green-title);
  cursor: pointer;
}
.results__sort select:focus { box-shadow: none; }

.result-list { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

.result {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.result:hover, .result:hover { text-decoration: none; border-color: var(--border-outline); box-shadow: var(--shadow-hover); }
.result__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result__meta .dim { font-size: 0.75rem; color: var(--muted); }
.result__title {
  font-family: var(--font-serif);
  font-size: 1.3125rem;
  font-weight: 400;
  margin: 11px 0 0;
  color: var(--green-title);
  line-height: 1.25;
}
.result__title a { color: var(--green-title); }
.result__title a:hover { color: var(--green); text-decoration: none; }
.result__certifier { font-size: 0.8125rem; color: var(--text-2); margin: 6px 0 0; }
.result__facts {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--muted-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Empty state ---- */
.empty {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid #e6ece0;
  border-radius: var(--radius-panel);
  padding: 64px 40px;
  text-align: center;
}
.empty__icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-pill);
  background: var(--chip-hover);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.625rem; color: var(--muted);
}
.empty__title { font-family: var(--font-serif); font-size: 1.625rem; color: var(--green-title); margin: 22px 0 0; }
.empty__text { font-size: 0.9375rem; color: var(--text-2); margin: 10px auto 0; max-width: 440px; line-height: 1.6; }
.empty__text strong { color: var(--green-body); font-weight: 500; }
.empty__actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.empty__freq { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border-faint); }
.empty__freq-label { font-size: 0.8125rem; color: var(--muted-2); margin-bottom: 12px; }
.chip-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 0.8125rem;
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: #4a5e4f;
  border: none;
  cursor: pointer;
}
.chip:hover { background: var(--chip-hover); }

/* ---- Pagination (Pagy) ---- */
.pagy {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.pagy a, .pagy span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: transparent;
}
.pagy a[href]:hover { background: var(--chip-hover); color: var(--green-title); text-decoration: none; }
.pagy a[aria-current] { background: var(--green); color: var(--bg); }                /* current page */
.pagy a[role="separator"] { background: transparent; pointer-events: none; }          /* gap (…) */
.pagy a[role="link"]:not([aria-current]) { opacity: 0.4; pointer-events: none; }       /* disabled prev/next */

/* ---- Mobile filter trigger + bottom sheet ---- */
.filter-trigger { display: none; }
.filters__backdrop { display: none; }

@media (max-width: 860px) {
  .results-region { grid-template-columns: 1fr; padding-bottom: 48px; }

  /* Inline filter trigger button sits in the results bar on mobile */
  .filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    border-radius: var(--radius-field);
    padding: 9px 14px;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--green-body);
    cursor: pointer;
  }
  .filter-trigger__count {
    position: absolute; top: -6px; right: -6px;
    background: var(--green); color: var(--bg);
    font-family: var(--font-mono); font-size: 0.625rem;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center;
  }

  /* Sidebar becomes a bottom sheet */
  .filters {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto;
    z-index: 90;
    max-height: 88vh;
    background: var(--bg);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
    padding: 0 var(--space-5) 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.28s ease;
    overflow: hidden;
  }
  .filters.is-open { transform: translateY(0); }

  .filters__handle {
    display: block;
    width: 44px; height: 5px; border-radius: var(--radius-pill);
    background: #cdd6c7;
    margin: 12px auto 4px;
    flex: none;
  }
  .filter__sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 6px;
    flex: none;
  }
  .filter__sheet-header h2 { margin: 0; font-size: 1.375rem; }
  .filters__head { display: none; } /* desktop head hidden; sheet header used */
  .filters__scroll { flex: 1; overflow-y: auto; padding: 8px 0 16px; }
  .filters__footer {
    display: block;
    flex: none;
    padding: 14px 0 26px;
    border-top: 1px solid var(--border);
    background: var(--bg);
  }

  .filters__backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(44, 66, 51, 0.32);
    z-index: 85;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  .filters__backdrop.is-open { opacity: 1; pointer-events: auto; }

  body.sheet-open { overflow: hidden; }
}

/* On desktop the scroll wrapper is transparent */
@media (min-width: 861px) {
  .filters__scroll { display: contents; }
}

/* ----------------------------------------------------------------------------
 * Certification detail (show)
 * ------------------------------------------------------------------------- */
.crumbs {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--space-6) 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--green-title); }
.crumbs .current { color: var(--green-body); }

.cert-head { border-bottom: 1px solid var(--border); margin-top: 18px; }
.cert-head__inner { max-width: var(--container); margin: 0 auto; padding: 8px var(--space-6) 36px; }
.cert-head__title {
  font-family: var(--font-serif);
  font-size: 2.375rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--green-title);
  margin: 14px 0 0;
  max-width: 760px;
}
.cert-head__certifier { font-size: 0.9375rem; color: var(--text-2); margin: 10px 0 0; }
.cert-head__certifier strong { color: var(--green-body); font-weight: 500; }
.cert-head__lvl { font-size: 0.8125rem; color: var(--muted); }

/* Sticky anchor nav */
.anchor-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.anchor-nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.anchor-nav__inner::-webkit-scrollbar { display: none; }
.anchor-nav a {
  font-size: 0.8125rem;
  color: var(--text-2);
  padding: 14px 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.anchor-nav a:hover { color: var(--green-title); text-decoration: none; }
.anchor-nav a.is-active { color: var(--green-title); border-bottom-color: var(--green); }

/* L'essentiel grid */
.essentiel {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) 0;
}
.essentiel__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.fact-card { background: var(--surface); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-soft); }
.fact-card__label { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
.fact-card__value { font-family: var(--font-serif); font-size: 1.625rem; color: var(--green-title); margin-top: 10px; }
.fact-card__list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.fact-card__list-item { font-size: 0.78rem; color: var(--green-body); line-height: 1.35; }
.fact-card__list-item .mono { color: var(--green); }

/* Two-column body */
.cert-body {
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px var(--space-6) 80px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  align-items: start;
}
.cert-main { min-width: 0; }

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 44px;
  scroll-margin-top: calc(var(--header-h) + 56px);
}
.section-eyebrow:first-child { margin-top: 0; }
.subhead {
  font-family: var(--font-serif);
  font-size: 1.3125rem;
  font-weight: 400;
  color: var(--green-title);
  margin: 30px 0 0;
}
.subhead:first-of-type, .section-eyebrow + .subhead { margin-top: 14px; }
.subhead .dim { font-size: 0.875rem; color: var(--muted-2); }

.prose { color: var(--green-body); }
.prose p { margin: 0 0 14px; font-size: 0.9375rem; line-height: 1.7; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.1rem; }
.prose li { font-size: 0.9375rem; line-height: 1.7; margin-bottom: 6px; }
.prose-stack { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.prose-stack > p, .prose-block { font-size: 0.9375rem; line-height: 1.7; color: var(--green-body); margin: 0; }
.lead { margin-top: 12px; }

/* Bulleted list inside white card (activités, compétences, secteurs) */
.bullet-card { background: var(--surface); border-radius: var(--radius-card); padding: 8px 6px; margin-top: 12px; box-shadow: var(--shadow-soft); }
.bullet-card__row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-faint); }
.bullet-card__row:last-child { border-bottom: 0; }
.bullet-card__dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--dot-active); margin-top: 8px; flex: none; }
.bullet-card__dot--soft { background: var(--dot-soft); }
.bullet-card__text { font-size: 0.875rem; line-height: 1.6; color: var(--green-body); }

/* Bloc de compétences card */
.bloc { background: var(--surface); border-radius: var(--radius-card); padding: 22px 24px; box-shadow: var(--shadow-soft); }
.bloc + .bloc { margin-top: 14px; }
.bloc-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.bloc__code { font-family: var(--font-mono); font-size: 0.75rem; color: var(--green); }
.bloc__title { font-family: var(--font-serif); font-size: 1.1875rem; color: var(--green-title); margin: 6px 0 0; line-height: 1.3; }
.bloc__micro {
  font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted-2); margin-top: 18px;
}
.bloc__comps { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.bloc__comp { display: flex; gap: 10px; }
.bloc__comp .bullet-card__dot { width: 5px; height: 5px; }
.bloc__comp-text { font-size: 0.84rem; line-height: 1.6; color: var(--green-body); }
.inset {
  background: var(--surface-sunk);
  border-radius: var(--radius-field);
  padding: 13px 16px;
  margin-top: 16px;
}
.inset__label { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.inset__text { font-size: 0.84rem; line-height: 1.6; color: var(--green-body); margin-top: 6px; }
.note { font-size: 0.84rem; line-height: 1.6; color: var(--text-2); margin-top: 14px; background: var(--surface); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow-soft); }

/* Tag cloud (types d'emplois) */
.tagcloud { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.tagcloud span { font-size: 0.8125rem; padding: 8px 15px; border-radius: var(--radius-pill); background: var(--chip-bg); color: var(--green); }

/* Code list (ROME, NSF inline) */
.code-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.code-list__row { font-size: 0.875rem; color: var(--green-body); }
.code-list__row .mono { color: var(--green); }

/* Data table (certificateurs, voies, liens, stats, base légale) */
.dtable { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; margin-top: 14px; box-shadow: var(--shadow-soft); }
.dtable__head, .dtable__row { display: grid; gap: 12px; align-items: center; }
.dtable__head {
  padding: 13px 18px;
  background: var(--chip-hover);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.dtable__row { padding: 14px 18px; border-bottom: 1px solid var(--border-faint); font-size: 0.875rem; color: var(--green-body); }
.dtable__row:last-child { border-bottom: 0; }
.dtable__row .mono { color: var(--text-2); }
.dtable__row strong { color: var(--green-title); font-weight: 500; }
.dtable__yes { color: var(--dot-active); font-weight: 600; text-align: center; }
.dtable__no { color: var(--muted-2); text-align: center; }
.dtable__foot { padding: 13px 18px; }
.dtable__link { color: var(--green); }

/* Per-table column templates */
.dtable--cert .dtable__head, .dtable--cert .dtable__row { grid-template-columns: 1.4fr 1.2fr 1fr; }
.dtable--voie .dtable__head, .dtable--voie .dtable__row { grid-template-columns: 1fr 72px; }
.dtable--voie .dtable__head span:last-child, .dtable--voie .dtable__row span:last-child { text-align: center; }
.dtable--liens .dtable__head, .dtable--liens .dtable__row { grid-template-columns: 96px 1fr; }
.dtable--stats .dtable__head, .dtable--stats .dtable__row { grid-template-columns: 0.8fr 1fr 1fr 1fr; }
.dtable--npec .dtable__head, .dtable--npec .dtable__row { grid-template-columns: 120px 1fr; }
.dtable--npec .dtable__row .mono { color: var(--green-title); font-weight: 600; }

/* Key/value list (base légale) */
.kv { background: var(--surface); border-radius: var(--radius-card); padding: 6px 4px; margin-top: 14px; box-shadow: var(--shadow-soft); }
.kv__row { display: flex; justify-content: space-between; gap: var(--space-4); padding: 14px 18px; border-bottom: 1px solid var(--border-faint); }
.kv__row:last-child { border-bottom: 0; }
.kv__key { font-size: 0.875rem; color: var(--muted); }
.kv__val { font-size: 0.875rem; color: var(--green-title); font-weight: 500; }

/* Pair cards (NC / PF) */
.pair { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pair > div {
  flex: 1; min-width: 200px;
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8125rem; color: var(--green-body);
  box-shadow: var(--shadow-soft);
}

/* Links list (informations) */
.link-list { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 14px 0 0; }
.link-list li { margin: 0; }

/* Sticky rail */
.cert-rail { position: sticky; top: calc(var(--header-h) + 56px); display: flex; flex-direction: column; gap: 14px; }
.rail-card { background: var(--surface); border-radius: var(--radius-panel); padding: 22px; box-shadow: var(--shadow); }
.rail-card .btn { width: 100%; }
.rail-card .btn + .btn { margin-top: 9px; }
.rail-card__split { display: flex; gap: 8px; margin-top: 9px; }
.rail-card__split .btn { margin-top: 0; }
.rail-stat { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.rail-stat__big { font-family: var(--font-serif); font-size: 2.375rem; color: var(--green-title); }
.rail-stat__cap { font-size: 0.75rem; color: var(--muted); }
.rail-divider { height: 1px; background: var(--border-faint); margin: 16px 0; }
.rail-row { display: flex; justify-content: space-between; padding: 6px 0; }
.rail-row__key { font-size: 0.8125rem; color: var(--muted); }
.rail-row__val { font-size: 0.8125rem; color: var(--green-title); font-weight: 500; }
.rail-note { font-size: 0.75rem; color: var(--muted-2); line-height: 1.6; padding: 0 4px; }

/* Mobile sticky action bar (replaces rail on small screens) */
.action-bar { display: none; }

@media (max-width: 900px) {
  .cert-body { grid-template-columns: 1fr; gap: 28px; }
  .essentiel__grid { grid-template-columns: repeat(2, 1fr); }
  .cert-rail { position: static; }
}
@media (max-width: 640px) {
  .cert-head__title { font-size: 1.75rem; }
  .crumbs, .cert-head__inner, .essentiel, .cert-body, .anchor-nav__inner { padding-inline: var(--space-4); }
  .dtable__head, .dtable__row { font-size: 0.8125rem; }

  /* Hide the rail's action card; surface a sticky bottom action bar instead */
  .cert-rail { display: none; }
  .action-bar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 50;
    gap: 10px;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 95%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
  }
  .action-bar .btn { flex: 1; }
  .action-bar .btn--icon { flex: none; }
  .cert-body { padding-bottom: 96px; }
}

/* ----------------------------------------------------------------------------
 * Tables (generic, used by older views)
 * ------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-faint); }
.table th { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); background: var(--chip-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--keyval th { width: 33%; background: var(--surface-sunk); color: var(--green-body); }

/* ----------------------------------------------------------------------------
 * Stats blocks (imports / certifiers index)
 * ------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats.stats--2 { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space-4); box-shadow: var(--shadow-soft); }
.stat__label { font-size: 0.8rem; color: var(--muted); }
.stat__value { font-family: var(--font-serif); font-size: 1.75rem; color: var(--green-title); }
.stat__value--rncp { color: var(--green); }
.stat__value--rs { color: var(--amber); }
.stat__value--accent { color: var(--green); }

/* ----------------------------------------------------------------------------
 * Detail (legacy hero / sections) — kept for any view still using them
 * ------------------------------------------------------------------------- */
.section { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--border-faint); }
.section:first-of-type { border-top: 0; }
.section__title { font-size: 1.2rem; margin-bottom: var(--space-4); }
.subsection { margin-bottom: var(--space-5); }
.subsection h3 { color: var(--green-body); margin-bottom: var(--space-2); }
.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-5); }
.def__label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-2); margin-bottom: var(--space-1); }
.def__value { color: var(--text); }
.block-card { background: var(--surface-sunk); border: 1px solid var(--border-faint); border-radius: var(--radius-card); padding: var(--space-5); margin-bottom: var(--space-4); }

/* ----------------------------------------------------------------------------
 * Progress (imports)
 * ------------------------------------------------------------------------- */
.progress { width: 100%; height: 0.5rem; background: var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--green); border-radius: var(--radius-pill); transition: width 0.3s; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--space-4); background: var(--surface); }
.panel--info { background: var(--chip-bg); border-color: var(--border-outline); color: var(--green-body); }
.panel--ok { background: var(--chip-bg); border-color: var(--border-outline); color: #2f5a3c; }
.panel--danger { background: var(--amber-bg); border-color: #e6d3a6; color: #8a5a1e; }
.panel pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.825rem; margin: 0; }

/* ----------------------------------------------------------------------------
 * Auth / narrow form pages
 * ------------------------------------------------------------------------- */
.narrow { max-width: 26rem; margin-inline: auto; }
.narrow--wide { max-width: 42rem; }

/* ----------------------------------------------------------------------------
 * Utilities
 * ------------------------------------------------------------------------- */
.stack > * + * { margin-top: var(--space-5); }
.muted { color: var(--muted); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 0.8125rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}

/* ----------------------------------------------------------------------------
 * Formacode® catalogue (/formacodes)
 * ------------------------------------------------------------------------- */
.badge--soft { background: var(--chip-bg-2); color: var(--green-body); font-family: var(--font-mono); }
.badge--soft:hover { background: var(--chip-hover); text-decoration: none; }

.fc-lead { max-width: 680px; margin-top: 18px; font-size: 1.0625rem; line-height: 1.6; color: var(--green-body); }
.fc-lead em { font-style: italic; color: var(--green-title); }

.fc-wrap { max-width: var(--container); margin-inline: auto; padding: var(--space-6) var(--space-6) 80px; }
@media (max-width: 640px) { .fc-wrap { padding: var(--space-5) var(--space-4) 56px; } }

/* Kind pill */
.fc-kind { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.02em; background: var(--chip-bg-2); color: var(--text-2); }
.fc-kind--grand_domaine { background: var(--green); color: var(--bg); }
.fc-kind--champ { background: var(--chip-bg); color: var(--green); }
.fc-kind--descripteur { background: var(--chip-bg-2); color: var(--green-body); }
/* NSF kinds (grand_domaine shared with Formacode above) */
.fc-kind--domaine { background: var(--chip-bg); color: var(--green); }
.fc-kind--groupe { background: var(--chip-bg-2); color: var(--green-body); }
.fc-kind--specialite { background: var(--chip-bg-2); color: var(--text-2); }

/* Stats strip */
.fc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: var(--space-8); }
.fc-stat { background: var(--surface); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-soft); }
.fc-stat__num { display: block; font-family: var(--font-serif); font-size: 1.875rem; color: var(--green-title); }
.fc-stat__lab { font-size: 0.78rem; color: var(--muted); }
@media (max-width: 720px) { .fc-stats { grid-template-columns: repeat(2, 1fr); } }

/* 14 grand-domaine cards */
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; margin-top: 14px; }
.fc-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border-faint);
  border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-soft); transition: border-color .15s, transform .15s; }
.fc-card:hover { border-color: var(--border-outline); transform: translateY(-2px); text-decoration: none; }
.fc-card__code { font-size: 0.72rem; color: var(--muted); }
.fc-card__label { font-family: var(--font-serif); font-size: 1.125rem; color: var(--green-title); line-height: 1.25; }
.fc-card__meta { font-size: 0.78rem; color: var(--text-2); margin-top: auto; }

.fc-about { margin-top: var(--space-8); max-width: 760px; color: var(--green-body); line-height: 1.65; }
.fc-about abbr { text-decoration: underline dotted; cursor: help; }

/* Search results list */
.fc-results { margin-top: var(--space-2); }
.fc-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fc-list__item { background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); }
.fc-list__link { display: flex; gap: 14px; align-items: baseline; padding: 16px 20px; }
.fc-list__link:hover { text-decoration: none; }
.fc-list__item:hover { border-color: var(--border-outline); }
.fc-list__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fc-list__label { font-family: var(--font-serif); font-size: 1.0625rem; color: var(--green-title); }
.fc-list__meta { font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fc-list__path { color: var(--text-2); }
.fc-list__syn { color: var(--muted-2); font-style: italic; }
.fc-empty { margin-top: 18px; color: var(--text-2); }

/* Show — synonyms, child grid, related, alignments */
.fc-synonyms { margin-top: 12px; font-size: 0.9rem; color: var(--text-2); }
.fc-synonyms__lab { color: var(--muted); }
.fc-childgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; }
.fc-chip { display: flex; gap: 8px; align-items: baseline; background: var(--surface); border: 1px solid var(--border-faint);
  border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow-soft); }
.fc-chip:hover { border-color: var(--border-outline); text-decoration: none; }
.fc-chip--soft { background: var(--surface-sunk); }
.fc-chip__code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--green); flex: none; }
.fc-chip__label { font-size: 0.85rem; color: var(--green-body); line-height: 1.3; }

.fc-aligns { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.fc-align { display: flex; gap: 12px; align-items: baseline; }
.fc-align__lab { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); width: 44px; flex: none; }
.fc-align__codes { display: flex; flex-wrap: wrap; gap: 6px; }

.fc-seeall { margin-top: 14px; }
.fc-rail-link { display: block; font-family: var(--font-serif); font-size: 1.05rem; color: var(--green-title); margin: 6px 0 14px; }
.fc-rail-link:hover { color: var(--green); }
.fact-card__forma { color: var(--green-body); }
.fact-card__forma:hover { color: var(--green); text-decoration: none; }
.fact-card__forma .mono { color: var(--green); }

/* ── Caisse des Dépôts: offre de formation + entrées/sorties ──────────────── */
.offre, .flux { margin-top: 14px; }

.offre__stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--space-4); }
.offre-stat {
  flex: 1 1 120px;
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-card);
  padding: 14px 16px;
}
.offre-stat__big { display: block; font-family: var(--font-serif); font-size: 1.5rem; color: var(--green-title); line-height: 1.15; }
.offre-stat__cap { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* Labour-market (BMO + DARES tension) panels on a ROME métier page */
.rome-market { margin-bottom: var(--space-5); }
/* A fiche rattachée's lead block and the note over its borrowed figures (#170). Both sit
   above the panels, whose headings drop their top margin as a section's first child. */
.rome-rattachement { margin-bottom: var(--space-5); }
.rome-rattachement .rail-note { margin-top: 8px; }
.st-hint.rome-market-inherited { margin: 0 0 var(--space-4); }
.badge--tension {
  font-size: 0.62rem; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
  background: var(--amber-bg); color: var(--amber);
}

/* DARES tension gauge — five severity segments, filled up to the métier's tranche */
.tension-gauge { display: flex; gap: 4px; max-width: 320px; margin: 6px 0 8px; }
.tension-gauge__seg {
  flex: 1; height: 10px; border-radius: 3px;
  background: var(--border-faint); /* unlit */
}
.tension-gauge__seg--1.is-on { background: #2e8b57; }
.tension-gauge__seg--2.is-on { background: #7aae34; }
.tension-gauge__seg--3.is-on { background: #e0a500; }
.tension-gauge__seg--4.is-on { background: #e07b39; }
.tension-gauge__seg--5.is-on { background: #d2442f; }
.tension-gauge__cap { font-size: 0.85rem; color: var(--green-body); margin: 0 0 var(--space-3); }
.tension-gauge__cap .muted { font-variant-numeric: tabular-nums; }

.region-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.region-chip {
  font-size: 0.8125rem; padding: 6px 13px; border-radius: var(--radius-pill);
  background: var(--chip-bg); color: var(--green); border: 1px solid transparent;
}
.region-chip:hover { text-decoration: none; border-color: var(--border-outline); }
.region-chip.is-active { background: var(--green); color: #fff; }
.region-chip__n { opacity: 0.6; font-variant-numeric: tabular-nums; }
.region-chip.is-active .region-chip__n { opacity: 0.85; }

.dtable--offre .dtable__head, .dtable--offre .dtable__row { grid-template-columns: 1.6fr 1.2fr 0.6fr 0.9fr 0.9fr; }
.dtable__sub { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.badge-remote { font-size: 0.68rem; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--chip-bg-2); color: var(--green); }

.offre__pager { margin-top: var(--space-4); }
.offre__source, .flux__source { font-size: 0.75rem; margin-top: var(--space-3); }

.flowchart-wrap { margin-top: var(--space-4); }
.flowchart { display: block; width: 100%; height: 120px; }
.flowchart__entry { fill: color-mix(in srgb, var(--green) 28%, #fff); }
.flowchart__exit { fill: var(--green); }
.flowchart__legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; font-size: 0.75rem; color: var(--green-body); }
.flowchart__key { display: inline-flex; align-items: center; gap: 6px; }
.flowchart__key::before { content: ""; width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.flowchart__key--entry::before { background: color-mix(in srgb, var(--green) 28%, #fff); }
.flowchart__key--exit::before { background: var(--green); }

@media (max-width: 640px) {
  .dtable--offre .dtable__head, .dtable--offre .dtable__row { grid-template-columns: 1.5fr 1fr 0.9fr; }
  .dtable--offre .dtable__head span:nth-child(3), .dtable--offre .dtable__row span:nth-child(3),
  .dtable--offre .dtable__head span:nth-child(5), .dtable--offre .dtable__row span:nth-child(5) { display: none; }
}

/* ----------------------------------------------------------------------------
 * Statistics dashboard (/stats)
 * ------------------------------------------------------------------------- */
/* Hero metrics band */
.st-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: var(--space-8); }
.st-metric { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-soft); }
.st-metric__num { font-family: var(--font-serif); font-size: 2rem; line-height: 1.1; color: var(--green-title); }
.st-metric__num--rncp { color: var(--green); }
.st-metric__num--rs { color: var(--amber); }
.st-metric__num--accent { color: var(--green); }
.st-metric__lab { font-size: 0.85rem; color: var(--green-body); }
.st-metric__sub { font-size: 0.72rem; color: var(--muted); }

/* Two-up grid for distribution cards and leaderboards */
.st-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 720px) { .st-cols { grid-template-columns: 1fr; } }

/* Horizontal bar series */
.st-bars { display: flex; flex-direction: column; gap: 10px; }
.st-bar { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 12px; align-items: center; }
.st-bar__lab { font-size: 0.82rem; color: var(--green-body); line-height: 1.25; }
.st-bar__track { height: 0.6rem; background: var(--surface-sunk); border-radius: var(--radius-pill); overflow: hidden; }
.st-bar__fill { display: block; height: 100%; background: var(--green); border-radius: var(--radius-pill); }
.st-bar__val { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-2); text-align: right; min-width: 3.5rem; }

/* FAP familles disclosure under a labour-market panel: the perimeter a figure was
   measured on, always nameable (never collapsed to a bare count). */
.fap-familles { margin-top: 4px; }
.fap-familles > summary { cursor: pointer; }
.fap-familles__list { margin: 6px 0 0; padding-left: 1.1rem; font-size: 0.78rem; color: var(--muted); }
.fap-familles__list code { font-family: var(--font-mono); color: var(--text-2); }
/* Each famille's own published level, and — when they disagree — the warning that the
   headline is a weighted blend. The spread stays in the always-visible summary, since
   the disclosure below it is collapsed by default (#84). */
.fap-familles__tranche { font-family: var(--font-mono); color: var(--text-2); white-space: nowrap; }
.fap-familles__spread { display: block; margin-top: 3px; color: var(--text-2); }

/* Card hints + flush table bodies */
.st-hint { font-size: 0.78rem; color: var(--muted); margin: 4px 0 0; }
.st-flush { padding: 0; }
.st-num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }

/* Fun-facts grid */
.st-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.st-fact { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--radius-card); padding: 18px 20px; box-shadow: var(--shadow-soft); }
.st-fact__lab { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.st-fact__val { font-family: var(--font-serif); font-size: 1.25rem; color: var(--green-title); line-height: 1.2; }
.st-fact__sub { font-size: 0.82rem; color: var(--text-2); }
a.st-fact__sub:hover { color: var(--green); }

.st-about { margin-top: var(--space-6); }
.st-about p { margin: 0; font-size: 0.85rem; line-height: 1.6; }

/* ----------------------------------------------------------------------------
 * Sources & API documentation pages (pages#sources / pages#api_docs)
 * ------------------------------------------------------------------------- */
.source-list, .doc-cards { display: grid; gap: var(--space-4); margin-bottom: var(--space-6); }
.section-eyebrow + .doc-cards { margin-top: 14px; }
.source-list .card__header h2, .doc-cards .card__header h2 { font-size: 1.05rem; }
.source-list .card__header .eyebrow, .doc-cards .card__header .eyebrow { margin-top: 4px; }

.codeblock {
  background: var(--green-title); color: #eef2ec;
  border-radius: var(--radius-field); padding: 12px 14px; margin: 6px 0 16px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5;
}
.codeblock code { font-family: inherit; color: inherit; }

.dtable--api-params .dtable__head, .dtable--api-params .dtable__row { grid-template-columns: 1.2fr 0.7fr 1fr 2fr; }
.dtable--api-fields .dtable__head, .dtable--api-fields .dtable__row { grid-template-columns: 1.2fr 1fr 2fr; }
.dtable--mcp-tools .dtable__head, .dtable--mcp-tools .dtable__row { grid-template-columns: 1fr 1.6fr; }
.dtable--mcp-tools .dtable__row span { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .dtable--api-params .dtable__head, .dtable--api-params .dtable__row { grid-template-columns: 1fr 1fr; }
  .dtable--api-params .dtable__head span:nth-child(n+3), .dtable--api-params .dtable__row span:nth-child(n+3) { display: none; }
  .dtable--api-fields .dtable__head, .dtable--api-fields .dtable__row { grid-template-columns: 1fr 1fr; }
  .dtable--api-fields .dtable__head span:nth-child(3), .dtable--api-fields .dtable__row span:nth-child(3) { display: none; }
}
