/*
 * Feuille de style unique du front custom NumGouv V3 (templates/front/**).
 * Toute évolution visuelle du front (couleurs, densité, formulaires) se fait
 * ICI — ne jamais réintroduire de <style> inline dans un template front.
 * Ne concerne pas le back-office PHPMaker natif (AdminLTE), hors périmètre.
 */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f6f7fa;
  --navy: #14213D;
  --navy-soft: #1F2E52;
  --gold: #B98B34;
  --ink: #23262B;
  --muted: #6B6F76;
  --white: #FFFFFF;
  --line: #DDDEE1;
  --line-soft: #D8D9DD;
  --surface: #F1F1F3;
  --field-bg: #ECECEE;
  --focus-ring: rgba(185, 139, 52, 0.35);
  --danger: #C0392B;
  --danger-soft: #A32D2D;
  --success: #2D6A4F;

  /* Sidebar : fond sombre compact et fixe (façon Supabase), indépendant du
     thème clair/sombre choisi par l'utilisateur pour le contenu. */
  --sidebar-bg: #14161A;
  --sidebar-bg-soft: #1C1F26;
  --sidebar-ink: #EDEEF1;
  --sidebar-ink-muted: #8B909C;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(255, 255, 255, 0.06);
}

[data-bs-theme="dark"] {
  --bg: #12141C;
  --navy: #0B0F1A;
  --navy-soft: #1A2038;
  --gold: #D3A557;
  --ink: #E7E8EC;
  --muted: #9A9EAE;
  --white: #1B1E29;
  --line: #2C2F3D;
  --line-soft: #33374A;
  --surface: #1F2230;
  --field-bg: #12141C;
  --focus-ring: rgba(211, 165, 87, 0.35);
  --danger: #E0574A;
  --danger-soft: #D9483A;
  --success: #4FA983;
}

* {
  box-sizing: border-box;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

html,
body {
  height: 100%;
}

@media (prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .shell {
    transition: none;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Shell / Sidebar (densité compacte façon Supabase) ---------- */
.shell {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .15s ease;
}

.shell.is-collapsed {
  grid-template-columns: 64px 1fr;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: padding .15s ease;
}

.is-collapsed .sidebar {
  padding: 20px 10px;
}

.is-collapsed .brand,
.is-collapsed .brand-sub,
.is-collapsed .sidenav-section,
.is-collapsed .side-foot,
.is-collapsed .sidebtn span,
.is-collapsed .actor-org-card .org-name,
.is-collapsed .actor-org-card .org-role {
  display: none;
}

.is-collapsed .actor-org-card {
  display: flex;
  justify-content: center;
  padding: 7px;
}

.is-collapsed .sidebtn {
  justify-content: center;
  padding: 8px;
}

.is-collapsed .sidebtn svg {
  margin: 0;
}

.brand {
  margin: 0 0 1px;
}

.brand a {
  display: inline-block;
  color: var(--sidebar-ink);
  text-decoration: none;
  line-height: 0;
}

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--sidebar-ink-muted);
  margin: 0 0 24px;
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.sidebtn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  background: none;
  border: none;
  color: var(--sidebar-ink-muted);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.sidebtn svg {
  width: 15px;
  height: 15px;
  stroke: var(--sidebar-ink-muted);
  fill: none;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.sidebtn.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-ink);
  border-left-color: var(--gold);
}

.sidebtn.active svg {
  stroke: var(--gold);
}

.sidebtn:hover:not(.active) {
  color: var(--sidebar-ink);
}

.sidebtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gold);
}

.side-foot {
  font-size: 10.5px;
  color: var(--sidebar-ink-muted);
  line-height: 1.5;
  margin-top: 14px;
}

.actor-org-card {
  display: block;
  background: var(--sidebar-bg-soft);
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
}

.actor-org-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.actor-org-card .org-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--sidebar-bg-soft);
  object-fit: cover;
  flex-shrink: 0;
}

.actor-org-card .org-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sidebar-ink);
  line-height: 1.3;
}

.actor-org-card .org-role {
  font-size: 10.5px;
  color: var(--sidebar-ink-muted);
  margin-top: 1px;
}

.actor-org-card .org-cta {
  font-size: 10.5px;
  color: var(--gold);
  margin-top: 6px;
}

.sidenav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-ink-muted);
  margin: 12px 0 3px;
  padding: 0 10px;
  opacity: .7;
}

.sidenav-section:first-child {
  margin-top: 0;
}

.side-foot a,
.side-foot button {
  color: var(--sidebar-ink-muted);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  flex: 1 0 auto;
}

.numgouv-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 14px 32px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.numgouv-footer-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
}

.numgouv-footer-links a:first-child {
  margin-left: 0;
}

.numgouv-footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.session-timer {
  font-variant-numeric: tabular-nums;
}

.session-timer.is-warning {
  color: #B8860B;
  font-weight: 600;
}

.session-timer.is-expired {
  color: #E0574A;
  font-weight: 600;
}

/* ---------- Session modal ---------- */
.session-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.session-modal-backdrop.is-open {
  display: flex;
}

.session-modal {
  background: var(--white);
  border-radius: 8px;
  padding: 22px;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.session-modal h2 {
  font-size: 15px;
  margin: 0 0 7px;
  color: var(--navy);
}

.session-modal p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 16px;
}

.session-modal .session-modal-countdown {
  font-size: 26px;
  font-weight: 700;
  color: #B8860B;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

/* ---------- Confirmation modal ----------
   Composant générique partagé par toute action mutante (suppression, archivage,
   réactivation, validation...) — remplace window.confirm() natif et comble les
   endroits qui n'avaient aucune confirmation. Même vocabulaire d'élévation que
   .session-modal (overlay + carte blanche + box-shadow la plus prononcée du
   système, réservée aux modales bloquantes). Deux tons partagent ce même balisage :
   "danger" (irréversible : suppression, révocation, suspension) et "standard"
   (réversible/validation : archiver, réactiver, valider) — jamais une troisième
   variante, voir DESIGN.md. */
.confirm-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 110;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-modal-backdrop.is-open {
  display: flex;
}

.confirm-modal {
  background: var(--white);
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.confirm-modal h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--navy);
}

.confirm-modal p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 20px;
}

.confirm-modal.is-danger h2 {
  color: var(--danger);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Topbar ---------- */
.topbar {
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.topbar-center {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.topbar-center img {
  max-height: 52px;
  width: auto;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex: 1;
  justify-content: flex-end;
}

.topbar-datetime {
  font-size: 12.5px;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.topbar-datetime .topbar-time {
  font-weight: 600;
  margin-left: 8px;
}

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .12s, box-shadow .12s;
}

.hamburger-btn:hover {
  border-color: var(--line);
}

.hamburger-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.hamburger-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: background .12s, color .12s, box-shadow .12s;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--ink);
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

/* ---------- Page header ---------- */
.page-header .eyebrow {
  font-family: 'Source Serif 4', serif;
  font-size: 12px;
  color: var(--gold);
  margin: 0 0 2px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.page-header {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 18px;
}

.page-header .breadcrumbs {
  margin: 0 0 10px;
}

/* ---------- Menus (thème / profil) ---------- */
.theme-menu {
  position: relative;
}

.theme-menu-panel {
  display: none;
  position: absolute;
  top: 36px;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 5px;
  min-width: 145px;
  z-index: 20;
}

.theme-menu.is-open .theme-menu-panel {
  display: block;
}

.theme-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 9px;
  border: none;
  background: none;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.theme-menu-item:hover {
  background: var(--surface);
}

.theme-menu-item.is-active {
  color: var(--gold);
  font-weight: 600;
}

.profile-menu-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
}

/* ---------- Content / cards (bords nets, densité resserrée) ---------- */
.content {
  padding: 24px 32px 64px;
  max-width: 1080px;
}

.row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tag {
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar--logo {
  background: var(--white);
  border: 1px solid var(--line);
  object-fit: contain;
  padding: 4px;
}

.check {
  color: var(--gold);
  font-size: 13px;
}

.divider {
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

/* .muted{color:var(--muted);} */
.muted {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: justify;
}

.fo-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.fo-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 0;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.tab {
  padding: 8px 16px 8px 0;
  margin-right: 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--ink);
  font-weight: 600;
  border-color: var(--navy);
}

.post {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.post-text {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-list a {
  text-decoration: none;
  color: inherit;
}

.feed {
  max-width: 620px;
}

.composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
  text-decoration: none;
  display: block;
}

.reactions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Boutons ---------- */
.btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  background: var(--field-bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}

.btn:hover {
  border-color: var(--line);
  background: var(--surface);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn-primary:hover {
  background: var(--navy-soft);
}

.btn-danger {
  color: #C0392B;
  border-color: color-mix(in srgb, #C0392B 40%, var(--line));
  background: color-mix(in srgb, #C0392B 8%, var(--white));
}

.btn-danger:hover {
  background: color-mix(in srgb, #C0392B 16%, var(--white));
}

/* ---------- Diagnostics ---------- */
.row-header {
  justify-content: space-between;
  align-items: flex-start;
}

.two-col-info p {
  margin: 0;
}

.two-col-info .field-label {
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--ink);
}

.two-col-info .field-label:not(:first-child) {
  margin-top: 16px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger-soft);
}

.field-group {
  margin-bottom: 14px;
}

.form-panel-narrow {
  max-width: 620px;
}

.dropzone {
  margin-top: 6px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.dropzone.is-dragover {
  border-color: var(--navy);
  background: var(--surface);
}

.dropzone p {
  margin: 0;
}

.dropzone-browse {
  color: var(--navy);
  text-decoration: underline;
}

.file-input-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.diag-block-row {
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.diag-block-row:last-child {
  border-bottom: none;
}

.diag-block-name {
  font-weight: 600;
}

.diag-block-summary {
  margin: 6px 0 0;
  font-size: 12.5px;
}

.diag-pill-spaced {
  margin-left: 8px;
}

.diag-pill-spaced + .diag-pill-spaced {
  margin-left: 4px;
}

.diag-report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.diag-report-title {
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--ink);
}

.diag-report-summary {
  margin: 0 0 10px;
  white-space: pre-line;
}

.diag-report-status {
  margin: 0;
}

.diag-generate-report-form {
  margin-bottom: 10px;
}

.diag-thread {
  margin-bottom: 14px;
}

.diag-message {
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 10px;
}

.diag-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--gold) 22%, var(--surface));
  color: var(--ink);
  font-size: 14px;
}

.diag-bubble {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  flex: 1;
}

.diag-bubble-user {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

/* ---------- Rendu markdown (assistant IA) ----------
   Habille la sortie HTML de marked.js dans .ai-markdown — l'IA répond
   en markdown riche (titres, gras, tableaux, listes), jamais affiché en texte
   brut. Typographie Inter partout (Source Serif 4 reste réservée à l'eyebrow
   et aux compteurs, voir DESIGN.md), bordures nettes plutôt qu'ombres, gold
   réservé à un accent rare (puce de liste), jamais un fond de grande surface. */
.ai-markdown > :first-child {
  margin-top: 0;
}

.ai-markdown > :last-child {
  margin-bottom: 0;
}

.ai-markdown h1,
.ai-markdown h2,
.ai-markdown h3,
.ai-markdown h4 {
  font-family: inherit;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  margin: 16px 0 8px;
}

.ai-markdown h1 { font-size: 16px; }
.ai-markdown h2 { font-size: 14.5px; }
.ai-markdown h3 { font-size: 13.5px; }
.ai-markdown h4 { font-size: 13px; }

.ai-markdown p {
  margin: 0 0 10px;
  line-height: 1.6;
}

.ai-markdown strong {
  font-weight: 600;
  color: var(--ink);
}

.ai-markdown ul,
.ai-markdown ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.ai-markdown li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.ai-markdown ul li::marker {
  color: var(--gold);
}

.ai-markdown hr {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 14px 0;
}

.ai-markdown code {
  background: var(--field-bg);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
}

.ai-markdown pre {
  background: var(--field-bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0 0 10px;
}

.ai-markdown pre code {
  background: none;
  padding: 0;
}

.ai-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 12.5px;
}

.ai-markdown th,
.ai-markdown td {
  border: 1px solid var(--line-soft);
  padding: 6px 10px;
  text-align: left;
}

.ai-markdown th {
  background: var(--field-bg);
  font-weight: 600;
  color: var(--ink);
}

.ai-markdown a {
  color: var(--gold);
}

.ai-markdown blockquote {
  border-left: 2px solid var(--gold);
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  color: var(--muted);
}

.diag-ask-form {
  display: flex;
  gap: 8px;
}

.diag-ask-input {
  min-height: auto;
  flex: 1;
}

.diag-create-concertation {
  margin-top: 10px;
  display: inline-block;
}

.diag-section-title {
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--ink);
}

.diag-block-list {
  margin-bottom: 10px;
}

.diag-index-actions {
  margin-bottom: 16px;
}

.diag-index-link {
  flex: 1;
}

.post-no-border {
  border-bottom: none;
}

/* ---------- Groupe de cases à cocher encadré (ex. listes de diffusion) --- */
.checkbox-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 0;
}

/* Bouton texte discret, ex. retirer une langue/tag d'une pill (PON incidents) */
.link-btn {
  background: none;
  border: none;
  padding: 0 0 0 6px;
  margin: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 0.9em;
}
.link-btn:hover {
  opacity: 1;
}

/* Label + checkbox sur une ligne, hors .checkbox-group (ex. formulaires courts) */
.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95em;
  white-space: nowrap;
}

/* ---------- Barre de filtres (recherche + selects, ex. bibliothèque) --- */
.filter-bar {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.filter-bar input,
.filter-bar select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 36px;
  transition: border-color .12s, box-shadow .12s;
}

.filter-bar input:hover,
.filter-bar select:hover {
  border-color: var(--line);
}

.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.filter-bar input[name=q] {
  min-width: 220px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.dropzone {
  display: block;
  border: 2px dashed #AEB4C1;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--gold);
  background: #FBF6EC;
}

.dropzone input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone strong {
  display: block;
  color: var(--navy);
  margin-bottom: 3px;
}

.dropzone-file {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.post-input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
}

textarea.post-input {
  resize: vertical;
  min-height: 90px;
}

input.post-input {
  min-height: auto;
}

.post-input:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

select.visibility-select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin-top: 8px;
}

.form-error {
  color: #E0574A;
  font-size: 12.5px;
  margin-bottom: 9px;
}

.pill {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.pill-gold {
  background: color-mix(in srgb, var(--gold) 22%, var(--surface));
  color: var(--gold);
  border-color: transparent;
}

/* ---------- Formulaire générique partagé (remplace .pon-form, .app-form,
   .pfd-form, .proto-form, .cadre-form, .dad-form, .rap-form, .users-form,
   .concertation-form, .org-settings-form, .profile-form, .library-form) --- */
.form-panel {
  max-width: 760px;
}

.form-panel label {
  display: block;
  font-size: 12.5px;
  margin-bottom: 13px;
  color: var(--muted);
  font-weight: 500;
}

.form-panel input,
.form-panel select,
.form-panel textarea {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  background: var(--field-bg);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}

.form-panel input:hover,
.form-panel select:hover,
.form-panel textarea:hover {
  border-color: var(--line);
}

.form-panel input:focus,
.form-panel select:focus,
.form-panel textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-panel textarea {
  min-height: 100px;
}

.form-panel .checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
}

.form-panel .checkbox input {
  width: auto;
  margin-top: 0;
}

.form-panel .row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-panel .row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.form-panel .help {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 11.5px;
}

/* Tailles ponctuelles conservées pour des besoins spécifiques déjà en place */
.form-panel--narrow {
  max-width: 600px;
}

.form-panel--tight {
  max-width: 560px;
}

.form-panel--wide {
  max-width: 820px;
}

.form-panel textarea.tall {
  min-height: 160px;
}

.form-panel textarea.taller {
  min-height: 180px;
}

.block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.block-grid label {
  margin: 0;
  padding: 9px;
  background: var(--surface);
  border-radius: 8px;
}

/* ---------- Cartes de résumé (organisation, bibliothèque, modération) --- */
.org-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.org-summary-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  display: block;
}

.org-summary-card:hover {
  border-color: var(--gold);
}

.org-summary-card .count {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'Source Serif 4', serif;
}

.org-summary-card .label {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

.org-section {
  margin-bottom: 22px;
}

.org-section h2 {
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 10px;
}

.org-alert {
  background: var(--field-bg);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--ink);
}

.org-alert a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

.version-card {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 9px;
}

.upload-form input,
.upload-form select,
.version-edit input,
.version-edit select {
  font: inherit;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
}

.version-edit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.moderation-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin-bottom: 10px;
}

.moderation-card input[type=text] {
  min-width: 240px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font: inherit;
  background: var(--field-bg);
  color: var(--ink);
}

/* ---------- Carte générique + grille 2 colonnes (admin plateforme) ------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px 20px;
}

.card label {
  display: block;
  font-size: 12.5px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 500;
}

.card input:not([type=checkbox]),
.card select,
.card textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}

.card input:not([type=checkbox]):hover,
.card select:hover,
.card textarea:hover {
  border-color: var(--line);
}

.card input:not([type=checkbox]):focus,
.card select:focus,
.card textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.card textarea {
  resize: vertical;
}

.card--wide {
  max-width: 820px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ---------- Notifications toast (remplace les bandeaux flash statiques) --- */
.toast-stack {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  opacity: 1;
  transform: translateX(0);
  transition: opacity .25s ease, transform .25s ease;
}

.toast.is-closing {
  opacity: 0;
  transform: translateX(16px);
}

.toast--error {
  border-left-color: #E0574A;
}

.toast-message {
  flex: 1;
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.toast-close:hover {
  color: var(--ink);
}

@media (max-width:760px) {
  .toast-stack {
    left: 12px;
    right: 12px;
    max-width: none;
    top: 12px;
  }


  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Gouvernance : grille des outils ---------- */
.gov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 7px;
}

.gov-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.gov-card:hover {
  border-color: var(--gold);
}

.gov-card .gov-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 5px;
}

.gov-card .gov-desc {
  font-size: 12.5px;
  color: var(--muted);
}

.gov-card.gov-disabled {
  opacity: .5;
  cursor: default;
}

.gov-card.gov-disabled:hover {
  border-color: var(--line);
}

/* ---------- Concertation : fiche détail ---------- */
.concertation-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.section-card h2,
.section-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
}

.section-card h2 {
  font-size: 16px;
}

.section-card h3 {
  font-size: 13px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.wrap {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
  font-size: 11.5px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.question {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.response {
  background: var(--surface);
  border-radius: 7px;
  padding: 9px 11px;
  margin-top: 7px;
}

.response p {
  margin: 4px 0;
  white-space: pre-line;
}

.meta {
  font-size: 10.5px;
  color: var(--muted);
}

.report-summary {
  white-space: pre-line;
  line-height: 1.55;
  font-size: 12.5px;
}

@media (max-width:900px) {
  .concertation-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Cartes incidents (PON & incidents) ---------- */
.pon-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.pon-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.pon-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.pon-card p {
  margin: 5px 0;
}

.pon-card details {
  margin-top: 10px;
}

.pon-card summary {
  cursor: pointer;
  font-weight: 600;
}

.pon-transition {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ---------- Connexion (page + modale) ---------- */
.connexion-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px;
}

.connexion-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.connexion-form label {
  font-weight: 600;
  font-size: 14px;
}

.connexion-form input {
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 14px;
  background: var(--field-bg);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}

.connexion-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.connexion-error {
  background: #fdecea;
  color: #611a15;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.connexion-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
}

.connexion-submit:disabled {
  cursor: wait;
  opacity: .78;
}

.connexion-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: connexion-spin .7s linear infinite;
}

.connexion-spinner[hidden] {
  display: none;
}

.connexion-status {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.connexion-forgot {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12.5px;
}

.connexion-forgot a {
  color: var(--muted);
}

.connexion-forgot a:hover {
  color: var(--ink);
}

.connexion-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.connexion-modal-backdrop.is-open {
  display: flex;
}

.connexion-modal {
  background: var(--white);
  width: 420px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  padding: 32px 24px 24px;
}

.connexion-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
}

.connexion-modal-close:hover {
  background: rgba(0, 0, 0, 0.12);
}

.connexion-modal-title {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--ink);
}

.connexion-modal-loading {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

@keyframes connexion-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width:900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    position: static;
    height: auto;
    padding: 14px 14px 8px;
  }

  .brand-sub {
    margin-bottom: 10px;
  }

  .sidenav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 6px;
  }

  .sidebtn {
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .sidebtn.active {
    border-left-color: transparent;
    border-bottom-color: var(--gold);
  }

  .side-foot {
    margin: 7px 0 0;
  }

  .actor-org-card {
    margin-bottom: 9px;
  }

  .sidenav-section {
    white-space: nowrap;
  }

  .topbar {
    padding: 14px 18px;
  }

  .content {
    padding: 18px 18px 80px;
  }
}