@charset "utf-8";

/* ============================================
   iManage UI — Apple-inspired design system
   ============================================ */

/* ============================================================
   SYSTÈME DE TOKENS UNIFIÉ — design simple / épuré / moderne
   ────────────────────────────────────────────────────────────
   Une SEULE source de vérité. Les composants ne hardcodent plus
   ni couleur, ni rayon, ni ombre, ni durée : tout passe par ces tokens.
   Une app ne surcharge QUE --accent / --accent-hover dans son app.css.
   ============================================================ */
:root {
	/* Schéma clair explicite : évite que les contrôles natifs (scrollbars,
	   date pickers…) suivent un OS en dark alors que l'app est en light.
	   Surchargé en `dark` par theme-toggle.css. */
	color-scheme: light;

	/* ── 1. Couleurs de base (système Apple = canonique) ── */
	--bg-primary:      #f5f5f7;            /* fond d'app */
	--bg-surface:      #ffffff;            /* cartes, modals, panels (le « papier ») */
	--bg-content:      #f0f0f3;            /* inputs, zones enfoncées, input-group */
	--bg-subtle:       #fafafa;            /* alternance subtile (remplace les Slate #f8fafc/#f1f5f9) */
	--bg-navbar:       rgba(251, 251, 253, 0.80);
	--text-primary:    #1d1d1f;            /* titres, texte fort */
	--text-secondary:  #6e6e73;            /* texte secondaire — WCAG AA 5.9:1 sur blanc */
	--text-tertiary:   #8e8e93;            /* texte muet, placeholder */
	--border:          rgba(0, 0, 0, 0.10);
	--border-strong:   rgba(0, 0, 0, 0.16);
	--separator:       1px solid var(--border);

	/* ── 2. Accent (UN SEUL — écrase les faux #00B4D8 et #0F766E) ── */
	--accent:          #1fb4c5;            /* surchargé par app.css */
	--accent-hover:    #18a0b0;
	--accent-soft:     color-mix(in srgb, var(--accent) 12%, transparent);  /* fonds teintés */
	--accent-border:   color-mix(in srgb, var(--accent) 24%, transparent);
	--text-on-accent:  #ffffff;            /* texte sur fond accent */

	/* ── 3. Status sémantiques (base + -soft pour les fonds) ── */
	--status-info:     #2563eb;  --status-info-soft:    color-mix(in srgb, var(--status-info) 10%, transparent);
	--status-success:  #059669;  --status-success-soft: color-mix(in srgb, var(--status-success) 10%, transparent);
	--status-warning:  #d97706;  --status-warning-soft: color-mix(in srgb, var(--status-warning) 10%, transparent);
	--status-danger:   #dc2626;  --status-danger-soft:  color-mix(in srgb, var(--status-danger) 10%, transparent);
	--color-admin:     #6366f1;            /* badge démo / admin */

	/* ── 4. Surfaces sombres (toasts, notifications, overlays) ── */
	--bg-notification: rgba(29, 29, 31, 0.94);
	--text-on-dark:    #f5f5f7;
	--overlay:         rgba(0, 0, 0, 0.32); /* backdrops modals / drawers */
	/* Voiles CLAIRS, pour poser un relief SUR une surface sombre (carte teintée,
	   bandeau d'accent). --overlay fait l'inverse : il assombrit. Introduits le
	   05/09/2026 pour im-tabs, dont la variante sombre écrivait des
	   rgba(255,255,255,…) en dur — refusés par tools/conformite_design.py. */
	--voile-clair:     rgba(255, 255, 255, 0.10);
	--voile-clair-fort:rgba(255, 255, 255, 0.20);
	--voile-clair-vif: rgba(255, 255, 255, 0.28);
	--opacity-muted:     0.55;             /* échelle d'opacité texte-sur-sombre, 3 crans */
	--opacity-secondary: 0.75;
	--opacity-strong:    0.92;

	/* ── 5. Rayons (vraie échelle — 6 crans distincts) ── */
	--radius-xs:    4px;    /* badges, chips, scrollbars, micro-éléments */
	--radius-sm:    6px;    /* boutons, inputs, selects, menu-items, icon-buttons */
	--radius-md:    10px;   /* cartes, panels, dropdowns, modals standard */
	--radius-lg:    14px;   /* overlays, drawers, bannières, gros conteneurs */
	--radius-xl:    20px;   /* modal hero (login) uniquement */
	--radius-full:  999px;  /* pills, badges arrondis */
	--radius:       var(--radius-md);  /* alias historique (certains app.css l'emploient) */

	/* ── 6. Élévation (ombres NEUTRES — jamais teintées accent/status) ── */
	--shadow-xs:    0 1px 2px rgba(0, 0, 0, 0.05);
	--shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.08);
	--shadow-md:    0 4px 12px rgba(0, 0, 0, 0.08);
	--shadow-lg:    0 8px 24px rgba(0, 0, 0, 0.12);
	--shadow-focus: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);

	/* ── 7. Transitions (même easing, 3 durées) ── */
	--transition-fast: 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);  /* hover, focus, couleur */
	--transition:      0.25s cubic-bezier(0.25, 0.1, 0.25, 1);  /* états, transform/opacity */
	--transition-slow: 0.4s  cubic-bezier(0.22, 1, 0.36, 1);    /* entrées panels/drawers */

	/* ── 8. Typographie — RÈGLE iManage (nombre d'or) ─────────────────────────
	   R = MENU = 13px (--font-size-menu) est la RÉFÉRENCE.
	   • Tout le contenu de page (corps, libellés, tableaux, sous-titres) est PLUS PETIT
	     que le menu : ≤ 12px. Le 13px est réservé au menu/chrome.
	   • Seuls les TITRES dépassent le menu, plafonnés à R × φ(1.618) = 21px (--font-size-xl).
	   Échelle (facteurs de φ) :  10 / 11 / 12 (contenu)  ·  13 (menu = R = PLAFOND contenu)
	   ·  21 (R×φ) / 34 (R×φ²) = TITRES uniquement.                                      ── */
	--phi: 1.618;                                   /* nombre d'or */
	--font-size-xs:   10px;   /* méta : séparateurs, micro-libellés */
	--font-size-sm:   11px;   /* libellés, captions, texte secondaire */
	--font-size-base: 12px;   /* CORPS de page (défaut) — < menu */
	--font-size-md:   12px;   /* corps confortable (= base) */
	--font-size-menu: 13px;   /* MENU = R = PLAFOND de TOUT contenu (champs, dropdowns, boutons, cellules) */
	--font-size-lg:   13px;   /* plafonné au menu : aucune taille de contenu entre 13 et 21 ; sous-titres ≤ menu (hiérarchie par graisse) */
	--font-size-xl:   21px;   /* R × φ — titres de page */
	--font-size-display: 34px;/* R × φ² — grands titres / hero (rare) */
	--font-size-title: var(--font-size-xl);         /* alias sémantique (21px) */
	--font-weight-medium:   500;
	--font-weight-semibold: 600;

	/* ── 9. Espacement (échelle 4px) ── */
	--spacing-xs:  4px;
	--spacing-sm:  8px;
	--spacing-md:  12px;
	--spacing-lg:  16px;
	--spacing-xl:  20px;
	--spacing-2xl: 24px;

	/* ── 10. Réconciliation Slate → Apple (alias, même valeur que le canon) ──
	   Garde les anciens noms vivants ; tous pointent vers le système Apple.
	   Les composants migrés utilisent directement les tokens canoniques ;
	   ces alias couvrent le legacy le temps de finir la migration. */
	--ink:           var(--text-primary);
	--mute:          var(--text-secondary);
	--muted:         var(--text-secondary);
	--line:          var(--border);
	--surf:          var(--bg-surface);
	--paper:         var(--bg-surface);
	--soft:          var(--bg-subtle);
	--softer:        var(--bg-subtle);
	--accent-dark:   var(--accent-hover);
	--border-color:  var(--border);
	--text-light:    var(--text-tertiary);
	--text-muted:    var(--text-secondary);
	--text-disabled: #cbd5e1;
	/* namespace legacy list-view / tile-view — aliasés puis à retirer */
	--lv-ink:   var(--text-primary);   --lv-mute:   var(--text-secondary);
	--lv-line:  var(--border);         --lv-surf:   var(--bg-surface);
	--lv-cyan:  var(--accent);         --lv-accent: var(--accent-hover);
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html { background: var(--bg-surface); }
body {
	font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
	/* PAS de background sur body — il doit rester transparent pour que
	   body::after (l'overlay 2-tons en position:fixed, z-index:-1) soit visible.
	   Le fond plein est porté par <html>. */
	background: transparent !important;
	color: var(--text-primary);
	font-size: var(--font-size-base);   /* RÈGLE iManage : corps de page = 12px (< menu 13px) */
	/* INTERLIGNE ET APPROCHE PAR DÉFAUT (05/09/2026). Le corps n'en fixait
	   AUCUN : tout héritait du défaut navigateur, soit environ 1,2 — serré pour
	   un texte de 12px, et d'autant plus sur les libellés longs des tableaux.
	   DESIGN.md §2 le dit déjà pour les blocs : préférer trop d'air que pas
	   assez ; la règle valait aussi pour le texte lui-même.
	   L'approche reste minime — 0,01em, soit un dixième de pixel par caractère.
	   Assez pour aérer un petit corps, trop peu pour élargir une colonne : une
	   valeur plus forte aurait fait déborder les tableaux denses. */
	line-height: 1.55;
	letter-spacing: 0.01em;
	/* Le bandeau est en position fixe : c'est ce décalage qui empêche la page
	   de passer dessous. Il SUIT sa hauteur (--nt-h, toast.css) — un message
	   long fait grandir le bandeau, et le contenu descend avec lui au lieu
	   d'être recouvert (06/09/2026). */
	padding-top: var(--nt-h, 48px);
	/* La MÊME cadence que le bandeau (--nt-transition, toast.css) : deux durées
	   différentes feraient glisser le contenu et le bandeau l'un par rapport à
	   l'autre, et l'on verrait le fond passer entre les deux. */
	transition: padding-top var(--nt-transition, 0.6s cubic-bezier(0.65, 0, 0.35, 1));
	position: relative;
	/* Overlay 2-tons : split-screen comme Cambatani — gauche claire (7/12),
	   droite légèrement plus sombre (5/12). Rehaussé à ~7% noir (light)
	   pour rendre la séparation clairement perceptible. En dark mode,
	   theme-toggle.css inverse à blanc 9% pour éclaircir au lieu d'assombrir. */
	--body-tone-overlay: rgba(15, 23, 42, 0.07);
}
/* Postulat iManage : body 2 tons — 7/12 gauche (clair) · 5/12 droite (légèrement plus sombre).
   La teinte est portée par --body-tone-overlay pour permettre l'override dark. */
body::after {
	content: '';
	position: fixed;
	top: 0; right: 0; bottom: 0;
	width: calc(100vw * 5 / 12);   /* 5/12 ≈ 41.67 % côté droit */
	background: var(--body-tone-overlay);
	z-index: -1;
	pointer-events: none;
}

/* ── Titres — RÈGLE NOMBRE D'OR ───────────────────────────────────────
   Bootstrap rend h1-h6 jusqu'à 2.5rem (40px) : on CAPE tout sous la règle.
   Maximum absolu = menu(13px) × φ(1.618) = 21px (--font-size-xl), pour h1 / titre
   de page UNIQUEMENT. Seuls h1-h3 dépassent le menu (ce sont des titres) ;
   h4-h6 restent ≤ menu. AUCUN texte de l'app ne dépasse le menu hors titres.
   On inclut les classes utilitaires .h1-.h6 (spécificité Bootstrap). */
h1, .h1 { font-size: var(--font-size-xl);   font-weight: 600; line-height: 1.25; }
h2, .h2 { font-size: var(--font-size-lg);   font-weight: 600; line-height: 1.3; }
h3, .h3 { font-size: var(--font-size-menu); font-weight: 600; line-height: 1.35; }
h4, .h4 { font-size: var(--font-size-menu); font-weight: 600; line-height: 1.4; }
h5, .h5 { font-size: var(--font-size-base); font-weight: 600; line-height: 1.4; }
h6, .h6 { font-size: var(--font-size-sm);   font-weight: 600; line-height: 1.4; }
/* Garde-fou ultime : aucune police de l'app ne peut dépasser le maximum φ.
   .display-* et gros utilitaires Bootstrap sont ramenés au plafond. */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
	font-size: var(--font-size-xl);
	font-weight: 600;
}

/* ---- Page header (calendar zone) ----
   Zone entre la navbar et le contenu, masquée par défaut (max-height animé),
   affichée quand l'app active le calendrier (.visible).
   Dégradé léger pour se distinguer visuellement de la navbar. */
#page_header {
	display: flex;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	padding: 0;
	background: linear-gradient(to bottom, #ffffff, var(--bg-primary));
	transition: max-height .3s ease, opacity .3s ease, padding .3s ease;
}

#page_header.visible,
#page_header.always-visible {
	max-height: 80px;
	opacity: 1;
	padding: 12px 0;
	overflow: visible;
}

/* Mode always-visible : utilisé par les apps où le calendrier fait partie intégrante
   de l'écran (ex: change de devises). Ajouter .always-visible sur le #page_header
   dans le template de l'app plutôt que d'override en CSS. */

#page_header .container,
#page_header .container-fluid {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Icônes du date picker dans la zone calendrier — gris neutre (pas l'accent)
   pour ne pas attirer trop l'attention sur un widget secondaire. */
.date-container .fa-solid,
.date-container .fa-regular {
	color: var(--text-muted, #94a3b8);
	cursor: pointer;
	transition: color .15s;
}
.date-container .fa-solid:hover,
.date-container .fa-regular:hover {
	color: var(--text-primary, #0f172a);
}
/* Texte de la date (weekday / date / year) — affiché en gris foncé,
   weight 500 pour rester lisible sans dominer. */
.date-container .weekday,
.date-container .date,
.date-container .year {
	color: var(--text-primary, #0f172a);
	font-weight: 500;
	margin: 0 4px;
}
.date-container .weekday::after { content: ' '; }
/* Espacement cohérent dans le datepicker — flexbox pour centrage propre. */
.date-container {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-md);
	padding: 4px 12px;
	border-radius: 6px;
}

#page_content {
	padding-top: 16px;
	padding-bottom: 60px;
}

#requested_content {
	padding-top: 0;
	padding-bottom: 0;
}

#page_header.visible + #page_content {
	padding-top: 0;
}

.panel-section-sticky {
	position: sticky;
	top: 134px;
}

/* Styles #page_footer portés par le composant page-footer.css */

/* ════════════════════════════════════════════════
   Scrollbar discrète (WebKit)
   ════════════════════════════════════════════════ */
::-webkit-scrollbar         { width: 6px; height: 6px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: rgba(0, 0, 0, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* ════════════════════════════════════════════════
   Dashboard (.dashboard-v3) — structure commune
   Les apps peuvent ajouter leurs propres extensions (KPIs spécifiques,
   cards métier, etc.) dans leur app.css. Cette base fournit hero, kpis,
   cards et feed. La couleur d'accent est automatiquement var(--accent).
   ════════════════════════════════════════════════ */
.dashboard-v3 {
    /* Les --d-* sont l'interface stable consommée par les sélecteurs du framework.
       Chaque variable hérite du namespace projet (--ink, --mute, --line, --surf,
       --soft, --softer) avec un fallback light-mode. Conséquence : si un projet
       (ou son theme-toggle.css en mode sombre) redéfinit --ink/--surf/etc., le
       dashboard s'adapte automatiquement sans toucher au framework. */
    --d-ink:    var(--ink,    #0f172a);
    --d-mute:   var(--mute,   #64748b);
    --d-line:   var(--line,   #e2e8f0);
    --d-surf:   var(--surf,   #ffffff);
    --d-soft:   var(--soft,   #f8fafc);
    --d-softer: var(--softer, #f1f5f9);
    --d-accent: var(--accent);

    color: var(--d-ink);
    font-size: var(--font-size-base);
    line-height: 1.5;
}
.dashboard-v3 h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--d-ink);
}
.dashboard-v3 h6.g-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--d-mute);
    margin: 0 0 12px;
}

/* ═════════════════════════════════════════════════════════════════
   Hero — bandeau d'accueil
   Structure attendue (templates des projets) :
     <section class="g-hero">
       <div class="g-hero-body">
         <div class="g-hero-greeting">Bonjour…</div>
         <div class="g-hero-subtitle">DBA · 20 mai 2026</div>
       </div>
       <div class="g-clinic-badge|g-clinic-selector">…</div>   (optionnel)
     </section>

   Design canonique : carte arrondie avec gradient subtil, contenu à gauche,
   actions/badge à droite. Bénéficie aux 9 projets iManage.

   Alias backward-compat : .g-hello, .g-role-pill, .g-hint restent supportés.
   ═════════════════════════════════════════════════════════════════ */
.dashboard-v3 .g-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--d-soft), var(--d-surf));
    border: 1px solid var(--d-line);
    border-radius: 10px;
}
.dashboard-v3 .g-hero-body,
.dashboard-v3 .g-hello { min-width: 0; flex: 1; }
.dashboard-v3 .g-hero-greeting {
    font-size: var(--font-size-xl);
    font-weight: 700;
    line-height: 1.2;
    color: var(--d-ink);
    margin-bottom: 4px;
}
.dashboard-v3 .g-hero-subtitle {
    font-size: var(--font-size-base);
    color: var(--d-mute);
    line-height: 1.4;
}
.dashboard-v3 .g-role-pill {
    display: inline-block;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--d-accent);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 8px;
}
.dashboard-v3 .g-hint {
    font-size: var(--font-size-base);
    color: var(--d-ink);
    margin: 0;
    opacity: 0.85;
}

/* ═════════════════════════════════════════════════════════════════
   KPI strip — design canonique iManage v2
   Structure attendue (générée par les templates de chaque projet) :
     <div class="g-kpis">
       <div class="g-kpi-card">
         <div class="g-kpi-head">
           <span class="g-kpi-label">Label</span>
           <span class="g-kpi-period">Période</span>
         </div>
         <div class="g-kpi-value">1234<span class="g-kpi-box-unit">FC</span></div>
       </div>
     </div>

   Règles inviolables :
   1. La valeur (montant) n'est JAMAIS tronquée (pas de text-overflow:ellipsis).
   2. Le label/période est en ligne 1, le montant en ligne 2.
   3. Les cards s'élargissent pour contenir le montant ; si l'espace manque,
      elles wrappent sur une nouvelle ligne (jamais de débordement horizontal).

   Bénéficie aux 9 projets iManage. Une app peut surcharger via son app.css
   (variables --d-* ou règles spécifiques) sans toucher au layout de base.
   ═════════════════════════════════════════════════════════════════ */
.dashboard-v3 .g-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: 20px;
}
.dashboard-v3 .g-kpi-card {
    background: var(--d-surf);
    border: 1px solid var(--d-line);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    transition: box-shadow .12s ease, transform .12s ease;
}
.dashboard-v3 .g-kpi-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Ligne 1 — Label (gauche) + période (droite) */
.dashboard-v3 .g-kpi-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    min-width: 0;
}
.dashboard-v3 .g-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--d-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.dashboard-v3 .g-kpi-period {
    margin-left: auto;
    font-size: 10px;
    color: var(--d-mute);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Ligne 2 — Montant intégral (jamais tronqué) */
.dashboard-v3 .g-kpi-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--d-ink);
    line-height: 1.1;
    white-space: nowrap;
    /* PAS de overflow:hidden / text-overflow:ellipsis : un montant tronqué = bug métier */
}
.dashboard-v3 .g-kpi-box-unit {
    font-size: var(--font-size-base);
    font-weight: 500;
    opacity: 0.6;
    margin-left: 4px;
}
.dashboard-v3 .g-kpi-hint { font-size: 12px; color: var(--d-mute); margin-top: 4px; }

/* Icône optionnelle — affichée seulement si un projet l'ajoute via son template */
.dashboard-v3 .g-kpi-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--d-softer);
    border-radius: 8px;
    color: var(--d-accent);
    font-size: 14px;
    margin-bottom: 8px;
}

/* ═════════════════════════════════════════════════════════════════
   Cards de section — structure canonique
   Structure attendue :
     <section class="g-card">
       <div class="g-card-head">
         <h4>Titre</h4>
         <span class="g-pill-sm">5</span>     (optionnel — compteur)
       </div>
       <!-- contenu (table, liste, etc.) directement -->
     </section>

   Bénéficie aux 9 projets iManage. Backward-compat : .g-card-body reste
   supporté pour les anciens templates qui wrappent leur contenu dedans.
   ═════════════════════════════════════════════════════════════════ */
.dashboard-v3 .g-card {
    background: var(--d-surf);
    border: 1px solid var(--d-line);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
}
.dashboard-v3 .g-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--d-line);
}
.dashboard-v3 .g-card-head h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
    color: var(--d-ink);
}
.dashboard-v3 .g-pill-sm {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: var(--d-softer);
    color: var(--d-mute);
    border: 1px solid var(--d-line);
}

/* Backward-compat : ancien wrapper g-card-body avec padding intégré */
.dashboard-v3 .g-card-body { font-size: var(--font-size-base); padding: 16px; }
.dashboard-v3 .g-card-body .table { margin-bottom: 0; }
.dashboard-v3 .g-card-body .table th {
    font-size: .72rem !important;
    color: var(--d-mute) !important;
    font-weight: 600 !important;
    border-bottom: 1px solid var(--d-line);
    padding: 8px 10px;
}
.dashboard-v3 .g-card-body .table td {
    padding: 8px 10px;
    border-top: 1px solid var(--d-line);
    vertical-align: middle;
}

/* Table compacte dans une g-card (.g-table) */
.dashboard-v3 .g-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-base); }
.dashboard-v3 .g-table thead th {
    padding: 10px 14px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--d-mute);
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--d-line);
}
.dashboard-v3 .g-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--d-line);
    vertical-align: middle;
}
.dashboard-v3 .g-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-v3 .g-table tbody tr:hover { background: var(--d-soft); }

/* État vide dans une g-card */
.dashboard-v3 .g-card-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    color: var(--d-mute);
    font-size: var(--font-size-base);
}
.dashboard-v3 .g-empty-ico {
    width: 32px; height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--d-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Activité / feed */
.dashboard-v3 .g-feed { list-style: none; padding: 0; margin: 0; }
.dashboard-v3 .g-feed-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 8px 0;
    border-bottom: 1px solid var(--d-line);
}
.dashboard-v3 .g-feed-item:last-child { border-bottom: none; }
.dashboard-v3 .g-feed-icon {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--d-softer);
    color: var(--d-accent);
    border-radius: 6px;
    font-size: 12px;
    flex-shrink: 0;
}
.dashboard-v3 .g-feed-main { flex: 1; min-width: 0; }
.dashboard-v3 .g-feed-label {
    font-weight: 500;
    color: var(--d-ink);
    font-size: var(--font-size-base);
}

/* ════════════════════════════════════════════════
   Status — deux patterns distincts
   · .status-box  : carré 32x32 avec abréviation 3 lettres (colonnes compactes)
   · .status-pill : pill icône + texte (lisible en N&B, a11y colorblind)
   La couleur de fond est fournie par les classes .badge-* de l'app.
   ════════════════════════════════════════════════ */
.status-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: .6rem;
    padding: 0;
    text-align: center;
    line-height: 1;
}

/* Pill accessible — icône + libellé. L'icône double le signal de la couleur
   pour les malvoyants et le mode N&B (accessibility guideline 1.4.1). */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    color: #fff;
}
.status-pill > .fa-solid,
.status-pill > .fa-regular {
    font-size: 10px;
}

/* ════════════════════════════════════════════════
   Bootstrap overrides standard iManage
   (les couleurs de marque sont définies dans app.css de chaque projet)
   ════════════════════════════════════════════════ */
.alert {
	border: none;
	border-radius: var(--radius-sm);
	font-weight: 500;
}

.nav-tabs .nav-link {
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-pills .nav-link.active {
	background: var(--accent);
}

.login-brand-logo {
	width: 60%;
	max-width: 160px;
	height: auto;
}

.form-control {
	border-radius: var(--radius-sm);
	border: 1px solid rgba(0, 0, 0, 0.12);
	padding: 8px 12px;
	transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Focus visible au clavier — a11y. Affiche un anneau sur les éléments
   focussés UNIQUEMENT via Tab (pas au clic souris). */
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Retire l'outline par défaut sur clic souris — garde focus-visible au clavier */
:focus:not(:focus-visible) {
	outline: none;
}

.form-select {
	border-radius: var(--radius-sm);
}

/* ── PLAFOND TYPOGRAPHIQUE (nombre d'or) ──────────────────────────────────
   RÈGLE iManage : AUCUN contenu ne dépasse le menu (R = 13px). Bootstrap impose
   1rem (champs/boutons), .875rem (-sm) et 1.25rem (-lg) → on neutralise ici, une
   fois pour toutes, pour TOUS les projets. Le menu (.nav-link) et les titres
   (h1/.h1, --font-size-xl/-title/-display) ne sont volontairement PAS concernés. */
.form-control, .form-select,
.form-control-sm, .form-select-sm,
.form-control-lg, .form-select-lg,
.btn, .btn-sm, .btn-lg,
.input-group-text, .dropdown-item {
	font-size: var(--font-size-base);
}

.table thead th {
	font-weight: 600;
	font-size: .78rem;
	text-transform: capitalize;
	color: var(--text-secondary);
}

.table td {
	vertical-align: top;
	border-color: var(--border);
	padding: 10px 12px;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
	background-color: rgba(0, 0, 0, 0.025);
}

.table-sm td, .table-sm th {
	padding: 6px 10px;
}

div.dataTables_info,
.dataTables_info {
	color: var(--text-secondary) !important;
	font-size: .72rem !important;
}

div.dataTables_length,
div.dataTables_length label,
.dataTables_length,
.dataTables_length label {
	font-size: .72rem !important;
	color: var(--text-secondary) !important;
}

div.dataTables_length select,
.dataTables_length select {
	font-size: .72rem !important;
}

div.dataTables_filter,
div.dataTables_filter label,
.dataTables_filter,
.dataTables_filter label {
	font-size: .72rem !important;
	color: var(--text-secondary) !important;
}

div.dataTables_filter input,
.dataTables_filter input {
	font-size: .78rem !important;
}

.table td .btn,
.table th .btn {
	padding-left: 10px;
	padding-right: 10px;
}

.table td .fa-solid,
.table td .fa-regular {
	padding: 0 4px;
}

strong.detail-link {
	color: var(--accent);
	cursor: pointer;
}

strong.detail-link:hover {
	text-decoration: underline;
}

.content-title {
	font-size: var(--font-size-xl);
	font-weight: 700;
	color: var(--text-primary);
	background: transparent;       /* pas de couleur de fond */
	margin: 16px 0;
	padding: 0;                    /* pas de padding interne */
	border-radius: 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.content-title .content-title-actions {
	margin-left: auto;
}

.content-title small {
	font-weight: 500;
	color: var(--text-secondary);
	margin-left: 10px;
}

/* Convention v3.4.1 (2026-05-21) : titre sans icône, sous-titre sur sa propre ligne.
   Tous les projets doivent utiliser :
       <h3 class="content-title">Titre</h3>
       <p  class="content-subtitle">Sous-titre…</p>
   au lieu de mettre l'icône et le sous-titre dans le <h3>. */
.content-subtitle {
	color: var(--text-secondary);
	font-size: var(--font-size-base);
	font-weight: 400;
	line-height: 1.4;
	margin: 0 0 16px;
}
.content-subtitle:empty { display: none; }
/* Si une icône traîne dans un .content-title (legacy), on la neutralise — la
   convention v3.4.1 interdit les icônes dans les titres de page. */
.content-title .fa-solid, .content-title .fa-regular,
.content-title .fa-brands, .content-title .fa-light { display: none !important; }

/* ════════════════════════════════════════════════════════════════════════
   Convention v3.4.3 (2026-05-21) — Cellules de tableau à 2 lignes
   ────────────────────────────────────────────────────────────────────────
   Pour densifier les list_view sans multiplier les colonnes, on combine
   2 informations dans une même cellule :
       <div class="cell-main">Valeur principale</div>
       <div class="cell-sub">Information secondaire (gris discret)</div>

   Usage typique :
   • Désignation client + code bureau en sous-ligne (au lieu d'une colonne Bureau)
   • Montant consommé + plafond en sous-ligne (au lieu d'une colonne Plafond)
   ════════════════════════════════════════════════════════════════════════ */
.cell-main {
	font-size: var(--font-size-base);
	color: var(--text-primary);
	line-height: 1.3;
}
.cell-sub {
	font-size: 11px;
	color: var(--text-secondary);
	line-height: 1.3;
	margin-top: 2px;
	font-weight: 400;
}
.cell-sub:empty { display: none; }
/* Si la cellule est alignée à droite (align: 'right'), les sous-lignes le sont aussi. */
.table td[class*="text-end"] .cell-main,
.table td[class*="text-end"] .cell-sub { text-align: right; }

#report_nav_links,
#report_form_links {
	margin-left: auto;
	display: flex;
	gap: 2px;
}

#report_nav_links + #report_form_links {
	margin-left: 0;
}

#report_nav_links .nav-link-btn,
#report_form_links .form-link-btn {
	background: none;
	border: none;
	color: var(--accent);
	font-size: .8rem;
	font-weight: 500;
	padding: 2px 8px;
	cursor: pointer;
	text-decoration: none;
}

#report_nav_links .nav-link-btn:hover,
#report_form_links .form-link-btn:hover {
	text-decoration: underline;
	color: var(--accent-hover);
}

/* ---- Action icons (tables standards, hors list_view) ---- */
.record_tools .fa-solid,
.record_tools .fa-regular,
.change_password_command,
.update_data,
.cancel_data {
	padding: 4px 6px;
	margin: 0 2px;
	cursor: pointer;
	color: var(--text-secondary);
	transition: color var(--transition);
}

.record_tools .fa-solid:hover,
.record_tools .fa-regular:hover,
.change_password_command:hover,
.update_data:hover,
.cancel_data:hover {
	color: var(--accent);
}

.form-container {
	max-width: 480px;
	margin: 0 auto;
}

.form-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-bottom: 24px;
}

.report-header {
	text-align: center;
	margin-bottom: 24px;
}

.report-header img {
	width: 180px;
	height: auto;
	margin-bottom: 8px;
}

.report-header .report-subtitle {
	color: var(--accent);
	font-weight: 600;
}

.report-header h3 {
	font-weight: 700;
	margin-top: 16px;
}

.report-header h3 small {
	font-weight: 400;
	color: var(--text-secondary);
}

.report-header .report-date {
	text-align: right;
	color: var(--text-secondary);
}

.report-main-title {
	font-weight: 700;
	margin-top: 16px;
}

.no_display,
input[type="radio"].no_display,
input[type="checkbox"].no_display {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.data_block {
	text-transform: uppercase;
}

.print_change_ticket, .dropdown-menu a {
	cursor: pointer;
}

.number {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.input-group-text {
	padding-left: 20px;
	padding-right: 20px;
}

input[type="number"] {
	text-align: right;
}

/* ════════════════════════════════════════════════
   Empty state — pattern réutilisable
   Usage minimal :
       <div class="empty-state">
           <i class="empty-state-icon fa-regular fa-folder-open"></i>
           <h3 class="empty-state-title">Aucun enregistrement</h3>
           <p class="empty-state-hint">Commencez par ajouter votre premier élément.</p>
           <button class="btn btn-primary btn-sm empty-state-action">
               <i class="fa-solid fa-plus"></i> Nouveau
           </button>
       </div>
   ════════════════════════════════════════════════ */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0 auto;
}
.empty-state-icon {
    font-size: 40px;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 16px;
    display: block;
}
.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.empty-state-hint {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin: 0 0 20px;
    line-height: 1.5;
}
.empty-state-action {
    margin-top: 4px;
}

.btn, .btn-sm { border-radius: 7px; font-weight: 500; transition: background .15s, border-color .15s; }
.btn-sm { padding: 6px 12px; font-size: var(--font-size-base); }
.btn-primary { box-shadow: none; }
.btn-outline-primary:hover { box-shadow: none; }

.btn:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent) !important;
    border-color: var(--accent) !important;
}

/* ════════════════════════════════════════════════
   Respecte prefers-reduced-motion — a11y
   Les utilisateurs avec vestibular disorders ou en mode économie
   de batterie désactivent les animations système. On respecte.
   ════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.ms-bar {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 20px 0 10px;
    overflow-x: auto;
    position: relative;
}
.ms-node {
    flex: 1 1 0;
    min-width: 140px;
    text-align: center;
    position: relative;
    padding: 0 8px;
}

.ms-node::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}
.ms-node:last-child::before { display: none; }

.ms-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00B4D8, #0891b2);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 180, 216, 0.25);
}
.ms-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: #0f172a;
    margin-top: 10px;
    line-height: 1.3;
}
.ms-code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
}
.ms-desc {
    font-size: var(--font-size-sm);
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

.ms-node.ms-done   .ms-circle { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25); }
.ms-node.ms-active .ms-circle { background: linear-gradient(135deg, #00B4D8, #0891b2); }
.ms-node.ms-todo   .ms-circle { background: #e2e8f0; color: #64748b; box-shadow: none; }
.ms-node.ms-done::before   { background: #10B981; }

/* ════════════════════════════════════════════════
   Print — règles canoniques iManage
   Cache le chrome UI, neutralise les positions fixes, formate la page A4.
   Les apps peuvent ajouter leurs règles spécifiques dans leur app.css.
   ════════════════════════════════════════════════ */
@media print {
	.navbar,
	#notification_box,
	#page_header,
	#busy_overlay,
	.print_toolbar,
	.form-actions,
	.record_tools,
	.session_controls,
	.no-print {
		display: none !important;
	}

	body {
		background: #fff !important;
		color: #000 !important;
		padding-top: 0 !important;
		font-size: 9pt !important;
	}

	#page, #page_content {
		position: static !important;
		overflow: visible !important;
		padding: 0 !important;
		margin: 0 !important;
		background: #fff !important;
	}

	#requested_content,
	#requested_content > div {
		background: #fff !important;
		padding: 0 !important;
	}

	table { width: 100%; }
	td { vertical-align: top; }
	a { text-decoration: none !important; color: #000 !important; }

	.card-header { padding: 4px 8px !important; }
	.card-body { padding: 0 !important; }
	h5 { font-size: 11pt !important; }

	.report-header { margin-bottom: 16px; }
	.report-header img { width: 140px; }
	.report-main-title { margin-top: 8px; }

	@page { size: A4 landscape; margin: 15mm; }
}

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVE — exploitation optimale de l'espace horizontal sur tous mobiles
   ════════════════════════════════════════════════════════════════════════ */

/* ─── container-fluid : cap visuel + paddings adaptatifs ─────────────────
   Variable CSS --app-px définit le padding horizontal commun à TOUTES les
   container-fluid de la page (navbar, header, breadcrumb, requested_content)
   pour garantir un alignement parfait entre menu et contenu.
   Bootstrap met par défaut padding-inline 12px sur container-fluid. On
   l'augmente avec la taille de l'écran pour aérer sur grands écrans.
*/
:root {
    --app-px: 12px;
    /* Cap horizontal du contenu — appliqué à navbar, header, breadcrumb et
       requested_content via .container-fluid. 1400px = largeur confortable
       pour tableaux, dashboards et formulaires sans dispersion visuelle sur
       les écrans 4K. Le contenu se centre automatiquement (margin: auto). */
    --app-max-w: 1400px;
}
@media (min-width: 768px)  { :root { --app-px: 20px; } }
@media (min-width: 1200px) { :root { --app-px: 28px; } }
@media (min-width: 1600px) { :root { --app-px: 40px; } }

.container-fluid {
    max-width: var(--app-max-w);
    margin-inline: auto;
    padding-inline: var(--app-px);
}
/* La navbar n'a PAS de padding horizontal — c'est son .container-fluid
   interne qui le porte (alignement parfait avec #requested_content). */
.navbar { padding-inline: 0; }

/* ─── Mobile : navbar plus compact + touch targets ≥ 44px ──────────────── */
@media (max-width: 767.98px) {
    .navbar { padding-block: 8px; padding-inline: 0; }
    .navbar-toggler { padding: 8px 10px; min-width: 44px; min-height: 44px; }
    /* Le user account devient un avatar circulaire seul sur mobile pour
       économiser l'espace — le nom complet et le rôle vont dans le panneau
       qui s'ouvre au clic. */
    @media (max-width: 575.98px) {
        #user .ua-name,
        #user .ua-job,
        #user .ua-clinic { display: none !important; }
        #user .ua-avatar-wrap { margin: 0; }
    }
}

/* ─── Mobile : footer compact, items wrappent proprement ───────────────── */
@media (max-width: 575.98px) {
    #page_footer { padding: 0 8px; height: auto; min-height: 48px; }
    #page_footer .footer-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
        padding: 6px 0;
    }
    #page_footer .footer-brand,
    #page_footer .footer-datetime { flex: 1 1 auto; justify-content: center; }
    body:has(#page_footer) { padding-bottom: 68px; }  /* hauteur réelle augmentée */
}

/* ─── Modal Bootstrap : plein écran sous 576px (login, change-password) ── */
@media (max-width: 575.98px) {
    .modal-dialog:not(.modal-fullscreen) {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }
    .modal-dialog:not(.modal-fullscreen) .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
}

/* ─── Tables responsives — scroll horizontal sur mobile au lieu d'écraser
   Les tableaux Bootstrap (.table) qui ne sont pas dans un wrapper responsive
   obtiennent un scroll horizontal natif sur petits écrans. */
@media (max-width: 767.98px) {
    table.table:not(.table-borderless):not(.table-ticket) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ─── Form panels (record-detail, form-container) : fullscreen mobile ── */
@media (max-width: 575.98px) {
    .form-panel,
    .form-panel.form-panel-xl,
    .form-panel.form-panel-xxl {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    .record-detail {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
    }
}

/* ─── Dashboard sur tablette : KPIs en 2 colonnes au lieu de 1 large ───
   Le grid auto-fit minmax(200px, 1fr) défini dans .g-kpis gère déjà la
   plupart des cas. On force juste un comportement clean entre 576-900px. */
@media (min-width: 576px) and (max-width: 899.98px) {
    .dashboard-v3 .g-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ─── Tile-view : déjà responsive via tile-view.css (1 col mobile,
   2 cols tablette, 3-4 cols desktop). Rien à ajouter ici. */

/* ─── List-view : table compactée sur mobile ─────────────────────────── */
@media (max-width: 575.98px) {
    .lv-actions { flex-wrap: wrap; gap: 8px; }
    .lv-search { flex: 1 1 100%; }
    .lv-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        text-align: center;
    }
    .lv-pager { justify-content: center; }
}

/* ─── Inputs : taille touch confortable sur mobile (≥ 16px évite zoom iOS) */
@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        font-size: 16px;     /* évite le zoom auto sur iOS Safari */
    }
    .btn {
        min-height: 40px;    /* touch target accessibilité */
    }
}


/* ─── Accessibilité — respect du prefers-reduced-motion ──────────────
   Désactive toutes les animations/transitions pour les utilisateurs qui
   l'ont configuré dans leur OS (WCAG 2.1 — 2.3.3 Animation from Interactions).
   À appliquer globalement plutôt que dans chaque composant. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   ENTÊTE DE PAGE — im-page-header
   ------------------------------------------------------------------------
   POURQUOI CE COMPOSANT (recensement du 05/09/2026 sur LEMAI, pris comme
   modèle). L'entête de page — l'élément le plus répété d'une application —
   avait 109 implémentations réparties sur 32 écrans, avec cinq préfixes
   concurrents (lm-, otd-, content-, pd-, dash-). Pire : DEUX systèmes
   coexistaient, et 28 écrans les employaient EN MÊME TEMPS — le
   `h3.content-title` du framework et un `lm-page-header-top` bâti par-dessus.

   CE N'EST PAS UN TROISIÈME SYSTÈME. C'est la réconciliation des deux :
   la structure vient de LEMAI (titres empilés, zone d'actions ordonnée),
   le point d'ancrage reste `.content-title`. Ce nom n'est pas décoratif :
   content.js n'injecte son propre titre QUE s'il n'en trouve pas
   (« si le report a déjà un .content-title, on ne touche pas »). En le
   conservant, le composant cohabite avec le framework au lieu de le
   combattre.

   STRUCTURE CANONIQUE :
     <header class="im-page-header">
       <div class="im-page-header-top">
         <div class="im-page-titles">
           <h3 class="content-title">Titre de la page</h3>
           <p  class="content-subtitle">Sous-titre facultatif</p>
         </div>
         <div class="im-page-actions">
           …sélecteurs (période, entité) puis UN bouton principal…
         </div>
       </div>
     </header>

   ÉCRIT EN MOBILE D'ABORD, ET C'EST DÉLIBÉRÉ. Au moment de la mesure, 36
   des 41 écrans à tableau de LEMAI n'avaient AUCUNE règle responsive : le
   mobile n'était pas imparfait, il était absent. Tant qu'il est une
   surcouche, on l'oublie. Ici les règles de base SONT le mobile ; les deux
   media queries n'ajoutent que ce que l'espace permet en plus. Oublier le
   mobile devient impossible.

   DEUX POINTS DE RUPTURE, PAS DIX-SEPT. 768px et 1200px — ceux que le socle
   emploie déjà. LEMAI en comptait dix-sept, inventés écran par écran.
   ════════════════════════════════════════════════════════════════════════ */

.im-page-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    /* Bloc majeur : ≥ 20px le sépare de ce qui suit (DESIGN.md §2). */
    margin-bottom: var(--spacing-xl);
}

/* MOBILE (défaut) — une colonne. Le titre occupe toute la largeur, les
   actions passent dessous : sur 375px, titre et boutons sur une même ligne
   écrasent l'un ou l'autre. */
.im-page-header-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
}

.im-page-titles { min-width: 0; }

/* Le titre de page est le SEUL texte autorisé à dépasser le menu : 21px,
   soit R × φ (DESIGN.md §1). La marge propre du .content-title est reprise
   par le conteneur — c'est lui qui possède l'espacement, sinon les deux
   s'additionnent. */
.im-page-titles .content-title {
    margin: 0;
    font-size: var(--font-size-xl);
    line-height: 1.25;
}

/* Sous-titre : explicatif, donc petit et gris (DESIGN.md §1). Sa marge basse
   native de 16px est annulée ici, le `gap` du conteneur s'en charge. */
.im-page-titles .content-subtitle {
    margin: var(--spacing-xs) 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ZONE D'ACTIONS — UN SEUL bouton principal, à droite du titre.
   L'ordre n'est pas cosmétique : sur mobile la colonne se lit de haut en
   bas, et le dernier élément est le plus proche du pouce. Le bouton
   principal est donc TOUJOURS en dernier, après les sélecteurs. */
.im-page-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}
.im-page-actions > * { order: 3; }
.im-page-actions > .im-period-host,
.im-page-actions > [data-role="periode"] { order: 1; }
.im-page-actions > .im-entite-host,
.im-page-actions > [data-role="entite"]  { order: 2; }

/* Cible tactile de 40px minimum sur toute action (DESIGN.md §5). Aucune
   action d'entête n'est JAMAIS repliée dans un menu : l'action principale
   d'un écran se fait en un clic, à toutes les tailles.

   Les secondaires se PARTAGENT la ligne, seule la principale la prend
   entière. Constaté en migrant rprt_service_detail (05/09/2026), qui porte
   trois actions : les mettre toutes en pleine largeur empilait trois barres
   avant le contenu et repoussait l'information hors de l'écran. */
.im-page-actions > .btn,
.im-page-actions > .im-cta {
    flex: 1 1 auto;
    min-width: 0;
}

/* CIBLE TACTILE — 40px minimum QUAND LE POINTEUR EST GROSSIER (un doigt).
   DESIGN.md §5 exige 40px ; mesuré le 05/09/2026, les boutons de LEMAI font
   30px (--btn-h), et cette hauteur ne varie jamais.

   On ne conditionne PAS cela à la largeur d'écran : la largeur ne dit rien du
   périphérique. Un portable de 1100px se pilote à la souris, une tablette de
   1024px au doigt. `pointer: coarse` interroge le vrai mode de saisie ; 30px
   restent donc la densité voulue à la souris, et seul le doigt obtient 40px.

   La spécificité est délibérée : app.css impose
   `.btn:not(.btn-xs):not(.btn-link)` (trois classes) et se charge APRÈS le
   socle. Une règle plus faible serait écrasée en silence — c'est exactement
   ce qui est arrivé à la première version de ce composant. */
@media (pointer: coarse) {
    .im-page-header .im-page-actions > .btn:not(.btn-link),
    .im-page-header .im-page-actions > .im-cta {
        min-height: 40px;
    }
}
.im-page-actions > .im-cta,
.im-page-actions > .btn-primary,
.im-page-actions > .btn-outline-primary {
    flex: 1 1 100%;
}

/* ── TABLETTE ET AU-DELÀ (≥ 768px) — l'espace permet une seule rangée ──── */
@media (min-width: 768px) {
    .im-page-header-top {
        flex-direction: row;
        align-items: center;      /* le titre reste centré face aux boutons,
                                     même avec un sous-titre sur deux lignes */
        justify-content: space-between;
        gap: var(--spacing-lg);
        flex-wrap: wrap;
    }
    .im-page-actions { flex-shrink: 0; }
    .im-page-actions > .btn,
    .im-page-actions > .im-cta,
    .im-page-actions > .btn-primary,
    .im-page-actions > .btn-outline-primary { flex: 0 0 auto; }
}

/* ── BUREAU (≥ 1200px) — seule l'aération augmente, rien ne se réorganise.
      Un changement de structure à 1200px surprendrait sans rien apporter. */
@media (min-width: 1200px) {
    .im-page-header { margin-bottom: var(--spacing-2xl); }
    .im-page-header-top { gap: var(--spacing-xl); }
}

/* SOUS-MENU DE PAGE — les onglets se placent SOUS la rangée de titre.
   Il appartient à l'entête (il qualifie la page), pas au contenu. */
.im-page-header > .im-subnav { margin-top: calc(var(--spacing-xs) * -1); }

/* ════════════════════════════════════════════════════════════════════════
   ONGLETS DE CLASSEUR — im-tabs
   ------------------------------------------------------------------------
   Deuxième composant promu au socle (05/09/2026), après im-page-header. Le
   recensement comptait 16 variantes d'onglets sur 4 écrans, avec cinq
   préfixes ; celui-ci les remplace.

   POURQUOI L'ONGLET DE CLASSEUR plutôt qu'un onglet souligné : l'onglet actif
   OCCULTE le filet du conteneur et fusionne avec le panneau qu'il ouvre. C'est
   ce raccord — et lui seul — qui fait lire « dossier ». Un onglet souligné dit
   « lien courant » ; un onglet de classeur dit « voici le contenu attaché ».

   MÉCANIQUE : le conteneur porte un filet bas ; chaque onglet descend d'un
   pixel pour venir à cheval dessus ; l'onglet actif reprend le fond du panneau,
   ce qui efface le filet sous lui.

   SUR FOND SOMBRE, ajouter `im-tabs--sombre` au conteneur. Ce n'est pas un
   raffinement : le style clair posé sur une carte sombre rend le texte
   illisible, et le raccord ne se voit plus. Le variant reprend des blancs
   translucides et laisse l'onglet actif montrer le fond de la carte.

   ACCESSIBILITÉ : role="tablist" / role="tab" / aria-selected sur le balisage,
   focus visible par --shadow-focus, cible tactile portée à 40px au doigt.
   ════════════════════════════════════════════════════════════════════════ */

.im-tabs {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.im-tab {
    appearance: none;
    margin-bottom: -1px;                 /* à cheval sur le filet du conteneur */
    padding: var(--spacing-sm) var(--spacing-md);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.im-tab:hover { background: var(--bg-surface); color: var(--text-primary); }
.im-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* L'onglet ouvert : fond du panneau, et son bord bas se fond dedans. */
.im-tab.is-active {
    background: var(--bg-content);
    border-bottom-color: var(--bg-content);
    color: var(--text-primary);
    font-weight: 600;
}

/* Fente d'actions sur la rangée d'onglets : sélecteurs et filtres se rangent à
   DROITE, sur la même ligne que les onglets. Ils cadrent ce que les panneaux
   montrent — les mettre ailleurs obligerait à remonter les chercher.
   `align-self: center` et non `flex-end` : les onglets s'alignent par le bas
   pour que leur raccord tombe sur le filet, un contrôle aligné de même
   paraîtrait tomber dans le vide. */
.im-tabs-actions {
    margin-left: auto;
    align-self: center;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
}

.im-tabpane { display: none; }
.im-tabpane.is-active { display: block; }

/* ── Variante fond sombre ─────────────────────────────────────────────── */
.im-tabs--sombre { border-bottom-color: var(--voile-clair-fort); }
.im-tabs--sombre .im-tab {
    background: var(--voile-clair);
    border-color: var(--voile-clair-fort);
    color: color-mix(in srgb, var(--text-on-dark) 72%, transparent);
}
.im-tabs--sombre .im-tab:hover { background: var(--voile-clair-vif); color: var(--text-on-dark); }
/* Sur fond sombre l'onglet actif laisse voir la carte : `transparent` suffirait
   à montrer le fond, mais laisserait AUSSI passer le filet du conteneur et
   casserait le raccord. D'où la couleur pleine, héritée par variable. */
.im-tabs--sombre .im-tab.is-active {
    background: var(--im-tabs-fond, transparent);
    border-bottom-color: var(--im-tabs-fond, transparent);
    color: var(--text-on-dark);
}

/* Cible tactile : 40px au DOIGT seulement — la largeur d'écran ne dit rien du
   mode de saisie, le pointeur si (même règle que im-page-header). */
@media (pointer: coarse) {
    .im-tabs .im-tab { min-height: 40px; }
}
