/* =========================================
   AGORITY — Design System (SaaS B2B / Cyber GRC)
   Édité par HM IT Consulting.
   Identité : Vert Émeraude (#26B27F) + Gris Anthracite (#30363C).
   Refonte « dashboard » 2026-06-19 : sidebar claire + top bar + cartes/graphes
   (alignée sur la maquette de référence). Aucune logique JS modifiée.

   TYPOGRAPHIE — 100 % locale (aucun CDN au runtime, cf. CLAUDE.md règles 1 & 2).
   Priorité à Inter si installée localement, sinon pile système (Segoe UI sous Windows).

   RÈGLE : toutes les couleurs sont des variables CSS (jamais de couleur en dur ici).
   ========================================= */
:root {
    /* ===== Palette de marque Agority ===== */
    --brand-emerald: #26B27F;        /* Émeraude vif : logo, accents, état actif */
    --brand-emerald-soft: #5AC79B;   /* Émeraude clair (barres secondaires) */
    --brand-emerald-tint: #E9F7F1;   /* Vert très clair : item de menu actif, badges doux (maquette) */
    --anthracite: #30363C;           /* Gris anthracite : titres, texte fort, barres */

    /* ===== Fonds & surfaces ===== */
    --bg-body: #F4F6F8;              /* Gris froid très clair (met les cartes en valeur) */
    --bg-card: #FFFFFF;              /* Surfaces : cartes, modales, panneaux */
    --bg-subtle: #F7F9FB;            /* Fonds d'input / zones au repos */

    /* ===== Texte ===== */
    --primary: #30363C;             /* Titres (h1–h4) — anthracite */
    --text-main: #30363C;           /* Texte courant fort */
    --text-muted: #64748B;          /* Gris ardoise (texte secondaire) */
    --text-soft: #94A3B8;           /* Gris clair (libellés discrets) */

    /* ===== Sidebar claire ===== */
    --sidebar-bg: #FFFFFF;
    --sidebar-nav: #5A6573;          /* Texte des items de nav au repos */
    --sidebar-nav-hover: var(--anthracite);
    --sidebar-hover-bg: #F1F5F9;
    --sidebar-active-bg: var(--brand-emerald-tint);
    --sidebar-active-text: #0B6346;

    /* ===== Accent / actions (émeraude profond — AA sur blanc ET blanc sur lui) ===== */
    --accent: #0E7A57;              /* Boutons primaires + texte interactif (≈5.3:1) */
    --accent-hover: #0B6346;
    --accent-strong: #095338;
    --accent-light: var(--brand-emerald-tint);  /* Teinte de fond (vert très clair, maquette) */
    --accent-ring: rgba(38, 178, 127, 0.32);   /* Anneau de focus */

    /* ===== Bordures & séparateurs ===== */
    --border: #E2E8F0;              /* Gris clair subtil (STYLE.md) */
    --border-strong: #CBD5E1;

    /* ===== Statuts sémantiques (CLAUDE.md : vert/orange/rouge/gris) ===== */
    --color-success: #1A9E70;       /* vert = conforme / maîtrisé */
    --color-success-ink: #0B6E4B;
    --color-warning: #E08A1E;       /* orange = partiel */
    --color-warning-ink: #92590A;
    --color-danger: #DC3A52;        /* rouge = critique / non conforme */
    --color-danger-ink: #A31E32;
    --color-info: #2F77C9;          /* bleu = information neutre */
    --color-gray: #94A3B8;          /* gris = non applicable */

    /* Fonds clairs sémantiques (badges, encarts, vues d'impression) — complètent chaque triade couleur/ink/bg */
    --color-success-bg: #E6F4EE;
    --color-warning-bg: #FBEFDD;
    --color-danger-bg:  #FBE7EA;
    --color-info-bg:    #E7F0FB;
    --color-gray-bg:    #EEF1F5;
    --scrim: rgba(16, 24, 40, 0.5);  /* voile de modale (neutre, non décoratif) */

    /* ===== Niveaux de risque (EBIOS) ===== */
    --risk-low: #1A9E70;
    --risk-medium: #E08A1E;
    --risk-high: #EA6A1E;
    --risk-critical: #DC3A52;

    /* ===== Géométrie & effets ===== */
    --sidebar-width: 264px;
    --topbar-h: 64px;
    --reminder-h: 46px;             /* bandeau de rappel de sauvegarde (it. 4) */
    --shadow-soft: 0 4px 6px -1px rgba(16, 24, 40, 0.05), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
    --shadow-hover: 0 12px 24px -8px rgba(16, 24, 40, 0.12);
    --radius-card: 12px;            /* cartes du dashboard (coins doux, façon maquette) */
    --radius: 8px;                  /* alias générique (réf. modules) */
    --radius-btn: 8px;
    --radius-sm: 6px;               /* inputs & petits éléments */
    --radius-pill: 999px;           /* badges/pastilles */
    --transition: all 0.2s ease;
}

/* =========================================
   RESET & BASE
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}
h1 { font-size: 1.6rem; line-height: 1.25; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

ul { list-style: none; }
a { text-decoration: none; color: inherit; }

/* Accessibilité : focus clavier toujours visible (cf. CLAUDE.md qualité de base) */
:focus-visible {
    outline: 2px solid var(--brand-emerald);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Accessibilité (AUDIT M9) : #app reçoit le focus par programmation à chaque
   changement de route (cf. router.js) pour que le clavier / lecteur d'écran
   reparte du nouveau contenu. Ce focus n'étant jamais déclenché au clavier sur
   le conteneur lui-même, aucun contour ne doit s'afficher autour de la zone. */
#app:focus { outline: none; }

/* =========================================
   SIDEBAR (claire, façon maquette)
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-nav);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    border-right: 1px solid var(--border);
}

/* Header sidebar = logo Agority en haut à gauche (hauteur alignée sur la top bar) */
.sidebar-header {
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: center;   /* logo centré horizontalement (façon maquette) */
    padding: 0.85rem 1.25rem;  /* respiration autour du logo (hauteur auto, non coincée à 64px) */
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand { display: inline-flex; align-items: center; transition: var(--transition); }
.brand:hover { opacity: 0.85; }

.brand-logo {
    height: 64px;   /* logo plein format (était 34px → 42px → 48px) */
    width: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
}

/* Menu de navigation (zone scrollable) */
.main-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem 1rem;
}

.main-nav::-webkit-scrollbar { width: 6px; }
.main-nav::-webkit-scrollbar-track { background: transparent; }
.main-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
.main-nav::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

.sidebar-divider {
    margin: 1.1rem 0 0.4rem 0;
    font-size: 0.66rem;
    text-transform: uppercase;
    color: var(--text-soft);
    font-weight: 700;
    letter-spacing: 0.07em;
    padding-left: 0.85rem;
}

.main-nav li { margin-bottom: 2px; }

.main-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.625rem 0.9rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sidebar-nav);
    border-left: 3px solid transparent;
}

/* Icônes de navigation (SVG « line », couleur pilotée par currentColor) */
.nav-ico {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke-width: 1.85;
    color: var(--text-soft);
    transition: var(--transition);
}

.main-nav a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-nav-hover);
}
.main-nav a:hover .nav-ico { color: var(--sidebar-nav-hover); }

.main-nav a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left-color: var(--brand-emerald);
}
.main-nav a.active .nav-ico { color: var(--brand-emerald); }

/* Footer sidebar : mention éditeur (CLAUDE.md règle 3 — à préserver) + version */
.sidebar-footer {
    flex-shrink: 0;
    padding: 1rem 1.25rem 1.15rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.local-chip {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: var(--radius-pill);
}
.local-chip svg { width: 12px; height: 12px; flex-shrink: 0; }

.company-brand { font-size: 0.74rem; color: var(--text-muted); }
.company-brand a {
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px dotted var(--border-strong);
    transition: var(--transition);
}
.company-brand a:hover { color: var(--accent); border-bottom-color: var(--brand-emerald); }

.version-badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 2px 9px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--text-muted);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    letter-spacing: 0.04em;
}

/* =========================================
   TOP BAR (barre supérieure fixe, façon maquette)
   ========================================= */
.app-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.75rem;
    z-index: 150;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.topbar-spacer { flex: 1; }

/* Titre de la page courante → FIL D'ARIANE (it. 41) — rendu par updateActiveNav
   (Section › Page, ou Section › Page cliquable › Détail sur les fiches). */
.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--anthracite);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title .bc-sec { font-weight: 500; font-size: 0.92rem; color: var(--text-muted); }
.topbar-title .bc-sep { margin: 0 7px; color: var(--text-soft); font-weight: 400; }
.topbar-title .bc-link { color: var(--text-muted); font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.topbar-title .bc-link:hover, .topbar-title .bc-link:focus-visible { color: var(--accent); text-decoration: underline; }
.topbar-title .bc-page { color: var(--anthracite); }

.topbar-actions { display: flex; align-items: center; gap: 0.85rem; }

/* Bouton hamburger (visible en mobile uniquement) */
.topbar-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.topbar-menu span { display: block; width: 18px; height: 2px; margin: 0 auto; background: var(--anthracite); border-radius: 2px; }

/* Chip de confiance (gauche de la top bar) : rappelle la promesse « données locales » */
.trust-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: var(--radius-pill);
}
.trust-chip svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Icône ronde (paramètres) */
.topbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    transition: var(--transition);
}
.topbar-icon svg { width: 18px; height: 18px; }
.topbar-icon:hover { color: var(--anthracite); background: var(--bg-subtle); border-color: var(--border-strong); }

/* CTA principal de la top bar (vert émeraude, texte blanc) */
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0.55rem 1.1rem;
    background: var(--accent);
    color: #FFFFFF;
    font-weight: 600;
    font-size: 0.88rem;
    border-radius: var(--radius-btn);
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.btn-cta:hover { background: var(--accent-hover); }
.btn-cta svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Sélecteur de périmètre (workspace switcher) — injecté par app.js */
.context-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}
.context-pill .context-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
}
.context-select {
    max-width: 220px;
    padding: 5px 10px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}
.context-select:focus { border-color: var(--brand-emerald); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Sélecteur de langue (préférence UI locale) — injecté par app.js, façon pilule discrète */
.lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}
.lang-pill .lang-ico { width: 15px; height: 15px; color: var(--text-soft); flex-shrink: 0; }
.lang-select {
    padding: 4px 6px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}
.lang-select:focus { border-color: var(--brand-emerald); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Voile mobile */
.sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* =========================================
   CONTENU PRINCIPAL
   ========================================= */
.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-h) + 2.25rem) 2.75rem 2.75rem;
    min-height: 100vh;
}

.page {
    animation: fadeIn 0.35s ease-out;
    max-width: 1480px;
    margin: 0 auto;
}

/* =========================================
   BANDEAU DE RAPPEL DE SAUVEGARDE (it. 4 — non intrusif)
   Bandeau fin sous la top bar ; le contenu se décale quand il est visible.
   ========================================= */
.backup-reminder {
    position: fixed;
    top: var(--topbar-h);
    left: var(--sidebar-width);
    right: 0;
    min-height: var(--reminder-h);
    z-index: 140;                      /* sous la top bar (150) */
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.75rem;
    background: rgba(224, 138, 30, 0.12);
    border-bottom: 1px solid rgba(224, 138, 30, 0.32);
    color: var(--color-warning-ink);
    font-size: 0.85rem;
    font-weight: 600;
}
.backup-reminder[hidden] { display: none; }
/* Taille de base de l'icône de bandeau, où qu'elle soit utilisée (bandeau calendrier
   du tableau de bord inclus) — un SVG sans dimension s'étire sur toute la carte. */
.reminder-ico { width: 17px; height: 17px; flex-shrink: 0; }
.backup-reminder .reminder-ico { width: 17px; height: 17px; flex-shrink: 0; color: var(--color-warning); }
.backup-reminder .reminder-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-reminder .reminder-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.backup-reminder .reminder-cta:hover { background: var(--accent-hover); }
.backup-reminder .reminder-cta svg { width: 14px; height: 14px; }
.backup-reminder .reminder-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-warning-ink);
    cursor: pointer;
}
.backup-reminder .reminder-close:hover { background: rgba(224, 138, 30, 0.18); }
.backup-reminder .reminder-close svg { width: 16px; height: 16px; }

/* Quand le bandeau est visible, on décale le contenu sous lui. */
body.has-backup-reminder .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 2.25rem); }

/* Bandeau critique « stockage saturé » (it. 28) — déclinaison danger du rappel.
   Prime sur le rappel d'export : les deux partagent le même emplacement fixe. */
.quota-banner {
    position: fixed;
    top: var(--topbar-h);
    left: var(--sidebar-width);
    right: 0;
    min-height: var(--reminder-h);
    z-index: 141;                      /* au-dessus du rappel (140), sous la top bar (150) */
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.75rem;
    background: var(--color-danger-bg);
    border-bottom: 1px solid var(--color-danger);
    color: var(--color-danger-ink);
    font-size: 0.85rem;
    font-weight: 600;
}
.quota-banner[hidden] { display: none; }
.quota-banner .reminder-ico { width: 17px; height: 17px; flex-shrink: 0; color: var(--color-danger); }
.quota-banner .reminder-text { flex: 1; min-width: 0; }
.quota-banner .reminder-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--color-danger);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.quota-banner .reminder-cta:hover { filter: brightness(0.92); }
.quota-banner .reminder-cta svg { width: 14px; height: 14px; }
.quota-banner .reminder-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-danger-ink);
    cursor: pointer;
}
.quota-banner .reminder-close:hover { background: var(--color-danger-bg); filter: brightness(0.95); }
.quota-banner .reminder-close svg { width: 16px; height: 16px; }
/* Décale le contenu et masque le rappel d'export tant que l'alerte est visible. */
body.has-quota-banner .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 2.25rem); }
body.has-quota-banner .backup-reminder { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.dashboard-header h1 { margin-bottom: 0.25rem; }
.dashboard-header .subtitle { color: var(--text-muted); font-size: 0.92rem; }
.dashboard-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* =========================================
   CARTES
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.dashboard-card:hover { box-shadow: var(--shadow-hover); }

.wide-card { grid-column: 1 / -1; }
.alert-card { border-top: 3px solid var(--color-danger); }

/* En-tête de carte (titre + libellé discret type maquette) */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.card-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.card-tag { font-size: 0.72rem; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; }

/* =========================================
   DASHBOARD — disposition en 3 colonnes (façon maquette)
   ========================================= */
.dash-columns {
    display: grid;
    grid-template-columns: 1.05fr 1.25fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 1.5rem; }

/* ----- Donut / anneau de conformité (SVG) ----- */
.ring-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0.5rem auto 1.25rem;
}
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.ring-pct { font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -0.02em; }
.ring-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.donut-legend { display: flex; flex-direction: column; gap: 0.55rem; }
.legend-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.86rem; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend-row .legend-name { color: var(--text-muted); }
.legend-row .legend-val { margin-left: auto; font-weight: 700; color: var(--text-main); }

/* ----- Grille de mini-KPI ----- */
.mini-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.25rem;
    text-align: center;
}
.mini-kpi-grid > div { display: flex; flex-direction: column; gap: 2px; }
.mini-kpi-grid strong { font-size: 1.45rem; font-weight: 800; color: var(--primary); line-height: 1; }
.mini-kpi-grid span { font-size: 0.72rem; color: var(--text-muted); line-height: 1.25; }

/* ----- Barres verticales (façon « Security Trend ») ----- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    height: 210px;
    padding-top: 0.5rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; min-width: 0; }
.bar-track {
    flex: 1;
    width: 100%;
    max-width: 46px;
    display: flex;
    align-items: flex-end;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.bar-fill {
    width: 100%;
    background: var(--brand-emerald);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 0.9s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 4px;
}
.bar-fill.is-ink { background: var(--anthracite); }
.bar-fill.is-warning { background: var(--color-warning); }
.bar-fill.is-danger { background: var(--color-danger); }
.bar-val { font-size: 0.82rem; font-weight: 700; color: var(--text-main); }
.bar-label { font-size: 0.72rem; color: var(--text-muted); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Liste « Dernières menaces » ----- */
.menace-list { display: flex; flex-direction: column; }
.menace-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}
.menace-row:last-child { border-bottom: none; }
.menace-row:hover { background: var(--bg-subtle); }
.menace-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-pill {
    flex-shrink: 0;
    padding: 3px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    color: #fff;
}

/* ----- Carte réseau « Asset Discovery » (SVG radial, données réelles) ----- */

/* ----- Tuiles statistiques (inventaire) ----- */
.stat-tiles { display: flex; gap: 0.85rem; }
.stat-tile {
    flex: 1;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1rem;
    text-align: center;
}
.stat-tile .stat-num { font-size: 1.85rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-tile.is-danger .stat-num { color: var(--color-danger); }
.stat-tile .stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 6px; }

/* Tuiles à valeur TEXTE + jauge d'espace (carte « État du stockage » — it. 28) */
.stat-tiles--wrap { flex-wrap: wrap; }
.stat-tiles--wrap .stat-tile { flex: 1 1 150px; }
.stat-tile .stat-text { font-size: 1rem; font-weight: 700; color: var(--text-main); margin-top: 6px; word-break: break-word; }
.storage-gauge { height: 10px; border-radius: var(--radius-pill); background: var(--bg-body); border: 1px solid var(--border); overflow: hidden; margin-top: 14px; }
.storage-gauge-fill { height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.storage-gauge-fill.is-warn { background: var(--color-warning); }
.storage-gauge-fill.is-danger { background: var(--color-danger); }
.storage-gauge-caption { font-size: 0.8rem; color: var(--text-muted); margin: 6px 0 0; }

/* ----- Tendances (it. 19) : tuiles à mini-courbes (historique auto quotidien) ----- */
.trend-card { margin-bottom: 1.5rem; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.85rem; }
.trend-tile {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 0.75rem 0.9rem;
    min-width: 0;
}
.trend-tile-lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.trend-tile-val { font-size: 1.5rem; font-weight: 800; color: var(--text-main); line-height: 1.25; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.trend-tile-val small { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.trend-delta { font-size: 0.78rem; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.trend-delta.is-good { color: var(--color-success-ink); }
.trend-delta.is-bad { color: var(--color-danger-ink); }
.trend-delta.is-flat { color: var(--text-muted); }
.trend-spark { width: 100%; height: 44px; display: block; }
.trend-empty { font-size: 0.75rem; color: var(--text-muted); }
.trend-hint { font-size: 0.78rem; color: var(--text-muted); margin: 0.6rem 0 0; }

/* ----- Suivi & échéances (it. 19) : listes cliquables incidents / revues doc ----- */
.suivi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-item { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.watch-item:last-child { border-bottom: none; }
.watch-item:hover { background: var(--bg-subtle); }
.wi-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.wi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wi-title { font-weight: 600; color: var(--text-main); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wi-meta { font-size: 0.75rem; color: var(--text-muted); }
.watch-item .notif-chip { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 900px) { .suivi-grid { grid-template-columns: 1fr; } }

/* ----- Coffre (it. 21) : écran de verrouillage plein écran ----- */
.lock-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000; /* au-dessus des modales et des toasts : rien ne doit passer devant */
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.lock-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    padding: 2.2rem 2.4rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.lock-logo { width: 160px; max-width: 70%; height: auto; display: block; margin: 0 auto 1.2rem; }
.lock-title { font-size: 1.35rem; color: var(--text-main); margin-bottom: 6px; }
.lock-sub { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; margin-bottom: 1.2rem; }
.lock-input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-btn);
    font-size: 1rem;
    margin-bottom: 8px;
}
.lock-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.lock-error { color: var(--color-danger-ink); font-size: 0.85rem; min-height: 20px; margin-bottom: 8px; }
.lock-btn {
    background: var(--accent);
    color: #fff;
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 1rem;
}
.lock-hint { color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; margin-top: 1.1rem; }
.lock-foot { color: var(--text-muted); font-size: 0.75rem; margin-top: 1.2rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.lock-foot a { color: var(--accent); }

/* ----- État vide (invite à l'action, jamais de données fictives) ----- */
.empty-state { text-align: center; padding: 1.75rem 1rem; color: var(--text-muted); }
.empty-state .empty-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 0.7rem;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-soft);
}
.empty-state .empty-ico svg { width: 22px; height: 22px; }
.empty-state p { font-size: 0.88rem; margin-bottom: 0.9rem; }

/* Lien-bouton « fantôme » (actions secondaires des cartes) */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.95rem;
    background: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-ghost:hover { background: var(--bg-subtle); border-color: var(--accent); }

/* =========================================
   COMPONENTS (PROGRESS, BUTTONS)
   ========================================= */
.dashboard-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.4rem 0;
    line-height: 1.1;
}

.progress-bar {
    background: var(--border);
    height: 8px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin: 1.1rem 0;
}
.progress-bar.small { height: 6px; }

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.success { background: var(--color-success); }

/* Boutons — primaire émeraude par défaut ; secondaire/cancel en contour */
button {
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--accent);
    color: #FFFFFF;
}

button:hover { background-color: var(--accent-hover); }
button:active { transform: scale(0.98); }

/* SVG dans les boutons (icônes d'action : enregistrer, supprimer, importer…) */
button svg, .btn-ghost svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Bouton-icône nu (ex. supprimer une ligne) : pas de fond, hérite de la couleur */
button.icon-only { background: none; padding: 6px; color: var(--color-danger); }
button.icon-only:hover { background: rgba(220, 58, 82, 0.10); }

button#save, button#addExigenceBtn, button#addRisqueBtn, button#addActionBtn, button#saveAction {
    background-color: var(--accent);
    color: #FFFFFF;
}
button#save:hover, button#addExigenceBtn:hover { background-color: var(--accent-hover); }

/* Bouton secondaire : transparent, contour anthracite (STYLE.md) */
button#cancel {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}
button#cancel:hover { background-color: var(--bg-subtle); border-color: var(--text-muted); }

button#exportExcelBtn { background-color: var(--color-success); color: white; }
button#exportPdfBtn { background-color: var(--color-danger); color: white; }

/* =========================================
   TABLES & DATA
   ========================================= */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-top: 1.5rem;
    border: 1px solid var(--border);
}

.data-table th, .data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }

.data-table th {
    background: var(--bg-subtle);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clickable-row:hover { background-color: var(--bg-subtle); cursor: pointer; }

/* Tableau compact intégré dans une carte (façon maquette) */
.card-table { width: 100%; border-collapse: collapse; }
.card-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    font-weight: 700;
    padding: 0 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.card-table td { padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.card-table tr:last-child td { border-bottom: none; }
.card-table .clickable-row:hover { background: var(--bg-subtle); }

/* Status Badges (pastilles) */
.status {
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
    display: inline-block;
}

.status-conforme { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.status-partiellement-conforme { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-non-conforme { background: rgba(220, 58, 82, 0.14); color: var(--color-danger-ink); }
.status-non-applicable { background: #EEF2F6; color: var(--text-muted); }

/* Statut d'implémentation des mesures de sécurité (it. 6) — mêmes codes sémantiques */
.status-mesure-implementee { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.status-mesure-partielle { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-mesure-non-implementee { background: rgba(220, 58, 82, 0.14); color: var(--color-danger-ink); }
.status-mesure-non-applicable { background: #EEF2F6; color: var(--text-muted); }

/* Incidents (it. 7) — gravité : gris / orange / rouge (le vert reste réservé au « maîtrisé »).
   Cycle de vie : nouveau (rouge) → en cours (orange) → résolu (vert) → clôturé (gris). */
.status-incident-gravite-mineur { background: #EEF2F6; color: var(--text-muted); }
.status-incident-gravite-majeur { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-incident-gravite-critique { background: rgba(220, 58, 82, 0.14); color: var(--color-danger-ink); }
.status-incident-nouveau { background: rgba(220, 58, 82, 0.14); color: var(--color-danger-ink); }
.status-incident-encours { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-incident-resolu { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.status-incident-cloture { background: #EEF2F6; color: var(--text-muted); }

/* Documents (it. 8) — cycle de vie : brouillon (gris) → en relecture (orange)
   → en vigueur (vert, état « maîtrisé ») → obsolète (gris barré). */
.status-doc-brouillon { background: #EEF2F6; color: var(--text-muted); }
.status-doc-relecture { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-doc-vigueur { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.status-doc-obsolete { background: #EEF2F6; color: var(--text-muted); text-decoration: line-through; }

/* Traitements RGPD (it. 9) — cycle de vie : actif (vert, « maîtrisé ») → en projet (orange)
   → suspendu (gris) → archivé (gris barré). */
.status-rgpd-actif { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.status-rgpd-projet { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.status-rgpd-suspendu { background: #EEF2F6; color: var(--text-muted); }
.status-rgpd-archive { background: #EEF2F6; color: var(--text-muted); text-decoration: line-through; }

/* Pastille sémantique « secured / neutral » réutilisable */
.dot-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; }
.dot-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-gray); }
.dot-pill.ok { color: var(--color-success-ink); }
.dot-pill.ok::before { background: var(--color-success); }
.dot-pill.warn { color: var(--color-warning-ink); }
.dot-pill.warn::before { background: var(--color-warning); }
.dot-pill.bad { color: var(--color-danger-ink); }
.dot-pill.bad::before { background: var(--color-danger); }

/* Pastille générique réutilisée par les modules */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
}

/* =========================================
   LIAISON n-n (cases à cocher) & TAGS RÉFÉRENTIELS (it. 6)
   ========================================= */
.checkbox-group { display: flex; flex-direction: column; gap: 4px; }
.checkbox-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.86rem;
    cursor: pointer;
}
.checkbox-line:hover { border-color: var(--accent); background: var(--bg-subtle); }
.checkbox-line .cl-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.checkbox-line .cl-main strong { white-space: nowrap; }
.checkbox-line input[type="checkbox"] { flex-shrink: 0; }

/* Éditeur de référentiels (lignes dynamiques : référentiel + clause) */
.ref-editor { margin-top: 6px; }
.ref-item { margin-bottom: 10px; }
.ref-row { display: flex; gap: 8px; align-items: center; }
.ref-row .ref-source { flex: 0 0 165px; }
.ref-row .ref-clause { flex: 1 1 auto; min-width: 0; }
.ref-row .ref-remove { flex-shrink: 0; }
/* Indice « titre de clause reconnu » sous une ligne (autocomplétion, it. 6c) */
.ref-hint { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 0 4px; }
.ref-hint-ok { color: var(--color-success-ink); font-weight: 700; }

/* Tags référentiels en lecture seule (listes/synthèses) */
.ref-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-light);
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 700;
}
.ref-tag-clause {
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0 6px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

/* =========================================
   COUVERTURE CROISÉE (it. 6b) — référentiel × mesures, trous de couverture
   ========================================= */
.cov-table-scroll { overflow-x: auto; }
.cov-bar {
    display: flex;
    height: 12px;
    width: 100%;
    min-width: 120px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--border);
}
.cov-bar-empty { background: var(--border); }
.cov-seg { display: block; height: 100%; }
.cov-seg.is-ok { background: var(--color-success); }
.cov-seg.is-warn { background: var(--color-warning); }
.cov-seg.is-bad { background: var(--color-danger); }
.cov-seg.is-na { background: var(--color-gray); }

.cov-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.78rem; color: var(--text-muted); margin-top: 12px; }
.cov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cov-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cov-legend i.is-ok { background: var(--color-success); }
.cov-legend i.is-warn { background: var(--color-warning); }
.cov-legend i.is-bad { background: var(--color-danger); }
.cov-legend i.is-na { background: var(--color-gray); }

.cov-gap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.cov-gap-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 280px; overflow-y: auto; }
.cov-gap-list li {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    margin-bottom: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.cov-gap-list li.cov-link { cursor: pointer; transition: var(--transition); }
.cov-gap-list li.cov-link:hover { background: var(--accent-light); }
.cov-origin { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.cov-ok { color: var(--color-success-ink); font-size: 0.85rem; font-weight: 600; margin-top: 10px; }
.cov-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* =========================================
   CATALOGUES DE RÉFÉRENTIELS (it. 6c) — page de référence #/referentiels
   ========================================= */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cat-tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cat-tab:hover { border-color: var(--accent); }
.cat-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-tab-count {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: var(--radius-pill);
}
.cat-tab.is-active .cat-tab-count { background: rgba(255, 255, 255, 0.22); color: #fff; }
.cat-source {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px;
}
.cat-table td { vertical-align: top; }

/* =========================================
   REGISTRE DES INCIDENTS (it. 7) — puces de notification, volets, échéances
   ========================================= */
/* Puce d'état d'une obligation de notification (liste + panneau des délais). */
.notif-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}
.notif-chip.is-ok { background: rgba(26, 158, 112, 0.14); color: var(--color-success-ink); }
.notif-chip.is-warn { background: rgba(224, 138, 30, 0.16); color: var(--color-warning-ink); }
.notif-chip.is-bad { background: rgba(220, 58, 82, 0.14); color: var(--color-danger-ink); }
.notif-chip.is-info { background: var(--color-info-bg); color: var(--color-info); }
.notif-chip.is-na { background: var(--bg-subtle); color: var(--text-muted); }

/* Texte relatif « dans 2 j » / « dépassé de 3 h » accolé à une puce. */
.dl-rel { font-size: 0.74rem; color: var(--text-muted); }

/* Volet de notification repliable (RGPD/CNIL, NIS2). */
.notif-volet { margin-bottom: 12px; }
.notif-volet .notif-body {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

/* =========================================
   NOTES PÉDAGOGIQUES (composant réutilisable ⓘ)
   ========================================= */
.synthese-message {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.55;
}
.synthese-message.info { border-left-color: var(--color-info); background: rgba(47, 119, 201, 0.06); }
.synthese-message.success { border-left-color: var(--color-success); background: rgba(26, 158, 112, 0.07); }
.synthese-message.warning { border-left-color: var(--color-warning); background: rgba(224, 138, 30, 0.08); }
.synthese-message.danger, .synthese-message.error { border-left-color: var(--color-danger); background: rgba(220, 58, 82, 0.07); }

/* ----- Pastille d'information « ⓘ » (inline, réutilisable) -----
   Révèle une note pédagogique au survol ET au focus clavier. Accessible
   (focusable + aria-label porté par window.infoTip), sûre (contenu échappé).
   Voir CLAUDE.md « Pédagogie systématique ». */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 0.3em;
    color: var(--color-info);
    cursor: help;
    border-radius: var(--radius-pill);
    outline: none;
}
.info-tip__icon { display: block; }
.info-tip:hover, .info-tip:focus-visible { color: var(--accent); }
.info-tip:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.info-tip__bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 50;
    width: max-content;
    max-width: min(260px, calc(100vw - 24px));
    padding: 0.6rem 0.75rem;
    background: var(--anthracite);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    letter-spacing: 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    /* Masquée = retirée de la géométrie (display) : une bulle proche du bord
       droit ne gonflerait sinon le scrollWidth de la page, même invisible
       (débordement horizontal en mobile). */
    display: none;
    /* --tip-shift : recadrage dans le viewport posé par utils.js quand la
       pastille est près d'un bord ; la flèche (::after) est compensée d'autant. */
    transform: translate(calc(-50% + var(--tip-shift, 0px)), 0);
}
.info-tip__bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(50% - var(--tip-shift, 0px));
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--anthracite);
}
.info-tip--bottom .info-tip__bubble { bottom: auto; top: calc(100% + 8px); --tip-rise: -4px; }
.info-tip--bottom .info-tip__bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--anthracite); }
.info-tip:hover .info-tip__bubble,
.info-tip:focus .info-tip__bubble,
.info-tip:focus-visible .info-tip__bubble {
    display: block;
    animation: info-tip-in 0.15s ease;
}
@keyframes info-tip-in {
    from { opacity: 0; transform: translate(calc(-50% + var(--tip-shift, 0px)), var(--tip-rise, 4px)); }
}
@media (prefers-reduced-motion: reduce) {
    .info-tip__bubble { animation: none; }
}
@media print {
    .info-tip { display: none !important; }  /* note interactive : sans objet à l'impression */
}

/* Puce colorée pour les listes d'arbitrages (Synthèse Direction) */
.synth-bullet {
    position: absolute;
    top: 0.5em;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-gray);
}

/* =========================================
   RADAR SVG (classes .radar / .rdr-* — consommées par #/referentiels ;
   la synthèse direction it. 31 utilise ses propres classes .sd-rdr-*)
   ========================================= */
.radar { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.rdr-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.rdr-spoke { stroke: var(--border); stroke-width: 1; }
.rdr-area { fill: rgba(38, 178, 127, 0.16); stroke: var(--brand-emerald); stroke-width: 2; stroke-linejoin: round; }
.rdr-dot { fill: var(--brand-emerald); }
.rdr-axis { font-size: 9.5px; font-weight: 700; fill: var(--text-main); }
.rdr-val { font-size: 8.5px; font-weight: 600; fill: var(--text-muted); }

/* Utilitaire global : contenu réservé à l'impression (masqué à l'écran).
   Consommé par l'en-tête de rapport de la synthèse direction (it. 31)
   et par les vues imprimables des autres modules. */
.print-only { display: none; }
@media print {
    .print-only { display: block !important; }
}

/* =========================================
   FORMS
   ========================================= */
/* min-width:0 : permet aux .form-group de rétrécir dans une grille/flex
   (sinon les inputs — notamment type=date — gardent leur largeur intrinsèque
   et débordent du cadre sur les petites largeurs). */
.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; min-width: 0; }
.form-group label { margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.form-group input, .form-group select, .form-group textarea {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
    transition: var(--transition);
    background: var(--bg-subtle);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--brand-emerald);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group textarea { min-height: 120px; resize: vertical; }

/* =========================================
   MATRICE DES RISQUES (grille EBIOS)
   ========================================= */
.risk-matrix { border-collapse: separate; border-spacing: 6px; margin: 2rem 0; width: 100%; }
.matrix-axis { padding: 12px; background: var(--bg-subtle); color: var(--text-muted); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; text-align: center; }
.matrix-cell { width: 18%; height: 110px; border-radius: var(--radius-sm); vertical-align: top; padding: 8px; transition: var(--transition); }

.matrix-low { background-color: rgba(26, 158, 112, 0.10); border: 1px solid rgba(26, 158, 112, 0.22); }
.matrix-medium { background-color: rgba(224, 138, 30, 0.10); border: 1px solid rgba(224, 138, 30, 0.22); }
.matrix-high { background-color: rgba(234, 106, 30, 0.10); border: 1px solid rgba(234, 106, 30, 0.22); }
.matrix-critical { background-color: rgba(220, 58, 82, 0.10); border: 1px solid rgba(220, 58, 82, 0.22); }

.matrix-risk {
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.06);
    cursor: pointer;
    border-left: 4px solid var(--accent);
}

.matrix-legend { display: flex; gap: 24px; margin-top: 1.5rem; flex-wrap: wrap; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; }
.legend::before { content: ""; width: 16px; height: 16px; border-radius: 4px; }
.legend.low::before { background: var(--risk-low); }
.legend.medium::before { background: var(--risk-medium); }
.legend.high::before { background: var(--risk-high); }
.legend.critical::before { background: var(--risk-critical); }

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
#toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 16px);
    right: 24px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 1rem 1.4rem;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast .toast-ico { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success { border-left: 5px solid var(--color-success); }
.toast.success .toast-ico { color: var(--color-success); }
.toast.error { border-left: 5px solid var(--color-danger); }
.toast.error .toast-ico { color: var(--color-danger); }
.toast.info { border-left: 5px solid var(--color-info); }
.toast.info .toast-ico { color: var(--color-info); }
.toast.warning { border-left: 5px solid var(--color-warning); }
.toast.warning .toast-ico { color: var(--color-warning); }

/* =========================================================================
   DIALOGUES MODAUX (confirm/alert maison — js/core/utils.js, corrige AUDIT M9)
   Voile + carte centrée. Tokens uniquement (zéro couleur en dur). Masqué à
   l'impression (`no-print`). Au-dessus des toasts (z-index 9999).
   ========================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--scrim);
    animation: modalFade 0.15s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: 0 20px 50px rgba(16, 24, 40, 0.28);
    width: 100%;
    max-width: 460px;
    padding: 1.5rem 1.6rem 1.4rem;
    animation: modalPop 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalPop {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.modal-title {
    margin: 0 0 0.6rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}
.modal-dialog--danger .modal-title { color: var(--color-danger-ink); }

.modal-body {
    margin: 0 0 1.3rem;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}
.modal-btn { min-width: 96px; }
.modal-btn--cancel {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}
.modal-btn--cancel:hover { background: var(--bg-subtle); border-color: var(--text-muted); }
.modal-btn--danger { background: var(--color-danger); color: #FFFFFF; }
.modal-btn--danger:hover { background: var(--color-danger-ink); }

@media (max-width: 480px) {
    .modal-actions { flex-direction: column-reverse; }
    .modal-btn { width: 100%; }
}

/* =========================================
   RÉFÉRENTIELS — AUTO-ÉVALUATION PAR CLAUSE (it. 22)
   Tokens uniquement — couleurs sémantiques strictes (teintes -bg / -ink).
   ========================================= */
.refx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.refx-card { display: flex; flex-direction: column; }
.refx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.refx-radar-box { flex: 1; display: flex; align-items: center; justify-content: center; }
.refx-card .radar { max-width: 290px; }

.refx-kpis { display: flex; gap: 10px; margin: 14px 0 8px; }
.refx-kpi { flex: 1; background: var(--bg-subtle); border-radius: var(--radius); padding: 10px 8px; text-align: center; }
.refx-kpi-val { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.refx-kpi-val span { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.refx-kpi-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.refx-progress { height: 6px; background: var(--bg-subtle); border-radius: 3px; overflow: hidden; margin: 4px 0 14px; }
.refx-progress > div { height: 100%; background: var(--accent); border-radius: 3px; }

.refx-open {
    margin-top: 14px; width: 100%; justify-content: center;
    background: var(--accent); color: #FFFFFF; border: none;
    padding: 10px 14px; border-radius: var(--radius); font-weight: 700; cursor: pointer;
    transition: var(--transition);
}
.refx-open:hover { background: var(--accent-strong); }

.refx-domain {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.refx-domain > summary {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none;
}
.refx-domain > summary::-webkit-details-marker { display: none; }
.refx-domain[open] > summary { border-bottom: 1px solid var(--border); }
.refx-dom-score { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; font-weight: 700; }
.refx-dom-count { color: var(--text-muted); font-weight: 500; }

.refx-statut, .refx-mat {
    width: 100%; border: 1px solid var(--border); border-radius: 6px;
    padding: 5px 8px; font-weight: 600; background: var(--bg-card); color: var(--text-main);
}
.refx-mat { width: auto; }
.refx-sel-conforme { background: var(--color-success-bg); color: var(--color-success-ink); border-color: var(--color-success-ink); }
.refx-sel-partiellement-conforme { background: var(--color-warning-bg); color: var(--color-warning-ink); border-color: var(--color-warning-ink); }
.refx-sel-non-conforme { background: var(--color-danger-bg); color: var(--color-danger-ink); border-color: var(--color-danger-ink); }
.refx-sel-non-applicable { background: var(--bg-subtle); color: var(--text-muted); }

.refx-toggle {
    background: transparent; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; font-size: 0.8rem; font-weight: 600; color: var(--text-main);
    cursor: pointer; transition: var(--transition);
}
.refx-toggle:hover { background: var(--bg-subtle); }
.refx-count {
    display: inline-block; min-width: 18px; padding: 1px 5px; border-radius: 9px;
    background: var(--accent-light); color: var(--accent-strong); font-size: 0.72rem; font-weight: 700;
}

.refx-detail-row > td { background: var(--bg-subtle); }
.refx-panel { display: grid; gap: 14px; padding: 4px 2px; }
.refx-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.refx-panel textarea { width: 100%; }
.refx-empty { color: var(--text-muted); font-size: 0.85rem; margin: 4px 0; }
.refx-linked { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.refx-linked li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.88rem; }
.refx-link-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.refx-link-row select, .refx-link-row input { flex: 1 1 180px; min-width: 0; }
.refx-actions-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.refx-action-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.refx-action-form .refx-act-titre { flex: 2 1 220px; min-width: 0; }
.refx-action-form .refx-act-save {
    background: var(--accent); color: #FFFFFF; border: none; border-radius: var(--radius);
    padding: 8px 14px; font-weight: 700; cursor: pointer; transition: var(--transition);
}
.refx-action-form .refx-act-save:hover { background: var(--accent-strong); }

@media (max-width: 720px) {
    .refx-panel-grid { grid-template-columns: 1fr; }
    .refx-kpis { flex-wrap: wrap; }
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1200px) {
    .dash-columns { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
    .main-content { padding: calc(var(--topbar-h) + 1.75rem) 1.75rem 2rem; }
    body.has-backup-reminder .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 1.75rem); }
    .backup-reminder { padding: 0 1.75rem; }
    body.has-quota-banner .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 1.75rem); }
    .quota-banner { padding: 0 1.75rem; }
    .trust-chip { display: none; }
}

@media (max-width: 880px) {
    .dash-columns { grid-template-columns: 1fr; }
}

/* =========================================================================
   CARTOGRAPHIE DU SI (it. 33) — tokens uniquement
   ========================================================================= */
.carto-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.carto-toolbar .form-group { margin: 0; min-width: 150px; }
.carto-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.carto-scroll { overflow-x: auto; }
.carto-scroll svg { display: block; }
.carto-node { cursor: pointer; }
.carto-node:focus { outline: none; }
.carto-node:focus-visible rect { stroke: var(--accent); stroke-width: 3px; }
.carto-node.carto-dim { opacity: 0.22; }
.carto-panel { position: sticky; top: 84px; }
.carto-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 0.78rem; color: var(--text-muted); }
.carto-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.carto-leg-line { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--anthracite); }
.carto-leg-bia { border-top-style: dashed; border-top-color: var(--border-strong); }
.carto-leg-dot { display: inline-block; width: 14px; height: 10px; border-radius: 4px; border: 1.6px solid; }
.carto-mini { display: block; }
.carto-mini svg { width: 100%; height: auto; display: block; }
@media (max-width: 900px) {
    .carto-wrap { grid-template-columns: 1fr; }
    .carto-panel { position: static; }
}
@media print {
    .carto-toolbar, .carto-panel, .carto-legend { display: none !important; }
    .carto-scroll { overflow: visible; }
    .carto-scroll svg { max-width: 100%; height: auto; }
}

@media (max-width: 720px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-scrim { display: block; opacity: 1; }

    .app-topbar { left: 0; padding: 0 1rem; }
    .topbar-menu { display: flex; }
    .main-content { margin-left: 0; padding: calc(var(--topbar-h) + 1.5rem) 1.25rem 2rem; }

    .backup-reminder { left: 0; padding: 0 1rem; gap: 0.5rem; }
    body.has-backup-reminder .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 1.5rem); }
    .quota-banner { left: 0; padding: 0 1rem; gap: 0.5rem; }
    body.has-quota-banner .main-content { padding-top: calc(var(--topbar-h) + var(--reminder-h) + 1.5rem); }

    .topbar-cta span[aria-hidden] { margin: 0; }
    .topbar-title { display: none; }  /* mobile : le hamburger + le titre de page (h1) suffisent */
    .context-pill .context-label { display: none; }
    .context-select { max-width: 150px; }
    .dashboard-header { align-items: flex-start; }
}

@media (max-width: 480px) {
    .topbar-cta { padding: 0.55rem 0.75rem; font-size: 0; gap: 0; }
    .topbar-cta span[aria-hidden] { font-size: 1rem; }

    /* CTA du rappel en icône seule pour laisser la place au message */
    .backup-reminder .reminder-cta { font-size: 0; gap: 0; padding: 7px 9px; }
    .backup-reminder .reminder-cta svg { width: 15px; height: 15px; }
    .quota-banner .reminder-cta { font-size: 0; gap: 0; padding: 7px 9px; }
    .quota-banner .reminder-cta svg { width: 15px; height: 15px; }

    /* Tuiles statistiques : 2 par rangée (4 côte à côte débordent sous 480 px) */
    .stat-tiles { flex-wrap: wrap; }
    .stat-tile { flex-basis: calc(50% - 0.425rem); }
}

/* Mouvement réduit (cf. CLAUDE.md) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================================
   FICHES RÉFLEXES PAR RÔLE (it. 40 — crise.js)
   Cartes d'action par rôle, imprimables. Accents sémantiques (orange = communs,
   rouge = contacts d'urgence) — tokens uniquement.
   ========================================================================= */
.frole-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.2rem; }
.frole-span { grid-column: 1 / -1; }
.frole-card { border-top: 4px solid var(--accent); }
.frole-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.frole-label { text-transform: uppercase; font-size: 0.72rem; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; margin: 12px 0 4px; }
.frole-holder { padding: 3px 0; }
.frole-supp { font-size: 0.85rem; color: var(--text-muted); }
.frole-empty { color: var(--text-muted); font-style: italic; }
.frole-actions { margin: 4px 0 0; padding-left: 20px; line-height: 1.5; }
.frole-actions li { margin-bottom: 6px; }
.frole-commun { border-top-color: var(--color-warning); }
.frole-commun .frole-title { color: var(--color-warning-ink); }
.frole-contacts { border-top-color: var(--color-danger); }
.frole-contacts .frole-title { color: var(--color-danger); }
.frole-note { font-weight: 400; font-size: 0.85rem; color: var(--text-muted); }
.frole-contacts table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 6px; }
.frole-contacts td { padding: 6px 4px; border-bottom: 1px dashed var(--border); }
.frole-contacts td:first-child { font-weight: 600; width: 55%; }
@media print {
    .frole-grid { grid-template-columns: 1fr 1fr; gap: 0.8rem; }
    .frole-card { font-size: 10pt; page-break-inside: avoid; break-inside: avoid; }
    .frole-title { font-size: 12pt; }
}

/* =========================================================================
   FICHES RÉFLEXES DE CRISE (it. 11c — crise.js)
   Playbooks imprimables. Couleurs sémantiques strictes (rouge = critique,
   orange = majeur ; le vert reste réservé à « maîtrisé »). Tokens uniquement.
   ========================================================================= */
.fiche-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.fiche-card {
    display: flex; flex-direction: column; gap: 0.55rem;
    padding: 1.1rem 1.15rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft); text-decoration: none; color: inherit;
    transition: var(--transition);
}
.fiche-card:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.fiche-card-head { display: flex; }
.fiche-card-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin: 0; line-height: 1.25; }
.fiche-card-resume { font-size: 0.86rem; color: var(--text-muted); line-height: 1.45; margin: 0; flex: 1; }
.fiche-card-cta { font-size: 0.84rem; font-weight: 600; color: var(--accent); }

.fiche-sev {
    display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.fiche-sev.crit { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.fiche-sev.maj  { background: var(--color-warning-bg); color: var(--color-warning-ink); }

/* Feuille de fiche (écran + impression) */
.fiche-page { max-width: 900px; }
.fiche-sheet { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem 1.75rem; box-shadow: var(--shadow-soft); }
.fiche-sheet-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.fiche-sheet-title { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin: 0; }
.fiche-resume { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 1.25rem; }

.fiche-block { margin-bottom: 1.4rem; }
.fiche-h { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); margin: 0 0 0.6rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.fiche-block ul { margin: 0; padding-left: 1.2rem; }
.fiche-block li { font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.35rem; }
.fiche-quand li { color: var(--text-main); }

/* Réflexes : à faire (neutre) vs à ne pas faire (danger) */
.fiche-reflexes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.4rem; }
.fiche-do, .fiche-dont { padding: 0.9rem 1rem; border-radius: var(--radius); border: 1px solid var(--border); }
.fiche-do { background: var(--bg-subtle); border-left: 4px solid var(--accent); }
.fiche-dont { background: var(--color-danger-bg); border-left: 4px solid var(--color-danger); }
.fiche-do .fiche-h, .fiche-dont .fiche-h { border-bottom: none; padding-bottom: 0; }
.fiche-dont .fiche-h { color: var(--color-danger-ink); }
.fiche-do ul, .fiche-dont ul { padding-left: 1.1rem; }
.fiche-dont li { color: var(--color-danger-ink); }

/* Phases */
.fiche-phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.fiche-phase { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem 0.85rem; }
.fiche-phase-t { font-weight: 700; font-size: 0.86rem; color: var(--primary); margin-bottom: 0.4rem; }
.fiche-phase ul { padding-left: 1.05rem; }
.fiche-phase li { font-size: 0.83rem; margin-bottom: 0.25rem; }

/* Rôles & annuaire */
.fiche-roles td, .fiche-annuaire td, .fiche-annuaire th { vertical-align: top; }
.fiche-role-name { font-weight: 700; color: var(--primary); white-space: nowrap; width: 30%; }
.fiche-annuaire { margin-top: 0; }

.fiche-flag { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 0.68rem; font-weight: 700; background: var(--color-info-bg); color: var(--color-info); text-transform: none; letter-spacing: 0; vertical-align: middle; }
.fiche-contacts li { color: var(--text-main); }
.fiche-empty { font-size: 0.88rem; color: var(--text-muted); }
.fiche-foot { margin-top: 1.5rem; padding-top: 0.85rem; border-top: 1px dashed var(--border); font-size: 0.76rem; color: var(--text-muted); }

/* L'en-tête de fiche imprimé est désormais le composant partagé .pbh (it. 32). */

@media (max-width: 760px) {
    .fiche-reflexes { grid-template-columns: 1fr; }
}

/* Impression des fiches : masquer l'écran, calibrer la feuille, maîtriser les sauts de page */
@media print {
    .fiche-sheet { border: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
    .fiche-block, .fiche-reflexes, .fiche-phase, .fiche-do, .fiche-dont { page-break-inside: avoid; break-inside: avoid; }
    .fiche-h { color: #000 !important; }
    .fiche-booklet-item { page-break-before: always; }
    .fiche-booklet .fiche-cover { page-break-after: always; page-break-before: avoid; }
    .fiche-booklet-item:first-of-type { page-break-before: avoid; }
}

/* =========================================
   PRINT / PDF STYLES
   ========================================= */
@media print {
    @page {
        size: A4;
        margin: 1.5cm 2cm;
    }

    .no-print, #toast-container, .sidebar, .app-topbar, .sidebar-scrim, .backup-reminder {
        display: none !important;
    }
    body.has-backup-reminder .main-content { padding-top: 0 !important; }

    body {
        background: white !important;
        color: #000 !important;
        font-size: 10pt;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        max-width: none !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .dashboard-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1.5rem !important;
    }
}
