:root {
  --fond: #0f1117; --fond2: #171a23; --fond3: #1f2330; --bord: #2a2f3d;
  --texte: #e6e8ef; --texte2: #9aa0b0; --accent: #6c8cff; --accent2: #4f6ee0;
  --ok: #3ccb7f; --jaune: #f2c94c; --orange: #f2994a; --rouge: #eb5757; --info: #56ccf2;
  --rayon: 12px; --nav: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Inter, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--bord); background: var(--fond3); border-radius: 10px; padding: 8px 14px; }
button.primaire { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.discret { background: transparent; border-color: transparent; color: var(--texte2); padding: 4px 8px; }
button.danger { color: var(--rouge); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; background: var(--fond); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--texte2); margin: 10px 0 4px; }
.ligne { display: flex; gap: 10px; align-items: center; }
.ligne > * { flex: 1; }
.ligne > .fixe { flex: 0 0 auto; }
.cache { display: none !important; }

/* coque */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.entete { position: sticky; top: 0; z-index: 5; background: rgba(15,17,23,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--bord); padding: max(10px, env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 12px; }
.entete h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete .retour { color: var(--texte2); font-size: 22px; line-height: 1; padding: 0 6px 0 0; }
.contenu { flex: 1; padding: 14px 16px calc(var(--nav) + 24px); max-width: 980px; width: 100%; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--fond2); border-top: 1px solid var(--bord); display: flex; z-index: 5; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--texte2); font-size: 11px; position: relative; }
.nav a.actif { color: var(--accent); }
.nav a .ico { font-size: 20px; }
.pastille { position: absolute; top: 8px; right: calc(50% - 22px); background: var(--rouge); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
@media (min-width: 900px) {
  #app { flex-direction: row; }
  .nav { position: sticky; top: 0; bottom: auto; height: 100vh; width: 200px; flex-direction: column; border-top: 0; border-right: 1px solid var(--bord); padding: 16px 0; justify-content: flex-start; }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 20px; font-size: 14px; }
  .pastille { top: 10px; right: 16px; }
  .principal { flex: 1; min-width: 0; }
  .contenu { padding-bottom: 40px; }
}

/* blocs */
.carte { background: var(--fond2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; margin-bottom: 12px; }
.carte.cliquable { cursor: pointer; color: var(--texte); }
.carte.cliquable:active { background: var(--fond3); }
.section-titre { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.section-titre h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte2); margin: 0; }
.vide { color: var(--texte2); font-size: 14px; padding: 8px 2px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fond3); color: var(--texte2); border: 1px solid var(--bord); }
.badge.accent { background: rgba(108,140,255,.15); color: var(--accent); border-color: transparent; }
.badge.rouge { background: rgba(235,87,87,.15); color: var(--rouge); border-color: transparent; }
.badge.orange { background: rgba(242,153,74,.15); color: var(--orange); border-color: transparent; }
.badge.jaune { background: rgba(242,201,76,.15); color: var(--jaune); border-color: transparent; }
.badge.ok { background: rgba(60,203,127,.15); color: var(--ok); border-color: transparent; }
.badge.info { background: rgba(86,204,242,.15); color: var(--info); border-color: transparent; }
.point { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.petit { font-size: 12px; color: var(--texte2); }
.titre-carte { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.titre-carte .spacer { flex: 1; }
.grille { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .grille { grid-template-columns: 1fr 1fr; } }
.jauge { height: 8px; background: var(--fond3); border-radius: 4px; overflow: hidden; margin: 6px 0 2px; }
.jauge > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.jauge > i.jaune { background: var(--jaune); } .jauge > i.orange { background: var(--orange); } .jauge > i.rouge { background: var(--rouge); }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin: 8px 0 12px; overflow-x: auto; }
.onglets button { border: 0; background: none; border-radius: 0; padding: 8px 12px; color: var(--texte2); border-bottom: 2px solid transparent; white-space: nowrap; }
.onglets button.actif { color: var(--texte); border-bottom-color: var(--accent); }
.tache { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.tache:last-child { border-bottom: 0; }
.tache input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--ok); }
.tache .corps { flex: 1; min-width: 0; }
.tache.fait .corps .t { text-decoration: line-through; color: var(--texte2); }
.retour { padding: 10px 0; border-bottom: 1px solid var(--bord); }
.retour:last-child { border-bottom: 0; }
.retour .t { font-weight: 600; }
.retour pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; font-size: 13px; color: var(--texte2); font-family: inherit; }
.retour.nonlu .t::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.note { padding: 10px 0; border-bottom: 1px solid var(--bord); }
.note:last-child { border-bottom: 0; }
.note .t { font-weight: 600; }
.note .c { white-space: pre-wrap; word-break: break-word; color: var(--texte); font-size: 14px; margin-top: 4px; }
.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--bord); }
.tableau th { color: var(--texte2); font-weight: 500; font-size: 12px; }
.tableau td.num, .tableau th.num { text-align: right; white-space: nowrap; }
.ajout { display: flex; gap: 8px; margin: 8px 0 12px; }
.ajout input { flex: 1; }
code, .code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 10px; display: block; white-space: pre-wrap; word-break: break-all; }

/* modale, toast, login */
.modale { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modale-boite { background: var(--fond2); border: 1px solid var(--bord); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modale { align-items: center; } .modale-boite { border-radius: 16px; } }
.modale h3 { margin: 0 0 10px; }
.toast { position: fixed; bottom: calc(var(--nav) + 16px); left: 50%; transform: translateX(-50%); background: var(--fond3); border: 1px solid var(--bord); padding: 10px 16px; border-radius: 10px; z-index: 30; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .carte { width: 100%; max-width: 360px; }
.login h1 { margin: 0 0 4px; }
.seuil-ligne { display: grid; grid-template-columns: 1fr 110px 100px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.seuil-ligne input, .seuil-ligne select { padding: 8px; }
