:root {
  --encre: #14213d;
  --ambre: #f2a93b;
  --sur-ambre: #1f1300;
  --fond: #f4f5f7;
  --surface: #ffffff;
  --trait: #e3e6ec;
  --secondaire: #5b6478;
  --alerte: #b91c1c;
  --ok: #166534;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --encre: #e6e9f5;
    --fond: #0b1020;
    --surface: #151c35;
    --trait: #222b4d;
    --secondaire: #9aa3c2;
    --alerte: #ff8a8a;
    --ok: #86efac;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--encre); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.discret { color: var(--secondaire); }
.erreur { color: var(--alerte); min-height: 1.5em; }

.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.connexion { max-width: 380px; margin: 12vh auto; }

label { display: block; font-weight: 600; margin-bottom: 12px; }
input, textarea, select { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--trait); border-radius: 9px; background: var(--fond); color: var(--encre); font: inherit; }
textarea { min-height: 90px; resize: vertical; }
label.case { display: flex; gap: 8px; align-items: center; font-weight: 500; }
label.case input { width: auto; margin: 0; }

button { font: inherit; cursor: pointer; border-radius: 9px; padding: 8px 14px; border: 1px solid var(--trait); background: var(--surface); color: var(--encre); }
button.primaire { background: var(--ambre); color: var(--sur-ambre); border-color: var(--ambre); font-weight: 700; }
button.danger { color: var(--alerte); border-color: var(--alerte); }
button.lien { border: none; background: none; padding: 0; color: var(--secondaire); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.barre { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--trait); }
#menu { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
#menu a { padding: 6px 10px; border-radius: 8px; color: var(--encre); text-decoration: none; }
#menu a[aria-current="page"] { background: var(--encre); color: var(--fond); }
.moi { color: var(--secondaire); }
main { max-width: 1100px; margin: 0 auto; padding: 22px 18px 60px; outline: none; }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.chiffre { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 14px; }
.chiffre b { display: block; font-size: 26px; }
.chiffre span { color: var(--secondaire); font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--secondaire); }
.tableau { overflow-x: auto; }

.etiquette { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--trait); }
.etiquette.alerte { background: #fdecef; color: #a50e24; }
.etiquette.ok { background: #dcfce7; color: #166534; }
.texte-cite { white-space: pre-wrap; background: var(--fond); padding: 10px; border-radius: 9px; }

.deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--encre); color: var(--fond); padding: 10px 16px; border-radius: 10px; }

@media (max-width: 640px) {
  .barre { padding: 10px 12px; }
  main { padding: 16px 12px 50px; }
}
