/* =========================================================================
   myCODESRIA : thème
   Base neutre noir et blanc, avec une couleur d'accent (marron par défaut).
   Chaque utilisateur peut choisir son accent (page Préférences) : il est
   injecté dans base.html via les variables --accent-light-* / --accent-dark-*.
   Pour changer l'identité par défaut, modifier uniquement les blocs « Jetons ».
   ========================================================================= */

/* --- Jetons : clair ---------------------------------------------------- */
:root,
[data-bs-theme="light"] {
  --accent: var(--accent-light, #8b5e3c);
  --accent-rgb: var(--accent-light-rgb, 139, 94, 60);
  --accent-hover: var(--accent-light-hover, #6f4a2f);
  --on-accent: var(--accent-light-on, #ffffff);
  --accent-soft: rgba(var(--accent-rgb), .10);

  --app-bg: #fafaf9;
  --surface: #ffffff;
  --surface-muted: #f5f5f4;
  --line: #e7e5e4;
  --ink: #1c1917;
  --ink-muted: #78716c;
  --primary-bg: #1c1917;
  --primary-hover: #000000;
  --on-primary: #ffffff;
  --sidebar-bg: #ffffff;
  --sidebar-ink: #44403c;
  --sidebar-active-bg: var(--accent-soft);
  --sidebar-active-ink: var(--accent);
  --hero-bg: linear-gradient(140deg, #1c1917 0%, #0c0a09 100%);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .05);
  --shadow-md: 0 8px 24px -8px rgba(28, 25, 23, .14);

  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-muted);
  --bs-border-color: var(--line);
  --bs-tertiary-bg: var(--surface-muted);
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--accent-hover);
  --bs-primary-bg-subtle: var(--accent-soft);
  --bs-primary-text-emphasis: var(--accent-hover);
  --bs-primary-border-subtle: rgba(var(--accent-rgb), .3);
  --bs-border-radius: .625rem;
  --bs-border-radius-lg: .875rem;
}

/* --- Jetons : sombre ---------------------------------------------------- */
[data-bs-theme="dark"] {
  --accent: var(--accent-dark, #c89b72);
  --accent-rgb: var(--accent-dark-rgb, 200, 155, 114);
  --accent-hover: var(--accent-dark-hover, #d9b593);
  --on-accent: var(--accent-dark-on, #0c0a09);
  --accent-soft: rgba(var(--accent-rgb), .14);

  --app-bg: #0c0a09;
  --surface: #171412;
  --surface-muted: #12100e;
  --line: #292524;
  --ink: #f5f5f4;
  --ink-muted: #a8a29e;
  --primary-bg: #f5f5f4;
  --primary-hover: #ffffff;
  --on-primary: #0c0a09;
  --sidebar-bg: #100e0c;
  --sidebar-ink: #d6d3d1;
  --sidebar-active-bg: var(--accent-soft);
  --sidebar-active-ink: var(--accent);
  --hero-bg: linear-gradient(140deg, #1c1917 0%, #0c0a09 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .6);

  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-muted);
  --bs-border-color: var(--line);
  --bs-tertiary-bg: var(--surface-muted);
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--accent-hover);
  --bs-primary-bg-subtle: var(--accent-soft);
  --bs-primary-text-emphasis: var(--accent-hover);
  --bs-primary-border-subtle: rgba(var(--accent-rgb), .35);
  --bs-dropdown-bg: var(--surface);
}

/* --- Base ---------------------------------------------------------------- */
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--app-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-family: "Noto Sans Arabic", "Inter", system-ui, sans-serif; }

.btn { font-weight: 500; border-radius: .5rem; }
/* Bouton principal : noir en mode clair, blanc en mode sombre */
.btn-primary {
  --bs-btn-color: var(--on-primary); --bs-btn-hover-color: var(--on-primary); --bs-btn-active-color: var(--on-primary);
  --bs-btn-disabled-color: var(--on-primary);
  --bs-btn-bg: var(--primary-bg); --bs-btn-border-color: var(--primary-bg);
  --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
  --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover);
  --bs-btn-disabled-bg: var(--primary-bg); --bs-btn-disabled-border-color: var(--primary-bg);
}
.btn-outline-primary {
  --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--on-primary); --bs-btn-hover-bg: var(--primary-bg); --bs-btn-hover-border-color: var(--primary-bg);
  --bs-btn-active-color: var(--on-primary); --bs-btn-active-bg: var(--primary-bg); --bs-btn-active-border-color: var(--primary-bg);
}
.btn-icon {
  width: 2.25rem; height: 2.25rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .5rem; color: var(--ink-muted); border: 1px solid transparent;
}
.btn-icon:hover { background: var(--surface-muted); color: var(--ink); border-color: var(--line); }

.form-control, .form-select { border-color: var(--line); background-color: var(--surface); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: rgba(var(--accent-rgb), .6);
  box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .15);
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-label { font-weight: 500; font-size: .875rem; }

.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--line);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-title-sm { font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); }

.badge-soft { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge-muted { background: var(--surface-muted); color: var(--ink-muted); border: 1px solid var(--line); font-weight: 500; }

.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); border-radius: .75rem; min-width: 15rem; }
.dropdown-item { border-radius: .375rem; }
.dropdown-menu { padding: .375rem; }

/* Thème : icône affichée selon le mode */
.theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: inline; }
[data-bs-theme="dark"] .theme-icon-light { display: none; }

/* Logo : version claire en mode sombre (logo noir sur fond transparent) */
.brand-logo { height: 30px; width: auto; }
[data-bs-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }

/* --- Coque applicative -------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-sidebar {
  --bs-offcanvas-width: 272px;
  --bs-offcanvas-bg: var(--sidebar-bg);
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--line);
}
@media (min-width: 992px) {
  .app-sidebar { width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 1.25rem; border-bottom: 1px solid var(--line);
}
.brand-tag {
  font-size: .6875rem; font-weight: 700; letter-spacing: .04em;  /* « my » en minuscules (nom : myCODESRIA) */
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: .05rem .5rem;
}
.sidebar-nav { padding: .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  margin: 1rem .75rem .375rem; font-size: .6875rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted);
}
.nav-item-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem; border-radius: .5rem;
  color: var(--sidebar-ink); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.nav-item-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; color: var(--ink-muted); }
.nav-item-link:hover { background: var(--surface-muted); color: var(--ink); }
.nav-item-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-ink); }
.nav-item-link.active i { color: var(--sidebar-active-ink); }
.nav-item-link.disabled { opacity: .55; cursor: default; }
.nav-item-link.disabled:hover { background: transparent; color: var(--sidebar-ink); }
.soon-dot { margin-inline-start: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: .5rem;
  height: 64px; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--app-bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.lang-switch { display: flex; align-items: center; gap: .375rem; color: var(--ink-muted); }
.lang-switch .form-select { width: auto; border-radius: .5rem; padding-block: .3rem; }
.user-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .5rem .25rem .25rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.user-chip-name { max-width: 10rem; font-size: .875rem; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 600; letter-spacing: .02em;
}

.app-content { padding: 1.75rem 1.5rem 3rem; width: 100%; max-width: 1280px; margin-inline: auto; }
@media (max-width: 575.98px) { .app-content, .app-topbar { padding-inline: 1rem; } }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.page-subtitle { color: var(--ink-muted); margin: .25rem 0 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Pages de gestion du compte (allauth) */
.manage .app-content { max-width: 720px; }
.manage .auth-title { font-size: 1.375rem; }

/* --- Onglets ------------------------------------------------------------- */
.nav-tabs-modern { border-bottom: 1px solid var(--line); gap: .25rem; margin-bottom: 1.5rem; }
.nav-tabs-modern .nav-link {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--ink-muted); font-weight: 500; padding: .625rem .875rem; margin-bottom: -1px;
}
.nav-tabs-modern .nav-link:hover { color: var(--ink); }
.nav-tabs-modern .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }

/* --- Tableaux ------------------------------------------------------------ */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bs-border-radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-card .table { --bs-table-bg: transparent; margin: 0; }
.table-card thead th {
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-muted); background: var(--surface-muted); border-bottom-color: var(--line);
  padding-block: .75rem; white-space: nowrap;
}
.table-card td { padding-block: .8rem; border-color: var(--line); }
.table-card tbody tr:last-child td { border-bottom: 0; }
.cell-user { display: flex; align-items: center; gap: .75rem; }
.cell-user .avatar { width: 2.25rem; height: 2.25rem; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }

.status-dot { display: inline-flex; align-items: center; gap: .375rem; font-size: .8125rem; font-weight: 500; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-dot.on { color: #16a34a; }
.status-dot.off { color: var(--ink-muted); }

.filter-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bs-border-radius-lg); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* --- Tableau de bord ---------------------------------------------------- */
.welcome {
  position: relative; overflow: hidden;
  background: var(--hero-bg);
  color: #fff; border-radius: 1rem; padding: 1.75rem; margin-bottom: 2rem;
}
[data-bs-theme="dark"] .welcome { border: 1px solid var(--line); }
.welcome::after {
  content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 240px; height: 240px;
  border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .55), transparent 70%);
}
.welcome h1 { font-size: 1.625rem; font-weight: 700; margin: 0 0 .25rem; }
.welcome p { margin: 0; opacity: .85; }
.welcome .badge { background: rgba(255,255,255,.18); color: #fff; font-weight: 500; }

.section-title { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.section-title .count { font-size: .75rem; color: var(--ink-muted); font-weight: 500; }

.module-tile {
  position: relative; display: flex; flex-direction: column; gap: .75rem; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--bs-border-radius-lg);
  padding: 1.25rem; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(var(--accent-rgb), .35); }
.module-tile.is-planned:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
.module-icon {
  width: 2.75rem; height: 2.75rem; border-radius: .75rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.25rem;
}
.module-tile.is-planned .module-icon { background: var(--surface-muted); color: var(--ink-muted); }
.module-tile h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.module-tile h3 a { color: inherit; text-decoration: none; }
.module-tile p { font-size: .875rem; color: var(--ink-muted); margin: 0; }
.module-tile .tile-arrow { margin-top: auto; color: var(--accent); font-size: .875rem; font-weight: 500; }
[dir="rtl"] .tile-arrow .bi-arrow-right { display: inline-block; transform: scaleX(-1); }

/* --- Grille des autorisations ------------------------------------------- */
.perm-group { border: 1px solid var(--line); border-radius: .75rem; padding: .875rem 1rem; margin-bottom: .75rem; background: var(--surface); }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.perm-group-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9375rem; }
.perm-group-title i { color: var(--accent); }
.perm-group .form-check { margin-bottom: .25rem; }

.toggle-row { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .form-switch .form-check-input { width: 2.5rem; height: 1.25rem; cursor: pointer; }

/* --- Pages d'authentification ------------------------------------------ */
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(480px, 1fr) 1.1fr; } }
.auth-form-side { display: flex; flex-direction: column; padding: 1.5rem; background: var(--surface); }
@media (min-width: 576px) { .auth-form-side { padding: 2rem 3rem; } }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 2.5rem 0; }
.auth-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .5rem; }
.auth-card .form-control-lg { font-size: 1rem; }
.auth-footer { font-size: .75rem; color: var(--ink-muted); text-align: center; margin: 0; }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--ink-muted); font-size: .8125rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-provider {
  display: flex; align-items: center; justify-content: center; gap: .625rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 1rem;
}
.btn-provider:hover { background: var(--surface-muted); border-color: var(--ink-muted); color: var(--ink); }

.auth-hero {
  position: relative; align-items: center; justify-content: center; padding: 4rem; overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.12) 1px, transparent 0) 0 0 / 24px 24px,
    var(--hero-bg);
  color: #fff;
}
.auth-hero::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  inset-inline-end: -160px; bottom: -200px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .5), transparent 65%);
}
.auth-hero.has-image { background: var(--hero-image) center / cover no-repeat, var(--hero-bg); }
.auth-hero.has-image::before {  /* voile réglable dans les paramètres, pour garder le titre lisible */
  inset: 0; width: auto; height: auto; border-radius: 0;
  background: linear-gradient(to top, rgba(0,0,0,calc(var(--hero-overlay, 55%) + 10%)), rgba(0,0,0,var(--hero-overlay, 55%)));
}
.auth-hero.has-image .auth-hero-inner { align-self: flex-end; }
.auth-hero-inner { position: relative; max-width: 480px; }
.hero-kicker { display: inline-block; font-size: .875rem; font-weight: 700; letter-spacing: .04em; color: #d6b08c; margin-bottom: 1rem; }
.hero-title { font-size: 2.25rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; margin-bottom: 1rem; }
.hero-text { font-size: 1.0625rem; opacity: .85; margin-bottom: 2rem; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.hero-points li { display: flex; align-items: center; gap: .75rem; font-weight: 500; }
.hero-points i {
  width: 2.25rem; height: 2.25rem; border-radius: .625rem; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); font-size: 1.05rem;
}

/* --- Préférences : mode et couleur -------------------------------------- */
.mode-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.mode-choice { position: relative; display: flex; flex-direction: column; gap: .5rem; cursor: pointer; }
.mode-choice input { position: absolute; opacity: 0; }
.mode-preview {
  display: flex; gap: 4px; height: 64px; padding: 8px; border-radius: .75rem;
  border: 2px solid var(--line); transition: border-color .15s ease;
}
.mode-preview span { flex: 1; border-radius: .375rem; }
.mode-preview--light { background: #fafaf9; }
.mode-preview--light span:first-child { background: #fff; border: 1px solid #e7e5e4; flex: .45; }
.mode-preview--light span:last-child { background: #fff; border: 1px solid #e7e5e4; }
.mode-preview--dark { background: #0c0a09; }
.mode-preview--dark span:first-child { background: #1c1917; flex: .45; }
.mode-preview--dark span:last-child { background: #1c1917; }
.mode-preview--system { background: linear-gradient(90deg, #fafaf9 50%, #0c0a09 50%); }
.mode-preview--system span:first-child { background: #fff; border: 1px solid #e7e5e4; flex: .45; }
.mode-preview--system span:last-child { background: #1c1917; }
.mode-choice input:checked + .mode-preview { border-color: var(--accent); }
.mode-choice input:focus-visible + .mode-preview { box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .25); }
.mode-label { font-size: .8125rem; font-weight: 500; text-align: center; }

.swatches { display: flex; flex-wrap: wrap; gap: .625rem; }
.swatch { position: relative; cursor: pointer; }
.swatch input[type="radio"] { position: absolute; opacity: 0; }
.swatch-dot {
  display: block; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
  outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s ease;
}
.swatch input:checked + .swatch-dot { outline-color: var(--ink); }
[data-bs-theme="dark"] .swatch-dot { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.swatch input:focus-visible + .swatch-dot { outline-color: var(--accent); }
.swatch-custom {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px dashed var(--ink-muted); color: var(--ink-muted);
}
.swatch-custom input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.accent-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  padding: .875rem 1rem; border: 1px dashed var(--line); border-radius: .75rem;
}

/* --- Module Membres ------------------------------------------------------ */
.member-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 1rem; padding: 1.75rem;
  background: var(--hero-bg); box-shadow: var(--shadow-md);
}
.member-card::after {
  content: ""; position: absolute; inset-inline-end: -80px; bottom: -120px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .6), transparent 70%);
}
[data-bs-theme="dark"] .member-card { border: 1px solid var(--line); }
.member-card-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.member-card-badge { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 500; }
.member-card-meta { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 2rem; }
.member-card-meta span { display: block; font-size: .75rem; opacity: .7; text-transform: uppercase; letter-spacing: .05em; }
.member-card-meta strong { font-weight: 600; }
.plan-price { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.plan-price small { font-size: .8125rem; font-weight: 500; color: var(--ink-muted); }

.pay-methods { display: grid; gap: .5rem; }
.pay-method { position: relative; cursor: pointer; display: block; }
.pay-method input { position: absolute; opacity: 0; }
.pay-method-body {
  display: flex; align-items: center; gap: .75rem; padding: .75rem .875rem;
  border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); transition: border-color .15s ease, background .15s ease;
}
.pay-method-body > i { font-size: 1.25rem; color: var(--accent); }
.pay-method input:checked + .pay-method-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pay-method input:focus-visible + .pay-method-body { box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .25); }
.instructions { background: var(--surface-muted); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem 1.25rem; white-space: normal; }
.instructions p:last-child { margin-bottom: 0; }

.status-dot.pending { color: #d97706; }
.stat-tile {
  display: block; height: 100%; padding: 1rem 1.25rem; border-radius: var(--bs-border-radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none;
}
a.stat-tile:hover { border-color: rgba(var(--accent-rgb), .4); color: var(--ink); }
.stat-tile span { display: block; font-size: .8125rem; color: var(--ink-muted); margin-bottom: .25rem; }
.stat-tile strong { font-size: 1.625rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat-tile strong small { font-size: .8125rem; font-weight: 500; color: var(--ink-muted); }
.stat-tile.is-alert { border-color: rgba(217, 119, 6, .5); }
.stat-tile.is-alert strong { color: #d97706; }
.small-tile { padding: .75rem; } .small-tile strong { font-size: 1.25rem; }
.list-row { display: flex; align-items: center; gap: .75rem; padding: .625rem .25rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-muted); color: var(--ink); }
.list-row .avatar { width: 2rem; height: 2rem; background: var(--accent-soft); color: var(--accent); }
.payment-row { padding: .875rem 0; border-bottom: 1px solid var(--line); }
.payment-row:first-of-type { padding-top: 0; } .payment-row:last-child { border-bottom: 0; }
.detail-list { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: .5rem 1rem; margin: 0; font-size: .875rem; }
.detail-list dt { color: var(--ink-muted); font-weight: 500; } .detail-list dd { margin: 0; }
.min-w-0 { min-width: 0; }

/* --- Module Procédures -------------------------------------------------- */
.status-dot.returned { color: #d97706; }
.status-dot.rejected { color: #dc2626; }
.steps-mini { padding-inline-start: 1.1rem; margin: 0 0 1rem; display: grid; gap: .5rem; }
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper-item { position: relative; display: flex; gap: .875rem; padding-bottom: 1.25rem; }
.stepper-item:not(:last-child)::before {
  content: ""; position: absolute; inset-inline-start: 1rem; top: 2.1rem; bottom: .2rem; width: 2px; background: var(--line);
}
.stepper-dot {
  flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; font-weight: 600;
  background: var(--surface-muted); color: var(--ink-muted); border: 2px solid var(--line);
}
.stepper-item--done .stepper-dot { background: #16a34a; border-color: #16a34a; color: #fff; }
.stepper-item--current .stepper-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper-item--rejected .stepper-dot { background: #dc2626; border-color: #dc2626; color: #fff; }
.stepper-item--skipped { opacity: .55; }
.stepper-item--done:not(:last-child)::before { background: #16a34a; }
.event-list { list-style: none; margin: 0; padding: 0; }
.event { padding: .625rem 0 .625rem .875rem; border-inline-start: 3px solid var(--line); margin-bottom: .5rem; }
.event--approved, .event--completed, .event--auto_approved { border-color: #16a34a; }
.event--rejected { border-color: #dc2626; }
.event--returned { border-color: #d97706; }
.event--commented { border-color: var(--accent); }
.event--skipped { opacity: .6; }

/* --- Module Projets et tâches ------------------------------------------- */
.progress-line { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; border: 1px solid var(--line); }
.progress-line span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.prio { font-weight: 600; font-size: .6875rem; }
.prio-urgent { background: rgba(220, 38, 38, .12); color: #dc2626; }
.prio-high { background: rgba(217, 119, 6, .14); color: #b45309; }
.prio-low { background: var(--surface-muted); color: var(--ink-muted); border: 1px solid var(--line); }
[data-bs-theme="dark"] .prio-high { color: #f59e0b; }
.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: .625rem; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: var(--surface-muted); border: 1px solid var(--line); border-radius: var(--bs-border-radius-lg); padding: .75rem; display: flex; flex-direction: column; min-height: 320px; }
.kanban-col-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .875rem; margin-bottom: .75rem; }
.kanban-col-head .count { margin-inline-start: auto; font-size: .75rem; color: var(--ink-muted); font-weight: 500; }
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.kanban-dot--in_progress { background: #2563eb; } .kanban-dot--review { background: #d97706; } .kanban-dot--done { background: #16a34a; }
.kanban-list { display: flex; flex-direction: column; gap: .5rem; flex: 1; min-height: 40px; }
.kanban-card {
  display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border-radius: .625rem;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; cursor: grab;
}
.kanban-card:hover { border-color: rgba(var(--accent-rgb), .45); color: var(--ink); }
.kanban-card.is-dragging { opacity: .5; }
.kanban-card.is-overdue { border-inline-start: 3px solid #dc2626; }
.kanban-card-title { font-size: .875rem; font-weight: 500; line-height: 1.35; }
.kanban-card-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.kanban-add { margin-top: .5rem; }
.kanban-add .form-control { background: transparent; border-style: dashed; }
@media (max-width: 991.98px) { .kanban { grid-template-columns: repeat(4, 260px); } }

/* --- Signature électronique --------------------------------------------- */
.pdf-frame { width: 100%; height: 100%; border: 0; border-radius: var(--bs-border-radius-lg); background: var(--surface-muted); }
.signature-pad { border: 1px dashed var(--ink-muted); border-radius: .75rem; background: #fff; touch-action: none; }
.signature-pad canvas { width: 100%; height: auto; display: block; cursor: crosshair; }
.signer-row { display: flex; gap: .75rem; align-items: flex-start; padding: .625rem 0; border-bottom: 1px solid var(--line); }
.signer-row:last-of-type { border-bottom: 0; }
.signer-num { flex-shrink: 0; width: 1.75rem; height: 1.75rem; margin-top: .3rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .8125rem; }
.public .app-topbar { position: static; }

/* --- Module RH -------------------------------------------------------------- */
.leave-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; vertical-align: -1px; flex-shrink: 0; }
.leave-calendar th, .leave-calendar td { text-align: center; padding: .25rem .1rem; font-size: .75rem; min-width: 1.6rem; }
.leave-calendar .sticky-col { position: sticky; inset-inline-start: 0; background: var(--surface); text-align: start; min-width: 11rem; z-index: 1; white-space: nowrap; }
.leave-calendar .is-weekend, .leave-calendar .is-holiday { background: var(--surface-muted); }
.leave-cell { display: block; height: 1.25rem; border-radius: 3px; background: var(--leave); }
.leave-cell.is-pending { background: repeating-linear-gradient(45deg, var(--leave), var(--leave) 3px, transparent 3px, transparent 6px); border: 1px solid var(--leave); }
.guard-list { display: grid; gap: .5rem; max-height: 70vh; overflow-y: auto; }
.guard-row { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); }
.guard-row .avatar { width: 2.5rem; height: 2.5rem; background: var(--accent-soft); color: var(--accent); }

/* Recrutement : pipeline des candidatures par étape */
.pipeline { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.pipeline-col { flex: 0 0 15rem; background: var(--surface-muted); border: 1px solid var(--line); border-radius: .75rem; padding: .5rem; }
.pipeline-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .85rem; padding: .25rem .25rem .5rem; }
.pipeline-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: .5rem .75rem; margin-bottom: .5rem; color: inherit; text-decoration: none; }
.pipeline-card:hover { border-color: var(--accent, var(--bs-primary)); }
.hp-field { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Intranet */
.cat-pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 14%, transparent); }
.news-thumb { width: 72px; height: 52px; object-fit: cover; border-radius: .5rem; flex: 0 0 auto; }
.news-image { width: 100%; max-height: 380px; object-fit: cover; border-radius: .75rem; }
.news-body { line-height: 1.7; }
.date-box { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
  border: 1px solid var(--line); border-radius: .5rem; line-height: 1; flex: 0 0 auto; }
.date-box span { font-weight: 700; } .date-box small { font-size: .65rem; text-transform: uppercase; color: var(--ink-muted); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.month-head { background: var(--surface-muted); font-size: .72rem; font-weight: 600; text-align: center; padding: .35rem 0; text-transform: capitalize; }
.month-cell { background: var(--surface); min-height: 5.5rem; padding: .25rem; min-width: 0; }
.month-cell.other { background: var(--surface-muted); color: var(--ink-muted); }
.month-cell.today .month-day { background: var(--ink); color: var(--surface); border-radius: 999px; padding: 0 .4rem; }
.month-day { font-size: .75rem; font-weight: 600; }
.month-event { display: block; font-size: .7rem; margin-top: .15rem; padding: .05rem .3rem; border-radius: .25rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-decoration: none; color: var(--ink); border-inline-start: 3px solid var(--cat); background: color-mix(in srgb, var(--cat) 10%, transparent); }
.month-event.cancelled { text-decoration: line-through; opacity: .6; }
@media (max-width: 575.98px) { .month-cell { min-height: 3.5rem; } .month-event { font-size: 0; height: .4rem; padding: 0; } }
.list-row.active { background: var(--surface-muted); }
.unread-dot { width: .5rem; height: .5rem; border-radius: 999px; background: var(--bs-danger); flex: 0 0 auto; }
.chat .card-body { height: min(70vh, 640px); }
.chat-log { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .25rem; }
.chat-msg { max-width: 80%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: end; }
.chat-meta { font-size: .7rem; color: var(--ink-muted); }
.chat-bubble { display: inline-block; text-align: start; padding: .45rem .75rem; border-radius: .9rem; background: var(--surface-muted); border: 1px solid var(--line); overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.avatar-lg { width: 2.75rem; height: 2.75rem; font-size: .95rem; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent); }
.min-w-0 { min-width: 0; }
[dir="rtl"] .flip-rtl { display: inline-block; transform: scaleX(-1); }

/* Vie de l'institution */
.album-card { display: block; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; background: var(--surface); color: inherit; text-decoration: none; }
.album-card img, .album-empty { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-muted); font-size: 2rem; color: var(--ink-muted); }
.album-meta { display: block; padding: .5rem .75rem; }
.album-card:hover { border-color: var(--accent); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.photo-item { margin: 0; }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; background: var(--surface-muted); }
.support-btn { min-width: 3.5rem; }
.response-box { border-inline-start: 3px solid var(--accent); padding: .5rem 1rem; background: var(--surface-muted); border-radius: .5rem; }
.faq-item { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { cursor: pointer; font-weight: 500; }
.planning { overflow-x: auto; }
.planning-row { display: flex; align-items: stretch; min-width: 640px; border-bottom: 1px solid var(--line); }
.planning-label { flex: 0 0 11rem; padding: .5rem .5rem .5rem 0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planning-track { position: relative; flex: 1 1 auto; min-height: 2.5rem; display: flex; }
.planning-head .planning-track span { font-size: .7rem; color: var(--ink-muted); border-inline-start: 1px solid var(--line); padding-inline-start: .2rem; }
.planning-block { position: absolute; top: .35rem; bottom: .35rem; border-radius: .35rem; background: var(--ink); color: var(--surface); font-size: .7rem;
  padding: .1rem .35rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none; }
.planning-block.pending { background: repeating-linear-gradient(45deg, var(--bs-warning), var(--bs-warning) 6px, #f5c451 6px, #f5c451 12px); color: #1c1917; }

/* GED et wiki */
.doc-preview { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface-muted); }
.doc-preview-img { max-width: 100%; border-radius: .5rem; border: 1px solid var(--line); }
.wiki-content { line-height: 1.7; overflow-wrap: anywhere; }
.wiki-content h1, .wiki-content h2, .wiki-content h3 { margin-top: 1.5rem; }
.wiki-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.wiki-content th, .wiki-content td { border: 1px solid var(--line); padding: .35rem .6rem; }
.wiki-content pre, .wiki-content code { background: var(--surface-muted); border-radius: .35rem; }
.wiki-content pre { padding: .75rem; overflow-x: auto; }
.wiki-content blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 1rem; color: var(--ink-muted); }
.wiki-content img { max-width: 100%; }
.wiki-diff { font-size: .8rem; white-space: pre-wrap; background: var(--surface-muted); padding: .75rem; border-radius: .5rem; max-height: 70vh; overflow: auto; }
.wiki-diff .add { background: color-mix(in srgb, #16a34a 18%, transparent); display: block; }
.wiki-diff .del { background: color-mix(in srgb, #dc2626 18%, transparent); display: block; text-decoration: line-through; }

/* Recherche globale */
.topbar-search { position: relative; flex: 0 1 22rem; min-width: 0; }
.topbar-search .bi { position: absolute; inset-inline-start: .65rem; top: 50%; transform: translateY(-50%); color: var(--ink-muted); font-size: .85rem; }
.topbar-search input { padding-inline-start: 2rem; border-radius: 999px; background: var(--surface-muted); }
@media (max-width: 575.98px) { .topbar-search { flex-basis: 8rem; } }
.wiki-content h1 { font-size: 1.5rem; } .wiki-content h2 { font-size: 1.25rem; } .wiki-content h3 { font-size: 1.1rem; }
.wiki-content h4, .wiki-content h5, .wiki-content h6 { font-size: 1rem; }

/* Parc automobile */
.fleet-week th, .fleet-week td { min-width: 7rem; vertical-align: top; }
.fleet-week thead th.today { color: var(--accent); }
.fleet-chip { display: block; font-size: .72rem; padding: .1rem .35rem; margin-bottom: .2rem; border-radius: .3rem; background: var(--ink); color: var(--surface);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10rem; }
.fleet-chip.pending { background: var(--bs-warning); color: #1c1917; }

/* Soumissions */
.stat-bar { display: inline-block; width: 3rem; height: .4rem; margin-inline-end: .4rem; border-radius: 999px; vertical-align: middle;
  background: linear-gradient(to right, var(--accent) var(--w), var(--surface-muted) var(--w)); }

/* Lien public vers les appels (connexion, pied de page) */
.auth-calls { display: flex; align-items: center; gap: .75rem; width: 100%; margin: 1.5rem 0 0; padding: .75rem 1rem;
  border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .85rem; }
.auth-calls:hover { border-color: var(--accent); }
.auth-calls > .bi:first-child { font-size: 1.25rem; color: var(--accent); }
.auth-calls span { flex: 1 1 auto; color: var(--ink-muted); }
.auth-calls strong { color: var(--ink); }
.auth-footer a, .public-footer a { color: inherit; }
.public-footer { font-size: .75rem; color: var(--ink-muted); text-align: center; padding: 1.5rem 1rem; }
