/* ============================================================
   EGUIMOS INTRANET — Design System & Styles — v28
   Architecture : Variables → Reset → Layout → Components → Views → Responsive
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   1. CUSTOM PROPERTIES
──────────────────────────────────────────────────────────── */
:root {
  /* Entity accent (overridden by .entity-* on #app) */
  --acc:        #374151;
  --acc-light:  #F3F4F6;
  --acc-mid:    #4B5563;

  /* Entity palettes — couleurs issues des logos officiels */
  --egu-color:  #C53B2A; --egu-light: #FDF0EF; --egu-mid: #E04A38;  /* Rouge Géomètre-Expert */
  --urb-color:  #2897B5; --urb-light: #E4F5FA; --urb-mid: #35AECF;  /* Teal Urba'Real VRD    */
  --lnd-color:  #5E8A30; --lnd-light: #EEF5E6; --lnd-mid: #72A83A;  /* Vert Land Concept     */
  --all-color:  #344858; --all-light: #EEF1F4; --all-mid: #4E6478;  /* Slate groupe EGUIMOS  */

  /* Neutrals */
  --bg:        #F0F2F5;
  --surface:   #FFFFFF;
  --surface2:  #F8F9FB;
  --border:    #E5E7EB;
  --border2:   #D1D5DB;

  /* Text */
  --txt-1: #111827;
  --txt-2: #374151;
  --txt-3: #6B7280;
  --txt-4: #737D88;

  /* Semantic — couleurs d'état (success/info/warning/danger/purple)                 */
  /*   -xx-bg      = fond coloré léger (ex: bandeau info)                            */
  /*   -xx-border  = bordure (un cran plus foncée que bg)                            */
  /*   -xx-text    = texte sur fond -xx-bg                                           */
  /*   THEME_CSS.dark (src/97-parametres.js) redéfinit ces vars pour le mode sombre. */
  --green:  #16A34A; --green-bg:  #F0FDF4; --green-border:  #DCFCE7; --green-text:  #166534;
  --red:    #DC2626; --red-bg:    #FEF2F2; --red-border:    #FEE2E2; --red-text:    #991B1B;
  --amber:  #D97706; --amber-bg:  #FFFBEB; --amber-border:  #FEF3C7; --amber-text:  #92400E;
  --blue:   #2563EB; --blue-bg:   #EFF6FF; --blue-border:   #DBEAFE; --blue-text:   #1E40AF;
  --purple: #7C3AED; --purple-bg: #F5F3FF; --purple-border: #EDE9FE; --purple-text: #5B21B6; --purple-light: #DDD6FE;

  /* Alias sémantiques — préférer ces noms dans le nouveau code */
  --success:        var(--green);        --success-bg: var(--green-bg);
  --success-border: var(--green-border); --success-text: var(--green-text);
  --danger:         var(--red);          --danger-bg: var(--red-bg);
  --danger-border:  var(--red-border);   --danger-text: var(--red-text);
  --warning:        var(--amber);        --warning-bg: var(--amber-bg);
  --warning-border: var(--amber-border); --warning-text: var(--amber-text);
  --info:           var(--blue);         --info-bg: var(--blue-bg);
  --info-border:    var(--blue-border);  --info-text: var(--blue-text);

  /* Layout */
  --topbar-h:   60px;
  --sidebar-w:  240px;
  --sidebar-c:  68px;   /* collapsed */

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 9999px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(0,0,0,.06);
  --sh-sm: 0 2px 8px rgba(0,0,0,.08);
  --sh-md: 0 4px 16px rgba(0,0,0,.10);
  --sh-lg: 0 8px 32px rgba(0,0,0,.12);

  /* Transition */
  --tr: .18s ease;
  --tr-slow: .3s ease;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Entity accent overrides */
.app.entity-all         { --acc: var(--all-color); --acc-light: var(--all-light); --acc-mid: var(--all-mid); }
.app.entity-eguimos     { --acc: var(--egu-color); --acc-light: var(--egu-light); --acc-mid: var(--egu-mid); }
.app.entity-urbareal    { --acc: var(--urb-color); --acc-light: var(--urb-light); --acc-mid: var(--urb-mid); }
.app.entity-landconcept { --acc: var(--lnd-color); --acc-light: var(--lnd-light); --acc-mid: var(--lnd-mid); }

/* ────────────────────────────────────────────────────────────
   2. RESET & BASE
──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select { font-family: var(--font); }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ────────────────────────────────────────────────────────────
   3. APP LAYOUT (CSS Grid)
──────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100dvh;
  transition: grid-template-columns var(--tr-slow);
}

.app.sidebar-collapsed {
  grid-template-columns: var(--sidebar-c) 1fr;
}

/* ────────────────────────────────────────────────────────────
   4. TOPBAR
──────────────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--sh-xs);
  z-index: 200;
  position: relative;
  transition: border-color var(--tr);
}
/* iOS PWA standalone uniquement : padding-top pour le notch.
   En mode browser (Chrome Android), safe-area-inset-top vaut 0 et n'a pas d'effet,
   mais on l'isole quand même dans une media query display-mode pour ne pas
   affecter le layout en mode browser. */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--acc);
  transition: background var(--tr-slow);
}

.tb-left  { display: flex; align-items: center; gap: 14px; min-width: 200px; }
.tb-center { flex: 1; display: flex; justify-content: center; }
.tb-right { display: flex; align-items: center; gap: 10px; min-width: 200px; justify-content: flex-end; }

/* Sidebar toggle */
.sidebar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--txt-3);
  transition: background var(--tr), color var(--tr);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--txt-1); }

/* Logo */
.logo { display: flex; align-items: center; }
.logo-combined-img {
  height: 32px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

/* Entity selector */
.entity-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
}

.ent-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--txt-3);
  transition: all var(--tr);
  white-space: nowrap;
}
.ent-btn:hover { color: var(--txt-1); background: var(--surface); }
.ent-btn.active { background: var(--surface); color: var(--txt-1); box-shadow: var(--sh-xs); font-weight: 600; }

.ent-pip {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--txt-4);
  flex-shrink: 0;
  transition: background var(--tr);
}
.ent-btn[data-entity="eguimos"]     .ent-pip { background: var(--egu-color); }
.ent-btn[data-entity="urbareal"]    .ent-pip { background: var(--urb-color); }
.ent-btn[data-entity="landconcept"] .ent-pip { background: var(--lnd-color); }
.ent-btn[data-entity="all"]         .ent-pip { background: var(--all-color); }

/* Search */
.tb-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 6px 14px;
  transition: border-color var(--tr), box-shadow var(--tr);
  position: relative;
}
.tb-search-wrap:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-light); }
.tb-search-wrap i { color: var(--txt-4); font-size: 12px; }
.tb-search-input { border: none; background: none; outline: none; font-size: 13px; color: var(--txt-1); width: 160px; }
.tb-search-input::placeholder { color: var(--txt-4); }

/* Icon buttons */
.tb-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--txt-3);
  transition: background var(--tr), color var(--tr);
  flex-shrink: 0;
}
.tb-icon-btn:hover { background: var(--bg); color: var(--txt-1); }
.tb-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* User chip */
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--tr);
  border: 1px solid transparent;
}
.user-chip:hover { background: var(--bg); border-color: var(--border); }

.user-avatar {
  width: 32px; height: 32px;
  background: var(--acc);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  transition: background var(--tr-slow);
}
.user-chip-info { display: flex; flex-direction: column; line-height: 1.2; }
.uc-name { font-size: 12px; font-weight: 600; color: var(--txt-1); }
.uc-role { font-size: 10px; color: var(--txt-3); }
.uc-arrow { font-size: 10px; color: var(--txt-4); }

/* ────────────────────────────────────────────────────────────
   5. SIDEBAR
──────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--tr-slow);
  z-index: 100;
  width: var(--sidebar-w);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-group { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-sep {
  margin: 8px 14px;
  border: none;
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  color: var(--txt-3);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--tr), color var(--tr);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item i {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--tr);
}
.nav-lbl { flex: 1; transition: opacity var(--tr-slow), width var(--tr-slow); }
.nav-item:hover  { background: var(--bg); color: var(--txt-1); }
.nav-item.active { background: var(--acc-light); color: var(--acc); font-weight: 600; }
.nav-item.active i { color: var(--acc); }

.nav-pill {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--r-full);
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Collapsed state */
.app.sidebar-collapsed .sidebar { width: var(--sidebar-c); }
.app.sidebar-collapsed .nav-lbl,
.app.sidebar-collapsed .nav-pill,
.app.sidebar-collapsed .sf-info  { opacity: 0; width: 0; pointer-events: none; }
.app.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.app.sidebar-collapsed .nav-item i { width: auto; }
.app.sidebar-collapsed .nav-group { padding: 4px 8px; }


/* Sidebar footer */
.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sf-user { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.sf-avatar {
  width: 30px; height: 30px;
  background: var(--acc);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  transition: background var(--tr-slow);
}
.sf-info { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.sf-name  { font-size: 12px; font-weight: 600; white-space: nowrap; }
.sf-status { font-size: 10px; color: var(--txt-3); display: flex; align-items: center; gap: 4px; }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }

/* ────────────────────────────────────────────────────────────
   6. MAIN CONTENT
──────────────────────────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  height: calc(100dvh - var(--topbar-h));
  position: relative;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--txt-4);
  font-size: 28px;
}

/* View wrapper */
.view { padding: 28px; min-height: 100%; animation: fadeIn .2s ease; }
.view-sm-pad { padding: 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* View header */
.view-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.view-hd-left h1 { font-size: 22px; font-weight: 700; color: var(--txt-1); }
.view-hd-left p  { font-size: 13px; color: var(--txt-3); margin-top: 2px; }
.view-hd-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ────────────────────────────────────────────────────────────
   7. COMPONENTS — Buttons
──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  transition: all var(--tr);
  cursor: pointer; border: none; white-space: nowrap;
}
.btn-primary {
  background: var(--acc); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: var(--sh-sm); }
.btn-outline {
  background: var(--surface); color: var(--txt-2);
  border: 1px solid var(--border2);
  box-shadow: var(--sh-xs);
}
.btn-outline:hover { border-color: var(--acc); color: var(--acc); }
.btn-ghost { background: transparent; color: var(--txt-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-ghost-sm {
  font-size: 12px; font-weight: 500; color: var(--acc);
  padding: 4px 8px; border-radius: var(--r-sm);
  background: transparent; cursor: pointer;
}
.btn-ghost-sm:hover { background: var(--acc-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.sec-filter-btn.active { background: var(--acc); color: #fff; }
.sec-filter-btn.active:hover { filter: brightness(1.1); }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; color: var(--txt-2); }
.btn-icon:hover { opacity: .8; }

/* ────────────────────────────────────────────────────────────
   8. COMPONENTS — Cards
──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.card-pad { padding: 20px; }
.card:hover { box-shadow: var(--sh-sm); }

.section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-hd h2 { font-size: 15px; font-weight: 700; color: var(--txt-1); }
.section-hd .link-all { font-size: 12px; color: var(--acc); font-weight: 500; }
.section-hd .link-all:hover { text-decoration: underline; }

/* ────────────────────────────────────────────────────────────
   9. COMPONENTS — Badges & Tags
──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-egu  { background: var(--egu-light); color: var(--egu-color); }
.badge-urb  { background: var(--urb-light); color: var(--urb-color); }
.badge-lnd  { background: var(--lnd-light); color: var(--lnd-color); }
.badge-all  { background: var(--all-light); color: var(--all-color); }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-orange { background: color-mix(in srgb, #F97316 18%, transparent); color: #C2410C; }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-gray   { background: var(--bg);        color: var(--txt-3); }
.badge-urgent { background: #DC2626; color: #fff; animation: urgent-pulse 1.5s ease-in-out infinite; }
/* Variantes dark mode : fonds translucides + texte clair lisible sur fond sombre */
html.dark-mode .badge-orange,
html.theme-preload-dark .badge-orange { background: rgba(249,115,22,0.22); color: #FDBA74; }
@keyframes urgent-pulse { 0%,100% { opacity:1 } 50% { opacity:.7 } }

.tag {
  background: var(--bg);
  color: var(--txt-3);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ────────────────────────────────────────────────────────────
   10. COMPONENTS — Forms & Inputs
──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--txt-2); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--txt-1);
  background: var(--surface);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.form-control:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-light); }
.form-control::placeholder { color: var(--txt-4); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 8px 14px;
  box-shadow: var(--sh-xs);
}
.search-bar:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-light); }
.search-bar i { color: var(--txt-4); font-size: 13px; }
.search-bar input { border: none; background: none; outline: none; font-size: 13px; color: var(--txt-1); flex: 1; }
.search-bar input::placeholder { color: var(--txt-4); }

/* Filter row */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
  padding: 5px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border2);
  background: var(--surface);
  font-size: 12px; font-weight: 500;
  color: var(--txt-3);
  cursor: pointer;
  transition: all var(--tr);
}
.filter-chip:hover,
.filter-chip.active { background: var(--acc-light); color: var(--acc); border-color: var(--acc); }

/* ────────────────────────────────────────────────────────────
   11. COMPONENTS — Avatar
──────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; color: #fff;
  overflow: hidden;
  /* Garde-fou : si aucune classe de taille n'est appliquée (avatar-sm/md/lg/xl),
     limite quand même la taille pour éviter qu'une grosse photo (ex: logo 2000x2000)
     ne déforme tout le layout. Les classes de taille override ces valeurs. */
  width: 40px; height: 40px; font-size: 14px;
}
.avatar-sm  { width: 30px; height: 30px; font-size: 10px; }
.avatar-md  { width: 38px; height: 38px; font-size: 13px; }
.avatar-lg  { width: 52px; height: 52px; font-size: 17px; }
.avatar-xl  { width: 70px; height: 70px; font-size: 24px; }

.avatar-egu  { background: var(--egu-color); }
.avatar-urb  { background: var(--urb-color); }
.avatar-lnd  { background: var(--lnd-color); }
.avatar-all  { background: var(--all-color); }

/* Photo dans un avatar (remplace les initiales) */
.avatar-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ── Photo picker dans le modal collaborateur ── */
.photo-picker {
  display: inline-block;
  position: relative;
  cursor: pointer;
}
.photo-picker-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  font-weight: 700;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.photo-picker-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.38);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  opacity: 0;
  transition: opacity .18s;
}
.photo-picker:hover .photo-picker-overlay { opacity: 1; }

/* ────────────────────────────────────────────────────────────
   12. COMPONENTS — Status Indicators
──────────────────────────────────────────────────────────── */
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.status-bureau  { background: var(--green); }
.status-terrain { background: var(--amber); }
.status-conge   { background: var(--txt-4); }
.status-reunion { background: var(--blue); }

/* ────────────────────────────────────────────────────────────
   13. NOTIFICATION PANEL
──────────────────────────────────────────────────────────── */
.notif-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 340px;
  height: calc(100dvh - var(--topbar-h));
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--sh-lg);
  z-index: 500;
  transform: translateX(100%);
  transition: transform var(--tr-slow);
  display: flex; flex-direction: column;
}
.notif-panel.open { transform: none; }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-panel-head h3 { font-size: 14px; font-weight: 700; }
.notif-list { flex: 1; overflow-y: auto; padding: 8px; }
.notif-item {
  display: flex; align-items: center; gap: 0;
  padding: 0 0 0 0;
  border-radius: var(--r-md);
  transition: background var(--tr);
}
.notif-content {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 4px 10px 12px;
  flex: 1; min-width: 0; cursor: pointer;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--acc-light); }
.notif-item.unread:hover { filter: brightness(.97); }
.notif-icon {
  width: 32px; height: 32px;
  background: var(--acc);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; flex-shrink: 0;
}
.notif-text { flex: 1; }
.notif-text p { font-size: 12px; color: var(--txt-1); line-height: 1.4; }
.notif-text span { font-size: 10px; color: var(--txt-4); margin-top: 2px; display: block; }
.notif-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc); margin-top: 4px; flex-shrink: 0; }
.notif-delete-btn { background: none; border: none; color: var(--txt-4); cursor: pointer; padding: 8px 10px; border-radius: var(--r-sm); font-size: 11px; opacity: .4; transition: opacity .15s, color .15s; flex-shrink: 0; align-self: stretch; display: flex; align-items: center; }
.notif-item:hover .notif-delete-btn { opacity: 1; }
.notif-delete-btn:hover { color: var(--red); background: rgba(239,68,68,.1); opacity: 1; }

/* User dropdown */
.user-dropdown {
  position: fixed;
  top: 56px; right: 16px;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  z-index: 600;
  display: none;
  overflow: hidden;
}
.user-dropdown.open { display: block; animation: fadeIn .15s ease; }
.ud-profile { padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.ud-avatar { width: 36px; height: 36px; background: var(--acc); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.ud-name { font-size: 13px; font-weight: 700; }
.ud-role { font-size: 11px; color: var(--txt-3); }
.ud-sep { border: none; border-top: 1px solid var(--border); margin: 0; }
.ud-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 13px; color: var(--txt-2); transition: background var(--tr); }
.ud-item:hover { background: var(--bg); }
.ud-item i { width: 16px; text-align: center; color: var(--txt-3); }
.ud-logout { color: var(--red); }
.ud-logout i { color: var(--red); }

/* Overlay */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 250;
}
.overlay.show { display: block; }

/* ────────────────────────────────────────────────────────────
   14. VIEW — DASHBOARD
──────────────────────────────────────────────────────────── */

/* ── Hero Banner ─────────────────────────────────────────── */
.dash-hero {
  border-radius: var(--r-xl);
  background: linear-gradient(130deg, #1e2530 0%, #252e3c 55%, #1a2028 100%);
  padding: 32px 36px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
/* Filigrane logo groupe — droite */
.dash-hero-watermark {
  position: absolute;
  right: -20px; top: 50%;
  transform: translateY(-50%);
  width: 380px;
  opacity: .07;
  pointer-events: none;
  user-select: none;
}
.dash-hero-watermark img { width: 100%; }
/* Halo décoratif */
.dash-hero::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(197,59,42,.18) 0%, transparent 70%);
}
.dash-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 40%;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(40,151,181,.12) 0%, transparent 70%);
}
.dash-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.dash-hero-left { flex: 1; min-width: 180px; }
.dash-hero-greeting {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
}
.dash-hero-greeting span { color: var(--acc, #C53B2A); }
.dash-hero-date {
  font-size: 13px;
  opacity: .6;
  margin-bottom: 14px;
}
.dash-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.hero-chip i { opacity: .7; font-size: 10px; }
/* Widget météo dans le hero */
.hero-weather {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  color: #fff;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
  min-width: 160px;
  transition: opacity .35s ease, background .2s ease;
  cursor: pointer;
  text-decoration: none;
}
.hero-weather:hover { background: rgba(255,255,255,.18); }
.hw-spin { font-size: 22px; opacity: .5; margin: auto; }
.hw-icon { font-size: 36px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); flex-shrink: 0; }
.hw-info { display: flex; flex-direction: column; gap: 2px; }
.hw-temp { font-size: 26px; font-weight: 800; line-height: 1; }
.hw-unit { font-size: 14px; font-weight: 500; opacity: .8; }
.hw-label { font-size: 11px; opacity: .75; margin-top: 2px; }
.hw-city { font-size: 10.5px; opacity: .6; margin-top: 3px; }
.hw-city i { font-size: 9px; }
.hw-detail { display: flex; flex-direction: column; gap: 4px; font-size: 11px; opacity: .6; margin-left: 4px; }
.hw-detail i { width: 12px; text-align: center; }

/* KPIs dans le bandeau */
.dash-hero-kpis {
  display: flex; gap: 6px; flex-shrink: 0;
}
.hero-kpi {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  text-align: center;
  min-width: 80px;
  backdrop-filter: blur(4px);
  transition: background var(--tr);
}
.hero-kpi:hover { background: rgba(255,255,255,.15); }
.hero-kpi-val { font-size: 24px; font-weight: 800; line-height: 1; }
.hero-kpi-lbl { font-size: 10px; opacity: .6; margin-top: 4px; font-weight: 500; }

/* ── Cartes entités ──────────────────────────────────────── */
.dash-entities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 20px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  cursor: pointer;
  transition: transform var(--tr), box-shadow var(--tr);
  position: relative;
  overflow: hidden;
  border-top: 4px solid transparent;
}
.entity-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.ec-geo { border-top-color: var(--egu-color); }
.ec-urb { border-top-color: var(--urb-color); }
.ec-lnd { border-top-color: var(--lnd-color); }
.ec-geo:hover { box-shadow: 0 8px 28px rgba(197,59,42,.15); }
.ec-urb:hover { box-shadow: 0 8px 28px rgba(40,151,181,.15); }
.ec-lnd:hover { box-shadow: 0 8px 28px rgba(94,138,48,.15); }
/* Halo de fond discret */
.ec-geo::after { content:''; position:absolute; top:-40px; right:-40px; width:120px; height:120px; border-radius:50%; background:rgba(197,59,42,.05); }
.ec-urb::after { content:''; position:absolute; top:-40px; right:-40px; width:120px; height:120px; border-radius:50%; background:rgba(40,151,181,.05); }
.ec-lnd::after { content:''; position:absolute; top:-40px; right:-40px; width:120px; height:120px; border-radius:50%; background:rgba(94,138,48,.05); }
.ec-logo { width: 100%; display: flex; justify-content: center; position: relative; z-index: 1; }
.ec-logo img { height: 72px; width: auto; max-width: 100%; object-fit: contain; }
.ec-stats {
  display: flex; gap: 20px; width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  position: relative; z-index: 1;
}
.ec-stat { flex: 1; text-align: center; }
.ec-val  { display: block; font-size: 22px; font-weight: 800; color: var(--txt-1); line-height: 1; }
.ec-lbl  { display: block; font-size: 10px; color: var(--txt-4); margin-top: 3px; font-weight: 500; }

/* ── Dashboard grid ──────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.dash-col  { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ── Accès rapide ────────────────────────────────────────── */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.qa-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px;
  padding: 20px 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--tr);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.qa-item:hover {
  background: var(--acc-light);
  border-color: var(--acc);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.qa-icon {
  width: 44px; height: 44px;
  background: var(--bg);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--acc);
  transition: all var(--tr);
}
.qa-item:hover .qa-icon { background: var(--acc); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.qa-label { font-size: 11px; font-weight: 600; color: var(--txt-2); line-height: 1.2; }

/* ── Actualités dashboard ────────────────────────────────── */
.dash-news-list { display: flex; flex-direction: column; gap: 8px; }
.dash-news-item {
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--tr);
}
.dash-news-item:hover { box-shadow: var(--sh-sm); transform: translateX(3px); border-color: var(--acc); }
.dni-accent {
  width: 4px;
  align-self: stretch;
  background: var(--acc);
  flex-shrink: 0;
}
.ent-border-egu .dni-accent { background: var(--egu-color); }
.ent-border-urb .dni-accent { background: var(--urb-color); }
.ent-border-lnd .dni-accent { background: var(--lnd-color); }
.ent-border-all .dni-accent { background: var(--all-color); }
.dni-body { flex: 1; padding: 12px 14px; min-width: 0; }
.dni-title { font-size: 13px; font-weight: 600; color: var(--txt-1); line-height: 1.35; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dni-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dni-date  { font-size: 11px; color: var(--txt-4); display: flex; align-items: center; gap: 3px; }
.dni-arrow { color: var(--txt-4); font-size: 11px; margin-right: 14px; flex-shrink: 0; }

/* ── Agenda widget ───────────────────────────────────────── */
.gcal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.gcal-date { font-size: 13px; font-weight: 700; }
.gcal-events { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.gcal-event {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--surface);
  border-radius: var(--r-md);
  border-left: 3px solid var(--acc);
  cursor: pointer;
  transition: box-shadow var(--tr);
}
.gcal-event:hover { box-shadow: var(--sh-sm); }
.gcal-event.ent-egu { border-color: var(--egu-color); }
.gcal-event.ent-urb { border-color: var(--urb-color); }
.gcal-event.ent-lnd { border-color: var(--lnd-color); }
.gcal-event.ent-all { border-color: var(--all-color); }
.ge-time  { font-size: 11px; font-weight: 700; color: var(--txt-3); min-width: 36px; }
.ge-title { font-size: 12px; font-weight: 600; color: var(--txt-1); flex: 1; }
.ge-loc   { font-size: 10px; color: var(--txt-4); }

/* ── Activité récente ────────────────────────────────────── */
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.act-icon {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
  color: var(--acc); background: var(--acc-light);
}
.act-text { font-size: 12px; color: var(--txt-2); line-height: 1.4; }
.act-time { font-size: 10px; color: var(--txt-4); margin-top: 2px; }

/* ── Collaborateurs ──────────────────────────────────────── */
.team-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.team-item:last-child { border-bottom: none; }
.ti-info  { flex: 1; min-width: 0; }
.ti-name  { font-size: 12px; font-weight: 600; color: var(--txt-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-role  { font-size: 10px; color: var(--txt-4); }
.ti-dispo { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--txt-3); white-space: nowrap; }

/* ── Stats row (conservé pour compatibilité) ─────────────── */
.stats-row {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--tr), transform var(--tr);
}
.stat-card:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.si-missions { background: var(--egu-light); color: var(--egu-color); }
.si-docs     { background: var(--urb-light);  color: var(--urb-color); }
.si-conges   { background: var(--lnd-light);  color: var(--lnd-color); }
.si-messages { background: var(--acc-light);  color: var(--acc); }
.si-absences { background: var(--red-bg);     color: var(--red); }
.stat-val    { font-size: 26px; font-weight: 800; color: var(--txt-1); line-height: 1; }
.stat-label  { font-size: 12px; color: var(--txt-3); margin-top: 3px; }
.stat-sub    { font-size: 11px; color: var(--txt-4); margin-top: 4px; font-weight: 500; }

/* ── np-* (rétrocompatibilité actualités) ───────────────── */
.np-pin  { color: var(--acc); font-size: 11px; }
.np-body { flex: 1; min-width: 0; }
.np-title { font-size: 13px; font-weight: 600; color: var(--txt-1); line-height: 1.3; }
.np-meta  { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.np-date  { font-size: 11px; color: var(--txt-4); }

/* ────────────────────────────────────────────────────────────
   15. VIEW — ACTUALITÉS
──────────────────────────────────────────────────────────── */
.news-tabs {
  display: flex; gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  width: fit-content;
}
.news-tab {
  padding: 6px 18px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
  color: var(--txt-3);
  cursor: pointer;
  transition: all var(--tr);
}
.news-tab:hover { color: var(--txt-1); background: var(--surface); }
.news-tab.active { background: var(--surface); color: var(--txt-1); box-shadow: var(--sh-xs); }

.news-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--tr);
  position: relative;
}
.news-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); border-color: var(--acc-mid); }
.news-card.pinned { border-top: 3px solid var(--acc); }
.nc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.nc-pin-icon { color: var(--acc); font-size: 12px; }
.nc-title { font-size: 14px; font-weight: 700; color: var(--txt-1); margin-bottom: 8px; line-height: 1.4; }
.nc-excerpt { font-size: 12px; color: var(--txt-3); line-height: 1.6; margin-bottom: 14px; }
.nc-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.nc-author { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--txt-3); }
.nc-author-avatar { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #fff; background: var(--acc); }
.nc-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ────────────────────────────────────────────────────────────
   16. VIEW — VEILLE MÉTIER
──────────────────────────────────────────────────────────── */
.veille-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.veille-sidebar { display: flex; flex-direction: column; gap: 8px; }
.veille-sidebar-title { font-size: 11px; font-weight: 700; color: var(--txt-3); text-transform: uppercase; letter-spacing: .06em; padding: 4px 0; }
.veille-filter-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--txt-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--tr);
}
.veille-filter-item:hover,
.veille-filter-item.active { background: var(--acc-light); color: var(--acc); border-color: var(--acc); }
.vf-count { font-size: 10px; font-weight: 700; background: var(--bg); padding: 1px 6px; border-radius: var(--r-full); }

.veille-articles { display: flex; flex-direction: column; gap: 14px; }

.veille-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--tr);
  display: flex; gap: 14px;
}
.veille-card:hover { box-shadow: var(--sh-sm); border-color: var(--acc-mid); }
.vc-source-badge {
  padding: 4px 10px;
  background: var(--acc-light);
  color: var(--acc);
  border-radius: var(--r-full);
  font-size: 10px; font-weight: 700;
  white-space: nowrap;
  height: fit-content;
  flex-shrink: 0;
}
.vc-body { flex: 1; min-width: 0; }
.vc-title { font-size: 14px; font-weight: 700; color: var(--txt-1); margin-bottom: 6px; line-height: 1.3; }
.vc-summary { font-size: 12px; color: var(--txt-3); line-height: 1.6; margin-bottom: 10px; }
.vc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vc-date { font-size: 11px; color: var(--txt-4); }

/* ────────────────────────────────────────────────────────────
   17. VIEW — ANNUAIRE
──────────────────────────────────────────────────────────── */
.annuaire-controls {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.annuaire-controls .search-bar { flex: 1; min-width: 200px; }

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

.employee-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all var(--tr);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 10px;
}
.employee-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.ec-avatar-wrap { position: relative; }
.ec-status {
  position: absolute; bottom: 0; right: 0;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.ec-status.bureau  { background: var(--green); }
.ec-status.terrain { background: var(--amber); }
.ec-status.conge   { background: var(--txt-4); }
.ec-name  { font-size: 14px; font-weight: 700; color: var(--txt-1); }
.ec-role  { font-size: 11px; color: var(--txt-3); }
.ec-dispo { font-size: 11px; color: var(--txt-3); font-style: italic; }
.ec-footer { display: flex; gap: 6px; margin-top: 4px; }
.ec-actions { display: flex; gap: 6px; margin-top: 2px; }
.ec-action-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--txt-3);
  transition: all var(--tr);
}
.ec-action-btn:hover { background: var(--acc-light); color: var(--acc); border-color: var(--acc); }

.ec-skills { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.ec-skill { background: var(--bg); color: var(--txt-3); padding: 2px 7px; border-radius: var(--r-full); font-size: 10px; border: 1px solid var(--border); }

/* ────────────────────────────────────────────────────────────
   18. VIEW — GED
──────────────────────────────────────────────────────────── */
.ged-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }

.ged-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  height: fit-content;
}
.ged-tree-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.ged-tree-body { padding: 8px; }
.tree-entity { margin-bottom: 4px; }
.tree-entity-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background var(--tr);
  background: none; border: none; color: var(--txt-1);
  text-align: left;
}
.tree-entity-btn:hover { background: var(--bg); }
.tree-entity-btn.active { background: var(--acc-light); color: var(--acc); }
.tree-chevron { font-size: 10px; color: var(--txt-4); transition: transform var(--tr); }
.tree-entity-btn.open .tree-chevron { transform: rotate(90deg); }
.tree-folders { padding-left: 16px; }
.tree-folder {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: 11px; color: var(--txt-3);
  cursor: pointer; transition: background var(--tr);
}
.tree-folder:hover { background: var(--bg); color: var(--txt-1); }
.tree-folder.active { background: var(--acc-light); color: var(--acc); font-weight: 600; }
.tree-folder i { font-size: 11px; }

.ged-main { display: flex; flex-direction: column; gap: 16px; }
.ged-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ged-toolbar .search-bar { flex: 1; }
.ged-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--txt-3); }
.ged-breadcrumb span { cursor: pointer; }
.ged-breadcrumb span:hover { color: var(--acc); }
.ged-breadcrumb i { font-size: 10px; }

.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--tr);
  display: flex; flex-direction: column; gap: 10px;
}
.doc-card:hover { box-shadow: var(--sh-sm); border-color: var(--acc-mid); transform: translateY(-1px); }
.doc-icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.doc-pdf   { background: var(--danger-border); color: #EF4444; }
.doc-dwg   { background: var(--info-bg); color: #3B82F6; }
.doc-xlsx  { background: var(--success-bg); color: #22C55E; }
.doc-docx  { background: color-mix(in srgb, #0EA5E9 14%, transparent); color: #0EA5E9; }
.doc-other { background: var(--bg); color: var(--txt-3); }
.doc-name  { font-size: 12px; font-weight: 700; color: var(--txt-1); line-height: 1.3; }
.doc-meta  { display: flex; flex-direction: column; gap: 3px; }
.doc-meta span { font-size: 10px; color: var(--txt-4); display: flex; align-items: center; gap: 4px; }
.doc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

/* ────────────────────────────────────────────────────────────
   19. VIEW — RH
──────────────────────────────────────────────────────────── */
.rh-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.rh-tab {
  padding: 10px 20px;
  font-size: 13px; font-weight: 600;
  color: var(--txt-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--tr);
}
.rh-tab:hover { color: var(--txt-1); }
.rh-tab.active { color: var(--acc); border-bottom-color: var(--acc); }

.rh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rh-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; }
.rh-form h3 { font-size: 15px; font-weight: 700; margin-bottom: 18px; }

.leave-list { display: flex; flex-direction: column; gap: 10px; }
.leave-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.leave-item-clickable {
  cursor: pointer;
}
.leave-item-clickable:hover {
  border-color: var(--acc);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.leave-item-cancel {
  border-color: #F97316;
  /* Teinte orange translucide : lisible en clair ET en sombre (le texte garde
     ses couleurs de thème par-dessus, pas de fond crème opaque qui masque tout) */
  background: color-mix(in srgb, #F97316 12%, transparent);
}
html.dark-mode .leave-item-cancel,
html.theme-preload-dark .leave-item-cancel {
  background: rgba(249, 115, 22, 0.16);
}
.li-info { flex: 1; }
.li-name  { font-size: 13px; font-weight: 700; }
.li-meta  { font-size: 11px; color: var(--txt-3); margin-top: 2px; }
.li-actions { display: flex; gap: 6px; }

/* ── Détail demande ── */
.leave-detail-grid { display: flex; flex-direction: column; gap: 10px; }
.ldg-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.ldg-lbl { min-width: 120px; color: var(--txt-3); font-weight: 600; flex-shrink: 0; }

/* ── Décalage des horaires ── */
.decal-block {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg);
}
.decal-block-hd {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--txt-3); margin-bottom: 10px;
}
.decal-block-hd i { margin-right: 6px; }
.li-meta-decal { display: flex; flex-direction: column; gap: 3px; }
.decal-meta-line { display: flex; align-items: center; gap: 5px; font-size: 11px; }
.decal-meta-line i { width: 12px; flex-shrink: 0; }

/* ── Modal détail RH — actions ── */
.mgr-detail-actions {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.mgr-revert-info {
  font-size: 12px; color: var(--txt-2);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; line-height: 1.5;
}
.mgr-action-approve {
  background: var(--green-bg); color: var(--green);
  border: 1px solid var(--green); font-weight: 600; padding: 10px;
}
.mgr-action-reject {
  background: var(--red-bg); color: var(--red);
  border: 1px solid var(--red); font-weight: 600; padding: 10px;
}
.mgr-action-revert {
  background: var(--bg); color: var(--txt-2);
  border: 1px solid var(--border); font-size: 12px;
}
.mgr-action-approve:hover { filter: brightness(.93); }
.mgr-action-reject:hover  { filter: brightness(.93); }
.mgr-action-revert:hover  { border-color: var(--acc); color: var(--acc); }

/* ── Section commentaires (modals absences) ── */
.leave-comments-section {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.leave-comments-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--txt-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.leave-comments-count {
  background: var(--acc);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.leave-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}
.leave-comments-empty {
  font-size: 12px;
  color: var(--txt-4);
  text-align: center;
  padding: 10px 0 4px;
  font-style: italic;
}
.leave-comment {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.leave-comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--acc-light);
  color: var(--acc);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.leave-comment-body {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 10px;
}
.leave-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.leave-comment-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--txt-1);
}
.leave-comment-date {
  font-size: 11px;
  color: var(--txt-4);
}
.leave-comment-text {
  font-size: 13px;
  color: var(--txt-2);
  line-height: 1.5;
}
.leave-comment-compose {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.leave-comment-send {
  background: var(--acc);
  color: #fff;
  border: none;
  margin-top: 6px;
  width: 100%;
}
.leave-comment-send:hover { background: var(--acc-dark, #1340A0); }

/* ── Notifications interactives ── */
.notif-interactive { cursor: pointer; }
.notif-interactive:hover { background: var(--bg); }
.notif-arrow {
  color: var(--txt-4);
  font-size: 10px;
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 0;
  color: var(--txt-4);
  font-size: 13px;
}
.notif-empty i { font-size: 26px; opacity: .4; }

/* ── Sélecteur période demi-journée ── */
.leave-period-row { display: flex; gap: 10px; }
.leave-period-opt {
  display: flex; align-items: center; gap: 8px;
  flex: 1; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; font-size: 13px;
  transition: border-color .15s, background .15s;
}
.leave-period-opt:has(input:checked) {
  border-color: var(--acc);
  background: var(--acc-light, var(--info-bg));
  font-weight: 700;
}
.leave-period-opt input[type="radio"] { margin: 0; accent-color: var(--acc); }

.expense-list { display: flex; flex-direction: column; gap: 10px; }
.expense-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.ei-amount { font-size: 16px; font-weight: 800; color: var(--txt-1); }

.manager-table { width: 100%; border-collapse: collapse; }
.manager-table th {
  text-align: left;
  font-size: 11px; font-weight: 700; color: var(--txt-3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
}
.manager-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--txt-1); }
.manager-table tr:last-child td { border-bottom: none; }
.manager-table tr:hover td { background: var(--bg); }

/* ── Admin collab cards (mobile-only, hidden by default) ── */
.admin-collab-cards { display: none; }

/* ── Filtres RH ── */
.rh-filter-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.rh-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--border2);
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--txt-2);
  cursor: pointer; transition: all var(--tr);
}
.rh-filter-btn:hover { border-color: var(--acc); color: var(--acc); }
.rh-filter-btn.active { background: var(--acc); border-color: var(--acc); color: #fff; }
.rh-filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: rgba(0,0,0,.12); border-radius: 10px;
  font-size: 10px; font-weight: 700;
}
.rh-filter-btn.active .rh-filter-count { background: rgba(255,255,255,.25); }

/* ── Export cards ── */
.export-card {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 20px 16px;
  text-align: center;
}
.export-card-hd {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--txt-1);
}
.export-card-hd i {
  color: var(--acc);
  margin-right: 6px;
}
.export-card .form-control {
  text-align: center;
}

/* ── Récapitulatif groupé par utilisateur ── */
.recap-group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.recap-group-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  cursor: pointer;
  transition: background var(--tr);
}
.recap-group-hd:hover { background: var(--surface2); }
.recap-group-chevron {
  font-size: 11px;
  color: var(--txt-4);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.recap-group-open .recap-group-chevron { transform: rotate(90deg); }
.recap-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.recap-group-open .recap-group-body {
  max-height: 2000px;
  border-top: 1px solid var(--border);
}
.recap-group-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.recap-stat {
  font-size: 11px;
  color: var(--txt-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
}
.recap-stat b { color: var(--txt-1); }
.recap-stat-pending {
  background: rgba(245,158,11,.08);
  border-color: var(--amber);
  color: var(--amber);
}
.recap-stat-pending b { color: var(--amber); }
.recap-stat-count {
  background: rgba(var(--acc-rgb),.08);
  border-color: var(--acc);
  color: var(--acc);
}
.recap-stat-count b { color: var(--acc); }
.recap-group-table {
  width: 100%;
  border-collapse: collapse;
}
.recap-group-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--txt-4);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.recap-group-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--txt-1);
}
.recap-group-table tr:last-child td { border-bottom: none; }
.recap-group-table tbody tr:hover td { background: rgba(var(--acc-rgb),.04); }

/* ── Sortable table headers ── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable-th:hover {
  color: var(--acc);
}

/* ── Sélecteur jours travaillés ── */
.ws-day-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-3);
  cursor: pointer;
  transition: all var(--tr);
  user-select: none;
}
.ws-day-toggle:hover { border-color: var(--acc); color: var(--acc); }
.ws-day-toggle.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}

/* ── Alertes congés dashboard ── */
.dash-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.dash-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border-left: 4px solid;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.dash-alert-icon {
  font-size: 18px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-alert-body { flex: 1; min-width: 0; }
.dash-alert-title { font-size: 12px; font-weight: 700; color: var(--txt-1); margin-bottom: 1px; }
.dash-alert-text  { font-size: 11px; color: var(--txt-3); }
.dash-alert-summer { border-color: var(--amber); }
.dash-alert-summer .dash-alert-icon { background: rgba(245,158,11,.12); color: var(--amber); }
.dash-alert-balance { border-color: var(--acc); }
.dash-alert-balance .dash-alert-icon { background: rgba(var(--acc-rgb),.1); color: var(--acc); }
.dash-alert-rh { border-color: #6366F1; }
.dash-alert-rh .dash-alert-icon { background: rgba(99,102,241,.1); color: #6366F1; }

/* ── Demandes urgentes dashboard ── */
.dash-urgent-section { background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.25); border-radius: var(--r-lg); padding: 12px 16px; margin-bottom: 16px; }
.dash-urgent-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dash-urgent-header h2 { font-size: 13px; font-weight: 700; color: var(--red, #DC2626); margin: 0; }
.dash-urgent-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--red, #DC2626); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; animation: urgent-pulse 1.5s ease-in-out infinite; }
.dash-urgent-list { display: flex; flex-direction: column; gap: 6px; }
.dash-urgent-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-radius: var(--r-md); cursor: pointer; transition: box-shadow .15s; border: 1px solid rgba(220,38,38,.25); }
.dash-urgent-item:hover { box-shadow: 0 2px 8px rgba(220,38,38,.2); }

/* ── Annonce épinglée ── */
.pinned-card-inner { padding: 16px 20px; }
.pinned-card-title { font-size: 15px; font-weight: 700; color: var(--txt-1); margin-bottom: 4px; }
.pinned-card-excerpt { font-size: 12px; color: var(--txt-3); line-height: 1.5; }
/* Bouton "masquer" (X) sur les annonces épinglées — préférence locale par user */
.pinned-dismiss-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--txt-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all .15s;
  z-index: 2;
}
.pinned-dismiss-btn:hover { background: var(--danger, #e74c3c); color: #fff; }
html.dark-mode .pinned-dismiss-btn { background: rgba(255,255,255,0.1); }
html.dark-mode .pinned-dismiss-btn:hover { background: var(--danger, #e74c3c); color: #fff; }

/* ── Planning des absences ── */
.planning-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.planning-table th, .planning-table td { text-align: center; padding: 0; border: 1px solid var(--border); }
.planning-table th { font-size: 10px; font-weight: 600; color: var(--txt-3); padding: 6px 0; background: var(--surface2); min-width: 28px; }
.plan-name-hd, .plan-name-cell { text-align: left !important; padding: 4px 8px !important; width: 130px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.plan-cell { height: 28px; min-width: 28px; position: relative; }
.plan-we { background: rgba(128,128,128,.12) !important; }
.plan-hol { background: rgba(245,158,11,.18) !important; }
.plan-pont { background: rgba(139,92,246,.15) !important; }
.plan-pont-m { background: rgba(139,92,246,.22) !important; }
.plan-day-hd.plan-we { background: rgba(128,128,128,.18) !important; color: var(--txt-4); }
.plan-day-hd.plan-hol { background: rgba(245,158,11,.25) !important; color: var(--amber, #F59E0B); }
.plan-day-hd.plan-pont { background: rgba(139,92,246,.2) !important; color: #A78BFA; }
.plan-day-hd.plan-pont-m { background: rgba(139,92,246,.28) !important; color: #A78BFA; }
.plan-approved { background: rgba(52,211,153,.7) !important; }
.plan-pending  { background: rgba(245,158,11,.7) !important; }
.plan-cancel   { background: rgba(249,115,22,.7) !important; }
.plan-cell-lbl { font-size: 8px; font-weight: 800; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.plan-hol .plan-cell-lbl { color: var(--amber, #F59E0B); text-shadow: none; }
.plan-pont .plan-cell-lbl, .plan-pont-m .plan-cell-lbl { color: #C4B5FD; text-shadow: none; }
.plan-saturday-counted { position: relative; }
.plan-saturday-counted::after { content: 'S'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 9px; font-weight: 800; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.4); }
.plan-legend { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.plan-legend-approved { background: rgba(52,211,153,.7); }
.plan-legend-pending  { background: rgba(245,158,11,.7); }
.plan-legend-we       { background: rgba(128,128,128,.25); }
.plan-legend-hol      { background: rgba(245,158,11,.35); }

/* Gantt annuel */
/* Ancien gantt (legacy) */
.gantt-table { width: max-content; border-collapse: collapse; }
.gantt-table th, .gantt-table td { border: none; padding: 0; }

/* ── Nouveau Gantt annuel v2 ── */
.gantt2-container { overflow-x: auto; }
.gantt2-header { display: flex; border-bottom: 2px solid var(--border); }
.gantt2-name-hd { width: 160px; min-width: 160px; padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--txt-2); background: var(--surface2); }
.gantt2-months { flex: 1; display: flex; background: var(--surface2); }
.gantt2-month { padding: 10px 2px; font-size: 10px; font-weight: 700; color: var(--txt-2); text-align: center; border-left: 1px solid var(--border); text-transform: uppercase; letter-spacing: .5px; }
.gantt2-body { }
.gantt2-row { display: flex; border-bottom: 1px solid var(--border); min-height: 52px; }
.gantt2-row:nth-child(even) { background: var(--surface2); }
.gantt2-row:hover { background: var(--acc-light, color-mix(in srgb, var(--acc) 10%, transparent)); }
.gantt2-name { width: 160px; min-width: 160px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.gantt2-name-text { font-size: 12px; font-weight: 600; color: var(--txt-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt2-name-sub { font-size: 10px; color: var(--txt-3); }
.gantt2-sat { font-size: 10px; color: var(--amber); margin-left: 0; }
.gantt2-timeline { flex: 1; position: relative; min-height: 36px; padding: 8px 0; }
.gantt2-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 22px; border-radius: 4px; min-width: 4px; cursor: pointer; transition: opacity .15s; display: flex; align-items: center; justify-content: center; }
.gantt2-bar:hover { opacity: .85; box-shadow: 0 2px 8px rgba(0,0,0,.2); z-index: 5; }
.gantt2-bar-approved { background: #34D399; }
.gantt2-bar-pending  { background: #FBBF24; }
.gantt2-bar-label { font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.3); white-space: nowrap; padding: 0 4px; }
.gantt2-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #EF4444; z-index: 4; }
.gantt2-today::before { content: ''; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; background: #EF4444; border-radius: 50%; }
.gantt2-grid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: .4; }

/* ── Planning annuel jour par jour ── */
.pa-scroll { overflow-x: auto; max-height: calc(100dvh - 260px); overflow-y: auto; border: 1px solid var(--border); }
.pa-table { border-collapse: collapse; width: max-content; }
.pa-table th, .pa-table td { padding: 0; text-align: center; border: 1px solid var(--border); }
.pa-name-hd { position: sticky; left: 0; z-index: 4; background: var(--surface); padding: 6px 10px !important; font-size: 11px; text-align: left; min-width: 130px; max-width: 130px; border-right: 2px solid var(--border) !important; }
.pa-name { position: sticky; left: 0; z-index: 3; background: var(--surface); padding: 3px 8px !important; text-align: left; min-width: 130px; max-width: 130px; border-right: 2px solid var(--border) !important; vertical-align: middle; }
.pa-name-txt { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100px; vertical-align: middle; }
.pa-name-sub { font-size: 9px; color: var(--txt-3); }
.pa-month-hd { font-size: 10px; font-weight: 700; color: #fff; padding: 5px 2px !important; border-bottom: 2px solid #333 !important; border-left: 2px solid #333 !important; text-transform: uppercase; letter-spacing: .5px; background: #475569; position: sticky; top: 0; z-index: 2; }
.pa-day-hd { font-size: 9px; font-weight: 600; color: var(--txt-2); width: 20px; min-width: 20px; max-width: 20px; height: 18px; position: sticky; top: 27px; z-index: 2; background: var(--surface); }
.pa-day-letter { font-size: 8px; color: var(--txt-4); width: 20px; min-width: 20px; max-width: 20px; height: 14px; position: sticky; top: 46px; z-index: 2; background: var(--surface); border-bottom: 2px solid #333 !important; }
.pa-cell { width: 20px; min-width: 20px; max-width: 20px; height: 22px; position: relative; }
.pa-cell-lbl { font-size: 7px; font-weight: 800; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.pa-hol .pa-cell-lbl { color: var(--danger-text); text-shadow: none; }
.pa-pont .pa-cell-lbl { color: var(--purple-text); text-shadow: none; }
.pa-pont-m .pa-cell-lbl { color: #fff; text-shadow: none; }
.pa-we { background: #E2E8F0 !important; }
.pa-hol { background: #FCA5A5 !important; }
.pa-pont { background: var(--purple-light) !important; }
.pa-pont-m { background: #8B5CF6 !important; }
/* Aujourd'hui : colonne entière surlignée + fond bleu clair */
.pa-today { background: var(--info-border) !important; }
.pa-day-hd.pa-today { background: #3B82F6 !important; color: #fff; font-weight: 800; border-radius: 0; }
.pa-day-letter.pa-today { background: #3B82F6 !important; color: #fff; font-weight: 700; }
.pa-cell.pa-today:not(.pa-approved):not(.pa-pending):not(.pa-hol):not(.pa-pont):not(.pa-pont-m) { background: #BFDBFE !important; }
.pa-approved { background: #34D399 !important; }
.pa-pending  { background: #FBBF24 !important; }
.pa-table tbody tr:nth-child(even) .pa-name { background: #F8FAFC; }
.pa-table tbody tr:hover .pa-name { background: var(--info-bg) !important; }
.pa-table tbody tr:hover .pa-cell:not(.pa-approved):not(.pa-pending):not(.pa-hol):not(.pa-pont):not(.pa-pont-m):not(.pa-we) { background: var(--info-bg); }

/* ── Multi-lignes note de frais ── */
.exp-line { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 10px; }
.exp-line + .exp-line { border-top: 1px solid var(--border); }

/* ── Zone justificatif note de frais ── */
.expense-file-zone {
  display: flex; align-items: center; gap: 8px;
  border: 2px dashed var(--border2);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer; background: var(--bg);
  font-size: 12px; color: var(--txt-3);
  transition: border-color var(--tr), background var(--tr);
}
.expense-file-zone:hover { border-color: var(--acc); background: rgba(var(--acc-rgb),.04); }
/* Retour visuel pendant le glisser-déposer */
.expense-file-zone.drag-over {
  border-color: var(--acc);
  border-style: solid;
  background: color-mix(in srgb, var(--acc) 12%, transparent);
  transform: scale(1.01);
}
.expense-attach-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--acc); text-decoration: none;
  margin-top: 4px; font-weight: 500;
}
.expense-attach-link:hover { text-decoration: underline; }

/* ────────────────────────────────────────────────────────────
   20. VIEW — MESSAGERIE
──────────────────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  /* La largeur de la liste est plafonnée à 40 % de la zone → la conversation
     garde toujours de la place, même si l'utilisateur a élargi la barre ou que
     son écran/zoom réduit la largeur disponible. minmax(0,1fr) autorise la
     colonne conversation à se rétrécir sans déborder. */
  grid-template-columns: min(var(--chat-sidebar-w, 260px), 40%) 6px minmax(0, 1fr);
  height: calc(100dvh - var(--topbar-h));
}

/* Resize handle */
.chat-resize-handle {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 3;
  transition: background .15s;
}
.chat-resize-handle:hover,
.chat-resize-handle.dragging { background: var(--acc); opacity: 0.4; }
.chat-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 30px;
  border-radius: 2px;
  background: var(--border);
  transition: background .15s;
}
.chat-resize-handle:hover::after { background: var(--acc); }

.chat-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-head { padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-sidebar-head h2 { font-size: 15px; font-weight: 700; }
.chat-search { margin-top: 10px; }

.ch-section-title {
  font-size: 10px; font-weight: 700; color: var(--txt-4);
  text-transform: uppercase; letter-spacing: .07em;
  padding: 12px 14px 6px;
}
.channel-list { flex: 1; overflow-y: auto; }
.channel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--tr);
}
.channel-item:hover { background: var(--bg); }
.channel-item.active { background: var(--acc-light); }
.ch-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0; color: #fff;
  overflow: hidden; /* clip pour les .avatar-photo */
}
.ch-icon .avatar-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 0; /* le parent gère déjà le radius */
}
.ch-icon.type-public  { background: var(--txt-3); }
.ch-icon.type-entity  { background: var(--acc); }
.ch-icon.type-project { background: var(--amber); }
.ch-icon.type-agence  { background: var(--green); }
.ch-icon.type-dm      { background: var(--egu-color); }
.ch-name { font-size: 13px; font-weight: 600; color: var(--txt-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-last { font-size: 11px; color: var(--txt-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-info { flex: 1; min-width: 0; }
.ch-unread { background: var(--red); color: #fff; font-size: 9px; font-weight: 700; border-radius: var(--r-full); padding: 2px 6px; flex-shrink: 0; }
/* Pastille "non lu" (conversation marquée non lue sans message non lu réel) */
.ch-unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex-shrink: 0; display: inline-block; }
/* Conversation non lue : nom en gras + aperçu plus marqué */
.channel-item.unread .ch-name { font-weight: 800; color: var(--txt-1); }
.channel-item.unread .ch-last { color: var(--txt-2); font-weight: 600; }
/* Bouton d'action (marquer lu/non lu) révélé au survol */
.ch-action {
  opacity: 0; background: none; border: none; color: var(--txt-3);
  cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 13px;
  flex-shrink: 0; transition: opacity .12s, background .12s, color .12s;
}
.channel-item:hover .ch-action { opacity: 1; }
.ch-action:hover { background: var(--surface2); color: var(--acc); }
/* Sur tactile (pas de survol), garder le bouton visible discrètement */
@media (hover: none) { .ch-action { opacity: .55; } }

/* Chat main */
.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-header h3 { font-size: 15px; font-weight: 700; }
.chat-header p  { font-size: 12px; color: var(--txt-3); }
.chat-actions { margin-left: auto; display: flex; gap: 8px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 0; }
.msg-date-divider { text-align: center; font-size: 11px; color: var(--txt-4); font-weight: 600; padding: 12px 0; margin-top: 8px; position: relative; }
.msg-date-divider::before,
.msg-date-divider::after { content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--border); }
.msg-date-divider::before { left: 0; }
.msg-date-divider::after  { right: 0; }

.msg-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; }
.msg-row.mine { flex-direction: row-reverse; }
/* Groupement messages consécutifs (style Google Chat) */
.msg-row.msg-continuation { margin-top: 1px; }
.msg-row.msg-continuation .msg-avatar { display: none; }
.msg-row.msg-continuation .msg-meta { display: none; }
.msg-row.msg-continuation .msg-bubble { padding: 4px 12px; border-radius: 4px 12px 12px 4px; }
.msg-row.mine.msg-continuation .msg-bubble { border-radius: 12px 4px 4px 12px; }
.msg-row.msg-continuation .msg-body { padding-left: 42px; }
.msg-row.mine.msg-continuation .msg-body { padding-left: 0; padding-right: 42px; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden; }
.msg-avatar .avatar-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.msg-body { max-width: 55%; min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg-row.mine .msg-meta { flex-direction: row-reverse; }
.msg-sender { font-size: 11px; font-weight: 700; color: var(--txt-2); }
.msg-time   { font-size: 10px; color: var(--txt-4); }
.msg-bubble {
  background: var(--msg-bubble-bg, var(--surface));
  border: 1px solid var(--msg-bubble-border, var(--border));
  border-radius: 12px 12px 12px 2px;
  padding: 8px 12px;
  font-size: var(--msg-font-size, 13px);
  line-height: 1.45;
  color: var(--msg-bubble-color, var(--txt-1));
  box-shadow: var(--sh-xs);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  width: fit-content;
  max-width: 100%;
}
.msg-row.mine .msg-bubble {
  background: var(--msg-mine-bg, var(--acc));
  color: var(--msg-mine-color, #fff);
  border-color: var(--msg-mine-border, var(--acc));
  border-radius: 12px 12px 2px 12px;
  margin-left: auto;
}

/* Emoji-only messages: bigger, no bubble background */
.msg-bubble.emoji-only {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 48px;
  line-height: 1.2;
}
.msg-bubble.emoji-only-sm {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 34px;
  line-height: 1.2;
}

.chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-format-bar {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cf-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--txt-3);
  cursor: pointer;
  font-size: 13px;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}
.cf-btn:hover {
  background: var(--bg);
  color: var(--txt-1);
  border-color: var(--border);
}
.cf-btn:active { transform: scale(0.94); }
.cf-btn b { font-weight: 800; }
.cf-btn u { text-decoration: underline; }
.cf-btn s { text-decoration: line-through; }
.cf-btn i.fas { font-size: 12px; }
.cf-color-wrap { position: relative; display: inline-flex; }
.cf-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.chat-input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 8px 16px;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.chat-input-wrap:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-light); }
.chat-input { flex: 1; border: none; background: none; outline: none; font-size: 13px; color: var(--txt-1); resize: none; font-family: inherit; line-height: 1.45; padding: 4px 0; min-height: 22px; max-height: 132px; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; word-break: break-word; }
textarea.chat-input { white-space: pre-wrap !important; }
.chat-input::placeholder { color: var(--txt-4); }
/* Placeholder pour contenteditable div */
div.chat-input:empty::before { content: attr(data-placeholder); color: var(--txt-4); pointer-events: none; }
div.chat-input { cursor: text; }
div.chat-input strong { font-weight: 700; }
div.chat-input em { font-style: italic; }
div.chat-input u { text-decoration: underline; }
div.chat-input s, div.chat-input strike { text-decoration: line-through; }
div.chat-input a { color: var(--acc); text-decoration: underline; }
div.chat-input ul { margin: 4px 0 4px 18px; padding: 0; }
.chat-send {
  width: 32px; height: 32px;
  background: var(--acc); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: filter var(--tr), transform var(--tr);
}
.chat-send:hover { filter: brightness(1.1); transform: scale(1.05); }

/* Group icon */
.ch-icon.type-group { background: var(--purple, #7C3AED); }

/* Message actions (hover to show) — positionné À CÔTÉ du message (pas au-dessus)
   pour ne jamais cacher les messages adjacents */
.msg-actions-bar {
  display: flex;                  /* Toujours dans le DOM, juste invisible */
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease-out, transform .12s ease-out;
  gap: 4px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(.95);
  left: 100%;                     /* Collée à la bulle (le pad ci-dessous évite le "trou") */
  padding-left: 8px;              /* Espace visuel + zone hover sans trou */
  z-index: 10;
  white-space: nowrap;
}
.msg-actions-bar::before {
  /* Boîte visuelle (avec border/bg) — séparée du conteneur pour pouvoir laisser
     un padding-left "fantôme" qui maintient le hover quand on déplace la souris. */
  content: '';
  position: absolute;
  inset: 0 0 0 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--sh-sm);
  z-index: -1;
}
.msg-row.mine .msg-actions-bar {
  left: auto;
  right: 100%;
  padding-left: 0;
  padding-right: 8px;
}
.msg-row.mine .msg-actions-bar::before { inset: 0 8px 0 0; }
.msg-body { position: relative; }
.msg-row:hover { z-index: 3; }
.msg-body:hover .msg-actions-bar,
.msg-actions-bar:hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
/* Délai à la disparition pour donner le temps de viser la barre */
.msg-actions-bar { transition-delay: .15s; }
.msg-body:hover .msg-actions-bar,
.msg-actions-bar:hover { transition-delay: 0s; }
.msg-action-btn {
  background: none;
  border: none;
  border-radius: 4px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--txt-3);
  cursor: pointer;
  transition: all var(--tr);
}
.msg-action-btn:hover { background: var(--bg); color: var(--acc); }

/* Avatars des lecteurs sous un message (style Messenger) */
.msg-readers-strip {
  display: flex;
  margin-top: 4px;
  padding: 0 2px;
  user-select: none;
}
.msg-row.mine .msg-readers-strip { justify-content: flex-end; }
.msg-reader-avatar {
  width: 16px; height: 16px;
  border-radius: 50%;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--surface);
  margin-left: -4px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: help;
  transition: transform .15s;
}
.msg-reader-avatar:first-child { margin-left: 0; }
.msg-reader-avatar:hover { transform: scale(1.25); z-index: 1; position: relative; }
.msg-reader-avatar .avatar-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.msg-reader-extra {
  font-size: 10px;
  color: var(--txt-3);
  margin-left: 5px;
  align-self: center;
  font-weight: 600;
}

/* Réactions emoji */
.reaction-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  min-height: 0;
}
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.reaction-pill span { font-size: 11px; font-weight: 600; color: var(--txt-2); }
.reaction-pill:hover { border-color: var(--acc); background: var(--acc-light, rgba(108,142,239,.1)); }
.reaction-pill.mine { border-color: var(--acc); background: var(--acc-light, rgba(108,142,239,.15)); }
.reaction-pill.mine span { color: var(--acc); }

/* Thème sombre : --acc-light est un gris clair → le pill apparaissait blanc.
   On force des fonds translucides lisibles sur fond sombre. */
html.dark-mode .reaction-pill {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  color: var(--txt-1);
}
html.dark-mode .reaction-pill span { color: var(--txt-2); }
html.dark-mode .reaction-pill:hover {
  background: color-mix(in srgb, var(--acc) 26%, transparent);
  border-color: var(--acc);
}
html.dark-mode .reaction-pill.mine {
  background: color-mix(in srgb, var(--acc) 30%, transparent);
  border-color: var(--acc);
}
html.dark-mode .reaction-pill.mine span { color: color-mix(in srgb, var(--acc) 65%, white); }

/* Bouton réaction — visible au hover */
/* ── Forum Q&A ── */
.forum-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}
.forum-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  position: sticky;
  top: 16px;
}
.forum-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--txt-2);
  text-decoration: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s;
}
.forum-cat-item:hover { background: var(--bg); }
.forum-cat-item.active { background: var(--acc-light, rgba(108,142,239,.1)); border-left-color: var(--acc); color: var(--acc); font-weight: 600; }

.forum-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.forum-search { flex: 1; position: relative; min-width: 200px; }
.forum-search input {
  width: 100%; padding: 9px 36px 9px 36px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--txt-1); font-size: 13px;
}
.forum-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--txt-4); }
.forum-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--bg); color: var(--txt-3);
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: background .12s, color .12s;
}
.forum-search-clear:hover { background: var(--red); color: #fff; }
.forum-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.forum-filter-btn {
  padding: 6px 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--txt-2); border-radius: 8px; font-size: 11px; cursor: pointer;
}
.forum-filter-btn.active { background: var(--acc); color: #fff; border-color: var(--acc); }
.forum-tag-active {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: var(--acc-light, rgba(108,142,239,.15)); color: var(--acc);
  border-radius: 14px; font-size: 11px; font-weight: 600;
}
.forum-tag-active i { cursor: pointer; }

.forum-topics-list { display: flex; flex-direction: column; gap: 6px; }
.forum-topic-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.forum-topic-row:hover { background: var(--bg); transform: translateX(2px); }
.forum-topic-row.is-pinned { border-left: 3px solid var(--amber); }
.forum-topic-row.is-resolved { opacity: .75; }
.forum-topic-row.is-closed { opacity: .55; }
/* Petite pastille de couleur en lieu et place de l'icône catégorie */
.forum-cat-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.forum-topic-pin {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--amber);
  flex-shrink: 0;
}
.forum-merge-result:hover { background: var(--bg); border-color: var(--acc) !important; }

/* Pièces jointes forum (zone d'upload composer) */
.forum-attach-zone {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  transition: border-color .15s, background .15s;
}
.forum-attach-zone.dragover { border-color: var(--acc); background: var(--acc-light, rgba(108,142,239,.06)); }
.forum-attach-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.forum-attach-preview:empty { display: none; }
.forum-attach-thumb {
  position: relative;
  width: 80px; height: 80px;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: var(--bg);
}
.forum-attach-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.forum-attach-thumb .forum-attach-file {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 4px; gap: 4px;
  font-size: 9px; color: var(--txt-3); text-align: center;
}
.forum-attach-thumb .forum-attach-file i { font-size: 20px; color: var(--acc); }
.forum-attach-thumb .forum-attach-file span {
  width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.forum-attach-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
  font-size: 12px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.forum-attach-remove:hover { background: var(--red); }
.forum-attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--txt-2);
}
.forum-attach-btn:hover { background: var(--bg); color: var(--acc); border-color: var(--acc); }
.forum-attach-hint { font-size: 10px; color: var(--txt-4); margin-left: 8px; }

/* Affichage des pièces jointes dans un sujet/réponse */
.forum-attach-display {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px;
}
.forum-attach-img-link {
  display: block; max-width: 240px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .15s;
}
.forum-attach-img-link:hover { transform: scale(1.02); }
.forum-attach-img-link img {
  display: block; width: 100%; height: auto; max-height: 240px; object-fit: cover;
}
.forum-attach-file-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--acc); text-decoration: none;
}
.forum-attach-file-link:hover { background: var(--surface); }
.forum-topic-body { flex: 1; min-width: 0; }
.forum-topic-title { font-weight: 600; font-size: 14px; color: var(--txt-1); margin-bottom: 4px; }
.forum-topic-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--txt-3); align-items: center; }
.forum-cat-chip { font-weight: 600; }
.forum-tag-chip {
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 10px; font-size: 10px; cursor: pointer;
  color: var(--txt-3);
}
.forum-tag-chip:hover { background: var(--acc-light, rgba(108,142,239,.1)); }
.forum-topic-stats { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.forum-topic-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--txt-3); }
.forum-topic-stat.has-replies { color: var(--acc); font-weight: 600; }

/* Détail */
.forum-topic-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
}
.forum-topic-head { padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.forum-topic-body-content {
  font-size: 14px; line-height: 1.6; color: var(--txt-1);
}
.forum-topic-body-content code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.forum-topic-body-content pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; }

.forum-reply {
  display: block; padding: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px;
  background: var(--surface);
  position: relative;
}
.forum-reply.is-best {
  border-color: var(--green);
  background: var(--success-bg);
}
.forum-reply-best-badge {
  position: absolute; top: -10px; left: 12px;
  background: var(--green); color: #fff;
  padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.forum-reply-content { display: flex; gap: 12px; }
.forum-reply-vote {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 40px; flex-shrink: 0;
}
.forum-vote-btn {
  background: none; border: 1px solid var(--border);
  width: 32px; height: 28px; border-radius: 6px;
  cursor: pointer; color: var(--txt-3);
  transition: all .12s;
}
.forum-vote-btn:hover { background: var(--bg); }
.forum-vote-btn.active.up   { background: var(--green); color: #fff; border-color: var(--green); }
.forum-vote-btn.active.down { background: var(--red);   color: #fff; border-color: var(--red); }
.forum-vote-score { font-weight: 700; font-size: 14px; color: var(--txt-2); }
.forum-vote-score.positive { color: var(--green); }
.forum-vote-score.negative { color: var(--red); }
.forum-reply-body { flex: 1; min-width: 0; }
.forum-reply-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 4px; }
.forum-reply-text { font-size: 13px; line-height: 1.55; color: var(--txt-1); }
.forum-reply-actions { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; }
.forum-reply-actions .btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--txt-3); font-size: 11px; padding: 0;
}
.forum-reply-actions .btn-link:hover { color: var(--acc); }

/* Admin tabs dans la modale */
.forum-admin-tab {
  padding: 10px 16px; border: none; background: none;
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--txt-3); border-bottom: 2px solid transparent;
}
.forum-admin-tab.active { color: var(--acc); border-bottom-color: var(--acc); }

/* Mobile */
@media (max-width: 768px) {
  .forum-layout { grid-template-columns: 1fr; }
  .forum-sidebar { position: relative; top: 0; max-height: 240px; overflow-y: auto; }
  .forum-toolbar { flex-direction: column; align-items: stretch; }
  .forum-search { width: 100%; }
  .forum-topic-row { flex-wrap: wrap; }
  .forum-topic-stats { width: 100%; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--border); }
}

/* Petites annonces — badge "Recherche" */
.an-kind-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--acc);
  color: #fff;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  z-index: 2;
}
.an-card.is-search .an-photo { background-color: var(--acc-light, rgba(108,142,239,.08)); }

.reaction-trigger-btn { opacity: 0; transition: opacity .15s; }
.msg-body:hover .reaction-trigger-btn,
.cse-chat-row:hover .reaction-trigger-btn { opacity: 1; }
/* Sur mobile (pas de hover), afficher le bouton réaction en permanence —
   sinon il est invisible et inaccessible. */
@media (hover: none), (max-width: 600px) {
  .reaction-trigger-btn { opacity: 0.55; }
  .reaction-trigger-btn:active { opacity: 1; }
}

/* Reply quote */
.msg-reply-quote {
  background: var(--bg);
  border-left: 3px solid var(--acc);
  border-radius: 0 6px 6px 0;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--txt-3);
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  gap: 6px;
}
.msg-reply-quote:hover { background: var(--acc-light); }

/* Edited badge */
.msg-edited { font-size: 9px; color: var(--txt-4); font-style: italic; }

/* Read status */
.msg-read-status { font-size: 10px; color: var(--acc); margin-left: 4px; }

/* Chat banner (reply / edit) */
.chat-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  font-size: 12px;
  color: var(--txt-2);
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.reply-banner { border-left: 3px solid var(--acc); }
.edit-banner  { border-left: 3px solid var(--amber); }

/* Attachment in messages */
.msg-attach-img { margin-top: 6px; }
.msg-attach-file {
  margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}

/* Chat background customization */
.chat-messages[data-bg-color] { background-color: var(--chat-bg-color); }
.chat-messages[data-bg-image] {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Chat themes */
.chat-theme-dark .chat-messages { background: #1a1a2e; }
.chat-theme-dark .msg-bubble { background: #2d2d44; border-color: #3d3d5c; color: #e0e0e0; }
.chat-theme-dark .msg-row.mine .msg-bubble { background: var(--msg-mine-bg, var(--acc)); color: #fff; }
.chat-theme-dark .msg-meta .msg-sender { color: #ccc; }
.chat-theme-dark .msg-date-divider { color: #888; }
.chat-theme-dark .msg-date-divider::before,
.chat-theme-dark .msg-date-divider::after { background: #444; }

.chat-theme-warm .chat-messages { background: #fdf6ec; }
.chat-theme-blue .chat-messages { background: #eef3fa; }
.chat-theme-green .chat-messages { background: #ecf7ee; }
.chat-theme-purple .chat-messages { background: #f3eef8; }
.chat-theme-rose .chat-messages { background: #fdf0f4; }

/* Emoji / GIF Picker */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 16px;
  width: 340px;
  max-height: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  display: flex;
  flex-direction: column;
  z-index: 50;
  margin-bottom: 6px;
  overflow: hidden;
}
.ep-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ep-tab {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--txt-3);
  cursor: pointer;
  transition: all var(--tr);
  border-bottom: 2px solid transparent;
}
.ep-tab.active { color: var(--acc); border-bottom-color: var(--acc); }
.ep-tab:hover { background: var(--bg); }
.ep-search {
  padding: 8px;
  flex-shrink: 0;
}
.ep-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12px;
  background: var(--bg);
  color: var(--txt-1);
  outline: none;
}
.ep-search input:focus { border-color: var(--acc); }
.ep-cats {
  display: flex;
  gap: 2px;
  padding: 0 8px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.ep-cat-btn {
  background: none;
  border: none;
  width: 30px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--tr);
}
.ep-cat-btn:hover { background: var(--bg); }
.ep-cat-btn.active { background: var(--acc-light); }
.ep-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.ep-emoji {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--tr);
}
.ep-emoji:hover { background: var(--bg); transform: scale(1.2); }
.ep-gif-grid {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.ep-gif-item {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform var(--tr);
}
.ep-gif-item:hover { transform: scale(1.05); }
/* GIF tab emoji reactions (when no API) */
.ep-gif-grid .ep-emoji {
  width: 52px;
  height: 52px;
  font-size: 32px;
}

/* ────────────────────────────────────────────────────────────
   21. VIEW — AGENDA
──────────────────────────────────────────────────────────── */
.agenda-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.agenda-side { display: flex; flex-direction: column; gap: 16px; }

.mini-calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.mc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--acc);
  color: #fff;
}
.mc-month { font-size: 13px; font-weight: 700; }
.mc-nav { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; border: none; color: #fff; transition: background var(--tr); }
.mc-nav:hover { background: rgba(255,255,255,.35); }
.mc-grid { padding: 10px; }
.mc-days-header { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.mc-day-hd { text-align: center; font-size: 10px; font-weight: 700; color: var(--txt-4); padding: 4px 0; }
.mc-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mc-cell {
  text-align: center;
  padding: 6px 0;
  border-radius: var(--r-sm);
  font-size: 11px; font-weight: 500;
  color: var(--txt-2);
  cursor: pointer;
  transition: background var(--tr);
  min-height: 28px;
  display: flex; align-items: center; justify-content: center;
}
.mc-cell:hover { background: var(--bg); }
.mc-cell.empty { cursor: default; }
.mc-cell.today { background: var(--acc); color: #fff; font-weight: 700; }
.mc-cell.has-event { position: relative; }
.mc-cell.has-event::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--acc); }
.mc-cell.today::after { background: #fff; }

.upcoming-events { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.upcoming-events h3 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.upcoming-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.upcoming-item:last-child { border-bottom: none; }
.up-date { text-align: center; min-width: 36px; }
.up-day  { font-size: 18px; font-weight: 800; color: var(--acc); line-height: 1; }
.up-mon  { font-size: 9px; font-weight: 600; color: var(--txt-4); text-transform: uppercase; }
.up-info { flex: 1; }
.up-title { font-size: 12px; font-weight: 700; color: var(--txt-1); line-height: 1.3; }
.up-meta  { font-size: 10px; color: var(--txt-4); margin-top: 2px; }
.up-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  padding: 8px 0 2px;
  font-size: 11px;
  color: var(--acc);
  cursor: pointer;
  font-weight: 600;
  transition: opacity var(--tr);
}
.up-toggle-btn:hover { opacity: .75; }

/* Main calendar */
.cal-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.agenda-filter-toggle { display: none; }
.agenda-mobile-filters { display: none; }
.cal-main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cal-main-header h2 { font-size: 16px; font-weight: 700; }
.cal-views { display: flex; gap: 4px; }
.cal-view-btn {
  padding: 5px 12px;
  border-radius: var(--r-md);
  font-size: 12px; font-weight: 600;
  color: var(--txt-3);
  cursor: pointer; border: none; background: none;
  transition: all var(--tr);
}
.cal-view-btn.active { background: var(--acc-light); color: var(--acc); }

.cal-grid { padding: 16px; }
.cal-week-hd { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 8px; }
.cal-week-hd-cell { text-align: center; font-size: 11px; font-weight: 700; color: var(--txt-3); padding: 8px 0; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-month-cell {
  min-height: 90px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px;
  background: var(--surface);
  transition: background var(--tr);
}
.cal-month-cell:hover { background: var(--bg); }
.cal-month-cell.other-month { background: var(--bg); opacity: .5; }
.cal-month-cell.today { border-color: var(--acc); background: var(--acc-light); }
.cal-day-num {
  font-size: 11px; font-weight: 700;
  color: var(--txt-3); display: block; margin-bottom: 4px;
}
.cal-month-cell.today .cal-day-num { color: var(--acc); }
.cal-ev {
  display: block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px; font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.cal-ev.egu { background: var(--egu-color); }
.cal-ev.urb { background: var(--urb-color); }
.cal-ev.lnd { background: var(--lnd-color); }
.cal-ev.all { background: var(--all-color); }

/* ────────────────────────────────────────────────────────────
   22. VIEW — LIENS RAPIDES
──────────────────────────────────────────────────────────── */
.liens-section { margin-bottom: 28px; }
.liens-section h3 {
  font-size: 12px; font-weight: 700; color: var(--txt-3);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.liens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.lien-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: all var(--tr);
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  text-decoration: none;
  position: relative;
}
.lien-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); border-color: var(--acc-mid); }
.lien-icon {
  width: 40px; height: 40px;
  background: var(--acc-light);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--acc);
  transition: all var(--tr);
}
.lien-card:hover .lien-icon { background: var(--acc); color: #fff; }
.lien-name { font-size: 13px; font-weight: 700; color: var(--txt-1); line-height: 1.2; }
.lien-desc { font-size: 11px; color: var(--txt-3); line-height: 1.3; }
.lien-entity-tag { font-size: 10px; }

/* Actions (modif/suppr) : masquées par défaut, apparaissent au survol de la carte.
   Le favori reste toujours visible (hors .lien-actions). Sur mobile → toujours affichées. */
.lien-actions {
  display: flex; gap: 4px; align-items: center;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.lien-card:hover .lien-actions,
.lien-card:focus-within .lien-actions {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
@media (hover: none) {
  .lien-actions { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }
}

/* ────────────────────────────────────────────────────────────
   23. MODAL
──────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 700;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  max-width: 560px; width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
/* Modal large : utilisé pour les éditeurs avec beaucoup de contenu (templates entretiens, etc.) */
.modal.modal-lg { max-width: 880px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--txt-3); font-size: 15px; cursor: pointer; transition: background var(--tr); }
.modal-close:hover { background: var(--bg); color: var(--txt-1); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Calendar Picker (sélecteur d'agenda) ─────────────────── */
.cal-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  color: var(--txt-1);
  width: 100%;
  transition: border-color var(--tr), box-shadow var(--tr);
  text-align: left;
}
.cal-picker-btn:hover,
.cal-picker-btn:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cal-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cal-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--txt-1);
  transition: background var(--tr);
}
.cal-picker-item:hover { background: var(--bg); }
.cal-picker-item-sel { background: rgba(37,99,235,.07); }
.cal-picker-item-sel:hover { background: rgba(37,99,235,.12); }
.cal-picker-item .cal-color-dot { width: 14px; height: 14px; }
.cal-all-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--txt-2);
  cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
  white-space: nowrap;
}
.cal-all-btn:hover { background: var(--bg); color: var(--acc); border-color: var(--acc); }
.cal-legend-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 10px;
  color: var(--txt-3);
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}
.cal-legend-toggle-btn:hover { background: var(--bg); color: var(--acc); }

/* ── Groupes d'agendas (sidebar) ─────────────────────────── */
.cal-group { margin-bottom: 2px; }
.cal-group-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background var(--tr);
}
.cal-group-header:hover { background: var(--bg); }
.cal-group-chevron {
  font-size: 8px;
  color: var(--txt-4);
  flex-shrink: 0;
  transition: transform .2s ease;
  width: 10px;
}
.cal-group-chevron.expanded { transform: rotate(90deg); }
.cal-group-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  color: var(--txt-2);
  flex: 1;
}
.cal-group-count {
  font-size: 10px;
  font-weight: 400;
  color: var(--txt-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}
.cal-group-eye {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 10px;
  color: var(--txt-4);
  cursor: pointer;
  border-radius: 4px;
  transition: color var(--tr);
  flex-shrink: 0;
}
.cal-group-header:hover .cal-group-eye { display: inline-flex; }
.cal-group-eye:hover { color: var(--acc); }
.cal-group-items {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height .22s ease, opacity .18s ease;
  padding-top: 2px;
}
.cal-group-items.collapsed { max-height: 0; opacity: 0; }
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 6px 3px 20px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--tr);
}
.cal-legend-item:hover { background: var(--bg); }
.cal-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: opacity .2s;
}
/* Sélecteur de couleur admin dans la légende (remplace la pastille) */
.cal-legend-colorpick {
  width: 15px; height: 15px; flex-shrink: 0;
  padding: 0; border: none; background: none; cursor: pointer;
  border-radius: 3px; transition: opacity .2s;
}
.cal-legend-colorpick::-webkit-color-swatch-wrapper { padding: 0; }
.cal-legend-colorpick::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 3px; }
.cal-legend-colorpick::-moz-color-swatch { border: 1px solid var(--border); border-radius: 3px; }
.cal-legend-reset {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--txt-4); font-size: 10px; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity .12s, color .12s;
}
.cal-legend-item:hover .cal-legend-reset { opacity: 1; }
.cal-legend-reset:hover { color: var(--acc); background: var(--surface2); }

/* ── Participant Picker (style Google Calendar) ───────────── */
.ep-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 42px;
  cursor: text;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.ep-wrap:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.ep-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--txt-1);
  flex: 1;
  min-width: 140px;
  padding: 2px 0;
}
.ep-input::placeholder { color: var(--txt-4); }
.ep-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 100px;
  padding: 2px 8px 2px 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
}
.ep-chip-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ep-chip-remove {
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: .55;
  transition: opacity var(--tr);
  margin-left: 1px;
}
.ep-chip-remove:hover { opacity: 1; }
.ep-dropdown {
  position: fixed;       /* échapper à l'overflow-y de la modale */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  z-index: 900;          /* au-dessus de la modale (z-index 700) */
  max-height: 260px;
  overflow-y: auto;
}
.ep-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--tr);
}
.ep-item:hover { background: var(--bg); }
.ep-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ep-info { flex: 1; min-width: 0; }
.ep-name { font-size: 13px; font-weight: 600; color: var(--txt-1); }
.ep-sub  { font-size: 11px; color: var(--txt-3); margin-top: 1px; }

/* ── Event modal — all-day + datetime + recurrence ─────────── */
.ev-allday-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
}
.ev-allday-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--txt-2);
}
/* Toggle switch */
.ev-toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.ev-toggle-switch input { opacity: 0; width: 0; height: 0; }
.ev-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.ev-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.ev-toggle-switch input:checked + .ev-toggle-slider { background: var(--acc); }
.ev-toggle-switch input:checked + .ev-toggle-slider::before { transform: translateX(16px); }

/* Start/End rows */
.ev-datetime-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 4px;
}
.ev-datetime-row .form-group { margin-bottom: 12px; }

/* Recurrence panel */
.ev-rec-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ev-rec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ev-rec-label {
  font-size: 13px;
  color: var(--txt-2);
  white-space: nowrap;
}
.ev-rec-num {
  width: 60px !important;
  padding: 4px 8px !important;
  text-align: center;
}
.ev-rec-unit {
  width: auto !important;
  min-width: 110px;
  padding: 4px 8px !important;
}
.ev-rec-end-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.ev-rec-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--txt-2);
  cursor: pointer;
}
.ev-rec-radio input[type="radio"] { cursor: pointer; }
.ev-rec-end-date, .ev-rec-end-count {
  padding: 3px 6px !important;
  font-size: 12px !important;
}

/* ────────────────────────────────────────────────────────────
   24. VIEW — ADMIN / PARAMETRES
──────────────────────────────────────────────────────────── */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.settings-menu { display: flex; flex-direction: column; gap: 2px; }
.settings-menu-item {
  padding: 9px 14px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  color: var(--txt-2);
  cursor: pointer; transition: all var(--tr);
  display: flex; align-items: center; gap: 8px;
}
.settings-menu-item:hover { background: var(--bg); }
.settings-menu-item.active { background: var(--acc-light); color: var(--acc); font-weight: 700; }
.settings-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; }
.settings-panel h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.settings-panel > p { font-size: 13px; color: var(--txt-3); margin-bottom: 24px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-info h4 { font-size: 13px; font-weight: 600; }
.setting-info p  { font-size: 12px; color: var(--txt-3); margin-top: 2px; }
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border2);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--tr);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: transform var(--tr);
  box-shadow: var(--sh-xs);
}
.toggle input:checked + .toggle-slider { background: var(--acc); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Roles table */
.roles-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 20px; }
.role-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; text-align: center; }
.role-card h4 { font-size: 12px; font-weight: 700; color: var(--txt-1); margin-bottom: 6px; }
.role-card p  { font-size: 10px; color: var(--txt-3); line-height: 1.4; }
.role-icon { font-size: 20px; margin-bottom: 8px; }

/* ────────────────────────────────────────────────────────────
   25. UTILITIES
──────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-auto { margin-top: auto; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--txt-3); }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relative { position: relative; }
.hidden { display: none !important; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--txt-4);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 14px; }

/* ────────────────────────────────────────────────────────────
   26. RESPONSIVE — Mobile & Tablet
──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .quick-access-grid { grid-template-columns: repeat(4, 1fr); }
  .news-grid { grid-template-columns: 1fr; }
  .ged-layout { grid-template-columns: 1fr; }
  .ged-tree { display: none; }
  .agenda-layout { grid-template-columns: minmax(0, 1fr); }
  .agenda-layout > * { min-width: 0; }
  .agenda-side { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  /* Statistiques d'usage : grilles en 1 colonne sur mobile */
  .usage-grid { grid-template-columns: 1fr !important; }

  /* ── Anti-débordement global ── */
  html { overflow-x: hidden; overflow-y: scroll; width: 100%; }
  body { overflow-x: hidden; overflow-y: scroll; width: 100%; }
  .app {
    display: flex; flex-direction: column;
    height: auto; min-height: 100dvh;
    overflow: visible;
  }
  .topbar { flex-shrink: 0; }
  .main-content { flex: 1; overflow: visible; height: auto; }
  .view { padding: 16px; padding-bottom: 80px; box-sizing: border-box; max-width: 100vw; min-height: auto; }

  /* ── Sidebar mobile ── */
  .sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0;
    height: calc(100dvh - var(--topbar-h));
    width: 260px;
    transform: translateX(-100%);
    z-index: 300;
    transition: transform var(--tr-slow);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .overlay,
  .app.sidebar-open .overlay.show { display: block; z-index: 250 !important; }
  .app.sidebar-collapsed .sidebar { width: 260px; }

  /* ── Topbar ── */
  .tb-center { display: none; }
  .topbar { max-width: 100vw; overflow: hidden; padding: 0 10px; }
  .tb-left { min-width: 0; gap: 8px; flex: 1 1 0; overflow: hidden; }
  .tb-right { min-width: 0; gap: 8px; flex-shrink: 0; }
  .logo { min-width: 0; }
  .logo-combined-img { height: 28px; width: auto; max-width: 100%; object-fit: contain; object-position: left; }

  /* ── Dashboard hero ── */
  .dash-hero { padding: 20px 16px; }
  .dash-hero-content { flex-direction: column; align-items: flex-start; gap: 14px; }
  .dash-hero-greeting { font-size: 22px; }
  .dash-hero-kpis { flex-shrink: 1; flex-wrap: wrap; width: 100%; }
  .hero-kpi { min-width: 60px; flex: 1; padding: 10px 8px; }
  .hero-kpi-val { font-size: 18px; }
  .dash-hero-watermark { width: 200px; }

  /* ── Dashboard grid ── */
  .dash-grid { grid-template-columns: 1fr !important; }
  .dash-entities { grid-template-columns: 1fr; }
  .dash-alerts .dash-alert { word-break: break-word; }

  /* ── Page headers ── */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-title { font-size: 18px; }
  .view-hd { flex-direction: column; align-items: flex-start; gap: 8px; }
  .view-hd-actions { width: 100%; flex-wrap: wrap; }

  /* ── Grilles ── */
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .quick-access-grid { grid-template-columns: repeat(3, 1fr); }
  .veille-layout { grid-template-columns: 1fr; }
  .veille-sidebar { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-menu { flex-direction: row; flex-wrap: wrap; }
  .rh-grid { grid-template-columns: 1fr; }

  /* ── RH mobile ── */
  .rh-tabs {
    flex-wrap: wrap; gap: 0; margin-bottom: 16px;
    border-bottom: none;
  }
  .rh-tab {
    white-space: nowrap;
    padding: 7px 12px; font-size: 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    margin: 0 4px 4px 0;
    border-bottom: 1px solid var(--border);
  }
  .rh-tab.active {
    background: var(--acc); color: #fff;
    border-color: var(--acc);
  }
  .view-hd { flex-direction: column; align-items: flex-start !important; gap: 10px; }
  .view-hd-actions { width: 100%; }
  .view-hd-actions .btn { width: 100%; justify-content: center; }
  .section-hd { flex-direction: column; align-items: flex-start !important; gap: 8px; }
  .leave-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .leave-item .badge { align-self: flex-start; }
  .leave-item > div:last-child { align-self: flex-end; }
  .rh-filter-row { flex-wrap: wrap; gap: 6px; }
  .rh-filter-row .rh-filter-btn { padding: 5px 10px; font-size: 11px; }
  .rh-filter-row .tb-search-wrap { width: 100% !important; min-width: 0 !important; }
  .stats-row[style*="repeat(3"] { grid-template-columns: 1fr 1fr !important; }
  .plan-wrap, .plan-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .planning-table { min-width: 600px; }
  .plan-name-hd, .plan-name-cell { width: 100px !important; max-width: 100px !important; font-size: 11px !important; }
  .manager-table { min-width: 500px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ldg-row { flex-direction: column; gap: 2px; }
  .ldg-lbl { min-width: 0; }
  .rh-export-filters { grid-template-columns: 1fr 1fr !important; }
  .rh-summer-grid { grid-template-columns: 1fr 1fr !important; }
  .leave-period-row { flex-direction: column; }
  .leave-period-opt { padding: 8px 12px; font-size: 12px; }
  .decal-block { padding: 10px 12px; }
  .leave-comment-body { padding: 6px 8px; }
  .mgr-revert-info { font-size: 11px; padding: 8px 10px; }
  .recap-group-hd { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .recap-group-stats { gap: 6px; }
  .recap-stat { font-size: 10px; padding: 2px 7px; }
  .recap-group-table { min-width: 500px; }
  .recap-group-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .recap-group-open .recap-group-body { overflow-x: auto; }
  .pa-name-hd, .pa-name { min-width: 100px !important; max-width: 100px !important; }
  .pa-name-txt { max-width: 80px; font-size: 10px; }
  .pa-cell { width: 18px; min-width: 18px; max-width: 18px; height: 20px; }
  .pa-scroll { max-height: calc(100dvh - 220px); }

  /* ── Messagerie mobile (slide panel) ── */
  .chat-layout { display: flex; flex-direction: column; position: relative; }
  .chat-sidebar {
    width: 100% !important; flex-shrink: 0;
    height: calc(100dvh - var(--topbar-h));
    border-right: none;
  }
  .chat-resize-handle { display: none; }
  .chat-main {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--surface);
    z-index: 10;
    transform: translateX(100%);
    transition: transform .25s ease;
  }
  .chat-main.mobile-open { transform: translateX(0); }
  .chat-main .chat-header { padding: 10px 14px; }
  .chat-back-btn {
    display: flex !important;
    width: 32px; height: 32px;
    align-items: center; justify-content: center;
    border: none; background: var(--bg); border-radius: 8px;
    color: var(--txt-2); cursor: pointer; flex-shrink: 0;
    font-size: 14px;
  }

  /* ── Notifications plein écran ── */
  .notif-panel { width: 100vw; right: 0; }

  /* ── Modals mobile ── */
  .modal-backdrop { padding: 8px; align-items: flex-start; padding-top: calc(var(--topbar-h) + 8px); }
  .modal {
    width: 100% !important; max-width: 100% !important;
    max-height: calc(100dvh - var(--topbar-h) - 16px) !important;
    margin: 0 !important;
    border-radius: var(--r-lg) !important;
    display: flex; flex-direction: column;
    overflow: hidden !important;
  }
  .modal-header { padding: 14px 16px; flex-shrink: 0; }
  .modal-header h2 { font-size: 15px; }
  .modal-body {
    padding: 14px 16px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    flex: 1; min-height: 0;
  }
  .modal-footer { padding: 10px 16px; flex-shrink: 0; }
  .modal-footer .btn { padding: 8px 14px; }
  .form-group { margin-bottom: 12px; }
  .form-label { font-size: 12px; }
  .form-control { font-size: 13px; padding: 8px 10px; }

  /* ── Tables ── */
  /* .table-wrap : overflow déjà défini dans le breakpoint ≤900px (couvre ≤600px) */
  table { min-width: 500px; }

  /* ── Boutons compacts ── */
  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }

  /* ── Cartes et éléments ── */
  .card, .card-pad { max-width: 100%; box-sizing: border-box; overflow: hidden; }

  /* ── Agenda mobile ── */
  .cal-main { overflow: hidden; max-width: 100%; min-width: 0; }
  .cal-main-header {
    flex-direction: column; gap: 8px; padding: 10px 12px;
    align-items: stretch;
  }
  .cal-main-header > div:first-child { justify-content: space-between; }
  .cal-main-header h2 { font-size: 14px; }
  /* Onglets vue agenda : scrollable horizontalement si pas assez de place */
  .cal-views {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 2px 0;
  }
  .cal-views::-webkit-scrollbar { display: none; }
  .cal-view-btn {
    padding: 6px 12px;
    font-size: 11px;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .cal-grid { padding: 8px; }
  .cal-month-cell { min-height: 50px; padding: 3px; }
  .cal-day-num { font-size: 10px; margin-bottom: 2px; }
  .cal-ev { font-size: 8px; padding: 1px 3px; margin-bottom: 1px; }
  .cal-week-hd-cell { font-size: 10px; padding: 4px 0; }
  .cal-month-grid { gap: 2px; }
  /* view padding-bottom global gère le bas de page */
  .agenda-layout { padding-bottom: 20px; }

  /* ── Agenda mobile filter toggle ── */
  .agenda-side { display: none; }
  .agenda-filter-toggle {
    display: flex !important;
    align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--r-md);
    font-size: 12px; font-weight: 600;
    color: var(--acc); background: var(--acc-light);
    border: 1px solid rgba(108,142,239,0.2);
    cursor: pointer; transition: all .2s;
    margin-bottom: 0;
  }
  .agenda-filter-toggle:hover { background: rgba(108,142,239,0.15); }
  .agenda-filter-toggle i { font-size: 13px; }
  .agenda-mobile-filters {
    display: none; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 14px; margin-bottom: 12px;
    animation: fadeIn .2s ease;
  }
  .agenda-mobile-filters.open { display: block; }

  /* ── Agenda page header compact ── */
  .view-hd-left p { font-size: 11px; }

  /* ── Comptabilité mobile ── */
  .compta-export-grid { grid-template-columns: 1fr !important; }
  .compta-stats-manager { grid-template-columns: 1fr 1fr !important; }
  .compta-stats-employee { grid-template-columns: 1fr 1fr !important; }
  .compta-credit-grid { grid-template-columns: 1fr 1fr !important; }
  .compta-sage-table { display: block; }
  .compta-sage-table table { width: 100% !important; min-width: 0 !important; }
  .compta-sage-table thead { display: none; }
  .compta-sage-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .compta-sage-table tr {
    display: flex; flex-direction: column; gap: 4px;
    padding: 10px; border: 1px solid var(--border) !important;
    border-radius: var(--r-md); background: var(--surface2);
  }
  .compta-sage-table td {
    display: block; padding: 0 !important; border: none !important;
  }
  .compta-sage-table td:first-child { font-size: 11px; font-weight: 700; color: var(--acc); margin-bottom: 2px; }
  .compta-sage-table td[data-label]::before {
    content: attr(data-label);
    display: block; font-size: 10px; font-weight: 600;
    color: var(--txt-3); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .03em;
  }
  .compta-sage-table td .form-control { width: 100% !important; box-sizing: border-box; }
  .expense-group .ei-amount { font-size: 12px; }
  .compta-demand-header { flex-wrap: wrap; gap: 6px 10px !important; padding: 10px 12px !important; }
  .compta-demand-header .avatar { width: 28px; height: 28px; font-size: 10px; flex-shrink: 0; }
  .compta-demand-header > div[style*="flex:1"], .compta-demand-header > div[style*="flex: 1"] { flex: 1 1 0 !important; min-width: 100px; }
  .compta-demand-header .ei-amount { font-size: 12px; min-width: 0; text-align: right; }
  .compta-demand-header .ei-amount div { font-size: 9px !important; }
  .compta-demand-header .badge { font-size: 10px !important; }
  .compta-demand-header .exp-chevron { display: none; }
  .compta-actions-row { flex-wrap: wrap !important; gap: 4px !important; }
  .compta-actions-row .btn { font-size: 11px !important; padding: 5px 8px !important; }
  .compta-tva-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .compta-tva-table-wrap table { min-width: 400px; }
  .compta-ticket-line { flex-wrap: wrap; gap: 6px !important; }
  .compta-ticket-line > div:first-child { flex: 1 1 100% !important; }
  .compta-subline-detail { flex-wrap: wrap; }
  .compta-export-filters { flex-direction: column !important; }
  .exp-subline { grid-template-columns: 1fr 1fr !important; gap: 4px !important; }

  /* ── CSE mobile ── */
  .cse-accueil-grid { grid-template-columns: 1fr !important; }
  .cse-kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .cse-dash-meeting { flex-wrap: wrap; }
  .cse-inbox-header { flex-direction: column; align-items: flex-start !important; }
  .cse-inbox-filters { width: 100%; flex-wrap: wrap; }
  .cse-inbox-filters .btn { font-size: 11px !important; padding: 5px 8px !important; }
  .cse-chat-container { flex-direction: column !important; height: auto !important; min-height: 60vh; }
  .cse-chat-sidebar { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--border); flex-direction: row !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cse-chat-sidebar > div:first-child { display: none; }
  .cse-chat-sidebar > div[style*="padding:12px;cursor:pointer"] { white-space: nowrap; padding: 8px 12px !important; border-left: none !important; border-bottom: 3px solid transparent; }
  .cse-chat-sidebar > div[style*="background:var(--bg)"] { border-bottom-color: var(--acc) !important; }
  #cseChatMessages { min-height: 300px; max-height: 50vh; }
  .cse-mailbox-container { flex-direction: column !important; }
  .cse-mailbox-container > div { max-width: 100% !important; }
  .cse-meetings-header { flex-direction: column; align-items: flex-start !important; }
  .cse-meetings-header .btn { width: 100%; justify-content: center; }
  .cse-meeting-row { flex-wrap: wrap; }
  .cse-meeting-row > div:last-child { width: 100%; justify-content: flex-start !important; margin-top: 4px; }

  /* ── Administration mobile ── */
  .admin-collab-table { display: none; }
  .admin-collab-cards { display: flex; flex-direction: column; gap: 8px; }
  .admin-collab-card {
    padding: 12px; background: var(--surface2); border-radius: var(--r-md);
    display: flex; flex-direction: column; gap: 10px;
  }
  .admin-collab-card .acc-info { display: flex; align-items: center; gap: 10px; }
  .admin-collab-card .acc-actions { display: flex; gap: 6px; }
  .admin-collab-card .acc-actions .btn { font-size: 11px; padding: 4px 8px; }
  .admin-tabs-nav { gap: 6px !important; }
  .admin-tabs-nav .btn { font-size: 11px !important; padding: 5px 10px !important; }
  .admin-section-hd { flex-direction: column; align-items: flex-start !important; }
  .admin-section-hd .btn { width: 100%; justify-content: center; }
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table-wrap table { min-width: 500px; }
  .admin-form-grid { grid-template-columns: 1fr !important; }
  .admin-card-hd { flex-direction: column; align-items: flex-start !important; }
  .admin-card-hd > div:last-child { width: 100%; }
  .admin-card-hd > div:last-child .btn { font-size: 11px; }
  .admin-member-row { flex-direction: column; align-items: flex-start !important; gap: 6px !important; }
  .admin-member-row > div:last-child { width: 100%; justify-content: flex-end; }

  /* ── Paramètres (settings) mobile ── */
  .settings-panel { padding: 18px 14px; }
  .settings-menu-item { padding: 8px 12px; font-size: 12px; border-radius: var(--r-sm); }
  .settings-profile-card { flex-wrap: wrap; gap: 14px !important; padding: 14px !important; }
  .settings-profile-card > div:last-child { width: 100%; }
  .settings-form-grid { grid-template-columns: 1fr !important; }
  .settings-theme-card { width: calc(50% - 8px) !important; min-width: 0 !important; }
  .settings-integration-row { flex-wrap: wrap; gap: 10px !important; }
  .settings-integration-row .btn { margin-left: 0 !important; }
  .settings-actions { flex-wrap: wrap; }
  .settings-actions .btn { flex: 1; min-width: 120px; justify-content: center; }
  .setting-row { gap: 12px; }
  .setting-info h4 { font-size: 13px; }
  .setting-info p { font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════
   § 15 — NEWS (Dashboard)
══════════════════════════════════════════════════════════ */
.nc-section { overflow: hidden; }

/* ── Actualités internes — liste simple ── */
.int-news-list { display: flex; flex-direction: column; }
.int-news-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: color .15s;
}
.int-news-item:first-child { padding-top: 0; }
.int-news-item:last-child  { border-bottom: none; padding-bottom: 0; }
.int-news-item:hover .int-news-title { color: var(--acc); }
.int-news-accent {
  width: 3px; border-radius: 2px; flex-shrink: 0;
  align-self: stretch; background: var(--acc); min-height: 36px;
}
.int-news-body  { flex: 1; min-width: 0; }
.int-news-title {
  font-size: 13px; font-weight: 600; color: var(--txt-1);
  line-height: 1.35; margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color .15s;
}
.int-news-excerpt {
  font-size: 11.5px; color: var(--txt-3); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden;
}
.int-news-meta  { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.int-news-date  { font-size: 10px; color: var(--txt-4); white-space: nowrap; }
.int-news-read  { font-size: 11px; font-weight: 600; color: var(--acc); white-space: nowrap; }
.int-news-item:hover .int-news-read { text-decoration: underline; }

/* ── Pièces jointes — zone de dépôt (modal publication) ── */
.attach-dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px; padding: 14px 16px;
  text-align: center; cursor: pointer;
  color: var(--txt-3); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: border-color .2s, background .2s;
}
.attach-dropzone:hover { border-color: var(--acc); background: var(--acc-light); color: var(--acc); }
.attach-dropzone i    { font-size: 22px; }
.attach-dropzone small { font-size: 11px; color: var(--txt-4); }
.attach-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin-top: 5px;
  background: var(--bg); border-radius: 8px;
  border: 1px solid var(--border); font-size: 12px;
}
.attach-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt-1); }
.attach-size { font-size: 10px; color: var(--txt-4); flex-shrink: 0; }
.attach-remove {
  background: none; border: none; cursor: pointer;
  color: var(--txt-4); padding: 2px 5px; border-radius: 4px;
  transition: color .15s; line-height: 1;
}
.attach-remove:hover { color: var(--danger); }

/* ── Pièces jointes — liens de téléchargement (modal lecture) ── */
.attach-dl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 6px;
  background: var(--bg); border-radius: 8px;
  text-decoration: none; color: var(--txt-1); font-size: 13px;
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.attach-dl-item:hover { border-color: var(--acc); background: var(--acc-light); }
.attach-dl-icon { font-size: 16px; color: var(--acc); flex-shrink: 0; }
.attach-dl-item .attach-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-dl-item .attach-size  { font-size: 11px; color: var(--txt-4); flex-shrink: 0; }

/* Grille de carousels RSS (flux externes) */
.nc-feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
/* Carte pleine largeur dans les carousels 1-par-1 */
.nc-track.nc-single .nc-card { flex: 0 0 100%; }

.nc-tabs { display: flex; gap: 8px; }
.nc-tab {
  padding: 5px 14px; border-radius: 20px;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--txt-2); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 5px;
}
.nc-tab.active { background: var(--acc); border-color: var(--acc); color: #fff; }
.nc-tab:hover:not(.active) { border-color: var(--acc); color: var(--acc); }
.nc-panel { position: relative; }
.nc-viewport { overflow: hidden; border-radius: 12px; }
.nc-track {
  display: flex; gap: 14px;
  transition: transform .45s cubic-bezier(.4,0,.2,1);
}
.nc-card {
  flex: 0 0 calc(33.333% - 10px);
  min-height: 150px; border-radius: 14px;
  padding: 12px 16px;
  display: flex; flex-direction: column;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s; user-select: none;
}
.nc-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0,0,0,.22); }
.nc-card::after {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.07); pointer-events: none;
}
.nc-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.nc-win-dots { display: flex; gap: 5px; }
.nc-win-dots span { display: block; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.35); }
.nc-win-dots span:first-child  { background: rgba(255,255,255,.9); }
.nc-win-dots span:nth-child(2) { background: rgba(255,255,255,.6); }
.nc-win-dots span:nth-child(3) { background: rgba(255,255,255,.4); }
.nc-time { font-size: 11px; color: rgba(255,255,255,.6); display: flex; align-items: center; gap: 4px; }
.nc-card-body { flex: 1; }
.nc-source { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.55); margin-bottom: 8px; font-weight: 700; }
.nc-card .nc-title { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.35; margin-bottom: 7px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nc-card .nc-excerpt { font-size: 11.5px; color: rgba(255,255,255,.68); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nc-card-footer { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.15); }
.nc-card-footer span, .nc-card-footer a { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.8); text-decoration: none; }
.nc-card-footer span:hover, .nc-card-footer a:hover { color: #fff; }
.nc-ent-eguimos     { background: linear-gradient(135deg, #C53B2A 0%, #8f2015 100%); }
.nc-ent-urbareal    { background: linear-gradient(135deg, #2897B5 0%, #1a6a80 100%); }
.nc-ent-landconcept { background: linear-gradient(135deg, #5E8A30 0%, #3d5e1e 100%); }
.nc-ent-all         { background: linear-gradient(135deg, #344858 0%, #1c2d3a 100%); }
.nc-empty { width: 100%; min-width: 100%; padding: 48px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--txt-3); font-size: 13px; }
.nc-empty i { font-size: 30px; opacity: .3; }
.nc-empty small { font-size: 12px; color: var(--acc); }
.nc-empty.nc-loading i { opacity: .75; color: var(--acc); }
.nc-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.nc-btn { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg); color: var(--txt-2); cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.nc-btn:hover { background: var(--acc); border-color: var(--acc); color: #fff; }
.nc-indicators { display: flex; gap: 6px; }
.nc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); cursor: pointer; transition: all .2s; }
.nc-dot.active { background: var(--acc); transform: scale(1.3); }
@media (max-width: 900px) { .nc-card { flex: 0 0 calc(50% - 7px); } }

/* ── Bottom Navigation (mobile) ────────────────────────────── */
.bottom-nav { display: none; }
@media (max-width: 600px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 250;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    height: calc(54px + env(safe-area-inset-bottom));
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    /* Reset button defaults */
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--txt-3);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 2px;
    transition: color .15s;
    position: relative;
    min-height: 44px; /* Apple HIG touch target */
    -webkit-tap-highlight-color: rgba(108,142,239,0.2);
  }
  .bn-item i { font-size: 18px; }
  .bn-item .bn-label { line-height: 1; }
  .bn-item.active { color: var(--acc); }
  .bn-item:active { background: var(--bg); }
  .bn-badge {
    position: absolute;
    top: 2px; right: calc(50% - 18px);
    min-width: 16px; height: 16px;
    border-radius: 8px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
  }
  /* Décaler le contenu principal pour ne pas être masqué par la bottom-nav */
  body { padding-bottom: calc(54px + env(safe-area-inset-bottom)); }
  /* Masquer aussi la sidebar foot (info utilisateur en bas) — déjà dans la bottom-nav */
}

@media (max-width: 600px) {
  :root { --topbar-h: 54px; }
  .logo-combined-img { height: 24px; width: auto; max-width: 100%; }
  .nc-card { flex: 0 0 100%; }
  .user-chip-info { display: none; }
  .tb-search-wrap { display: none; }
  .entity-selector { display: none; }
  /* Bouton "popout" inutile sur mobile (pas de fenêtres détachées) */
  .tb-popout-btn { display: none !important; }

  /* ── Topbar compacte ── */
  .topbar { padding: 0 8px; justify-content: space-between; }
  .topbar > div[style*="flex: 1"] { display: none; }
  .tb-left { flex: 1 1 0; overflow: hidden; }
  .sidebar-toggle { margin-right: 4px; flex-shrink: 0; }
  .tb-right { gap: 6px; flex-shrink: 0; }

  /* ── Contenu ── */
  .view { padding: 10px; padding-bottom: 80px; min-height: auto; }
  .page-header { gap: 8px; }
  .page-title { font-size: 16px; }
  .page-subtitle { font-size: 12px; }

  /* ── Dashboard hero compact ── */
  .dash-hero { padding: 14px 12px; margin-bottom: 10px; }
  .dash-hero-greeting { font-size: 20px; }
  .dash-hero-date { font-size: 11px; margin-bottom: 8px; }
  .dash-hero-kpis { gap: 4px; }
  .hero-kpi { min-width: 50px; padding: 8px 6px; }
  .hero-kpi-val { font-size: 16px; }
  .hero-kpi-lbl { font-size: 9px; }
  .hero-chip { padding: 3px 7px; font-size: 10px; }

  /* ── Météo compacte ── */
  .hero-weather { padding: 8px 12px; gap: 8px; min-width: 0; }
  .hw-icon { font-size: 24px; }
  .hw-temp { font-size: 18px; }
  .hw-unit { font-size: 11px; }
  .hw-desc { font-size: 10px; }
  .hw-detail { font-size: 9px; }
  .hw-loc { font-size: 9px; }

  /* ── Alertes / annonces compactes ── */
  .dash-alerts { margin-bottom: 10px; gap: 6px; }
  .dash-alert { padding: 8px 10px; font-size: 11px; }
  .dash-alert-icon { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
  .dash-alert-title { font-size: 11px; }
  .dash-alert-text { font-size: 10px; }

  /* ── Demandes urgentes compactes ── */
  .dash-urgent-section { padding: 10px 12px; margin-bottom: 10px; }
  .dash-urgent-header h2 { font-size: 12px; }
  .dash-urgent-icon { width: 24px; height: 24px; font-size: 11px; }
  .dash-urgent-item { padding: 6px 10px; gap: 8px; }
  .dash-urgent-item .avatar { width: 28px; height: 28px; font-size: 10px; }

  /* ── Annonce épinglée compacte ── */
  .pinned-card-inner { padding: 10px 12px !important; }
  .pinned-card-title { font-size: 13px !important; margin-bottom: 2px; }
  .pinned-card-excerpt { font-size: 11px !important; line-height: 1.4; }
  .pinned-card { margin-bottom: 6px !important; }

  /* ── Grilles compactes ── */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-val  { font-size: 20px; }
  .quick-access-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .employee-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .docs-grid { grid-template-columns: 1fr; }
  .dash-grid { gap: 10px; }

  /* ── Cards compactes ── */
  .card-pad { padding: 12px; }
  .employee-card { padding: 10px 6px; gap: 4px; }
  .employee-card .ec-avatar-wrap .avatar { width: 40px; height: 40px; font-size: 14px; }
  .employee-card .ec-name { font-size: 11px; line-height: 1.2; }
  .employee-card .ec-role { font-size: 9px; }
  .employee-card .ec-dispo { font-size: 9px; }
  .employee-card .ec-skills { display: none; }
  .employee-card .ec-actions { display: none; }
  .employee-card > div[style*="map-marker"] { font-size: 9px !important; }
  .employee-card > div:has(> i.fa-map-marker-alt) { font-size: 9px !important; }

  /* ── Annonce épinglée ── */
  .dash-alerts { margin-bottom: 12px; }

  /* ── RH ultra-compact ── */
  .rh-tab { padding: 5px 8px; font-size: 10px; margin: 0 3px 3px 0; }
  .leave-item { padding: 10px; gap: 6px; }
  .li-name { font-size: 12px; }
  .li-meta { font-size: 10px; }
  .rh-filter-btn { padding: 5px 10px; font-size: 11px; }
  .stat-card { padding: 10px; }
  .stat-val { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stat-sub { font-size: 9px; }
  .stat-icon { width: 36px; height: 36px; font-size: 14px; }
  .stats-row { gap: 8px; }
  .stats-row[style*="repeat(3"] { grid-template-columns: 1fr !important; }
  .plan-name-hd, .plan-name-cell { width: 80px !important; max-width: 80px !important; font-size: 10px !important; }
  .plan-cell { min-width: 24px; height: 24px; }
  .plan-cell-lbl { font-size: 7px; }
  .planning-table th { font-size: 9px; padding: 4px 0; min-width: 24px; }
  .mgr-detail-actions { gap: 6px; }
  .mgr-action-approve, .mgr-action-reject { padding: 8px; font-size: 13px; }
  .leave-detail-grid { gap: 8px; }
  .ldg-row { font-size: 12px; }
  .leave-comments-list { max-height: 150px; }
  .rh-export-filters { grid-template-columns: 1fr !important; }
  .rh-summer-grid { grid-template-columns: 1fr !important; }
  .rh-filter-btn { padding: 4px 8px; font-size: 10px; }
  .rh-filter-count { min-width: 16px; height: 16px; font-size: 9px; }

  /* ── Messagerie compacte ── */
  .chat-input-wrap { flex-wrap: wrap; }
  .chat-actions { gap: 4px; }
  .chat-actions .btn { padding: 4px 8px; }

  /* ── Agenda ultra-compact ── */
  .cal-main { overflow: hidden; max-width: 100%; min-width: 0; }
  .cal-main-header h2 { font-size: 13px; }
  .cal-main-header .btn { font-size: 10px; padding: 4px 8px; }
  .cal-month-cell { min-height: 40px; padding: 2px; }
  .cal-ev { font-size: 7px; padding: 1px 2px; }
  .cal-day-num { font-size: 9px; }
  .agenda-filter-toggle { font-size: 11px; padding: 6px 10px; }

  /* ── Planning RH responsive ── */
  .plan-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rh-detail-section { padding: 12px; }

  /* ── Tableau Kp GNSS responsive ── */
  .gnss-kp-table { font-size: 11px !important; }
  .gnss-kp-table th,
  .gnss-kp-table td { padding: 8px 6px !important; }
  .gnss-kp-table td:last-child { font-size: 11px; line-height: 1.4; }

  /* ── Liens rapides ── */
  .links-grid { grid-template-columns: 1fr !important; }

  /* ── Administration ── */
  .admin-content { padding: 12px !important; }
  .admin-tabs-list { flex-wrap: wrap; gap: 4px; }
  .admin-tab { font-size: 11px; padding: 6px 10px; }
  .admin-tabs-nav { gap: 4px !important; }
  .admin-tabs-nav .btn { font-size: 10px !important; padding: 5px 8px !important; }
  .admin-tabs-nav .btn i { margin-right: 2px; }

  /* ── Tables admin : scroll horizontal ── */
  .manager-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .manager-table th, .manager-table td { font-size: 11px; padding: 8px 10px; }

  /* ── Journal d'audit : scroll ── */
  .audit-table-wrap, div:has(> table.manager-table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Toggles : ne pas écraser ── */
  .setting-row { flex-wrap: wrap; gap: 8px; }
  .setting-info { flex: 1; min-width: 0; }
  .toggle { flex-shrink: 0; min-width: 40px; }

  /* ── Paramètres compact ── */
  .settings-card { padding: 14px; }

  /* ── Comptabilité ultra-compact ── */
  .compta-stats-manager { grid-template-columns: 1fr !important; }
  .compta-stats-employee { grid-template-columns: 1fr !important; }
  .compta-credit-grid { grid-template-columns: 1fr !important; }
  .stat-card { padding: 10px !important; }
  .stat-card .stat-val { font-size: 14px !important; }
  .expense-group > div:first-child { padding: 10px 12px !important; gap: 8px !important; }
  .compta-demand-header { padding: 10px 12px !important; }
  .compta-actions-row { padding: 8px 12px !important; }
  .compta-actions-row > div { width: 100%; }
  .compta-actions-row .btn { flex: 1; min-width: 0; text-align: center; justify-content: center; }
  .exp-subline { grid-template-columns: 1fr 1fr !important; }

  /* ── CSE ultra-compact ── */
  .cse-kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .cse-kpi-grid .card { padding: 12px 8px !important; }
  .cse-kpi-grid .card div:first-child { font-size: 22px !important; }
  .cse-inbox-filters .btn { font-size: 10px !important; padding: 4px 6px !important; }
  #cseChatMessages { min-height: 250px; max-height: 40vh; }

  /* ── Paramètres ultra-compact ── */
  .settings-layout { gap: 12px; }
  .settings-menu { gap: 0; }
  .settings-menu-item { padding: 6px 10px; font-size: 11px; }
  .settings-panel { padding: 14px 10px; }
  .settings-panel h2 { font-size: 16px; }
  .settings-profile-card { padding: 12px !important; gap: 10px !important; }
  .settings-profile-card .avatar-xl { width: 48px !important; height: 48px !important; font-size: 18px !important; }
  .settings-theme-card { width: 100% !important; }
  .settings-theme-card > div:last-child { padding: 10px 12px !important; }
  .settings-integration-row { padding: 12px !important; }
  .settings-actions .btn { font-size: 12px; }
  .setting-row { padding: 10px 0; }
}

/* ────────────────────────────────────────────────────────────
   27. SCROLL IMPROVEMENTS
──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--txt-4); }

/* ────────────────────────────────────────────────────────────
   28. PRINT
──────────────────────────────────────────────────────────── */
@media print {
  .topbar, .sidebar, .notif-panel { display: none; }
  .app { display: block; }
  .main-content { height: auto; overflow: visible; }
}

/* ────────────────────────────────────────────────────────────
   29. PAGE DE CONNEXION
──────────────────────────────────────────────────────────── */

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes lgnFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lgnSlideDown {
  from { opacity: 0; transform: translateY(-28px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes lgnSlideRight {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes lgnSlideLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes lgnOrb1 {
  0%, 100% { transform: translate(0,   0)   scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.12); }
  66%      { transform: translate(-25px, 20px) scale(.9); }
}
@keyframes lgnOrb2 {
  0%, 100% { transform: translate(0,   0)   scale(1); }
  40%      { transform: translate(-50px, 35px) scale(1.18); }
  70%      { transform: translate(20px, -15px) scale(.92); }
}
@keyframes lgnOrb3 {
  0%, 100% { transform: translate(0,   0) scale(1); }
  50%      { transform: translate(25px, 40px) scale(1.1); }
}
@keyframes lgnShimmer {
  0%        { left: -80%; opacity: 1; }
  60%, 100% { left: 150%; opacity: 0; }
}

/* ── Structure ───────────────────────────────────────────── */
.login-page {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font);
  animation: lgnFadeIn .4s ease;
}

/* ── Panneau gauche — marque ─────────────────────────────── */
.login-left {
  flex: 1;
  background:
    linear-gradient(
      160deg,
      rgba(18, 12,  6, .78) 0%,
      rgba(28, 18, 10, .72) 45%,
      rgba(12,  8,  4, .82) 100%
    ),
    url('../img/bg-geometre-1.jpg') center / cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

/* Lueur rouge (marque Géomètre-Expert) */
.login-left::before {
  content: '';
  position: absolute;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(197,59,42,.28) 0%, transparent 65%);
  top: -140px; right: -160px;
  animation: lgnOrb1 9s ease-in-out infinite;
}
/* Lueur ambre chaude (harmonie avec la prairie dorée) */
.login-left::after {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,130,20,.16) 0%, transparent 65%);
  bottom: -110px; left: -110px;
  animation: lgnOrb2 11s ease-in-out infinite;
}
/* Troisième lueur subtile (centre) */
.login-orb3 {
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,160,40,.06) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: lgnOrb3 15s ease-in-out infinite;
  pointer-events: none;
}

/* Contenu du panneau gauche */
.login-left-logo {
  width: 260px; max-width: 85%;
  position: relative; z-index: 1;
  animation: lgnSlideDown .8s cubic-bezier(.16,1,.3,1) .15s both;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.4));
}
.login-left-title {
  font-size: 13px; color: rgba(255,255,255,.4);
  text-align: center; line-height: 1.6; max-width: 280px;
  position: relative; z-index: 1; letter-spacing: .3px; margin-top: 20px;
  animation: lgnFadeIn .8s ease .5s both;
}
.login-features {
  margin-top: 36px;
  display: flex; flex-direction: column; gap: 13px;
  width: 100%; max-width: 280px;
  position: relative; z-index: 1;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 28px;
  animation: lgnFadeIn .8s ease .7s both;
}
.login-feature {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.55); font-size: 12.5px;
  animation: lgnSlideLeft .5s ease calc(var(--fi, 0) * 80ms + .75s) both;
}
.login-feature-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #C53B2A; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(197,59,42,.5);
}

/* ── Panneau droit — formulaire ──────────────────────────── */
.login-right {
  width: 440px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  box-shadow: -12px 0 60px rgba(0,0,0,.18);
  animation: lgnSlideRight .75s cubic-bezier(.16,1,.3,1) .05s both;
}
.login-right-logo {
  width: 340px; max-width: 100%; margin-bottom: 28px;
  animation: lgnSlideDown .7s cubic-bezier(.16,1,.3,1) .25s both;
}
.login-right h2 {
  font-size: 22px; font-weight: 700; color: #1a2a35; margin: 0 0 6px;
  animation: lgnFadeIn .6s ease .35s both;
}
.login-right > p {
  font-size: 13px; color: var(--txt-3); margin: 0 0 30px;
  animation: lgnFadeIn .6s ease .4s both;
}
.login-right .form-group {
  animation: lgnFadeIn .6s ease calc(var(--fi, 0) * 80ms + .45s) both;
}

/* Inputs */
.login-input-wrap { position: relative; width: 100%; }
.login-input-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%); color: #737D88;
  font-size: 14px; pointer-events: none;
  transition: color .2s;
}
.login-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1.5px solid #E5E7EB;
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
  background: #FAFAFA;
  color: var(--txt-1);
}
.login-input:focus {
  border-color: #C53B2A;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(197,59,42,.10);
}
.login-input:focus + .login-input-icon,
.login-input-wrap:focus-within .login-input-icon { color: #C53B2A; }

/* ── Toggle afficher/masquer mot de passe ── */
.pwd-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--txt-3, #9CA3AF);
  padding: 6px 10px;
  font-size: 15px;
  border-radius: 999px;
  line-height: 1;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  z-index: 2;
}
.pwd-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  color: #6366F1;
  transform: translateY(-50%) scale(1.08);
}
.pwd-toggle-btn:active {
  transform: translateY(-50%) scale(0.92);
}
.pwd-toggle-btn i { transition: inherit; }

/* Bouton */
.login-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #C53B2A 0%, #A83025 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, filter .2s;
  letter-spacing: .3px;
  margin-top: 8px;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
  animation: lgnFadeIn .6s ease .65s both;
}
.login-btn::after {
  content: '';
  position: absolute;
  top: -50%; left: -80%;
  width: 40%; height: 200%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,.25), transparent);
  transform: skewX(-20deg);
  animation: lgnShimmer 3.5s ease-in-out 1.5s infinite;
}
.login-btn:hover  {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(197,59,42,.35);
}
.login-btn:active { transform: scale(.98); box-shadow: none; }

/* ── Bouton de connexion : wrap + états verrouillé/déverrouillé/fuyard ── */
.login-btn-wrap {
  position: relative;
  width: 100%;
  margin-top: 8px;
  /* Hauteur fixe pour garder l'espace quand le bouton "fuit" en position absolute */
  min-height: 48px;
}
.login-btn-wrap .login-btn {
  margin-top: 0;
  /* Quand on fuit, on passe en position absolute via JS. Transition douce du transform. */
  transition: transform 350ms cubic-bezier(.34, 1.56, .64, 1),
              background 400ms ease,
              box-shadow 400ms ease,
              filter 300ms ease,
              color 300ms ease;
  will-change: transform;
}
/* État verrouillé : grisé, aucun hover, shimmer coupé */
.login-btn.locked {
  background: #E5E7EB !important;
  color: #9CA3AF !important;
  cursor: not-allowed;
  box-shadow: none !important;
  filter: none !important;
  animation: none !important;
}
.login-btn.locked::after { display: none; }
.login-btn.locked:hover {
  filter: none !important;
  transform: none;
  box-shadow: none !important;
}
/* État déverrouillé : pulsation lumineuse invitante */
.login-btn.unlocked {
  animation: loginBtnPulse 2.6s ease-in-out infinite;
}
@keyframes loginBtnPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(197,59,42,0.25); }
  50%      { box-shadow: 0 4px 22px rgba(197,59,42,0.55), 0 0 0 6px rgba(197,59,42,0.08); }
}
/* Bulle "Remplis les champs" */
.login-btn-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: var(--txt-1);
  color: #fff;
  padding: 7px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  animation: loginBubbleIn 350ms cubic-bezier(.34, 1.56, .64, 1);
}
.login-btn-bubble::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -6px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--txt-1);
  border-bottom: 0;
}
@keyframes loginBubbleIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.8); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Messages */
.login-error {
  display: none;
  background: var(--danger-bg);
  border: 1px solid #FCA5A5;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 13px;
  color: #DC2626;
  width: 100%;
  animation: lgnSlideDown .3s ease;
}
.login-hint {
  margin-top: 28px;
  color: #737D88;
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
  animation: lgnFadeIn .6s ease .8s both;
}
.login-divider {
  width: 100%;
  height: 1px;
  background: #F0F0F0;
  margin: 24px 0;
  animation: lgnFadeIn .6s ease .75s both;
}

/* Responsive — masquer panneau gauche sous 700px */
@media (max-width: 700px) {
  .login-left  { display: none; }
  .login-right { width: 100%; padding: 40px 24px; box-shadow: none; }
  .login-right-logo { width: 110px; }
}

/* ── Dashboard — Agenda du jour : cartes événements enrichies ── */
.dash-ev-card {
  border-left: 3px solid var(--acc);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px 10px 12px;
  margin-bottom: 8px;
  transition: box-shadow .15s;
}
.dash-ev-card:last-child { margin-bottom: 0; }
.dash-ev-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* Couleurs par entité (hérite des variables existantes) */
.dash-ev-card.ent-siege    { border-left-color: var(--c-siege,    #C53B2A); }
.dash-ev-card.ent-dinan    { border-left-color: var(--c-dinan,    #1E6FC3); }
.dash-ev-card.ent-plancoet { border-left-color: var(--c-plancoet, #1C8A5A); }
.dash-ev-card.ent-lamballe { border-left-color: var(--c-lamballe, #E07B1A); }
.dash-ev-card.ent-broons   { border-left-color: var(--c-broons,   #7B3F9E); }

.dash-ev-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.dash-ev-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--acc);
  white-space: nowrap;
  min-width: 36px;
}
.dash-ev-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--txt-1);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-ev-location {
  font-size: 11px;
  color: var(--txt-3);
  margin-bottom: 8px;
}
.dash-ev-location i { margin-right: 4px; }

.dash-ev-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.dash-ev-detail {
  font-size: 11px;
  color: var(--txt-2);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}
.dash-ev-spinner {
  color: var(--txt-4);
  font-size: 11px;
}

/* Lien cliquable météo / maps */
.dash-ev-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--txt-2);
  text-decoration: none;
  font-size: 11px;
  transition: color .15s;
}
.dash-ev-link:hover { color: var(--acc); text-decoration: underline; }
.dash-ev-link i { font-size: 12px; }

/* Message indisponible */
.dash-ev-na {
  color: var(--txt-4);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Départ recommandé */
.dash-ev-dep {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--green, #1C8A5A);
  font-weight: 500;
}
.dash-ev-dep i { font-size: 12px; }
.dash-ev-dep-hint {
  font-weight: 400;
  color: var(--txt-4);
  margin-left: 2px;
}
/* Départ déjà passé → alerte orange */
.dash-ev-dep.dash-ev-dep-past {
  color: #E07B1A;
}

/* ── CSE Rich Text Editor ───────────────────── */
.cse-richtext {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.cse-richtext:focus {
  border-color: var(--acc) !important;
  box-shadow: 0 0 0 3px rgba(var(--acc-rgb,0,180,216),0.15);
}
.cse-richtext ul, .cse-richtext ol {
  padding-left: 24px;
  margin: 4px 0;
}
.cse-richtext li {
  margin-bottom: 2px;
}
.cse-richtext p {
  margin: 4px 0;
}

/* Communication — Sondages */
.survey-card { border-left: 4px solid #8B5CF6; }
.survey-progress-bar { height: 4px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.survey-progress-fill { height: 100%; background: #8B5CF6; border-radius: 4px; transition: width .3s; }

/* ── Conditions GNSS ─────────────────────────────── */

/* Hero badge */
.hero-gnss {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,.08);
  border-radius: var(--r-lg);
  color: #fff;
  transition: background .2s;
  white-space: nowrap;
}
.hero-gnss:hover { background: rgba(255,255,255,.15); }
.gnss-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

/* Summary banner */
.gnss-summary {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.gnss-summary-optimal { border-left: 4px solid #16A34A; }
.gnss-summary-vigilance { border-left: 4px solid #EAB308; background: rgba(234,179,8,.04); }
.gnss-summary-degraded { border-left: 4px solid #F97316; background: rgba(249,115,22,.04); }
.gnss-summary-severe { border-left: 4px solid #DC2626; background: rgba(220,38,38,.06); }
.gnss-summary-unknown { border-left: 4px solid #999; }
.gnss-summary-icon { flex-shrink: 0; padding-top: 4px; }
.gnss-summary-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.gnss-summary-detail { font-size: 13px; color: var(--txt-2); line-height: 1.6; }

/* Section */
.gnss-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.gnss-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
}

/* Indices grid */
.gnss-indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.gnss-index-card {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.gnss-index-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.gnss-index-label { font-size: 12px; font-weight: 600; color: var(--txt-2); }
.gnss-index-value { font-size: 20px; font-weight: 800; }
.gnss-index-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.gnss-index-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}
.gnss-index-desc { font-size: 11px; color: var(--txt-4); line-height: 1.4; }

/* Constellations */
.gnss-const-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.gnss-const-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.gnss-const-flag { font-size: 28px; }
.gnss-const-name { font-size: 14px; font-weight: 700; }
.gnss-const-status { font-size: 12px; color: var(--txt-3); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.gnss-const-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Forecast */
.gnss-forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.gnss-forecast-card {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.gnss-forecast-day { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.gnss-forecast-date { font-size: 11px; color: var(--txt-4); margin-bottom: 10px; }
.gnss-forecast-kp { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.gnss-forecast-risk { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.gnss-forecast-conseil { font-size: 11px; color: var(--txt-3); }

/* Raw data (collapsible) */
.gnss-collapsed { display: none; }
.gnss-raw-table { width: 100%; font-size: 13px; }
.gnss-raw-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); }
.gnss-raw-table tr:last-child td { border-bottom: none; }

/* Alerts list */
.gnss-alerts-list { display: flex; flex-direction: column; gap: 8px; }
.gnss-alert-item {
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--r-md);
  border-left: 3px solid var(--acc);
}
.gnss-alert-time { font-size: 10px; color: var(--txt-4); margin-bottom: 2px; }
.gnss-alert-msg { font-size: 12px; color: var(--txt-2); font-family: monospace; white-space: pre-wrap; word-break: break-word; }

/* Responsive */
@media (max-width: 600px) {
  .gnss-summary { flex-direction: column; padding: 14px; }
  .gnss-indices-grid, .gnss-const-grid, .gnss-forecast-grid { grid-template-columns: 1fr; }
  .hero-gnss span:not(.gnss-badge) { display: none; }
}


/* ────────────────────────────────────────────────────────────
   MODULE IT — Inventaire + Tickets
──────────────────────────────────────────────────────────── */

/* Device cards */
.it-device-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: box-shadow .15s;
}
.it-device-card:hover { box-shadow: var(--shadow); }
.it-device-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  background: transparent;
}
.it-device-icon.pc,
.it-device-icon.laptop   { color: #2563EB; }
.it-device-icon.phone    { color: #059669; }
.it-device-icon.tablet   { color: #D97706; }
.it-device-icon.printer  { color: var(--txt-2); }
.it-device-icon.monitor  { color: #7C3AED; }
.it-device-icon.mouse    { color: #0891B2; }
.it-device-icon.keyboard { color: #4F46E5; }
.it-device-icon.vehicle  { color: #DC2626; }
.it-device-icon.other    { color: var(--txt-2); }

.it-device-info { flex: 1; min-width: 0; }
.it-device-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--txt-1); }
.it-device-detail { font-size: 12px; color: var(--txt-3); line-height: 1.6; }
.it-device-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* Ticket cards */
.it-ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all .15s;
}
.it-ticket-card:hover {
  border-color: var(--acc);
  box-shadow: var(--shadow);
}

/* ── Personnalisation du tableau de bord ── */
.dash-cust-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: background var(--tr);
}
.dash-cust-item:hover { background: var(--bg); }
.dash-cust-grip { color: var(--txt-4); cursor: grab; padding: 4px; user-select: none; }
.dash-cust-grip:active { cursor: grabbing; }
.dash-cust-item[draggable="true"] { user-select: none; }
.dash-cust-item.dragging { opacity: 0.4; cursor: grabbing; }
.dash-cust-item.drop-above { box-shadow: inset 0 3px 0 0 var(--acc); }
.dash-cust-item.drop-below { box-shadow: inset 0 -3px 0 0 var(--acc); }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border2);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--tr);
}
.toggle-slider:before {
  content: "";
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--tr);
}
.toggle-switch input:checked + .toggle-slider { background: var(--acc); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ── Mentions @user dans la messagerie ── */
.msg-mention {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  /* Dérive automatiquement de l'accent du thème courant (entité ou défaut)
     → toujours bon contraste quel que soit le thème actif (rouge EGUIMOS,
     bleu Urba Real, vert Land Concept, dark mode, etc.) */
  background: color-mix(in srgb, var(--acc) 18%, transparent);
  color: var(--acc);
  font-weight: 700;
  font-size: 0.95em;
  cursor: default;
  border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent);
}
/* Mode sombre : forcer un texte plus clair pour rester lisible sur fond sombre */
html.dark-mode .msg-mention,
html.theme-preload-dark .msg-mention {
  background: color-mix(in srgb, var(--acc) 28%, transparent);
  color: color-mix(in srgb, var(--acc) 50%, #ffffff);
  border-color: color-mix(in srgb, var(--acc) 60%, transparent);
}
/* Dans une bulle "mes messages" (fond accent / dark), inverser pour rester lisible.
   La bulle utilise la classe `.msg-row.mine` (pas .is-mine — historique). On force la
   spécificité avec html.dark-mode aussi pour battre la règle dark-mode-globale. */
.msg-row.mine .msg-mention,
html.dark-mode .msg-row.mine .msg-mention,
html.theme-preload-dark .msg-row.mine .msg-mention {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.msg-mention.is-me {
  background: var(--warning-bg);
  color: var(--warning-text);
  font-weight: 700;
  border-color: var(--warning-border, #F59E0B);
}
html.dark-mode .msg-mention.is-me,
html.theme-preload-dark .msg-mention.is-me {
  background: rgba(245, 158, 11, 0.25);
  color: #FCD34D;
  border-color: rgba(252, 211, 77, 0.5);
}
.msg-mention-everyone {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--acc) 20%, transparent),
    color-mix(in srgb, var(--acc) 8%, transparent)) !important;
  color: var(--acc) !important;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent);
}
html.dark-mode .msg-mention-everyone,
html.theme-preload-dark .msg-mention-everyone {
  color: color-mix(in srgb, var(--acc) 50%, #ffffff) !important;
  border-color: color-mix(in srgb, var(--acc) 60%, transparent);
}

/* Markdown léger (gras, italique, liens, listes) */
.md-list { margin: 4px 0 4px 18px; padding: 0; list-style: disc; }
.md-list li { margin: 2px 0; }
.message-bubble strong, .nc-excerpt strong { font-weight: 700; }
.message-bubble em, .nc-excerpt em { font-style: italic; }
.message-bubble a[target="_blank"] { color: var(--acc); text-decoration: underline; word-break: break-all; }

/* Pièces jointes en attente (preview avant envoi) */
.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.pending-att-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-width: 240px;
  position: relative;
}
.pending-att-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.pending-att-icon {
  width: 40px; height: 40px;
  background: var(--bg);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--txt-3);
  font-size: 16px;
}
.pending-att-info {
  flex: 1;
  min-width: 0;
}
.pending-att-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.pending-att-type {
  font-size: 10px;
  color: var(--txt-3);
}
.pending-att-remove {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.pending-att-remove:hover { opacity: .85; }

/* "X est en train d'écrire" — indicateur live */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--txt-3);
  font-style: italic;
  background: var(--surface);
  border-top: 1px solid var(--border);
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--acc);
  animation: typingPulse 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typingPulse {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30%           { opacity: 1;  transform: translateY(-3px); }
}

/* Mention @everyone dans l'autocomplete : trait coloré à gauche */
.mention-item.mention-everyone {
  border-left: 3px solid var(--acc);
}
/* Quand je suis mentionné dans un message → bord coloré sur la bulle */
.msg-bubble.msg-mentioned-me {
  border-left: 3px solid var(--warning);
  padding-left: 9px;
}

/* Dropdown d'autocomplete @mention */
.mention-menu {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.mention-item:hover,
.mention-item.selected {
  background: var(--acc-light);
}

/* ── Highlight <mark> des snippets de recherche plein-texte (ts_headline Postgres) ── */
.doc-item mark {
  background: var(--warning-border);
  color: var(--warning-text);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* ── Kanban board (Support IT / Tous les tickets) ── */
.it-kanban-card:hover {
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.it-kanban-card:active {
  cursor: grabbing;
}
.it-kanban-col-over {
  background: rgba(var(--acc-rgb, 27, 79, 138), 0.08) !important;
  outline: 2px dashed var(--acc);
  outline-offset: -4px;
}
/* Thème sombre : rendre les colonnes et cartes lisibles */
.theme-preload-dark .it-kanban-col,
[data-theme="dark"] .it-kanban-col { background: #1A1D23 !important; }
.theme-preload-dark .it-kanban-card,
[data-theme="dark"] .it-kanban-card { background: #22262E !important; border-color: rgba(255,255,255,0.08) !important; }
.it-ticket-id {
  font-size: 11px;
  font-weight: 700;
  color: var(--txt-3);
  min-width: 32px;
}
.it-ticket-info { flex: 1; min-width: 0; }
.it-ticket-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; color: var(--txt-1); }
.it-ticket-meta { font-size: 11px; color: var(--txt-3); display: flex; gap: 12px; flex-wrap: wrap; }
.it-ticket-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Stats cards */
.it-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.it-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
}
.it-stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}
.it-stat-label {
  font-size: 12px;
  color: var(--txt-3);
  font-weight: 500;
}

/* Warranty badge */
.warranty-ok      { color: var(--green); }
.warranty-warning { color: var(--amber); font-weight: 600; }
.warranty-expired { color: var(--red); font-weight: 600; }

/* IT Tabs */
.it-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 700px) {
  .it-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .it-tabs::-webkit-scrollbar { display: none; }
  .it-tab { scroll-snap-align: start; flex-shrink: 0; }
  .it-tab-sep { display: none; }
}
.it-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--txt-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  white-space: nowrap;
}
.it-tab.active { color: var(--acc); border-bottom-color: var(--acc); }
.it-tab:hover:not(.active) { color: var(--txt-1); }
.it-tab-sep {
  width: 1px;
  background: var(--border);
  margin: 6px 8px;
  align-self: stretch;
}

/* Comment thread */
.it-comment {
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg);
  margin-bottom: 8px;
}
.it-comment.auto {
  background: transparent;
  border-left: 3px solid var(--border);
  font-size: 12px;
  color: var(--txt-3);
  font-style: italic;
}
.it-comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
}
.it-comment-author { font-weight: 600; color: var(--txt-1); }
.it-comment-date { color: var(--txt-3); }
.it-comment-text { font-size: 13px; line-height: 1.5; }

/* Responsive */
@media (max-width: 768px) {
  .it-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .it-device-card { flex-direction: column; }
  .it-tabs { font-size: 11px; }
  .it-tab { padding: 8px 10px; font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════════
   Assistant IA — panneau latéral
   ══════════════════════════════════════════════════════════════ */
.ai-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,.12);
  z-index: 800;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.ai-panel.open { transform: translateX(0); }
.ai-panel-hd {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
}
.ai-messages {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.ai-msg {
  display: flex; gap: 10px; align-items: flex-start;
}
.ai-msg-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 12px; color: #fff;
}
.ai-msg-user .ai-msg-icon { background: #3B82F6; }
.ai-msg-assistant .ai-msg-icon { background: linear-gradient(135deg, #7C3AED, #EC4899); }
.ai-msg-bubble {
  flex: 1;
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--txt-1);
  word-break: break-word;
}
.ai-msg-user .ai-msg-bubble { background: rgba(59,130,246,.10); }
.ai-cursor {
  display: inline-block;
  animation: ai-blink 1s infinite;
  color: var(--acc);
  font-weight: bold;
}
@keyframes ai-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.ai-code {
  background: rgba(0,0,0,.30);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 6px 0;
  overflow-x: auto;
  font-size: 12px;
  font-family: 'Consolas', 'Monaco', monospace;
}
.ai-inline-code {
  background: rgba(0,0,0,.20);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
}
.ai-suggestions {
  padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 6px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.ai-suggestion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  color: var(--txt-2);
}
.ai-suggestion:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: rgba(var(--acc-rgb,0,180,216),.08);
}
.ai-input-form {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.ai-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--txt-1);
  outline: none;
  line-height: 1.4;
  max-height: 100px;
}
.ai-input:focus { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(var(--acc-rgb,0,180,216),.15); }
.ai-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  align-self: flex-end;
  transition: all .15s;
}
.ai-send:hover:not(:disabled) { transform: scale(1.05); }
.ai-send:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 600px) {
  .ai-panel { width: 100vw; }
}

/* Bouton stop IA */
.ai-stop {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #DC2626;
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  align-self: flex-end;
  transition: all .15s;
  animation: ai-stop-pulse 1.6s ease-in-out infinite;
}
.ai-stop:hover { transform: scale(1.05); background: #B91C1C; }
@keyframes ai-stop-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ══════════════════════════════════════════════════════════════
   Easter Eggs — animations
   ══════════════════════════════════════════════════════════════ */
@keyframes eggToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-30px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes eggToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}
@keyframes eggConfettiFall {
  0%   { transform: translateY(-30px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.4; }
}
@keyframes eggSnowFall {
  0%   { transform: translateY(0) translateX(0); opacity: 0.8; }
  50%  { transform: translateY(50vh) translateX(20px); opacity: 1; }
  100% { transform: translateY(110vh) translateX(-20px); opacity: 0; }
}

/* ════════════════════════════════════════════════════════════════
   PETITES ANNONCES (Communication > Annonces)
   ════════════════════════════════════════════════════════════════ */
.an-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.an-scope { display: flex; gap: 6px; flex-wrap: wrap; }
.an-scope-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--txt-2);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.an-scope-btn:hover { background: var(--bg); color: var(--txt-1); }
.an-scope-btn.active { background: var(--acc); color: #fff; border-color: var(--acc); }
.an-scope-btn .cnt { background: rgba(255,255,255,.25); padding: 0 6px; border-radius: 8px; font-size: 11px; }
.an-scope-btn:not(.active) .cnt { background: var(--bg); color: var(--txt-3); }
.an-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.an-search { position: relative; flex: 1; min-width: 200px; }
.an-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--txt-4); font-size: 12px; }
.an-search input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--txt-1); font-size: 13px; outline: none; }
.an-search input:focus { border-color: var(--acc); }
.an-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--txt-1); font-size: 13px; cursor: pointer; outline: none; }

.an-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.an-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column;
  position: relative;
  min-height: 280px;
}
.an-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); border-color: var(--acc-light); }
.an-card.is-sold, .an-card.is-closed, .an-card.is-expired { opacity: .65; }
.an-photo {
  height: 160px; background: var(--bg); background-size: cover; background-position: center;
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--txt-4); font-size: 36px;
}
.an-status-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(124, 58, 237, .85); color: #fff; font-weight: 800; font-size: 18px; letter-spacing: 1px;
}
.an-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--orange, #F59E0B); color: #fff;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .03em;
}
.an-photo-count {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
}
.an-fav {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.9); color: var(--txt-3);
  border: none; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.an-fav:hover { transform: scale(1.1); }
.an-fav.active { color: var(--danger, #EF4444); background: #fff; }
.an-fav-big { width: 40px; height: 40px; font-size: 16px; border-radius: 50%; background: var(--bg); color: var(--txt-3); border: 1px solid var(--border); cursor: pointer; }
.an-fav-big.active { color: var(--danger, #EF4444); border-color: var(--danger, #EF4444); }

.an-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; position: relative; }
.an-price { font-size: 17px; font-weight: 800; color: var(--acc); }
.an-title { font-size: 13px; font-weight: 600; color: var(--txt-1); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.an-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.an-cat, .an-cond { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--bg); color: var(--txt-3); border: 1px solid var(--border); }
.an-cat { background: var(--acc-light); color: var(--acc); border-color: transparent; font-weight: 600; }
.an-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--txt-3); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.an-mine-badge { position: absolute; top: -2px; right: 8px; background: var(--acc); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 0 0 4px 4px; }

/* ── Modale détail ── */
.an-gallery { display: flex; flex-direction: column; gap: 8px; }
.an-gallery-main {
  width: 100%; height: 360px; max-height: 50vh; background: var(--bg);
  background-size: contain; background-position: center; background-repeat: no-repeat;
  border-radius: 8px; border: 1px solid var(--border);
}
.an-gallery-thumbs { display: flex; gap: 6px; overflow-x: auto; }
.an-gal-thumb {
  flex-shrink: 0; width: 70px; height: 70px; border-radius: 6px;
  background-size: cover; background-position: center;
  border: 2px solid transparent; cursor: pointer; transition: border-color .15s;
}
.an-gal-thumb.active { border-color: var(--acc); }
.an-gallery-empty {
  height: 200px; display: flex; align-items: center; justify-content: center;
  color: var(--txt-4); font-size: 48px; background: var(--bg); border-radius: 8px;
}

/* ── Formulaire création/édition ── */
.an-photos-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.an-photo-item { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg); }
.an-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.an-photo-rm {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: #fff;
  border: none; cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* Responsive */
@media (max-width: 600px) {
  .an-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .an-photo { height: 120px; }
  .an-price { font-size: 14px; }
  .an-title { font-size: 12px; }
  .an-filters { flex-direction: column; align-items: stretch; }
  .an-search { min-width: 0; }
}

/* ── Zoom main image (loupe button) ── */
.an-gallery-main { position: relative; cursor: zoom-in; }
.an-zoom-btn {
  position: absolute; bottom: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  border: none; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
  backdrop-filter: blur(4px);
}
.an-zoom-btn:hover { background: rgba(0,0,0,.85); transform: scale(1.1); }

/* ── Lightbox plein écran ── */
.an-lightbox {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.an-lightbox.open { opacity: 1; }
.an-lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.92);
  cursor: zoom-out;
}
.an-lb-img {
  position: relative; z-index: 1;
  max-width: 92vw; max-height: 92vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  border-radius: 4px;
  user-select: none;
  pointer-events: none;
}
.an-lb-close, .an-lb-nav {
  position: absolute; z-index: 2;
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
  backdrop-filter: blur(4px);
}
.an-lb-close {
  top: 20px; right: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 18px;
}
.an-lb-nav {
  top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 22px;
}
.an-lb-nav.prev { left: 20px; }
.an-lb-nav.next { right: 20px; }
.an-lb-close:hover, .an-lb-nav:hover { background: rgba(255,255,255,.25); }
.an-lb-nav:hover { transform: translateY(-50%) scale(1.08); }
.an-lb-counter {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 2;
  background: rgba(0,0,0,.6); color: #fff;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  backdrop-filter: blur(4px);
}
@media (max-width: 600px) {
  .an-lb-nav { width: 40px; height: 40px; font-size: 16px; }
  .an-lb-nav.prev { left: 8px; }
  .an-lb-nav.next { right: 8px; }
  .an-lb-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 16px; }
}

/* ════════════════════════════════════════════════════════════════
   CHECKLIST PERSONNELLE (widget dashboard)
   ════════════════════════════════════════════════════════════════ */
.todos-widget { padding: 0; overflow: hidden; }
.todos-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.todos-body { padding: 8px 10px; }
.todos-filters {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.todos-pill {
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  background: var(--bg); color: var(--txt-3);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.todos-pill:hover { background: var(--surface2, var(--bg)); color: var(--txt-1); }
.todos-pill.active { background: var(--acc); color: #fff; border-color: var(--acc); }
.todos-pill-cnt {
  background: rgba(255,255,255,.25); padding: 0 5px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
}
.todos-pill:not(.active) .todos-pill-cnt { background: var(--surface, var(--bg)); color: var(--txt-2); }

.todos-add {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px;
}
.todos-add input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--txt-1); font-size: 13px; padding: 4px 0;
}
.todos-add input::placeholder { color: var(--txt-4); }

.todos-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.todo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 6px;
  transition: background .12s;
  position: relative;
}
.todo-row:hover { background: var(--bg); }
.todo-row.is-done .todo-title { text-decoration: line-through; color: var(--txt-4); }
.todo-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border); border-radius: 5px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
  transition: all .15s;
}
.todo-check:hover { border-color: var(--acc); }
.todo-check.done { background: var(--acc); border-color: var(--acc); }
.todo-text { flex: 1; min-width: 0; cursor: pointer; }
.todo-title { font-size: 13px; font-weight: 500; color: var(--txt-1); line-height: 1.3; word-break: break-word; }
.todo-meta { display: flex; gap: 8px; margin-top: 2px; align-items: center; }
.todo-due { font-size: 10px; color: var(--txt-3); display: inline-flex; align-items: center; gap: 3px; }
.todo-due.today { color: var(--orange, #F59E0B); font-weight: 600; }
.todo-due.overdue { color: var(--danger, #EF4444); font-weight: 600; }
.todo-has-desc { color: var(--txt-4); }
.todo-prio {
  width: 4px; height: 24px; border-radius: 2px; flex-shrink: 0;
}
.todo-del {
  width: 22px; height: 22px; border-radius: 50%;
  background: transparent; color: var(--txt-4);
  border: none; cursor: pointer; font-size: 11px;
  opacity: 0; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.todo-row:hover .todo-del { opacity: 1; }
.todo-del:hover { background: var(--danger, #EF4444); color: #fff; }

/* ════════════════════════════════════════════════════════════════
   PAGE SANTÉ SYSTÈME — gauges, charts, alertes
   ════════════════════════════════════════════════════════════════ */
.health-gauge-card {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.health-chart-card { padding: 14px 16px; }
.health-chart-card h3 { color: var(--txt-2); }
.health-chart-card canvas { max-height: 200px; }
@media (max-width: 700px) {
  .health-gauge-card svg { max-width: 200px; }
}

/* ════════════════════════════════════════════════════════════════
   MODE POPOUT (fenêtre détachée d'une vue)
   Active en ajoutant la classe .popout-mode sur <body>.
   Masque le chrome (sidebar, topbar, breadcrumbs) et étend la vue
   sur 100 % de la fenêtre.
   ════════════════════════════════════════════════════════════════ */
body.popout-mode .sidebar,
body.popout-mode .topbar,
body.popout-mode .breadcrumbs,
body.popout-mode .ent-bar,
body.popout-mode #overlay,
body.popout-mode .return-btn,
body.popout-mode .skip-link {
  display: none !important;
}
body.popout-mode .app {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
  grid-template-areas: "main" !important;
  height: 100dvh !important;
}
body.popout-mode .main-content {
  padding: 0 !important;
  height: 100dvh !important;
  overflow: auto;
  grid-area: main !important;
}
/* Garder le spinner centré pendant le chargement */
body.popout-mode.app-loading .main-content,
body.popout-mode .app.app-loading .main-content {
  display: flex; align-items: center; justify-content: center;
}
body.popout-mode .view {
  padding: 12px 16px;
}
body.popout-mode .view-hd {
  padding-top: 4px;
}
/* Messagerie en popout : on conserve la sidebar des conversations (module complet).
   Si une conv unique a été détachée (.popout-conv-only), on masque la sidebar. */
body.popout-mode.popout-conv-only .chat-layout { grid-template-columns: 1fr !important; }
body.popout-mode.popout-conv-only .chat-sidebar { display: none !important; }
body.popout-mode .chat-main { height: 100dvh !important; }

/* Mini barre du popout : nom de la conv/vue + bouton fermer */
body.popout-mode .popout-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
  color: var(--txt-1);
  -webkit-app-region: drag;
}
body:not(.popout-mode) .popout-titlebar { display: none; }

/* Bouton détacher générique (topbar + headers de vues) */
.popout-detach-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; color: var(--txt-3);
  border: none; cursor: pointer; font-size: 12px;
  transition: background .15s, color .15s;
}
.popout-detach-btn:hover { background: var(--bg); color: var(--acc); }
body.popout-mode .popout-detach-btn { display: none; }

/* ════════════════════════════════════════════════════════════════
   REFACTOR RESPONSIVE MOBILE (≤ 600 px)
   Couche 1 : modales fullscreen — Couche 3 : utilities partagées
   ════════════════════════════════════════════════════════════════ */

/* ── Couche 1 : modales fullscreen-on-mobile ── */
@media (max-width: 600px) {
  .modal-backdrop {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  .modal {
    width: 100% !important; max-width: none !important;
    height: 100% !important; max-height: 100dvh !important;
    border-radius: 0 !important;
    display: flex; flex-direction: column;
    margin: 0 !important;
  }
  .modal-header {
    position: sticky; top: 0; z-index: 5;
    background: var(--surface);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .modal-body, .modal > .modal-body, .modal-content {
    flex: 1; overflow-y: auto;
    padding: 14px 16px;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    display: flex; gap: 8px; flex-wrap: wrap;
    flex-shrink: 0;
  }
  .modal-footer .btn { flex: 1; min-width: 0; padding: 10px 12px; font-size: 14px; }
  /* Inputs plus grands au tactile */
  .modal input.form-control,
  .modal textarea.form-control,
  .modal select.form-control {
    font-size: 16px !important;  /* évite le zoom auto iOS sur focus */
    min-height: 38px;
  }
}

/* ── Couche 3 : utilities partagées ── */

/* Form grids responsives */
.form-grid     { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid-3   { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.form-grid-full { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr !important; }
  /* Tout grid avec template-columns en 2 cols → 1 col en mobile par défaut */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Onglets en scroll horizontal (sous-onglets RH, IT, Compta…) */
.tabs-scroll, .rh-tabs, .admin-tabs-nav {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap !important;
  padding-bottom: 4px;
}
.tabs-scroll::-webkit-scrollbar,
.rh-tabs::-webkit-scrollbar,
.admin-tabs-nav::-webkit-scrollbar { display: none; }
.tabs-scroll > *, .rh-tabs > *, .admin-tabs-nav > * {
  flex-shrink: 0; scroll-snap-align: start;
  white-space: nowrap;
}

/* Desktop : les onglets d'administration (nombreux) passent à la ligne
   au lieu de déborder de l'écran. Le scroll horizontal reste sur mobile. */
@media (min-width: 901px) {
  .admin-tabs-nav {
    flex-wrap: wrap !important;
    overflow-x: visible;
    scroll-snap-type: none;
  }
}

/* Table avec scroll horizontal + 1ère colonne sticky (nom toujours visible) */
.table-sticky-col {
  width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 600px) {
  .table-sticky-col table { min-width: 600px; }
  .table-sticky-col table th:first-child,
  .table-sticky-col table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--surface);
    box-shadow: 2px 0 4px rgba(0,0,0,.04);
  }
}

/* Cartes empilées (transform tableau → card list) — usage : <table class="responsive-cards"> */
@media (max-width: 600px) {
  table.responsive-cards { display: block; }
  table.responsive-cards thead { display: none; }
  table.responsive-cards tbody { display: block; }
  table.responsive-cards tr {
    display: block;
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 8px; padding: 10px 12px;
    background: var(--surface);
  }
  table.responsive-cards td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; border: none;
    font-size: 13px;
    gap: 12px;
  }
  table.responsive-cards td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--txt-3);
    font-size: 11px; text-transform: uppercase;
    letter-spacing: .03em;
    flex-shrink: 0;
  }
  table.responsive-cards td:not([data-label])::before { content: none; }
}

/* Stat cards : passent à 2 colonnes sur mobile au lieu de 4 */
@media (max-width: 600px) {
  .it-stat-grid,
  [style*="grid-template-columns:repeat(auto-fit,minmax(180px"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(180"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .it-stat-card { padding: 12px !important; }
}

/* View-hd (en-tête de vue) : empile titre + actions sous 600 px */
@media (max-width: 600px) {
  .view-hd { flex-direction: column; align-items: stretch !important; gap: 12px; }
  .view-hd-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .view-hd-actions .btn { flex: 1; min-width: 120px; }
}

/* Messagerie mobile : barre format compacte + safe-area input */
@media (max-width: 600px) {
  .chat-input-bar {
    padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
  }
  .chat-format-bar {
    overflow-x: auto; flex-wrap: nowrap !important;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .chat-format-bar::-webkit-scrollbar { display: none; }
  .chat-format-bar .cf-btn { flex-shrink: 0; }
  .chat-format-bar .cf-sep { display: none; }
}

/* Picker emoji plein écran sur mobile */
@media (max-width: 600px) {
  .emoji-picker-pop, .emoji-picker {
    position: fixed !important;
    left: 0 !important; right: 0 !important;
    bottom: 0 !important; top: auto !important;
    width: 100vw !important; max-width: 100vw !important;
    max-height: 60vh !important;
    border-radius: 12px 12px 0 0 !important;
  }
}

/* Sidebar messagerie : retour à la liste depuis le chat (bouton flèche) */
.chat-back-btn {
  display: none;
  width: 36px; height: 36px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: transparent; color: var(--txt-2);
  border: none; cursor: pointer; font-size: 14px;
  margin-right: 4px;
}
.chat-back-btn:hover { background: var(--bg); color: var(--txt-1); }
@media (max-width: 700px) {
  .chat-back-btn { display: inline-flex !important; }
}

/* ════════════════════════════════════════════════════════════════
   ONBOARDING — Tour guidé première connexion
   ════════════════════════════════════════════════════════════════ */
.ob-backdrop {
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
}
.ob-modal {
  max-width: 560px;
  width: 95%;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
}
.ob-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 480px;
}
.ob-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 18px 20px 0;
}
.ob-dot {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--tr);
}
.ob-dot-active {
  background: var(--acc);
  width: 40px;
}
.ob-dot-done {
  background: var(--acc);
  opacity: 0.5;
}
.ob-content {
  flex: 1;
  padding: 30px 28px 20px;
  overflow-y: auto;
  text-align: center;
}
.ob-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ob-logo-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ob-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 16px;
}
.ob-hero-icon {
  font-size: 38px;
  color: var(--acc);
  display: none;
}
.ob-logo[style*="display: none"] + .ob-hero-icon,
.ob-logo:not([src]) + .ob-hero-icon { display: block; }
.ob-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--txt-1);
  margin: 0;
  line-height: 1.2;
}
.ob-subtitle {
  font-size: 15px;
  color: var(--txt-2);
  margin: 0;
}
.ob-text {
  font-size: 14px;
  color: var(--txt-2);
  line-height: 1.5;
  margin: 4px 0;
  max-width: 440px;
}
.ob-text-small {
  font-size: 12px;
  color: var(--txt-4);
  margin: 4px 0;
  font-style: italic;
}
.ob-feat-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  margin-bottom: 4px;
}
.ob-success {
  background: rgba(34, 197, 94, 0.12);
  color: #22C55E;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ob-warn {
  background: rgba(245, 158, 11, 0.1);
  color: var(--txt-2);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.ob-ios-howto {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: 10px;
  text-align: left;
  font-size: 13px;
}
.ob-ios-howto ol { margin: 8px 0 0 18px; padding: 0; }
.ob-ios-howto li { margin: 4px 0; }

/* Tour de modules */
.ob-modules { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ob-mod-counter {
  font-size: 11px;
  color: var(--txt-4);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.ob-mod-icon-big {
  width: 90px;
  height: 90px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  margin: 6px 0;
}
.ob-mod-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--txt-1);
}
.ob-mod-desc {
  font-size: 14px;
  color: var(--txt-2);
  line-height: 1.5;
  margin: 0;
  max-width: 380px;
}
.ob-mod-progress {
  width: 100%;
  max-width: 320px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0;
}
.ob-mod-progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}
.ob-mod-mini-nav {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Raccourcis finale */
.ob-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 400px;
  margin: 14px 0;
}
.ob-shortcut {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--tr);
  font-size: 13px;
  font-weight: 600;
  color: var(--txt-1);
}
.ob-shortcut:hover {
  background: var(--surface);
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--sh-sm);
}
.ob-shortcut i { font-size: 20px; }

.ob-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  gap: 10px;
}
.ob-footer .btn { min-width: 120px; }

/* Mobile */
@media (max-width: 600px) {
  .ob-modal { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .ob-content { padding: 20px 18px 14px; }
  .ob-title { font-size: 20px; }
  .ob-mod-icon-big { width: 76px; height: 76px; font-size: 36px; }
  .ob-mod-title { font-size: 19px; }
  .ob-shortcuts { grid-template-columns: 1fr; }
  .ob-footer { padding: 14px 16px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .ob-footer .btn { min-width: 100px; font-size: 13px; }
}

/* Onboarding — Cartes procédure d'installation PWA */
.ob-install-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
  width: 100%;
  max-width: 460px;
  margin: 4px auto 0;
}
.ob-install-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--acc);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.ob-install-steps {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  color: var(--txt-2);
  line-height: 1.6;
}
.ob-install-steps li { margin: 6px 0; }
.ob-install-steps b { color: var(--txt-1); }

/* ════════════════════════════════════════════════════════════════
   ONBOARDING — Animation logo EGUIMOS (slide 1)
   ════════════════════════════════════════════════════════════════ */
.ob-logo-stage {
  position: relative;
  width: 360px;
  height: 130px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

/* Halo lumineux derrière le logo */
.ob-logo-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--acc) 0%, transparent 65%);
  opacity: 0;
  filter: blur(20px);
  animation: obGlow 3s ease-in-out 0.3s infinite alternate;
}
@keyframes obGlow {
  0%   { opacity: 0.15; transform: scale(0.85); }
  100% { opacity: 0.45; transform: scale(1.1); }
}

/* Anneaux concentriques qui pulsent */
.ob-logo-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--acc);
  opacity: 0;
}
.ob-logo-ring-1 { width: 320px; height: 100px; border-radius: 60px; animation: obRing 2.8s ease-out 0.4s infinite; }
.ob-logo-ring-2 { width: 320px; height: 100px; border-radius: 60px; animation: obRing 2.8s ease-out 1.3s infinite; }
.ob-logo-ring-3 { width: 320px; height: 100px; border-radius: 60px; animation: obRing 2.8s ease-out 2.2s infinite; }
@keyframes obRing {
  0%   { transform: scale(0.95); opacity: 0.6; border-width: 2px; }
  100% { transform: scale(1.35); opacity: 0;   border-width: 0.5px; }
}

/* Le logo lui-même : entrée bouncy + flottement continu */
.ob-logo-anim {
  width: 320px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 2;
  animation: obLogoEntry 0.9s cubic-bezier(.34,1.56,.64,1) both,
             obLogoFloat 4s ease-in-out 1s infinite;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
}
/* Bascule logo clair / sombre */
.ob-logo-dark  { display: none; }
.ob-logo-light { display: block; }
html.dark-mode .ob-logo-light,
html.theme-preload-dark .ob-logo-light { display: none; }
html.dark-mode .ob-logo-dark,
html.theme-preload-dark .ob-logo-dark  { display: block; }
@keyframes obLogoEntry {
  0%   { transform: scale(0.4) translateY(20px); opacity: 0; }
  60%  { transform: scale(1.08) translateY(-4px); opacity: 1; }
  100% { transform: scale(1)    translateY(0);   opacity: 1; }
}
@keyframes obLogoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* Étincelles autour du logo */
.ob-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--acc);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 8px var(--acc);
}
.ob-spark-1 { top: 10%;  left: 15%;  animation: obSpark 2.4s ease-in-out 0.8s infinite; }
.ob-spark-2 { top: 20%;  right: 10%; animation: obSpark 2.4s ease-in-out 1.4s infinite; }
.ob-spark-3 { bottom: 15%; left: 8%; animation: obSpark 2.4s ease-in-out 2.0s infinite; }
.ob-spark-4 { bottom: 20%; right: 12%; animation: obSpark 2.4s ease-in-out 1.0s infinite; width: 4px; height: 4px; }
.ob-spark-5 { top: 50%;  left: 0%;   animation: obSpark 2.4s ease-in-out 1.8s infinite; width: 4px; height: 4px; }
.ob-spark-6 { top: 50%;  right: 0%;  animation: obSpark 2.4s ease-in-out 0.5s infinite; width: 4px; height: 4px; }
@keyframes obSpark {
  0%, 100% { opacity: 0; transform: scale(0); }
  50%      { opacity: 1; transform: scale(1.4); }
}

/* Texte d'entrée */
.ob-title-anim {
  animation: obSlideUp 0.7s cubic-bezier(.22,1,.36,1) 0.3s both;
}
.ob-fade-in {
  animation: obSlideUp 0.6s cubic-bezier(.22,1,.36,1) both;
  opacity: 0;
}
@keyframes obSlideUp {
  0%   { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Mobile : un peu plus petit */
@media (max-width: 600px) {
  .ob-logo-stage { width: 280px; height: 100px; }
  .ob-logo-anim  { width: 240px; }
  .ob-logo-ring-1, .ob-logo-ring-2, .ob-logo-ring-3 { width: 240px; height: 80px; }
}

/* Respect des préférences reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .ob-logo-anim, .ob-logo-glow, .ob-logo-ring, .ob-spark,
  .ob-title-anim, .ob-fade-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Onboarding — Liste features mobile (slide 3) */
.ob-mobile-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 460px;
  margin: 14px auto 6px;
}
.ob-mfeat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  transition: all var(--tr);
}
.ob-mfeat:hover { border-color: var(--acc); }
.ob-mfeat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.ob-mfeat-text { flex: 1; min-width: 0; }
.ob-mfeat-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt-1);
  margin-bottom: 2px;
}
.ob-mfeat-desc {
  font-size: 12px;
  color: var(--txt-3);
  line-height: 1.4;
}
@media (max-width: 600px) {
  .ob-mfeat { padding: 10px 12px; }
  .ob-mfeat-icon { width: 34px; height: 34px; font-size: 15px; }
}

/* ════════════════════════════════════════════════════════════════
   Bandeau iOS auto — installation PWA
   ════════════════════════════════════════════════════════════════ */
.ios-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  z-index: 9998;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s ease, transform .3s ease;
}
.ios-install-banner.ios-install-visible {
  opacity: 1;
  transform: translateY(0);
}
.ios-install-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1F2937, #374151);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ios-install-body { flex: 1; min-width: 0; }
.ios-install-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--txt-1);
  margin-bottom: 2px;
}
.ios-install-desc {
  font-size: 12px;
  color: var(--txt-3);
  line-height: 1.4;
}
.ios-install-close {
  background: transparent;
  border: none;
  color: var(--txt-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 14px;
  flex-shrink: 0;
}
.ios-install-close:hover { background: var(--surface2); color: var(--txt-1); }
.ios-install-arrow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  color: var(--acc);
  animation: iosArrowBounce 1.4s ease-in-out infinite;
}
@keyframes iosArrowBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(6px); }
}

/* Onboarding — Variantes "warning" pour la carte install (Chrome iOS, etc.) */
.ob-install-card.ob-install-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}
.ob-install-badge-warn {
  background: #F59E0B !important;
  color: #fff !important;
}
.ob-install-text {
  font-size: 13px;
  color: var(--txt-2);
  line-height: 1.5;
  margin: 0 0 12px;
}
.ob-install-substeps {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 158, 11, 0.2);
}
.ob-install-substeps-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--txt-1);
  margin-bottom: 6px;
}

/* Planning RH — séparateur de groupe d'agence
   Ligne entre chaque groupe d'agence dans le planning annuel.
   Le libellé de l'agence est sticky à gauche pour rester visible lors du scroll horizontal. */
.pa-agence-row {
  background: var(--surface2);
}
.pa-agence-row td {
  border-top: 2px solid var(--acc) !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--surface2) !important;
}
.pa-agence-cell {
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--txt-1) !important;
  text-align: left !important;
  /* Sticky horizontal : le libellé reste visible même quand on scroll les jours à droite */
  position: sticky !important;
  left: 0;
  z-index: 3;
  /* Largeur sticky limitée à la colonne nom (~150px) */
  max-width: 150px;
  width: 150px;
  min-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Bordure droite plus marquée pour séparer du reste */
  border-right: 2px solid var(--acc) !important;
}

/* IT — Indicateur ticket avec nouvelle activité non lue */
.it-ticket-card.it-ticket-unread {
  border-left: 3px solid var(--red, #DC2626);
  background: linear-gradient(90deg, rgba(220,38,38,0.04) 0%, transparent 80%);
}
.it-ticket-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red, #DC2626);
  margin-left: 6px;
  vertical-align: middle;
  animation: itDotPulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(220,38,38,0.6);
}
@keyframes itDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

/* ════════════════════════════════════════════════════════════════
   Bannière "Nouvelle version disponible"
   ════════════════════════════════════════════════════════════════ */
.version-update-banner {
  position: fixed;
  top: calc(var(--topbar-h, 56px) + 12px);
  right: 16px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--acc), #4F46E5);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.1);
  max-width: 380px;
  animation: vubSlideIn 0.4s cubic-bezier(.22,1,.36,1);
}
@keyframes vubSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.vub-text { flex: 1; min-width: 0; }
.vub-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.vub-sub   { font-size: 11px; opacity: 0.85; line-height: 1.3; }
.version-update-banner .btn-primary {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
  font-weight: 700;
}
.version-update-banner .btn-primary:hover {
  background: rgba(255,255,255,0.3);
}
.vub-close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  border-radius: 6px;
  transition: all 0.15s;
}
.vub-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

@media (max-width: 600px) {
  .version-update-banner {
    top: calc(env(safe-area-inset-top, 0) + var(--topbar-h, 56px) + 8px);
    left: 8px; right: 8px;
    max-width: none;
    padding: 10px 12px;
  }
  .vub-title { font-size: 12px; }
  .vub-sub   { font-size: 10px; }
}

/* Messagerie — Color picker pour groupes */
.group-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.group-color-swatch {
  position: relative;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-block;
}
.group-color-swatch input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.group-color-swatch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.15s;
  box-sizing: border-box;
  pointer-events: none;
}
.group-color-swatch:hover span {
  transform: scale(1.1);
}
.group-color-swatch input[type="radio"]:checked ~ span {
  border-color: var(--txt-1);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--acc);
}

/* ════════════════════════════════════════════════════════════════
   Messagerie — Indicateur de présence sur avatars DM
   ════════════════════════════════════════════════════════════════ */
.ch-icon { position: relative; }
.presence-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-sizing: content-box;
  transition: background 0.3s, transform 0.2s;
  z-index: 2;
}
.presence-dot.is-online {
  animation: presencePulse 2.5s ease-in-out infinite;
}
@keyframes presencePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}
.presence-dot.is-offline {
  opacity: 0.75;
}

/* ════════════════════════════════════════════════════════════════
   Messagerie — Sections repliables (groupes / DMs / agences)
   ════════════════════════════════════════════════════════════════ */
.ch-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--txt-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.ch-section-header:hover { background: var(--surface2); }
.ch-section-chevron {
  font-size: 9px;
  width: 12px;
  text-align: center;
  transition: transform 0.2s ease;
}
.ch-section-header.is-collapsed .ch-section-chevron { transform: rotate(-90deg); }
.ch-section-title { flex: 1; }
.ch-section-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--txt-4);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 8px;
}
.ch-section-unread {
  display: none;
  background: var(--red, #DC2626);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
}
.ch-section-header.is-collapsed .ch-section-unread { display: inline-block; }
.ch-section-body {
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.ch-section-body.is-collapsed { max-height: 0 !important; }

/* Sous-section agence (niveau 2) */
.ch-subsection-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 24px;
  font-size: 10px;
  font-weight: 700;
  color: var(--txt-3);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.ch-subsection-header:hover { background: var(--surface2); }
.ch-subsection-chevron {
  font-size: 8px;
  width: 10px;
  transition: transform 0.2s ease;
}
.ch-subsection-header.is-collapsed .ch-subsection-chevron { transform: rotate(-90deg); }
.ch-subsection-title { flex: 1; font-size: 10px; }
.ch-subsection-count { font-size: 9px; color: var(--txt-4); }
.ch-subsection-body { overflow: hidden; transition: max-height 0.25s ease; }
.ch-subsection-body.is-collapsed { max-height: 0 !important; }

/* Color picker — bouton couleur custom :
   on cache la radio standard derrière le color input pour que le clic ouvre
   le picker OS, pas la radio. */
.group-color-custom { position: relative; }
.group-color-custom input[type="radio"] {
  z-index: 0 !important;        /* en dessous du color picker */
  pointer-events: none !important; /* radio invisible et non cliquable */
}
.group-color-custom input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  border: 0;
  z-index: 2;
}

/* ── Glisser-déposer global : retour visuel sur les zones data-drop-input ── */
[data-drop-input] { transition: outline-color .15s, background .15s; }
[data-drop-input].dropzone-over {
  outline: 2px dashed var(--acc);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--acc) 10%, transparent) !important;
  border-radius: var(--r-md);
}

/* Glisser-déposer sur la zone de conversation (messagerie) */
.chat-messages.chat-drop-over {
  outline: 2px dashed var(--acc);
  outline-offset: -6px;
  background: color-mix(in srgb, var(--acc) 8%, transparent);
}

/* ── Visionneuse d'image (lightbox) générique ── */
.img-viewer {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.img-viewer.open { opacity: 1; }
.iv-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.88); cursor: zoom-out; }
.iv-img {
  position: relative; max-width: 92vw; max-height: 88vh;
  object-fit: contain; border-radius: 6px; cursor: zoom-in;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  transition: transform .2s;
}
.img-viewer.zoomed .iv-img {
  max-width: none; max-height: none;
  width: auto; height: auto;
  cursor: zoom-out;
  /* permet le scroll pour explorer l'image zoomée */
}
.img-viewer.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.iv-toolbar { position: fixed; top: 16px; right: 16px; display: flex; gap: 10px; z-index: 2; }
.iv-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; text-decoration: none;
}
.iv-btn:hover { background: rgba(255,255,255,.28); }
.iv-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; z-index: 2;
}
.iv-nav:hover { background: rgba(255,255,255,.28); }
.iv-nav.prev { left: 16px; }
.iv-nav.next { right: 16px; }
.iv-counter {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.5); color: #fff; font-size: 13px;
  padding: 5px 14px; border-radius: 20px; z-index: 2;
}
@media (max-width: 600px) {
  .iv-img { max-width: 96vw; max-height: 80vh; }
  .iv-nav { width: 40px; height: 40px; font-size: 15px; }
  .iv-toolbar { top: calc(env(safe-area-inset-top, 0) + 10px); }
}
