/* Variables de theme communes a toutes les pages */
:root {
  --brand: #0f5b8d;
  --brand-dark: #0a4267;
  --brand-soft: #dbeaf3;
  --accent: #d9a441;
  --surface: #ffffff;
  --surface-alt: #f5f8fb;
  --text: #1f2933;
  --muted: #607080;
  --border: #d4dde6;
  --shadow: 0 16px 40px rgba(15, 55, 84, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-brand: Georgia, "Times New Roman", serif;

  /* Harmonisation Bootstrap sur le bleu maison : sans ca, .btn-primary rend en bleu
     Bootstrap par defaut (#0d6efd), different du bleu institutionnel utilise partout
     ailleurs (header, chips, barres de progression) -> deux bleus qui cohabitent. */
  --bs-primary: var(--brand);
  --bs-primary-rgb: 15, 91, 141;
}

/* .btn-primary / .btn-outline-primary consomment leurs propres variables --bs-btn-*
   (valeurs figees a la compilation Sass de Bootstrap, --bs-primary seul ne suffit pas
   a les faire changer) : on les recible explicitement sur le bleu maison. */
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 15, 91, 141;
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-border-color: var(--brand);
  --bs-btn-disabled-color: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 15, 91, 141;
}

* {
  box-sizing: border-box;
}

/* Lien d'evitement RGAA (12.1/12.2) : invisible tant qu'il n'a pas le focus clavier */
.skip-link {
  position: absolute;
  top: -999px;
  left: 0;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) 0;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

/* Fond d'application et ambiance generale */
body.app-shell {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 42%, white) 0%, color-mix(in srgb, var(--surface-alt) 78%, white) 40%, color-mix(in srgb, var(--brand-soft) 28%, white) 100%);
}

body.login-shell {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 24%, transparent), transparent 24%),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--brand) 18%, transparent), transparent 26%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 34%, white) 0%, color-mix(in srgb, var(--surface-alt) 84%, white) 45%, color-mix(in srgb, var(--brand-soft) 26%, white) 100%);
}

/* Header institutionnel partage */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  box-shadow: 0 10px 30px rgba(8, 52, 80, 0.18);
}

.app-header--compact {
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__inner {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}

.app-brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.app-brand[data-home-link] {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-brand[data-home-link]:hover {
  opacity: 0.92;
}

.app-brand[data-home-link]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 12px;
}

.app-brand--login {
  align-items: flex-start;
}

.app-logo {
  width: auto;
  max-width: min(100%, 180px);
  max-height: 56px;
  height: auto;
  flex: 0 0 auto;
  opacity: 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.2rem;
}

.app-logo[data-brand-logo] {
  visibility: visible;
  opacity: 1;
}

.app-kicker,
.panel-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.app-kicker {
  color: rgba(255, 255, 255, 0.75);
}

.app-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app-title--dark {
  color: var(--brand-dark);
}

/* Pastille d'environnement (cf. branding.js applyEnvironmentBadge) */
.env-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.6rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  cursor: help;
}

.env-badge--dev {
  color: #7a4312;
  background: #ffe7d1;
  border: 1px solid #f3ba87;
}

[data-color-mode="dark"] .env-badge--dev {
  color: #e8a060;
  background: color-mix(in srgb, #8a4b12 25%, var(--surface));
  border-color: color-mix(in srgb, #c87830 40%, var(--border));
}

.env-badge--preprod {
  color: #4b2d7f;
  background: #ece3fb;
  border: 1px solid #c9b3ee;
}

[data-color-mode="dark"] .env-badge--preprod {
  color: #c9aef2;
  background: color-mix(in srgb, #5a3a99 25%, var(--surface));
  border-color: color-mix(in srgb, #8a63d2 40%, var(--border));
}

.app-subtitle {
  max-width: 55rem;
  margin: 0.45rem 0 0;
  color: rgba(255, 255, 255, 0.82);
}

.branding-preview-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 120px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 45;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(15, 91, 141, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 36px rgba(15, 55, 84, 0.16);
  color: var(--brand-dark);
  font-weight: 700;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(320px, 0.85fr);
}

.login-brand-panel {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 2rem;
}

.login-brand-panel__content {
  width: min(100%, 720px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
}

.app-logo--login {
  width: auto;
  max-width: min(100%, 260px);
}

.unc-row {
  display: grid;
  grid-template-columns: 1fr 160px 140px 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .unc-row {
    grid-template-columns: 1fr 1fr auto;
    grid-template-rows: auto auto;
  }
}

.login-lead {
  max-width: 42rem;
  margin: 0.6rem 0 0;
  color: #4d6474;
  font-size: 1.02rem;
  line-height: 1.65;
}

.login-card {
  border: 1px solid rgba(212, 221, 230, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 50px rgba(15, 55, 84, 0.12);
  backdrop-filter: blur(12px);
}

.product-hero-card {
  margin: 0;
  border: 1px solid rgba(212, 221, 230, 0.9);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(217, 164, 65, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 251, 0.94));
  box-shadow: 0 24px 56px rgba(15, 55, 84, 0.12);
  overflow: hidden;
}

.product-hero-card--login {
  max-width: 34rem;
  padding: 1rem;
}

.product-hero-card--about {
  width: min(100%, 24rem);
  padding: 0.85rem;
  flex: 0 0 auto;
}

.product-hero-card__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
}

.app-footer__org-logo {
  display: block;
  width: auto;
  max-width: 72px;
  max-height: 72px;
  margin-top: 0.9rem;
  padding: 0.22rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 22px rgba(8, 52, 80, 0.12);
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 480px);
  padding: 1.75rem;
}

.login-card__header {
  margin-bottom: 1.25rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-footnote {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212, 221, 230, 0.9);
}

.login-footnote__title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #123d58;
}

.login-footnote__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.login-footnote__text + .login-footnote__text {
  margin-top: 0.45rem;
}

.password-generator-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.password-generator-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 40, 0.55);
  backdrop-filter: blur(6px);
}

.password-generator-modal__dialog {
  position: relative;
  width: min(100%, 32rem);
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.35rem;
  border: 1px solid rgba(212, 221, 230, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 56px rgba(15, 55, 84, 0.22);
}

.password-generator-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.password-generator-modal__content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.password-generator-modal__result {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfdff, #f4f8fb);
}

.password-generator-modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Barre d'action toujours visible en bas d'une modale longue (defilement interne). */
.password-generator-modal__actions--sticky {
  position: sticky;
  bottom: -1.35rem;
  margin: 0 -1.35rem -1.35rem;
  padding: 0.85rem 1.35rem;
  border-top: 1px solid var(--border);
  background: #fff;
  border-radius: 0 0 24px 24px;
}

[data-color-mode="dark"] .password-generator-modal__actions--sticky {
  background: var(--surface);
}

/* Contenants principaux reutilises dans les pages */
.hero-panel,
.content-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(212, 221, 230, 0.88);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-panel {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.6rem 1.75rem;
}

.hero-panel__meta {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.hero-panel__actions {
  display: flex;
  align-items: flex-start;
}

.hero-panel__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(10.5rem, 1fr));
  gap: 0.85rem;
}

.hero-panel__stats--single {
  grid-template-columns: minmax(12rem, 1fr);
}

.panel-eyebrow {
  color: var(--brand);
}

.panel-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.55rem;
  font-weight: 700;
}

.panel-title-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.dashboard-pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #fff4d6;
  border: 1px solid #f1d48b;
  color: #694b00;
  font-size: 0.82rem;
  font-weight: 700;
}

.panel-text {
  margin: 0.6rem 0 0;
  color: var(--muted);
  max-width: 46rem;
}

.stat-card,
.status-pill {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.stat-card {
  min-width: 0;
  padding: 0.85rem 1rem;
}

.stat-card__label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-card__value {
  display: block;
  font-size: 1.9rem;
  line-height: 1.1;
}

.status-pill {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-dark);
}

.form-layout {
  display: grid;
  gap: 1.25rem;
}

.content-card {
  padding: 1.5rem;
}

.signature-box--readonly {
  pointer-events: none;
  opacity: 0.85;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 700;
}

.filter-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfdff, #f4f8fb);
}

.filter-toolbar__search {
  display: block;
}

.filter-toolbar__filters {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
}

.filter-toolbar__grid {
  flex: 1;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Filtres replies par defaut : seule la recherche reste visible, avec le bouton "Filtres". */
.filter-toolbar.is-collapsed {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.filter-toolbar.is-collapsed .filter-toolbar__grid > div:not(.filter-toolbar__search) {
  display: none;
}

.filter-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chips:empty {
  display: none;
}

.filter-chip {
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text, inherit);
  font-size: 0.82rem;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  border-color: var(--brand, #0f5c8a);
}

[data-color-mode="dark"] .filter-chip {
  background: var(--surface);
}

.dashboard-toolbar__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.timing-chip,
.status-chip {
  white-space: nowrap;
}

.filter-toolbar__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.admin-hero {
  align-items: stretch;
}

.admin-stats {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  align-content: start;
}

.admin-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
}

.admin-nav {
  display: grid;
  gap: 0.75rem;
}

.admin-nav__link {
  display: grid;
  gap: 0.18rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfdff, #f4f8fb);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-nav__link:hover,
.admin-nav__link:focus {
  border-color: rgba(15, 91, 141, 0.42);
  box-shadow: 0 12px 24px rgba(15, 55, 84, 0.08);
  transform: translateY(-1px);
  color: var(--text);
}

.admin-nav__link span {
  font-weight: 700;
  color: #14364a;
}

.admin-nav__link small {
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-entry-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.admin-entry-card:hover,
.admin-entry-card:focus {
  color: inherit;
  transform: translateY(-2px);
  border-color: rgba(15, 91, 141, 0.38);
  box-shadow: 0 16px 28px rgba(15, 55, 84, 0.1);
}

.admin-content {
  display: grid;
  gap: 1.25rem;
}

.admin-inner-card {
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #fbfdff, #f4f8fb);
}

.dashboard-update-notice {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(15, 91, 141, 0.18);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #eef7ff, #f8fbfe);
  color: var(--brand-dark);
  font-weight: 600;
}

.dashboard-update-notice__content {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.dashboard-update-notice.is-highlighted {
  animation: dashboard-notice-fade 3.2s ease;
}

.draft-row--new {
  animation: dashboard-row-flash 3.2s ease;
}

@keyframes dashboard-notice-fade {
  0% {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(15, 91, 141, 0.14);
  }
  100% {
    transform: translateY(0);
    box-shadow: none;
  }
}

@keyframes dashboard-row-flash {
  0% {
    background: rgba(217, 164, 65, 0.22);
  }
  100% {
    background: transparent;
  }
}

.choice-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.choice-chip {
  position: relative;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip span,
.equipment-toggle {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.equipment-toggle:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  color: var(--brand);
}

.choice-chip input:checked + span {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.equipment-grid {
  display: grid;
  gap: 1rem;
}

.equipment-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.equipment-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff, #f9fbfd);
  transition: border-color 0.15s, background 0.15s;
}

.equipment-item.is-selected {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f4f8ff, #f9fbfd);
}

.equipment-item__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.equipment-item__hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.equipment-item__desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.4rem 0 0;
}

.equipment-item__body {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.resource-kind-block + .resource-kind-block {
  margin-top: 1.5rem;
}

.resource-kind-block__header {
  margin-bottom: 0.85rem;
}

.resource-kind-block__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.resource-kind-block__text {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.repeatable-list {
  display: grid;
  gap: 0.75rem;
}

.repeatable-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.resource-field-builder {
  display: grid;
  gap: 0.9rem;
}

.resource-order-list {
  display: grid;
  gap: 1rem;
}

.resource-order-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
}

.resource-order-group {
  padding: 1rem;
  border: 1px solid rgba(15, 91, 141, 0.12);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 252, 0.96));
}

.resource-order-group__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.resource-order-group__list {
  display: grid;
  gap: 0.9rem;
}

.resource-order-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(15, 91, 141, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(15, 55, 84, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.resource-order-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15, 55, 84, 0.12);
}

.resource-order-item.is-dragging {
  opacity: 0.72;
}

.resource-order-item.is-drag-over {
  border-color: rgba(15, 91, 141, 0.42);
  box-shadow: 0 0 0 3px rgba(15, 91, 141, 0.12);
}

.resource-order-item__handle {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.resource-order-item__position {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(15, 91, 141, 0.10);
  color: var(--brand-dark);
  font-weight: 700;
}

.resource-order-item__content {
  min-width: 0;
}

.resource-order-item__status {
  justify-self: end;
}

.resource-field-row {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff, #f9fbfd);
}

.resource-field-row .form-label {
  font-size: 0.84rem;
  color: var(--muted);
}

/* Champ masque (cf. Suppr. -> Masquer) : reste dans le schema, retire du formulaire dossier */
.resource-field-row--hidden {
  opacity: 0.6;
  background: repeating-linear-gradient(135deg, #f4f6f8, #f4f6f8 10px, #eef1f4 10px, #eef1f4 20px);
}

.resource-field-hidden-banner .status-pill {
  background: rgba(214, 163, 64, 0.16);
  color: #8a5a00;
}

.progress-required-field {
  border-color: #d6a53a !important;
  box-shadow: 0 0 0 0.18rem rgba(214, 165, 58, 0.14);
  background: linear-gradient(180deg, #fffdf7, #ffffff);
}

.progress-required-surface {
  border-color: #d6a53a !important;
  box-shadow: 0 0 0 0.18rem rgba(214, 165, 58, 0.12);
}

.progress-required-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.progress-required-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(214, 165, 58, 0.14);
  color: #8a5a00;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.equipment-toggle input {
  accent-color: var(--brand);
}

.subgrid + .subgrid {
  margin-top: 0.75rem;
}

.subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.restitution-list {
  display: grid;
  gap: 0.9rem;
}

.restitution-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.25fr) minmax(220px, 1.15fr) minmax(220px, 1.2fr);
  gap: 0.75rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff, #f9fbfd);
}

.restitution-row__title {
  font-weight: 700;
}

.restitution-row__meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.restitution-choice-group {
  gap: 0.45rem;
}

.restitution-choice-group .choice-chip span {
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.signature-wrap {
  border: 2px dashed #9db8ca;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff, #f4f8fb);
  padding: 0.5rem;
}

.signature-box {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  touch-action: none;
}

.rgpd-card {
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff8eb, #fffdf8);
}

.rgpd-card__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.rgpd-text {
  color: var(--muted);
  font-size: 0.95rem;
}

.stack-gap {
  display: grid;
  gap: 0.85rem;
}

.status-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
}

.status-card__label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.action-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(212, 221, 230, 0.88);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

/* Barre d'action collee en bas d'ecran : "Enregistrer" reste accessible sur un long formulaire. */
form > .action-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 90;
}

.dashboard-nav.form-toc {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.form-toc .dashboard-nav__link {
  flex: 0 0 auto;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
}

form section.content-card {
  scroll-margin-top: 9rem;
}

.section-heading--collapsible {
  cursor: pointer;
}

.section-heading--collapsible::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
}

.content-card.is-collapsed > :not(.section-heading) {
  display: none;
}

.content-card.is-collapsed .section-heading--collapsible::after {
  content: "▸";
}

.section-count {
  margin-left: 0.75rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 55, 84, 0.1);
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill--warning {
  background: #fff4d6;
  color: #7a4b00;
}

[data-color-mode="dark"] .status-pill--warning {
  background: #4a3a12;
  color: #f5d27a;
}

.action-bar__hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.action-bar__buttons,
.header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.app-footer {
  margin-top: 2rem;
  border-top: 1px solid rgba(212, 221, 230, 0.88);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 251, 0.92));
  backdrop-filter: blur(10px);
}

.app-footer__inner {
  padding-top: 1.35rem;
  padding-bottom: 1rem;
  display: grid;
  gap: 1rem;
}

.app-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 1.2rem;
}

.app-footer__bottom {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.app-footer__column,
.app-footer__identity,
.app-footer__contact,
.app-footer__links {
  display: grid;
  gap: 0.45rem;
}

.app-footer__identity {
  gap: 0.65rem;
  align-items: center;
  grid-auto-flow: column;
  justify-content: flex-start;
}

.app-footer__contact {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.app-footer__heading {
  color: var(--brand-dark);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-footer__app {
  color: var(--brand-dark);
  font-weight: 700;
}

.app-footer__version {
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(15, 91, 141, 0.14);
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-soft) 70%, white);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.app-footer__contact,
.app-footer__bottom {
  color: var(--muted);
  font-size: 0.92rem;
}

.app-footer__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.app-footer__links a {
  width: fit-content;
}

.app-footer a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus {
  text-decoration: underline;
}

.app-footer__cookies {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

.app-footer__cookies:hover,
.app-footer__cookies:focus {
  text-decoration: underline;
}

.info-page {
  max-width: 1120px;
}

.info-page__hero {
  display: grid;
  gap: 0.9rem;
}

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

.info-page__list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.info-page__list li + li {
  margin-top: 0.45rem;
}

#cc-main {
  --cc-font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --cc-bg: rgba(255, 255, 255, 0.98);
  --cc-primary-color: var(--text);
  --cc-secondary-color: var(--muted);
  --cc-btn-primary-bg: var(--brand);
  --cc-btn-primary-color: #fff;
  --cc-btn-primary-hover-bg: var(--brand-dark);
  --cc-btn-primary-hover-color: #fff;
  --cc-btn-secondary-bg: rgba(15, 91, 141, 0.08);
  --cc-btn-secondary-color: var(--brand-dark);
  --cc-btn-secondary-hover-bg: rgba(15, 91, 141, 0.14);
  --cc-btn-secondary-hover-color: var(--brand-dark);
  --cc-toggle-on-bg: var(--brand);
  --cc-toggle-off-bg: #9fb5c5;
  --cc-toggle-readonly-bg: #c7d4de;
  --cc-cookie-category-block-bg: color-mix(in srgb, var(--brand-soft) 26%, white);
  --cc-cookie-category-block-hover-bg: color-mix(in srgb, var(--brand-soft) 44%, white);
  --cc-cookie-category-block-border: rgba(15, 91, 141, 0.12);
  --cc-modal-border-radius: 20px;
  --cc-btn-border-radius: 12px;
  --cc-separator-border-color: rgba(212, 221, 230, 0.9);
  --cc-modal-margin: 0.85rem;
  --cc-z-index: 90;
}

#cc-main .cm,
#cc-main .pm {
  box-shadow: 0 22px 48px rgba(15, 55, 84, 0.16);
  border: 1px solid rgba(15, 91, 141, 0.12);
  backdrop-filter: blur(14px);
}

#cc-main .cm {
  max-width: 420px;
}

#cc-main .pm {
  max-width: 720px;
}

#cc-main .cm__title,
#cc-main .pm__title {
  color: var(--brand-dark);
}

#cc-main .pm__section-title {
  color: var(--brand-dark);
}

#cc-main .cm__desc {
  line-height: 1.6;
  font-size: 0.93rem;
}

#cc-main .cm__btn-group {
  gap: 0.5rem;
}

#cc-main .cm__btn,
#cc-main .pm__btn {
  min-height: 42px;
  font-size: 0.92rem;
}

#cc-main .cc-cookie-details {
  margin: 0;
  padding-left: 1.1rem;
}

#cc-main .cc-cookie-details li + li {
  margin-top: 0.45rem;
}

.draft-table {
  margin-bottom: 0;
}

/* Affordance de clic : la ligne ouvre l'apercu rapide (bindQuickPreviews) sauf sur
   boutons/liens/actions, deja exclus cote JS - le survol doit le signaler visuellement. */
.draft-table tbody tr.draft-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.draft-table tbody tr.draft-row:hover {
  background-color: var(--surface-alt);
}

/* Historique deplie d'une personne ayant plusieurs dossiers (une ligne par personne dans les tableaux de bord). */
.person-history-toggle td {
  padding: 0;
  border-top: none;
}

.person-history__summary {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted, #6b7a8d);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.person-history__summary:hover {
  color: var(--text);
}

.person-history__chevron {
  display: inline-block;
  transition: transform 0.12s ease;
}

.person-history-panel td {
  padding: 0 1rem 0.75rem;
  border-top: none;
}

.person-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.person-history__item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-alt);
  border-radius: 8px;
  font-size: 0.85rem;
}

.person-history__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.person-history__resources {
  color: var(--text-muted, #6b7a8d);
  font-size: 0.8rem;
}

.person-history__date {
  color: var(--text-muted, #6b7a8d);
  min-width: 6.5rem;
}

.person-history__title {
  flex: 1;
  min-width: 8rem;
}

/* Pagination du journal */
.logs-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.logs-pagination__info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.logs-pagination__controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.logs-pagination__btn {
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.logs-pagination__btn:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--brand);
  color: var(--brand);
}

.logs-pagination__btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: default;
}

.logs-pagination__btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.logs-pagination__ellipsis {
  padding: 0 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  user-select: none;
}

/* Colonne Cible dans le journal */
.log-target__type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.35rem;
}

.log-target__label {
  font-weight: 600;
  color: var(--text);
}

.draft-table th {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* En-tetes triables (cf. bindSortableHeaders, storage.js) */
.draft-table th[data-sort-field] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.draft-table th[data-sort-field]:hover {
  color: var(--brand);
}

.draft-table th[data-sort-field]::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  margin-left: 0.3em;
  opacity: 0.35;
}

.draft-table th[data-sort-field].is-sorted-asc::after {
  content: "\25B2"; /* triangle plein vers le haut */
  opacity: 1;
  color: var(--brand);
}

.draft-table th[data-sort-field].is-sorted-desc::after {
  content: "\25BC"; /* triangle plein vers le bas */
  opacity: 1;
  color: var(--brand);
}

.draft-check-col {
  width: 42px;
  text-align: center;
}

.draft-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.draft-title {
  font-weight: 700;
}

.draft-unc-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  cursor: default;
  white-space: nowrap;
}

.draft-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.draft-actions {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: flex-end;
  flex-direction: column;
}

.draft-actions .btn {
  white-space: nowrap;
}

.draft-actions__primary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.draft-actions__menu {
  align-self: flex-end;
}

.draft-actions__menu summary {
  list-style: none;
  cursor: pointer;
}

.draft-actions__menu summary::-webkit-details-marker {
  display: none;
}

.draft-actions__menu-panel {
  width: min(240px, 100%);
  min-width: 0;
  margin-top: 0.45rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f7fafc);
  box-shadow: 0 16px 34px rgba(15, 55, 84, 0.14);
  display: grid;
  gap: 0.55rem;
}

.draft-actions__menu-section {
  display: grid;
  gap: 0.45rem;
}

.draft-actions__menu-section + .draft-actions__menu-section {
  padding-top: 0.55rem;
  border-top: 1px solid rgba(212, 221, 230, 0.9);
}

.draft-actions__menu-panel .btn {
  width: 100%;
}

@media (min-width: 992px) {
  .draft-actions__primary {
    flex-wrap: nowrap;
  }
}

/* Volet flottant sur grand ecran : ne deforme pas la hauteur de la ligne. */
@media (min-width: 768px) {
  .draft-actions__menu {
    position: relative;
  }

  .draft-actions__menu-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 30;
    width: 15rem;
  }

  .draft-table tbody tr:nth-last-child(-n+2) .draft-actions__menu-panel {
    top: auto;
    bottom: 100%;
    margin: 0 0 0.45rem;
  }
}

.draft-actions__menu-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Menu filtres dans le header (details/summary natif) */
.filter-menu {
  position: relative;
}

.filter-menu summary {
  list-style: none;
  cursor: pointer;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.filter-menu__panel {
  position: absolute;
  right: 0;
  z-index: 25;
  width: 440px;
  max-width: calc(100vw - 1rem);
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(15, 55, 84, 0.14);
  display: grid;
  gap: 0.8rem;
}

.filter-menu__search .form-control {
  width: 100%;
}

.filter-menu__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.filter-menu__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.filter-menu__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3em;
  height: 1.3em;
  padding: 0 0.3em;
  border-radius: 99px;
  background: #fff;
  color: var(--brand);
  font-size: 0.68em;
  font-weight: 800;
  margin-left: 0.3rem;
  vertical-align: middle;
  line-height: 1;
}

.filter-menu__footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

/* Menu export regroupé (details/summary natif) */
.export-menu {
  position: relative;
}

.export-menu summary {
  list-style: none;
  cursor: pointer;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu__panel {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 200px;
  max-width: calc(100vw - 1rem);
  margin-top: 0.45rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(15, 55, 84, 0.14);
  display: grid;
  gap: 0.2rem;
}

.export-menu__item {
  display: block;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background-color 0.15s ease;
}

.export-menu__item:hover,
.export-menu__item:focus {
  background: var(--surface-alt);
  color: var(--brand);
  text-decoration: none;
}

button.export-menu__item {
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
}

/* Modale filtre export Excel */
.export-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.export-filter-modal.is-hidden {
  display: none;
}

.export-filter-modal__dialog {
  width: min(480px, 100%);
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(15, 55, 84, 0.14);
}

.export-filter-modal__dialog h3 {
  margin: 0 0 1.1rem;
  font-size: 1.1rem;
}

.export-filter-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.export-filter-modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

[data-color-mode="dark"] .export-filter-modal__dialog {
  background: var(--surface);
  border-color: var(--border);
}

/* Menu utilisateur (header, details/summary) */
.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu__panel {
  position: absolute;
  right: 0;
  z-index: 30;
  min-width: 240px;
  max-width: calc(100vw - 1rem);
  margin-top: 0.55rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(15, 55, 84, 0.18);
  display: grid;
  gap: 0.15rem;
}

.user-menu__header {
  padding: 0.6rem 0.85rem 0.55rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.user-menu__name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.user-menu__role {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.user-menu__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease;
}

.user-menu__item:hover,
.user-menu__item:focus {
  background: var(--surface-alt);
  color: var(--brand);
  text-decoration: none;
}

.user-menu__sep {
  height: 1px;
  margin: 0.25rem 0.5rem;
  background: var(--border);
}

.user-menu__item--danger:hover,
.user-menu__item--danger:focus {
  color: #dc3545;
}

/* Modale changement de mot de passe */
.password-change-modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1080; /* au-dessus de la bannière de configuration (1040) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.password-change-modal__dialog {
  width: min(440px, 100%);
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(15, 55, 84, 0.14);
}

.password-change-modal__dialog h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.password-change-modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.password-change-modal__feedback {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
}

.password-change-modal__feedback--error {
  background: #fde2e2;
  color: #7f1d1d;
  border: 1px solid #efb0b0;
}

.password-change-modal__feedback--success {
  background: #def7e7;
  color: #0a4d28;
  border: 1px solid #97d8ae;
}

[data-color-mode="dark"] .password-change-modal__backdrop {
  background: rgba(0, 0, 0, 0.65);
}

[data-color-mode="dark"] .password-change-modal__dialog {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .password-change-modal__feedback--error {
  background: color-mix(in srgb, #7f1d1d 25%, var(--surface));
  color: #e88080;
  border-color: color-mix(in srgb, #b84a4a 40%, var(--border));
}

[data-color-mode="dark"] .password-change-modal__feedback--success {
  background: color-mix(in srgb, #0a4d28 25%, var(--surface));
  color: #6bc990;
  border-color: color-mix(in srgb, #2d8a56 40%, var(--border));
}

.dashboard-groups {
  display: grid;
  gap: 1.2rem;
}

.dashboard-nav {
  position: sticky;
  top: 4.8rem;
  z-index: 99;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.8rem 0;
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  border-radius: var(--radius-md);
}

.dashboard-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.dashboard-nav__count {
  display: inline-block;
  min-width: 1.5em;
  margin-left: 0.35rem;
  padding: 0 0.45em;
  border-radius: 999px;
  background: rgba(15, 55, 84, 0.1);
  font-size: 0.78em;
  font-weight: 700;
  text-align: center;
}

.dashboard-nav__link.is-active .dashboard-nav__count {
  background: rgba(255, 255, 255, 0.22);
}

.dashboard-nav__link:hover,
.dashboard-nav__link:focus-visible {
  background: rgba(219, 234, 243, 0.8);
  border-color: rgba(15, 91, 141, 0.26);
  transform: translateY(-1px);
}

.dashboard-nav__link.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 91, 141, 0.18);
}

.dashboard-group {
  padding: 1rem;
  border: 1px solid rgba(212, 221, 230, 0.88);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 248, 251, 0.92));
}

.dashboard-group__header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.dashboard-group__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 91, 141, 0.14);
  background: rgba(219, 234, 243, 0.72);
  color: var(--brand-dark);
  font-weight: 700;
}

.dashboard-group__empty {
  padding: 1rem 0.25rem 0.1rem;
  color: var(--muted);
}

.dashboard-group__load-more {
  padding: 0.5rem 0.25rem;
  text-align: center;
}

.dashboard-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.dashboard-toolbar__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-chip--draft {
  color: #694b00;
  background: #fff4d6;
  border-color: #f1d48b;
}

.status-chip--active {
  color: #0a4d28;
  background: #def7e7;
  border-color: #97d8ae;
}

.status-chip--partial_assignment {
  color: #8a4b12;
  background: #ffe7d1;
  border-color: #f3ba87;
}

/* Violet distinct du bleu "returned" : les deux ne doivent jamais se confondre au scan rapide */
.status-chip--awaiting_signature {
  color: #4a2382;
  background: #eee3fb;
  border-color: #c6a8f0;
}

.status-chip--returned {
  color: #18436d;
  background: #ddefff;
  border-color: #9cc7f0;
}

/* Teal distinct de l'orange "partial_assignment" : phase restitution vs phase attribution */
.status-chip--partial_return {
  color: #0b5c52;
  background: #d9f5f2;
  border-color: #8ed9d1;
}

.status-chip--cancelled {
  color: #7f1d1d;
  background: #fde2e2;
  border-color: #efb0b0;
}

.timing-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.timing-chip--ok {
  color: #0a4d28;
  background: #def7e7;
  border-color: #97d8ae;
}

.timing-chip--warning {
  color: #8a4b12;
  background: #ffe7d1;
  border-color: #f3ba87;
}

.timing-chip--late {
  color: #7f1d1d;
  background: #fde2e2;
  border-color: #efb0b0;
}

.timing-chip--neutral {
  color: #475569;
  background: #eef1f4;
  border-color: #cbd5e0;
}

.resource-progress {
  min-width: 150px;
}

.resource-progress__fraction {
  margin-bottom: 0.3rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.resource-progress__track {
  overflow: hidden;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #dfe8ee;
}

.resource-progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f5b8d, #3f88b5);
  transition: width 0.25s ease;
}

/* Etat vide et messages d'absence de donnees */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 0.75rem;
}

.empty-state p {
  max-width: 34rem;
  margin: 0 auto 1.25rem;
  color: var(--muted);
}

/* Apercu flottant au survol d'un statut dans la liste */
/* z-index > .dashboard-nav (99) pour ne pas etre masque par le bandeau sticky quand la ligne survolee est proche du haut */
.status-hover-card {
  position: fixed;
  z-index: 101;
  pointer-events: none;
  width: min(360px, calc(100vw - 2rem));
  padding: 1rem 1.1rem;
  border: 1px solid rgba(15, 91, 141, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 50px rgba(15, 55, 84, 0.18);
  backdrop-filter: blur(10px);
}

.status-hover-card h4 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.status-hover-card ul {
  margin: 0;
  padding-left: 1rem;
}

.status-hover-card li + li {
  margin-top: 0.35rem;
}

.status-hover-card__missing-list li {
  color: #8a5a00;
}

.status-hover-card__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-chip {
  cursor: default;
}

/* Overlay de chargement partage par les pages qui hydrataient des donnees */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(238, 244, 248, 0.82);
  backdrop-filter: blur(8px);
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader__panel {
  width: min(420px, 100%);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid rgba(15, 91, 141, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(15, 55, 84, 0.14);
}

.page-loader__panel p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.page-loader__spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.9rem;
  border: 4px solid #d8e4ec;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: loader-spin 0.8s linear infinite;
}

.branding-save-loader .page-loader__panel {
  width: min(620px, 100%);
  text-align: left;
}

.branding-save-loader__header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.branding-save-loader__header .page-loader__spinner {
  margin: 0 0 0.4rem;
}

.branding-save-loader__list {
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(15, 91, 141, 0.10);
}

.branding-save-loader__item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(15, 91, 141, 0.08);
}

.branding-save-loader__item:last-child {
  border-bottom: 0;
}

.branding-save-loader__bullet {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 0.9rem;
  margin-top: 0.18rem;
  border-radius: 50%;
  border: 2px solid #c6d5df;
  background: #eef4f8;
}

.branding-save-loader__content {
  min-width: 0;
}

.branding-save-loader__label {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.branding-save-loader__state {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.branding-save-loader__item.is-active .branding-save-loader__bullet {
  border-color: var(--brand);
  background: rgba(15, 91, 141, 0.18);
  box-shadow: 0 0 0 6px rgba(15, 91, 141, 0.10);
}

.branding-save-loader__item.is-done .branding-save-loader__bullet {
  border-color: #1f8f59;
  background: #1f8f59;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.branding-save-loader__item.is-error .branding-save-loader__bullet {
  border-color: #b84a4a;
  background: #b84a4a;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.branding-save-loader__item.is-active .branding-save-loader__state {
  color: var(--brand-dark);
  font-weight: 600;
}

.branding-save-loader__item.is-done .branding-save-loader__state {
  color: #1f8f59;
}

.branding-save-loader__item.is-error .branding-save-loader__state {
  color: #b84a4a;
  font-weight: 600;
}

.branding-save-loader__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

.workflow-dialog {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.workflow-dialog.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.workflow-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 40, 0.55);
  backdrop-filter: blur(6px);
}

.workflow-dialog__panel {
  position: relative;
  width: min(100%, 38rem);
  max-height: min(90vh, 640px);
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  border: 1px solid rgba(212, 221, 230, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 56px rgba(15, 55, 84, 0.22);
}

.workflow-dialog__header {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  flex-shrink: 0;
}

.workflow-dialog__header p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.workflow-dialog__spinner {
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 2.6rem;
  border: 4px solid #d8e4ec;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: loader-spin 0.8s linear infinite;
}

.workflow-dialog__list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(15, 91, 141, 0.10);
  /* Beaucoup de ressources incompletes (ex: "Attribution partielle") rendent cette liste tres longue : elle
     defile seule, le bouton OK (hors de ce bloc) reste toujours visible. min-height:0 est indispensable, sinon
     un enfant flex ne peut jamais se restreindre sous la hauteur de son contenu et ne defile pas. */
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.workflow-dialog__item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(15, 91, 141, 0.08);
}

.workflow-dialog__item:last-child {
  border-bottom: 0;
}

.workflow-dialog__bullet {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 0.9rem;
  margin-top: 0.18rem;
  border-radius: 50%;
  border: 2px solid #c6d5df;
  background: #eef4f8;
}

.workflow-dialog__content {
  min-width: 0;
}

.workflow-dialog__label {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.workflow-dialog__state {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.workflow-dialog__item.is-active .workflow-dialog__bullet {
  border-color: var(--brand);
  background: rgba(15, 91, 141, 0.18);
  box-shadow: 0 0 0 6px rgba(15, 91, 141, 0.10);
}

.workflow-dialog__item.is-done .workflow-dialog__bullet {
  border-color: #1f8f59;
  background: #1f8f59;
  box-shadow: inset 0 0 0 2px #ffffff;
}

/* Ambre plutot que rouge : ce statut signale une ressource pas encore completement renseignee, jamais un
   blocage reel (le dossier reste modifiable) - voir getWorkflowStepStateLabel, ui.js. */
.workflow-dialog__item.is-error .workflow-dialog__bullet {
  border-color: #c89e30;
  background: #f1d48b;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.workflow-dialog__item.is-active .workflow-dialog__state {
  color: var(--brand-dark);
  font-weight: 600;
}

.workflow-dialog__item.is-done .workflow-dialog__state {
  color: #1f8f59;
}

.workflow-dialog__item.is-error .workflow-dialog__state {
  color: #8a4b12;
  font-weight: 600;
}

.workflow-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  flex-shrink: 0;
}

.signature-validity-dialog__panel {
  width: min(100%, 31rem);
}

.signature-validity-dialog__body {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15, 91, 141, 0.10);
}

.signature-validity-dialog__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.signature-validity-dialog__row .form-control {
  width: 7rem;
}

.signature-validity-dialog__suffix {
  color: var(--muted);
  font-weight: 600;
}

.signature-validity-dialog__hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.signature-validity-dialog__error {
  margin: 0.6rem 0 0;
  color: #b84a4a;
  font-size: 0.92rem;
  font-weight: 600;
}

/* ── Toasts ──────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(24rem, calc(100vw - 2.5rem));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text);
  animation: toast-in 0.22s ease;
}

.toast.is-dismissing {
  animation: toast-out 0.25s ease forwards;
}

.toast--success { border-left-color: #1f8f59; }
.toast--error   { border-left-color: #c0392b; }
.toast--warning { border-left-color: var(--accent); }
.toast--info    { border-left-color: var(--brand); }

.toast__icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
  font-style: normal;
}

.toast--success .toast__icon { color: #1f8f59; }
.toast--error   .toast__icon { color: #c0392b; }
.toast--warning .toast__icon { color: var(--accent); }
.toast--info    .toast__icon { color: var(--brand); }

.toast__msg { flex: 1; }

.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.toast__close:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(0.75rem); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); max-height: 6rem; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(0.75rem); max-height: 0; margin-bottom: -0.5rem; }
}

[data-color-mode="dark"] .toast {
  background: #1e2d3d;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e8f0f7;
}

/* ─────────────────────────────────────────────────────────────────────── */

.completion-celebration {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
  overflow: hidden;
}

.completion-celebration__piece {
  position: absolute;
  top: -10vh;
  width: 0.7rem;
  height: 1.1rem;
  border-radius: 0.2rem;
  opacity: 0.96;
  animation: confetti-fall linear forwards;
}

.boat-departure {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2rem;
  height: 8rem;
}

.boat-departure__waves {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 1.6rem;
  background:
    radial-gradient(circle at 1rem 1.1rem, rgba(100, 167, 217, 0) 0.75rem, rgba(100, 167, 217, 0.82) 0.78rem, rgba(100, 167, 217, 0.82) 1rem, rgba(100, 167, 217, 0) 1.03rem) 0 0 / 3rem 100% repeat-x;
  opacity: 0.92;
}

.boat-departure__boat {
  position: absolute;
  left: -8rem;
  bottom: 1.2rem;
  width: 8.5rem;
  height: 4.4rem;
  animation: boat-departure 2.6s ease-in forwards;
}

.boat-departure__flag {
  position: absolute;
  right: 1.8rem;
  top: 0.1rem;
  width: 0.85rem;
  height: 1.35rem;
  border-left: 2px solid #0f5b8d;
}

.boat-departure__flag::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.1rem;
  width: 0;
  height: 0;
  border-top: 0.32rem solid transparent;
  border-bottom: 0.32rem solid transparent;
  border-left: 0.65rem solid #d9a441;
}

.boat-departure__cabin {
  position: absolute;
  right: 1.6rem;
  bottom: 1.35rem;
  width: 2rem;
  height: 1.3rem;
  border-radius: 0.3rem 0.3rem 0.1rem 0.1rem;
  background: #f9fbfd;
  border: 2px solid #0f5b8d;
}

.boat-departure__hull {
  position: absolute;
  left: 0.8rem;
  right: 0.2rem;
  bottom: 0.5rem;
  height: 1.55rem;
  background: linear-gradient(180deg, #1c5884, #0f3f63);
  clip-path: polygon(4% 18%, 100% 18%, 82% 100%, 14% 100%);
  border-radius: 0.25rem;
  box-shadow: 0 14px 28px rgba(15, 55, 84, 0.18);
}

.export-progress {
  margin-top: 1rem;
}

.export-progress__track {
  overflow: hidden;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dfe8ee;
}

.export-progress__bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f5b8d, #3f88b5);
  transition: width 0.2s ease;
}

.export-progress__value {
  margin-top: 0.55rem;
  color: var(--brand-dark);
  font-weight: 700;
}

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

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translate3d(1.5rem, 105vh, 0) rotate(420deg);
    opacity: 0;
  }
}

@keyframes boat-departure {
  0% {
    transform: translateX(0) translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    transform: translateX(calc(50vw - 4rem)) translateY(-0.2rem) rotate(-1.2deg);
  }
  100% {
    transform: translateX(calc(100vw + 8rem)) translateY(-0.45rem) rotate(1deg);
    opacity: 0;
  }
}

.print-summary {
  display: none;
}

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

.print-line strong {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  color: #6b7280;
}

.print-line span {
  display: block;
  margin-top: 0.15rem;
}

.print-list {
  margin: 0;
  padding-left: 1.1rem;
}

.print-list li + li {
  margin-top: 0.4rem;
}

@media (max-width: 991.98px) {
  .app-header__inner,
  .hero-panel,
  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-panel__meta {
    justify-content: flex-start;
    flex-direction: column;
  }

  .hero-panel__stats {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-panel__actions {
    width: 100%;
  }

  .hero-panel__actions .btn {
    width: 100%;
  }

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

  .documents-layout {
    grid-template-columns: 1fr;
  }

  .restitution-row {
    grid-template-columns: 1fr;
  }

  .filter-toolbar {
    gap: 0.85rem;
  }

  .filter-toolbar__filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-toolbar__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-brand-panel,
  .login-form-panel {
    padding: 1.25rem;
  }
}

@media (max-width: 767.98px) {
  .content-card,
  .hero-panel {
    padding: 1.15rem;
  }

  .hero-panel__stats {
    grid-template-columns: 1fr;
  }

  .product-hero-card--about {
    width: 100%;
  }

  .app-header--compact {
    position: static;
  }

  .app-header__inner {
    gap: 1rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .draft-actions {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .draft-actions__primary {
    flex-direction: column;
    width: 100%;
  }

  .draft-actions .btn {
    width: 100%;
  }

  .draft-actions__menu {
    width: 100%;
    align-self: stretch;
  }

  .draft-actions__menu-panel {
    width: 100%;
    margin-top: 0.5rem;
    box-shadow: none;
  }

  .draft-actions__menu-section + .draft-actions__menu-section {
    padding-top: 0.5rem;
  }

  /* Dropdowns flottants (position:absolute right:0) : éviter le débordement viewport */
  .user-menu__panel,
  .export-menu__panel,
  .filter-menu__panel {
    right: auto;
    left: 0;
    width: calc(100vw - 1.5rem);
    max-width: 320px;
    min-width: 0;
  }

  .filter-menu__grid {
    grid-template-columns: 1fr;
  }

  .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-toolbar__actions {
    justify-content: stretch;
  }

  .dashboard-toolbar__actions .btn {
    width: 100%;
  }

  .app-footer__grid {
    grid-template-columns: 1fr;
  }

  .app-footer__bottom,
  .app-footer__identity,
  .app-footer__contact {
    align-items: flex-start;
  }

  .app-brand {
    align-items: flex-start;
  }

  .app-logo {
    max-width: min(100%, 140px);
    max-height: 56px;
  }

  .app-footer__org-logo {
    max-width: 52px;
    max-height: 52px;
  }

  .app-title {
    font-size: clamp(1.25rem, 7vw, 1.8rem);
  }

  .app-subtitle {
    margin-top: 0.25rem;
    font-size: 0.9rem;
  }

  .filter-toolbar__grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-nav__link {
    padding: 0.85rem 0.9rem;
  }

.table-responsive {
    overflow-x: visible;
  }

  .draft-table,
  .draft-table tbody,
  .draft-table tr,
  .draft-table td {
    display: block;
    width: 100%;
  }

  .draft-table thead {
    display: none;
  }

  .draft-table tbody {
    display: grid;
    gap: 0.9rem;
  }

  .dashboard-group {
    padding: 0.9rem;
  }

  .draft-row {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    box-shadow: 0 10px 24px rgba(15, 55, 84, 0.06);
  }

  .draft-table td {
    padding: 0;
    border: 0;
  }

  .draft-table td + td {
    margin-top: 0.8rem;
  }

  .draft-check-col {
    width: auto;
    text-align: left;
  }

  .draft-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .draft-actions-cell::before {
    margin-bottom: 0.55rem;
  }

  .back-to-top {
    left: 50%;
    right: auto;
    bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
    transform: translate(-50%, 8px);
  }

  .back-to-top.is-visible {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 768px) {
  .resource-order-group__header {
    flex-direction: column;
  }

  .resource-order-item {
    grid-template-columns: auto 1fr;
  }

  .resource-order-item__handle,
  .resource-order-item__position {
    grid-row: span 2;
  }

  .resource-order-item__status {
    grid-column: 2;
    justify-self: start;
  }
}

/* ========================================================================
   Mode sombre — surcharges des couleurs codees en dur
   Les variables CSS (--brand, --surface, --text, etc.) sont deja remplacees
   par branding.js. Ce bloc corrige les backgrounds, couleurs et bordures
   ecrites en valeurs fixes dans le reste du fichier.
   ======================================================================== */

[data-color-mode="dark"] body.app-shell {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28%),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 40%, var(--surface) 100%);
}

[data-color-mode="dark"] body.login-shell {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 24%, transparent), transparent 24%),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--brand) 18%, transparent), transparent 26%),
    linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 45%, var(--surface) 100%);
}

/* Logos — fond adapte */
[data-color-mode="dark"] .app-logo {
  background: rgba(255, 255, 255, 0.12);
}

[data-color-mode="dark"] .app-footer__org-logo {
  background: rgba(255, 255, 255, 0.12);
}

/* Contenants principaux */
[data-color-mode="dark"] .hero-panel,
[data-color-mode="dark"] .content-card {
  background: color-mix(in srgb, var(--surface-alt) 90%, transparent);
  border-color: var(--border);
}

[data-color-mode="dark"] .login-card {
  background: color-mix(in srgb, var(--surface-alt) 95%, transparent);
  border-color: var(--border);
}

[data-color-mode="dark"] .product-hero-card {
  background: var(--surface-alt);
  border-color: var(--border);
}

/* Cartes, panneaux et zones de contenu */
[data-color-mode="dark"] .stat-card,
[data-color-mode="dark"] .status-pill {
  background: var(--surface);
  border-color: var(--border);
}

/* Filtres et toolbar */
[data-color-mode="dark"] .filter-toolbar {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .filter-menu__panel {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .filter-menu__badge {
  background: var(--brand-dark);
  color: #fff;
}

[data-color-mode="dark"] .equipment-toggle {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .choice-chip span {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .choice-chip input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Panneau action-bar */
[data-color-mode="dark"] .action-bar {
  background: color-mix(in srgb, var(--surface-alt) 96%, transparent);
  border-color: var(--border);
}

/* Dashboard */
[data-color-mode="dark"] .dashboard-update-notice {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-color-mode="dark"] .dashboard-pending-badge {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
}

[data-color-mode="dark"] .dashboard-nav__link {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[data-color-mode="dark"] .dashboard-nav__link:hover,
[data-color-mode="dark"] .dashboard-nav__link:focus-visible {
  background: var(--surface-alt);
  border-color: var(--brand);
}

[data-color-mode="dark"] .dashboard-nav__link.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

/* Menu dossier */
[data-color-mode="dark"] .draft-actions__menu-panel {
  background: var(--surface);
  border-color: var(--border);
}

/* Hover cards */
[data-color-mode="dark"] .status-hover-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Resource order */
[data-color-mode="dark"] .resource-order-group {
  background: var(--surface-alt);
  border-color: var(--border);
}

[data-color-mode="dark"] .resource-order-item {
  background: var(--surface);
  border-color: var(--border);
}

/* Equipement items */
[data-color-mode="dark"] .equipment-item {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .equipment-item.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

[data-color-mode="dark"] .equipment-toggle:has(input:checked) {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}

[data-color-mode="dark"] .equipment-item__body {
  border-top-color: var(--border);
}

/* Resource progress */
[data-color-mode="dark"] .resource-progress__track {
  background: var(--border);
}

/* Login */
[data-color-mode="dark"] .login-lead {
  color: var(--muted);
}

[data-color-mode="dark"] .login-footnote__title {
  color: var(--text);
}

/* Password generator / help modal */
[data-color-mode="dark"] .password-generator-modal__dialog {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .password-generator-modal__result {
  background: var(--surface-alt);
  border-color: var(--border);
}

/* Workflow dialog */
[data-color-mode="dark"] .workflow-dialog__backdrop,
[data-color-mode="dark"] .password-generator-modal__backdrop {
  background: rgba(0, 0, 0, 0.65);
}

[data-color-mode="dark"] .workflow-dialog__panel {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .workflow-dialog__item {
  border-color: var(--border);
}

[data-color-mode="dark"] .workflow-dialog__item.is-active .workflow-dialog__state {
  color: var(--brand);
}

[data-color-mode="dark"] .workflow-dialog__item.is-error .workflow-dialog__bullet {
  border-color: #c89e30;
  background: color-mix(in srgb, #694b00 60%, #f1d48b);
}

[data-color-mode="dark"] .workflow-dialog__item.is-error .workflow-dialog__state {
  color: #e8a060;
}

[data-color-mode="dark"] .workflow-dialog__item.is-done .workflow-dialog__state {
  color: #6bc990;
}

[data-color-mode="dark"] .workflow-dialog__item.is-error .workflow-dialog__state {
  color: #e88080;
}

/* Branding save loader */
[data-color-mode="dark"] .branding-save-loader__item.is-active .branding-save-loader__state {
  color: var(--brand);
}

[data-color-mode="dark"] .branding-save-loader__item.is-done .branding-save-loader__state {
  color: #6bc990;
}

[data-color-mode="dark"] .branding-save-loader__item.is-error .branding-save-loader__state {
  color: #e88080;
}

/* Couleurs texte fixes */
[data-color-mode="dark"] .panel-title,
[data-color-mode="dark"] .section-title {
  color: var(--text);
}

[data-color-mode="dark"] .resource-kind-block__title,
[data-color-mode="dark"] .resource-progress__fraction {
  color: var(--text);
}

[data-color-mode="dark"] .draft-title {
  color: var(--text);
}

[data-color-mode="dark"] .user-menu__item--danger:hover,
[data-color-mode="dark"] .user-menu__item--danger:focus {
  color: #e88080;
}

[data-color-mode="dark"] .draft-unc-badge {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}

[data-color-mode="dark"] .app-footer__heading,
[data-color-mode="dark"] .app-footer__app {
  color: var(--text);
}

/* Bouton retour en haut */
[data-color-mode="dark"] .back-to-top {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Export progress */
[data-color-mode="dark"] .export-progress__value {
  color: var(--text);
}

/* Admin layout */
[data-color-mode="dark"] .admin-nav__link {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-alt);  /* le fond clair par défaut rendait le titre (clair) illisible */
}

[data-color-mode="dark"] .admin-nav__link:hover,
[data-color-mode="dark"] .admin-nav__link.is-active {
  background: var(--surface-alt);
  border-color: var(--brand);
}

/* Tables (mode mobile card) */
[data-color-mode="dark"] .draft-row {
  background: var(--surface);
  border-color: var(--border);
}

/* Form controls Bootstrap override */
[data-color-mode="dark"] .form-control,
[data-color-mode="dark"] .form-select {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[data-color-mode="dark"] .form-control:focus,
[data-color-mode="dark"] .form-select:focus {
  background-color: var(--surface);
  border-color: var(--brand);
  color: var(--text);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--brand) 25%, transparent);
}

[data-color-mode="dark"] .form-check-input {
  background-color: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .form-label {
  color: var(--text);
}

/* Cookie consent */
[data-color-mode="dark"] #cc-main {
  --cc-bg: var(--surface);
  --cc-primary-color: var(--text);
  --cc-secondary-color: var(--muted);
}

/* Status chips (avancement) */
[data-color-mode="dark"] .status-chip--draft {
  color: #f0c94d;
  background: color-mix(in srgb, #694b00 30%, var(--surface));
  border-color: color-mix(in srgb, #c89e30 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--active {
  color: #6bc990;
  background: color-mix(in srgb, #0a4d28 30%, var(--surface));
  border-color: color-mix(in srgb, #2d8a56 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--partial_assignment {
  color: #e8a060;
  background: color-mix(in srgb, #8a4b12 25%, var(--surface));
  border-color: color-mix(in srgb, #c87830 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--partial_return {
  color: #5fd1c0;
  background: color-mix(in srgb, #0b5c52 28%, var(--surface));
  border-color: color-mix(in srgb, #1f9484 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--awaiting_signature {
  color: #c9a6f0;
  background: color-mix(in srgb, #4a2382 28%, var(--surface));
  border-color: color-mix(in srgb, #7c4bc4 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--returned {
  color: #7ab8e8;
  background: color-mix(in srgb, #18436d 28%, var(--surface));
  border-color: color-mix(in srgb, #3a80b8 40%, var(--border));
}

[data-color-mode="dark"] .status-chip--cancelled {
  color: #e88080;
  background: color-mix(in srgb, #7f1d1d 25%, var(--surface));
  border-color: color-mix(in srgb, #b84a4a 40%, var(--border));
}

/* Timing chips (pilotage) */
[data-color-mode="dark"] .timing-chip--ok {
  color: #6bc990;
  background: color-mix(in srgb, #0a4d28 30%, var(--surface));
  border-color: color-mix(in srgb, #2d8a56 40%, var(--border));
}

[data-color-mode="dark"] .timing-chip--warning {
  color: #e8a060;
  background: color-mix(in srgb, #8a4b12 25%, var(--surface));
  border-color: color-mix(in srgb, #c87830 40%, var(--border));
}

[data-color-mode="dark"] .timing-chip--late {
  color: #e88080;
  background: color-mix(in srgb, #7f1d1d 25%, var(--surface));
  border-color: color-mix(in srgb, #b84a4a 40%, var(--border));
}

[data-color-mode="dark"] .timing-chip--neutral {
  color: var(--muted);
  background: var(--surface-alt);
  border-color: var(--border);
}

/* Progress bars */
[data-color-mode="dark"] .resource-progress__bar {
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

[data-color-mode="dark"] .export-progress__track {
  background: var(--border);
}

[data-color-mode="dark"] .export-progress__bar {
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

/* Dashboard group */
[data-color-mode="dark"] .dashboard-group {
  background: color-mix(in srgb, var(--surface-alt) 85%, transparent);
  border-color: var(--border);
}

[data-color-mode="dark"] .dashboard-group__badge {
  background: color-mix(in srgb, var(--brand) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  color: var(--brand);
}

/* Resource & restitution rows */
[data-color-mode="dark"] .resource-field-row,
[data-color-mode="dark"] .restitution-row {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .resource-field-row--hidden {
  background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-alt) 10px, var(--surface-alt) 20px);
}

[data-color-mode="dark"] .resource-field-hidden-banner .status-pill {
  background: color-mix(in srgb, #d6a340 22%, var(--surface));
  color: #e8a060;
}

/* Signature, RGPD, status cards */
[data-color-mode="dark"] .signature-wrap {
  background: var(--surface-alt);
  border-color: var(--border);
}

[data-color-mode="dark"] .signature-box {
  background: var(--surface);
}

[data-color-mode="dark"] .rgpd-card {
  background: color-mix(in srgb, #694b00 12%, var(--surface));
  border-color: color-mix(in srgb, #c89e30 25%, var(--border));
}

[data-color-mode="dark"] .rgpd-card__title {
  color: var(--text);
}

[data-color-mode="dark"] .status-card {
  background: var(--surface);
  border-color: var(--border);
}

/* Footer */
[data-color-mode="dark"] .app-footer {
  background: color-mix(in srgb, var(--surface-alt) 92%, transparent);
  border-color: var(--border);
}

/* Page loader */
[data-color-mode="dark"] .page-loader {
  background: rgba(0, 0, 0, 0.55);
}

[data-color-mode="dark"] .page-loader__panel {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[data-color-mode="dark"] .page-loader__spinner {
  border-color: var(--border);
  border-top-color: var(--brand);
}

/* Status hover card */
[data-color-mode="dark"] .status-hover-card h4 {
  color: var(--brand);
}

[data-color-mode="dark"] .status-hover-card__missing-list li {
  color: #e8a060;
}

/* Admin nav & inner card */
[data-color-mode="dark"] .admin-nav__link span {
  color: var(--text);
}

[data-color-mode="dark"] .admin-inner-card {
  background: var(--surface);
}

[data-color-mode="dark"] .progress-required-field {
  border-color: #c89e30 !important;
  box-shadow: 0 0 0 0.18rem rgba(200, 158, 48, 0.18);
  background: color-mix(in srgb, #694b00 10%, var(--surface));
}

[data-color-mode="dark"] .progress-required-surface {
  border-color: #c89e30 !important;
  box-shadow: 0 0 0 0.18rem rgba(200, 158, 48, 0.12);
}

[data-color-mode="dark"] .progress-required-badge {
  background: rgba(200, 158, 48, 0.18);
  color: #f0c94d;
}

/* Branding save loader */
[data-color-mode="dark"] .branding-save-loader__bullet {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .branding-save-loader__list {
  border-color: var(--border);
}

[data-color-mode="dark"] .branding-save-loader__item {
  border-color: var(--border);
}

/* Bootstrap form-check-input — checked state */
[data-color-mode="dark"] .form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

/* Export menu */
[data-color-mode="dark"] .export-menu__panel {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .export-menu__item {
  color: var(--text);
}

[data-color-mode="dark"] .export-menu__item:hover {
  background: var(--surface-alt);
  color: var(--brand);
}

/* Table overrides */
[data-color-mode="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  color: var(--text);
}

[data-color-mode="dark"] .table thead th {
  color: var(--muted);
  border-color: var(--border);
}

[data-color-mode="dark"] .table td {
  border-color: var(--border);
}

/* Misc text colors */
[data-color-mode="dark"] .panel-text,
[data-color-mode="dark"] .panel-eyebrow {
  color: var(--muted);
}

/* btn-outline-secondary on dark surfaces */
[data-color-mode="dark"] .btn-outline-secondary {
  color: var(--text);
  border-color: var(--border);
}

[data-color-mode="dark"] .btn-outline-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--brand);
  color: var(--text);
}

/* Confetti / animations — pas de changement */

@media print {
  @page {
    margin: 12mm;
  }

  body.app-shell {
    background: #fff;
  }

  .app-header {
    display: none !important;
  }

  .app-footer {
    display: none !important;
  }

  .app-kicker,
  .app-subtitle,
  .panel-eyebrow,
  .action-bar,
  .no-print,
  #dotationForm {
    display: none !important;
  }

  .print-summary {
    display: block !important;
  }

  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }
}

/* ============================================================
   Bannière setup initial
   ============================================================ */
.setup-banner {
  background: #7c3aed;
  color: #fff;
  padding: .6rem 0;
  position: sticky;
  top: 0;
  z-index: 1040;
}

.setup-banner__inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.setup-banner__text {
  flex: 1;
  font-size: .875rem;
}

.setup-banner__link {
  white-space: nowrap;
  font-size: .8rem;
  padding: .2rem .65rem;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}

.setup-banner__link:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
}

.setup-banner__dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 .25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.setup-banner__dismiss:hover {
  color: #fff;
}

[data-color-mode="dark"] .setup-banner {
  background: #5b21b6;
}

/* ============================================================
   Setup wizard
   ============================================================ */
.setup-shell {
  min-height: 100vh;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
}

.setup-header {
  background: var(--brand);
  color: #fff;
  padding: 1.25rem 0;
}

.setup-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.setup-header__logo {
  height: 2.5rem;
  width: auto;
}

.setup-header__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.setup-header__sub {
  font-size: .8rem;
  opacity: .85;
  margin: 0;
}

.setup-main {
  flex: 1;
  padding: 2rem 0 4rem;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 2rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Stepper */
.setup-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}

.setup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 60px;
  position: relative;
}

.setup-step + .setup-step::before {
  content: "";
  position: absolute;
  top: 1rem;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.setup-step.is-done + .setup-step::before,
.setup-step.is-active + .setup-step::before {
  background: var(--brand);
}

.setup-step__dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: background .2s, border-color .2s, color .2s;
}

.setup-step.is-active .setup-step__dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.setup-step.is-done .setup-step__dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.setup-step__label {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .35rem;
  text-align: center;
  line-height: 1.2;
}

.setup-step.is-active .setup-step__label {
  color: var(--brand);
  font-weight: 600;
}

/* Panels */
.setup-panel {
  animation: fadeInPanel .18s ease;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.setup-panel__eyebrow {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  margin-bottom: .25rem;
}

.setup-panel__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .35rem;
}

.setup-panel__desc {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

/* Nav buttons */
.setup-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.setup-nav__right {
  display: flex;
  gap: .5rem;
}

/* Récap */
.setup-recap__row {
  display: flex;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}

.setup-recap__label {
  width: 11rem;
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 500;
}

.setup-recap__value {
  color: var(--text);
  word-break: break-word;
}

/* Preset chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .5rem;
}

.preset-chip {
  padding: .3rem .75rem;
  border-radius: 2rem;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: .82rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.preset-chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* Dark mode */
[data-color-mode="dark"] .setup-card {
  background: var(--surface);
  border-color: var(--border);
}

[data-color-mode="dark"] .setup-step__dot {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--muted);
}

[data-color-mode="dark"] .preset-chip {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

/* ── Panneau d'aperçu rapide (slide-in depuis la droite) ─────────────────── */

.quick-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(10, 30, 50, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.quick-panel-overlay--open {
  opacity: 1;
  pointer-events: auto;
}

.quick-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(420px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(15, 55, 84, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.32, 0, 0.18, 1);
  overflow-y: auto;
}

.quick-panel--open {
  transform: translateX(0);
}

.quick-panel__header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.quick-panel__close {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  line-height: 1;
  transition: background 120ms;
}

.quick-panel__close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.quick-panel__identity {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.quick-panel__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.quick-panel__meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.quick-panel__status {
  align-self: flex-start;
}

.quick-panel__body {
  flex: 1;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quick-panel__start {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.quick-panel__section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.quick-panel__section-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.quick-panel__resource-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.quick-panel__resource-item {
  font-size: 0.9rem;
  color: var(--text);
}

.quick-panel__resource-item code {
  font-size: 0.82rem;
  background: var(--surface-alt);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  word-break: break-all;
}

.quick-panel__progress {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quick-panel__progress-label {
  font-size: 0.88rem;
  color: var(--text);
}

.quick-panel__progress-track {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.quick-panel__progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width 300ms ease;
}

.quick-panel__actions {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.quick-panel__btn {
  flex: 1;
  text-align: center;
  min-width: 120px;
}

.quick-panel__loading,
.quick-panel__error {
  padding: 2rem 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

/* Curseur sur les lignes clickables */
[data-quick-preview-id] {
  cursor: pointer;
}

[data-quick-preview-id]:hover td {
  background: color-mix(in srgb, var(--brand-soft) 30%, var(--surface-alt));
}

/* Dark mode */
[data-color-mode="dark"] .quick-panel {
  background: var(--surface);
  border-left-color: var(--border);
}

[data-color-mode="dark"] .quick-panel__header {
  background: var(--surface);
}

[data-color-mode="dark"] .quick-panel__resource-item code {
  background: var(--surface-alt);
}

[data-color-mode="dark"] .quick-panel-overlay {
  background: rgba(0, 0, 0, 0.45);
}

/* Recherche globale (command palette Ctrl+K) */
.global-search {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
}
.global-search.d-none { display: none; }

.global-search__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 55, 84, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.global-search__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(15, 55, 84, 0.28);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.global-search__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.global-search__icon {
  font-size: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.global-search__input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: var(--text);
  padding: 4px 0;
}
.global-search__input::placeholder { color: var(--muted); }

.global-search__esc {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-alt) !important;
  color: var(--muted) !important;
  border: 1px solid var(--border);
  font-family: var(--font-ui);
}

.global-search__results {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;  /* les filtres ne doivent pas écraser la liste des pages et actions */
}

.global-search__result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background-color 0.1s ease;
}
.global-search__result.is-active,
.global-search__result:hover {
  background: var(--brand-soft);
}

.global-search__result-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.global-search__result-name {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search__result-service {
  font-size: 12px;
  color: var(--muted);
}

.global-search__result-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--brand-dark);
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}

.global-search__empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.global-search__empty--error { color: #b91c1c; }

.global-search__footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 11px;
  color: var(--muted);
}
.global-search__footer kbd {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  font-size: 10px;
  border-radius: 4px;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  font-family: var(--font-ui);
}

.global-search__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.global-search__trigger-icon { font-size: 14px; }
.global-search__trigger-kbd {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-family: var(--font-ui);
}

.global-search__filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.global-search__filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.global-search__filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.global-search__filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.global-search__filter-chip {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.global-search__filter-chip:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.global-search__filter-chip.is-active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-dark);
}

@media (max-width: 640px) {
  .global-search { padding: 6vh 8px 8px; }
  .global-search__trigger-label,
  .global-search__trigger-kbd { display: none; }
}

body.global-search-open { overflow: hidden; }

[data-color-mode="dark"] .global-search__panel {
  background: #1b2633;
  border-color: #2d3b4d;
}
[data-color-mode="dark"] .global-search__header,
[data-color-mode="dark"] .global-search__footer {
  border-color: #2d3b4d;
}
[data-color-mode="dark"] .global-search__footer { background: #141d27; }
[data-color-mode="dark"] .global-search__input { color: #e6edf3; }
[data-color-mode="dark"] .global-search__result.is-active,
[data-color-mode="dark"] .global-search__result:hover {
  background: rgba(15, 91, 141, 0.35);
}
[data-color-mode="dark"] .global-search__result-name { color: #e6edf3; }
[data-color-mode="dark"] .global-search__result-status {
  background: #141d27;
  color: #8fb4d6;
  border-color: #2d3b4d;
}
[data-color-mode="dark"] .global-search__esc,
[data-color-mode="dark"] .global-search__footer kbd {
  background: #141d27 !important;
  color: #e6edf3 !important;
  border-color: #2d3b4d;
}

/* Champs verrouillés depuis le dossier source (mise_à_jour) */
input[data-locked-from-source],
select[data-locked-from-source] {
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
  border-color: #dee2e6;
  opacity: 0.9;
}

input[readonly][data-locked-from-source]::placeholder {
  color: #adb5bd;
}

input[data-locked-from-source]:focus,
select[data-locked-from-source]:focus {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  box-shadow: none;
  outline: 2px solid var(--border);
  outline-offset: 1px;
}

[data-color-mode="dark"] input[data-locked-from-source],
[data-color-mode="dark"] select[data-locked-from-source] {
  background-color: var(--surface-alt);
  color: var(--muted);
  border-color: var(--border);
}

[data-color-mode="dark"] input[data-locked-from-source]:focus,
[data-color-mode="dark"] select[data-locked-from-source]:focus {
  background-color: var(--surface-alt);
  border-color: var(--border);
}

/* Badge visuel pour indiquer les champs verrouillés */
.section-personne [data-locked-from-source]::after {
  content: " 🔒";
  font-size: 0.75rem;
}

/* Header sticky avec navigation */
main {
  padding-top: 1rem;
}

/* Header Action Button (dans le header sticky) */
.header-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-action-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 300;
}

.header-action-btn__text {
  display: inline;
}

/* Mobile: icône seul */
@media (max-width: 576px) {
  .header-action-btn {
    padding: 0.5rem;
    width: 42px;
    height: 42px;
    justify-content: center;
  }

  .header-action-btn__text {
    display: none;
  }
}

/* ── Écran de confirmation de signature ───────────────────────────────────── */

.sig-success {
  text-align: center;
  padding: 3rem 2rem 2.5rem;
}

.sig-success__icon-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto 1.75rem;
  background: #def7e7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sig-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes sig-pop {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sig-success__check {
  stroke-dasharray: 52;
  stroke-dashoffset: 52;
  animation: sig-draw 0.4s 0.35s ease forwards;
}

@keyframes sig-draw {
  to { stroke-dashoffset: 0; }
}

.sig-success__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.sig-success__subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

.sig-success__summary {
  display: inline-flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 2rem;
  margin-bottom: 2rem;
  text-align: left;
  min-width: 260px;
}

.sig-success__summary-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sig-success__summary-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sig-success__summary-value {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.sig-success__decision-confirmed {
  color: #0a4d28;
  background: #def7e7;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.sig-success__decision-reservation {
  color: #8a4b12;
  background: #ffe7d1;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.sig-success__close {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* Bouton en état chargement */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: loader-spin 0.7s linear infinite;
}

[data-color-mode="dark"] .sig-success__icon-wrap {
  background: #0a4d2840;
}

[data-color-mode="dark"] .sig-success__summary {
  background: var(--surface-alt);
}

[data-color-mode="dark"] .sig-success__decision-confirmed {
  color: #6bc990;
  background: color-mix(in srgb, #0a4d28 25%, var(--surface));
}

[data-color-mode="dark"] .sig-success__decision-reservation {
  color: #e8a060;
  background: color-mix(in srgb, #8a4b12 25%, var(--surface));
}


/* Fil d'Ariane et indicateur des parties de la restitution */
.restitution-steps {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.restitution-steps__crumb {
  color: var(--muted);
  font-size: 0.9rem;
}

.restitution-steps__list {
  display: flex;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.restitution-steps__item > a,
.restitution-steps__item > span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.restitution-steps__item.is-current > span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.restitution-steps__num {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(15, 55, 84, 0.12);
  font-size: 0.85rem;
}

.restitution-steps__item.is-current .restitution-steps__num {
  background: rgba(255, 255, 255, 0.25);
}


/* Listes d'administration : action principale et menu "Plus" sur une seule ligne. */
.draft-table td.text-end > .draft-actions {
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
}


/* Ecrans tactiles : cibles d'au moins 44 px (boutons de ligne, menus, filtres). */
@media (pointer: coarse) {
  .btn,
  .btn-sm,
  .dashboard-nav__link,
  .user-menu__item,
  .draft-actions__menu summary,
  .filter-chip,
  .form-select,
  .form-control {
    min-height: 44px;
  }

  .draft-select,
  .form-check-input {
    width: 1.35rem;
    height: 1.35rem;
  }
}


/* Entree de menu d'une fonctionnalite dediee (ex. Base de donnees) : separee visuellement. */
.user-menu__item--feature {
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.user-menu__item--feature[aria-current="page"] {
  color: var(--brand);
}

form section.content-card[id^="db-"],
section.content-card[id^="db-"] {
  scroll-margin-top: 9rem;
}

/* Bandeaux d'alerte de l'accueil admin : aucun espace reserve quand ils sont tous masques. */
.admin-alerts:not(:has(.alert:not(.d-none))) {
  display: none !important;
}

/* Champs en lecture seule (identifiant, nom et prenom verrouilles) : visibles comme non modifiables. */
.form-control[readonly] {
  background-color: color-mix(in srgb, var(--border) 35%, var(--surface));
  cursor: not-allowed;
}


/* Assistant de creation de ressource : fenetre large, apercu a droite. */
.password-generator-modal__dialog.wizard-dialog {
  width: min(100%, 64rem);
  max-height: min(92vh, 48rem);
}

.wizard-preview {
  position: sticky;
  top: 0;
  background: var(--surface-alt, #f8fafc);
}


/* Tableau de bord : jamais de defilement horizontal.
   - le bloc parent peut retrecir (sinon il impose la largeur minimale du tableau et la PAGE defile) ;
   - en-tetes, pastilles et boutons peuvent passer a la ligne ;
   - entre 1024 et 1199 px, marges resserrees et colonnes « secondaires » masquees (voir DASHBOARD_COLUMNS, storage.js) ;
   - sous 1024 px, la presentation en cartes prend le relais (mobile : sous 768 px, regles existantes). */
.dashboard-group {
  min-width: 0;
}

.draft-table th[data-sort-field] {
  white-space: normal;
}

.draft-table .status-chip {
  white-space: normal;
}

.draft-table .draft-actions,
.draft-table .draft-actions__primary {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.draft-table .draft-actions .btn {
  white-space: normal;
}

.draft-table .draft-actions-cell {
  min-width: 0;
}

.draft-table .resource-progress {
  min-width: 100px;
}

/* 1024-1199 px : marges resserrees et colonnes « secondaires » masquees. */
@media (min-width: 1024px) and (max-width: 1199.98px) {
  .draft-table > :not(caption) > * > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .draft-table th {
    letter-spacing: 0.03em;
  }

  .draft-table .dash-col--secondary {
    display: none;
  }
}

/* 768-1023 px : la zone du tableau est trop etroite pour 6 colonnes, la presentation en cartes (celle du mobile)
   s'applique aux tableaux du tableau de bord uniquement. */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .dashboard-group .table-responsive {
    overflow-x: visible;
  }

  .dashboard-group .draft-table,
  .dashboard-group .draft-table tbody,
  .dashboard-group .draft-table tr,
  .dashboard-group .draft-table td {
    display: block;
    width: 100%;
  }

  .dashboard-group .draft-table thead {
    display: none;
  }

  .dashboard-group .draft-table tbody {
    display: grid;
    gap: 0.9rem;
  }

  .dashboard-group .draft-row {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    box-shadow: 0 10px 24px rgba(15, 55, 84, 0.06);
  }

  .dashboard-group .draft-table td {
    padding: 0;
    border: 0;
  }

  .dashboard-group .draft-table td + td {
    margin-top: 0.8rem;
  }

  .dashboard-group .draft-check-col {
    width: auto;
    text-align: left;
  }

  .dashboard-group .draft-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .dashboard-group .draft-actions-cell::before {
    margin-bottom: 0.55rem;
  }
}


/* Historique de vie (fiche d'un objet) : la date de chaque action est en evidence. */
.parc-when {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Mode sombre : le gris « atténué » de Bootstrap (libellés des fiches, notes, auteurs) était presque invisible sur fond foncé. */
[data-color-mode="dark"] .text-muted,
[data-color-mode="dark"] .text-body-secondary {
  color: #b9c7d5 !important;
}

[data-color-mode="dark"] .parc-when {
  color: #e6eef6;
}

/* Mode sombre : le texte d'aide des champs (placeholder) était quasiment invisible sur fond foncé. */
[data-color-mode="dark"] .form-control::placeholder,
[data-color-mode="dark"] textarea::placeholder,
[data-color-mode="dark"] input::placeholder {
  color: #9db0c2;
  opacity: 1;
}


/* Navigation d'administration commune (admin-nav.js) : groupes, fil d'Ariane, focus et cibles tactiles. */
.admin-nav__group {
  margin: 0.9rem 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #607080);
}

.admin-nav__link--local {
  border-style: dashed;
}

.admin-breadcrumb .breadcrumb {
  font-size: 0.9rem;
}

.admin-nav__link,
.dashboard-nav__link,
.user-menu__item {
  min-height: 44px;
}

.admin-nav__link:focus-visible,
.dashboard-nav__link:focus-visible,
.user-menu__item:focus-visible,
.admin-breadcrumb a:focus-visible {
  outline: 3px solid var(--brand, #0f5b8d);
  outline-offset: 2px;
}

@media (max-width: 767.98px) {
  .dashboard-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scroll-snap-type: x proximity;
  }
  .dashboard-nav__link {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}


.global-search__group {
  padding: 0.5rem 0.9rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #607080);
  list-style: none;
}


/* Personnalisation : barre d'enregistrement unique, fixée en bas de la zone de contenu. */
.branding-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #d4dde6);
  border-radius: 14px;
  box-shadow: 0 -6px 18px rgba(15, 35, 55, 0.08);
}

.branding-savebar__text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #607080);
}

/* Mode sombre : fil d'Ariane, barre d'enregistrement et palette lisibles. */
[data-color-mode="dark"] .admin-breadcrumb .breadcrumb {
  --bs-breadcrumb-divider-color: var(--muted);
  --bs-breadcrumb-item-active-color: var(--muted);
}

[data-color-mode="dark"] .admin-breadcrumb a {
  color: var(--brand);
}

/* ─── Mode sombre : corrections de contraste relevées par tests/browser/audit_dark.py ───────────────────────────────────
   En mode sombre la « marque » devient claire (--brand) et la « marque foncée » reste foncée : les textes blancs posés sur --brand
   (boutons, onglet actif, en-tête) étaient illisibles, de même que les couleurs codées en dur pour le mode clair. */
[data-color-mode="dark"] .app-header {
  background: linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.22)), linear-gradient(135deg, var(--brand-dark), var(--brand-dark));
}

[data-color-mode="dark"] .btn-primary {
  --bs-btn-color: #0a1f2e;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-active-color: #ffffff;
  --bs-btn-disabled-color: #0a1f2e;
}

[data-color-mode="dark"] .btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #0a1f2e;
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
}

[data-color-mode="dark"] .btn-outline-danger,
[data-color-mode="dark"] .btn-danger {
  --bs-btn-color: #ff8f9b;
  --bs-btn-border-color: #ff8f9b;
  --bs-btn-hover-color: #0a1f2e;
  --bs-btn-hover-bg: #ff8f9b;
  --bs-btn-hover-border-color: #ff8f9b;
}

[data-color-mode="dark"] .btn-danger {
  --bs-btn-bg: transparent;
}

[data-color-mode="dark"] .btn-link {
  --bs-btn-color: var(--brand);
  --bs-btn-hover-color: var(--text);
}

[data-color-mode="dark"] .dashboard-nav__link.is-active,
[data-color-mode="dark"] .dashboard-nav__link.is-active .dashboard-nav__count {
  color: #0a1f2e;
}

[data-color-mode="dark"] .app-footer__version {
  color: var(--muted);
}

[data-color-mode="dark"] .status-pill {
  color: var(--text);
}

[data-color-mode="dark"] .resource-order-item__position {
  color: var(--brand);
}

[data-color-mode="dark"] .form-text {
  color: var(--muted);
}

[data-color-mode="dark"] .list-group-item {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-color-mode="dark"] .choice-chip input:checked + span {
  color: #0a1f2e;
}

[data-color-mode="dark"] .dashboard-nav__link.is-active {
  background: var(--brand-dark);
  color: #ffffff;
}

[data-color-mode="dark"] .dashboard-nav__link.is-active .dashboard-nav__count {
  color: #ffffff;
}

[data-color-mode="dark"] .dashboard-nav__link.is-active .dashboard-nav__count {
  background: rgba(0, 0, 0, 0.3);
}

/* Notifications : cloche de l'en-tête, panneau et choix du service référent (js/notifications.js) */
.notification-bell {
  position: relative;
  min-width: 2.75rem;
}

.notification-bell__count {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.notification-panel {
  position: fixed;
  z-index: 1070; /* au-dessus de la bannière (1040), sous les fenêtres (1080) */
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text, inherit);
  box-shadow: 0 18px 44px rgba(15, 55, 84, 0.22);
}

.notification-panel__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.notification-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
}

.notification-item {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.notification-item__title {
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.notification-item__urgent {
  font-weight: 700;
  color: #b42318;
}

[data-color-mode="dark"] .notification-item__urgent {
  color: #f19b92;
}

.notification-item__detail {
  margin: 0 0 0.6rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.notification-empty {
  margin: 0;
  color: var(--muted);
}

.assign-services {
  width: min(560px, 100%);
}

.assign-services__group {
  margin-bottom: 1rem;
}

.assign-services__resources {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.service-referents {
  display: grid;
  gap: 0.35rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.service-referents__item {
  margin: 0;
}

.service-tasks {
  width: min(860px, 100%);
}

.service-tasks__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .service-tasks__table thead {
    position: absolute;
    left: -9999px;
  }

  .service-tasks__table tr {
    display: block;
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
  }

  .service-tasks__table td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border: 0;
    padding: 0.2rem 0;
  }

  .service-tasks__table td::before {
    content: attr(data-label);
    font-weight: 600;
  }
}

.notification-panel__all {
  margin: 0.85rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.service-tasks__late {
  font-weight: 600;
  color: #b54708;
}

.service-tasks__late--escalated {
  color: #b42318;
}

[data-color-mode="dark"] .service-tasks__late {
  color: #f5b668;
}

[data-color-mode="dark"] .service-tasks__late--escalated {
  color: #f19b92;
}

.service-tasks__feedback {
  min-height: 1.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.tasks-page__section {
  margin-bottom: 1.25rem;
}

.tasks-page__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: end;
  margin-bottom: 1rem;
}

