/* Apific — mise en page sobre, claire ou sombre selon l'appareil (même famille que Traces). */
:root {
  --fond: #f4f5f7;
  --surface: #ffffff;
  --texte: #1a1d24;
  --texte-2: #5c6270;
  --trait: #e0e3ea;
  --accent: #3b5bdb;
  --accent-texte: #ffffff;
  --accent-doux: #edf1ff;
  --alerte-fond: #fdecef;
  --alerte-texte: #8a1238;
  --info-fond: #edf1ff;
  --info-texte: #24387f;
  --code-fond: #f1f3f6;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(20, 25, 40, .06), 0 4px 16px rgba(20, 25, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #111318;
    --surface: #1a1d24;
    --texte: #eceef3;
    --texte-2: #a2a8b6;
    --trait: #2b2f3a;
    --accent: #7c93f5;
    --accent-texte: #0b1030;
    --accent-doux: #22294a;
    --alerte-fond: #3a1220;
    --alerte-texte: #ffc2d4;
    --info-fond: #1e2645;
    --info-texte: #c5d0ff;
    --code-fond: #22252e;
    --ombre: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
main { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 1rem; margin: 0 0 8px; }
h3 { font-size: .95rem; margin: 18px 0 6px; }
[hidden] { display: none !important; }

/* En-tête */
.entete {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 960px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 4px;
}
.marque { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--texte); }
.marque:hover { text-decoration: none; }
.marque.grande { font-size: 1.8rem; justify-content: center; width: 100%; margin-bottom: 4px; }
.pastille {
  width: 14px; height: 14px; border-radius: 4px; background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent);
}
.marque.grande .pastille { width: 18px; height: 18px; }
.lien-discret {
  background: none; border: 0; padding: 8px 4px; font: inherit; font-size: .95rem;
  color: var(--texte-2); cursor: pointer;
}
.lien-discret:hover { color: var(--texte); }
.lien-discret.danger:hover, .lien-discret.arme { color: var(--alerte-texte); }
.lien-discret.arme { font-weight: 600; }

/* Formulaires */
.carte-auth {
  max-width: 380px; margin: 12vh auto 0; background: var(--surface); border-radius: var(--rayon);
  padding: 28px 24px; box-shadow: var(--ombre); border: 1px solid var(--trait);
}
.carte-auth.large { max-width: 460px; margin-top: 4vh; }
.carte-auth h2 { margin-top: 8px; }
.formulaire { display: grid; gap: 14px; margin-top: 12px; }
.formulaire label { display: grid; gap: 6px; font-size: .9rem; color: var(--texte-2); }
input, textarea {
  font: inherit; font-size: 1rem; color: var(--texte); background: var(--fond);
  border: 1px solid var(--trait); border-radius: 10px; padding: 11px 12px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type="file"] { padding: 9px; background: var(--surface); }
.bouton {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-texte); text-align: center; display: inline-block; white-space: nowrap;
}
.bouton:hover { filter: brightness(1.06); text-decoration: none; }
.bouton:disabled { opacity: .55; cursor: default; filter: none; }
.bouton.secondaire { background: var(--surface); color: var(--texte); border: 1px solid var(--trait); font-weight: 500; }
.alerte { background: var(--alerte-fond); color: var(--alerte-texte); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; }
.info { background: var(--info-fond); color: var(--info-texte); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; }
.aide { color: var(--texte-2); font-size: .9rem; margin: 0; }
.centre { text-align: center; }
.qr { background: #fff; border-radius: 10px; padding: 10px; width: 220px; margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.cle { font-size: .85rem; word-break: break-all; }
.texte-erreur { color: var(--alerte-texte); }

/* Panneaux */
.panneau {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 18px; margin: 14px 0; box-shadow: var(--ombre);
}
.panneau h1 { font-size: 1.25rem; margin-bottom: 6px; }
.titre-section { display: block; font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); margin: 22px 0 0; }
.panneau .titre-section { margin: 0 0 8px; }

/* Envoi */
.envoi { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.envoi input { flex: 1 1 260px; width: auto; }
.progression { margin-top: 12px; }
.barre { height: 8px; border-radius: 4px; background: var(--trait); overflow: hidden; }
.barre span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progression .aide { margin-top: 6px; }

/* Liste des fichiers */
.liste { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.ligne {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 12px 16px; color: var(--texte);
}
.ligne:hover { text-decoration: none; border-color: var(--accent); }
.ligne-titre { display: grid; min-width: 0; flex: 1 1 260px; }
.ligne-titre strong { font-weight: 600; overflow-wrap: anywhere; }
.ligne-titre small { color: var(--texte-2); font-size: .82rem; overflow-wrap: anywhere; }
.etiquette {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.etiquette.attente { background: var(--info-fond); color: var(--info-texte); }
.etiquette.erreur { background: var(--alerte-fond); color: var(--alerte-texte); }
.vide { color: var(--texte-2); text-align: center; margin: 28px 0; }
.roue {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* Page d'un fichier */
.retour { display: inline-block; margin: 4px 0 10px; font-size: .95rem; }
.sous-titre { color: var(--texte-2); margin: 6px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.form-question textarea { font-size: 1.05rem; }
.ligne-actions { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin-top: 10px; flex-wrap: wrap; }
.exemples { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 300px; }
.exemple {
  font: inherit; font-size: .82rem; color: var(--accent); background: var(--accent-doux);
  border: 0; border-radius: 999px; padding: 5px 11px; cursor: pointer; text-align: left;
}
.exemple:hover { filter: brightness(.97); }
.historique { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.reponse {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 16px 18px; box-shadow: var(--ombre);
}
.panneau .reponse.en-cours { border: 0; padding: 0; box-shadow: none; margin-top: 16px; }
.question { font-weight: 650; margin: 0 0 8px; overflow-wrap: anywhere; }
.question::before { content: "Q · "; color: var(--accent); }
.texte-reponse p { margin: 0 0 10px; }
.texte-reponse ul, .texte-reponse ol { margin: 0 0 10px; padding-left: 22px; }
.texte-reponse h4 { margin: 12px 0 6px; font-size: 1rem; }
.texte-reponse code, .fiche code { background: var(--code-fond); border-radius: 5px; padding: 1px 5px; font-size: .88em; }
.tableau { overflow-x: auto; margin: 6px 0 12px; }
table { border-collapse: collapse; font-size: .92rem; min-width: 50%; }
th, td { border-bottom: 1px solid var(--trait); padding: 6px 10px; text-align: left; vertical-align: top; }
th { font-weight: 650; color: var(--texte-2); font-size: .85rem; }
td.droite, th.droite { text-align: right; }
.requetes { margin-top: 8px; font-size: .88rem; }
.requetes summary { cursor: pointer; color: var(--texte-2); }
.requetes ol { padding-left: 20px; margin: 8px 0 0; display: grid; gap: 8px; }
.requetes .but { font-weight: 600; }
.requetes .resultat { color: var(--texte-2); margin-left: 6px; font-size: .85rem; }
.requetes pre {
  margin: 4px 0 0; background: var(--code-fond); border-radius: 8px; padding: 8px 10px;
  overflow-x: auto; font-size: .8rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
}
.meta { color: var(--texte-2); font-size: .8rem; margin: 10px 0 0; }
.fiche summary { cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; list-style: none; }
.fiche summary::-webkit-details-marker { display: none; }
.fiche summary::before { content: "▸"; color: var(--texte-2); }
.fiche[open] summary::before { content: "▾"; }
.fiche summary h2 { margin: 0; }
.fiche ul { padding-left: 20px; margin: 0; }
.fiche li { margin-bottom: 4px; }
.form-notes .ligne-actions { align-items: center; }
.actions-jeu { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

@media (max-width: 560px) {
  h1 { font-size: 1.35rem; }
  .panneau { padding: 14px; }
  .carte-auth { margin-top: 6vh; }
  .ligne-actions .bouton { width: 100%; }
}
