/* Palette : accent #ED1F2F, gris #848484, noir #000, blanc #FFF */

:root {
  --brand-primary-rgb: 237, 31, 47;
  --brand-primary: #ED1F2F;
  --brand-primary-dark: #c41a28;
  --accent-warm: #e67e22;
  --neutral-muted: #848484;
  --neutral-surface-subtle: #f5f5f5;
  --black: #000000;
  --white: #ffffff;
  --carbon-dark: #111111;
  --carbon: #1a1a1a;
  --carbon-light: #2d2d2d;
  --carbon-border: #3d3d3d;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s ease;
  --header-height: 56px;
  --footer-height: 44px;
  --sidebar-width: 220px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* Décalage pour les ancres (éviter que le header masque le contenu) */
[id^="section-"] {
  scroll-margin-top: 5rem;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--black);
  background: var(--carbon);
}

/* Texte : variables dans theme.css (mode clair / sombre) */
body:not(.page-login) {
  color: var(--app-text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  z-index: 1000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--black);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-brand {
  color: var(--brand-primary);
}

.logo-text {
  color: var(--black);
}

/* Boutons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: all var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--white);
  color: var(--brand-primary);
  border-color: var(--white);
}

.btn-primary:hover {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

.btn-secondary:hover {
  background: var(--white);
  color: var(--brand-primary);
}

/* Sections */
.section {
  padding: 4rem 0;
}

.section-light {
  background: var(--neutral-surface-subtle);
}

.section h2 {
  font-size: 1.75rem;
  color: var(--brand-primary);
  margin-bottom: 2rem;
  text-align: center;
}

/* Cards À propos */
.apropos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--white);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(var(--brand-primary-rgb), 0.12);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-icon .card-icon-svg,
.card-icon svg {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--brand-primary);
}

.card h3 {
  font-size: 1.2rem;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--neutral-muted);
  font-size: 0.95rem;
}

/* Actualités */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.news-card {
  background: var(--white);
  padding: 1.75rem;
  border-radius: 8px;
  border-left: 4px solid var(--brand-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.news-date {
  font-size: 0.85rem;
  color: var(--neutral-muted);
  margin-bottom: 0.5rem;
}

.news-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.news-card p {
  font-size: 0.95rem;
  color: var(--neutral-muted);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.contact-block,
.join-block {
  background: var(--white);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.contact-block h2,
.join-block h2 {
  text-align: left;
  margin-bottom: 1rem;
}

.contact-info {
  list-style: none;
  margin-top: 1rem;
}

.contact-info li {
  margin-bottom: 0.5rem;
}

.contact-info a {
  color: var(--brand-primary);
  text-decoration: none;
}

.contact-info a:hover {
  text-decoration: underline;
}

.join-block .btn {
  margin-top: 1rem;
}

/* Footer */
.footer {
  background: var(--black);
  color: var(--white);
  padding: 2rem 0;
}

.footer-content {
  text-align: center;
}

.footer-content p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.footer-links a {
  color: var(--white);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ========== Page Login ========== */
.page-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--neutral-surface-subtle);
}

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

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-kicker {
  font-size: 0.9rem;
  color: var(--neutral-muted);
  margin-bottom: 0.25rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
}

.login-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 0.95rem;
  color: var(--neutral-muted);
  margin-bottom: 1.5rem;
}

.login-error {
  padding: 0.75rem;
  background: #fee;
  color: #c00;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.login-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.login-form input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 2.5rem;
}

.toggle-pwd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-pwd .icon-eye,
.toggle-pwd svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--neutral-muted);
}

.btn-login {
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  background: var(--brand-primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-login:hover:not(:disabled) {
  background: var(--brand-primary-dark);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--neutral-muted);
}

/* ========== Dashboard (outil interne) ========== */
/* Layout : header fixe + footer fixe (carbon) + sidebar gauche + contenu droite */
.page-dashboard {
  min-height: 100vh;
  background: var(--carbon);
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* Header fixe – fond carbon */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--carbon);
  border-bottom: 1px solid var(--carbon-border);
  z-index: 1000;
}

.main-header .header-inner {
  height: 100%;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--app-text);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-menu-btn:hover {
  background: var(--app-surface-hover-strong);
}

.sidebar-menu-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.main-header .header-datetime {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Date : même visuel que l'horloge, jour / mois / année séparés */
.main-header .header-date {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
  font-variant-numeric: tabular-nums;
}

.main-header .header-date .date-group {
  display: flex;
  align-items: center;
}

.main-header .header-date .date-digits {
  display: flex;
  align-items: center;
  gap: 0.05rem;
}

.main-header .header-date .date-digits .clock-digit-bubble {
  width: 1.2rem;
  height: 1.4rem;
  font-size: 0.85rem;
}

.main-header .header-date .date-digits .clock-digit-strip span {
  height: 1.4rem;
  line-height: 1.4rem;
}

.main-header .header-date .date-sep {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--app-header-sep);
  margin: 0 0.15rem;
  line-height: 1.4rem;
}

/* Horloge : minibulles par chiffre, défilement type cahier à spirale */
.main-header .header-clock {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
  font-variant-numeric: tabular-nums;
}

.clock-digit-bubble {
  position: relative;
  width: 1.5rem;
  height: 1.75rem;
  background: rgba(var(--brand-primary-rgb), 0.2);
  border: 1px solid rgba(var(--brand-primary-rgb), 0.5);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.main-header .header-date .clock-digit-bubble {
  background: rgba(120, 120, 120, 0.35);
  border-color: rgba(160, 160, 160, 0.5);
}

.clock-digit-spiral {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.3) 60%,
    transparent 100%
  );
  z-index: 2;
  border-radius: 6px 6px 0 0;
}

.clock-digit-strip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clock-digit-strip span {
  height: 1.75rem;
  line-height: 1.75rem;
  flex-shrink: 0;
}

.clock-sep {
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin: 0 0.05rem;
  line-height: 1;
}

.main-header .header-right {
  justify-self: end;
}

.main-header .site-name {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--app-text);
  text-decoration: none;
}

.main-header .logo-brand {
  color: var(--brand-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow: visible;
}

.layout-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.layout-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--app-line-medium);
  border-radius: 6px;
  color: var(--app-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.layout-toggle-btn:hover {
  background: var(--app-surface-hover-strong);
  color: var(--app-text);
  border-color: var(--app-text-faint);
}

.layout-toggle-btn[aria-pressed="true"] {
  background: rgba(var(--brand-primary-rgb), 0.35);
  color: #fff;
  border-color: var(--brand-primary);
}

.layout-toggle-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.user-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--app-text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.user-menu-trigger:hover {
  background: var(--app-surface-hover-strong);
  color: var(--app-text);
}

.user-menu-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
}

.user-menu-chevron {
  font-size: 0.65rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.35rem;
  min-width: 200px;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  box-shadow: var(--app-shadow-dropdown);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1100;
}

.user-menu-wrap.is-open .user-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.user-menu a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.user-menu a:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  color: var(--brand-primary);
}

.user-menu-logout {
  border-top: 1px solid var(--app-line-subtle);
  margin-top: 0.25rem;
  padding-top: 0.5rem !important;
  color: var(--brand-primary) !important;
}

.user-menu-logout:hover {
  background: rgba(var(--brand-primary-rgb), 0.25) !important;
  color: #ff4d5a !important;
}

.user-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--app-text-muted);
}

.user-icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--app-text-muted);
  flex-shrink: 0;
}

.user-role {
  font-size: 0.8rem;
  color: var(--neutral-muted);
}

.user-email {
  font-size: 0.85rem;
  color: var(--app-text-muted);
}

.btn-logout {
  font-size: 0.85rem;
  color: var(--brand-primary);
  text-decoration: none;
}

.db-status {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.db-status--ok {
  background: #22c55e;
}

.db-status--error {
  background: #ef4444;
}

.btn-logout:hover {
  text-decoration: underline;
  color: #ff4d5a;
}

/* Overlay sidebar (masqué sur desktop, utilisé sur mobile) */
.sidebar-overlay {
  display: none;
}

/* Sidebar à gauche */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: var(--footer-height);
  width: var(--sidebar-width);
  background: var(--carbon-light);
  border-right: 1px solid var(--carbon-border);
  overflow: visible;
  z-index: 500;
}

.sidebar-nav {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 100%;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--app-text-soft);
  font-size: 0.95rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover {
  background: var(--app-surface-hover);
  color: var(--app-text);
}

.sidebar-link.active {
  background: rgba(var(--brand-primary-rgb), 0.2);
  color: var(--brand-primary);
  border-left: 3px solid var(--brand-primary);
}

.sidebar-vault-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-vault-status .icon-vault-lock {
  width: 0.85rem;
  height: 0.85rem;
}

.sidebar-vault-status--locked .icon-vault-lock {
  color: #ffffff;
  opacity: 0.6;
}

.sidebar-vault-status--open .icon-vault-lock {
  color: #ffffff;
  opacity: 0.9;
}

.sidebar-link .sidebar-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
  color: var(--white);
  background: var(--brand-primary);
  border-radius: 10px;
}

/* Sous-menu Syndiqués (déroulant à droite au survol) */
.sidebar-item {
  position: relative;
}

.sidebar-item .sidebar-link {
  flex: 1;
}

.sidebar-chevron {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-left: auto;
}

.sidebar-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: -2px;
  min-width: 180px;
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - 0.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  box-shadow: var(--app-shadow-dropdown);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

.sidebar-item--has-submenu:hover .sidebar-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Pont invisible entre la ligne et le panneau latéral du sous-menu (desktop) : évite de perdre :hover.
   Le menu Décision seul a une pastille mise à jour par JS ; sans ce pont, un reflow peut aussi couper le survol. */
@media (min-width: 769px) {
  .sidebar-item--has-submenu::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 0;
    bottom: 0;
    width: 14px;
    z-index: 10000;
  }
  html.layout-force-mobile .sidebar-item--has-submenu::after {
    display: none;
  }
}

/* Sous-menu Paramètres en bas de la sidebar : s'ouvre vers le haut */
.sidebar-bottom .sidebar-submenu {
  top: auto;
  bottom: 0;
  transform: translateX(-8px) translateY(8px);
}
.sidebar-bottom .sidebar-item--has-submenu:hover .sidebar-submenu {
  transform: translateX(0) translateY(0);
}

.sidebar-submenu-link {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.sidebar-submenu-link:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  color: var(--brand-primary);
}

.sidebar-submenu-link.active {
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  font-weight: 500;
}

/* Bouton action dans la sidebar (ex: Nouvelle tâche) */
.sidebar-item--action {
  margin-top: 0.25rem;
}

.sidebar-link--button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  background: rgba(var(--brand-primary-rgb), 0.25);
  color: var(--brand-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link--button:hover {
  background: rgba(var(--brand-primary-rgb), 0.4);
  color: #fff;
}

.sidebar-link--button .nav-icon {
  flex-shrink: 0;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon .nav-icon-svg,
.nav-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Zone contenu à droite */
.main-content {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  padding: 1.5rem 2rem;
  overflow-y: auto;
  background: var(--carbon);
}

.page-inner h1 {
  font-size: 1.5rem;
  color: var(--app-heading);
  margin-bottom: 0.5rem;
}

.welcome-msg {
  color: var(--neutral-muted);
  margin-bottom: 2rem;
}

/* Bulle Actualité (tableau de bord) */
.dashboard-actualite {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 24px;
  padding: 2rem 2.5rem;
  margin-bottom: 1.5rem;
  min-height: 120px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.dashboard-actualite-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin: 0 0 0.5rem 0;
}

.dashboard-actualite-content {
  color: var(--app-text-soft);
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
}

.dashboard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-stat {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.dashboard-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.dashboard-stat-label {
  font-size: 0.95rem;
  color: var(--app-text-soft);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.page-inner .card {
  height: 100%;
  text-align: left;
}

.content-block {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.content-block h2 {
  font-size: 1.1rem;
  color: var(--brand-primary);
  margin-bottom: 0.75rem;
}

.simple-list,
.contact-list,
.aide-list {
  list-style: none;
}

.simple-list li,
.contact-list li,
.aide-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--neutral-surface-subtle);
}

.simple-list li:last-child,
.contact-list li:last-child,
.aide-list li:last-child {
  border-bottom: none;
}

.simple-list a,
.content-block a {
  color: var(--brand-primary);
  text-decoration: none;
}

.simple-list a:hover,
.content-block a:hover {
  text-decoration: underline;
}

/* Footer fixe – fond carbon, toujours visible */
.main-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--carbon);
  border-top: 1px solid var(--carbon-border);
  font-size: 0.85rem;
  color: var(--app-text-muted);
  z-index: 100;
}

/* Légende des couleurs – dans la sidebar, uniquement quand nécessaire */
.sidebar-legend {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-legend-title {
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
}

.sidebar-zones-vacances .sidebar-legend-item {
  cursor: help;
}

.sidebar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--app-text-soft);
}

.sidebar-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--legend-color);
  border: 1px solid var(--app-line-strong);
  flex-shrink: 0;
}

.sidebar-legend-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-legend-permanence {
  margin-top: auto;
  padding-top: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--carbon-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
}
.sidebar-legend-permanence .sidebar-legend-title {
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 0.1rem;
}
.sidebar-legend-permanence .sidebar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--app-text-soft);
}
.sidebar-legend-permanence .sidebar-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid var(--app-line-strong);
}
.perm-swatch-present {
  background: #2980b9;
}
.perm-swatch-conge {
  background: rgba(255, 200, 100, 0.95);
}

.sidebar-perm-presences {
  margin-top: 1rem;
  padding: 1rem 0.75rem 0.5rem 0.75rem;
  border-top: 1px solid var(--carbon-border);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-perm-presences-title {
  font-weight: 600;
  color: var(--app-text);
}
.sidebar-perm-presences-empty {
  color: var(--app-text-muted);
  font-size: 0.75rem;
  margin: 0;
}
.sidebar-perm-presences-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-perm-presences-list li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--app-text);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
}
.sidebar-perm-presences-list li:last-child {
  border-bottom: none;
}
.sidebar-perm-presences-list .perm-presence-name {
  font-weight: 500;
}
.sidebar-perm-presences-list .perm-presence-times {
  font-size: 0.72rem;
  color: var(--app-text-muted);
}
.sidebar-perm-presences-list li.perm-me .perm-presence-name {
  color: var(--brand-primary);
  font-weight: 600;
}

/* Contenu des pages – fond carbon, texte clair */

.welcome-msg {
  color: var(--app-text-muted);
}

.page-inner .card {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
}

.page-inner .card-link:hover .card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--brand-primary);
}

.page-inner .card h3 {
  color: var(--brand-primary);
}

.page-inner .card p {
  color: var(--app-text-soft);
}

.content-block {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
}

.content-block h2 {
  color: var(--brand-primary);
}

.content-block p,
.simple-list li,
.contact-list li,
.aide-list li {
  color: var(--app-text-soft);
}

.content-block h3 {
  font-size: 1rem;
  color: var(--app-text);
  margin: 1rem 0 0.5rem 0;
}

.simple-list li,
.contact-list li,
.aide-list li {
  border-bottom-color: var(--carbon-border);
}

.simple-list a,
.content-block a {
  color: var(--brand-primary);
}

.simple-list a:hover,
.content-block a:hover {
  color: #ff4d5a;
}

.content-link {
  color: var(--brand-primary);
  text-decoration: none;
}

.content-link:hover {
  text-decoration: underline;
  color: #ff4d5a;
}

/* Formulaires dashboard */
.form-msg {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.form-msg--success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.form-msg--error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.dashboard-form .form-group {
  margin-bottom: 1rem;
}

.dashboard-form .form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-form .form-row .form-group {
  flex: 1;
  min-width: 180px;
}

.dashboard-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--app-text);
  margin-bottom: 0.35rem;
}

.dashboard-form input[type="text"],
.dashboard-form input[type="email"],
.dashboard-form input[type="tel"],
.dashboard-form input[type="password"],
.dashboard-form input[type="number"],
.dashboard-form select {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.dashboard-form input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.dashboard-form .password-wrap {
  position: relative;
}

.dashboard-form .password-wrap input {
  padding-right: 2.5rem;
}

.dashboard-form .toggle-pwd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  opacity: 0.7;
}

.dashboard-form .toggle-pwd:hover {
  opacity: 1;
}

.dashboard-form .form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--neutral-muted);
  margin-top: 0.25rem;
}

/* Palette couleur utilisateur */
.user-color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.user-color-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}
.user-color-swatch:hover:not(.taken) {
  transform: scale(1.1);
}
.user-color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.user-color-swatch .user-color-dot {
  display: block;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.user-color-swatch.selected {
  border-color: rgba(255,255,255,0.9);
  box-shadow: 0 0 0 2px var(--carbon-border);
}
.user-color-swatch.taken {
  cursor: not-allowed;
  opacity: 0.55;
}

.dashboard-form .required {
  color: var(--brand-primary);
}

.dashboard-form .btn {
  margin-top: 0.5rem;
}

/* Page Membres – bulles par rôle, identiques, centrées */
.membres-bulles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.membres-bulle {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--carbon-border);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.membres-bulle-titre {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(var(--brand-primary-rgb), 0.4);
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.membres-bulle-noms {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  text-align: center;
}

.membres-bulle-nom {
  font-size: 0.9rem;
  color: var(--app-text);
}

.membres-bulle-vide {
  font-size: 0.85rem;
  color: var(--neutral-muted);
  font-style: italic;
}

/* Commission Exécutive – grande bulle avec petites bulles par membre */
.membres-bulle-ce {
  min-height: auto;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  align-items: start;
}

@media (min-width: 480px) {
  .membres-bulle-ce {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 768px) {
  .membres-bulle-ce {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.membres-ce-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  padding: 0.6rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid var(--carbon-border);
}

.membres-ce-name {
  font-size: 0.85rem;
  color: var(--app-text);
  font-weight: 500;
}

.membres-ce-roles {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--brand-primary);
}

/* Configuration mandats (Paramètres) – bulles compactes et responsives */
.mandats-config-form .mandats-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
  .mandats-config-form .mandats-config-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (min-width: 768px) {
  .mandats-config-form .mandats-config-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .mandats-config-form .mandats-config-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.mandats-config-group {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--carbon-border);
}

.mandats-config-categorie {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin: 0 0 0.4rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(var(--brand-primary-rgb), 0.4);
}

.mandats-config-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.mandats-config-row:last-child {
  margin-bottom: 0;
}

.mandats-config-row label {
  flex: 1;
  margin-bottom: 0;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--app-text);
}

.mandats-config-form .mandats-config-row input[type="number"] {
  width: 3rem !important;
  min-width: 3rem;
  max-width: 3.5rem;
  padding: 0.3rem 0.35rem;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
  background: var(--white) !important;
  color: var(--black) !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.mandats-config-form .mandats-config-row input[type="number"]::-webkit-outer-spin-button,
.mandats-config-form .mandats-config-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mandats-config-form .mandats-config-row input[type="number"]:focus {
  outline: 2px solid var(--brand-primary);
  outline-offset: 1px;
  border-color: var(--brand-primary);
}

.mandats-config-count {
  font-size: 0.72rem;
  color: var(--app-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Gestion des rôles (Paramètres) */
.mandats-manage-group {
  background: rgba(0, 0, 0, 0.15);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.mandats-manage-group:last-child {
  margin-bottom: 0;
}

.mandats-manage-list {
  list-style: none;
  margin: 0 0 0.75rem 0;
}

.mandats-manage-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mandats-manage-item:last-child {
  border-bottom: none;
}

.mandats-manage-label {
  flex: 1;
  color: var(--app-text);
}

.mandats-manage-count {
  font-size: 0.8rem;
  color: var(--app-text-muted);
}

.mandats-manage-delete {
  margin-left: auto;
}

.mandats-manage-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.mandats-manage-input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
}

/* Accès aux pages par profil (Paramètres) */
.profile-pages-form {
  margin-top: 1rem;
}

.profile-pages-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.profile-pages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.profile-pages-table th,
.profile-pages-table td {
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--app-line-subtle);
  text-align: center;
  color: var(--app-text);
}

.profile-pages-table thead th {
  background: rgba(0, 0, 0, 0.35);
  color: var(--brand-primary);
  font-weight: 600;
  white-space: nowrap;
}

.profile-pages-col-page {
  text-align: left !important;
  min-width: 200px;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
  color: var(--app-text);
}

.profile-pages-col-profile {
  width: 168px;
  min-width: 168px;
  max-width: 168px;
}

.profile-pages-col-admin {
  background: rgba(0, 0, 0, 0.5) !important;
  color: var(--app-text-soft);
}

.profile-pages-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.25rem;
}

.profile-pages-check-wrap input {
  width: 1.35rem;
  height: 1.35rem;
  min-width: 1.35rem;
  min-height: 1.35rem;
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.profile-pages-check-label {
  display: none;
}

/* Blocs par groupe de pages */
.profile-pages-group {
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-pages-group:last-of-type {
  border-bottom: none;
}

.profile-pages-group-header td {
  padding: 0.45rem 0.5rem !important;
  background: rgba(0, 0, 0, 0.4) !important;
  color: var(--brand-primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-pages-group-title {
  text-align: left !important;
}

.btn-danger {
  background: var(--brand-primary);
  color: var(--white);
  border: 1px solid var(--brand-primary);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: var(--white);
}

/* Table utilisateurs – en-têtes fixes au scroll de la page */
.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.users-table th,
.users-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--carbon-border);
}

.users-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--carbon-light);
  font-weight: 600;
  color: var(--brand-primary);
  box-shadow: 0 1px 0 var(--carbon-border);
}

.users-table td {
  color: var(--app-text-soft);
}

.users-table .actions-cell,
.users-table .statut-cell {
  white-space: nowrap;
}

.users-table .statut-cell .user-toggle-form {
  margin-left: 0.5rem;
  display: inline;
}

.users-table .user-row-form {
  display: inline;
}

.users-table-input,
.users-table-select {
  width: 100%;
  min-width: 120px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  color: var(--app-text);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
}

.users-table-input:focus,
.users-table-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: rgba(0, 0, 0, 0.3);
}

.users-table-select {
  cursor: pointer;
}

.users-table .inline-form {
  display: inline;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

/* Associé : vert = oui, gris = non */
.checkbox-associe {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.checkbox-associe--yes {
  color: #22c55e;
}
.checkbox-associe--yes input[type="checkbox"] {
  accent-color: #22c55e;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}
.checkbox-associe--no {
  color: #6b7280;
}
.checkbox-associe--no input[type="checkbox"] {
  accent-color: #6b7280;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

/* Droits accès – tableau style Excel */
.droits-acces-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}
.droits-acces-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.droits-acces-table th,
.droits-acces-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border: 1px solid var(--carbon-border);
}
.droits-acces-table th {
  background: var(--carbon-light);
  font-weight: 600;
  color: var(--brand-primary);
}
.droits-acces-table td {
  color: var(--app-text-soft);
  vertical-align: middle;
}
.droits-acces-table .col-user {
  min-width: 160px;
  font-weight: 500;
}
.droits-acces-table .col-right {
  text-align: center;
  min-width: 90px;
}
.droits-acces-table .col-actions {
  white-space: nowrap;
}
.droits-role {
  font-size: 0.85rem;
  color: var(--app-text-muted);
  font-weight: normal;
  margin-left: 0.35rem;
}
.droits-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.droits-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
}
.droits-check {
  color: var(--brand-primary);
  font-weight: bold;
}
.droits-save-form {
  display: inline;
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--brand-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0 0.25rem;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
  color: #ff4d5a;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge--active {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.badge--inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Page Syndiqués */
.syndiques-toolbar {
  margin-bottom: 1rem;
}

.syndiques-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.syndiques-search .search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.syndiques-search .search-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border: 1px solid var(--carbon-border);
}

.btn-secondary:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.syndiques-count {
  font-size: 0.9rem;
  color: var(--neutral-muted);
  margin-bottom: 1rem;
}

.syndiques-empty {
  color: var(--app-text-muted);
}

/* Pages Actifs / Retraités – liste mobile nom, email, tél */
.syndiques-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.syndiques-mobile-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--carbon-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
}
.syndiques-mobile-item:last-child {
  border-bottom: none;
}
.syndiques-mobile-name {
  font-weight: 600;
  width: 100%;
  flex-shrink: 0;
  color: var(--app-text);
}
.syndiques-mobile-email,
.syndiques-mobile-tel {
  font-size: 0.9rem;
  color: var(--brand-primary);
  text-decoration: none;
}
.syndiques-mobile-email:hover,
.syndiques-mobile-tel:hover {
  text-decoration: underline;
}
.syndiques-mobile-empty {
  color: var(--app-text-faint);
}
.syndiques-search--compact {
  margin-bottom: 1rem;
}

.syndiques-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.syndiques-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.syndiques-table th,
.syndiques-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--carbon-border);
}

.syndiques-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--carbon-light);
  font-weight: 600;
  color: var(--brand-primary);
  box-shadow: 0 1px 0 var(--carbon-border);
}

.syndiques-table td {
  color: var(--app-text-soft);
}

.syndique-row {
  cursor: pointer;
  transition: background var(--transition);
}

.syndique-row:hover {
  background: rgba(var(--brand-primary-rgb), 0.08);
}

.syndiques-pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.syndiques-pagination .pagination-info {
  color: var(--neutral-muted);
  font-size: 0.9rem;
}

.syndiques-pagination a {
  color: var(--brand-primary);
  text-decoration: none;
}

.syndiques-pagination a:hover {
  text-decoration: underline;
  color: #ff4d5a;
}

/* Page Mandats / Rôles – Barre de sélection de vue (dropdown au survol) */
.mandats-vue-bar {
  margin-bottom: 1rem;
}

.mandats-vue-dropdown {
  position: relative;
  display: inline-block;
}

.mandats-vue-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  color: var(--app-text);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.mandats-vue-trigger:hover {
  background: rgba(var(--brand-primary-rgb), 0.15);
  border-color: var(--brand-primary);
}

.mandats-vue-chevron {
  font-size: 0.7rem;
  opacity: 0.8;
}

.mandats-vue-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.4rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.mandats-vue-dropdown:hover .mandats-vue-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mandats-vue-link {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.mandats-vue-link:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  color: var(--brand-primary);
}

.mandats-vue-link.is-active {
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  font-weight: 500;
}

.mandats-form {
  margin: 0;
}

.mandats-search-wrap {
  margin-bottom: 1rem;
}

.mandats-search-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--neutral-muted);
}

.mandats-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.mandats-search-input {
  width: 100%;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
  color: inherit;
}

.mandats-save-btn {
  flex-shrink: 0;
}

.mandats-search-input::placeholder {
  color: var(--neutral-muted);
}

.mandats-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.mandats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mandats-table th,
.mandats-table td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--carbon-border);
  vertical-align: middle;
}

.mandats-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 600;
  color: var(--brand-primary);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 1px 0 var(--carbon-border);
}

.mandats-table tbody tr:nth-child(even) td:not(.mandats-col-syndique) {
  background: rgba(255, 255, 255, 0.02);
}

.mandats-table tbody tr:hover td:not(.mandats-col-syndique) {
  background: rgba(var(--brand-primary-rgb), 0.06);
}

.mandats-col-syndique {
  min-width: 180px;
  max-width: 220px;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 2px solid var(--carbon-border);
}

.mandats-table thead th.mandats-col-syndique {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 1px 1px 0 var(--carbon-border);
}

.mandats-table tbody td.mandats-col-syndique {
  background: var(--carbon);
}

.mandats-table tbody tr:nth-child(even) td.mandats-col-syndique {
  background: var(--app-row-hover);
}

.mandats-table tbody tr:hover td.mandats-col-syndique {
  background: rgba(var(--brand-primary-rgb), 0.08);
}

.mandats-col-mandat {
  max-width: 9rem;
  min-width: 6rem;
  padding: 0.4rem 0.35rem;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
  font-size: 0.75rem;
  text-align: center;
  vertical-align: bottom;
  hyphens: auto;
  min-height: 3.6em;
}

.mandats-table thead th.mandats-col-mandat {
  white-space: normal;
}

.mandats-col-check {
  text-align: center;
  width: 3.75rem;
  min-width: 3.75rem;
}

.mandats-syndique-name {
  display: block;
  font-weight: 500;
  color: var(--app-text);
}

.mandats-syndique-entite {
  display: block;
  font-size: 0.75rem;
  color: var(--neutral-muted);
  margin-top: 0.15rem;
}

.mandats-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
}

.mandats-check-wrap input {
  position: absolute;
  opacity: 0;
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
  margin: 0;
}

.mandats-check-visual {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--carbon-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  transition: background var(--transition), border-color var(--transition);
}

.mandats-check-wrap input:checked + .mandats-check-visual {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.mandats-check-wrap input:focus + .mandats-check-visual {
  box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.5);
}

.mandats-check-display {
  color: var(--neutral-muted);
  font-size: 1rem;
}

.mandats-col-save {
  width: 1%;
  white-space: nowrap;
  padding: 0.4rem 0.5rem !important;
}

.mandats-row-form {
  margin: 0;
  display: flex;
  justify-content: center;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* Trésorerie - sous-menu et tableaux */
.tresorerie-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--carbon-border);
}

.tresorerie-subnav-link {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--neutral-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.tresorerie-subnav-link:hover {
  color: var(--white);
  background: rgba(var(--brand-primary-rgb), 0.15);
}

.tresorerie-subnav-link.active {
  color: var(--white);
  background: rgba(var(--brand-primary-rgb), 0.25);
}

/* Module Mail — liste + lecture */
.mail-app {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 178px);
  min-height: 520px;
}

.mail-app-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.mail-toolbar-hint {
  font-size: 0.8rem;
  color: var(--neutral-muted);
  line-height: 1.35;
}

.mail-app-columns {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 0;
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: var(--carbon-panel, rgba(0, 0, 0, 0.2));
}

.mail-list-panel {
  border-right: 1px solid var(--carbon-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mail-list-loading,
.mail-list-empty {
  padding: 1rem 0.85rem;
  color: var(--neutral-muted);
  font-size: 0.9rem;
}

.mail-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.mail-thread-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--carbon-border);
  cursor: pointer;
  transition: background var(--transition);
}

.mail-thread-item:hover {
  background: rgba(var(--brand-primary-rgb), 0.08);
}

.mail-thread-item.is-active {
  background: rgba(var(--brand-primary-rgb), 0.16);
  border-left: 3px solid var(--brand-primary, #ed1f2f);
  padding-left: calc(0.85rem - 3px);
}

.mail-thread-item.is-unread .mail-item-subject {
  font-weight: 700;
}

.mail-thread-item.is-unread::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-primary, #ed1f2f);
  margin-right: 0.4rem;
  flex-shrink: 0;
  vertical-align: middle;
  margin-bottom: 1px;
}

.mail-item-subject {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.18rem;
  color: var(--app-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-item-meta {
  display: block;
  font-size: 0.74rem;
  color: var(--neutral-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-item-preview {
  display: block;
  font-size: 0.76rem;
  color: var(--neutral-muted);
  margin-top: 0.25rem;
  opacity: 0.85;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mail-item-by {
  font-weight: 500;
  opacity: 0.9;
}

.mail-read-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mail-read-article {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mail-read-header {
  flex-shrink: 0;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--carbon-border);
  background: rgba(0, 0, 0, 0.12);
}

.mail-read-subject {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--white);
}

.mail-read-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.6rem;
  font-size: 0.8rem;
}

.mail-meta-label {
  color: var(--neutral-muted);
  white-space: nowrap;
  padding-top: 0.05rem;
}

.mail-meta-value {
  color: var(--text-secondary, #ccc);
  word-break: break-word;
  min-width: 0;
}

.mail-read-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}

.mail-read-body .mail-read-pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: inherit;
}
.mail-read-body .mail-read-pre a {
  color: var(--brand-primary);
  text-decoration: underline;
  word-break: break-all;
}

.mail-compose-form .mail-input-wide {
  max-width: 100%;
  width: 100%;
}

.mail-body-textarea {
  min-height: 12rem;
  font-family: inherit;
}

.tresorerie-setup-msg,
.tresorerie-empty {
  color: var(--neutral-muted);
  font-style: italic;
}

.tresorerie-year-form {
  margin-bottom: 0;
  display: flex;
  align-items: stretch;
}

.tresorerie-year-form label {
  margin-right: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

.tresorerie-year-form select {
  padding: 0 0.6rem;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: inherit;
  min-height: 2.5rem;
  height: 2.5rem;
}

.tresorerie-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
  margin-top: 1rem;
}

.tresorerie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tresorerie-table th,
.tresorerie-table td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--carbon-border);
  vertical-align: middle;
}

.tresorerie-table th {
  font-weight: 600;
  color: var(--brand-primary);
  background: rgba(0, 0, 0, 0.2);
}

.tresorerie-table-checkboxes thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--carbon-light);
  box-shadow: 0 1px 0 var(--carbon-border);
}

.tresorerie-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.tresorerie-table tbody tr:hover td {
  background: rgba(var(--brand-primary-rgb), 0.06);
}

.tresorerie-col-num {
  text-align: center;
}

.tresorerie-col-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tresorerie-reste--du {
  color: #f5a623;
  font-weight: 600;
}

.tresorerie-filtre-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tresorerie-filtre-wrap .tresorerie-filtre-btn,
.tresorerie-filtre-wrap .tresorerie-year-form select,
.tresorerie-filtre-wrap .btn {
  height: 2.5rem;
  min-height: 2.5rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.tresorerie-filtre-wrap .btn {
  padding-left: 1rem;
  padding-right: 1rem;
}

.tresorerie-filtre-btns {
  display: flex;
  gap: 0.25rem;
  align-items: stretch;
}

.tresorerie-filtre-btn {
  padding: 0 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  color: var(--app-text-muted);
  text-decoration: none;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tresorerie-filtre-btn:hover {
  color: var(--white);
  background: rgba(var(--brand-primary-rgb), 0.15);
  border-color: rgba(var(--brand-primary-rgb), 0.4);
}

.tresorerie-filtre-btn.active {
  color: var(--white);
  background: rgba(var(--brand-primary-rgb), 0.25);
  border-color: var(--brand-primary);
}

.tresorerie-form-inline {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tresorerie-form-inline label {
  display: flex;
  align-items: center;
  margin: 0;
  margin-right: 0.25rem;
}

.tresorerie-form-actions {
  margin: 1rem 0 0;
}

.tresorerie-table-checkboxes thead th.tresorerie-col-name {
  left: 0;
  z-index: 4;
  background: var(--carbon-light);
  box-shadow: 1px 1px 0 var(--carbon-border);
}

.tresorerie-table-checkboxes .tresorerie-col-name {
  min-width: 180px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--carbon);
  border-right: 2px solid var(--carbon-border);
}

.tresorerie-table-checkboxes .tresorerie-col-check {
  text-align: center;
  width: 3rem;
  min-width: 3rem;
  padding: 0.35rem;
}

.tresorerie-entite {
  display: block;
  font-size: 0.75rem;
  color: var(--neutral-muted);
  margin-top: 0.15rem;
}

.tresorerie-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
}

.tresorerie-check-wrap input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tresorerie-check-visual {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--carbon-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  transition: background var(--transition), border-color var(--transition);
}

.tresorerie-check-wrap input:checked + .tresorerie-check-visual {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.tresorerie-check-wrap input:focus + .tresorerie-check-visual {
  box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.5);
}

.tresorerie-check-display {
  color: var(--neutral-muted);
  font-size: 1rem;
}

.syndique-link {
  color: var(--brand-primary);
  text-decoration: none;
}

.syndique-link:hover {
  text-decoration: underline;
  color: #ff4d5a;
}

.syndique-popup {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.syndique-dialog:not([open]) {
  display: none;
}

.syndique-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--carbon-border);
  flex-shrink: 0;
}

.syndique-popup-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand-primary);
}

.syndique-popup-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.syndique-popup-close:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.syndique-popup-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.syndique-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
}

.syndique-form-grid .form-group {
  margin-bottom: 0;
}

.syndique-form-grid label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--neutral-muted);
  margin-bottom: 0.25rem;
}

.syndique-form-grid input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.syndique-form-grid input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.syndique-form-grid input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.syndique-popup-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}

/* Page édition syndiqué (remplace la popup) */
.syndique-edit-form .syndique-form-grid {
  margin-bottom: 1rem;
}

.syndique-edit-form .syndique-form-grid input {
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
}

.syndique-edit-form input:disabled,
.syndique-edit-form input[readonly] {
  opacity: 0.8;
}

.syndique-edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--carbon-border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--app-text-soft);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--white);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-form {
  padding: 1.25rem;
}

.dashboard-form .form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}

.modal-form .form-group {
  margin-bottom: 1rem;
}

.modal-form input[type="password"] {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.modal-form input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.modal-form .password-wrap {
  position: relative;
}

.modal-form .password-wrap input {
  padding-right: 2.5rem;
}

.modal-form .toggle-pwd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  opacity: 0.7;
}

.modal-form .modal-user-email {
  margin: 0.5rem 0 0;
  color: var(--app-text);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.modal-actions .btn {
  margin-top: 0;
}

/* Modal remplacement mandat (limite atteinte) */
.mandats-replace-modal-inner {
  max-width: 480px;
}

.mandats-replace-body {
  padding: 1rem 1.25rem;
}

.mandats-replace-body p {
  margin: 0 0 1rem 0;
  color: var(--app-text);
}

.mandats-replace-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mandats-replace-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.mandats-replace-name {
  flex: 1;
  color: var(--app-text);
}

.mandats-replace-actions {
  margin-top: 0.5rem;
}

/* Zone d'import Excel (glisser-déposer) */
.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 1.5rem;
  margin: 1rem 0;
  border: 2px dashed var(--carbon-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.import-dropzone:hover,
.import-dropzone:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.08);
}

.import-dropzone--active {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.12);
}

.import-dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.import-dropzone-text {
  font-weight: 500;
  color: var(--app-text);
  margin-bottom: 0.25rem;
}

.import-dropzone-sub {
  font-size: 0.9rem;
  color: var(--neutral-muted);
}

.import-last-date {
  font-size: 0.9rem;
  color: var(--neutral-muted);
  margin-bottom: 0.5rem;
}

.import-last-date-empty {
  font-style: italic;
  opacity: 0.8;
}

.import-status {
  font-size: 0.95rem;
  color: var(--app-text-soft);
  margin-top: 0.75rem;
}

.import-status--error {
  color: #fca5a5;
}

.import-errors {
  display: none;
  font-size: 0.85rem;
  color: #fca5a5;
  margin-top: 0.5rem;
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  .dashboard-form .form-row {
    flex-direction: column;
  }

  .users-table th,
  .users-table td {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
}

/* Calendrier – vue mensuelle, plein écran responsive */
/* Quand la page calendrier est active : main remplit la hauteur, calendrier scroll si besoin */
body.page-calendrier-active .main-content {
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  height: calc(100vh - var(--header-height) - var(--footer-height));
  max-height: calc(100vh - var(--header-height) - var(--footer-height));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.page-calendrier-active .main-content .page-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-calendrier {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.page-calendrier h1 {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.calendar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  padding: 1rem;
  width: 100%;
}

.calendar-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.calendar-title {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--app-heading);
  margin: 0;
}

.calendar-nav {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-surface-hover-strong);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
  font-size: 1.35rem;
  cursor: pointer;
  transition: background var(--transition);
}

.calendar-nav:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.calendar-btn-today {
  width: auto;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.calendar-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.calendar-weekdays {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 0.35rem;
}

.calendar-weekdays span {
  text-align: center;
  font-size: clamp(0.75rem, 1.6vw, 0.9rem);
  font-weight: 600;
  color: var(--neutral-muted);
}

.calendar-weekdays span.cal-weekday-weekend {
  background: rgba(148, 152, 160, 0.14);
  color: var(--app-text-soft);
  border-radius: 4px;
  padding:0.2rem 0;
}

.calendar-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(50px, 1fr);
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  color: var(--app-text);
}

.cal-day .cal-num {
  padding: 0.25rem 0 0 0.35rem;
  line-height: 1;
}

.cal-day-events {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.2rem 0.35rem 0.35rem;
}

.cal-day-events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  overflow: visible;
}

.cal-day-ev {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1.3;
  border-radius: 4px;
  border-left: 3px solid transparent;
  background: var(--app-surface-hover-strong);
  color: var(--app-text);
}

.cal-day-ev-f1 { border-left-color: var(--brand-primary); background: rgba(var(--brand-primary-rgb), 0.2); }
.cal-day-ev-f2 { border-left-color: #2980b9; background: rgba(41, 128, 185, 0.2); }
.cal-day-ev-f3 { border-left-color: #27ae60; background: rgba(39, 174, 96, 0.2); }
.cal-day-ev-f4 { border-left-color: #e67e22; background: rgba(230, 126, 34, 0.2); }
.cal-day-ev-f5 { border-left-color: #8e44ad; background: rgba(142, 68, 173, 0.2); }
.cal-day-ev-f6 { border-left-color: #1abc9c; background: rgba(26, 188, 156, 0.2); }
.cal-day-ev-f7 { border-left-color: #95a5a6; background: rgba(149, 165, 166, 0.2); }
.cal-day-ev-f0 { border-left-color: #7f8c8d; background: rgba(127, 140, 141, 0.15); }

.cal-day-ev-user {
  border-left-color: var(--ev-user-color, #7f8c8d) !important;
  background: rgba(255,255,255,0.08) !important;
}

.cal-day-ev-perm { border-left-color: #2980b9; background: rgba(41, 128, 185, 0.25); }

.perm-legend {
  flex-shrink: 0;
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

.perm-day-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}
.perm-bar-item {
  position: relative;
  height: 5.5px;
  min-width: 0;
}
.perm-bar-track {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.perm-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  background: #2980b9;
  border-radius: 3px;
  min-width: 2px;
  overflow: hidden;
}
.perm-bar-name {
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 5px;
  max-width: 100%;
  line-height: 1;
}
.perm-bar-more {
  font-size: 0.65rem;
  color: var(--app-text-muted);
  padding: 0.1rem 0;
}

.perm-day-conges {
  margin-top: 4px;
  padding-top: 3px;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
  font-size: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: center;
}
.perm-conge-name {
  font-style: italic;
  color: rgba(255, 200, 100, 0.95);
  background: rgba(180, 120, 40, 0.35);
  padding: 1px 4px;
  border-radius: 2px;
}
.perm-conge-more {
  font-style: italic;
  color: rgba(255, 200, 100, 0.8);
  font-size: 0.6rem;
}
.perm-popup-conges-title {
  font-size: 0.9rem;
  margin: 1rem 0 0.4rem 0;
  color: var(--app-text-soft);
}
.perm-popup-conges-title + .cal-popup-events-empty {
  margin-top: 0;
}
.perm-conge-item .perm-popup-name {
  font-style: italic;
  color: rgba(255, 200, 100, 0.95);
}
/* Popup Permanence – compacte */
.perm-popup {
  max-width: 480px;
}
.perm-popup .cal-popup-header {
  padding: 0.9rem 1.25rem;
}
.perm-popup .cal-popup-divider {
  margin: 0;
}
.perm-popup-body {
  padding: 1rem 1.25rem;
}
.perm-popup-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.perm-admin-for-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--carbon-border);
}
.perm-admin-label {
  font-size: 0.85rem;
  color: var(--app-text-soft);
  margin: 0;
  white-space: nowrap;
}
.perm-for-user-select {
  flex: 1;
  min-width: 0;
  max-width: 180px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  background: var(--app-surface-hover-strong);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}
.perm-popup-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.perm-popup-block {
  min-width: 0;
}
.perm-popup-h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 0.35rem 0;
}
.perm-popup-block .cal-popup-events-empty {
  font-size: 0.8rem;
  margin: 0;
}
.perm-popup-block .cal-popup-events-list {
  margin: 0.25rem 0 0;
  padding-left: 1rem;
  font-size: 0.85rem;
}
.perm-popup-block .cal-popup-events-list li {
  margin-bottom: 0.4rem;
  padding-bottom: 0.35rem;
}
.perm-forms-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--carbon-border);
}
.perm-form-block {
  min-width: 0;
}
.perm-form-h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.4rem 0;
  color: var(--app-text);
}
.perm-form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.perm-form-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.perm-form-group label {
  font-size: 0.8rem;
  color: var(--app-text-soft);
  white-space: nowrap;
}
.perm-form-group input {
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--app-text);
}
.perm-form-block .perm-conges-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.4rem 0;
  font-size: 0.8rem;
}
.perm-form-block .perm-conge-period-item {
  padding: 0.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.perm-form-block .perm-conge-delete {
  padding: 0 2px;
  font-size: 1.1rem;
}
@media (max-width: 480px) {
  .perm-popup-row,
  .perm-forms-row {
    grid-template-columns: 1fr;
  }
}

.perm-my-conges-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}
.perm-my-conges-wrap h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 0.5rem 0;
}
.perm-conges-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem 0;
}
.perm-conge-period-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--app-text-soft);
}
.perm-conge-delete {
  background: none;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 4px;
}
.perm-conge-delete:hover {
  color: #e74c3c;
}

.perm-popup-times {
  font-size: 0.9em;
  color: var(--app-text-muted);
  margin-left: 0.5rem;
}

.perm-my-presence-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}
.perm-my-presence-wrap h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 0.75rem 0;
}
.perm-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.perm-form-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.perm-form-row label {
  font-size: 0.9rem;
  color: var(--app-text-soft);
}
.perm-form-row input[type="time"] {
  padding: 0.4rem 0.5rem;
  font-size: 0.95rem;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--app-text);
}
.perm-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.cal-popup-event-item.perm-me {
  font-weight: 600;
  color: var(--brand-primary);
}

.cal-day-ev-multi {
  position: relative;
  z-index: 2;
}
.cal-day-ev-span-2 { width: calc(200% + 0.25rem); max-width: calc(200% + 0.25rem); }
.cal-day-ev-span-3 { width: calc(300% + 0.5rem); max-width: calc(300% + 0.5rem); }
.cal-day-ev-span-4 { width: calc(400% + 0.75rem); max-width: calc(400% + 0.75rem); }
.cal-day-ev-span-5 { width: calc(500% + 1rem); max-width: calc(500% + 1rem); }
.cal-day-ev-span-6 { width: calc(600% + 1.25rem); max-width: calc(600% + 1.25rem); }
.cal-day-ev-span-7 { width: calc(700% + 1.5rem); max-width: calc(700% + 1.5rem); }

.cal-event-date-range,
.cal-event-time-range {
  font-size: 0.8em;
  color: var(--app-text-soft);
  font-weight: 400;
}

.cal-day-ev-time {
  font-size: 0.65em;
  opacity: 0.88;
  margin-right: 0.35em;
  font-weight: 500;
}

.cal-popup-event-time {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.35em;
  font-weight: 500;
}

.cal-day-ev-more {
  font-size: 0.72rem;
  color: var(--app-text-muted);
  font-style: italic;
  padding: 0.15rem 0.4rem;
  background: none;
  border: none;
}

.cal-ev-icon-attention-wrap,
.cal-popup-ev-icon-attention {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.2rem;
  vertical-align: middle;
  color: rgba(255, 200, 80, 0.95);
}

.cal-ev-icon-attention-wrap .cal-ev-icon-attention,
.cal-popup-ev-icon-attention .cal-ev-icon-attention {
  display: block;
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
  line-height: 0;
}

@media (max-width: 768px) {
  .page-calendrier {
    min-height: 240px;
  }

  .calendar-wrap {
    padding: 0.75rem;
  }

  .calendar-header {
    margin-bottom: 0.5rem;
  }

  .calendar-nav {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
  }

  .calendar-btn-today {
    width: auto;
    height: 28px;
    padding: 0 0.5rem;
    font-size: 0.8rem;
  }
}

/* Vue semaine mobile – scroll fluide, jours enchaînés */
.cal-week-view .calendar-weekdays {
  display: none;
}

.cal-week-view .perm-legend {
  display: none;
}

.cal-week-view .calendar-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cal-week-view .calendar-days {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  grid-template-columns: none;
  grid-auto-rows: auto;
  min-height: auto;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.cal-week-view .cal-day-week {
  min-height: auto;
  flex-shrink: 0;
  overflow: visible;
}

.cal-week-view .cal-day-week .cal-num {
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  font-size: 0.95rem;
}

.cal-week-view .cal-day-week .cal-day-events {
  padding: 0.35rem 0.5rem 0.5rem;
  flex: none;
  overflow: visible;
}

.cal-week-view .cal-day-week .cal-day-events-list {
  overflow: visible;
}

.cal-day.cal-empty {
  background: transparent;
}

.cal-day.cal-empty .cal-day-events {
  visibility: hidden;
}

.cal-day.cal-past {
  opacity: 0.4;
  cursor: default;
}

.cal-day.cal-weekend:not(.cal-today) {
  background: rgba(148, 152, 160, 0.2);
}

.cal-day.cal-today {
  background: var(--brand-primary);
  color: var(--white);
  font-weight: 600;
}

.cal-day.cal-clickable {
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease;
}

.cal-day.cal-clickable:hover {
  background: rgba(var(--brand-primary-rgb), 0.25);
  transform: scale(1.05);
}

.cal-day.cal-clickable:focus {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.cal-day.cal-today.cal-clickable:hover {
  background: rgba(var(--brand-primary-rgb), 0.85);
}

.cal-day.cal-ferie {
  position: relative;
  overflow: hidden;
}

.cal-day.cal-ferie::before {
  content: 'RF';
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2rem, 6.5vw, 3.75rem);
  font-weight: 700;
  color: rgba(195, 200, 210, 0.55);
  letter-spacing: 0.06em;
  pointer-events: none;
}

.cal-day.cal-ferie .cal-num,
.cal-day.cal-ferie .cal-day-events {
  position: relative;
  z-index: 1;
}

.cal-day.cal-ferie.cal-today::before {
  color: var(--app-text-faint);
}

/* Liseré vacances scolaires (zones A, B, C) */
.cal-day.cal-vacances {
  position: relative;
}

.cal-day.cal-vacances::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 4px 4px;
  pointer-events: none;
}

.cal-day.cal-vacances[data-vacances="a"]::after {
  background: #4a90d9;
}

.cal-day.cal-vacances[data-vacances="b"]::after {
  background: #50c878;
}

.cal-day.cal-vacances[data-vacances="c"]::after {
  background: #e67e22;
}

.cal-day.cal-vacances[data-vacances="ab"]::after {
  height: 6px;
  background: linear-gradient(to bottom, #4a90d9 50%, #50c878 50%);
}

.cal-day.cal-vacances[data-vacances="ac"]::after {
  height: 6px;
  background: linear-gradient(to bottom, #4a90d9 50%, #e67e22 50%);
}

.cal-day.cal-vacances[data-vacances="bc"]::after {
  height: 6px;
  background: linear-gradient(to bottom, #50c878 50%, #e67e22 50%);
}

.cal-day.cal-vacances[data-vacances="abc"]::after {
  height: 9px;
  background: linear-gradient(to bottom, #4a90d9 33.33%, #50c878 33.33% 66.66%, #e67e22 66.66%);
}

/* Version mobile : pastilles zones vacances à côté du jour (remplace le liseré) */
.cal-week-view .cal-day.cal-vacances::after {
  display: none;
}
.cal-num-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.cal-vac-pills {
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
}
.cal-vac-pill {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}
.cal-week-view .cal-day-week .cal-vac-pill {
  width: 12px;
  height: 12px;
}

/* Popup informations du jour */
.cal-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cal-popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cal-popup {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  width: min(95vw, 920px);
  max-width: 920px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.cal-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
}

.cal-popup-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.cal-popup-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text-soft);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.cal-popup-close:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.cal-popup-divider {
  margin: 0;
  border: none;
  border-top: 1px solid var(--carbon-border);
}

.cal-popup-body {
  padding: 1rem 1.25rem;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  overflow: hidden;
}

.cal-popup-body .cal-popup-events,
.cal-popup-body .cal-event-form {
  overflow-y: auto;
  max-height: calc(88vh - 120px);
  min-height: 0;
}

.cal-popup-body .cal-popup-events:only-child {
  grid-column: 1 / -1;
}

.cal-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .cal-popup {
    width: min(92vw, 520px);
    max-width: 92vw;
    max-height: 90vh;
  }

  .cal-popup-body {
    grid-template-columns: 1fr;
  }

  .cal-popup-body .cal-popup-events,
  .cal-popup-body .cal-event-form {
    max-height: none;
  }
}

html.layout-force-mobile .cal-popup {
  width: min(92vw, 520px);
  max-width: 92vw;
  max-height: 90vh;
}

@media (max-width: 640px) {
  .cal-popup-grid {
    grid-template-columns: 1fr;
  }
}

.cal-popup-events h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 0.5rem;
}

.cal-popup-events-empty {
  color: var(--app-text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.cal-popup-events-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--app-text-soft);
  font-size: 0.95rem;
}

.cal-popup-events-list li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--carbon-border);
}

.cal-popup-events-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cal-popup-event-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.cal-popup-event-user {
  border-left: 3px solid var(--ev-user-color, #7f8c8d);
  padding-left: 0.5rem;
  margin-left: 0.25rem;
}

.cal-popup-event-content {
  flex: 1;
  min-width: 0;
}

.cal-popup-event-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.25rem;
}

.cal-event-btn-edit,
.cal-event-btn-delete {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  background: var(--carbon-dark);
  color: var(--app-text-soft);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.cal-event-btn-edit:hover,
.cal-event-btn-delete:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.cal-event-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.cal-event-desc {
  display: block;
  font-size: 0.85rem;
  color: var(--app-text-muted);
  margin-top: 0.25rem;
}

.cal-event-participants {
  display: block;
  font-size: 0.85rem;
  color: var(--app-text-soft);
  margin-top: 0.25rem;
}

.cal-event-family {
  color: var(--accent-warm);
  font-weight: 500;
}

.cal-event-form {
  margin: 0;
  padding: 0 0 0 1.25rem;
  border-left: 1px solid var(--carbon-border);
}

@media (max-width: 768px) {
  .cal-event-form {
    border-left: none;
    padding-left: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--carbon-border);
    margin-top: 0.5rem;
  }
}

.cal-event-form h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 1rem;
}

.cal-event-form-row {
  margin-bottom: 0.6rem;
}

.cal-event-form-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--app-text);
  margin-bottom: 0.25rem;
}

.cal-event-form-row--inline {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cal-event-form-row--inline > div {
  flex: 1;
  min-width: 100px;
}

.cal-event-form-row input,
.cal-event-form-row select,
.cal-event-form-row textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--carbon-dark);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.cal-event-form-row select option {
  background: var(--carbon-dark);
}

.cal-event-form-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.cal-event-participants-wrap,
.cal-event-guests-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cal-event-participants-row,
.cal-event-guests-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cal-event-participants-row select {
  flex: 1;
  min-width: 180px;
}

.cal-event-guests-inputs input,
.cal-event-guests-inputs select {
  flex: 1;
  min-width: 120px;
}

.cal-event-guests-inputs #calEventGuestEntityNew {
  min-width: 160px;
}

.cal-event-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cal-event-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  background: var(--carbon-dark);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

.cal-event-chip-remove {
  background: none;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 1.1rem;
  line-height: 1;
}

.cal-event-chip-remove:hover {
  color: #e74c3c;
}

.cal-popup-events-list small {
  font-size: 0.75rem;
  color: var(--neutral-muted);
}

/* Popup et modal Syndiqués */
.syndique-popup-overlay,
.syndique-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.syndique-popup-overlay.is-visible,
.syndique-modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.syndique-popup,
.syndique-modal {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.syndique-modal {
  max-width: 560px;
}

.syndique-popup-header,
.syndique-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--carbon-border);
}

.syndique-popup-title,
.syndique-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.syndique-popup-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--app-text-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.syndique-popup-close:hover {
  background: rgba(var(--brand-primary-rgb), 0.2);
  border-color: var(--brand-primary);
}

.syndique-popup-body {
  padding: 1.25rem;
}

.syndique-popup-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.25rem 0;
  font-size: 0.95rem;
}

.syndique-popup-details dt {
  color: var(--neutral-muted);
  font-weight: 500;
}

.syndique-popup-details dd {
  margin: 0;
  color: var(--app-text);
}

.syndique-popup-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.syndique-modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.syndique-create-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.syndique-create-fields .form-group--full {
  grid-column: 1 / -1;
}

.syndique-modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--carbon-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Pistes de syndicalisation */
.pistes-toolbar {
  margin-bottom: 1rem;
}

.pistes-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.pistes-search .search-input {
  min-width: 200px;
}

.pistes-count {
  margin-bottom: 0.75rem;
  color: var(--app-text-soft);
  font-size: 0.95rem;
}

.pistes-table-wrap {
  overflow-x: auto;
}

.pistes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pistes-actions .piste-delete-form {
  display: inline;
}

.piste-form-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.piste-form-fields .form-group--full {
  grid-column: 1 / -1;
}

.syndique-row--archived td,
.syndiques-table--archived .syndique-row td {
  text-decoration: line-through;
  color: var(--app-text-muted);
}

.validation-orga-question {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0 0 0.5rem 0;
  color: var(--app-text);
}

.validation-orga-hint {
  font-size: 0.9rem;
  color: var(--app-text-muted);
  margin: 0 0 1.25rem 0;
}

/* Version mobile : sidebar masquée, bouton menu, overlay */
@media (max-width: 768px) {
  html:not(.layout-force-desktop) .sidebar-menu-btn {
    display: flex;
  }
  html:not(.layout-force-desktop) .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  /* Sidebar en overlay, masquée par défaut */
  html:not(.layout-force-desktop) .sidebar {
    top: 0;
    bottom: 0;
    width: min(280px, 85vw);
    max-width: 280px;
    padding: 1rem 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1100;
    overflow-y: auto;
  }
  html:not(.layout-force-desktop) .sidebar .sidebar-label {
    display: block;
  }
  html:not(.layout-force-desktop) .sidebar-nav {
    padding-top: calc(var(--header-height) + 0.5rem);
  }
  /* Pages non visibles sur mobile (config. Paramètres > Pages sur mobile) */
  html:not(.layout-force-desktop) .sidebar .sidebar-item-mobile-hidden,
  html:not(.layout-force-desktop) .sidebar .sidebar-link-mobile-hidden,
  html:not(.layout-force-desktop) .sidebar .sidebar-submenu-link-mobile-hidden {
    display: none !important;
  }
  html:not(.layout-force-desktop) .sidebar-submenu {
    position: static;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }
  html:not(.layout-force-desktop) .sidebar-item--submenu-open .sidebar-submenu {
    max-height: 320px;
  }
  html:not(.layout-force-desktop) .sidebar-submenu {
    margin-left: 0.5rem;
    margin-top: 0.25rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
  }
  html:not(.layout-force-desktop) .sidebar-bottom .sidebar-submenu {
    margin-left: 0.5rem;
  }
  html:not(.layout-force-desktop).sidebar-open {
    overflow: hidden;
  }
  html:not(.layout-force-desktop).sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }
  html:not(.layout-force-desktop) .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  html:not(.layout-force-desktop).sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  /* Sous-menus dépliables au clic sur mobile */
  html:not(.layout-force-desktop) .sidebar-item--has-submenu .sidebar-link {
    cursor: pointer;
  }
  html:not(.layout-force-desktop) .sidebar-chevron {
    transition: transform 0.2s ease;
  }
  html:not(.layout-force-desktop) .sidebar-item--submenu-open .sidebar-chevron {
    transform: rotate(90deg);
  }
  html:not(.layout-force-desktop) .header-date {
    display: none;
  }
  html:not(.layout-force-desktop) .header-datetime {
    gap: 0.5rem;
  }
  html:not(.layout-force-desktop) .header-clock {
    font-size: 0.9rem;
  }
  html:not(.layout-force-desktop) .site-name-extra {
    display: none;
  }
  html:not(.layout-force-desktop) .layout-toggle {
    display: none;
  }
  html:not(.layout-force-desktop) .main-header .header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
  }
  html:not(.layout-force-desktop) .user-menu-trigger .user-name,
  html:not(.layout-force-desktop) .user-menu-trigger .user-role,
  html:not(.layout-force-desktop) .user-menu-trigger .user-menu-chevron {
    display: none;
  }
  html:not(.layout-force-desktop) .user-menu-trigger {
    padding: 0.5rem;
  }
  /* Responsive global */
  .main-content .page-inner {
    padding: 0;
  }
  .tresorerie-subnav {
    gap: 0.35rem;
  }
  .tresorerie-subnav-link {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }
  .mail-app {
    height: auto;
    min-height: 0;
  }
  .mail-app-columns {
    grid-template-columns: 1fr;
    flex: none;
    height: auto;
  }
  .mail-list-panel {
    border-right: none;
    border-bottom: 1px solid var(--carbon-border);
    max-height: 45vh;
  }
  .mail-read-panel {
    max-height: 52vh;
  }
  .site-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Actifs et Retraités : visibles uniquement en version mobile, masqués en version ordinateur */
html.layout-force-desktop .sidebar .sidebar-link-desktop-hidden {
  display: none !important;
}
@media (min-width: 769px) {
  html:not(.layout-force-mobile) .sidebar .sidebar-link-desktop-hidden {
    display: none !important;
  }
}

/* Force desktop : layout ordinateur même sur petit écran */
html.layout-force-desktop {
  --sidebar-width: 220px;
}
html.layout-force-desktop .sidebar {
  width: var(--sidebar-width);
  padding: 0.75rem 1rem;
}
html.layout-force-desktop .sidebar-label {
  display: block;
}
html.layout-force-desktop .sidebar-link {
  padding: 0.5rem 0.75rem;
  justify-content: flex-start;
}
html.layout-force-desktop .main-content {
  margin-left: var(--sidebar-width);
}

/* Force mobile : même comportement que viewport mobile (sidebar toggle) */
@media (min-width: 769px) {
  html.layout-force-mobile .sidebar-menu-btn {
    display: flex;
  }
  html.layout-force-mobile .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  html.layout-force-mobile .sidebar {
    top: 0;
    bottom: 0;
    width: min(280px, 85vw);
    max-width: 280px;
    padding: 1rem 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1100;
    overflow-y: auto;
  }
  html.layout-force-mobile .sidebar .sidebar-label {
    display: block;
  }
  html.layout-force-mobile .sidebar-nav {
    padding-top: calc(var(--header-height) + 0.5rem);
  }
  html.layout-force-mobile .sidebar .sidebar-item-mobile-hidden,
  html.layout-force-mobile .sidebar .sidebar-link-mobile-hidden,
  html.layout-force-mobile .sidebar .sidebar-submenu-link-mobile-hidden {
    display: none !important;
  }
  html.layout-force-mobile .sidebar-submenu {
    position: static;
    margin: 0.5rem 0 0 1rem;
    padding: 0 0 0 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
  }
  html.layout-force-mobile .sidebar-item--submenu-open .sidebar-submenu {
    max-height: 200px;
  }
  html.layout-force-mobile .sidebar-bottom .sidebar-submenu {
    margin-left: 0.5rem;
  }
  html.layout-force-mobile.sidebar-open {
    overflow: hidden;
  }
  html.layout-force-mobile.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }
  html.layout-force-mobile .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  html.layout-force-mobile.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  html.layout-force-mobile .header-date {
    display: none;
  }
  html.layout-force-mobile .site-name-extra {
    display: none;
  }
  html.layout-force-mobile .user-menu-trigger .user-name,
  html.layout-force-mobile .user-menu-trigger .user-role,
  html.layout-force-mobile .user-menu-trigger .user-menu-chevron {
    display: none;
  }
  html.layout-force-mobile .user-menu-trigger {
    padding: 0.5rem;
  }
}

/* Page Contacts utiles – grands blocs par famille */
.page-contacts .contacts-actions {
  margin-bottom: 1.5rem;
}

.contacts-familles {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contacts-famille-bloc {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.contacts-famille-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(var(--brand-primary-rgb), 0.35);
}

.contacts-famille-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contacts-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--neutral-muted);
  font-style: italic;
}

.contacts-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid var(--carbon-border);
}

.contacts-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.contacts-card-name {
  font-size: 1rem;
  color: var(--app-text);
}

.contacts-card-tel a,
.contacts-card-email a {
  font-size: 0.9rem;
  color: var(--brand-primary);
  text-decoration: none;
}

.contacts-card-tel a:hover,
.contacts-card-email a:hover {
  text-decoration: underline;
}

.contacts-card-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.contacts-modal {
  max-width: 440px;
}

/* ========== Mail ========== */
.page-mail .mail-form-block {
  max-width: 100%;
  width: 100%;
}

.page-mail .mail-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.page-mail .mail-form .form-group {
  margin-bottom: 1.25rem;
}

.page-mail .mail-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--app-text);
  margin-bottom: 0.4rem;
}

.page-mail .mail-form input[type="text"],
.page-mail .mail-form input[type="search"],
.page-mail .mail-form input[type="email"],
.page-mail .mail-form select {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
  box-sizing: border-box;
}

.page-mail .mail-form input:focus,
.page-mail .mail-form select:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.page-mail .mail-form textarea {
  width: 100%;
  max-width: 100%;
  min-height: 200px;
  padding: 0.65rem 0.9rem;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.5;
  background: var(--app-surface-hover);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
  resize: vertical;
  box-sizing: border-box;
}

.page-mail .mail-body-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-mail .mail-body-group textarea {
  flex: 1;
  min-height: 220px;
}

.page-mail .mail-field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-mail .mail-field-row select {
  flex: 1;
  min-width: 200px;
}

.page-mail .mail-form textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.page-mail .mail-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--app-text);
  cursor: pointer;
}

.page-mail .mail-form input::placeholder,
.page-mail .mail-form textarea::placeholder {
  color: var(--neutral-muted);
  opacity: 0.8;
}

.page-mail .mail-form .form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon-border);
}

.page-mail-listes .dashboard-form {
  max-width: 560px;
}

.mail-mode-panel {
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.mail-mode-panel .form-group {
  margin-bottom: 0.75rem;
}

.mail-search-results {
  margin-top: 0.5rem;
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
}

.mail-search-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--carbon-border);
}

.mail-search-item:last-child {
  border-bottom: none;
}

.mail-search-item:hover {
  background: var(--app-surface-hover-strong);
}

.page-mail .mail-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.65rem 0.9rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid var(--carbon-border);
}

.page-mail .mail-count {
  font-size: 0.9rem;
  color: var(--neutral-muted);
  white-space: nowrap;
}

.mail-tous-info {
  margin-bottom: 0.5rem;
  color: var(--app-text-soft);
}

.mail-count {
  font-size: 0.9rem;
  color: var(--neutral-muted);
}

.mail-listes-actions {
  margin-bottom: 1rem;
}

.mail-listes-table-wrap {
  overflow-x: auto;
}

.mail-listes-table {
  width: 100%;
  border-collapse: collapse;
}

.mail-listes-table th,
.mail-listes-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--carbon-border);
}

.mail-listes-table th {
  font-weight: 600;
  color: var(--brand-primary);
}

.mail-liste-selected {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.mail-liste-selected-title {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--neutral-muted);
}

.mail-liste-selected ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mail-liste-selected li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.mail-liste-selected .btn-remove {
  background: none;
  border: none;
  color: var(--brand-primary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 0.25rem;
}

.mail-liste-selected .btn-remove:hover {
  color: #ff4d5a;
}

/* Mails envoyés */
.mail-envoyes-actions {
  margin-bottom: 1rem;
}

.mail-envoyes-empty {
  color: var(--neutral-muted);
  font-style: italic;
}

.mail-envoyes-table-wrap {
  overflow-x: auto;
}

.mail-envoyes-table {
  width: 100%;
  border-collapse: collapse;
}

.mail-envoyes-table th,
.mail-envoyes-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--carbon-border);
}

.mail-envoyes-table th {
  font-weight: 600;
  color: var(--brand-primary);
}

.mail-envoyes-row {
  cursor: pointer;
}

.mail-envoyes-row:hover {
  background: var(--app-surface-hover-strong);
}

.mail-envoyes-modal {
  max-width: 560px;
}

.mail-envoyes-preview dt {
  font-weight: 600;
  color: var(--brand-primary);
  margin-top: 1rem;
  margin-bottom: 0.25rem;
}

.mail-envoyes-preview dt:first-child {
  margin-top: 0;
}

.mail-envoyes-preview dd {
  margin: 0;
  font-size: 0.95rem;
}

.mail-preview-body {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.page-mail .form-hint {
  display: block;
  font-size: 0.85rem;
  color: var(--neutral-muted);
  margin-top: 0.35rem;
}

.mail-attachment-list {
  margin-top: 0.5rem;
}

.mail-attachment-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mail-attachment-list li {
  font-size: 0.9rem;
  padding: 0.25rem 0;
  color: var(--app-text);
}

/* Documents – layout Finder */
.documents-finder {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 580px;
  height: calc(100vh - 210px);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--app-line);
  box-shadow: 0 1px 6px rgba(0,0,0,0.10);
  background: var(--app-surface);
}

/* ── Panneau arbre ── */
.documents-tree-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--app-line);
  background: var(--app-surface-hover);
  overflow: hidden;
}
.documents-tree-header {
  padding: 0.55rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--app-text-muted);
  border-bottom: 1px solid var(--app-line);
  flex-shrink: 0;
}
.documents-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0 0.5rem;
}
.documents-tree-loading,
.documents-tree-empty,
.documents-tree-error {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--app-text-muted);
}

/* Nœud d'arbre */
.dt-node { user-select: none; }
.dt-node-row {
  display: flex;
  align-items: center;
  height: 1.85rem;
  padding-right: 0.4rem;
  gap: 0.15rem;
  border-radius: 0;
}
.dt-node-row:hover {
  background: rgba(var(--brand-primary-rgb), 0.07);
}
.dt-toggle {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.55rem;
  color: var(--app-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  padding: 0;
  line-height: 1;
}
.dt-toggle:hover { color: var(--brand-primary); }
.dt-toggle-ph {
  flex-shrink: 0;
  width: 1.1rem;
}
.dt-name {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  color: var(--app-text);
  padding: 0.15rem 0.35rem;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.dt-name.active {
  background: var(--brand-primary);
  color: #fff !important;
  font-weight: 600;
}
.dt-name-root { font-weight: 600; }
.dt-actions {
  display: none;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}
.dt-node-row:hover .dt-actions { display: flex; }
.dt-btn {
  width: 1.2rem;
  height: 1.2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: var(--app-text-muted);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.dt-btn:hover { background: rgba(var(--brand-primary-rgb), 0.15); color: var(--brand-primary); }

/* ── Panneau contenu ── */
.documents-content-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--app-surface);
}
.documents-content-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--app-text-muted);
}
.documents-content-empty-icon { font-size: 2.5rem; opacity: 0.4; }
.documents-content-empty p { font-size: 0.9rem; margin: 0; }

.documents-content-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.documents-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--app-line);
  flex-shrink: 0;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Fil d'Ariane */
.documents-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: 0.87rem;
  flex: 1;
  min-width: 0;
}
.bc-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brand-primary);
  font: inherit;
  font-size: 0.87rem;
  padding: 0;
  white-space: nowrap;
}
.bc-btn:hover { text-decoration: underline; }
.bc-current { color: var(--app-text); font-weight: 600; white-space: nowrap; }
.bc-sep { color: var(--app-text-muted); font-size: 0.9rem; }

/* Actions du panneau */
.documents-content-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.documents-upload-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.documents-upload-label input[type="file"] { display: none; }
.documents-upload-btn {
  padding: 0.35rem 0.75rem;
  background: rgba(var(--brand-primary-rgb), 0.12);
  color: var(--brand-primary);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.documents-upload-btn:hover { background: rgba(var(--brand-primary-rgb), 0.22); }
.documents-btn-add-sub {
  padding: 0.35rem 0.7rem;
  background: var(--app-surface-hover);
  border: 1px solid var(--app-line-strong);
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--app-text);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.documents-btn-add-sub:hover {
  background: rgba(var(--brand-primary-rgb), 0.1);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Tableau de fichiers */
.documents-file-wrap {
  flex: 1;
  overflow-y: auto;
}
.documents-file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.documents-file-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--app-surface-hover);
  padding: 0.45rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--app-text-muted);
  border-bottom: 1px solid var(--app-line);
}
.documents-file-table th.col-actions { width: 8rem; }
.df-state-row {
  padding: 1.25rem 1rem;
  color: var(--app-text-muted);
  font-size: 0.88rem;
  text-align: center;
}
.df-state-empty { font-style: italic; }
.df-state-error { color: #dc2626; }

/* Ligne dossier */
.df-folder-row {
  border-bottom: 1px solid var(--app-line);
  background: rgba(var(--brand-primary-rgb), 0.02);
}
.df-folder-row:hover { background: rgba(var(--brand-primary-rgb), 0.06); }
.df-folder-name-cell { padding: 0.45rem 0.75rem; }
.df-folder-open {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  color: var(--app-text);
  padding: 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.df-folder-open:hover .df-folder-label { text-decoration: underline; color: var(--brand-primary); }
.df-sub-count { font-size: 0.78rem; color: var(--app-text-muted); }

/* Ligne fichier */
.df-row {
  border-bottom: 1px solid var(--app-line);
  transition: background 0.1s;
}
.df-row:hover { background: rgba(var(--brand-primary-rgb), 0.03); }
.df-row td {
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
}
.df-name-cell { min-width: 0; max-width: 300px; }
.df-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.87rem;
}
.df-cat-cell { min-width: 110px; }
.df-cat-select {
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
  background: var(--app-surface-hover-strong, var(--app-surface-hover));
  border: 1px solid var(--app-line-strong, var(--app-line));
  border-radius: 4px;
  color: inherit;
  max-width: 130px;
  cursor: pointer;
}
.df-date, .df-size {
  white-space: nowrap;
  color: var(--app-text-muted);
  font-size: 0.8rem;
}
.df-actions { white-space: nowrap; }

/* Boutons actions */
.documents-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0.18rem 0.32rem;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--app-text-muted);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.documents-btn:hover {
  background: rgba(var(--brand-primary-rgb), 0.12);
  border-color: rgba(var(--brand-primary-rgb), 0.25);
  color: var(--brand-primary);
}

/* Barre filtre tiers */
.documents-tiers-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--app-line);
  background: var(--app-surface-hover);
  flex-shrink: 0;
}
.documents-tiers-bar-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted);
  white-space: nowrap;
}
.documents-tiers-select {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  padding: 0.28rem 0.55rem;
  background: var(--app-surface);
  border: 1px solid var(--app-line-strong, var(--app-line));
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
  max-width: 340px;
}
.documents-tiers-add-btn {
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--app-line-strong, var(--app-line));
  background: var(--app-surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.15s;
  text-decoration: none;
}
.documents-tiers-add-btn:hover { background: rgba(var(--brand-primary-rgb), 0.12); }

/* Cellule tiers dans le tableau */
.df-tiers-cell { min-width: 130px; }
.df-tiers-select {
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
  background: var(--app-surface-hover-strong, var(--app-surface-hover));
  border: 1px solid var(--app-line-strong, var(--app-line));
  border-radius: 4px;
  color: inherit;
  max-width: 150px;
  cursor: pointer;
}

/* Colonne Dossier (vue filtrée par tiers) */
.df-folder-cell {
  font-size: 0.82rem;
  color: var(--app-text-muted);
}
.df-folder-cell .df-folder-open {
  font-size: 0.82rem;
  color: var(--brand-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.df-folder-cell .df-folder-open:hover { text-decoration: underline; }

/* Label tiers dans le fil d'Ariane vue filtrée */
.bc-tiers-label {
  font-size: 0.87rem;
  color: var(--app-text);
}

/* Glisser-déposer */
.df-name-cell[draggable="true"],
.df-folder-name-cell[draggable="true"] {
  cursor: grab;
}
.df-name-cell[draggable="true"]:active,
.df-folder-name-cell[draggable="true"]:active {
  cursor: grabbing;
}
.df-dragging {
  opacity: 0.35;
}
.dt-node-row.df-drag-over {
  background: rgba(var(--brand-primary-rgb), 0.18) !important;
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
  border-radius: 4px;
}
.df-folder-row.df-drag-over td {
  background: rgba(var(--brand-primary-rgb), 0.12);
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

/* Saisie inline de renommage */
.df-rename-input {
  width: 100%;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--brand-primary);
  border-radius: 4px;
  font: inherit;
  background: var(--app-surface);
  color: var(--app-text);
  outline: none;
}

/* Thème clair – adaptations */
body.app-theme-light:not(.page-login) .documents-tree-panel {
  background: #f4f5f7;
}
body.app-theme-light:not(.page-login) .dt-node-row:hover {
  background: rgba(var(--brand-primary-rgb), 0.08);
}
body.app-theme-light:not(.page-login) .documents-finder {
  border-color: rgba(0,0,0,0.12);
}

/* Documents */
.documents-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.documents-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
/* Grille de cartes pour les dossiers (comme le tableau de bord) */
.documents-folders.documents-folders-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.documents-folder-card {
  text-align: left;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
}
.documents-folder-card .card {
  height: 100%;
  padding: 0.6rem 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}
.documents-folder-card .card-icon {
  margin-bottom: 0;
  flex-shrink: 0;
}
.documents-folder-card .card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}
.documents-folder-card .card h3 {
  font-size: 0.9rem;
  margin-bottom: 0;
}
.documents-folder-card .card p {
  display: none;
}
.documents-folder-card.active .card,
.documents-folder-card:hover .card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--brand-primary);
}

.documents-folder-card-cell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 0;
}

.documents-folder-card-cell .documents-folder-card {
  flex: 1;
  min-width: 0;
}

.documents-folder-add-task,
.documents-category-add-task {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.5rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.documents-folder-add-task:hover,
.documents-folder-add-task:focus,
.documents-category-add-task:hover,
.documents-category-add-task:focus {
  background: rgba(var(--brand-primary-rgb), 0.28);
  outline: none;
}

.documents-folder-add-task:active,
.documents-category-add-task:active {
  transform: scale(0.96);
}

.documents-category-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.documents-category-row .documents-category-toggle {
  flex: 1;
  width: auto;
  min-width: 0;
}

.documents-category-row .documents-category-add-task {
  margin-top: 0.35rem;
}
.documents-folder-bubble {
  padding: 0.75rem 1.25rem;
  border-radius: 24px;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.documents-folder-bubble:hover,
.documents-folder-bubble.active {
  background: rgba(var(--brand-primary-rgb), 0.15);
  border-color: var(--brand-primary);
}
.documents-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.documents-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.documents-item {
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border-left: 3px solid var(--doc-user-color, #7f8c8d);
  position: relative;
  cursor: pointer;
}
.documents-item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
}
.documents-item-comment-block {
  display: none;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 8px 8px;
}
.documents-item.is-comment-expanded .documents-item-comment-block {
  display: block;
}
.documents-item-comment-text {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--app-text-soft);
  line-height: 1.4;
  white-space: pre-wrap;
}
.documents-item-comment-text em {
  color: var(--neutral-muted);
  font-style: italic;
}
.documents-item-comment-edit {
  font-size: 0.85rem;
  color: var(--brand-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.documents-item-comment-edit:hover {
  text-decoration: underline;
}
.documents-item-user {
  border-left-color: var(--doc-user-color, #7f8c8d) !important;
}
.documents-item-accent {
  display: none;
}
.documents-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.documents-item-categorie {
  font-size: 0.8rem;
  color: var(--neutral-muted);
  white-space: nowrap;
}
.documents-upload-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.documents-categorie-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.documents-categorie-wrap label {
  font-size: 0.9rem;
  color: var(--app-text-soft);
}
.documents-categorie-wrap select {
  padding: 0.4rem 0.75rem;
  background: var(--app-surface-hover-strong);
  border: 1px solid var(--app-line-strong);
  border-radius: 6px;
  color: inherit;
  font-size: 0.9rem;
  min-width: 180px;
}
.documents-categorie-add-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: rgba(var(--brand-primary-rgb), 0.2);
  border: 1px solid var(--brand-primary);
  border-radius: 6px;
  color: var(--brand-primary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.documents-categorie-add-btn:hover {
  background: rgba(var(--brand-primary-rgb), 0.35);
}
.documents-item-meta {
  font-size: 0.85rem;
  color: var(--neutral-muted);
}
.documents-item-comment {
  font-size: 1rem;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
}
.documents-item-comment:hover {
  opacity: 1;
}
.documents-item-comment.has-comment {
  opacity: 1;
}

/* ─── Tooltip survol commentaire document ──────────────────────────────────── */
.documents-comment-tooltip {
  display: none;
  position: fixed;
  z-index: 9500;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  background: var(--carbon-light, #2d2d2d);
  color: var(--app-text, #e0e0e0);
  border: 1px solid var(--carbon-border, rgba(255, 255, 255, 0.14));
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.documents-item-view,
.documents-item-dl {
  font-size: 0.85rem;
  color: var(--brand-primary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.documents-item-view:hover,
.documents-item-dl:hover {
  text-decoration: underline;
}
.documents-upload-label {
  cursor: pointer;
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(var(--brand-primary-rgb), 0.2);
  border: 1px dashed var(--brand-primary);
  border-radius: 8px;
  font-size: 0.9rem;
}
.documents-upload-label input { display: none; }

/* Modal envoi documents — choix catégorie */
.param-modal-content--upload .upload-modal-intro {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--app-text-soft);
}
.upload-modal-file-list {
  list-style: none;
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.75rem;
  max-height: 180px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}
.upload-modal-file-list li {
  padding: 0.25rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-modal-categorie-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.upload-modal-categorie-row select {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: var(--carbon);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}

/* Documents - groupement par catégorie */
.documents-list.documents-list-by-category {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.documents-category-block {
  list-style: none;
  margin: 0;
  padding: 0;
}
.documents-category-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: var(--app-surface-hover);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: inherit;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.documents-category-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.documents-category-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255, 255, 255, 0.7);
  transition: transform 0.2s;
}
.documents-category-toggle[aria-expanded="true"] .documents-category-chevron {
  transform: rotate(180deg);
}
.documents-category-label {
  flex: 1;
  font-weight: 500;
}
.documents-category-count {
  font-size: 0.85rem;
  color: var(--neutral-muted);
}
.documents-category-docs {
  list-style: none;
  margin: 0.5rem 0 0 1.5rem;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.documents-category-docs.is-expanded {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

/* ── Sous-dossiers hiérarchiques (niveaux 1 et 2) ── */
.documents-subfolder-block {
  list-style: none;
  margin: 0 0 0.35rem 0;
  padding: 0;
}
.documents-subfolder-level-2 {
  margin-left: 1.5rem;
  margin-top: 0.25rem;
}
.documents-subfolder-level-3 {
  margin-left: 1.5rem;
  margin-top: 0.25rem;
}
.documents-subfolder-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}
.documents-subfolder-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.9rem;
  background: rgba(var(--brand-primary-rgb), 0.08);
  border: 1px solid rgba(var(--brand-primary-rgb), 0.2);
  border-radius: 8px;
  color: inherit;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.documents-subfolder-level-2 .documents-subfolder-toggle,
.documents-subfolder-level-3 .documents-subfolder-toggle {
  background: var(--app-surface-hover);
  border-color: rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
}
.documents-subfolder-level-3 .documents-subfolder-toggle {
  font-size: 0.83rem;
  opacity: 0.92;
}
.documents-subfolder-toggle:hover {
  background: rgba(var(--brand-primary-rgb), 0.16);
  border-color: rgba(var(--brand-primary-rgb), 0.35);
}
.documents-subfolder-toggle[aria-expanded="true"] .documents-category-chevron {
  transform: rotate(180deg);
}
.documents-subfolder-icon {
  flex-shrink: 0;
}
.documents-subfolder-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease-out;
  padding-left: 0.5rem;
}
.documents-subfolder-content.is-open {
  max-height: 9000px;
  transition: max-height 0.5s ease-in;
}
.documents-subfolder-docs-list {
  list-style: none;
  margin: 0.35rem 0 0.35rem 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.documents-subfolder-empty {
  font-size: 0.85rem;
  color: var(--app-text-faint);
  padding: 0.5rem 1rem;
  margin: 0;
}
/* Bouton upload dans un sous-dossier */
.documents-subfolder-upload-label {
  flex-shrink: 0;
  cursor: pointer;
}
.documents-subfolder-upload-label input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.documents-subfolder-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid var(--carbon-border);
  background: var(--app-surface-hover);
  color: var(--app-text-muted);
  font-size: 1rem;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.documents-subfolder-upload-label:hover .documents-subfolder-upload-btn {
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
/* Bouton ajouter sous-sous-dossier (icône) */
.documents-add-subfolder-btn--icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
  font-size: 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--carbon-border);
  background: var(--app-surface-hover);
  color: var(--app-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.documents-add-subfolder-btn--icon:hover {
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
/* Bouton ajouter sous-dossier niveau 1 (pleine largeur, en bas de liste) */
.documents-add-subfolder-item {
  list-style: none;
  margin-top: 0.75rem;
  padding: 0;
}
.documents-add-subfolder-btn--full {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 6px;
  border: 1px dashed var(--carbon-border);
  background: transparent;
  color: var(--app-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.documents-add-subfolder-btn--full:hover {
  background: rgba(var(--brand-primary-rgb), 0.08);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
/* Mode clair */
body.app-theme-light:not(.page-login) .documents-subfolder-toggle {
  background: rgba(var(--brand-primary-rgb), 0.06);
  border-color: rgba(var(--brand-primary-rgb), 0.18);
}
body.app-theme-light:not(.page-login) .documents-subfolder-toggle:hover {
  background: rgba(var(--brand-primary-rgb), 0.12);
}
.documents-item-categorie-wrap {
  min-width: 140px;
}
.documents-item-categorie-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: var(--app-surface-hover-strong);
  border: 1px solid var(--app-line-strong);
  border-radius: 4px;
  color: inherit;
  min-width: 120px;
  max-width: 160px;
}
.documents-folder-rename-btn,
.documents-subfolder-rename-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  line-height: 1;
  font-size: 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--carbon-border);
  background: var(--app-surface-hover);
  color: var(--app-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.documents-folder-rename-btn {
  align-self: flex-start;
  margin-top: 0.5rem;
}
.documents-folder-rename-btn:hover,
.documents-subfolder-rename-btn:hover {
  background: rgba(var(--brand-primary-rgb), 0.15);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.documents-item-folder-wrap {
  min-width: 160px;
}
.documents-item-folder-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: var(--app-surface-hover-strong);
  border: 1px solid var(--app-line-strong);
  border-radius: 4px;
  color: inherit;
  min-width: 140px;
  max-width: 200px;
  cursor: pointer;
}

/* ── Dashboard - Raccourcis ── */
.dashboard-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--app-text-muted);
  margin: 2rem 0 0.75rem;
}
.dashboard-link-wrapper {
  position: relative;
}
.dashboard-link-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.dashboard-link-favicon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
}
.dashboard-link-domain {
  font-size: 0.78rem;
  color: var(--app-text-muted);
  word-break: break-all;
}
.dashboard-link-add-btn {
  background: none;
  border: none;
  cursor: pointer;
  text-align: inherit;
  font: inherit;
  width: 100%;
}
.dashboard-link-add-icon {
  font-size: 2rem;
  color: var(--brand-primary);
  font-weight: 300;
}
.dashboard-link-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.88);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.dashboard-link-wrapper:hover .dashboard-link-delete,
.dashboard-link-wrapper:focus-within .dashboard-link-delete {
  opacity: 1;
}
.dashboard-link-favicon-preview {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: var(--app-surface-hover);
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--app-text-muted);
}
.dashboard-link-favicon-preview.is-visible {
  display: flex;
}
.dashboard-link-favicon-preview img {
  border-radius: 4px;
  flex-shrink: 0;
}

/* Image personnalisée dans la bulle */
.dashboard-link-favicon.is-custom {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.dashboard-link-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Zone d'upload image dans la modal */
.dashboard-upload-zone {
  border: 2px dashed var(--app-line-strong);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  overflow: hidden;
}
.dashboard-upload-zone.drag-over {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), 0.06);
}
.dashboard-upload-zone.has-image {
  border-style: solid;
  border-color: var(--brand-primary);
}
.dashboard-upload-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--app-text-muted);
}
.dashboard-upload-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.dashboard-upload-browse {
  color: var(--brand-primary);
  text-decoration: underline;
  cursor: pointer;
}
.dashboard-upload-hint {
  font-size: 0.75rem;
  opacity: 0.6;
}
.dashboard-upload-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 0.5rem;
}
.dashboard-upload-preview img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
}
.dashboard-upload-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Paramètres - Listes */
.form-desc {
  margin-bottom: 1.5rem;
  color: var(--app-text-muted);
  font-size: 0.9rem;
}
.param-listes {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.param-liste-block {
  padding: 1.5rem;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
}
.param-liste-block h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--brand-primary);
}
.param-liste-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.param-liste-table th,
.param-liste-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--carbon-border);
  text-align: left;
}
.param-liste-table th {
  background: rgba(0, 0, 0, 0.2);
  font-weight: 600;
}
.param-liste-table .col-actions {
  white-space: nowrap;
}
.param-liste-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.param-liste-add input[type="text"],
.param-liste-add select {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--carbon);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
  min-width: 160px;
}
.param-liste-add button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  background: var(--brand-primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.param-liste-add button:hover {
  background: var(--brand-primary-dark);
}
.param-liste-table .btn-edit-item,
.param-liste-table .btn-del-item {
  padding: 0.25rem 0.5rem;
  margin-right: 0.25rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--carbon-border);
  border-radius: 4px;
  color: var(--app-text);
  cursor: pointer;
}
.param-liste-table .btn-edit-item:hover,
.param-liste-table .btn-del-item:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.param-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.param-modal.is-open {
  opacity: 1;
  visibility: visible;
}
.param-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  z-index: 0;
}
.param-modal-content {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-border);
  border-radius: 8px;
  min-width: 320px;
}
.param-modal-content h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--brand-primary);
}
.param-modal-content .form-group {
  margin-bottom: 1rem;
}
.param-modal-content .form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--app-text-soft);
}
.param-modal-content .form-group input,
.param-modal-content .form-group select,
.param-modal-content .form-group textarea {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
  background: var(--carbon);
  border: 1px solid var(--carbon-border);
  border-radius: 6px;
  color: var(--app-text);
}
.param-modal-content .form-group textarea {
  min-height: 80px;
  resize: vertical;
}
.param-modal-content .form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.param-modal-content .btn-primary {
  padding: 0.5rem 1rem;
  background: var(--brand-primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.param-modal-content .btn-cancel {
  padding: 0.5rem 1rem;
  background: var(--carbon-border);
  color: var(--app-text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

