/* Mizanga : charte commune des maquettes (administration, PWA citoyen) */

/* COULEURS DE LA CHARTE */
:root {
  --mz-bleu: #064593;
  --mz-bleu-rgb: 6, 69, 147;
  --mz-jaune: #FFB900;
  --mz-jaune-rgb: 255, 185, 0;
  --mz-rouge: #E9232B;
  --mz-rouge-rgb: 233, 35, 43;
  --mz-bleu-doux: #e8eef8;
  --mz-texte-marque: var(--mz-bleu);
  --mz-graph: var(--mz-bleu);
  --mz-surface: #ffffff;
  --mz-fond: #f5f7fb;
  --mz-ligne: #e3e8f0;

  --bs-primary: var(--mz-bleu);
  --bs-primary-rgb: var(--mz-bleu-rgb);
  --bs-warning: var(--mz-jaune);
  --bs-warning-rgb: var(--mz-jaune-rgb);
  --bs-danger: var(--mz-rouge);
  --bs-danger-rgb: var(--mz-rouge-rgb);
  --bs-link-color: var(--mz-bleu);
  --bs-link-color-rgb: var(--mz-bleu-rgb);
  --bs-link-hover-color: #04336d;
  --bs-body-font-family: "Nunito", system-ui, "Segoe UI", sans-serif;
  --bs-body-bg: var(--mz-fond);
}
[data-bs-theme="dark"] {
  --mz-bleu-doux: #142744;
  --mz-texte-marque: #ffffff;
  --mz-graph: #6f9ee8;
  --mz-surface: #1b2230;
  --mz-fond: #11161f;
  --mz-ligne: #2b3445;
  --bs-primary: #3f7fd9;
  --bs-primary-rgb: 63, 127, 217;
  --bs-link-color: #8db4f0;
  --bs-link-color-rgb: 141, 180, 240;
  --bs-link-hover-color: #b5cff6;
  --bs-body-bg: var(--mz-fond);
}

/* TYPOGRAPHIE : Fredoka (titres, proche du logo), Nunito (texte) */
body { background: var(--mz-fond); }
h1, h2, h3, h4, h5, .mz-titre, .mz-marque { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; }
.mz-marque { color: var(--mz-texte-marque); letter-spacing: .01em; }

/* BOUTONS */
.btn-primary {
  --bs-btn-bg: var(--mz-bleu); --bs-btn-border-color: var(--mz-bleu);
  --bs-btn-hover-bg: #05397a; --bs-btn-hover-border-color: #05397a;
  --bs-btn-active-bg: #04306a; --bs-btn-active-border-color: #04306a;
  --bs-btn-disabled-bg: var(--mz-bleu); --bs-btn-disabled-border-color: var(--mz-bleu);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-bg: #2f6fca; --bs-btn-border-color: #2f6fca;
  --bs-btn-hover-bg: #3f7fd9; --bs-btn-hover-border-color: #3f7fd9;
}
.btn-outline-primary {
  --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
}
.btn-accent {
  --bs-btn-bg: var(--mz-jaune); --bs-btn-border-color: var(--mz-jaune); --bs-btn-color: #1f2328;
  --bs-btn-hover-bg: #e6a700; --bs-btn-hover-border-color: #e6a700; --bs-btn-hover-color: #1f2328;
  --bs-btn-active-bg: #cc9400; --bs-btn-active-border-color: #cc9400;
  font-weight: 700;
}
.btn-danger { --bs-btn-bg: var(--mz-rouge); --bs-btn-border-color: var(--mz-rouge); --bs-btn-hover-bg: #c81c23; --bs-btn-hover-border-color: #c81c23; }
.text-bg-warning { color: #1f2328 !important; }

/* CARTES ET TABLEAUX */
.card { --bs-card-bg: var(--mz-surface); --bs-card-border-color: var(--mz-ligne); border-radius: 12px; }
.card-header { background: transparent; font-family: "Fredoka", sans-serif; font-weight: 600; }
.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); font-weight: 700; white-space: nowrap; }
.table td { vertical-align: middle; }
.mz-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
code.mz-cle { font-size: .85em; color: var(--bs-body-color); background: var(--mz-bleu-doux); padding: .15em .45em; border-radius: 6px; }

/* COQUILLE DE L'ADMINISTRATION */
.mz-shell { display: flex; min-height: 100vh; }
.mz-nav {
  width: 248px; flex: 0 0 248px; background: var(--mz-surface); border-right: 1px solid var(--mz-ligne);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.mz-nav .mz-nav-marque { display: flex; align-items: center; gap: 10px; padding: 18px 20px; text-decoration: none; }
.mz-nav .mz-nav-marque img { width: 40px; height: auto; }
.mz-nav .mz-nav-marque span { font-size: 1.45rem; }
.mz-nav .mz-groupe { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bs-secondary-color); padding: 14px 22px 6px; font-weight: 700; }
.mz-nav a.mz-lien {
  display: flex; align-items: center; gap: 12px; padding: 8px 20px 8px 19px; margin: 1px 10px; border-radius: 8px;
  color: var(--bs-body-color); text-decoration: none; border-left: 3px solid transparent; font-weight: 600; font-size: .95rem;
}
.mz-nav a.mz-lien i { font-size: 1.1rem; color: var(--bs-secondary-color); width: 20px; text-align: center; }
.mz-nav a.mz-lien:hover { background: var(--mz-bleu-doux); }
.mz-nav a.mz-lien.active { background: var(--mz-bleu-doux); border-left-color: var(--mz-jaune); color: var(--bs-primary); }
.mz-nav a.mz-lien.active i { color: var(--bs-primary); }
.mz-nav .mz-nav-bas { margin-top: auto; padding: 14px 20px; font-size: .8rem; color: var(--bs-secondary-color); border-top: 1px solid var(--mz-ligne); }

.mz-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mz-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--mz-surface);
  border-bottom: 1px solid var(--mz-ligne); position: sticky; top: 0; z-index: 10;
}
.mz-top .mz-fil { font-size: .85rem; color: var(--bs-secondary-color); }
.mz-top .mz-fil a { color: inherit; text-decoration: none; }
.mz-top h1 { font-size: 1.35rem; margin: 0; }
.mz-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mz-jaune); color: #1f2328; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; }
.mz-contenu { padding: 24px 28px; flex: 1; }
.mz-pied { padding: 14px 28px; font-size: .8rem; color: var(--bs-secondary-color); border-top: 1px solid var(--mz-ligne); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 991.98px) {
  .mz-nav { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .mz-nav.ouvert { transform: none; }
  .mz-top { padding: 10px 16px; }
  .mz-contenu { padding: 16px; }
  .mz-pied { padding: 12px 16px; }
}

/* TUILES CHIFFRES */
.mz-tuile { background: var(--mz-surface); border: 1px solid var(--mz-ligne); border-radius: 12px; padding: 16px 18px; height: 100%; }
.mz-tuile .mz-tuile-libelle { font-size: .85rem; color: var(--bs-secondary-color); font-weight: 600; }
.mz-tuile .mz-tuile-valeur { font-family: "Fredoka", sans-serif; font-size: 1.75rem; font-weight: 600; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mz-tuile .mz-tuile-note { font-size: .8rem; color: var(--bs-secondary-color); margin-top: 2px; }

/* JAUGE DE SOLDE */
.mz-jauge { height: 8px; border-radius: 4px; background: var(--mz-ligne); overflow: hidden; min-width: 80px; }
.mz-jauge > span { display: block; height: 100%; border-radius: 4px; background: var(--bs-primary); }
.mz-jauge.bas > span { background: var(--mz-jaune); }
.mz-jauge.vide > span { background: var(--mz-rouge); }

/* GRAPHIQUE EN BARRES (une seule serie) */
.mz-graph { position: relative; }
.mz-graph svg { width: 100%; height: 220px; display: block; overflow: visible; }
.mz-graph .barre { fill: var(--mz-graph); }
.mz-graph .barre:hover, .mz-graph .zone:hover + .barre { opacity: .8; }
.mz-graph .grille { stroke: var(--mz-ligne); stroke-width: 1; }
.mz-graph .axe { fill: var(--bs-secondary-color); font-size: 11px; font-family: "Nunito", sans-serif; }
.mz-bulle { position: absolute; pointer-events: none; background: var(--bs-body-color); color: var(--bs-body-bg); font-size: .8rem; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); display: none; z-index: 5; }

/* PASTILLES D'ETAT */
.mz-etat { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: .25em .65em; border-radius: 999px; white-space: nowrap; }
.mz-etat i { font-size: .9em; }
.mz-etat.ok { background: rgba(25, 135, 84, .12); color: #146c43; }
.mz-etat.attente { background: rgba(var(--mz-jaune-rgb), .18); color: #8a6100; }
.mz-etat.ko { background: rgba(var(--mz-rouge-rgb), .12); color: #b3141b; }
.mz-etat.neutre { background: var(--mz-bleu-doux); color: var(--bs-primary); }
.mz-etat.gris { background: var(--mz-ligne); color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .mz-etat.ok { color: #75d6a5; }
[data-bs-theme="dark"] .mz-etat.attente { color: #ffd466; }
[data-bs-theme="dark"] .mz-etat.ko { color: #ff8a8f; }

/* NOTE DE MAQUETTE */
.mz-note-maquette { border: 1px dashed var(--mz-jaune); background: rgba(var(--mz-jaune-rgb), .08); border-radius: 10px; padding: 10px 14px; font-size: .85rem; }

/* PAGE DE CONNEXION (petite page d'accueil) */
.mz-accueil { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.mz-accueil-presentation {
  background: linear-gradient(160deg, #064593 0%, #04336d 70%, #032553 100%); color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.mz-accueil-presentation::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
  border: 40px solid rgba(255, 185, 0, .14);
}
.mz-accueil-presentation .mz-bandeau { display: flex; align-items: center; gap: 12px; }
.mz-accueil-presentation .mz-bandeau .pastille { background: #fff; border-radius: 16px; padding: 6px; display: inline-flex; }
.mz-accueil-presentation .mz-bandeau img { width: 44px; }
.mz-accueil-presentation h1 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.12; margin: 48px 0 16px; max-width: 16ch; }
.mz-accueil-presentation h1 em { font-style: normal; color: var(--mz-jaune); }
.mz-accueil-presentation .accroche { font-size: 1.1rem; opacity: .9; max-width: 46ch; }
.mz-piliers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 40px; max-width: 720px; position: relative; z-index: 1; }
.mz-pilier { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; padding: 16px; }
.mz-pilier i { font-size: 1.4rem; color: var(--mz-jaune); }
.mz-pilier strong { display: block; margin: 8px 0 4px; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.05rem; }
.mz-pilier span { font-size: .88rem; opacity: .85; }
.mz-domaines { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; position: relative; z-index: 1; }
.mz-domaines span { background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 5px 12px; font-size: .85rem; }
.mz-domaines span b { color: var(--mz-jaune); font-weight: 700; }
.mz-accueil-presentation .mz-bas { margin-top: auto; padding-top: 40px; font-size: .85rem; opacity: .75; position: relative; z-index: 1; }
.mz-accueil-formulaire { background: var(--mz-surface); display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.mz-accueil-formulaire .boite { width: 100%; max-width: 380px; margin: 0 auto; }
.mz-accueil-formulaire .logo-complet { width: 132px; display: block; margin: 0 auto 18px; }
@media (max-width: 900px) {
  .mz-accueil { grid-template-columns: 1fr; }
  .mz-accueil-presentation { padding: 28px 20px 36px; }
  .mz-accueil-presentation h1 { margin-top: 28px; }
  .mz-piliers { grid-template-columns: 1fr; }
  .mz-accueil-formulaire { padding: 32px 16px; }
}

/* BON DE COMMANDE IMPRIMABLE */
.mz-bon { background: #fff; color: #1f2328; border: 1px solid var(--mz-ligne); border-radius: 12px; padding: 32px; }
.mz-bon .table { --bs-table-color: #1f2328; }
.mz-bon .entete { display: flex; justify-content: space-between; gap: 24px; border-bottom: 3px solid var(--mz-bleu); padding-bottom: 16px; }
.mz-bon .entete img { width: 64px; }
.mz-bon .total td { font-weight: 800; border-top: 2px solid var(--mz-bleu); }
@media print {
  .mz-nav, .mz-top, .mz-pied, .no-print { display: none !important; }
  .mz-contenu { padding: 0; }
  .mz-bon { border: none; padding: 0; }
}

/* LIENS : soulignes au survol seulement */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.mz-nav a:hover, .dropdown-item:hover, .btn:hover { text-decoration: none; }

/* RETOURS A LA LIGNE */
.mz-contenu .btn, .mz-etat, .badge { white-space: nowrap; }
.mz-bon .entete .mz-titre { white-space: nowrap; }
.mz-nowrap { white-space: nowrap; }

/* TELEPHONE : jamais de defilement horizontal de la page */
.mz-accueil > *, .mz-piliers > *, .mz-main, .mz-contenu, .mz-contenu .row > * { min-width: 0; }
@media (max-width: 900px) {
  .mz-accueil { grid-template-columns: minmax(0, 1fr); }
  .mz-piliers { grid-template-columns: minmax(0, 1fr); }
}

code.mz-cle, .table td > a { white-space: nowrap; }

/* SURFACES COLOREES : en-tetes de tableaux, de cartes et de modales */
:root { --mz-entete: #e8eef8; --mz-entete-texte: #064593; --mz-carte-entete: #f3f6fb; }
[data-bs-theme="dark"] { --mz-entete: #1d2c45; --mz-entete-texte: #b5cff6; --mz-carte-entete: #202a3b; }
.table > thead th { --bs-table-bg: var(--mz-entete); --bs-table-color: var(--mz-entete-texte); color: var(--mz-entete-texte); border-bottom-color: var(--mz-ligne); }
.card-header { background: var(--mz-carte-entete); border-bottom-color: var(--mz-ligne); }
.card-footer { background: var(--mz-carte-entete); }
.modal-header { background: var(--mz-bleu); color: #fff; border-bottom: 3px solid var(--mz-jaune); }
.modal-header .btn-close { filter: var(--bs-btn-close-white-filter); opacity: .8; }
.modal-footer { background: var(--mz-carte-entete); }
.modal-content { overflow: hidden; }
[data-bs-theme="dark"] .modal-header { background: #0d2a55; }
.nav-tabs .nav-link.active { background: var(--mz-surface); border-top: 3px solid var(--mz-jaune); }
.mz-bon .table > thead th { --bs-table-bg: #e8eef8; --bs-table-color: #064593; color: #064593; }

/* REVISION : en-tetes de tableaux en bleu soutenu, aucun soulignement */
:root { --mz-entete: #064593; --mz-entete-texte: #ffffff; }
[data-bs-theme="dark"] { --mz-entete: #0d2a55; --mz-entete-texte: #e6eefb; }
.table > thead th { border-bottom: 0; }
.mz-bon .table > thead th { --bs-table-bg: #064593; --bs-table-color: #ffffff; color: #ffffff; }
.modal-header { border-bottom: 0; }
.nav-tabs .nav-link.active { border-top: var(--bs-border-width) solid var(--bs-border-color); }
a:hover { text-decoration: none; }
.btn-link, .btn-link:hover { text-decoration: none; }

/* BOITES DE CONFIRMATION (SweetAlert2) : aux couleurs du theme, clair ou sombre */
.swal2-popup { background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: .75rem; font-size: 1rem; }
.swal2-html-container { color: var(--bs-body-color); }
