/* Charte Elit-Technologies : le bleu porte la structure, le violet ponctue,
   le vert signale le positif (remplissage seulement), le gris recule. */
:root {
  --elit-bleu: #124188;
  --elit-violet: #997ADB;
  --elit-vert: #AEC353;
  --elit-gris: #939599;
  --elit-bleu-nuit: #0E1628;
  --elit-bleu-700: #0D3470;
  --elit-bleu-800: #082554;
  --elit-bleu-100: #D9E1F2;
  --elit-bleu-50: #EEF2FA;
  --elit-gris-2: #4A5468;
  --elit-filet: #D6DEEC;
  --elit-filet-subtil: #E9EEF6;

  --fond: #FFFFFF;
  --fond-alt: var(--elit-bleu-50);
  --texte: #222222;
  --texte-secondaire: var(--elit-gris-2);
  --accent: var(--elit-bleu);
  --accent-fort: var(--elit-bleu-700);
  --accent-2: var(--elit-violet);
  --succes: var(--elit-vert);
  --bordure: var(--elit-filet);
  --bordure-champ: var(--elit-gris);
  --bordure-subtile: var(--elit-filet-subtil);
  --bandeau: var(--elit-bleu);

  --police: Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: var(--elit-bleu-nuit);
    --fond-alt: #16203A;
    --texte: var(--elit-bleu-100);
    --texte-secondaire: #93A3BF;
    --accent: #6FA0E6;
    --accent-fort: #6FA0E6;
    --bordure: #2A3654;
    --bordure-champ: #2A3654;
    --bordure-subtile: #1C2540;
    --bandeau: var(--elit-bleu-800);
  }
}

* { box-sizing: border-box; }
html { background: var(--fond-alt); }
body { margin: 0; min-height: 100vh; font: 16px/1.45 var(--police); background: var(--fond-alt); color: var(--texte); }
main { max-width: 760px; margin: 0 auto; padding: 16px; }

/* Bandeau : fond bleu, logo blanc */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bandeau); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 32px; width: auto; display: block; }
.brand span { font-weight: 700; font-size: 17px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .45); }
nav { display: flex; gap: 16px; align-items: center; }
nav a, nav .link { color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; }

h1 { font-size: 24px; margin: 8px 0; color: var(--accent); }
h2 { font-size: 17px; margin: 24px 0 8px; color: var(--accent); padding-bottom: 4px; border-bottom: 1px solid var(--bordure); }
.card { background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px; padding: 16px; margin: 16px 0; }
.narrow { max-width: 420px; margin: 32px auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label { display: block; margin: 12px 0; font-weight: 700; font-size: 14px; color: var(--texte); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 12px; font: inherit; font-weight: 400; border: 1px solid var(--bordure-champ); border-radius: 8px; background: var(--fond); color: var(--texte); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: var(--accent); }
label.check, label.chip { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input, label.chip input { width: auto; margin: 0; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--bordure-champ); border-radius: 999px; padding: 8px 16px; margin: 0; background: var(--fond); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--elit-bleu-100); color: #222222; }

button, .button { display: inline-block; padding: 12px 18px; font: inherit; font-weight: 700; border-radius: 8px; border: 1px solid var(--accent); background: var(--fond); color: var(--accent); cursor: pointer; text-decoration: none; text-align: center; }
.primary { background: var(--elit-bleu); border-color: var(--elit-bleu); color: #fff; }
.primary:hover { background: var(--elit-bleu-700); }
/* Vert : remplissage avec texte foncé, jamais de texte vert sur fond clair */
.button.succes { background: var(--elit-vert); border-color: var(--elit-vert); color: #222222; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; }
.small { font-size: 14px; color: var(--accent); font-weight: 700; }
.actions { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.actions button { flex: 1; }
.grid3 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.time { display: flex; gap: 8px; align-items: center; }
.time input { flex: 1; }
.time .now { margin-top: 4px; padding: 12px 10px; font-size: 13px; }
.ligne { border-left: 3px solid var(--elit-violet); padding-left: 12px; margin-bottom: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--texte-secondaire); font-size: 14px; display: block; }
.list { list-style: none; padding: 0; margin: 0; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--fond); border: 1px solid var(--bordure); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.item strong { color: var(--accent); }

/* Badges de statut : remplissage de palette, texte #222222 */
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; color: #222222; background: var(--elit-filet-subtil); border: 1px solid var(--elit-filet); }
.badge.en_cours { background: var(--elit-bleu-100); border-color: var(--elit-bleu-100); }
.badge.a_signer { background: var(--elit-violet); border-color: var(--elit-violet); }
.badge.signee { background: var(--elit-vert); border-color: var(--elit-vert); }
.badge.annulee { background: var(--elit-gris); border-color: var(--elit-gris); }

.alert, .ok, .note { padding: 10px 12px; border-radius: 8px; background: var(--fond); border: 1px solid var(--bordure); }
.alert { border-left: 4px solid var(--elit-violet); font-weight: 700; }
.ok { border-left: 4px solid var(--elit-vert); }
.note { border-left: 4px solid var(--accent); }
.drop { border: 2px dashed var(--bordure-champ); border-radius: 10px; padding: 24px; text-align: center; font-weight: 400; color: var(--texte-secondaire); cursor: pointer; background: var(--fond-alt); }
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop input { display: none; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 12px; }
.photos.nouvelles { margin-top: 12px; }
.photos[hidden] { display: none; }
.photo { border: 1px solid var(--bordure-champ); border-radius: 10px; padding: 8px; background: var(--fond); }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--fond-alt); }
.photo input[name^="legende_"] { margin-top: 8px; font-size: 14px; }
.photo .supprimer { font-size: 14px; color: var(--texte-secondaire); margin-top: 6px; }
.inline { display: flex; gap: 8px; align-items: end; }
.inline label { flex: 1; margin: 0; }

/* Signature sur place */
.etapes { display: flex; gap: 4px; list-style: none; padding: 0; margin: 8px 0 0; counter-reset: etape; }
.etapes li { flex: 1; font-size: 13px; font-weight: 700; color: var(--texte-secondaire); padding: 8px 4px 6px; border-bottom: 3px solid var(--bordure); text-align: center; counter-increment: etape; }
.etapes li::before { content: counter(etape) ". "; }
.etapes li.actif { color: var(--accent); border-color: var(--elit-violet); }
.apercu { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; padding: 8px; background: var(--elit-gris); border-radius: 10px; }
.apercu img { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
/* Le cadre reste blanc, même en thème sombre : l'encre est bleue */
.pad { position: relative; height: 220px; background: #fff; border: 2px dashed var(--elit-gris); border-radius: 10px; }
.pad::after { content: "Signez ici"; position: absolute; left: 16px; right: 16px; bottom: 44px; border-top: 1px solid var(--elit-filet); padding-top: 4px; font-size: 12px; color: #4A5468; pointer-events: none; }
.pad canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
@media (orientation: landscape) and (max-height: 500px) { .pad { height: 60vh; } }
label.approuve { margin: 16px 0 4px; padding: 12px; border: 1px solid var(--bordure-champ); border-radius: 8px; background: var(--fond); font-weight: 700; }
label.approuve input { width: 22px; height: 22px; }

/* Comptes */
.badge.role-admin { background: var(--elit-violet); border-color: var(--elit-violet); }
.badge.role-cdp { background: var(--elit-bleu-100); border-color: var(--elit-bleu-100); }
.compte { margin: 0 0 12px; border-left: 4px solid var(--accent); }
.compte.inactif { border-left-color: var(--elit-gris); opacity: .75; }
.compte .muted.inline { display: inline; }
.role-form { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: end; }
.role-form label { margin: 8px 0 0; }
.role-form details { grid-column: 1 / -1; order: 3; margin-top: 8px; }
.role-form button { margin-bottom: 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 14px; }
details.ajout > summary { font-size: 16px; }
.compte-actions { display: flex; gap: 20px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--bordure-subtile); font-size: 14px; }
.provisoire .mdp { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.provisoire code { font-size: 20px; font-weight: 700; letter-spacing: .5px; padding: 6px 10px; border-radius: 6px; background: var(--fond-alt); color: var(--texte); }
.provisoire .copier { padding: 8px 14px; }
.roles { padding-left: 18px; }
.roles li { margin: 4px 0; }

/* Connexion et état vide */
.button.microsoft { display: flex; width: 100%; justify-content: center; align-items: center; gap: 10px; }
.ms-carre { display: inline-grid; grid-template-columns: 8px 8px; gap: 2px; }
.ms-carre i { width: 8px; height: 8px; background: #F25022; }
.ms-carre i:nth-child(2) { background: #7FBA00; }
.ms-carre i:nth-child(3) { background: #00A4EF; }
.ms-carre i:nth-child(4) { background: #FFB900; }
.login-local { margin-top: 16px; }
.login-local summary { cursor: pointer; color: var(--texte-secondaire); }
.login-logo { display: block; height: 64px; width: auto; margin: 0 auto 16px; }
.illustration { display: block; width: 100%; max-width: 280px; height: auto; margin: 8px auto 0; }
.vide { text-align: center; padding: 16px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .illustration { display: none; }
  :root:not([data-theme="light"]) .login-logo { content: url("/static/brand/elit-logo-blanc.png"); }
}

/* Petits écrans : le bandeau tient sur une ligne */
nav a, nav .link { white-space: nowrap; }
@media (max-width: 520px) {
  .top { padding: 10px 12px; }
  .brand span { display: none; }
  .brand img { height: 28px; }
  nav { gap: 12px; }
  nav a, nav .link { font-size: 14px; }
  nav .nav-large { display: none; }
}
