/* Tatbiki Commercial — couleurs reprises de Dépenses (charte § 1) */
:root {
  --jaune: #FFCC00; --noir: #0F0F0F; --gris-fonce: #3A3A3A; --gris-clair: #EDEDED; --blanc: #FFFFFF;
  --danger: #C62828; --whatsapp: #25D366;
  --fond: #F5F5F5; --surface: #FFFFFF; --texte: #0F0F0F; --texte-doux: #5A5A5A; --bord: #D0D0D0; --rayon: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif; background: var(--fond); color: var(--texte); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
[hidden] { display: none !important; }

/* En-tête */
.barre { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 16px; background: #000; color: var(--blanc); position: sticky; top: 0; z-index: 5; direction: ltr; }
.barre-g { display: flex; align-items: center; gap: 6px; }
.logo { height: 32px; width: auto; }
@media (max-width: 420px) { .barre { padding: 8px 10px; gap: 6px; } .logo { height: 26px; } .btn-icone, .btn-retour { min-width: 40px; min-height: 40px; } .langue { min-width: 28px; padding: 0 2px; } }
.barre h1 { margin: 0; font-size: 1.05rem; text-align: center; color: var(--gris-clair); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icone { min-width: 44px; min-height: 44px; font-size: 1.4rem; border: none; border-radius: 12px; background: #1A1A1A; color: var(--gris-clair); cursor: pointer; }
.btn-retour { min-width: 44px; min-height: 44px; font-size: 1.5rem; font-weight: 900; border: 2px solid var(--noir); border-radius: 12px; background: var(--jaune); color: var(--noir); cursor: pointer; }
.langues { justify-self: end; display: flex; gap: 2px; }
.langue { min-width: 34px; min-height: 34px; border: none; border-radius: 8px; background: transparent; color: var(--gris-clair); font-weight: 700; cursor: pointer; }
.langue.actif { background: var(--jaune); color: var(--noir); }

/* Formulaires */
.carte { background: var(--surface); border-radius: var(--rayon); padding: 16px; border: 1px solid var(--bord); margin-bottom: 12px; }
label { display: block; font-weight: 700; margin: 12px 0 6px; }
input, select { width: 100%; min-height: 50px; font: inherit; padding: 10px 12px; border-radius: var(--rayon); border: 2px solid var(--bord); background: var(--surface); color: var(--texte); }
input:focus, select:focus { outline: 3px solid var(--noir); outline-offset: 1px; }
.btn { display: block; width: 100%; min-height: 52px; margin-top: 14px; font: inherit; font-weight: 800; border-radius: var(--rayon); border: 2px solid var(--noir); background: var(--jaune); color: var(--noir); cursor: pointer; text-align: center; text-decoration: none; line-height: 48px; }
.btn.secondaire { background: var(--surface); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: var(--noir); }
.btn:disabled { opacity: .5; }
.msg { margin: 10px 0 0; color: var(--texte-doux); }
.msg.erreur { color: var(--danger); font-weight: 700; }

/* Listes (charte § 19) : noms seulement → fiche */
.filtres { display: grid; gap: 8px; margin-bottom: 8px; }
.compteur { color: var(--texte-doux); font-weight: 700; margin: 4px 0 8px; }
.liste { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--rayon); border: 1px solid var(--bord); overflow: hidden; }
.liste li button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 56px; padding: 12px 16px; border: none; border-bottom: 1px solid var(--gris-clair); background: none; font: inherit; font-weight: 700; color: var(--texte); cursor: pointer; text-align: start; }
.liste li:last-child button { border-bottom: none; }
.liste .inactif { color: var(--texte-doux); text-decoration: line-through; }
.fleche { color: var(--texte-doux); }
dl.infos { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dl.infos dt { color: var(--texte-doux); }
dl.infos dd { margin: 0; font-weight: 700; }

/* Menu (charte § 5 + § 16) */
.panneau { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 10; }
.panneau-contenu { position: absolute; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); background: var(--surface); padding: 12px 16px; overflow-y: auto; }
[dir="rtl"] .panneau-contenu { left: auto; right: 0; }
.panneau-tete { display: flex; align-items: center; gap: 12px; }
.panneau-tete h2 { margin: 0; }
.lien-menu { display: block; width: 100%; min-height: 52px; padding: 12px 8px; border: none; border-bottom: 1px solid var(--gris-clair); background: none; font: inherit; font-weight: 700; text-align: start; color: var(--texte); cursor: pointer; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 20px; max-width: 600px; margin: 0 auto; padding: 14px 16px; border-radius: var(--rayon); background: var(--noir); color: var(--blanc); font-weight: 700; z-index: 20; }

/* Phase 2 — terrain */
.bandeau-attente { display: block; width: 100%; min-height: 44px; border: none; border-bottom: 2px solid var(--noir); background: var(--jaune); color: var(--noir); font: inherit; font-weight: 800; cursor: pointer; }
.bandeau-attente.erreur { background: var(--danger); color: var(--blanc); }
.gros-boutons .btn { min-height: 64px; line-height: 60px; font-size: 1.1rem; }
.apercu { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--rayon); background: var(--gris-clair); margin-top: 8px; }
.statuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statuts button { min-height: 50px; font: inherit; font-weight: 800; border-radius: var(--rayon); border: 2px solid var(--bord); background: var(--surface); color: var(--texte); cursor: pointer; }
.statuts button.actif { border-color: var(--noir); background: var(--jaune); }
textarea { width: 100%; min-height: 96px; font: inherit; padding: 10px 12px; border-radius: var(--rayon); border: 2px solid var(--bord); background: var(--surface); color: var(--texte); resize: vertical; }
textarea:focus { outline: 3px solid var(--noir); outline-offset: 1px; }
.encadre { border: 2px solid var(--noir); border-radius: var(--rayon); padding: 12px; background: #FFF6CC; margin-bottom: 12px; }
.carte-map { height: 280px; border-radius: var(--rayon); border: 1px solid var(--bord); margin-bottom: 12px; z-index: 0; }
.sous { display: block; font-weight: 400; color: var(--texte-doux); font-size: .9rem; }
.pastille { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--gris-clair); font-size: .85rem; font-weight: 700; }
.pastille.chaud { background: var(--jaune); }
.onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.onglets button { min-height: 44px; font: inherit; font-weight: 800; border-radius: var(--rayon); border: 2px solid var(--bord); background: var(--surface); color: var(--texte); cursor: pointer; }
.onglets button.actif { border-color: var(--noir); background: var(--jaune); }
h3 { margin: 18px 0 8px; }
a { color: var(--noir); font-weight: 700; }
.encadre.alerte { border-color: var(--danger); background: #FDECEA; }

/* Phase 3 — directeur */
.tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tuile { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 10px 6px; text-align: center; }
.tuile strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.tuile span { font-size: .8rem; color: var(--texte-doux); font-weight: 700; }
.tuile.fort { background: var(--jaune); border-color: var(--noir); }
.tuile.fort span { color: var(--noir); }
.ligne-date { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.interrupteur { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--gris-clair); font-weight: 700; }
.interrupteur input { width: 52px; min-height: 30px; accent-color: var(--noir); flex: none; }
.rapport-texte { white-space: pre-wrap; font-family: inherit; margin: 0; }
.bulles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bulle { max-width: 85%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; }
.bulle.moi { align-self: flex-end; background: var(--jaune); }
.bulle.ia { align-self: flex-start; background: var(--gris-clair); }
.m-titre { margin: 18px 0 6px; font-size: .85rem; color: var(--texte-doux); text-transform: uppercase; }
.m-app { display: flex; justify-content: space-between; align-items: center; min-height: 46px; padding: 8px; border-bottom: 1px solid var(--gris-clair); font-weight: 700; text-decoration: none; color: var(--texte); }
.m-app small { color: var(--texte-doux); font-weight: 700; }
.m-app.cours { color: var(--texte-doux); }
.m-app.ici small { background: var(--jaune); color: var(--noir); padding: 2px 8px; border-radius: 999px; }
