/* CYBERLOGIC — contact@cyberlogic.fr — www.cyberlogic.fr
   Tous droits réservés.
   Feuille de style du back-office CyberShield.
   Aucun style en ligne dans les vues : la politique de sécurité du contenu
   (CSP) interdit 'unsafe-inline'. Tout nouveau style vient ici. */

:root {
    --fond:        #f4f6fb;
    --surface:     #ffffff;
    --encre:       #111a2e;
    --encre-douce: #4a5568;
    --bord:        #dde1ec;
    --accent:      #4c5fd7;
    --accent-fonce:#3b4bb8;
    --accent-pale: #eef0fb;
    --ok:          #15803d;
    --ok-pale:     #e8f6ed;
    --attention:   #a16207;
    --attention-pale:#fdf4e3;
    --critique:    #b42318;
    --critique-pale:#fdeceb;
    --rayon:       10px;

    /* Barre latérale — un bezel d'appareil de mesure autour d'un document
       clair. Bleu nuit, pas noir : le noir pur écrase les reliefs. */
    --rail-fond:   #0b1220;
    --rail-haut:   #141f38;
    --rail-fil:    rgba(255,255,255,.10);
    --rail-texte:  #94a3c4;
    --rail-vif:    #ffffff;
    --signal:      #8aa0ff;   /* même famille que --accent, sans virer au néon */
    --rail-largeur: 248px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--encre);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

.bo-body { display: flex; min-height: 100vh; align-items: stretch; }
.bo-body--nu { display: block; }
.bo-zone { flex: 1 1 auto; min-width: 0; }

/* Premier élément focusable : sortir de la navigation au clavier sans
   parcourir les six entrées du menu à chaque page. */
.bo-evitement {
    position: absolute; left: -9999px; top: 0; z-index: 10;
    background: var(--accent); color: #fff; padding: 10px 16px;
    border-radius: 0 0 var(--rayon) 0; text-decoration: none;
}
.bo-evitement:focus { left: 0; }

/* ─── Barre latérale ──────────────────────────────────────────────── */
/* Le fil vertical et les nœuds reprennent le motif de la chaîne
   d'empreintes : chaque section est un maillon posé sur un fil continu. */
.bo-rail {
    flex: 0 0 var(--rail-largeur);
    width: var(--rail-largeur);
    background: linear-gradient(180deg, var(--rail-haut) 0%, var(--rail-fond) 42%);
    color: var(--rail-texte);
    display: flex; flex-direction: column;
    position: sticky; top: 0; align-self: flex-start;
    height: 100vh;
}

.bo-rail__marque { padding: 24px 20px 20px; }
.bo-rail__nom {
    display: block; color: var(--rail-vif);
    font-size: 1.08rem; font-weight: 600; letter-spacing: -.012em;
}
.bo-rail__role {
    display: block; margin-top: 2px;
    /* #64748f ne donnait que 3,46:1 sur le haut du dégradé — insuffisant
       pour du texte de 12,8 px. Celui-ci monte à 5,3:1. */
    color: #8593b5; font-size: .8rem;
}

.bo-rail__nav { position: relative; padding: 6px 0; flex: 1 1 auto; overflow-y: auto; }
/* Le fil. Il passe exactement par le centre des nœuds (voir le calcul
   dans .bo-rail__noeud) et s'arrête avant le premier et le dernier. */
.bo-rail__nav::before {
    content: ''; position: absolute;
    left: 26px; top: 16px; bottom: 16px; width: 1px;
    background: var(--rail-fil);
}

.bo-rail__lien {
    position: relative; display: flex; align-items: center; gap: 14px;
    padding: 10px 18px; color: var(--rail-texte);
    text-decoration: none; font-size: .95rem;
    transition: color .15s ease, background-color .15s ease;
}
/* padding-left 18 + marge 4 = le nœud occupe 22→31 px, centre à 26,5 px :
   le fil posé à left:26px (1 px) passe donc pile au milieu. */
.bo-rail__noeud {
    flex: 0 0 9px; width: 9px; height: 9px; margin-left: 4px;
    border-radius: 50%; border: 1.5px solid #39486b; background: var(--rail-fond);
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.bo-rail__libelle { min-width: 0; }

.bo-rail__lien:hover { color: #d7deef; background: rgba(255,255,255,.04); }
.bo-rail__lien:hover .bo-rail__noeud { border-color: #6b7da8; }

.bo-rail__lien.is-active { color: var(--rail-vif); font-weight: 500; }
.bo-rail__lien.is-active .bo-rail__noeud {
    border-color: var(--signal); background: var(--signal);
    box-shadow: 0 0 0 4px rgba(138,160,255,.16);
}
/* Teinte très légère, qui s'efface vers la droite : le nœud reste le
   marqueur, le fond ne fait que l'accompagner. */
.bo-rail__lien.is-active::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(138,160,255,.12), transparent 72%);
    pointer-events: none;
}

.bo-rail__pied {
    border-top: 1px solid rgba(255,255,255,.07);
    padding: 16px 20px 20px;
}
.bo-rail__compte {
    display: block; color: #c3cbe0; font-size: .9rem;
    text-decoration: none; margin-bottom: 10px; word-break: break-word;
}
.bo-rail__compte:hover { color: var(--rail-vif); text-decoration: underline; }
.bo-rail__sortie {
    width: 100%; padding: 8px 12px; font: inherit; font-size: .88rem;
    color: var(--rail-texte); background: transparent;
    border: 1px solid rgba(255,255,255,.14); border-radius: 8px; cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.bo-rail__sortie:hover {
    color: var(--rail-vif); border-color: rgba(255,255,255,.3);
    background: rgba(255,255,255,.06);
}

.bo-rail a:focus-visible,
.bo-rail button:focus-visible,
.bo-evitement:focus-visible {
    outline: 2px solid var(--signal); outline-offset: -2px;
}

/* ─── Mise en page ────────────────────────────────────────────────── */
.bo-main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }
.bo-main--nu { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.bo-footer {
    max-width: 1180px; margin: 0 auto; padding: 0 32px 32px;
    color: var(--encre-douce); font-size: .82rem;
}

.bo-titre { font-size: 1.7rem; margin: 0 0 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bo-sous-titre { font-size: 1.15rem; margin: 34px 0 12px; }
.bo-chapo { color: var(--encre-douce); margin: 0 0 24px; }
.bo-fil { color: var(--encre-douce); font-size: .88rem; margin: 0 0 10px; }
.bo-petit { color: var(--encre-douce); font-size: .8rem; display: block; }
.bo-vide { color: var(--encre-douce); background: var(--surface); border: 1px dashed var(--bord);
           border-radius: var(--rayon); padding: 22px; }
.bo-lien { color: var(--accent); }
.bo-optionnel { color: var(--encre-douce); font-weight: 400; }

/* ─── Messages ────────────────────────────────────────────────────── */
.bo-flashes { margin-bottom: 20px; }
.bo-flash { border-radius: var(--rayon); padding: 12px 16px; margin: 0 0 8px; border: 1px solid; }
.bo-flash--ok        { background: var(--ok-pale);        border-color: #b7e0c6; color: var(--ok); }
.bo-flash--attention { background: var(--attention-pale); border-color: #f0dca8; color: var(--attention); }
.bo-flash--erreur    { background: var(--critique-pale);  border-color: #f3c0bc; color: var(--critique); }

/* ─── Cartes et alertes ───────────────────────────────────────────── */
.bo-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.bo-carte {
    background: var(--surface); border: 1px solid var(--bord);
    border-radius: var(--rayon); padding: 18px 20px;
}
.bo-carte__valeur { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; }
.bo-carte__legende { color: var(--encre-douce); font-size: .88rem; }

.bo-alertes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.bo-alerte {
    display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
    border: 1px solid; border-radius: var(--rayon); padding: 16px 18px;
}
.bo-alerte--attention { background: var(--attention-pale); border-color: #f0dca8; }
.bo-alerte--critique  { background: var(--critique-pale);  border-color: #f3c0bc; }
.bo-alerte__nombre { font-size: 1.7rem; font-weight: 700; }
.bo-alerte__texte  { font-size: .92rem; }

/* ─── Blocs ───────────────────────────────────────────────────────── */
.bo-bloc {
    background: var(--surface); border: 1px solid var(--bord);
    border-radius: var(--rayon); padding: 20px 22px; margin: 0 0 20px;
}
.bo-bloc--accent { border-color: var(--accent); background: var(--accent-pale); }
.bo-bloc__titre { font-size: 1.05rem; margin: 0 0 6px; }
.bo-bloc__sous-titre { font-size: .95rem; margin: 18px 0 6px; }
.bo-bloc__aide { color: var(--encre-douce); font-size: .88rem; margin: 0 0 14px; }
.bo-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; margin-bottom: 20px; }
.bo-colonnes .bo-bloc { margin: 0; }

.bo-defs { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: .92rem; }
.bo-defs dt { color: var(--encre-douce); }
.bo-defs dd { margin: 0; }

.bo-totaux {
    margin-top: 16px; justify-content: flex-end;
    grid-template-columns: auto auto; width: max-content; margin-left: auto;
}
.bo-totaux dd { text-align: right; font-variant-numeric: tabular-nums; }

/* Répartition des événements : deux colonnes, le nombre aligné à droite
   et en chiffres tabulaires pour que les ordres de grandeur se comparent
   d'un coup d'œil. */
.bo-repartition { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.bo-repartition__ligne {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 5px 0; border-bottom: 1px solid var(--bord);
}
.bo-repartition__ligne:last-child { border-bottom: none; }
.bo-repartition__type { color: var(--encre-douce); word-break: break-word; }
.bo-repartition__n { font-variant-numeric: tabular-nums; font-weight: 600; }

.bo-pre { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon);
          padding: 14px; overflow-x: auto; font-size: .9rem; margin: 0; }
.bo-code { background: #f1f3f9; border-radius: 4px; padding: 1px 6px; font-size: .86rem; word-break: break-all; }

/* ─── Formulaires ─────────────────────────────────────────────────── */
.bo-form { margin: 0 0 4px; }
.bo-form--sep { border-top: 1px solid var(--bord); padding-top: 16px; margin-top: 16px; }
.bo-form--inline { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.bo-form--large { max-width: 100%; }
.bo-form__ligne { display: flex; gap: 16px; flex-wrap: wrap; }
.bo-form__champ { display: flex; flex-direction: column; min-width: 180px; }

.bo-label { display: block; font-size: .86rem; color: var(--encre-douce); margin: 10px 0 4px; }
.bo-form--inline .bo-label { margin-top: 0; }
.bo-input {
    width: 100%; padding: 9px 11px; font: inherit; color: var(--encre);
    background: #fff; border: 1px solid var(--bord); border-radius: 8px;
}
.bo-input:focus { outline: 3px solid rgba(76,95,215,.25); border-color: var(--accent); }
.bo-input--court { width: 180px; }
/* « 24 mois (2 ans — durée standard) » ne tient pas dans 180 px :
   la liste se dimensionne sur son contenu plutôt que de le rogner. */
.bo-input--duree { width: auto; min-width: 220px; }
.bo-textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; }

.bo-btn {
    display: inline-block; padding: 9px 16px; font: inherit; font-weight: 600;
    border-radius: 8px; border: 1px solid transparent; cursor: pointer;
    text-decoration: none; text-align: center;
}
.bo-btn--bloc { display: block; width: 100%; margin-top: 16px; }
.bo-btn--primary  { background: var(--accent); color: #fff; }
.bo-btn--primary:hover { background: var(--accent-fonce); }
.bo-btn--ghost    { background: transparent; color: var(--accent); border-color: var(--bord); }
.bo-btn--ghost:hover { background: var(--accent-pale); }
.bo-header .bo-btn--ghost { color: #c3cbe0; border-color: rgba(255,255,255,.25); }
.bo-header .bo-btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.bo-btn--attention { background: var(--attention); color: #fff; }
.bo-btn--critique  { background: var(--critique); color: #fff; }
.bo-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ─── Tableaux ────────────────────────────────────────────────────── */
.bo-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden;
    font-size: .92rem;
}
.bo-table th, .bo-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--bord); }
.bo-table th { background: #f7f8fc; font-weight: 600; color: var(--encre-douce); font-size: .84rem; }
.bo-table tr:last-child td { border-bottom: none; }
.bo-td--attention { background: var(--attention-pale); }
.bo-td--critique  { background: var(--critique-pale); }

.bo-pastille {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: .78rem; font-weight: 600; border: 1px solid;
}
.bo-pastille--stock    { background: #f1f3f9; border-color: var(--bord); color: var(--encre-douce); }
.bo-pastille--expedie  { background: var(--accent-pale); border-color: #c3cbee; color: var(--accent-fonce); }
.bo-pastille--active   { background: var(--ok-pale); border-color: #b7e0c6; color: var(--ok); }
.bo-pastille--suspendu { background: var(--attention-pale); border-color: #f0dca8; color: var(--attention); }
.bo-pastille--revoque  { background: var(--critique-pale); border-color: #f3c0bc; color: var(--critique); }

.bo-pagination { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.bo-pagination__etat { color: var(--encre-douce); font-size: .88rem; }

/* ─── Connexion ───────────────────────────────────────────────────── */
.bo-login { width: 100%; max-width: 400px; }
.bo-login__card {
    background: var(--surface); border: 1px solid var(--bord);
    border-radius: 14px; padding: 32px 30px;
}
.bo-login__titre { margin: 0; font-size: 1.5rem; }
.bo-login__sous-titre { color: var(--encre-douce); margin: 4px 0 22px; font-size: .92rem; }
.bo-login__aide { color: var(--encre-douce); font-size: .9rem; margin: 0 0 6px; }
.bo-login__note { color: var(--encre-douce); font-size: .8rem; margin: 18px 0 0; text-align: center; }

/* ─── Écrans étroits ──────────────────────────────────────────────── */
/* Sous 980 px, la colonne devient un bandeau : le fil vertical n'aurait
   plus de sens couché, on le retire plutôt que de le tordre. */
@media (max-width: 980px) {
    .bo-body { display: block; }
    .bo-rail {
        width: auto; height: auto; position: static;
        flex-direction: row; align-items: center; gap: 8px;
        padding: 0 8px; flex-wrap: wrap;
        background: linear-gradient(180deg, var(--rail-haut), var(--rail-fond));
    }
    .bo-rail__marque { padding: 12px 10px; display: flex; align-items: baseline; gap: 10px; }
    .bo-rail__role { margin-top: 0; }
    .bo-rail__nav { order: 3; width: 100%; display: flex; overflow-x: auto; padding: 0 0 8px; }
    .bo-rail__nav::before { display: none; }
    .bo-rail__lien { padding: 8px 12px; white-space: nowrap; border-radius: var(--rayon); }
    .bo-rail__lien.is-active::before { border-radius: var(--rayon); }
    .bo-rail__noeud { margin-left: 0; }
    .bo-rail__pied {
        border-top: none; padding: 8px 10px; margin-left: auto;
        display: flex; align-items: center; gap: 12px;
    }
    .bo-rail__compte { margin-bottom: 0; }
    .bo-rail__sortie { width: auto; }
}

@media (max-width: 720px) {
    .bo-main { padding: 20px 16px 48px; }
    .bo-footer { padding: 0 16px 24px; }
    .bo-defs { grid-template-columns: 1fr; gap: 2px; }
    .bo-defs dd { margin-bottom: 8px; }
    .bo-rail__pied { width: 100%; margin-left: 0; }
}

/* Une personne qui a demandé moins d'animation n'en reçoit aucune. */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ─────────────────────────────────────────────────────────────────────
   Statuts de facture — mêmes pastilles que le parc, autres mots.
   ───────────────────────────────────────────────────────────────── */
.bo-pastille--brouillon { background: #f1f3f9; border-color: var(--bord); color: var(--encre-douce); }
.bo-pastille--emise     { background: var(--accent-pale); border-color: #c3cbee; color: var(--accent-fonce); }
.bo-pastille--payee     { background: var(--ok-pale); border-color: #b7e0c6; color: var(--ok); }
.bo-pastille--annulee   { background: var(--critique-pale); border-color: #f3c0bc; color: var(--critique); }

/* ─────────────────────────────────────────────────────────────────────
   Facture imprimable
   ─────────────────────────────────────────────────────────────────────
   Un document, pas un écran : largeur de page, pas de couleur de fond à
   imprimer, et aucune coupure de tableau au milieu d'une ligne. */
.bo-impression {
    background: #fff; color: var(--encre);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0; padding: 24px;
}
.fa { max-width: 760px; margin: 0 auto; }
.fa p { margin: 0 0 2px; }
.fa__entete { display: flex; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.fa__emetteur { font-size: .9rem; }
.fa__nom { font-weight: 600; }
.fa__legal { color: var(--encre-douce); font-size: .82rem; }
.fa__titre { text-align: right; }
.fa__titre h1 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: .08em; }
.fa__numero { font-weight: 600; font-size: 1.05rem; }
.fa__client {
    border: 1px solid var(--bord); border-radius: 6px;
    padding: 12px 14px; margin-bottom: 24px; max-width: 360px; margin-left: auto;
}
.fa__etiquette { color: var(--encre-douce); font-size: .8rem; margin-bottom: 4px; }
.fa__lignes { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.fa__lignes th, .fa__lignes td {
    padding: 8px 10px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top;
}
.fa__lignes thead th { border-bottom: 2px solid var(--encre); font-size: .84rem; }
.fa__num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fa__totaux { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.fa__totaux table { border-collapse: collapse; min-width: 300px; }
.fa__totaux th { text-align: left; font-weight: 400; padding: 5px 12px 5px 0; }
.fa__totaux td { padding: 5px 0; }
.fa__ttc th, .fa__ttc td { border-top: 2px solid var(--encre); font-weight: 700; padding-top: 8px; }
.fa__mention { margin: 14px 0; font-size: .9rem; }
.fa__pied {
    border-top: 1px solid var(--bord); padding-top: 14px; margin-top: 24px; font-size: .88rem;
}

@media print {
    .bo-impression { padding: 0; }
    .fa { max-width: none; }
    .fa__lignes tr, .fa__totaux { page-break-inside: avoid; }
    .fa__pied { page-break-inside: avoid; }
    a[href]::after { content: ""; }
}

/* ─────────────────────────────────────────────────────────────────────
   Espace client
   ─────────────────────────────────────────────────────────────────────
   Sobre et sans rail : le client consulte deux ou trois choses, il ne
   parcourt pas une application. */
.bo-body--espace { display: block; background: var(--fond); }

.es-barre {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 24px; background: var(--rail-fond); color: #fff;
}
.es-barre__nom { font-weight: 600; letter-spacing: .02em; }
.es-barre__role { color: var(--rail-texte); font-size: .82rem; margin-left: 10px; }
.es-barre__compte { display: flex; align-items: center; gap: 14px; }
.es-barre__titulaire { color: var(--rail-texte); font-size: .9rem; }
.es-barre .bo-btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.es-barre .bo-btn--ghost:hover { background: rgba(255,255,255,.08); }

.es-main { max-width: 920px; margin: 0 auto; padding: 28px 24px 56px; }
.es-carte {
    max-width: 420px; margin: 48px auto; background: var(--surface);
    border: 1px solid var(--bord); border-radius: 10px; padding: 28px;
}
.es-pied {
    max-width: 920px; margin: 0 auto; padding: 0 24px 32px;
    color: var(--encre-douce); font-size: .84rem;
}

@media (max-width: 720px) {
    .es-barre { flex-direction: column; align-items: flex-start; gap: 10px; }
    .es-main { padding: 20px 16px 40px; }
    .es-carte { margin: 20px auto; padding: 20px; }
}

/* Lien de paiement : imprimé, il doit rester lisible et copiable. */
.fa__lien { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem;
            word-break: break-all; color: var(--encre-douce); }

/* Statuts d'un devis. */
.bo-pastille--envoye  { background: var(--accent-pale); border-color: #c3cbee; color: var(--accent-fonce); }
.bo-pastille--accepte { background: var(--ok-pale); border-color: #b7e0c6; color: var(--ok); }
.bo-pastille--refuse  { background: var(--critique-pale); border-color: #f3c0bc; color: var(--critique); }
.bo-pastille--expire  { background: var(--attention-pale); border-color: #f0dca8; color: var(--attention); }

/* Cadre d'accord d'un devis : de la place pour une signature à la main. */
.fa__accord {
    margin-top: 22px; border: 1px solid var(--bord); border-radius: 6px;
    padding: 12px 14px 56px; max-width: 320px;
}
