/* Design system SuiviCM (tokens --ds-*), repris de Design/Suivi CM/src/styles/theme.css.
   Règle : jamais de couleur, de rayon ni de taille en dur, toujours une variable --ds-*.
   Montserrat embarquée dans le bundle React (shell.css, paquet @fontsource) ; à défaut, police système. */
:root {
  --ds-primary-50: #f0f7ff;
  --ds-primary-100: #d9eafb;
  --ds-primary-200: #aecff2;
  --ds-primary-300: #6ea6e0;
  --ds-primary-400: #2e7acd;
  --ds-primary-500: #115ab0;
  --ds-primary-600: #0254a2;
  --ds-primary-700: #1d477a; /* marine standard */
  --ds-primary-800: #07264a;
  --ds-primary-900: #112d4f; /* marine profond — chrome / sidebar */

  /* --- Primitives : accent jaune (call-to-action cliquables) --- */
  --ds-accent-400: #ffcb33;
  --ds-accent-500: #ffbe00;
  --ds-accent-600: #e29200;

  /* --- Or institutionnel (état actif / accent de marque noble) --- */
  --ds-gold: #c79a3f;
  --ds-gold-soft: #d8b878;
  --ds-gold-rgb: 199, 154, 63;

  /* --- Chrome / drawer --- */
  --ds-sidebar-bg: var(--ds-primary-900);

  /* --- Primitives : neutres --- */
  --ds-neutral-50: #fbfbfc;
  --ds-neutral-100: #f5f6f8;
  --ds-neutral-200: #e2e2e5;
  --ds-neutral-300: #cbcbd0;
  --ds-neutral-400: #8a8b92;
  --ds-neutral-500: #55565c;
  --ds-neutral-800: #262626;

  /* --- Sémantiques : surfaces & texte (clair) --- */
  --ds-bg: #fbfbfc;
  --ds-surface-page: #f9fafb; /* fond de la zone de travail principale (gris froid très clair) */
  --ds-surface: #ffffff;
  --ds-sunken: #f5f6f8;
  --ds-text: #262626;
  --ds-text-muted: #55565c;
  --ds-text-faint: #8a8b92;
  --ds-border: #e2e2e5;
  --ds-border-strong: #cbcbd0;
  --ds-focus: #2e7acd;

  /* --- Sémantiques : actions --- */
  --ds-primary: #0254a2;
  --ds-primary-hover: #073f79;
  --ds-on-primary: #ffffff;
  --ds-accent: #ffbe00;
  --ds-accent-hover: #e29200;
  --ds-on-accent: #262626;

  /* --- Statuts --- */
  --ds-success: #068a54;
  --ds-success-bg: #e4f5ec;
  --ds-warning: #f5a300;
  --ds-warning-bg: #fff3d6;
  --ds-danger: #e82332;
  --ds-danger-bg: #fce6e8;
  --ds-info: #0254a2;
  --ds-info-bg: #f0f7ff;

  /* --- Typographie --- */
  --ds-font: "Montserrat", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ds-fw-normal: 400;
  --ds-fw-medium: 500;
  --ds-fw-semibold: 600;
  --ds-fw-bold: 700;
  --ds-fs-body: 18px;
  --ds-fs-label: 14px;
  --ds-fs-caption: 13px;
  --ds-fs-h1: 30px;
  --ds-fs-h2: 24px;
  --ds-fs-h3: 20px;
  --ds-lh-body: 1.6;

  /* --- Rayons --- */
  --ds-radius-sm: 6px;
  --ds-radius: 8px;
  --ds-radius-lg: 12px;
  --ds-radius-pill: 999px;

  /* --- Badges (StatusBadge / InstitutionBadge / PercentageBadge) --- */
  --ds-badge-h: 22px;
  --ds-badge-px: 8px;
  --ds-badge-gap: 5px;
  --ds-badge-fs: 11px;
  --ds-badge-dot: 6px;
  --ds-badge-border: rgba(0, 0, 0, 0.08);
  /* Famille neutre/institutionnelle (jamais sémantique) */
  --ds-institution-bg: var(--ds-sunken);
  --ds-institution-fg: var(--ds-text);
  --ds-institution-border: var(--ds-border-strong);

  /* --- Espacement --- */
  --ds-sp-1: 4px;
  --ds-sp-2: 8px;
  --ds-sp-3: 12px;
  --ds-sp-4: 16px;
  --ds-sp-5: 24px;
  --ds-sp-6: 32px;
  --ds-sp-7: 40px;
  --ds-sp-8: 48px;
  --ds-sp-9: 64px;

  /* --- Contrôles --- */
  --ds-control-h: 52px;
  --ds-control-h-sm: 44px;

  /* --- Champs de recherche / filtres --- */
  --ds-search-h: 44px;
  --ds-search-radius: 12px;

  /* --- Ombres --- */
  --ds-shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --ds-shadow-2: 0 4px 12px rgba(16, 24, 40, 0.1), 0 2px 4px rgba(16, 24, 40, 0.06);
  --ds-shadow-3: 0 16px 40px rgba(16, 24, 40, 0.16);

  /* --- Dimensions de la coquille --- */
  --ds-sidebar-w: 252px;
  --ds-sidebar-w-collapsed: 76px;
  --ds-topbar-h: 68px;

  /* --- Barre latérale (repris du remappage shadcn/ui du design) --- */
  --sidebar: var(--ds-sidebar-bg);
  --sidebar-foreground: #adc2da; /* éléments inactifs */
  --sidebar-primary: var(--ds-gold);
  --sidebar-primary-foreground: var(--ds-primary-900);
  --sidebar-accent: rgba(var(--ds-gold-rgb), 0.16); /* fond de l'élément actif */
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-ring: var(--ds-focus);
}

/* Remise à zéro dans une couche : les classes utilitaires des composants React (Tailwind) passent devant. */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; min-height: 100%; }
  body { background: var(--ds-bg); color: var(--ds-text); font-family: var(--ds-font); -webkit-font-smoothing: antialiased; }
  h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
  ul { list-style: none; }
  button { font: inherit; cursor: pointer; }
  /* Typographie institutionnelle (h1-h4) : les classes (.h1, .h2…) et utilitaires Tailwind passent devant. */
  h1 { font-size: var(--ds-fs-h1); font-weight: var(--ds-fw-bold); line-height: 1.25; }
  h2 { font-size: var(--ds-fs-h2); font-weight: var(--ds-fw-semibold); line-height: 1.3; }
  h3 { font-size: var(--ds-fs-h3); font-weight: var(--ds-fw-semibold); line-height: 1.35; }
  h4 { font-size: var(--ds-fs-body); font-weight: var(--ds-fw-semibold); line-height: 1.4; margin: 0; }
}

/* Coquille React (shell.js) : le contenu Django reste masqué jusqu'à son déplacement dans l'espace de travail. */
#shell-root + #page-content { display: none; }
/* Gabarit de page pour les écrans Django (identique au PageTemplate du design). */
.page-template { display: flex; flex-direction: column; gap: var(--ds-sp-5); width: 100%; padding: var(--ds-sp-5) var(--ds-sp-6); }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--ds-sp-4); }
.page-header h1 { color: var(--ds-text); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-sp-2); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }
.icon-xs { width: 12px; height: 12px; }
.icon-lg { width: 21px; height: 21px; }
.icon-primary { color: var(--ds-primary); }

/* Cadre */
.shell { display: flex; min-height: 100vh; background: var(--ds-surface-page); }
.sidebar { width: 256px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--ds-border); background: var(--ds-surface); }
.sidebar-brand { padding: 16px 20px; border-bottom: 1px solid var(--ds-border); }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ds-text-faint); }
.brand { font-weight: 700; color: var(--ds-primary-900); }
.nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: var(--ds-radius-sm); background: none; font-size: 14px; color: var(--ds-text); text-decoration: none; text-align: left; }
.nav-link:hover { background: var(--ds-primary-50); }
.nav-link.is-active { background: var(--ds-primary-50); font-weight: 600; color: var(--ds-primary-700); }
.sidebar-user { padding: 12px; border-top: 1px solid var(--ds-border); }
.user-name { padding: 0 12px; font-size: 14px; font-weight: 600; }
.user-email { padding: 0 12px; font-size: 12px; color: var(--ds-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-roles { padding: 0 12px 8px; font-size: 12px; font-weight: 500; color: var(--ds-primary); }
.logout { color: var(--ds-text-muted); }
.logout:hover { background: var(--ds-sunken); }
.main { flex: 1; min-width: 0; padding: 40px; }
#flash:not(:empty) { margin-bottom: 16px; }
@media (max-width: 767px) { .sidebar { display: none; } .main { padding: 24px 16px; } }

/* Mise en page */
.stack > * + * { margin-top: 24px; }
/* Le contenu occupe toute la largeur de la zone de travail. */
.narrow, .wide-4, .wide-5, .wide-6 { width: 100%; }
.h1 { font-size: 24px; font-weight: 600; }
.h2 { font-size: var(--ds-fs-h2); font-weight: 700; }
.h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.muted { color: var(--ds-text-muted); } .faint { color: var(--ds-text-faint); }
.small { font-size: 14px; } .strong { font-weight: 600; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.warning { color: var(--ds-warning); } .danger { color: var(--ds-danger); }
.link { color: var(--ds-primary); text-decoration: none; } .link:hover { text-decoration: underline; }
.inline-icon { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.grid-2 { display: grid; gap: 24px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.card { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); }
.padded { padding: 20px; }
.card-title { padding: 20px 20px 0; }
.list > * + * { margin-top: 8px; }
.tag-line { display: flex; align-items: flex-start; gap: 12px; }
.divider { width: 100%; height: 1px; margin: 2px 0; background: var(--ds-border); }

/* Formulaires et boutons */
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
.input { padding: 8px 12px; border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius); background: var(--ds-surface); font: inherit; font-weight: 400; color: var(--ds-text); }
.input:focus, .login-input:focus { outline: none; border-color: var(--ds-focus); box-shadow: 0 0 0 2px var(--ds-primary-100); }
.field-error { font-size: 12px; font-weight: 400; color: var(--ds-danger); }
.field-error:empty { display: none; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 0; border-radius: var(--ds-radius); font-size: 14px; font-weight: 600; }
.btn-primary { background: var(--ds-primary); color: var(--ds-on-primary); }
.btn-primary:hover { background: var(--ds-primary-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: none; color: var(--ds-text-muted); padding: 8px 12px; }
.btn-link { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border: 0; border-radius: var(--ds-radius-sm); background: none; color: var(--ds-primary); text-decoration: none; font-size: 14px; font-weight: 600; }
.btn-link.small { font-size: 12px; padding: 2px 8px; }
.btn-link:hover, .icon-btn:hover { background: var(--ds-primary-50); }
.icon-btn { display: inline-flex; padding: 6px; border: 0; border-radius: var(--ds-radius-sm); background: none; color: var(--ds-primary); }
.icon-btn-danger { color: var(--ds-danger); } .icon-btn-danger:hover { background: var(--ds-danger-bg); }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.actions-left { display: flex; gap: 8px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead { background: var(--ds-sunken); color: var(--ds-text-muted); text-align: left; }
.table th { padding: 12px 16px; font-weight: 600; }
.table td { padding: 12px 16px; border-top: 1px solid var(--ds-border); }
.table tr.top td { vertical-align: top; }
.table tr.hoverable:hover { background: var(--ds-primary-50); }
.table td.empty { padding: 24px 16px; text-align: center; color: var(--ds-text-muted); }
.table td.panel-cell { padding: 0 16px 16px; border-top: 0; }
.col-number { width: 48px; }
.attributes { display: grid; gap: 16px; }
@media (min-width: 640px) { .attributes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .attributes { grid-template-columns: repeat(3, 1fr); } }
.attributes dt { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--ds-text-faint); }
.attributes dd { margin-top: 4px; font-weight: 500; }

/* Étiquettes d'institution */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--ds-radius-pill); background: var(--ds-primary-50); font-size: 12px; font-weight: 600; color: var(--ds-primary-700); white-space: nowrap; }
.tag-with-action { display: inline-flex; align-items: center; gap: 2px; }
.remove-btn { display: inline-flex; padding: 2px; border: 0; border-radius: var(--ds-radius-pill); background: none; color: var(--ds-text-faint); }
.remove-btn:hover { background: var(--ds-danger-bg); color: var(--ds-danger); }

/* Panneau d'affectation */
.assign-panel { padding: 16px; border: 1px solid var(--ds-primary-200); border-radius: var(--ds-radius); background: var(--ds-primary-50); }
.assign-panel > * + * { margin-top: 16px; }
.assign-panel fieldset { border: 0; margin: 0; padding: 0; }
.legend { margin-bottom: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--ds-text-muted); }
.checkbox-grid { display: grid; gap: 8px; }
@media (min-width: 640px) { .checkbox-grid { grid-template-columns: 1fr 1fr; } }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.checkbox input { margin-top: 3px; }
.danger:empty { display: none; }

/* Messages */
.feedback { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--ds-radius); font-size: 14px; }
.feedback-success { background: var(--ds-success-bg); color: var(--ds-success); }
.feedback-error { background: var(--ds-danger-bg); color: var(--ds-danger); }

/* Connexion */
.login { display: flex; width: 100%; height: 100vh; overflow: hidden; }
.login-brand { position: relative; display: none; flex: 1.1 1 0; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 56px 52px; color: #fff;
  background: linear-gradient(160deg, var(--ds-primary-900) 0%, var(--ds-primary-700) 55%, #1a3f6f 100%); }
@media (min-width: 1024px) { .login-brand { display: flex; } }
.login-brand-glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(255,190,0,.06) 0%, transparent 70%); }
.login-brand-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 440px; text-align: center; }
.login-illustration { width: clamp(220px, 68%, 380px); height: auto; margin-bottom: clamp(32px, 5vh, 52px); object-fit: contain; }
.login-title { margin-bottom: clamp(14px, 2vh, 22px); font-size: clamp(22px, 2.6vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.login-tagline { margin-bottom: clamp(36px, 6vh, 60px); font-size: clamp(13px, 1.1vw, 16px); line-height: 1.6; color: rgba(210,225,242,.9); }
.login-rule { width: 40px; height: 2px; margin-bottom: clamp(28px, 4.5vh, 48px); border-radius: 2px; background: var(--ds-accent); opacity: .85; }
.login-product { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login-product-name { font-size: clamp(20px, 2vw, 26px); font-weight: 800; letter-spacing: -.02em; }
.login-product-sub { font-size: 11.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: rgba(210,225,242,.65); }
.login-panel { display: flex; flex: 1 1 0; align-items: safe center; justify-content: center; overflow-y: auto; padding: 40px 36px; background: var(--ds-surface); }
.login-panel-content { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 420px; }
.login-logo { width: 280px; max-width: 82%; height: auto; margin-bottom: 8px; object-fit: contain; }
.login-heading { font-size: 26px; line-height: 1.25; font-weight: 700; }
.login-intro { margin-top: 8px; font-size: 16px; line-height: 1.6; color: var(--ds-text-muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.login-label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.login-input { height: 48px; width: 100%; padding: 0 16px; border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-lg); font: inherit; font-size: 16px; font-weight: 400; }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; border: 1px solid var(--ds-primary); border-radius: var(--ds-radius-lg); background: var(--ds-primary); color: var(--ds-on-primary); font-size: 16px; font-weight: 700; transition: background-color .15s; }
.login-submit:hover { background: var(--ds-primary-700); border-color: var(--ds-primary-700); }
.login-submit:disabled { opacity: .6; }
.login-note { text-align: center; font-size: 13px; line-height: 1.6; color: var(--ds-text-faint); }


/* Liste des décisions : filtres, statut, avancement, pagination */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters .input { min-width: 220px; }
.col-title { min-width: 280px; font-weight: 500; color: var(--ds-text); }
.col-progress { min-width: 150px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--ds-radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-a_venir { background: var(--ds-neutral-100); color: var(--ds-text-muted); }
.status-en_cours { background: var(--ds-info-bg); color: var(--ds-info); }
.status-en_retard { background: var(--ds-danger-bg); color: var(--ds-danger); }
.status-terminee { background: var(--ds-success-bg); color: var(--ds-success); }
.status-non_affectee { background: var(--ds-warning-bg); color: #9a6700; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1; height: 8px; border-radius: var(--ds-radius-pill); background: var(--ds-neutral-200); overflow: hidden; }
.progress-bar { display: block; height: 100%; border-radius: inherit; background: var(--ds-primary); }
.progress-en_retard { background: var(--ds-danger); }
.progress-terminee { background: var(--ds-success); }
.progress-non_affectee { background: var(--ds-warning); }
.progress-value { min-width: 40px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pagination-links { display: flex; gap: 4px; }
.page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-surface); font-size: 14px; font-weight: 600; color: var(--ds-text); text-decoration: none; }
.page-link:hover { border-color: var(--ds-primary-300); color: var(--ds-primary-700); }
.page-link.is-current { border-color: var(--ds-primary); background: var(--ds-primary); color: var(--ds-on-primary); }
.page-link.is-disabled { color: var(--ds-text-faint); background: var(--ds-sunken); }
.decision-title { margin-top: 6px; font-size: 18px; font-weight: 500; color: var(--ds-text-muted); }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; gap: 12px 16px; padding: 16px; }
.filter-bar .input { width: 100%; min-width: 0; }
.filter-actions { display: flex; gap: 8px; }
.btn { text-decoration: none; }

/* --- Ergonomie : en-têtes, focus, lignes cliquables, notifications, confirmation, états vides --- */
#flash:empty { display: none; }
.page-subtitle { margin-top: 6px; font-size: 15px; color: var(--ds-text-muted); }
.page-title-block { min-width: 0; flex: 1; }
.page-title-block h1 { font-size: 26px; line-height: 1.3; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ds-text-faint); }
.summary-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 260px; padding: 14px 16px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); }
.summary-card .progress { width: 100%; }
.progress-lg .progress-track { height: 10px; }
.progress-lg .progress-value { font-size: 16px; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--ds-sunken); }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:focus-visible { outline-offset: -2px; background: var(--ds-primary-50); }
.table tr.is-editing { background: var(--ds-warning-bg); }
.form-row.is-editing { border-color: var(--ds-warning); box-shadow: 0 0 0 3px var(--ds-warning-bg); }
.count-link { font-weight: 600; color: var(--ds-primary); text-decoration: none; }
.count-link:hover { text-decoration: underline; }
.icon-btn.is-disabled { color: var(--ds-text-faint); opacity: .5; cursor: not-allowed; }
.icon-btn.is-disabled:hover { background: none; }
.btn-outline { border: 1px solid var(--ds-border-strong); background: var(--ds-surface); color: var(--ds-text); }
.btn-outline:hover { background: var(--ds-sunken); }
.btn-danger { background: var(--ds-danger); color: #fff; }
.btn-danger:hover { background: #c41d2a; }
.assign-search { width: 100%; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; }
.empty-state-icon { display: inline-flex; padding: 12px; border-radius: 50%; background: var(--ds-primary-50); color: var(--ds-primary); }
.empty-state-icon .icon { width: 22px; height: 22px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--ds-text); }
.empty-state-message { font-size: 14px; color: var(--ds-text-muted); }

.toasts { position: fixed; top: 76px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border: 1px solid var(--ds-border); border-left-width: 4px; border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: 0 10px 28px rgba(17, 45, 79, .16); font-size: 14px; animation: toast-in .18s ease-out; }
.toast-success { border-left-color: var(--ds-success); } .toast-success .toast-icon { color: var(--ds-success); }
.toast-error { border-left-color: var(--ds-danger); } .toast-error .toast-icon { color: var(--ds-danger); }
.toast-icon { margin-top: 1px; }
.toast-text { flex: 1; color: var(--ds-text); }
.toast-close { display: inline-flex; padding: 2px; border: 0; border-radius: var(--ds-radius-sm); background: none; color: var(--ds-text-faint); }
.toast-close:hover { background: var(--ds-sunken); color: var(--ds-text); }
.toast.is-leaving { opacity: 0; transform: translateX(12px); transition: all .18s ease-in; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.dialog { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--ds-radius-lg); box-shadow: 0 24px 60px rgba(17, 45, 79, .28); color: var(--ds-text); font-family: var(--ds-font); }
.dialog::backdrop { background: rgba(17, 45, 79, .45); }
.dialog-body { display: flex; flex-direction: column; gap: 20px; padding: 22px; }
.dialog-head { display: flex; gap: 14px; }
.dialog-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ds-primary-50); color: var(--ds-primary); }
.dialog-icon.is-danger { background: var(--ds-danger-bg); color: var(--ds-danger); }
.dialog-title { font-size: 17px; font-weight: 700; }
.dialog-message { margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--ds-text-muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation: none; transition: none; } }
.enhanced-select { width: 100%; }
.filter-bar .field { font-weight: 600; color: var(--ds-text); }
.filter-bar .input { height: 44px; }

/* Barre de filtres réactive : une ligne sur grand écran, deux sur écran moyen, une colonne sur mobile. */
.filter-bar { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.filter-bar > * { grid-column: span 12; min-width: 0; }
.filter-bar .filter-search { grid-column: span 12; }
.filter-actions { align-self: end; justify-content: flex-start; }
@media (min-width: 640px) {
  .filter-bar .filter-search { grid-column: span 12; }
  .filter-council, .filter-type, .filter-institution, .filter-status { grid-column: span 6; }
  .filter-actions { grid-column: span 12; }
}
@media (min-width: 1100px) {
  .filter-bar .filter-search { grid-column: span 6; }
  .filter-council, .filter-type { grid-column: span 3; }
  .filter-institution { grid-column: span 5; }
  .filter-status { grid-column: span 4; }
  .filter-actions { grid-column: span 3; }
}
@media (min-width: 1500px) {
  .filter-bar .filter-search { grid-column: span 3; }
  .filter-council, .filter-type, .filter-status { grid-column: span 2; }
  .filter-institution { grid-column: span 2; }
  .filter-actions { grid-column: span 1; }
}
.filter-actions .btn { height: 44px; }
@media (max-width: 639px) { .filter-actions .btn { flex: 1; justify-content: center; } .page-template { padding: 16px; } }

/* Cellule « Décision » : numéro + séance, puis intitulé. */
.col-title { min-width: 320px; width: 38%; }
.decision-cell { display: flex; flex-direction: column; gap: 4px; }
.decision-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.decision-number { font-size: 13px; font-weight: 700; letter-spacing: .01em; color: var(--ds-primary); text-decoration: none; }
.decision-number:hover { text-decoration: underline; }
.decision-council { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--ds-radius-pill); background: var(--ds-sunken); font-size: 12px; color: var(--ds-text-muted); white-space: nowrap; }
.decision-cell-title { font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--ds-text); }

/* Tableau des décisions sans défilement : Décision | Institutions | Avancement. */
.decisions-table { table-layout: auto; }
.decisions-table .col-title { width: auto; min-width: 0; }
.decisions-table .col-institutions { width: 26%; }
.decisions-table .col-progress { width: 220px; min-width: 180px; }
.decisions-table .col-go { width: 48px; }
.decision-type { font-size: 12px; font-weight: 600; color: var(--ds-text-muted); }
.decision-type::before { content: "·"; margin-right: 8px; color: var(--ds-text-faint); }
.institution-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.institution-lead { display: inline-flex; align-items: center; overflow: hidden; border-radius: var(--ds-radius-pill); background: var(--ds-primary-700); color: #fff; font-size: 12px; font-weight: 700; }
.institution-lead .institution-role { padding: 2px 8px; background: rgba(255,255,255,.14); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.institution-lead .institution-code { padding: 2px 10px; }
.institution-joint { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.institution-joint .institution-role { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ds-text-faint); margin-right: 2px; }
.progress-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.progress-cell .progress { width: 100%; }

/* Mobile et petite tablette : chaque décision devient une carte. */
@media (max-width: 767px) {
  .decisions-table thead { display: none; }
  .decisions-table, .decisions-table tbody, .decisions-table tr, .decisions-table td { display: block; width: 100%; }
  .decisions-table tr { position: relative; padding: 14px 16px; border-top: 1px solid var(--ds-border); }
  .decisions-table tr:first-child { border-top: 0; }
  .decisions-table td { padding: 0; border: 0; }
  .decisions-table td + td { margin-top: 12px; }
  .decisions-table .col-institutions, .decisions-table .col-progress { width: 100%; min-width: 0; }
  .decisions-table .col-go { position: absolute; top: 10px; right: 8px; width: auto; margin: 0; }
  .decisions-table .col-title { padding-right: 32px; }
  .decisions-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ds-text-faint); }
  .institution-stack { flex-direction: row; flex-wrap: wrap; align-items: center; }
}

/* --- Qualification des décisions (boîte « Nouvelles décisions », bandeau de la fiche) --- */
.ms-18 { font-size: 18px; }
.filter-follow-up { grid-column: span 12; }
@media (min-width: 640px) { .filter-follow-up { grid-column: span 6; } }
@media (min-width: 1100px) { .filter-follow-up { grid-column: span 3; } .filter-status { grid-column: span 3; } .filter-institution { grid-column: span 4; } .filter-actions { grid-column: span 2; } }
@media (min-width: 1500px) { .filter-bar .filter-search { grid-column: span 2; } .filter-follow-up, .filter-status, .filter-council, .filter-type, .filter-institution { grid-column: span 2; } }
.status-non_suivie { background: var(--ds-neutral-200); color: var(--ds-text-muted); }
.source-badge { padding: 1px 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-pill); font-size: 11.5px; font-weight: 600; color: var(--ds-text-muted); }
.inbox-callout { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--ds-warning); border-radius: var(--ds-radius-lg); background: var(--ds-warning-bg); color: var(--ds-text); font-size: 14px; text-decoration: none; }
.inbox-callout:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.inbox-callout .material-symbols-rounded { color: #9a6700; }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 12px 16px; }
.bulk-bar.is-active { border-color: var(--ds-primary-300); background: var(--ds-primary-50); }
.bulk-select { font-weight: 600; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.inbox-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; transition: border-color .12s, box-shadow .12s; }
.inbox-card:hover { box-shadow: 0 2px 10px rgba(17,45,79,.08); }
.inbox-card.is-selected { border-color: var(--ds-primary); box-shadow: 0 0 0 2px var(--ds-primary-100); }
.inbox-card-head { display: flex; align-items: flex-start; gap: 10px; }
.inbox-check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ds-primary); }
.inbox-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.inbox-title a { color: var(--ds-text); text-decoration: none; }
.inbox-title a:hover { color: var(--ds-primary); }
.inbox-institution { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inbox-recommendations { padding: 10px 12px; border-radius: var(--ds-radius); background: var(--ds-sunken); }
.inbox-label { margin-bottom: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ds-text-faint); }
.inbox-recommendations ul { display: flex; flex-direction: column; gap: 4px; padding-left: 18px; list-style: disc; font-size: 13.5px; color: var(--ds-text); }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.qualify-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border: 1px solid; border-radius: var(--ds-radius-lg); font-size: 14px; }
.qualify-banner.is-pending { border-color: var(--ds-warning); background: var(--ds-warning-bg); }
.qualify-banner.is-pending .material-symbols-rounded { color: #9a6700; }
.qualify-banner.is-not-followed { border-color: var(--ds-border-strong); background: var(--ds-sunken); }
.qualify-text { flex: 1; min-width: 240px; }
.qualify-actions { display: flex; gap: 8px; }
.dialog-textarea { width: 100%; resize: vertical; font: inherit; }
@media (max-width: 639px) { .bulk-actions { margin-left: 0; width: 100%; } .bulk-actions .btn, .inbox-actions .btn { flex: 1; justify-content: center; } }
@media (min-width: 1500px) {
  .filter-bar .filter-search { grid-column: span 4; }
  .filter-council, .filter-type, .filter-institution, .filter-follow-up { grid-column: span 2; }
  .filter-status { grid-column: span 2; }
  .filter-actions { grid-column: span 2; }
}

/* Tableau de qualification */
.qualification-table .col-check { width: 44px; }
.qualification-table .col-check input { width: 18px; height: 18px; accent-color: var(--ds-primary); }
.qualification-table .col-institutions { width: 22%; }
.qualification-table .col-recommendations { width: 24%; }
.qualification-table .col-actions { width: 1%; white-space: nowrap; }
.qualification-table tr.is-selected { background: var(--ds-primary-50); }
.institution-lead .institution-code:only-child { padding: 2px 10px; }
.institution-name { margin-top: 6px; line-height: 1.4; }
.reco-preview summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ds-primary); }
.reco-preview ul { margin-top: 6px; padding-left: 18px; list-style: disc; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ds-text); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
@media (max-width: 1099px) { .row-actions { flex-wrap: wrap; justify-content: flex-start; } .qualification-table .col-actions { white-space: normal; } }
@media (max-width: 767px) {
  .qualification-table .col-check { position: absolute; top: 14px; left: 16px; width: auto; }
  .qualification-table .col-title { padding-left: 32px; }
  .qualification-table .row-actions .btn { flex: 1; justify-content: center; }
}
.qualification-table .col-actions { width: 1%; }
.qualification-table .col-institutions { width: 26%; }
/* Mobile : les colonnes du tableau (exécution comme qualification) prennent toute la largeur de la carte. */
@media (max-width: 767px) {
  .decisions-table td.col-institutions, .decisions-table td.col-actions, .decisions-table td.col-progress { width: 100%; white-space: normal; }
  .qualification-table .row-actions { justify-content: stretch; }
  .qualification-table .row-actions .btn { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .institution-lead { flex-shrink: 0; white-space: nowrap; }
}

/* --- Saisie et import des décisions, gestion des recommandations --- */
.btn.is-disabled { opacity: .5; cursor: not-allowed; }
.form-grid { display: flex; flex-direction: column; gap: var(--ds-sp-5); }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px 20px; }
.field-span-2 { grid-column: 1 / -1; }
.field textarea.input { resize: vertical; min-height: 64px; font: inherit; }
.field-hint { font-size: 12px; font-weight: 400; color: var(--ds-text-faint); }
.reco-inputs { display: flex; flex-direction: column; gap: 8px; padding-left: 22px; }
.reco-input { display: flex; align-items: center; gap: 8px; }
.reco-input .input { flex: 1; }
.form-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.import-drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; border: 2px dashed var(--ds-border-strong); text-align: center; }
.import-drop.is-over { border-color: var(--ds-primary); background: var(--ds-primary-50); }
.import-icon { font-size: 40px; color: var(--ds-primary); }
.import-title { font-size: 16px; font-weight: 600; }
.import-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ds-border); }
.import-table tr.is-invalid { background: var(--ds-danger-bg); }
.import-errors { margin: 0; padding-left: 16px; list-style: disc; font-size: 12.5px; color: var(--ds-danger); }
.reco-label-cell { position: relative; }
.reco-tools { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; opacity: .55; }
tr:hover .reco-tools, .reco-tools:focus-within { opacity: 1; }
.reco-tools .icon-btn { padding: 4px; }
.reco-editor { display: flex; flex-wrap: wrap; gap: 6px; }
.reco-editor .input { flex: 1; min-width: 220px; }
.reco-new { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--ds-border); }
.reco-new .input { flex: 1; min-width: 240px; }
@media (max-width: 639px) { .form-footer .btn, .reco-new .btn { flex: 1; justify-content: center; } }
