/* =============================================================================
   BETLAB – Espace Collaboratif
   Feuille de style principale (design system + composants + mises en page)
   ============================================================================= */

/* ---------- 1. Variables du design system ---------- */
:root {
  /* Nuit bleue — noms --petrol-* conservés */
  --petrol-900: #070B16;
  --petrol-800: #10182C;
  --petrol-700: #9AADFF;
  --petrol-500: #6D84FF;
  --petrol-100: #2A3658;
  --petrol-50: #1A2340;

  /* Bouton bleu vif, filet clair */
  --jalon: #4F6BFF;
  --jalon-hover: #3E58E8;
  --laiton: #8EA2FF;

  --bg: #070B16;
  --surface: #121A30;
  --surface-2: #1A2340;
  --border: rgba(148, 168, 220, 0.16);
  --border-strong: rgba(148, 168, 220, 0.3);

  --text: #F5F7FF;
  --text-2: #C5D0EA;
  --muted: #8E9BB8;

  --success: #3DDC97;
  --success-bg: rgba(61, 220, 151, 0.14);
  --warning: #F5B14A;
  --warning-bg: rgba(245, 177, 74, 0.14);
  --danger: #FF7A7A;
  --danger-bg: rgba(255, 122, 122, 0.14);
  --info: #8EA2FF;
  --info-bg: rgba(79, 107, 255, 0.16);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);

  --sidebar-w: 300px;
  --topbar-h: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(56, 96, 255, 0.28), transparent 55%),
    var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); font-weight: 650; }
p { margin: 0; }
a { color: var(--petrol-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--petrol-500); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.hidden { display: none !important; }
.noscript { padding: 24px; text-align: center; }

/* ---------- 3. Écran de lancement ---------- */
.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 30% 20%, var(--petrol-700), var(--petrol-900) 70%);
  color: #fff;
  transition: opacity .35s var(--ease), visibility .35s;
}
.splash.is-hidden { opacity: 0; visibility: hidden; }
.splash-logo { width: 132px; height: 132px; padding: 10px; object-fit: contain; background: #fff; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin-bottom: 14px; }
.splash-name { font-size: 22px; font-weight: 700; letter-spacing: .04em; text-align: center; line-height: 1.25; max-width: 320px; padding: 0 16px; }
.splash-sub { font-size: 14px; opacity: .75; margin-bottom: 22px; }

/* ---------- 4. Spinner & squelettes ---------- */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(154, 173, 255, .25); border-top-color: var(--jalon);
  animation: spin .8s linear infinite;
}
.spinner-light { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  display: inline-block; min-width: 40px; min-height: 1em; border-radius: 6px;
  background: linear-gradient(90deg, #182038 25%, #243056 50%, #182038 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 5. Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; line-height: 1;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--jalon); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--jalon-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--petrol-50); border-color: var(--petrol-500); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--petrol-50); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 15px; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--petrol-50); color: var(--text); }

/* ---------- 6. Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.input-wrap > .icon ~ .input { padding-left: 42px; }
.input-wrap .input-action {
  position: absolute; right: 4px; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer;
}
.input-wrap .input-action:hover { color: var(--text); background: var(--petrol-50); }
.input-wrap .input.has-action { padding-right: 46px; }

.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9AABB4; }
.input:focus { outline: none; border-color: var(--jalon); box-shadow: 0 0 0 3px rgba(79, 107, 255, .28); }
.input:read-only { background: var(--surface-2); color: var(--text-2); }
.input[aria-invalid="true"] { border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }

/* ---------- 7. Alertes & badges ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; border: 1px solid transparent; margin-bottom: 16px;
  animation: fadeIn .2s var(--ease);
}
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--danger-bg); color: #FFC2C2; border-color: rgba(255, 122, 122, .4); }
.alert-success { background: var(--success-bg); color: #B6F5D8; border-color: rgba(61, 220, 151, .4); }
.alert-warning { background: var(--warning-bg); color: #FFD59A; border-color: rgba(245, 177, 74, .4); }
.alert-info { background: var(--info-bg); color: #D5DEFF; border-color: rgba(142, 162, 255, .4); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--petrol-50); color: var(--text);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-preparation { background: var(--info-bg); color: var(--info); }
.badge-en_cours { background: var(--petrol-50); color: var(--petrol-700); }
.badge-termine, .badge-success { background: var(--success-bg); color: var(--success); }
.badge-suspendu, .badge-warning { background: var(--warning-bg); color: #FFD59A; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: #243056; color: var(--muted); }
.badge-admin { background: var(--jalon); color: #fff; }

/* ---------- 8. Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; }
.card-title .icon { color: var(--petrol-700); }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ---------- 9. Page de connexion ---------- */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--surface);
}
.auth-visual {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px;
  color: #fff;
  background: radial-gradient(circle at 20% 15%, var(--petrol-700) 0%, var(--petrol-900) 65%);
}
.auth-visual .contours { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .16; pointer-events: none; }
.auth-visual > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.auth-brand strong { display: block; font-size: 16px; letter-spacing: .03em; line-height: 1.25; }
.auth-brand span { font-size: 13px; opacity: .75; }
.auth-pitch h2 { color: #fff; font-size: 34px; font-weight: 700; max-width: 460px; letter-spacing: -.01em; }
.auth-pitch p { margin-top: 14px; max-width: 440px; opacity: .8; font-size: 16px; }
.auth-features { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: .92; }
.auth-features .icon {
  width: 34px; height: 34px; padding: 8px; border-radius: 10px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
}
.auth-copy { font-size: 12px; opacity: .6; }

.auth-panel {
  display: flex; align-items: center; justify-content: center; padding: 32px 20px;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(to right, rgba(142, 162, 255, 0.07) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(to bottom, rgba(142, 162, 255, 0.07) 0 1px, transparent 1px 32px);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--laiton);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 36px 32px 28px;
  animation: riseIn .4s var(--ease);
}
.auth-card-logo { width: 140px; height: 140px; object-fit: contain; margin: 0 auto 10px; }
.auth-card h1 { font-size: 21px; text-align: center; }
.auth-card .auth-subtitle { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 26px; }
.auth-row { display: flex; justify-content: flex-end; margin: -6px 0 20px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 4px 0; cursor: pointer;
  color: var(--petrol-700); font-weight: 600; font-size: 13px;
}
.link-btn:hover { text-decoration: underline; }
.auth-footer { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth-site-link { display: block; margin-top: 14px; text-align: center; font-size: 13px; font-weight: 600; }

/* ---------- 10. Structure de l'application ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0C1224 0%, #070B16 100%);
  color: #fff;
  padding-bottom: env(safe-area-inset-bottom);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--topbar-h); padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand > div { min-width: 0; }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.sidebar-brand strong { display: block; font-size: 13px; letter-spacing: .03em; line-height: 1.25; }
.sidebar-brand span { display: block; font-size: 11.5px; opacity: .65; }
.sidebar-close { display: none; margin-left: auto; color: #fff; }
.sidebar-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .45; padding: 14px 12px 6px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: rgba(255,255,255,.78); font-weight: 500; font-size: 14.5px;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.is-active { background: rgba(255,255,255,.13); color: #fff; }
.nav-link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--jalon);
}
.nav-link .nav-tag {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
}
.nav-link .nav-unread { background: var(--jalon); color: #fff; }

.sidebar-footer { padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 8px; }
.sidebar-footer .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.12); }
.sidebar-footer .btn:hover { background: rgba(255,255,255,.14); }
.sidebar-site { display: block; text-align: center; color: rgba(255,255,255,.8); font-size: 12.5px; font-weight: 600; padding: 6px 0; }
.sidebar-site:hover { color: #fff; text-decoration: none; }
.sidebar-version { font-size: 11px; opacity: .45; text-align: center; }

.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(10, 30, 40, .45);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}

.main { margin-left: var(--sidebar-w); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 28px;
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 11, 22, .88);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-menu { display: none; }
.topbar-logo { display: none; width: 34px; height: 34px; border-radius: 9px; }
.topbar-welcome { min-width: 0; }
.topbar-welcome strong { display: block; font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-welcome span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-messages { color: inherit; text-decoration: none; }
.topbar-messages.is-active { background: var(--petrol-50); color: var(--petrol-700); }
.messages-badge { background: var(--jalon); }
.push-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 28px 0; padding: 12px 14px;
  background: var(--info-bg); border: 1px solid rgba(79, 107, 255, 0.35); border-radius: 14px;
}
.push-banner p { margin: 0; flex: 1; min-width: 220px; }

.notif-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--warning); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

.profile-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.profile-btn:hover, .profile-btn[aria-expanded="true"] { background: var(--petrol-50); border-color: var(--border); }
.profile-meta { text-align: left; line-height: 1.2; }
.profile-meta strong { display: block; font-size: 13.5px; font-weight: 600; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-meta span { font-size: 12px; color: var(--muted); }

.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--petrol-700), var(--petrol-900));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .03em;
}
.avatar-lg { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }

/* Menus déroulants */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70;
  min-width: 240px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .15s var(--ease), transform .15s var(--ease), visibility .15s;
}
.dropdown.is-open .dropdown-panel { opacity: 1; visibility: visible; transform: none; }
.dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dropdown-header > strong { display: block; font-size: 14px; }
.dropdown-header > span { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; border: 0; background: none; text-align: left;
  font-size: 14px; color: var(--text-2); cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-list { padding: 6px 0; }

.notif-panel { width: 360px; max-width: calc(100vw - 24px); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 12px; width: 100%; padding: 12px 16px;
  border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: rgba(79, 107, 255, 0.16); }
.notif-item .notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: transparent; }
.notif-item.is-unread .notif-dot { background: var(--petrol-700); }
.notif-item strong { display: block; font-size: 13.5px; font-weight: 600; }
.notif-item p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.notif-item time { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Zone de contenu */
.view { flex: 1; padding: 28px; width: 100%; max-width: 1440px; margin: 0 auto; animation: fadeIn .25s var(--ease); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-header p { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* ---------- 11. Tableau de bord ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-icon.petrol { background: var(--petrol-50); color: var(--petrol-700); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card-link { color: inherit; text-decoration: none; }
.stat-card-link:focus-visible { outline: 2px solid var(--petrol-700); outline-offset: 2px; }
.stat-kinds { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.stat-kinds span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.stat-kinds i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }

.map-box { height: 380px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; position: relative; z-index: 0; }
.map-overlay {
  position: absolute; inset: auto 12px 12px 12px; z-index: 500;
  background: rgba(255,255,255,.95); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: var(--text-2); box-shadow: var(--shadow);
}
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leaflet-popup-content { font-family: var(--font); font-size: 13px; }
.leaflet-popup-content strong { color: var(--petrol-900); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--petrol-50); color: var(--petrol-700);
}
.list-icon.warning { background: var(--warning-bg); color: var(--warning); }
.list-icon.danger { background: var(--danger-bg); color: var(--danger); }
.list-icon.success { background: var(--success-bg); color: var(--success); }
.list-icon.info { background: var(--info-bg); color: var(--info); }
.list-icon .icon { width: 18px; height: 18px; }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; font-size: 13.5px; font-weight: 600; }
.list-main p { font-size: 13px; color: var(--text-2); }
.list-main time, .list-meta { font-size: 12px; color: var(--muted); }

.empty-state { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty-state .icon { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--border-strong); }
.empty-state strong { display: block; color: var(--text-2); margin-bottom: 4px; }
.error-state { padding: 18px 20px; color: var(--danger); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }

/* ---------- 12. Tableaux ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2);
  padding: 11px 20px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12.5px; color: var(--muted); }
.table .nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warning { color: #FFD59A; font-weight: 600; }

/* ---------- 13. Pages secondaires ---------- */
.placeholder-card { padding: 40px 28px; text-align: center; max-width: 720px; margin: 0 auto; }
.placeholder-card .ph-icon {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--petrol-50); color: var(--petrol-700);
}
.placeholder-card .ph-icon .icon { width: 30px; height: 30px; }
.placeholder-card h3 { font-size: 19px; }
.placeholder-card > p { color: var(--muted); margin: 8px auto 22px; max-width: 520px; }
.feature-list { list-style: none; padding: 0; margin: 0 auto; max-width: 520px; text-align: left; display: grid; gap: 8px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.feature-list .icon { color: var(--petrol-500); width: 18px; height: 18px; margin-top: 2px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-stack { display: grid; gap: 18px; }
.profile-summary { display: flex; align-items: center; gap: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: right; }

.setup-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.setup-card { max-width: 640px; width: 100%; padding: 32px; }
.setup-card h1 { font-size: 22px; margin: 14px 0 8px; }
.setup-card ol { padding-left: 20px; color: var(--text-2); }
.setup-card li { margin-bottom: 8px; }
code, .code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px; background: var(--petrol-50); color: var(--text);
  padding: 2px 6px; border-radius: 6px;
}

/* ---------- 13 bis. Fenêtres modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 30, 40, .5);
  animation: fadeIn .15s var(--ease);
}
.modal {
  width: 100%; max-width: 620px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: riseIn .2s var(--ease);
}
.modal-sm { max-width: 440px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.modal-header h3 .icon { color: var(--petrol-700); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--petrol-700); }
.input-group { display: flex; gap: 8px; }
.input-group .input-wrap, .input-group > .input { flex: 1; }
.credentials { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius-sm); background: var(--petrol-50); border: 1px solid var(--petrol-100); }
.credentials div { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.credentials span { color: var(--muted); font-size: 13px; }
.credentials code { font-size: 15px; background: var(--surface-2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 36px; height: 36px; }
.row-actions .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.row-actions .icon-btn.success:hover { background: var(--success-bg); color: var(--success); }

.modal-lg { max-width: 920px; }

@media (max-width: 720px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-footer { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* ---------- 13 ter. Projets ---------- */
.icon-xs { width: 13px; height: 13px; vertical-align: -2px; }
.map-hint { display: flex; align-items: flex-start; gap: 6px; margin: -4px 0 8px; }
.map-hint .icon { flex: none; margin-top: 2px; }
td .icon-xs { display: inline-block; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.toolbar-search { flex: 1 1 280px; }
.toolbar-select { width: auto; flex: 0 0 200px; }
.toolbar-check { white-space: nowrap; }
.projects-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.projects-map-card { position: sticky; top: calc(var(--topbar-h) + 16px); overflow: hidden; }
.projects-map { height: 520px; }
.table tbody tr.row-link { cursor: pointer; }
textarea.input { min-height: 84px; padding-top: 10px; padding-bottom: 10px; resize: vertical; line-height: 1.5; }
.form-section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--petrol-700);
}
form > .form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-map, .detail-map { height: 320px; border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.detail-map { margin-top: 12px; height: 360px; }
.file-drop {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); transition: border-color .15s, background-color .15s;
}
.file-drop:hover, .file-drop:focus-within { border-color: var(--petrol-500); background: var(--petrol-50); }
.file-drop > .icon { width: 26px; height: 26px; color: var(--petrol-700); flex: none; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.file-list li.is-removed { opacity: .55; }
.file-list li.is-removed .file-name { text-decoration: line-through; }
.file-list li.file-empty { color: var(--muted); font-size: 14px; justify-content: center; border-style: dashed; }
.file-list .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.file-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--muted); }
.contact-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.contact-rows:empty { display: none; }
.contact-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.contact-row .icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contact-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.contact-name { font-weight: 600; }
.contact-phone { display: inline-flex; align-items: center; gap: 6px; color: var(--petrol-700); font-weight: 600; text-decoration: none; white-space: nowrap; }
.contact-phone:hover { text-decoration: underline; }
td .cell-sub .icon-xs { vertical-align: -2px; }
.member-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.detail-badges { display: flex; gap: 8px; margin-bottom: 14px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
.detail-grid dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.detail-grid dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-grid a { color: var(--petrol-700); font-weight: 600; margin-left: 4px; }
.detail-description { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-line; color: var(--text-2); }
.requests-card { margin-bottom: 18px; }
.request-list { display: flex; flex-direction: column; gap: 8px; }
.request-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: inherit; cursor: pointer;
}
.request-row:hover { border-color: var(--laiton); }
.request-row p { margin: 2px 0 0; }
.request-main { min-width: 0; }
.request-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.requests-history { margin-top: 8px; }
.requests-history summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.map-popup-desc { margin-top: 4px; max-width: 260px; white-space: pre-line; }
.map-popup-file { margin-top: 6px; font-size: 11px; color: var(--muted); }

@media (max-width: 1200px) {
  .projects-layout { grid-template-columns: minmax(0, 1fr); }
  .projects-map-card { position: static; }
  .projects-map { height: 380px; }
}
@media (max-width: 720px) {
  .toolbar-select { flex: 1 1 160px; }
  .projects-map { height: 300px; }
  .form-map, .detail-map { height: 260px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-checks { grid-template-columns: minmax(0, 1fr); }
  .contact-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .contact-row .input { grid-column: 1; }
  .contact-row .icon-btn { grid-column: 2; grid-row: 1; }
}

/* ---------- 14. Messages entre membres ---------- */
.view.messages-view {
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--topbar-h));
  max-width: none;
}
.messages-view .page-header { margin-bottom: 14px; }
.messages-layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px;
}
.messages-people, .messages-thread, .messages-placeholder {
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.messages-layout:not(.is-thread) .messages-thread,
.messages-layout.is-thread .messages-placeholder,
.messages-layout.is-unavailable .messages-thread,
.messages-layout.is-unavailable .messages-placeholder { display: none; }
.messages-layout.is-unavailable { grid-template-columns: minmax(0, 1fr); }
.messages-search {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; border-bottom: 1px solid var(--border);
}
.messages-search .icon { color: var(--muted); }
.messages-search .input { border: 0; background: transparent; padding: 0; min-height: 36px; box-shadow: none; }
.messages-search .input:focus { box-shadow: none; }
.messages-people-list, .messages-log { flex: 1; overflow-y: auto; }
.messages-people-status { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.messages-people-status:empty { display: none; }
.messages-alert { margin: 10px 12px; font-size: 13px; }
.avatar-presence { position: relative; overflow: visible; }
.presence-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.presence-dot.is-online { background: var(--success); }
.avatar-presence > .presence-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; box-shadow: 0 0 0 2px var(--surface); }
.text-online { color: var(--success) !important; font-weight: 600; }
.messages-person {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; text-align: left; cursor: pointer;
}
.messages-person:hover { background: var(--surface-2); }
.messages-person.is-active { background: var(--petrol-50); }
.messages-person .avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--jalon); color: #fff; font-size: 13px; font-weight: 700;
}
.messages-person-text, .messages-peer span { min-width: 0; display: block; }
.messages-person-text strong, .messages-peer strong {
  display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.messages-person-text span, .messages-peer span span {
  display: block; color: var(--muted); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.messages-person-meta {
  margin-left: auto; display: grid; justify-items: end; gap: 4px; flex-shrink: 0;
  color: var(--muted); font-size: 11px;
}
.messages-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--jalon); color: #fff; font-size: 10px; font-weight: 700;
}
.messages-thread-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.messages-back { display: none; }
.messages-peer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.messages-peer .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--jalon); color: #fff; font-size: 12px; font-weight: 700;
}
.messages-log { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: min(78%, 460px); display: grid; gap: 3px; }
.msg p {
  margin: 0; padding: 10px 12px; border-radius: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px;
}
.msg time { font-size: 11px; color: var(--muted); }
.msg.is-mine { align-self: flex-end; }
.msg.is-mine p { background: var(--jalon); color: #fff; border-bottom-right-radius: 4px; }
.msg.is-mine time { text-align: right; }
.msg.is-theirs p { background: var(--petrol-50); color: var(--text); border-bottom-left-radius: 4px; }
.messages-compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px; border-top: 1px solid var(--border);
}
.messages-compose[hidden] { display: none; }
.messages-compose .input {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; padding-top: 10px; padding-bottom: 10px;
}
.messages-empty {
  display: grid; place-items: center; gap: 8px; text-align: center;
  padding: 28px 16px; color: var(--muted); height: 100%;
}
.messages-empty .icon { color: var(--petrol-500); }
.messages-placeholder .messages-empty { align-content: center; }

@media (max-width: 800px) {
  .messages-layout { grid-template-columns: minmax(0, 1fr); }
  .messages-layout.is-thread .messages-people,
  .messages-layout.is-thread .messages-placeholder,
  .messages-layout:not(.is-thread) .messages-placeholder { display: none; }
  .messages-back { display: inline-flex; }
  .view.messages-view { padding-bottom: 12px; }
}

/* ---------- 14 ter. Agenda des présences ---------- */
.presence-toolbar { justify-content: space-between; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { min-width: 150px; text-align: center; text-transform: capitalize; }
.presence-switch { display: flex; gap: 8px; }
.presence-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  list-style: none; padding: 0; margin: -6px 0 16px;
  color: var(--text-2); font-size: 13px;
}
.presence-legend li { display: inline-flex; align-items: center; gap: 8px; }
.presence-legend i, .presence-totals i {
  width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none;
}
.kind-beja { background: #1A4E62; color: #fff; }
.kind-tunis { background: #C4452E; color: #fff; }
.kind-hors_tunis { background: #E8891C; color: #fff; }
.kind-bureau { background: #2E9E6B; color: #fff; }
.presence-picker { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; margin-bottom: 16px; }
.presence-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.presence-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 190px; padding: 8px 12px; border: 2px solid transparent; border-radius: 10px;
  cursor: pointer; text-align: left;
}
.presence-choice strong { font-size: 14px; }
.presence-choice span { font-size: 12px; line-height: 1.3; }
.presence-choice.is-on { outline: 2px solid var(--text); outline-offset: 2px; }
.agenda-week, .agenda-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.agenda-week { padding: 12px 12px 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.agenda-grid { padding: 8px 12px 14px; }
.agenda-pad { min-height: 76px; }
.agenda-day {
  min-height: 76px; padding: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.agenda-day.is-weekend { background: var(--surface-2); }
.agenda-day.is-today { border-color: var(--petrol-700); }
.agenda-day.is-selected { outline: 2px solid var(--jalon); outline-offset: 1px; }
.agenda-num { font-size: 12px; font-weight: 700; color: var(--text-2); }
.agenda-kind { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 6px; }
.agenda-short, .agenda-empty { font-size: 11px; color: var(--muted); }
.presence-own { padding: 16px; margin-top: 16px; }
.presence-own h3 { font-size: 15px; margin-bottom: 12px; }
.presence-totals { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.presence-totals li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  font-size: 13px; color: var(--text-2);
}
.presence-totals strong { font-size: 18px; color: var(--text); }
.team-cal { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.team-cal th, .team-cal td { padding: 4px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.team-cal thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; z-index: 1; }
.team-cal thead th span { display: block; font-size: 10px; text-transform: uppercase; }
.team-cal thead th:first-child { left: 0; z-index: 2; }
.team-cal th.is-today { color: var(--jalon); }
.team-cal tbody th {
  position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface);
  font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--border);
}
.cal-cell {
  width: 36px; height: 28px; border: 0; border-radius: 6px;
  background: var(--surface-2); color: transparent; font-size: 9px; font-weight: 700; cursor: pointer;
}
.cal-cell.kind-beja { background: #1A4E62; color: #fff; }
.cal-cell.kind-tunis { background: #C4452E; color: #fff; }
.cal-cell.kind-hors_tunis { background: #E8891C; color: #fff; }
.cal-cell.kind-bureau { background: #2E9E6B; color: #fff; }
.cal-cell.is-selected { outline: 2px solid var(--text); outline-offset: 1px; }
.presence-chart { display: grid; gap: 10px; }
.presence-bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 28px; gap: 10px; align-items: center; }
.presence-bar-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence-track { height: 22px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.presence-stack { display: flex; height: 100%; min-width: 0; }
.presence-stack span { display: grid; place-items: center; font-size: 11px; font-weight: 700; min-width: 0; }
.presence-bar-sum { font-size: 13px; font-weight: 700; text-align: right; }
.presence-sum .num, .team-cal .num { text-align: right; }
.presence-sum th.num span { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.presence-sum tfoot th, .presence-sum tfoot td { border-top: 2px solid var(--border-strong); background: var(--surface-2); }
.presence-view .card { margin-bottom: 16px; }
.presence-note { flex: 1 1 100%; display: flex; flex-direction: column; gap: 8px; }
.presence-note-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.day-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.day-note {
  padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--jalon);
  border-radius: 8px; background: var(--surface-2);
}
.day-note.is-editing { border-color: var(--petrol-700); background: var(--surface); }
.day-note-text { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.day-note-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.day-note-actions { display: flex; gap: 4px; }
.note-action {
  display: inline-flex; align-items: center; gap: 4px; min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer;
}
.note-action:hover { background: var(--surface); border-color: var(--border); }
.note-action.is-danger { color: #fff; background: #C4452E; font-size: 12px; font-weight: 600; }
.presence-note-buttons { display: flex; gap: 8px; }
.presence-note-buttons .btn { display: inline-flex; align-items: center; gap: 6px; }
.presence-note textarea {
  width: 100%; min-height: 60px; resize: vertical; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: 10px; font: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
}
.presence-note textarea:focus { outline: 2px solid var(--petrol-700); outline-offset: 1px; }
.presence-note-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agenda-num { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; }
.agenda-note-count { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--jalon); }
.agenda-notes { display: flex; flex-direction: column; gap: 2px; width: 100%; min-width: 0; }
.agenda-note {
  display: block; padding-left: 6px; border-left: 2px solid var(--jalon);
  font-size: 11px; line-height: 1.3; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agenda-more { font-size: 10px; font-weight: 600; color: var(--muted); }
.cal-cell { position: relative; }
.cal-cell.has-note::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--jalon); box-shadow: 0 0 0 1.5px var(--surface);
}
.presence-notes { display: grid; gap: 14px; }
.presence-notes-day h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
.presence-notes-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.presence-notes button {
  width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  text-align: left; cursor: pointer; color: var(--text);
}
.presence-notes button:hover { border-color: var(--petrol-700); }
.presence-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.presence-note-head > span:not(.agenda-kind) { color: var(--muted); }
.presence-note-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Programme ---------- */
.programme-view .card { margin-bottom: 16px; }
.prog-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 8px 12px 14px; }
.prog-pad { min-height: 104px; }
.prog-day {
  min-height: 104px; padding: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0;
  cursor: pointer;
}
.prog-day:hover { border-color: var(--petrol-700); }
.prog-day.is-weekend { background: var(--surface-2); }
.prog-day.is-today { border-color: var(--petrol-700); box-shadow: inset 0 0 0 1px var(--petrol-700); }
.prog-day-head { display: flex; align-items: center; justify-content: space-between; }
.prog-num { font-size: 12px; font-weight: 700; color: var(--text-2); }
.prog-add {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); cursor: pointer;
  opacity: .55;
}
.prog-day:hover .prog-add, .prog-add:focus-visible { opacity: 1; color: var(--petrol-700); border-color: var(--petrol-700); }
.prog-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.prog-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; min-width: 0;
  padding: 3px 6px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--c); color: #fff; font-size: 11px; line-height: 1.3; text-align: left;
}
.prog-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-chip span { display: inline-flex; align-items: center; gap: 2px; flex: none; opacity: .9; }
.prog-chip:hover { filter: brightness(1.1); }
.prog-more { font-size: 11px; font-weight: 600; color: var(--muted); }
.prog-team td { vertical-align: middle; min-width: 44px; }
.prog-team td[data-day] { cursor: pointer; }
.prog-day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prog-day-list li {
  border-left: 4px solid var(--c); padding: 10px 12px; display: grid; gap: 4px;
  background: var(--surface-2); border-radius: 10px;
}
.prog-day-list p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.prog-day-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.prog-request { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; }
.prog-team tbody th span { display: block; font-size: 11px; font-weight: 500; }
.prog-team td.is-conflict { box-shadow: inset 0 0 0 2px var(--danger); border-radius: 6px; }
.prog-chip-mini { justify-content: center; padding: 3px 4px; margin: 1px 0; font-size: 10px; }
.prog-chip-mini span { display: none; }
.prog-empty {
  width: 36px; height: 26px; border: 1px dashed transparent; border-radius: 6px;
  background: var(--surface-2); cursor: pointer;
}
.prog-empty:hover, .prog-empty:focus-visible { border-color: var(--petrol-700); }
.prog-team-hint { display: flex; align-items: center; gap: 6px; padding: 10px 16px; margin: 0; }
.prog-list { list-style: none; margin: 0; padding: 0; }
.prog-list li { border-top: 1px solid var(--border); }
.prog-list button {
  width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 12px 18px;
  border: 0; border-left: 4px solid var(--c); background: transparent; text-align: left; cursor: pointer; color: var(--text);
}
.prog-list button:hover { background: var(--surface-2); }
.prog-list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.prog-list-head strong { overflow-wrap: anywhere; }
.prog-list-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.prog-list-meta span { display: inline-flex; align-items: center; gap: 4px; }
.prog-members { display: flex; flex-wrap: wrap; gap: 6px; }
.prog-member {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--petrol-50); color: var(--text); border: 1px solid var(--petrol-100);
}
.prog-note { font-size: 13px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.prog-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.prog-check { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.prog-check:has(input:checked) { border-color: var(--petrol-700); background: var(--petrol-50); }
.prog-check > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prog-busy { font-size: 12px; color: var(--danger); }
.prog-busy:empty { display: none; }
.prog-delete { margin-right: auto; }
.prog-detail { border-left: 4px solid var(--c); padding-left: 14px; display: grid; gap: 8px; }
.prog-detail h4 { margin: 0; font-size: 16px; }
.prog-detail h5 { margin: 8px 0 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prog-detail p { margin: 0; display: flex; align-items: center; gap: 6px; }

@media (max-width: 720px) {
  .prog-pad, .prog-day { min-height: 72px; padding: 4px; }
  .prog-chip { justify-content: center; padding: 2px 3px; font-size: 10px; }
  .prog-chip span { display: none; }
  .prog-add { display: none; }
  .prog-checks { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .month-nav { width: 100%; }
  .month-nav strong { flex: 1; }
  .presence-choice { flex: 1 1 140px; min-width: 0; }
  .agenda-pad, .agenda-day { min-height: 58px; padding: 4px; }
  .agenda-short { display: none; }
  .agenda-notes { display: none; }
  .presence-bar-row { grid-template-columns: minmax(72px, 100px) minmax(0, 1fr) 24px; }
}

/* ---------- 14 bis. Notifications toast ---------- */
.toasts {
  position: fixed; z-index: 1100; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 400px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--petrol-700);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn .25s var(--ease);
}
.toast.is-leaving { animation: toastOut .2s var(--ease) forwards; }
.toast-success { border-left-color: var(--success); }
.toast-success > .icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error > .icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning > .icon { color: var(--warning); }
.toast-info > .icon { color: var(--petrol-700); }
.toast-body { flex: 1; }
.toast-action { margin-top: 8px; }
.toast-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }

/* ---------- 15. Animations ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 16. Responsive ---------- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-grid .span-2 { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .shell.sidebar-open .sidebar { transform: none; }
  .shell.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .sidebar-close { display: inline-flex; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .push-banner { margin: 12px 16px 0; }
  .topbar-menu { display: inline-flex; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-panel {
    min-height: 100vh; min-height: 100dvh;
    background-color: var(--bg);
    background-image:
      repeating-linear-gradient(to right, rgba(142, 162, 255, 0.07) 0 1px, transparent 1px 32px),
      repeating-linear-gradient(to bottom, rgba(142, 162, 255, 0.07) 0 1px, transparent 1px 32px),
      linear-gradient(168deg, var(--petrol-900) 0%, var(--petrol-700) 36%, var(--bg) 36.2%);
  }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .view { padding: 18px 14px 28px; }
  .page-header { margin-bottom: 18px; }
  .page-header h2 { font-size: 21px; }
  .stats-grid { gap: 12px; margin-bottom: 14px; }
  .stat-card { flex-direction: column; gap: 12px; padding: 16px; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-value { font-size: 24px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .map-box { height: 300px; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .list-item { padding: 12px 16px; }
  .table th, .table td { padding: 11px 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn { flex: 1; }
  .profile-meta { display: none; }
  .profile-btn { padding: 4px; }
  .topbar-welcome span { display: none; }
  .topbar-logo { display: block; }
  .auth-card { padding: 28px 22px 22px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; min-width: 0; }
  .hide-mobile { display: none; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-card { flex-direction: row; }
}

.geo-layout { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }
.geo-layout [hidden] { display: none !important; }
.geo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.geo-order { margin: 0 0 16px; }
.geo-dl { display: grid; grid-template-columns: minmax(140px, 190px) 1fr; gap: 8px 12px; margin: 14px 0; }
.geo-dl dt { color: var(--muted); font-size: 13px; }
.geo-dl dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.geo-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.geo-history button {
  width: 100%; text-align: start; display: grid; gap: 2px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.geo-history button:hover { border-color: var(--jalon); }
.geo-history span { color: var(--muted); font-size: 13px; }
.geo-history-card { margin-top: 16px; }
.geo-layout .alert { margin-bottom: 12px; }
@media (max-width: 980px) {
  .geo-layout { grid-template-columns: minmax(0, 1fr); }
}
