/* ==========================================================================
   ZEMIO — Intranet social
   Identité : bleu nuit + orange cuivré. Interface claire, aérée, typographie
   Inter, surfaces à bordure fine, ombres discrètes, barre latérale sur ordinateur.
   Les variables Bootstrap sont surchargées pour garder les composants cohérents.
   ========================================================================== */

/* ---------- 1. Jetons de design ---------- */
:root,
[data-bs-theme="light"] {
  --brand-navy: #0f1b33;
  --brand-navy-soft: #1e3a6e;
  --brand-accent: #e8772e;         /* fonds et icônes (personnalisable par entreprise) */
  --brand-accent-rgb: 232, 119, 46;
  --brand-on-accent: #0f1b33;      /* texte posé sur la couleur d’accent */
  --brand-accent-hover: #f08a45;
  --brand-accent-active: #cf6620;
  --brand-accent-strong: #b45309;  /* texte orange sur fond clair (contraste AA) */
  --brand-accent-soft: rgba(var(--brand-accent-rgb), .12);
  --brand-accent-contrast: #0f1b33;

  --app-bg: #f5f6fa;
  --surface: #ffffff;
  --surface-muted: #f2f4f8;
  --surface-hover: #eef1f6;
  --border: #e6e9f0;
  --border-strong: #d7dce6;
  --text-muted: #667085;
  --topbar-bg: rgba(245, 246, 250, .78);
  --sidebar-bg: #ffffff;
  --primary-soft: rgba(30, 58, 110, .08);

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .03);
  --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .18);

  --radius-sm: .5rem;
  --radius: .75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;

  --bs-body-bg: var(--app-bg);
  --bs-body-color: #1d2433;
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-primary: #1e3a6e;
  --bs-primary-rgb: 30, 58, 110;
  --bs-link-color: #1e3a6e;
  --bs-link-color-rgb: 30, 58, 110;
  --bs-link-hover-color: #0f1b33;
  --bs-focus-ring-color: rgba(var(--brand-accent-rgb), .35);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-border-radius-sm: .375rem;
  --bs-font-sans-serif: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-emphasis-color: #0f1b33;

  --sidebar-w: 260px;
  --header-h: 64px;
  --bottom-nav-h: 68px;
}

[data-bs-theme="dark"] {
  --brand-accent: #f28c4a;
  --brand-accent-rgb: 242, 140, 74;
  --brand-accent-hover: #f69d63;
  --brand-accent-active: #e07a37;
  --brand-accent-strong: #f6a874;
  --brand-accent-soft: rgba(var(--brand-accent-rgb), .14);

  --app-bg: #0b0f19;
  --surface: #121826;
  --surface-muted: #171e2e;
  --surface-hover: #1c2436;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text-muted: #98a2b8;
  --topbar-bg: rgba(11, 15, 25, .72);
  --sidebar-bg: #0e1320;
  --primary-soft: rgba(143, 176, 255, .12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);

  --bs-body-bg: var(--app-bg);
  --bs-body-color: #e4e8f1;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-primary: #8fb0ff;
  --bs-primary-rgb: 143, 176, 255;
  --bs-link-color: #8fb0ff;
  --bs-link-color-rgb: 143, 176, 255;
  --bs-link-hover-color: #b5cbff;
  --bs-card-bg: var(--surface);
  --bs-tertiary-bg: var(--surface-muted);
}

/* ---------- 2. Base ---------- */
body {
  background: var(--app-bg);
  font-family: var(--bs-font-sans-serif);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}
@media (min-width: 992px) {
  body { padding-bottom: 0; }
}

h1, .h1 { font-size: clamp(1.5rem, 1.25rem + .8vw, 1.875rem); font-weight: 700; letter-spacing: -.025em; margin: 0; }
h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { letter-spacing: -.015em; font-weight: 650; }
.fw-semibold { font-weight: 600 !important; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
main:focus { outline: none; }
.min-w-0 { min-width: 0; }
.text-accent { color: var(--brand-accent) !important; }
.bg-accent { background-color: var(--brand-accent) !important; color: var(--brand-accent-contrast) !important; }
::selection { background: var(--brand-accent-soft); }

/* Focus visible renforcé pour la navigation clavier */
:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; top: .5rem; left: .5rem; z-index: 2000;
  background: var(--brand-accent); color: var(--brand-on-accent);
  padding: .5rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}

/* Cartes : bordure fine + ombre légère */
.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius-lg);
  --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  --bs-card-cap-bg: transparent;
  box-shadow: var(--shadow-xs);
}
.card-header { padding-block: 1rem; }

/* Formulaires */
.form-control, .form-select {
  background-color: var(--surface);
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--text-muted); opacity: .8; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 4px var(--brand-accent-soft);
}
.form-label { font-weight: 550; font-size: .875rem; margin-bottom: .4rem; }

/* Champ de recherche : icône intégrée au champ */
.input-group > .input-group-text {
  background: var(--surface); border-color: var(--border-strong);
  color: var(--text-muted); padding-right: .25rem;
}
.input-group > .input-group-text + .form-control { border-left: 0; padding-left: .5rem; }
.input-group:focus-within > .input-group-text { border-color: var(--brand-accent); }
.input-group:focus-within { box-shadow: 0 0 0 4px var(--brand-accent-soft); border-radius: var(--radius-sm); }
.input-group:focus-within > .form-control:focus { box-shadow: none; }

.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--border); }
.table { --bs-table-bg: transparent; }
.table > thead th {
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); background: var(--surface-muted); border-bottom-color: var(--border);
}
.modal-content { border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); background: var(--surface); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-backdrop { --bs-backdrop-opacity: .4; backdrop-filter: blur(2px); }
.badge { font-weight: 600; }
.alert { border-radius: var(--radius); }
.alert-warning { --bs-alert-bg: #fff7ed; --bs-alert-border-color: #fed7aa; --bs-alert-color: #7c2d12; }
[data-bs-theme="dark"] .alert-warning { --bs-alert-bg: rgba(242, 140, 74, .1); --bs-alert-border-color: rgba(242, 140, 74, .25); --bs-alert-color: #fbc8a3; }

/* ---------- 3. Boutons ---------- */
.btn { --bs-btn-font-weight: 550; --bs-btn-border-radius: var(--radius-sm); transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  --bs-btn-bg: var(--brand-navy-soft);
  --bs-btn-border-color: var(--brand-navy-soft);
  --bs-btn-hover-bg: var(--brand-navy);
  --bs-btn-hover-border-color: var(--brand-navy);
  --bs-btn-active-bg: var(--brand-navy);
  --bs-btn-active-border-color: var(--brand-navy);
  --bs-btn-disabled-bg: var(--brand-navy-soft);
  --bs-btn-disabled-border-color: var(--brand-navy-soft);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.btn-outline-primary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-active-bg: var(--brand-navy-soft);
  --bs-btn-active-border-color: var(--brand-navy-soft);
  --bs-btn-active-color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-active-bg: var(--surface-hover);
  --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-active-color: var(--bs-body-color);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-bg: #3d63b8;
  --bs-btn-border-color: #3d63b8;
  --bs-btn-hover-bg: #4b72c9;
  --bs-btn-hover-border-color: #4b72c9;
  --bs-btn-active-bg: #4b72c9;
  --bs-btn-disabled-bg: #3d63b8;
  --bs-btn-disabled-border-color: #3d63b8;
}
[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-active-bg: #3d63b8;
  --bs-btn-active-border-color: #3d63b8;
}
.btn-accent {
  --bs-btn-bg: var(--brand-accent);
  --bs-btn-border-color: var(--brand-accent);
  --bs-btn-color: var(--brand-on-accent);
  --bs-btn-hover-bg: var(--brand-accent-hover);
  --bs-btn-hover-border-color: var(--brand-accent-hover);
  --bs-btn-hover-color: var(--brand-on-accent);
  --bs-btn-active-bg: var(--brand-accent-active);
  --bs-btn-active-border-color: var(--brand-accent-active);
  --bs-btn-active-color: var(--brand-on-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 4px 12px -2px rgba(var(--brand-accent-rgb), .35);
}
.btn, .form-control, .form-select { min-height: 44px; } /* cibles tactiles confortables */
.btn-sm { min-height: 36px; }
.btn-icon {
  width: 42px; height: 42px; min-height: 42px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-muted); font-size: 1.15rem; border: 0;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--bs-body-color); }

/* ---------- 4. Barre latérale (ordinateur) ---------- */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1035;
  width: var(--sidebar-w);
  flex-direction: column; gap: 1.25rem;
  padding: 1.25rem 1rem 1rem;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: .25rem .5rem; color: var(--bs-emphasis-color); text-decoration: none;
}
.brand-name { font-weight: 800; letter-spacing: -.03em; font-size: 1.2rem; color: var(--bs-emphasis-color); }
.brand-company {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-muted); margin-top: .3rem;
}
.sidebar-publish { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; }
.sidebar-publish.active { box-shadow: 0 0 0 3px var(--brand-accent-soft); }

.sidebar-nav { flex: 1; }
.sidebar-label {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 1rem .75rem .4rem;
}
.sidebar-nav ul { margin: 0; display: grid; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  min-height: 40px; padding: .5rem .75rem; border-radius: var(--radius-sm);
  color: var(--bs-body-color); text-decoration: none; font-weight: 500; font-size: .9rem;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-nav a i { font-size: 1.1rem; color: var(--text-muted); transition: color .15s ease; }
.sidebar-nav a:hover { background: var(--surface-hover); }
.sidebar-nav a:hover i { color: var(--bs-body-color); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--bs-primary); font-weight: 600; }
.sidebar-nav a.active i { color: var(--brand-accent); }

.sidebar-profile {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--bs-body-color); text-decoration: none; font-size: .875rem;
  transition: background-color .15s ease, border-color .15s ease;
}
.sidebar-profile .small { font-size: .75rem; }
.sidebar-profile > .bi { color: var(--text-muted); font-size: .8rem; }
.sidebar-profile:hover, .sidebar-profile.active { background: var(--surface-hover); border-color: var(--border-strong); color: var(--bs-body-color); }

/* ---------- 5. Barre supérieure ---------- */
@media (min-width: 992px) {
  .app-shell { margin-left: var(--sidebar-w); }
}
.app-topbar {
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--header-h); padding: 0 1rem;
}
@media (min-width: 992px) { .topbar-inner { padding: 0 2rem; } }
.topbar-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.topbar-context { align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; color: var(--bs-body-color); }
.topbar-context .bi { color: var(--text-muted); }
.topbar-sep { color: var(--border-strong); font-weight: 400; }
.header-profile {
  display: inline-flex; align-items: center; padding: 3px; border-radius: 999px; text-decoration: none;
}
.header-profile:hover, .header-profile.active { box-shadow: 0 0 0 2px var(--brand-accent); }

.app-main { padding-top: 1.75rem; padding-bottom: 2.5rem; }
@media (min-width: 992px) { .app-main { padding-top: 2.25rem; padding-inline: 2rem; } }

/* ---------- 6. Navigation inférieure (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--text-muted);
  font-size: .7rem; font-weight: 500; text-decoration: none; min-height: 44px;
}
.bottom-nav i { font-size: 1.3rem; }
.bottom-nav .active { color: var(--bs-body-color); font-weight: 650; }
.bottom-nav .active i { color: var(--brand-accent); }
.bottom-nav .bottom-nav-publish i {
  background: var(--brand-accent); color: var(--brand-on-accent) !important;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; margin-top: -20px;
  box-shadow: 0 0 0 4px var(--app-bg), 0 8px 18px -4px rgba(var(--brand-accent-rgb), .55);
}
.nav-more { border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface); }
.nav-more .list-group-item { min-height: 52px; display: flex; align-items: center; border-radius: var(--radius-sm); border: 0; }
.nav-more .list-group-item.active { background: var(--primary-soft); color: var(--bs-primary); font-weight: 600; }

/* ---------- 7. Composants communs ---------- */
.page-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1.5rem;
}
.filter-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-pills .btn {
  min-height: 34px; padding-inline: .9rem; font-size: .8125rem; font-weight: 550;
  --bs-btn-bg: transparent; box-shadow: none;
}
.filter-pills .btn-check:checked + .btn {
  background: var(--bs-body-color); border-color: var(--bs-body-color); color: var(--app-bg);
}
.toolbar { box-shadow: none; }
.toolbar .card-body { padding: 1rem; }

.avatar {
  --size: 44px;
  width: var(--size); height: var(--size); flex: 0 0 var(--size);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--avatar-bg, var(--brand-navy-soft));
  background-image: linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 60%);
  color: #fff; font-weight: 650; font-size: calc(var(--size) * .36); letter-spacing: .01em;
  user-select: none;
}
[data-bs-theme="dark"] .avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.avatar-sm { --size: 32px; }
.avatar-lg { --size: 72px; }
.avatar-xl { --size: 104px; box-shadow: 0 0 0 5px var(--surface), var(--shadow-md); }

.cat-badge {
  --cat-color: #1e3a6e;
  color: var(--cat-color); font-weight: 600; font-size: .75rem;
  padding: .35em .7em; border-radius: 999px;
  background: color-mix(in srgb, var(--cat-color) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-color) 22%, transparent);
}
[data-bs-theme="dark"] .cat-badge {
  color: color-mix(in srgb, var(--cat-color) 30%, #fff);
  background: color-mix(in srgb, color-mix(in srgb, var(--cat-color) 65%, #fff) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-color) 55%, transparent);
}

.empty-state { text-align: center; padding: 3.5rem 1rem; }
.empty-state-icon {
  display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 1rem;
  border-radius: var(--radius-lg); background: var(--brand-accent-soft); color: var(--brand-accent); font-size: 1.75rem;
}

/* ---------- 8. Fil d'actualité ---------- */
.post-card { overflow: hidden; transition: box-shadow .2s ease, border-color .2s ease; }
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card.is-pinned { border-color: color-mix(in srgb, var(--brand-accent) 45%, var(--border)); box-shadow: 0 0 0 3px var(--brand-accent-soft); }
.pinned-label {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand-accent-strong); background: var(--brand-accent-soft);
  padding: .3rem .65rem; border-radius: 999px; margin-bottom: 1rem;
}
.post-card .card-title { font-size: 1.125rem; margin-bottom: .5rem; }
.post-text { white-space: pre-line; line-height: 1.6; color: color-mix(in srgb, var(--bs-body-color) 88%, transparent); }
.post-media {
  display: block; width: calc(100% - 2.5rem); height: auto; margin: 0 1.25rem;
  border-radius: var(--radius); background: var(--surface-muted); border: 1px solid var(--border);
}
.post-video { width: calc(100% - 2.5rem); margin: 0 1.25rem; border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 80% 20%, rgba(var(--brand-accent-rgb), .35), transparent 50%), linear-gradient(135deg, #0f1b33, #24447f); color: #fff; }
.post-video .bi-play-circle-fill { font-size: 3.5rem; color: #fff; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .35)); }
.post-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem;
  border-top: 1px solid var(--border); padding-top: .5rem;
}
.btn-action {
  color: var(--text-muted); font-weight: 550; font-size: .875rem; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
.btn-action:hover { background: var(--surface-hover); color: var(--bs-body-color); }
.btn-action.is-active { color: var(--brand-accent-strong); background: var(--brand-accent-soft); }
.post-comments { padding: 1rem 1.25rem 1.25rem; background: var(--surface-muted); border-top: 1px solid var(--border); }
.comment { display: flex; gap: .6rem; margin-bottom: .75rem; }
.comment-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: .35rem var(--radius) var(--radius) var(--radius); padding: .5rem .85rem; }
.comment-form { display: flex; align-items: flex-start; gap: .5rem; }
.comment-form .avatar { margin-top: 6px; }
.comment-form .form-control { border-radius: 999px; padding-inline: 1rem; }
.comment-form .btn { border-radius: 50%; width: 44px; padding: 0; }

/* ---------- 9. Création de publication ---------- */
.image-choice {
  display: flex; flex-direction: column; gap: .35rem; align-items: center;
  padding: .4rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  cursor: pointer; font-size: .78rem; text-align: center; height: 100%;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.image-choice:hover { border-color: var(--brand-accent); }
.image-choice img, .image-choice-none {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm);
}
.image-choice-none { display: grid; place-items: center; background: var(--surface-muted); font-size: 1.4rem; color: var(--text-muted); }
.btn-check:checked + .image-choice { border-color: var(--brand-accent); background: var(--brand-accent-soft); box-shadow: 0 0 0 3px var(--brand-accent-soft); font-weight: 600; }
.btn-check:focus-visible + .image-choice { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

/* ---------- 10. Messagerie ---------- */
.messenger {
  display: grid; overflow: hidden; grid-template-columns: minmax(0, 1fr);
  height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - 8rem);
  min-height: 420px;
}
@media (min-width: 992px) {
  .messenger { height: calc(100dvh - var(--header-h) - 9rem); }
}
.messenger-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.messenger-list > .border-bottom { border-color: var(--border) !important; }
#conv-list { overflow-y: auto; padding: .5rem; }
.conv-item {
  width: 100%; display: flex; gap: .75rem; align-items: center; text-align: left;
  padding: .75rem; background: none; border: 0; border-radius: var(--radius);
  color: inherit; transition: background-color .15s ease;
}
.conv-item:hover { background: var(--surface-hover); }
.conv-item.active { background: var(--primary-soft); }
.conv-item.active .conv-name { color: var(--bs-primary); }
.conv-icon {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.1rem; color: #fff;
  background: linear-gradient(135deg, var(--brand-navy-soft), #3b5ea8);
}
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: .825rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; font-size: .72rem; color: var(--text-muted); }

.messenger-thread { display: flex; flex-direction: column; min-height: 0; }
.thread-header { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.thread-messages {
  flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 20px 20px,
    var(--surface-muted);
}
.thread-form { display: flex; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); }
.thread-form .form-control { border-radius: 999px; padding-inline: 1.1rem; }
.thread-form .btn { border-radius: 999px; }
.msg { display: flex; gap: .5rem; align-items: flex-end; max-width: 80%; }
.msg-mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  background: var(--surface); padding: .55rem .9rem;
  border: 1px solid var(--border); border-radius: 1.1rem 1.1rem 1.1rem .3rem; box-shadow: var(--shadow-xs);
}
.msg-mine .msg-bubble {
  background: linear-gradient(135deg, var(--brand-navy-soft), #2d4f92); border-color: transparent; color: #fff;
  border-radius: 1.1rem 1.1rem .3rem 1.1rem;
}
.msg-author { font-size: .72rem; font-weight: 650; margin-bottom: .1rem; opacity: .85; }
.msg-time { display: block; font-size: .68rem; opacity: .7; text-align: right; margin-top: .15rem; }
.msg-system {
  align-self: center; text-align: center; font-size: .78rem; color: var(--text-muted); margin: 0;
  background: var(--surface); border: 1px solid var(--border); padding: .3rem .8rem; border-radius: 999px;
}

/* Mobile : on affiche soit la liste, soit la conversation */
@media (max-width: 767.98px) {
  .messenger { height: calc(100dvh - var(--header-h) - var(--bottom-nav-h) - 7rem); }
  .messenger-list { border-right: 0; }
  .messenger[data-mobile-view="list"] .messenger-thread,
  .messenger[data-mobile-view="thread"] .messenger-list { display: none; }
}
@media (min-width: 768px) {
  .messenger { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .messenger { grid-template-columns: 340px minmax(0, 1fr); }
}

/* ---------- 11. Annuaire ---------- */
.person-card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.person-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.person-card .avatar-lg { box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border); }
.person-meta li { display: flex; gap: .5rem; align-items: center; margin-bottom: .25rem; color: var(--text-muted); }
.person-meta i { color: var(--brand-accent); }

/* ---------- 12. Événements ---------- */
.event-card { transition: box-shadow .2s ease; }
.event-card:hover { box-shadow: var(--shadow-md); }
.event-date {
  flex: 0 0 64px; height: 72px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; line-height: 1;
  box-shadow: var(--shadow-xs);
}
.event-month {
  order: -1; width: 100%; text-align: center; padding: .3rem 0;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: var(--brand-accent); color: var(--brand-on-accent);
}
.event-day { font-size: 1.6rem; font-weight: 750; letter-spacing: -.03em; margin: auto 0; color: var(--bs-emphasis-color); }
.event-card.is-registered { border-color: color-mix(in srgb, var(--bs-success) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-success) 14%, transparent); }
.event-meta li { display: flex; gap: .5rem; align-items: baseline; margin-bottom: .2rem; }

/* ---------- 13. Documents ---------- */
.documents-list { border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.doc-item { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; background: var(--surface); transition: background-color .15s ease; }
.doc-item:hover { background: var(--surface-muted); }
.doc-icon {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: var(--radius);
  display: grid; place-items: center; font-size: 1.3rem;
  color: var(--doc-color); background: color-mix(in srgb, var(--doc-color) 12%, transparent);
}
.doc-pdf { --doc-color: #d92d20; }
.doc-procedure { --doc-color: #12866b; }
.doc-note { --doc-color: #c2610c; }
.doc-formation { --doc-color: #6e56cf; }
[data-bs-theme="dark"] .doc-icon { color: color-mix(in srgb, var(--doc-color) 55%, #fff); background: color-mix(in srgb, var(--doc-color) 22%, transparent); }
.doc-meta { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; color: var(--text-muted); }
.doc-meta .text-bg-light { background: var(--surface-muted) !important; color: var(--bs-body-color) !important; border-color: var(--border) !important; font-weight: 550; }

/* ---------- 14. Profil ---------- */
.profile-cover {
  height: 140px;
  background:
    radial-gradient(circle at 85% 10%, rgba(var(--brand-accent-rgb), .85), transparent 40%),
    radial-gradient(circle at 10% 100%, rgba(91, 132, 214, .55), transparent 45%),
    linear-gradient(135deg, #0f1b33, #24447f);
}
.profile-avatar { margin-top: -52px; margin-bottom: .75rem; }
.profile-stats { border-top: 1px solid var(--border); }
.profile-stats li {
  display: flex; flex-direction: column; align-items: center; padding: 1.1rem .5rem;
  border-right: 1px solid var(--border);
}
.profile-stats li:last-child { border-right: 0; }
.profile-stats i { color: var(--brand-accent); font-size: 1.1rem; }
.profile-stat-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.profile-stat-label { font-size: .75rem; color: var(--text-muted); }

/* ---------- 15. Centre de notifications ---------- */
.notif-badge {
  position: absolute; top: 5px; right: 3px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--brand-accent); color: var(--brand-on-accent);
  font-size: .65rem; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--app-bg);
}
.offcanvas { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-border-color: var(--border); }
.notif-panel { --bs-offcanvas-width: 420px; }
@media (min-width: 576px) {
  .notif-panel.offcanvas-end { top: .75rem; bottom: .75rem; right: .75rem; height: auto; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
}
/* Le panneau reçoit le focus à l'ouverture (Bootstrap) : pas de contour sur le conteneur lui-même. */
.offcanvas:focus, .offcanvas:focus-visible, .modal:focus-visible { outline: none; }
/* Interrupteurs et cases aux couleurs de la charte */
.form-check-input:checked { background-color: var(--brand-accent); border-color: var(--brand-accent); }
.form-check-input:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 4px var(--brand-accent-soft); }
.notif-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
}
.notif-toolbar .btn-link { color: var(--bs-primary); font-weight: 600; }
.notif-group-title {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 1rem 1.25rem .4rem; margin: 0;
}
.notif-group ul { padding: 0 .5rem; }
.notif-item { position: relative; display: flex; align-items: stretch; border-radius: var(--radius); margin-bottom: 2px; }
.notif-item.is-unread { background: var(--brand-accent-soft); }
.notif-main {
  flex: 1; display: flex; gap: .75rem; align-items: flex-start; text-align: left;
  padding: .75rem .25rem .75rem .75rem; background: none; border: 0; color: inherit; min-height: 64px;
  border-radius: var(--radius);
}
.notif-main:hover { background: var(--surface-hover); }
.notif-visual { position: relative; flex: 0 0 44px; }
.notif-icon, .notif-type-badge { display: grid; place-items: center; border-radius: 50%; color: #fff; }
.notif-icon { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 12px; }
.notif-type-badge {
  position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; font-size: .68rem;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-like { background: #c2610c; }
.notif-comment { background: #1e3a6e; }
.notif-message { background: #0b6fa4; }
.notif-post { background: #6e56cf; }
.notif-security { background: #d92d20; }
.notif-event, .notif-reminder { background: #12866b; }
.notif-system { background: #4a5568; }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.notif-text { font-size: .875rem; line-height: 1.4; }
.notif-item:not(.is-unread) .notif-text { color: var(--text-muted); }
.notif-item:not(.is-unread) .notif-text strong { color: var(--bs-body-color); }
.notif-time { font-size: .72rem; color: var(--text-muted); }
.notif-item.is-unread .notif-time { color: var(--brand-accent-strong); font-weight: 600; }
.notif-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: .45rem; border-radius: 50%; background: var(--brand-accent); box-shadow: 0 0 0 3px var(--brand-accent-soft); }
.notif-delete { align-self: center; width: 36px; height: 36px; min-height: 36px; margin-right: .25rem; color: var(--text-muted); opacity: .55; border-radius: var(--radius-sm); }
.notif-delete:hover, .notif-delete:focus-visible { opacity: 1; background: var(--surface-hover); }
.notif-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-muted); }

/* Mise en évidence d'un élément ouvert depuis une notification */
.is-highlighted { animation: zemio-highlight 2.5s ease-out; }
@keyframes zemio-highlight {
  0%, 30% { box-shadow: 0 0 0 4px var(--brand-accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Apparition douce des vues */
[data-view]:not([hidden]) { animation: zemio-fade-in .25s ease-out; }
@keyframes zemio-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 16. Toasts ---------- */
.toast-container { right: 0; bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); z-index: 1090; }
@media (min-width: 992px) { .toast-container { bottom: 0; } }
.toast {
  background: rgba(15, 27, 51, .94); color: #fff; border-radius: var(--radius);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow-lg);
}
[data-bs-theme="dark"] .toast { background: rgba(28, 36, 54, .96); border: 1px solid var(--border-strong) !important; }
.toast .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.toast-success .bi { color: #6ee7a8; }
.toast-info .bi { color: #9cc2ff; }
.toast-warning .bi { color: #ffc46b; }
.toast-danger .bi { color: #ff9b9b; }

/* ---------- 17. Préférences d'accessibilité ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   18. Application PHP — compléments
   ========================================================================== */

/* Filtres en liens (GET) : même rendu que les boutons radio de la maquette */
.filter-pills .btn.active {
  background: var(--bs-body-color); border-color: var(--bs-body-color); color: var(--app-bg);
}

/* Rubriques pas encore développées */
.is-soon { cursor: not-allowed; opacity: .55; }
.sidebar-nav .is-soon {
  display: flex; align-items: center; gap: .75rem;
  min-height: 40px; padding: .5rem .75rem; border-radius: var(--radius-sm);
  font-weight: 500; font-size: .9rem;
}
.sidebar-nav .is-soon i { font-size: 1.1rem; color: var(--text-muted); }
.soon-badge {
  margin-left: auto; font-size: .625rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  padding: .15rem .45rem; border-radius: 999px; background: var(--surface-muted); color: var(--text-muted);
  border: 1px solid var(--border);
}
.bottom-nav .is-soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-muted); font-size: .7rem; font-weight: 500;
}
.bottom-nav .is-soon i { font-size: 1.3rem; }
.nav-more .is-soon { display: flex; align-items: center; min-height: 52px; }
.nav-more-logout { min-height: 52px; color: var(--bs-danger); border: 0; border-radius: var(--radius-sm); }
.nav-more-logout:hover { background: var(--surface-hover); color: var(--bs-danger); }

/* Profil en bas de la barre latérale (avec menu) */
.sidebar-profile .dropup .btn-icon { width: 32px; height: 32px; min-height: 32px; font-size: 1rem; }
.sidebar-profile .text-truncate { max-width: 140px; }
.dropdown-menu {
  --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border);
  --bs-dropdown-link-hover-bg: var(--surface-hover); --bs-dropdown-link-active-bg: var(--brand-navy-soft);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: .35rem; font-size: .9rem;
}
.dropdown-item { border-radius: var(--radius-sm); padding: .5rem .75rem; }
.header-profile.btn { min-height: 0; }

/* Actions d'une publication : le J'aime est un petit formulaire */
.post-actions form { display: contents; }
.post-actions .btn-action { min-height: 40px; }
.post-card { scroll-margin-top: calc(var(--header-h) + 1rem); }
.post-card:target { box-shadow: 0 0 0 3px var(--brand-accent-soft), var(--shadow-md); }

/* ---------- Page de connexion ---------- */
.auth-page {
  min-height: 100dvh; padding-bottom: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(var(--brand-accent-rgb), .14), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(30, 58, 110, .14), transparent 45%),
    var(--app-bg);
}
.auth-wrap {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.auth-card { width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); border-radius: var(--radius-xl); }
.auth-card .card-body { padding: 2rem; }
@media (min-width: 576px) { .auth-card .card-body { padding: 2.5rem; } }
.auth-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 2rem; }
.auth-brand .brand-name { font-size: 1.4rem; }
.auth-demo {
  font-size: .8rem; padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--surface-muted); border: 1px dashed var(--border-strong); color: var(--text-muted);
}
.auth-legal { max-width: 420px; margin: 1.25rem 0 0; text-align: center; font-size: .75rem; color: var(--text-muted); }
.auth-theme { position: fixed; top: 1rem; right: 1rem; }
.password-field .btn { border-color: var(--border-strong); background: var(--surface); }
.password-field:focus-within .btn { border-color: var(--brand-accent); }
.password-field .form-control:focus { box-shadow: none; }
.password-field:focus-within { box-shadow: 0 0 0 4px var(--brand-accent-soft); border-radius: var(--radius-sm); }

/* Toasts au-dessus de la barre mobile, y compris sur la page de connexion */
.auth-page .toast-container { bottom: 0; }
.alert-danger { --bs-alert-bg: #fef3f2; --bs-alert-border-color: #fecdca; --bs-alert-color: #912018; }
[data-bs-theme="dark"] .alert-danger { --bs-alert-bg: rgba(217, 45, 32, .12); --bs-alert-border-color: rgba(217, 45, 32, .3); --bs-alert-color: #fda29b; }

/* ==========================================================================
   19. Administration
   ========================================================================== */
.admin-tabs {
  display: flex; gap: .25rem; margin-bottom: 1.5rem; overflow-x: auto;
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.admin-tabs a {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .65rem .9rem; margin-bottom: -1px; min-height: 44px;
  color: var(--text-muted); text-decoration: none; font-weight: 550; font-size: .9rem;
  border-bottom: 2px solid transparent; transition: color .15s ease, border-color .15s ease;
}
.admin-tabs a:hover { color: var(--bs-body-color); }
.admin-tabs a.active { color: var(--bs-body-color); border-bottom-color: var(--brand-accent); }
.admin-tabs a.active i { color: var(--brand-accent); }

.back-link {
  display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .35rem;
  font-size: .85rem; font-weight: 550; color: var(--text-muted); text-decoration: none;
}
.back-link:hover { color: var(--bs-body-color); }

/* Chiffres clés */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.5rem; padding: 0; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat-card { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; transition: box-shadow .2s ease, border-color .2s ease; }
.stat-card:has(.stretched-link):hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-icon {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: .5rem;
  border-radius: var(--radius-sm); background: var(--brand-accent-soft); color: var(--brand-accent); font-size: 1.05rem;
}
.stat-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-muted); }

.admin-log .list-group-item { padding: .85rem 1.25rem; }

/* Tableaux */
.admin-table > :not(caption) > * > * { padding: .8rem 1rem; }
.admin-table tr.is-disabled td { opacity: .6; }
.admin-post-cell { min-width: 220px; }
.pill-count { font-size: .72rem; opacity: .65; margin-left: .15rem; }
.btn-square { width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-square.is-on { color: var(--brand-accent-strong); border-color: color-mix(in srgb, var(--brand-accent) 45%, var(--border)); background: var(--brand-accent-soft); }

.role-badge { background: var(--primary-soft); color: var(--bs-primary); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.status-badge {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600;
  padding: .25rem .6rem; border-radius: 999px; white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ok { color: #067647; background: #ecfdf3; }
.status-pending { color: #b54708; background: #fffaeb; }
.status-off { color: var(--text-muted); background: var(--surface-muted); }
[data-bs-theme="dark"] .status-ok { color: #75e0a7; background: rgba(23, 178, 106, .14); }
[data-bs-theme="dark"] .status-pending { color: #fec84b; background: rgba(247, 144, 9, .14); }

/* Fiche compte */
.card-footer { background: transparent; border-color: var(--border); padding: 1rem 1.25rem; }
.account-facts { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; font-size: .875rem; }
.account-facts dt { font-weight: 500; color: var(--text-muted); }
.account-facts dd { margin: 0; text-align: right; }
.temp-password { border-color: color-mix(in srgb, var(--brand-accent) 50%, var(--border)); box-shadow: 0 0 0 4px var(--brand-accent-soft); }
.temp-password-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: var(--radius); background: var(--brand-accent); color: var(--brand-on-accent); font-size: 1.2rem;
}
.temp-password-value {
  font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; color: var(--bs-body-color);
  padding: .5rem .85rem; border-radius: var(--radius-sm); background: var(--surface-muted); border: 1px dashed var(--border-strong);
  user-select: all; white-space: nowrap;
}

/* Pastilles de couleur */
.color-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.color-swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .1s ease, box-shadow .15s ease;
}
.color-swatch:hover { transform: scale(1.08); }
.btn-check:checked + .color-swatch { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--swatch); }
.btn-check:focus-visible + .color-swatch { outline: 2px solid var(--brand-accent); outline-offset: 4px; }

/* Catégories */
.category-row.is-editing { background: var(--brand-accent-soft); }
.btn-reorder {
  width: 32px; height: 28px; min-height: 28px; padding: 0; border: 0; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-muted); font-size: .8rem;
}
.btn-reorder:hover:not(:disabled) { background: var(--surface-hover); color: var(--bs-body-color); }
.btn-reorder:disabled { opacity: .3; }

/* ==========================================================================
   20. Annuaire et profil
   ========================================================================== */
.author-link { color: inherit; text-decoration: none; }
.author-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.person-card .person-phone { position: relative; z-index: 2; color: inherit; } /* cliquable au-dessus de la carte */
.person-card:focus-within { box-shadow: 0 0 0 3px var(--brand-accent-soft), var(--shadow-md); border-color: var(--brand-accent); }

.sidebar-profile-link { color: inherit; text-decoration: none; }
.sidebar-profile-link:hover .fw-semibold { text-decoration: underline; text-underline-offset: 3px; }
.sidebar-profile.active { border-color: var(--brand-accent); background: var(--brand-accent-soft); }

.profile-facts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.25rem;
  margin: 0 0 1rem; font-size: .875rem; color: var(--text-muted);
}
.profile-facts li { display: inline-flex; align-items: center; gap: .4rem; }
.profile-facts i { color: var(--brand-accent); }
.profile-facts a { color: inherit; }
.profile-bio { max-width: 52ch; margin-inline: auto; line-height: 1.6; }
.profile-managed { padding: .7rem .85rem; border-radius: var(--radius-sm); background: var(--surface-muted); }
.recent-post { position: relative; }
.recent-post:hover { background: var(--surface-muted); }

/* ==========================================================================
   21. Messagerie
   ========================================================================== */
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--brand-accent); color: var(--brand-on-accent); font-size: .7rem; font-weight: 800; line-height: 1;
}
.nav-badge[hidden] { display: none; }
.bottom-nav a { position: relative; }
.bottom-nav .nav-badge { position: absolute; top: 6px; left: calc(50% + 4px); margin: 0; box-shadow: 0 0 0 2px var(--surface); }

a.conv-item { text-decoration: none; }
.conv-item.is-unread .conv-name { font-weight: 750; }
.conv-item.is-unread .conv-preview { color: var(--bs-body-color); font-weight: 550; }
.conv-icon { background: linear-gradient(135deg, var(--brand-navy-soft), #3b5ea8); }
.thread-header .conv-icon, .thread-header .avatar { flex-shrink: 0; }

.msg-text { white-space: pre-line; overflow-wrap: anywhere; }
.msg-day { display: flex; align-items: center; gap: .75rem; margin: .5rem 0; font-size: .72rem; font-weight: 600; color: var(--text-muted); }
.msg-day::before, .msg-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg-day span { text-transform: uppercase; letter-spacing: .05em; }

.thread-form { align-items: flex-end; }
.thread-form textarea { resize: none; border-radius: 1.25rem; padding: .6rem 1.1rem; min-height: 44px; max-height: 160px; line-height: 1.4; }
.btn-send { width: 44px; height: 44px; padding: 0; border-radius: 50% !important; flex: 0 0 44px; display: grid; place-items: center; }
p.thread-form { display: flex; align-items: center; }

.thread-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem;
  background: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 20px 20px, var(--surface-muted);
}
.messenger-list .empty-state { padding: 2.5rem 1rem; }

/* Choix des destinataires */
.recipient-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem;
  max-height: 22rem; overflow-y: auto; padding: 2px;
}
.recipient-list.is-invalid { outline: 2px solid var(--bs-danger); outline-offset: 4px; border-radius: var(--radius); }
.recipient {
  display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 56px; padding: .5rem .75rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.recipient:hover { border-color: var(--brand-accent); }
.recipient-check { margin-left: auto; color: var(--brand-accent); font-size: 1.15rem; opacity: 0; transition: opacity .15s ease; }
.btn-check:checked + .recipient { border-color: var(--brand-accent); background: var(--brand-accent-soft); }
.btn-check:checked + .recipient .recipient-check { opacity: 1; }
.btn-check:focus-visible + .recipient { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

/* ==========================================================================
   22. Événements
   ========================================================================== */
.events-month {
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 0 0 .75rem;
}
.event-description { white-space: pre-line; line-height: 1.6; }
.event-card .event-description {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; /* aperçu : 3 lignes */
}
.event-link:hover { text-decoration: underline !important; text-underline-offset: 3px; }
.event-card.is-past { opacity: .8; }
.event-card.is-past .event-month { background: var(--surface-muted); color: var(--text-muted); }
.event-meta li { gap: .5rem; }
.event-meta i { color: var(--brand-accent); }
.event-detail .event-meta { display: grid; gap: .35rem; }
.event-detail .event-meta li { display: flex; align-items: baseline; gap: .5rem; }
.event-detail.is-registered { border-color: color-mix(in srgb, var(--bs-success) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-success) 14%, transparent); }

/* Avatars empilés */
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { --size: 30px; font-size: .62rem; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -5px; }
.avatar-more { background: var(--surface-muted) !important; background-image: none !important; color: var(--text-muted); font-size: .65rem; }

/* Participants */
.participant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem; padding: .75rem; }
.participant {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: var(--radius);
  color: inherit; text-decoration: none; transition: background-color .15s ease;
}
.participant:hover { background: var(--surface-hover); color: inherit; }

/* ==========================================================================
   23. Documents
   ========================================================================== */
.doc-word  { --doc-color: #2b579a; }
.doc-excel { --doc-color: #1d7044; }
.doc-ppt   { --doc-color: #c43e1c; }
.doc-image { --doc-color: #6e56cf; }
.doc-text  { --doc-color: #4a5568; }
.doc-other { --doc-color: #4a5568; }
.doc-download { flex-shrink: 0; }
.current-file {
  display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-muted);
}
input[type="file"].form-control { padding: .55rem .75rem; }
input[type="file"]::file-selector-button { border-radius: var(--radius-sm); }

/* ==========================================================================
   24. Notifications
   ========================================================================== */
a.notif-main { color: inherit; text-decoration: none; }
a.notif-main:hover { color: inherit; }
.notif-item .notif-main:focus-visible { outline-offset: -2px; }
.notif-page .notif-group ul { padding: 0 .75rem; }
.notif-page .notif-group-title { padding-inline: 1.5rem; }
.notif-panel .notif-group ul { padding: 0 .5rem; }
.app-topbar .btn-icon.active { color: var(--brand-accent); background: var(--brand-accent-soft); }
.app-topbar .notif-badge { top: 4px; right: 2px; }
.notif-toolbar form { display: inline; }

/* ==========================================================================
   25. Personnalisation par entreprise
   ========================================================================== */
.brand-logo { display: block; max-width: 100%; max-height: 44px; width: auto; height: auto; object-fit: contain; }
.brand-logo-sm { max-height: 32px; max-width: 160px; }
.brand-logo-lg { max-height: 64px; max-width: 260px; }
.sidebar-brand.has-logo { padding: .25rem .5rem; min-height: 44px; align-items: center; }

.logo-field { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 200px; min-height: 84px; padding: .75rem; border-radius: var(--radius);
  border: 1px dashed var(--border-strong); background: var(--surface-muted);
}
.logo-preview img { max-width: 100%; max-height: 60px; object-fit: contain; }
/* Damier pour voir la transparence du logo */
.logo-preview:not(.is-empty) {
  background-color: #fff;
  background-image: linear-gradient(45deg, #eef1f6 25%, transparent 25%), linear-gradient(-45deg, #eef1f6 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #eef1f6 75%), linear-gradient(-45deg, transparent 75%, #eef1f6 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.brand-picker { align-items: center; }
.color-swatch-custom {
  display: grid; place-items: center; color: #fff; font-size: .9rem;
  background: conic-gradient(from 90deg, #ef4444, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444);
}
.btn-check:checked + .color-swatch-custom { background: var(--swatch); }
.form-control-color { width: 46px; height: 34px; min-height: 34px; padding: 3px; border-radius: var(--radius-sm); }

.brand-preview { display: grid; gap: .25rem; }
.brand-preview .btn, .brand-preview .filter-pills .btn { pointer-events: none; }
.brand-preview-nav { display: grid; gap: 2px; }
.brand-preview-nav span {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; border-radius: var(--radius-sm);
  font-weight: 500; font-size: .9rem;
}
.brand-preview-nav i { color: var(--text-muted); }
.brand-preview-nav .is-active { background: var(--primary-soft); color: var(--bs-primary); font-weight: 600; }
.brand-preview-nav .is-active i { color: var(--brand-accent); }

.auth-welcome {
  display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius);
  background: var(--brand-accent-soft); color: var(--bs-body-color); font-size: .9rem; line-height: 1.5;
}
.auth-welcome i { color: var(--brand-accent-strong); margin-top: .1rem; }
.auth-brand .brand-logo-lg { margin: 0 auto 0 0; }
/* Mode sombre : la plupart des logos ont un texte foncé sur fond transparent → fond clair derrière */
[data-bs-theme="dark"] .brand-logo { background: #fff; padding: 4px 8px; border-radius: 8px; }

/* ==========================================================================
   26. Console super-admin (console/)
   ========================================================================== */
.console-topbar {
  position: sticky; top: 0; z-index: 1020;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
}
.console-topbar-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.console-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--bs-body-color); }
.console-tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: .2rem .5rem; border-radius: 999px; background: var(--brand-navy); color: #fff;
}
[data-bs-theme="dark"] .console-tag { background: var(--surface-muted); color: var(--bs-body-color); }
.console-nav { display: flex; gap: .25rem; }
.console-nav a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 550; font-size: .9rem; text-decoration: none;
}
.console-nav a:hover { background: var(--surface-hover); color: var(--bs-body-color); }
.console-nav a.active { background: var(--primary-soft); color: var(--bs-primary); font-weight: 600; }
.console-nav a.active i { color: var(--brand-accent); }
@media (max-width: 575.98px) { .console-brand .brand-name { display: none; } .console-topbar-inner { gap: .5rem; } }
.console-user { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--border); border-radius: 999px; font-weight: 550; }

@media (min-width: 1200px) { .stat-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.console-table tbody tr { position: relative; }
.stretched-row-link { text-decoration: none; }
.stretched-row-link::after { content: ""; position: absolute; inset: 0; }
.stretched-row-link:hover { text-decoration: underline; }
.console-search { position: relative; width: min(260px, 100%); }
.console-search .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; }
.console-search .form-control { padding-left: 2rem; }

.status-suspended { color: #b42318; background: #fef3f2; }
.status-default { color: var(--bs-primary); background: var(--primary-soft); }
[data-bs-theme="dark"] .status-suspended { color: #fda29b; background: rgba(240, 68, 56, .14); }

.console-log-icon {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-muted); color: var(--text-muted);
}

.console-choice { display: grid; gap: .75rem; }
@media (min-width: 768px) { .console-choice { grid-template-columns: 1fr 1fr; } }
.console-choice-card {
  display: flex; gap: .75rem; align-items: flex-start; height: 100%; padding: 1rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s ease, box-shadow .15s ease;
}
.console-choice-card > .bi { font-size: 1.4rem; color: var(--text-muted); line-height: 1; }
.btn-check:checked + .console-choice-card { border-color: var(--brand-accent); box-shadow: 0 0 0 3px var(--brand-accent-soft); }
.btn-check:checked + .console-choice-card > .bi { color: var(--brand-accent); }
.btn-check:focus-visible + .console-choice-card { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

.console-created { border-color: color-mix(in srgb, #17b26a 45%, var(--border)); box-shadow: 0 0 0 4px rgba(23, 178, 106, .12); }
.temp-password-inline { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 1rem; border-radius: var(--radius); background: var(--surface-muted); }
.console-step { padding-top: 1rem; border-top: 1px solid var(--border); }
.console-code {
  display: block; padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--surface-muted);
  color: var(--bs-body-color); font-size: .78rem; word-break: break-all; white-space: pre-wrap;
}

.console-dl { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1.25rem; }
.console-dl dt { font-weight: 500; color: var(--text-muted); font-size: .875rem; }
.console-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.console-setting { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.console-setting .btn { flex: none; }
.console-danger { border-color: color-mix(in srgb, #f04438 35%, var(--border)); }
.console-danger .card-header h2 { color: #b42318; }
[data-bs-theme="dark"] .console-danger .card-header h2 { color: #fda29b; }
