/* ════════════════════════════════════════════════════════════════════════
   theme.css — SILICON PLATFORM · Charte graphique unifiée (v3)
   Inspirée de Njangi : surfaces claires, cartes arrondies à bordure fine,
   gros boutons faciles à toucher, fenêtres qui montent du bas sur
   téléphone, bulles d'aide. Couleurs = identité visuelle Silicon
   (variables --brand-* injectées depuis Identité visuelle / branding.py).

   Organisation :
     1. Jetons (couleurs, polices, rayons)
     2. Base
     3. Composants maison (sil-*)  : en-tête de page, cartes, KPI, puces…
     4. Bootstrap harmonisé        : boutons, formulaires, tableaux, onglets,
                                     fenêtres, alertes, badges, menus…
     5. Fenêtres « feuille » (aide, verrouillage) et bulles d'aide
     6. Adaptation téléphone / tablette
     7. Impression
   ════════════════════════════════════════════════════════════════════════ */

/* ─── 1. JETONS ─────────────────────────────────────────────────────────── */
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("../vendor/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("../vendor/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../vendor/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../vendor/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Couleurs (dérivées de l'identité visuelle) */
  --sil-brand:      var(--brand-primary, #003399);
  --sil-brand-2:    var(--brand-light, #1a4db5);
  --sil-brand-ink:  #ffffff;
  --sil-brand-soft: color-mix(in srgb, var(--sil-brand) 10%, #fff);
  --sil-ring:       color-mix(in srgb, var(--sil-brand) 20%, transparent);
  --sil-navy:       var(--brand-navy, #0a1628);
  --sil-accent:     var(--brand-accent, #0ea5e9);

  --sil-bg:         #eef2f8;
  --sil-surface:    #ffffff;
  --sil-surface-2:  #e8edf5;
  --sil-ink:        #0f1b33;
  --sil-muted:      #56627a;
  --sil-line:       #d6deea;

  --sil-good:       var(--brand-success, #059669);
  --sil-warn:       var(--brand-warning, #b45309);
  --sil-crit:       var(--brand-danger, #e30613);
  --sil-good-soft:  color-mix(in srgb, var(--sil-good) 12%, #fff);
  --sil-warn-soft:  color-mix(in srgb, var(--sil-warn) 13%, #fff);
  --sil-crit-soft:  color-mix(in srgb, var(--sil-crit) 10%, #fff);
  --sil-hint:       #fff6e0;
  --sil-hint-line:  #f0d9a0;

  /* Polices */
  --sil-font:    "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sil-display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;
  --sil-mono:    ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Formes */
  --sil-r:    14px;
  --sil-r-sm: 10px;
  --sil-shadow: 0 1px 2px rgba(15,27,51,.05);
  --sil-shadow-lg: 0 18px 44px -14px rgba(15,27,51,.32);

  /* Compatibilité avec l'ancien thème */
  --shadow-sm: var(--sil-shadow);
  --shadow-md: var(--sil-shadow-lg);
  --fs-body: 0.9375rem;

  /* Bootstrap suit la charte */
  --bs-body-font-family: var(--sil-font);
  --bs-body-color: var(--sil-ink);
  --bs-body-bg: var(--sil-bg);
  --bs-border-color: var(--sil-line);
  --bs-border-radius: var(--sil-r-sm);
  --bs-border-radius-lg: var(--sil-r);
  --bs-primary: var(--sil-brand);
  --bs-link-color: var(--sil-brand);
  --bs-link-hover-color: var(--sil-brand-2);
  --bs-secondary-color: var(--sil-muted);
  --bs-tertiary-bg: var(--sil-surface-2);
}

/* Navigateurs anciens (sans color-mix) : teintes calculées à l'avance */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --sil-brand-soft: #e6ecf8; --sil-ring: rgba(0,51,153,.2); --sil-good-soft: #e2f4ec;
          --sil-warn-soft: #fbf0dc; --sil-crit-soft: #fde7e9; }
}

/* ─── 2. BASE ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sil-font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--sil-ink);
  background: var(--sil-bg);
  margin: 0; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
/* Une seule famille de polices partout (les icônes gardent la leur) */
body *:not(i):not([class^="fa"]):not([class*=" fa"]):not([class^="bi"]):not([class*=" bi-"]):not(code):not(kbd):not(pre):not(samp):not(h1):not(h2):not(h3):not(.h1):not(.h2):not(.h3):not(.sil-display):not(.sil-kpi .v):not(.modal-title):not(.sil-keep-font):not(.sil-keep-font *) {
  font-family: var(--sil-font) !important;
}
h1, h2, h3, .h1, .h2, .h3, .sil-display { font-family: var(--sil-display) !important; letter-spacing: -.02em; text-wrap: balance; }
h1, .h1 { font-weight: 800; }
h2, .h2, h3, .h3 { font-weight: 700; }
h4, h5, h6, .h4, .h5, .h6 { font-weight: 700; }
a { color: var(--sil-brand); text-underline-offset: 2px; }
code, kbd, pre, samp { font-family: var(--sil-mono); }
img, svg, video, canvas { max-width: 100%; }
::selection { background: color-mix(in srgb, var(--sil-brand) 22%, transparent); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sil-brand) 55%, transparent); outline-offset: 2px; }
.tnum { font-variant-numeric: tabular-nums; }
.text-muted, .sil-muted { color: var(--sil-muted) !important; }
.small, small { font-size: .84em; }

/* ─── 3. COMPOSANTS MAISON ──────────────────────────────────────────────── */

/* En-tête de page (partials/_page_header.html et pages existantes) */
.page-header, .sil-page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.page-header h1, .sil-page-head h1 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); margin: 0; line-height: 1.15; }
.page-header .subtitle, .sil-page-head p { color: var(--sil-muted); margin: 4px 0 0; font-size: .92rem; }
.page-header-titles { min-width: 0; }
.page-header-actions, .sil-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Cartes */
.sil-card, .card-brand {
  background: var(--sil-surface); border: 1px solid var(--sil-line);
  border-radius: var(--sil-r); padding: 16px; box-shadow: var(--sil-shadow);
}
.sil-card > h2, .sil-card-title { font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sil-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sil-card-head h2 { font-size: 1.05rem; margin: 0; }

/* Grilles */
.sil-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.sil-grid > * { min-width: 0; }
.sil-stack { display: flex; flex-direction: column; gap: 14px; }
.sil-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Indicateurs (KPI) */
.sil-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.sil-kpi {
  background: var(--sil-surface); border: 1px solid var(--sil-line); border-radius: var(--sil-r);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative;
}
.sil-kpi .l { font-size: .78rem; font-weight: 700; color: var(--sil-muted); display: flex; align-items: center; gap: 6px; }
.sil-kpi .v { font-family: var(--sil-display) !important; font-weight: 800; font-size: 1.55rem; line-height: 1.1; overflow-wrap: anywhere; }
.sil-kpi .s { font-size: .8rem; color: var(--sil-muted); }
.sil-kpi.good { border-left: 4px solid var(--sil-good); }
.sil-kpi.warn { border-left: 4px solid var(--sil-warn); }
.sil-kpi.crit { border-left: 4px solid var(--sil-crit); }

/* Puces d'état */
.sil-chip {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  font-size: .76rem; font-weight: 700; padding: .16rem .6rem; border-radius: 20px;
  background: var(--sil-surface-2); color: var(--sil-muted);
}
.sil-chip.good { background: var(--sil-good-soft); color: var(--sil-good); }
.sil-chip.warn { background: var(--sil-warn-soft); color: var(--sil-warn); }
.sil-chip.crit { background: var(--sil-crit-soft); color: var(--sil-crit); }
.sil-chip.brand { background: var(--sil-brand-soft); color: var(--sil-brand); }
.sil-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--sil-muted); flex: none; }
.sil-dot.good { background: var(--sil-good); box-shadow: 0 0 0 3px var(--sil-good-soft); }
.sil-dot.warn { background: var(--sil-warn); box-shadow: 0 0 0 3px var(--sil-warn-soft); }
.sil-dot.crit { background: var(--sil-crit); box-shadow: 0 0 0 3px var(--sil-crit-soft); animation: silDotPulse 1.6s ease-in-out infinite; }
@keyframes silDotPulse { 50% { box-shadow: 0 0 0 6px transparent; } }

/* Encadrés « astuce » et « à savoir » (comme Njangi) */
.sil-tip {
  display: flex; gap: .65rem; align-items: flex-start;
  background: color-mix(in srgb, var(--sil-brand) 7%, var(--sil-surface));
  border: 1px solid color-mix(in srgb, var(--sil-brand) 24%, transparent);
  border-radius: var(--sil-r); padding: 10px 12px; font-size: .9rem;
}
.sil-hint { background: var(--sil-hint); border: 1px solid var(--sil-hint-line); border-radius: var(--sil-r); padding: 12px 14px; font-size: .9rem; }

/* Listes simples */
.sil-list { display: flex; flex-direction: column; }
.sil-li { display: flex; align-items: center; gap: .7rem; padding: 10px 0; border-top: 1px solid var(--sil-line); min-width: 0; }
.sil-li:first-child { border-top: 0; }
.sil-li .grow { flex: 1; min-width: 0; }
.sil-li .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.sil-li .d { font-size: .82rem; color: var(--sil-muted); }
.sil-empty { text-align: center; color: var(--sil-muted); padding: 22px 10px; }
.sil-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--sil-surface-2); color: var(--sil-ink); }

/* Segments (choix exclusif) */
.sil-seg { display: inline-flex; flex-wrap: wrap; background: var(--sil-surface-2); border: 1px solid var(--sil-line); border-radius: 12px; padding: 3px; gap: 3px; max-width: 100%; overflow-x: auto; }
.sil-seg button, .sil-seg a { border: 0; background: none; border-radius: 9px; padding: .42rem .9rem; font-weight: 700; color: var(--sil-muted); white-space: nowrap; min-height: 38px; text-decoration: none; display: inline-flex; align-items: center; }
.sil-seg [aria-pressed="true"], .sil-seg .on { background: var(--sil-surface); color: var(--sil-ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* Barre de progression */
.sil-progress { height: 9px; background: var(--sil-surface-2); border-radius: 6px; overflow: hidden; }
.sil-progress > i { display: block; height: 100%; background: var(--sil-brand); border-radius: 6px; transition: width .4s; }

/* Boutons maison (compatibilité) */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 0 14px; border-radius: var(--sil-r-sm);
  background: var(--sil-surface); border: 1px solid var(--sil-line);
  color: var(--sil-ink); font-size: .88rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-back:hover { border-color: var(--sil-brand); color: var(--sil-brand); }
.btn-brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 0 16px; border-radius: var(--sil-r-sm);
  background: var(--sil-brand); border: 1px solid var(--sil-brand);
  color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-brand:hover { filter: brightness(1.08); color: #fff; }

/* Tableau maison */
.table-brand { width: 100%; border-collapse: collapse; background: var(--sil-surface); font-size: .88rem; }
.table-brand th { background: var(--sil-surface-2); color: var(--sil-muted); font-weight: 800; padding: 9px 10px; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table-brand td { padding: 9px 10px; border-bottom: 1px solid var(--sil-line); }
.table-brand tr:hover td { background: color-mix(in srgb, var(--sil-brand) 4%, transparent); }

/* Menus déroulants maison (menu utilisateur) */
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px;
  padding: 6px 10px; border-radius: 10px; border: 0; background: none;
  color: var(--sil-ink); font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer; text-align: left;
}
.dd-item:hover { background: var(--sil-surface-2); color: var(--sil-ink); }
.dd-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--sil-surface-2); color: var(--sil-brand); flex: none; font-size: .85rem; }
.dd-sep { height: 1px; background: var(--sil-line); margin: 4px 6px; }

/* Bouton « remonter » (un seul, n'apparaît qu'après défilement) */
.scroll-btn {
  position: fixed; right: 84px; bottom: calc(18px + var(--tabbar-h, 0px) + env(safe-area-inset-bottom)); z-index: 1030;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--sil-line);
  background: var(--sil-surface); color: var(--sil-ink); display: grid; place-items: center;
  box-shadow: var(--sil-shadow-lg); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.scroll-btn.on { opacity: 1; pointer-events: auto; transform: none; }
.scroll-bottom { display: none !important; }

/* Bandeau mode DEBUG */
.sil-debug { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--sil-crit-soft); border: 1px solid color-mix(in srgb, var(--sil-crit) 28%, transparent); color: var(--sil-crit); font-size: .82rem; }

/* ─── 4. BOOTSTRAP HARMONISÉ ────────────────────────────────────────────── */

/* Cartes */
.card {
  --bs-card-border-color: var(--sil-line);
  --bs-card-border-radius: var(--sil-r);
  --bs-card-inner-border-radius: calc(var(--sil-r) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-bg: var(--sil-surface);
  border: 1px solid var(--sil-line);
  border-radius: var(--sil-r);
  box-shadow: var(--sil-shadow);
}
.card-header { font-weight: 700; border-bottom: 1px solid var(--sil-line); padding: .8rem 1rem; }
.card-footer { border-top: 1px solid var(--sil-line); background: transparent; }
.card-title { font-weight: 700; }

/* Boutons : grands, lisibles, faciles à toucher */
.btn {
  --bs-btn-font-weight: 700;
  --bs-btn-border-radius: var(--sil-r-sm);
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: .5rem;
  --bs-btn-font-size: .9rem;
  min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .3rem; --bs-btn-font-size: .82rem; min-height: 34px; }
.btn-lg { min-height: 48px; }
.btn-primary {
  --bs-btn-bg: var(--sil-brand); --bs-btn-border-color: var(--sil-brand);
  --bs-btn-hover-bg: var(--sil-brand-2); --bs-btn-hover-border-color: var(--sil-brand-2);
  --bs-btn-active-bg: var(--sil-brand-2); --bs-btn-active-border-color: var(--sil-brand-2);
  --bs-btn-disabled-bg: var(--sil-brand); --bs-btn-disabled-border-color: var(--sil-brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--sil-brand); --bs-btn-border-color: var(--sil-brand);
  --bs-btn-hover-bg: var(--sil-brand); --bs-btn-hover-border-color: var(--sil-brand);
  --bs-btn-active-bg: var(--sil-brand); --bs-btn-active-border-color: var(--sil-brand);
}
.btn-secondary, .btn-light, .btn-outline-secondary {
  --bs-btn-bg: var(--sil-surface-2); --bs-btn-color: var(--sil-ink); --bs-btn-border-color: var(--sil-line);
  --bs-btn-hover-bg: var(--sil-line); --bs-btn-hover-color: var(--sil-ink); --bs-btn-hover-border-color: var(--sil-line);
  --bs-btn-active-bg: var(--sil-line); --bs-btn-active-color: var(--sil-ink);
}
.btn-danger { --bs-btn-bg: var(--sil-crit); --bs-btn-border-color: var(--sil-crit); }
.btn-success { --bs-btn-bg: var(--sil-good); --bs-btn-border-color: var(--sil-good); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--sil-ring); }

/* Formulaires */
.form-control, .form-select {
  min-height: 44px; border-radius: var(--sil-r-sm); border-color: var(--sil-line);
  font-size: .95rem; color: var(--sil-ink); background-color: var(--sil-surface);
}
.form-control-sm, .form-select-sm { min-height: 36px; font-size: .86rem; }
textarea.form-control { min-height: 88px; }
.form-control:focus, .form-select:focus { border-color: var(--sil-brand); box-shadow: 0 0 0 3px var(--sil-ring); }
.form-label, label.form-label { font-size: .84rem; font-weight: 700; color: var(--sil-muted); margin-bottom: .3rem; }
.form-text { font-size: .8rem; color: var(--sil-muted); }
.form-check-input { width: 1.15em; height: 1.15em; }
.form-check-input:checked { background-color: var(--sil-brand); border-color: var(--sil-brand); }
.input-group-text { background: var(--sil-surface-2); border-color: var(--sil-line); font-weight: 700; }
.invalid-feedback, .errorlist { color: var(--sil-crit); font-size: .82rem; }

/* Tableaux */
.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--sil-line);
  --bs-table-striped-bg: color-mix(in srgb, var(--sil-surface-2) 55%, transparent);
  --bs-table-hover-bg: color-mix(in srgb, var(--sil-brand) 5%, transparent);
  font-size: .9rem; margin-bottom: 0; vertical-align: middle;
}
.table > thead th, .table > thead td {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--sil-muted); background: var(--sil-surface-2); white-space: nowrap; border-bottom-width: 1px;
}
.table-dark { --bs-table-bg: var(--sil-navy); }
.table > :not(caption) > * > * { padding: .6rem .7rem; }
.sil-scroll, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* Onglets → soulignés et défilants (comme Njangi) */
.nav-tabs {
  --bs-nav-tabs-border-color: var(--sil-line);
  border-bottom: 1px solid var(--sil-line); gap: 2px;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link {
  border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none;
  color: var(--sil-muted); font-weight: 700; white-space: nowrap; min-height: 44px; padding: .5rem .85rem;
}
.nav-tabs .nav-link:hover { color: var(--sil-ink); border-bottom-color: var(--sil-line); }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: var(--sil-ink); background: none; border-bottom-color: var(--sil-brand); }
.nav-pills { gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-pills .nav-link { border-radius: 10px; font-weight: 700; color: var(--sil-muted); white-space: nowrap; min-height: 40px; }
.nav-pills .nav-link.active { background: var(--sil-brand); color: #fff; }

/* Badges → pastilles */
.badge { border-radius: 20px; font-weight: 700; padding: .32em .65em; letter-spacing: .01em; }

/* Alertes → encadrés doux */
.alert {
  border-radius: var(--sil-r); border: 1px solid transparent; border-left-width: 4px;
  font-size: .9rem; padding: .75rem 1rem;
}
.alert-success { background: var(--sil-good-soft); border-color: color-mix(in srgb, var(--sil-good) 28%, transparent); border-left-color: var(--sil-good); color: color-mix(in srgb, var(--sil-good) 70%, #000); }
.alert-danger  { background: var(--sil-crit-soft); border-color: color-mix(in srgb, var(--sil-crit) 25%, transparent); border-left-color: var(--sil-crit); color: color-mix(in srgb, var(--sil-crit) 75%, #000); }
.alert-warning { background: var(--sil-warn-soft); border-color: color-mix(in srgb, var(--sil-warn) 28%, transparent); border-left-color: var(--sil-warn); color: color-mix(in srgb, var(--sil-warn) 70%, #000); }
.alert-info    { background: var(--sil-brand-soft); border-color: color-mix(in srgb, var(--sil-brand) 22%, transparent); border-left-color: var(--sil-brand); color: var(--sil-ink); }

/* Menus déroulants */
.dropdown-menu { border: 1px solid var(--sil-line); border-radius: var(--sil-r); box-shadow: var(--sil-shadow-lg); padding: 6px; font-size: .9rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .7rem; font-weight: 600; }
.dropdown-item.active, .dropdown-item:active { background: var(--sil-brand); }

/* Pagination */
.pagination { --bs-pagination-color: var(--sil-brand); --bs-pagination-active-bg: var(--sil-brand); --bs-pagination-active-border-color: var(--sil-brand); --bs-pagination-border-radius: var(--sil-r-sm); flex-wrap: wrap; gap: 4px; }
.page-link { border-radius: var(--sil-r-sm) !important; min-width: 40px; min-height: 40px; display: grid; place-items: center; font-weight: 700; }

/* Fenêtres (modales) */
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--sil-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--sil-line); padding: 14px 18px; }
.modal-title { font-family: var(--sil-display) !important; font-weight: 800; }
.modal-footer { border-top: 1px solid var(--sil-line); }
.modal-backdrop.show { opacity: .5; }
.list-group-item { border-color: var(--sil-line); }
.progress { border-radius: 6px; background: var(--sil-surface-2); }
.progress-bar { background-color: var(--sil-brand); }
.bg-primary { background-color: var(--sil-brand) !important; }
.text-primary { color: var(--sil-brand) !important; }
.border-primary { border-color: var(--sil-brand) !important; }

/* ─── 5. FEUILLES (aide, verrouillage…) ET BULLES D'AIDE ───────────────── */
.sil-sheet {
  position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
  background: rgba(8,16,32,.5); padding: 16px; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.sil-sheet.on { opacity: 1; pointer-events: auto; }
.sil-sheet .inner {
  background: var(--sil-surface); color: var(--sil-ink); width: min(620px, 100%); max-height: 88vh; overflow: auto;
  border-radius: 20px; padding: 18px 18px 20px; box-shadow: var(--sil-shadow-lg);
  transform: translateY(18px); transition: transform .22s ease;
}
.sil-sheet.on .inner { transform: none; }
.sil-sheet .grab { display: none; width: 44px; height: 5px; border-radius: 3px; background: var(--sil-line); margin: -6px auto 10px; }
.sil-sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.sil-sheet-head h2 { font-size: 1.2rem; margin: 0; flex: 1; }
.sil-x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--sil-line); background: var(--sil-surface-2); color: var(--sil-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.sil-help-zones { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.sil-help-zone { border: 1px solid var(--sil-line); border-radius: 12px; padding: 10px 12px; }
.sil-help-zone b { display: block; font-size: .95rem; }
.sil-help-zone span { font-size: .88rem; color: var(--sil-muted); }
.sil-help-zone em { display: block; font-style: normal; font-size: .84rem; margin-top: 4px; padding: 6px 9px; border-radius: 8px; background: var(--sil-hint); }
.sil-steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 5px; font-size: .92rem; }

/* Bulle d'aide riche : data-help="Titre|Explication|Exemple" */
.sil-htip {
  position: fixed; z-index: 4000; max-width: 300px; pointer-events: none;
  background: var(--sil-ink); color: #fff; border-radius: 12px; padding: 10px 12px;
  font-size: .84rem; line-height: 1.45; box-shadow: 0 10px 28px rgba(0,0,0,.28);
  display: flex; flex-direction: column; gap: 3px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.sil-htip.on { opacity: 1; transform: none; }
.sil-htip b { font-size: .9rem; }
.sil-htip em { font-style: normal; opacity: .9; border-top: 1px solid rgba(255,255,255,.2); padding-top: 4px; margin-top: 2px; }
@media (hover: hover) { [data-help] { cursor: help; } a[data-help], button[data-help], label[data-help] { cursor: pointer; } }
.sil-help-i {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  border: 0; padding: 0; background: var(--sil-surface-2); color: var(--sil-muted); font-size: .7rem; font-weight: 800; cursor: pointer; vertical-align: middle;
}
.sil-help-i:hover { background: var(--sil-brand); color: #fff; }
body.sil-help-mode [data-help] { outline: 2px dashed color-mix(in srgb, var(--sil-brand) 60%, transparent); outline-offset: 3px; border-radius: 8px; }

/* Notifications légères (silToast) */
.sil-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--tabbar-h, 0px) + env(safe-area-inset-bottom)); z-index: 4100; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.sil-toast { display: flex; gap: 10px; align-items: flex-start; background: var(--sil-ink); color: #fff; border-radius: 12px; padding: 11px 14px; font-size: .88rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: silIn .22s ease-out; }
.sil-toast i { margin-top: 2px; }
.sil-toast.ok i { color: #6ee7b7; } .sil-toast.err i { color: #fca5a5; } .sil-toast.warn i { color: #fcd34d; }
@keyframes silIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─── 6. TÉLÉPHONE / TABLETTE ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .page-header, .sil-page-head { flex-direction: column; }
  .page-header-actions { width: 100%; }
}
@media (max-width: 767.98px) {
  :root { --fs-body: 0.95rem; }
  /* Fenêtres : montent du bas, comme sur Njangi */
  .modal-dialog { margin: 0; position: fixed; left: 0; right: 0; bottom: 0; max-width: none; width: 100%; transform: translateY(20px); }
  .modal.show .modal-dialog { transform: none; }
  .modal-content { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .modal-dialog-scrollable { height: auto; max-height: 92vh; }
  .modal-dialog-centered { min-height: 0; align-items: flex-end; }
  .sil-sheet { align-items: flex-end; padding: 0; }
  .sil-sheet .inner { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .sil-sheet .grab { display: block; }
  /* Boutons d'actions : pleine largeur, empilés proprement */
  .page-header-actions > .btn, .page-header-actions > a, .page-header-actions > button { flex: 1 1 auto; }
  .btn-group { flex-wrap: wrap; }
  .table { font-size: .86rem; }
  .card-body { padding: .9rem; }
  /* Évite le zoom automatique d'iOS sur les champs */
  input, select, textarea { font-size: 16px !important; }
  .sil-kpi .v { font-size: 1.3rem; }
  h1, .h1 { font-size: 1.4rem; }
}
@media (pointer: coarse) {
  .btn, .form-control, .form-select, .nav-link { min-height: 44px; }
  .btn-sm { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ─── 7. IMPRESSION ─────────────────────────────────────────────────────── */
.print-fab { display: none !important; } /* l'impression est dans la barre du haut */
.print-cfg-heading { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--sil-muted); margin-bottom: 10px; }
.print-cfg-sections { display: flex; flex-direction: column; gap: 4px; }
.print-cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; background: var(--sil-surface-2); }
.print-cfg-row .form-check-label { font-size: .88rem; }
.print-cfg-row .form-check-sm .form-check-label { font-size: .74rem; }

@media print {
  .scroll-btn, .print-fab, .d-print-none, .page-header-actions, .btn-back, .btn-brand,
  .sil-htip, .sil-toasts, .sil-sheet, .tabbar { display: none !important; }
  body { background: #fff !important; font-size: 11px; }
  .card, .sil-card, .sil-kpi { box-shadow: none !important; }
  .print-hidden { display: none !important; }
  .print-break-before { page-break-before: always !important; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  h1, h2, h3, h4 { page-break-after: avoid; }
  .card-brand, .print-block, .print-section { page-break-inside: avoid; }
  img { max-width: 100% !important; }
  @page { margin: 12mm 10mm; }
  body.print-bw, body.print-bw * { color: #000 !important; background: #fff !important; border-color: #999 !important; box-shadow: none !important; }
  body.print-bw img, body.print-bw canvas, body.print-bw svg { filter: grayscale(1) contrast(1.1); }
  body.print-font-compact { font-size: 9.5px; }
  body.print-font-normal { font-size: 11px; }
  body.print-font-large { font-size: 13px; }
  .print-footer { position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: 9px; color: #666; }
  a[href]::after { content: ""; }
  [style*="overflow"], .table-scroll, .table-responsive, .sil-scroll { overflow: visible !important; max-height: none !important; height: auto !important; }
  details > *:not(summary) { display: block !important; }
  details summary { list-style: none; }
  details summary::-webkit-details-marker { display: none; }
  details summary::marker { content: ""; }
  .sig-cell, .sig-grid, .sig-wrap { page-break-inside: avoid !important; }
  textarea { height: auto !important; min-height: 1.6em; overflow: visible !important; white-space: pre-wrap !important; border: 1px solid #ccc !important; resize: none !important; }
}
@media screen { .print-footer { display: none; } }

/* ─── SAISIE DES CLIENTS DANS LA CAISSE (autocomplétion, identifiants) ─── */
.cl-ids { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; }
.cl-ids input { min-height: 34px !important; font-size: .82rem !important; }
.cl-err { color: var(--sil-crit); font-size: .78rem; font-weight: 600; margin-top: 3px; }
tr.cl-missing td { background: var(--sil-crit-soft) !important; }
tr.cl-missing .cl-ids input:placeholder-shown, tr.cl-missing input[name$="-nom_client"]:placeholder-shown { border-color: var(--sil-crit) !important; }
.ac-dropdown { position: absolute; z-index: 3500; background: var(--sil-surface); border: 1px solid var(--sil-line); border-radius: 12px;
  box-shadow: var(--sil-shadow-lg); max-height: 300px; overflow-y: auto; padding: 4px; }
.ac-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none;
  border-radius: 9px; padding: 7px 10px; cursor: pointer; color: var(--sil-ink); font-size: .86rem; }
.ac-item:hover, .ac-item:focus { background: var(--sil-brand-soft); }
.ac-item span { font-size: .76rem; color: var(--sil-muted); }
.ac-item .ac-other { font-style: normal; font-size: .74rem; font-weight: 700; color: #6d4bd1; }
.ac-empty { padding: 9px 10px; font-size: .82rem; color: var(--sil-muted); }
.ac-note { margin-top: 5px; font-size: .78rem; background: var(--sil-hint); border: 1px solid var(--sil-hint-line); border-radius: 8px; padding: 6px 8px; line-height: 1.35; }
.ac-use { margin-left: 4px; border: 0; background: var(--sil-brand); color: #fff; border-radius: 7px; padding: 3px 8px; font-size: .75rem; font-weight: 700; cursor: pointer; }
.ac-veh select { margin-top: 4px; min-height: 32px; font-size: .78rem; width: 100%; }
@media (max-width: 575.98px) { .cl-ids { grid-template-columns: 1fr; } }
#report-form .formset-row input.field-input, #report-form .formset-row select.field-input, .cl-ids input {
  width: 100%; min-height: 36px; border: 1px solid var(--sil-line); border-radius: 8px; padding: 4px 8px;
  background: var(--sil-surface); color: var(--sil-ink); font-size: .86rem; }
#report-form .formset-row input.field-input:focus, .cl-ids input:focus { outline: none; border-color: var(--sil-brand); box-shadow: 0 0 0 3px var(--sil-ring); }
/* Libellés expliqués par le glossaire : léger soulignement pointillé */
.sil-gl:not(.btn):not(button) { text-decoration: underline dotted color-mix(in srgb, var(--sil-brand) 45%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ═══════════ Éditeur d'impression (static/js/print-editor.js) ═══════════ */
.pe-dlg{border:0;padding:0;width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;display:none;grid-template-columns:330px minmax(0,1fr);background:#e9edf3}
.pe-dlg[open]{display:grid}
.pe-dlg::backdrop{background:rgba(0,26,77,.5)}
@media (max-width:760px){.pe-dlg[open]{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr)}.pe-cote{max-height:48dvh}}
.pe-cote{background:#fff;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:10px;border-right:1px solid #d6deea}
.pe-tete{display:flex;justify-content:space-between;align-items:center;font-size:1.05rem}
.pe-cote h4{font-size:.8rem;text-transform:uppercase;letter-spacing:.04em;color:#56627a;margin:6px 0 0}
.pe-pages{font-weight:800;font-size:1.1rem;padding:8px 12px;border-radius:10px;text-align:center}
.pe-pages.ok{background:#e2f4ec;color:#047857}.pe-pages.trop{background:#fff3d6;color:#8a5a00}
.pe-fit{display:flex;gap:6px}.pe-fit .btn{flex:1}
.pe-liste{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
.pe-liste li{display:flex;align-items:center;gap:6px;border:1px solid #e3e8f0;border-radius:8px;padding:4px 6px;font-size:.84rem}
.pe-liste .pe-t{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pe-liste button{border:0;background:#eef2f8;border-radius:6px;width:24px;height:24px;font-size:.7rem;cursor:pointer}
.pe-liste button:disabled{opacity:.3}
.pe-saut-l{font-size:.75rem;color:#56627a;white-space:nowrap}
.pe-grille{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.pe-grille label,.pe-curseur{font-size:.78rem;font-weight:700;color:#56627a;display:flex;flex-direction:column;gap:2px}
.pe-case{font-size:.86rem;display:flex;gap:8px;align-items:center}
.pe-note{font-size:.76rem;color:#56627a;margin:0}
.pe-actions{display:flex;gap:8px;justify-content:space-between;margin-top:auto;position:sticky;bottom:0;background:#fff;padding-top:8px}
.pe-zone{overflow:auto;padding:24px}
.pe-page{background:#fff;margin:0 auto;box-shadow:0 10px 30px rgba(0,26,77,.18);box-sizing:border-box;overflow:hidden}
#silPrintDoc{display:none}
.pe-doc{font-size:calc(13px * var(--pe-taille,1));color:#111;line-height:1.35}
.pe-doc table,.pe-doc td,.pe-doc th,.pe-doc .table{font-size:inherit}
.pe-doc .sil-card,.pe-doc .card{box-shadow:none!important;border:1px solid #cfd6e2;margin-bottom:8px}
.pe-doc > *{margin-bottom:8px}
.pe-doc .pe-saut{break-before:page;page-break-before:always}
.pe-doc tr,.pe-doc .sil-kpi{break-inside:avoid;page-break-inside:avoid}
.pe-doc .table-responsive{overflow:visible!important}
.pe-doc,.pe-doc *{max-width:100%!important;min-width:0!important}
.pe-doc table{width:100%!important;table-layout:auto}
.pe-doc th,.pe-doc td{white-space:normal!important;overflow-wrap:anywhere}
.pe-doc img{height:auto}
.pe-doc .print-section,.pe-doc .card,.pe-doc .sil-card,.pe-doc .print-block,.pe-doc details{break-inside:auto!important;page-break-inside:auto!important}
.pe-doc .pe-val{font-weight:600}
.pe-compact{line-height:1.2}
.pe-compact td,.pe-compact th{padding:2px 5px!important}
.pe-compact .sil-card,.pe-compact .card,.pe-compact .card-body{padding:6px 8px!important}
.pe-compact h1{font-size:1.3em}.pe-compact h2{font-size:1.12em}.pe-compact h3,.pe-compact h4{font-size:1em}
.pe-compact .sil-kpis{gap:4px}.pe-compact .sil-kpi{padding:4px 8px}
.pe-nb,.pe-nb *{color:#000!important;background:transparent!important;border-color:#999!important;box-shadow:none!important}
@media print{
  html.pe-impression body > *:not(#silPrintDoc){display:none!important}
  html.pe-impression #silPrintDoc{display:block!important}
  html.pe-impression body{background:#fff!important;margin:0;padding:0}
  .pe-doc{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* v23 — liste déroulante sortie d'un bandeau qui la coupait (js/dropdown-fix.js) */
.dropdown-menu.sil-dd-flottant { z-index: 4000; max-height: 70vh; overflow-y: auto; }
