/* Portail Academy — même langage visuel que les contenus (academy.css) :
   console d'administration, titres en monospace, accent ambre.
   Pour appliquer une autre charte : ne modifier que les jetons ci-dessous. */

:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --fg: #1b2226;
  --muted: #56646b;
  --border: #d6ddd9;
  --prompt: #1d7a3c;
  --accent: #a85400;
  --accent-soft: #fbead7;
  --term-bg: #12171a;
  --term-fg: #d5dde0;
  --term-muted: #7f8d94;
  --term-prompt: #7fd18b;
  --term-accent: #f2a541;
  --ok: #1d7a3c;
  --alerte: #b3261e;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1315;
    --surface: #151b1e;
    --surface-2: #1a2226;
    --fg: #d7dee1;
    --muted: #8d9aa1;
    --border: #26323a;
    --prompt: #7fd18b;
    --accent: #f2a541;
    --accent-soft: #2b2114;
    --ok: #7fd18b;
    --alerte: #f2857a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .3em; border-radius: 3px; }

/* ------------------------------------------------------------- structure */
.enveloppe { max-width: 62rem; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left, 0px)) 3rem; }
.enveloppe--etroite { max-width: 34rem; }
.enveloppe--large { max-width: 78rem; }

.bandeau {
  background: var(--term-bg);
  color: var(--term-fg);
  font-family: var(--mono);
  font-size: .72rem;
  padding: .45rem 0;
  border-bottom: 1px solid #000;
}
.bandeau .enveloppe, .bandeau .dedans { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; max-width: 78rem; margin: 0 auto; padding: 0 16px; }
.bandeau a { color: var(--term-fg); border-bottom: 1px dotted var(--term-muted); }
.bandeau a:hover { color: var(--term-accent); text-decoration: none; }
.bandeau .marque { color: var(--term-accent); font-weight: 700; }
.bandeau .marque::before { content: "# "; color: var(--term-muted); font-weight: 400; }
.bandeau .droite { margin-left: auto; color: var(--term-muted); display: flex; gap: .9rem; align-items: center; }

h1, h2, h3 { font-family: var(--mono); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.6rem; margin: 2rem 0 .4rem; }
h2 { font-size: 1.05rem; margin: 2.2rem 0 .6rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border); }
h3 { font-size: .9rem; margin: 1.2rem 0 .4rem; }
h1 em { font-style: normal; color: var(--accent); }
.invite { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin: 0 0 1.2rem; }
.invite b { color: var(--prompt); font-weight: 400; }
.chapeau { color: var(--muted); max-width: 46rem; }

/* ------------------------------------------------------------- cartes */
.grille { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.carte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.carte h3 { margin: 0; }
.carte p { margin: 0; font-size: .82rem; color: var(--muted); }
.carte--accent { border-left: 3px solid var(--accent); }
.carte--inactive { opacity: .72; background: var(--surface-2); }
.carte .pied { margin-top: auto; padding-top: .7rem; font-size: .72rem; font-family: var(--mono); color: var(--muted); }

.etiquette {
  display: inline-block; font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .05em; padding: .12rem .4rem; border-radius: 3px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}
.etiquette--ok { border-color: var(--ok); color: var(--ok); }
.etiquette--accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.etiquette--alerte { border-color: var(--alerte); color: var(--alerte); }
.etiquette--neutre { }

/* ------------------------------------------------------------- boutons */
.bouton {
  display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .74rem;
  padding: .45rem .9rem; border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none;
}
.bouton:hover, .bouton:focus-visible { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.bouton--primaire { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.bouton--primaire:hover, .bouton--primaire:focus-visible { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.bouton--discret { font-size: .68rem; padding: .25rem .55rem; }
.bouton--danger:hover, .bouton--danger:focus-visible { border-color: var(--alerte); color: var(--alerte); }
.bouton[disabled], .bouton--inactif { opacity: .5; cursor: not-allowed; }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ------------------------------------------------------------- formulaires */
form { margin: 0; }
.champ { display: block; margin-bottom: .9rem; }
.champ > span.libelle { display: block; font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .25rem; }
.champ > span.aide { display: block; font-size: .72rem; color: var(--muted); margin-top: .25rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; font-family: var(--mono); font-size: .82rem; padding: .5rem .6rem;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border); border-radius: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 4.5rem; resize: vertical; }
.champ-code input {
  font-size: 1.3rem; letter-spacing: .18em; text-align: center; text-transform: uppercase; padding: .7rem;
}
.grille-champs { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
fieldset { border: 1px solid var(--border); border-radius: 5px; padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 .3rem; }
.choix { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.choix label { display: flex; gap: .35rem; align-items: center; font-size: .82rem; }
.choix input { width: auto; }

/* ------------------------------------------------------------- messages */
.message { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 0 4px 4px 0; padding: .7rem .9rem; margin: 1rem 0; font-size: .85rem; background: var(--surface); }
.message--erreur { border-left-color: var(--alerte); background: var(--surface); }
.message--succes { border-left-color: var(--ok); }
.message--info { border-left-color: var(--accent); background: var(--accent-soft); }
.message b { font-family: var(--mono); }

/* ------------------------------------------------------------- terminal */
.terminal { background: var(--term-bg); color: var(--term-fg); border-radius: 6px; overflow: hidden; font-family: var(--mono); font-size: .74rem; border: 1px solid #000; }
.terminal .barre { display: flex; justify-content: space-between; background: #0b0f11; color: var(--term-muted); padding: .3rem .7rem; font-size: .66rem; border-bottom: 1px solid #000; }
.terminal .corps { padding: .8rem; }
.terminal .corps div { white-space: pre-wrap; word-break: break-word; }
.terminal .p { color: var(--term-prompt); }
.terminal .d { color: var(--term-muted); }
.terminal .a { color: var(--term-accent); }

.code-bon { font-family: var(--mono); font-size: 1.5rem; letter-spacing: .14em; color: var(--accent); font-weight: 700; }

/* ------------------------------------------------------------- tableaux */
.tableau-enveloppe { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .78rem; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.mono, th.mono, .mono { font-family: var(--mono); }
td.nombre { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.vide { padding: 1.2rem; color: var(--muted); font-size: .82rem; text-align: center; }

/* ------------------------------------------------------------- indicateurs */
.indicateurs { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); margin: 1.2rem 0; }
.indicateur { border: 1px solid var(--border); border-radius: 6px; padding: .6rem .75rem; background: var(--surface); }
.indicateur .l { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.indicateur .v { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.indicateur--accent { border-color: var(--accent); background: var(--accent-soft); }
.indicateur--accent .v { color: var(--accent); }

/* ------------------------------------------------------------- pied */
.pied-page { border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.2rem 0; font-size: .72rem; color: var(--muted); font-family: var(--mono); }
.pied-page .enveloppe { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding-bottom: 0; }

/* ------------------------------------------------------------- navigation admin */
.nav-admin { display: flex; flex-wrap: wrap; gap: .2rem; border-bottom: 1px solid var(--border); margin: 1.2rem 0 1.6rem; }
.nav-admin a { font-family: var(--mono); font-size: .74rem; padding: .45rem .8rem; border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0; color: var(--muted); margin-bottom: -1px; }
.nav-admin a:hover { color: var(--accent); text-decoration: none; }
.nav-admin a[aria-current="page"] { background: var(--surface); border-color: var(--border); color: var(--fg); }

.filtres { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin: 1rem 0; }
.filtres .champ { margin: 0; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 40rem) {
  h1 { font-size: 1.35rem; }
  .bandeau .droite { margin-left: 0; }
}
