/* Salle de contrôle de Jarvis — feuille unique, sans police externe (rapide sur une connexion faible). */
:root {
  --fond: #f3f4f7; --carte: #ffffff; --texte: #0f172a; --doux: #64748b; --bord: #e2e8f0; --bord-fort: #cbd5e1;
  --accent: #1d4ed8; --accent-texte: #ffffff; --accent-doux: #e0e7ff;
  --vert: #15803d; --orange: #b45309; --orange-vif: #f59e0b; --rouge: #c81e1e; --gris: #94a3b8; --bleu: #1d4ed8;
  --vert-fond: #dcfce7; --orange-fond: #ffedd5; --rouge-fond: #fee2e2; --gris-fond: #f1f5f9; --bleu-fond: #dbeafe;
  --rayon: 14px; --ombre: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0a0e15; --carte: #121925; --texte: #e6ebf2; --doux: #94a3b8; --bord: #223047; --bord-fort: #2f3f5a;
    --accent: #6ea8fe; --accent-texte: #0a0e15; --accent-doux: #172345;
    --vert: #4ade80; --orange: #fb923c; --orange-vif: #fbbf24; --rouge: #f87171; --gris: #64748b; --bleu: #6ea8fe;
    --vert-fond: #0c2a18; --orange-fond: #33200b; --rouge-fond: #3a1010; --gris-fond: #182131; --bleu-fond: #14213d;
    --ombre: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fond); color: var(--texte); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + var(--bas));
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; margin: 26px 0 10px; letter-spacing: -.005em; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 6px; }
p { margin: 6px 0; }
small, .doux { color: var(--doux); }
.petit { font-size: 13px; }
.gras { font-weight: 650; }
.chiffre { font-variant-numeric: tabular-nums; }
.cache { display: none !important; }
.sr { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; border: 0 !important; opacity: 0; }
pre, .pre { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--gris-fond); border-radius: 10px; padding: 10px 12px; margin: 6px 0; max-height: 420px; overflow: auto; }

/* --- en-tête et navigation ----------------------------------------------------------------------- */
.entete {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--bord); padding: calc(10px + var(--haut)) 16px 10px;
  display: flex; align-items: center; gap: 10px;
}
.entete .titre { flex: 1; min-width: 0; }
.entete .titre small { display: block; font-size: 12px; }
.retour { font-size: 15px; padding: 6px 10px 6px 0; }
.direct { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--doux); white-space: nowrap; }
.direct i { width: 8px; height: 8px; border-radius: 50%; background: var(--vert); display: inline-block; }
.direct.muet i { background: var(--rouge); }
.direct.lent i { background: var(--orange); }

.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--carte);
  border-top: 1px solid var(--bord); padding-bottom: var(--bas);
}
.onglets a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px;
  font-size: 11px; color: var(--doux); position: relative; -webkit-tap-highlight-color: transparent;
}
.onglets a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.onglets a.actif { color: var(--accent); }
.onglets .badge { position: absolute; top: 3px; left: calc(50% + 6px); }
.lateral { display: none; }

main { padding: 8px 16px 24px; max-width: 1240px; margin: 0 auto; }
.bandeau-lecture { background: var(--bleu-fond); color: var(--bleu); padding: 8px 16px; font-size: 13px; text-align: center; }
.bandeau-hors { background: var(--orange-fond); color: var(--orange); padding: 8px 16px; font-size: 13px; text-align: center; }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 230px; }
  .onglets { display: none; }
  .lateral {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 230px; z-index: 30;
    background: var(--carte); border-right: 1px solid var(--bord); padding: 18px 12px; gap: 2px; overflow-y: auto;
  }
  .lateral .marque { font-weight: 750; font-size: 16px; padding: 4px 10px 16px; display: flex; gap: 10px; align-items: center; }
  .lateral .marque img { width: 28px; height: 28px; border-radius: 8px; }
  .lateral a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--texte); font-size: 15px; }
  .lateral a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--doux); }
  .lateral a.actif { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
  .lateral a.actif svg { color: var(--accent); }
  .lateral .badge { margin-left: auto; }
  main { padding: 8px 28px 40px; }
  .entete { padding-left: 28px; padding-right: 28px; }
}

/* --- éléments ------------------------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--rouge); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge.bleu { background: var(--accent); color: var(--accent-texte); }
.voyant { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--gris); }
.voyant.vert { background: var(--vert); }
.voyant.orange { background: var(--orange-vif); }
.voyant.rouge { background: var(--rouge); box-shadow: 0 0 0 3px var(--rouge-fond); }
.voyant.bleu { background: var(--bleu); }
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  background: var(--gris-fond); color: var(--doux); white-space: nowrap; font-weight: 550; }
.pastille.vert { background: var(--vert-fond); color: var(--vert); }
.pastille.orange { background: var(--orange-fond); color: var(--orange); }
.pastille.rouge { background: var(--rouge-fond); color: var(--rouge); }
.pastille.bleu { background: var(--bleu-fond); color: var(--bleu); }

.grille { display: grid; gap: 10px; grid-template-columns: 1fr; }
.grille.deux { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grille { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grille.quatre { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px 14px; box-shadow: var(--ombre);
  min-width: 0; display: block; color: inherit; }
a.carte { transition: transform 160ms var(--ease-out), border-color 160ms ease; -webkit-tap-highlight-color: transparent; }
a.carte:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { a.carte:hover { border-color: var(--bord-fort); } }
.carte.rouge { border-color: color-mix(in srgb, var(--rouge) 45%, var(--bord)); }
.carte.orange { border-color: color-mix(in srgb, var(--orange) 35%, var(--bord)); }
.carte .ligne1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.carte .ligne1 .nom { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte .sous { font-size: 13.5px; color: var(--doux); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.carte .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12.5px; color: var(--doux); }
.carte .meta b { color: var(--texte); font-weight: 600; }

/* bandeau d'état */
.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
@media (min-width: 700px) { .tuiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .tuiles { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.tuile { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 10px 12px; box-shadow: var(--ombre);
  display: block; color: inherit; min-width: 0; transition: transform 160ms var(--ease-out); -webkit-tap-highlight-color: transparent; }
a.tuile:active { transform: scale(0.98); }
.tuile .etiquette { font-size: 12px; color: var(--doux); display: flex; align-items: center; gap: 6px; font-weight: 550; }
.tuile .valeur { font-size: 19px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile .sous { font-size: 12px; color: var(--doux); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile.rouge { background: var(--rouge-fond); border-color: transparent; }
.tuile.rouge .valeur { color: var(--rouge); }
.tuile.orange .valeur { color: var(--orange); }

/* à voir maintenant */
.avoir { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.avoir a { display: flex; gap: 10px; align-items: center; background: var(--rouge-fond); color: var(--texte); border-radius: 12px; padding: 9px 12px; font-size: 14px; }
.avoir a.orange { background: var(--orange-fond); }
.avoir a > span:not(.voyant), .avoir div > span:not(.voyant) { flex: 1; min-width: 0; }
.avoir div { display: flex; gap: 10px; align-items: center; background: var(--rouge-fond); border-radius: 12px; padding: 9px 12px; font-size: 14px; }

/* barres */
.barre { height: 7px; background: var(--gris-fond); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.barre > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.barre.vert > i { background: var(--vert); } .barre.orange > i { background: var(--orange); } .barre.rouge > i { background: var(--rouge); }
.etapes { display: flex; gap: 4px; margin-top: 8px; }
.etapes i { flex: 1; height: 5px; border-radius: 3px; background: var(--gris-fond); }
.etapes i.fait { background: var(--vert); } .etapes i.encours { background: var(--accent); }

.histo { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin: 10px 0 2px; }
.histo i { flex: 1; background: var(--vert); border-radius: 2px 2px 0 0; min-height: 2px; }
.histo i.orange { background: var(--orange-vif); } .histo i.rouge { background: var(--rouge); } .histo i.vide { background: var(--gris-fond); }
.histo i.bleu { background: var(--accent); }
.histo-legende { display: flex; justify-content: space-between; font-size: 11px; color: var(--doux); }

/* listes */
.liste { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); }
.liste > * { display: flex; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--bord); align-items: flex-start; color: inherit; min-width: 0; }
.liste > *:first-child { border-top: 0; }
.liste .corps { flex: 1; min-width: 0; }
.liste .titre-l { font-weight: 600; overflow-wrap: anywhere; }
.liste .droite { text-align: right; font-size: 12.5px; color: var(--doux); white-space: nowrap; }
.liste .vide { color: var(--doux); font-size: 14px; }

/* journal */
.journal > div { padding: 8px 14px; font-size: 14px; }
.journal .h { font-size: 12px; color: var(--doux); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; min-width: 44px; flex: none; }
.journal .qui { font-size: 12px; font-weight: 650; color: var(--doux); }
.journal .t { overflow-wrap: anywhere; }
.journal .erreur .t { color: var(--rouge); }
.journal .alerte .qui { color: var(--orange); }
.journal .neuf { animation: neuf 1.6s ease-out; }
@keyframes neuf { from { background: var(--accent-doux); } to { background: transparent; } }

/* boutons et champs */
.bouton { appearance: none; border: 1px solid var(--bord-fort); background: var(--carte); color: var(--texte); border-radius: 11px;
  padding: 9px 14px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; min-height: 42px; transition: transform 160ms var(--ease-out), opacity 160ms ease;
  -webkit-tap-highlight-color: transparent; }
.bouton:active { transform: scale(0.97); }
.bouton:disabled { opacity: .5; cursor: default; }
.bouton.primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.bouton.vert { background: var(--vert); border-color: var(--vert); color: #fff; }
.bouton.danger { color: var(--rouge); border-color: color-mix(in srgb, var(--rouge) 45%, var(--bord)); }
.bouton.plein { width: 100%; }
.bouton.petit { min-height: 34px; padding: 5px 11px; font-size: 14px; border-radius: 9px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  font: inherit; font-size: 16px; color: var(--texte); background: var(--carte); border: 1px solid var(--bord-fort);
  border-radius: 11px; padding: 10px 12px; width: 100%; }
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--doux); margin: 10px 0 4px; font-weight: 550; }
.filtres { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }
.filtres button { appearance: none; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; }
.filtres button.actif { background: var(--texte); color: var(--carte); border-color: var(--texte); }

/* fiches */
.fiche-tete { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; }
.fiche-tete .voyant { margin-top: 7px; width: 13px; height: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--doux); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.plan { list-style: none; padding: 0; margin: 0; }
.plan li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--bord); font-size: 14.5px; }
.plan li:first-child { border-top: 0; }
.plan .coche { width: 20px; flex: none; text-align: center; font-weight: 700; }
.plan .fait .coche { color: var(--vert); }
.plan .encours .coche { color: var(--accent); }
.plan .fait .txt { color: var(--doux); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--doux) 50%, transparent); }
.captures { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.captures a { display: block; border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; background: var(--gris-fond); }
.captures img { display: block; width: 100%; height: 110px; object-fit: cover; object-position: top; }
.captures span { display: block; font-size: 11.5px; padding: 4px 6px; color: var(--doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 600; }

/* file d'attente */
.rang { width: 26px; height: 26px; border-radius: 8px; background: var(--gris-fond); display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.fleches { display: flex; flex-direction: column; gap: 4px; }
.fleches button { appearance: none; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); border-radius: 8px;
  width: 34px; height: 28px; font-size: 15px; cursor: pointer; }
.fleches button:active { transform: scale(0.95); }

/* connexion */
.connexion { max-width: 380px; margin: 9vh auto 0; padding: 0 20px; text-align: center; }
.connexion img { width: 72px; height: 72px; border-radius: 18px; }
.connexion h1 { margin: 14px 0 4px; font-size: 22px; }
.connexion form { text-align: left; margin-top: 22px; }
.connexion .ou { margin: 14px 0; color: var(--doux); font-size: 13px; }
.erreur-txt { color: var(--rouge); font-size: 14px; min-height: 20px; margin-top: 8px; }

/* modale et message */
.voile { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  opacity: 1; transition: opacity 200ms ease; }
.voile.entree { opacity: 0; }
.modale { background: var(--carte); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + var(--bas));
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1); max-height: 88vh; overflow: auto; }
.voile.entree .modale { transform: translateY(100%); }
@media (min-width: 640px) { .voile { align-items: center; } .modale { border-radius: 18px; } .voile.entree .modale { transform: translateY(12px) scale(0.98); } }
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--bas)); transform: translateX(-50%); z-index: 60; background: var(--texte);
  color: var(--carte); padding: 10px 16px; border-radius: 12px; font-size: 14.5px; max-width: min(92vw, 520px); box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transition: opacity 200ms ease, transform 200ms var(--ease-out); }
.toast.entree { opacity: 0; transform: translateX(-50%) translateY(8px); }
.toast.erreur { background: var(--rouge); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; left: calc(50% + 115px); } }

.section-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-tete a { font-size: 14px; font-weight: 600; }
.squelette { color: var(--doux); padding: 24px 0; text-align: center; }
.deux-col { display: grid; gap: 14px; }
@media (min-width: 1000px) { .deux-col { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation: none !important; }
}
