/* ==========================================================================
   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 */
  --brand-accent-hover: #f08a45;
  --brand-accent-active: #cf6620;
  --brand-accent-strong: #b45309;  /* texte orange sur fond clair (contraste AA) */
  --brand-accent-soft: rgba(232, 119, 46, .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(232, 119, 46, .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-hover: #f69d63;
  --brand-accent-active: #e07a37;
  --brand-accent-strong: #f6a874;
  --brand-accent-soft: rgba(242, 140, 74, .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-navy);
  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-navy);
  --bs-btn-hover-bg: var(--brand-accent-hover);
  --bs-btn-hover-border-color: var(--brand-accent-hover);
  --bs-btn-hover-color: var(--brand-navy);
  --bs-btn-active-bg: var(--brand-accent-active);
  --bs-btn-active-border-color: var(--brand-accent-active);
  --bs-btn-active-color: var(--brand-navy);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 4px 12px -2px rgba(232, 119, 46, .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-navy) !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(232, 119, 46, .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) 35%, #fff);
  background: color-mix(in srgb, var(--cat-color) 30%, 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(232, 119, 46, .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-navy);
}
.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(232, 119, 46, .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-navy);
  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; }
}
