/* Projets (mobile) : même charte que l'application du PC, pensée pour le téléphone. */
:root {
  --fond: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --texte: #1d2433; --discret: #5f6b7a;
  --bord: #dde1e6; --accent: #1c6fd6; --accent-texte: #ffffff; --survol: #eef2f8;
  --vert: #1e7e45; --vert-fond: #e3f4ea; --rouge: #c0392b; --rouge-fond: #fbe7e5;
  --orange: #b9660a; --orange-fond: #fdf0dc; --bleu: #2459c4; --bleu-fond: #e6eefb;
  --gris: #5f6b7a; --gris-fond: #eceef1; --ombre: 0 8px 30px rgba(20, 30, 50, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #050a05; --surface: #0b120c; --surface-2: #0f1a11; --texte: #d6f5dc; --discret: #7ea888;
    --bord: #1b2e1f; --accent: #39d96a; --accent-texte: #03140a; --survol: #12201a;
    --vert: #4cc27c; --vert-fond: #173525; --rouge: #f07468; --rouge-fond: #3d1f1d;
    --orange: #f0a64a; --orange-fond: #3a2a14; --bleu: #7aa4f5; --bleu-fond: #1b2a45;
    --gris: #a3adba; --gris-fond: #2a3039; --ombre: 0 8px 30px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --fond: #050a05; --surface: #0b120c; --surface-2: #0f1a11; --texte: #d6f5dc; --discret: #7ea888;
  --bord: #1b2e1f; --accent: #39d96a; --accent-texte: #03140a; --survol: #12201a;
  --vert: #4cc27c; --vert-fond: #173525; --rouge: #f07468; --rouge-fond: #3d1f1d;
  --orange: #f0a64a; --orange-fond: #3a2a14; --bleu: #7aa4f5; --bleu-fond: #1b2a45;
  --gris: #a3adba; --gris-fond: #2a3039; --ombre: 0 8px 30px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg { width: 18px; height: 18px; flex: none; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.cache { display: none !important; }
.sous { color: var(--discret); font-size: 13px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--bord); background: var(--surface); border-radius: 8px; padding: 9px 14px; cursor: pointer; min-height: 40px; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.btn.discret { border-color: transparent; background: transparent; color: var(--discret); padding: 8px; }
.btn.petit { padding: 5px 11px; font-size: 14px; min-height: 34px; }
.btn.large { width: 100%; }
.btn:disabled { opacity: .55; }
.tourne { animation: tourne 1s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Pastilles */
.pastille { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.p-vert { color: var(--vert); background: var(--vert-fond); }
.p-rouge { color: var(--rouge); background: var(--rouge-fond); }
.p-orange { color: var(--orange); background: var(--orange-fond); }
.p-bleu { color: var(--bleu); background: var(--bleu-fond); }
.p-gris { color: var(--gris); background: var(--gris-fond); }
.compte { font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--gris-fond); color: var(--gris); font-weight: 600; }
.compte.rouge { background: var(--rouge-fond); color: var(--rouge); }
.compte.orange { background: var(--orange-fond); color: var(--orange); }

/* Bandeau et onglets */
header.haut { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--bord); padding: env(safe-area-inset-top) 0 0; }
.titre { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px 16px; }
.titre h1 { font-size: 17px; margin: 0; }
.titre .meta { color: var(--discret); font-size: 12.5px; }
.titre .espace { flex: 1; }
nav.onglets { display: flex; padding: 0 8px; }
nav.onglets button { flex: 1; border: 0; background: none; padding: 10px 8px; color: var(--discret); border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; align-items: center; justify-content: center; cursor: pointer; }
nav.onglets button.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }
.menu { position: relative; }
.menu-liste { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); padding: 4px; min-width: 230px; z-index: 20; }
.menu-liste button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 11px 12px; border-radius: 6px; text-align: left; cursor: pointer; }

main { padding: 12px 12px calc(32px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.filtres { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.filtres .btn { flex: none; }

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.carte h2 { font-size: 15.5px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.carte .entete { display: flex; align-items: flex-start; gap: 8px; }
.carte .entete > div:first-child { flex: 1; min-width: 0; }
.ligne { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--bord); }
.ligne:first-of-type { border-top: 0; }
.ligne .grand { flex: 1; min-width: 0; }
.ligne .grand strong { overflow-wrap: anywhere; }
.vide { padding: 28px; text-align: center; color: var(--discret); background: var(--surface); border: 1px dashed var(--bord); border-radius: 12px; }
.encadre { padding: 10px 12px; border-radius: 10px; background: var(--bleu-fond); margin-bottom: 12px; }
.encadre.orange { background: var(--orange-fond); }
.encadre.rouge { background: var(--rouge-fond); }
.encadre ol { margin: 6px 0 0; padding-left: 20px; }
.info { color: var(--discret); cursor: help; }

/* Lots et constats */
.lot { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: var(--surface-2); }
.lot .tete { display: flex; gap: 8px; align-items: flex-start; }
.lot .tete strong { flex: 1; }
details summary { cursor: pointer; color: var(--discret); font-size: 13.5px; padding: 6px 0; }
.constat { padding: 8px 0; border-top: 1px dashed var(--bord); }
.constat:first-of-type { border-top: 0; }
.constat .tete { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.constat p { margin: 4px 0 0; font-size: 14px; }
.constat .etiquette { color: var(--discret); font-size: 12.5px; }

/* Formulaires */
.formulaire { max-width: 460px; margin: 6vh auto 0; padding: 0 16px; }
.formulaire h1 { font-size: 20px; margin: 0 0 4px; }
.champ { margin: 14px 0; }
.champ label { display: block; font-weight: 600; margin-bottom: 4px; }
.champ input { width: 100%; border: 1px solid var(--bord); background: var(--surface); border-radius: 8px; padding: 10px 12px; font-size: 16px; }
.champ .aide { color: var(--discret); font-size: 13px; margin-top: 4px; }
.erreur-texte { color: var(--rouge); min-height: 1.4em; }

/* Fenêtre du rapport */
.voile { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.modale { background: var(--surface); width: min(760px, 100%); max-height: 92vh; border-radius: 14px 14px 0 0; display: flex; flex-direction: column; box-shadow: var(--ombre); }
.modale .barre { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--bord); }
.modale .barre strong { flex: 1; overflow-wrap: anywhere; }
.modale .corps { padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); overflow: auto; }
.rapport h1 { font-size: 18px; } .rapport h2 { font-size: 16px; margin-top: 18px; } .rapport h3, .rapport h4 { font-size: 15px; }
.rapport table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 13px; }
.rapport th, .rapport td { border: 1px solid var(--bord); padding: 4px 6px; text-align: left; vertical-align: top; }
.rapport code { background: var(--gris-fond); padding: 0 4px; border-radius: 4px; }

/* Messages */
#messages { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; z-index: 40; }
.message { background: var(--surface); border: 1px solid var(--bord); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; box-shadow: var(--ombre); }
.message.erreur { border-left-color: var(--rouge); }
.message.ok { border-left-color: var(--vert); }

/* Logo : version claire ou « terminal » selon le thème */
.logo { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.logo-terminal { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-clair { display: none; } :root:not([data-theme="light"]) .logo-terminal { display: block; } }
:root[data-theme="dark"] .logo-clair { display: none; } :root[data-theme="dark"] .logo-terminal { display: block; }
.formulaire .logo { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 10px; }
/* Thème sombre : touche « terminal » sur les titres */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1 { font-family: ui-monospace, Consolas, monospace; letter-spacing: -.02em; } }
:root[data-theme="dark"] h1 { font-family: ui-monospace, Consolas, monospace; letter-spacing: -.02em; }
