/* Pilotage v1 — mobile d'abord */
:root {
  --fond: #14171c; --carte: #1c2129; --carte2: #232a34;
  --texte: #e8e6df; --muted: #9aa3ad; --ligne: #2c333d;
  --accent: #d4a94e;            /* laiton photo, discret */
  --ok: #6fae7b; --alerte: #c0564f; --alerte-fond: #3a2422;
  --rayon: 14px;
}
[data-theme="light"] {
  --fond: #f4f3ef; --carte: #ffffff; --carte2: #f0ede6;
  --texte: #23262b; --muted: #6b7280; --ligne: #dcd8cf;
  --accent: #a97d1e; --ok: #3f7d4e; --alerte: #b3352c; --alerte-fond: #f6e3e1;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.muted { color: var(--muted); }
.err { color: var(--alerte); }
[hidden] { display: none !important; }

/* Connexion */
.ecran { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 32px 28px; width: min(360px, 92vw); text-align: center; display: flex; flex-direction: column; gap: 16px; }
.logo { font-weight: 700; letter-spacing: .04em; color: var(--accent); font-size: 18px; }

/* Structure */
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--ligne); }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { border: 1px solid var(--ligne); border-radius: 999px; padding: 4px 12px; background: var(--carte); }
.lock { font-size: 18px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ligne); }
.lock.locked { color: #d97e77; border-color: #7a423d; background: var(--alerte-fond); }
.lock.open { color: var(--ok); }
.bandeau { background: var(--alerte-fond); color: var(--alerte); border: 1px solid var(--alerte);
  border-radius: 8px; padding: 3px 10px; font-size: 12.5px; }

main { padding: 14px 14px 96px; max-width: 760px; margin: 0 auto; }
footer { position: fixed; bottom: 58px; right: 0; left: 0; display: flex; gap: 12px; justify-content: center;
  font-size: 11.5px; color: var(--muted); pointer-events: none; }
footer .lien { pointer-events: auto; text-decoration: underline; color: var(--muted); }

nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(8, 1fr);
  background: var(--carte); border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom); }
nav#tabs button { padding: 9px 2px 10px; font-size: 10.5px; line-height: 1.15; color: var(--muted); }
nav#tabs button.actif { color: var(--accent); font-weight: 600; }

/* Cartes du tableau de bord */
.grille { display: flex; flex-direction: column; gap: 10px;
  min-height: calc(100dvh - 235px); }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 14px 18px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.carte.cliquable { cursor: pointer; }
.carte.cliquable:active { background: var(--carte2); }
.carte .etiquette { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.carte .valeur { font-size: 31px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; }
.carte .sous { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.carte.large { grid-column: 1 / -1; }
.valeur .proj { color: var(--accent); }
.valeur.rouge { color: var(--alerte); }
.asterisque { color: var(--accent); font-weight: 700; }

.section-titre { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); }

/* Graphiques */
.graph-boite { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 10px; margin-top: 10px; }
.graph-boite canvas { max-height: 300px; }

/* Listes d'opérations */
.op { display: flex; gap: 10px; align-items: baseline; padding: 9px 2px; border-bottom: 1px solid var(--ligne); }
.op .d { color: var(--muted); font-size: 12px; white-space: nowrap; }
.op .l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.op .m { font-weight: 600; white-space: nowrap; }
.op .m.neg { color: var(--alerte); } .op .m.pos { color: var(--ok); }
.op select { max-width: 46vw; background: var(--carte2); color: var(--texte); border: 1px solid var(--ligne);
  border-radius: 8px; padding: 3px 6px; font-size: 12px; }

.btn { border: 1px solid var(--ligne); background: var(--carte2); border-radius: 10px; padding: 9px 14px; }
.btn-accent { background: var(--accent); color: #171512; border-color: var(--accent); font-weight: 600; }
.btn-ghost { background: none; }

.zone-depot { border: 2px dashed var(--ligne); border-radius: var(--rayon); padding: 26px 14px;
  text-align: center; color: var(--muted); margin-top: 10px; }
.zone-depot.actif { border-color: var(--accent); color: var(--accent); }

table.simple { width: 100%; border-collapse: collapse; font-size: 13px; }
table.simple td, table.simple th { padding: 6px 4px; border-bottom: 1px solid var(--ligne); text-align: left; }
table.simple td.num { text-align: right; font-weight: 600; white-space: nowrap; }

/* Modale */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20;
  display: flex; align-items: center; justify-content: center; }
#modal-boite { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 20px; width: min(420px, 92vw); }
#modal-boite input[type=number] { width: 100%; font-size: 22px; padding: 10px; background: var(--carte2);
  color: var(--texte); border: 1px solid var(--ligne); border-radius: 10px; }
#modal-boite .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.placeholder { text-align: center; color: var(--muted); padding: 60px 20px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--ligne); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 700px) { nav#tabs button { font-size: 12px; } .carte .valeur { font-size: 36px; } .grille { min-height: calc(100dvh - 245px); } }

.pastille { color: #e0973f; font-size: 15px; }

.valeur.vert { color: var(--ok); }
.lock { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 34px; }
.lock.locked { color: #d9736b; }
.lock.open { background: var(--carte); border-color: var(--ligne); }
