@font-face { font-family: Inter; src: url(/static/fonts/inter-variable.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Manrope; src: url(/static/fonts/manrope-variable.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --bleu: #2e5f9e; --bleu-fonce: #1c3c63; --bleu-doux: #e8f0fa;
  --fond: #f3f5f8; --carte: #ffffff; --texte: #18212c; --doux: #5d6c7e; --bord: #e1e6ed;
  --rouge: #b42318; --rouge-doux: #fde8e6; --orange: #9a5b00; --orange-doux: #fdf0d9; --vert: #17703e; --vert-doux: #e2f4ea; --gris-doux: #eef1f5;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --rayon: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bleu: #5b8fd4; --bleu-fonce: #9cc3f0; --bleu-doux: rgba(46, 95, 158, .28);
    --fond: #0b1622; --carte: #101d2c; --texte: #e6edf5; --doux: #94a7bd; --bord: rgba(255, 255, 255, .08);
    --rouge: #ff8a80; --rouge-doux: rgba(255, 99, 88, .15); --orange: #ffc266; --orange-doux: rgba(255, 170, 51, .15); --vert: #6fd69a; --vert-doux: rgba(46, 204, 113, .14); --gris-doux: rgba(255, 255, 255, .06);
    --ombre: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.5 Inter, system-ui, sans-serif; }
h1, h2, h3, .marque { font-family: Manrope, Inter, sans-serif; letter-spacing: -.01em; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); }
a { color: var(--bleu); overflow-wrap: anywhere; }
p { margin: 0 0 10px; }
.doux { color: var(--doux); }
.petit { font-size: 13px; }
.pre { white-space: pre-line; }
code, pre { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--gris-doux); padding: 12px; border-radius: 8px; overflow: auto; max-height: 320px; white-space: pre-wrap; }
[hidden] { display: none !important; }

.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); padding: 9px 14px; border-radius: 9px; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--bleu); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-principal { background: var(--bleu); border-color: var(--bleu); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-principal { background: #2e5f9e; border-color: #2e5f9e; } }
.btn-danger { color: var(--rouge); }
.btn-discret { border-color: transparent; background: transparent; color: var(--doux); }
.btn-discret:hover { color: var(--texte); border-color: var(--bord); }
.btn.petit { min-height: 30px; padding: 4px 10px; }
:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }

input, textarea, select { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--bord); border-radius: 9px; padding: 9px 11px; width: 100%; }
select { width: auto; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
textarea { resize: vertical; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 18px; }

/* ---- barre ---- */
.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: var(--carte); border-bottom: 1px solid var(--bord); }
.marque { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; white-space: nowrap; }
.onglets { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.onglets button { font: inherit; font-weight: 600; background: none; border: 0; color: var(--doux); padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.onglets button:hover { color: var(--texte); background: var(--gris-doux); }
.onglets button.actif { color: var(--bleu); background: var(--bleu-doux); }
.pastille { background: var(--bleu); color: #fff; font-size: 12px; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
.pastille:empty { display: none; }
.moi { display: flex; gap: 4px; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- équipe ---- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { display: grid; gap: 6px; align-content: start; }
.kpi-titre { color: var(--doux); font-size: 13px; font-weight: 600; }
.kpi strong { font-family: Manrope, Inter, sans-serif; font-size: 22px; }
.jauge { height: 6px; background: var(--gris-doux); border-radius: 99px; overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--bleu); border-radius: 99px; transition: width .4s; }
.equipe { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.agent { display: flex; gap: 12px; align-items: flex-start; }
.agent > div:last-child { display: grid; gap: 2px; min-width: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--gris-doux); color: var(--doux); font-family: Manrope, sans-serif; }
.agent.occupe .avatar { background: var(--bleu-doux); color: var(--bleu); }
.tache { font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
.point { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--vert); margin-right: 6px; animation: battre 1.6s infinite; }
@keyframes battre { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .point { animation: none; } }
.deux { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; }
.ligne { display: flex; gap: 8px; align-items: flex-start; }
.ligne textarea { flex: 1; }
.consignes, .journal, .historique, .comptes { list-style: none; padding: 0; margin: 12px 0 0; }
.consignes li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--bord); }
.consignes li .btn { grid-row: 1 / 3; grid-column: 2; align-self: center; }
.journal { max-height: 460px; overflow: auto; margin: 0; }
.journal li { padding: 7px 0; border-top: 1px solid var(--bord); font-size: 14px; overflow-wrap: anywhere; }
.journal li:first-child { border-top: 0; }
.j-erreur { color: var(--rouge); }
.j-bug strong, .j-decision { color: var(--texte); }

/* ---- listes ---- */
.filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.puces { display: flex; gap: 4px; flex-wrap: wrap; }
.puce { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--bord); background: var(--carte); color: var(--doux); padding: 6px 11px; border-radius: 99px; cursor: pointer; }
.puce span { opacity: .7; margin-left: 2px; }
.puce.actif { background: var(--bleu-doux); border-color: transparent; color: var(--bleu); }
.liste { display: grid; gap: 10px; }
.element { display: flex; gap: 16px; text-align: left; width: 100%; font: inherit; color: inherit; cursor: pointer; align-items: flex-start; padding: 14px; }
.element:hover { border-color: var(--bleu); }
.element > img { flex: none; width: 150px; height: 96px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--bord); }
.element-texte { display: grid; gap: 4px; min-width: 0; }
.element-texte strong { font-size: 16px; }
.extrait { color: var(--doux); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--gris-doux); color: var(--doux); text-transform: capitalize; }
.g-bloquant { background: var(--rouge-doux); color: var(--rouge); }
.g-majeur { background: var(--orange-doux); color: var(--orange); }
.st-nouveau { background: var(--bleu-doux); color: var(--bleu); }
.st-confirme, .st-retenue, .st-valide { background: var(--vert-doux); color: var(--vert); }
.st-corrige { background: var(--vert-doux); color: var(--vert); }
.vide { text-align: center; color: var(--doux); padding: 48px 0; }
.liste-visuels { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.element.visuel { flex-direction: column; }
.avant-apres { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.avant-apres img { width: 100%; height: 150px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--bord); }
.avant-apres.grand img { height: auto; max-height: 70vh; object-fit: contain; background: var(--gris-doux); cursor: zoom-in; }
figure { margin: 0; }
figcaption { font-size: 13px; font-weight: 700; color: var(--doux); margin-top: 4px; }

/* ---- fenêtres ---- */
dialog { border: 1px solid var(--bord); border-radius: 16px; background: var(--carte); color: var(--texte); padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(8, 15, 25, .55); }
.panneau { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 28px; }
.petit-panneau { width: min(460px, calc(100vw - 32px)); }
.fermer { position: sticky; top: 0; float: right; margin: -12px -12px 0 0; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--gris-doux); color: var(--texte); font-size: 22px; cursor: pointer; z-index: 2; }
.panneau h2 { font-size: 22px; margin: 10px 0 12px; }
.occurrences { display: grid; gap: 10px; }
.occurrence { display: flex; gap: 12px; align-items: flex-start; }
.occurrence > div { display: grid; gap: 2px; min-width: 0; }
.occurrence img { flex: none; width: 180px; max-height: 120px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--bord); cursor: zoom-in; }
.occurrence.disparu { opacity: .55; }
.decision { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--bord); }
.historique li { padding: 8px 0; border-top: 1px solid var(--bord); font-size: 14px; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--doux); font-weight: 600; font-size: 14px; }
.visionneuse { max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); padding: 0; overflow: auto; }
.visionneuse img { display: block; max-width: 100%; }
.visionneuse .fermer { position: fixed; top: 24px; right: 24px; margin: 0; }
.erreur { color: var(--rouge); font-weight: 600; min-height: 1em; }
.message { min-height: 1em; font-weight: 600; }
.comptes li { padding: 8px 0; border-top: 1px solid var(--bord); }

/* ---- connexion ---- */
.page-connexion { min-height: 100vh; display: grid; place-items: center; }
.connexion { width: min(420px, 100%); padding: 24px 16px; }
.marque-grande { font-size: 20px; justify-content: center; margin-bottom: 20px; }
.connexion .carte { padding: 26px; }
.connexion h1 { font-size: 22px; margin-bottom: 14px; }
.connexion .btn { width: 100%; }
.etapes { padding-left: 20px; margin: 0 0 16px; color: var(--doux); font-size: 14px; }
.qr { display: grid; place-items: center; margin: 4px 0 8px; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; padding: 6px; }
.connexion .erreur { text-align: center; margin-top: 14px; }

/* ---- mobile ---- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .deux { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .barre { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .marque { flex: 1; }
  .onglets { order: 3; flex-basis: 100%; }
  main { padding: 16px; }
  .element { flex-direction: column; }
  .element > img { width: 100%; height: 140px; }
  .liste-visuels { grid-template-columns: 1fr; }
  .panneau { padding: 20px 16px; }
  .occurrence { flex-direction: column; }
  .occurrence img { width: 100%; }
  .ligne { flex-direction: column; align-items: stretch; }
  .moi .btn { padding: 6px 8px; }
}
