:root {
  --fond: #16131d;
  --fond2: #1f1b29;
  --fond3: #2a2436;
  --bord: #3a3248;
  --texte: #f2eef8;
  --doux: #b8aecb;
  --rose: #ff7fa8;
  --rose-fonce: #e75f8c;
  --menthe: #63e6be;
  --jaune: #ffd479;
  --rouge: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
}

a { color: var(--rose); }

h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; }

.centre { max-width: 34rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
.large { max-width: 70rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* ---------- barre du haut ---------- */
.barre {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  background: var(--fond2);
  border-bottom: 1px solid var(--bord);
  flex-wrap: wrap;
}
.barre .logo { font-weight: 700; letter-spacing: .3px; margin-right: auto; display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--texte); }
.barre .logo span.point { color: var(--rose); }
.barre .qui { color: var(--doux); font-size: .92rem; }

/* ---------- boutons ---------- */
button, .btn {
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--bord);
  background: var(--fond3);
  color: var(--texte);
  padding: .6rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none;
  transition: background .12s, transform .08s;
}
button:hover, .btn:hover { background: #352d45; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }

.btn-rose, button.primaire {
  background: var(--rose); border-color: var(--rose); color: #2a0d19; font-weight: 600;
}
.btn-rose:hover, button.primaire:hover { background: var(--rose-fonce); }

.btn-petit { padding: .35rem .6rem; font-size: .85rem; border-radius: 9px; }
.btn-danger { color: var(--rouge); }
.btn-large { width: 100%; justify-content: center; padding: .85rem; font-size: 1.05rem; }

/* ---------- formulaires ---------- */
label { display: block; margin: .9rem 0 .3rem; font-weight: 600; font-size: .95rem; }
.aide { color: var(--doux); font-size: .85rem; font-weight: 400; margin-top: .2rem; }
input[type=text], input[type=password], select {
  width: 100%;
  font: inherit; font-size: 1.05rem;
  padding: .7rem .8rem;
  border-radius: var(--radius);
  border: 1px solid var(--bord);
  background: var(--fond3);
  color: var(--texte);
}
input:focus, select:focus { outline: 2px solid var(--rose); outline-offset: 1px; }

.carte {
  background: var(--fond2);
  border: 1px solid var(--bord);
  border-radius: 18px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.onglets { display: flex; gap: .5rem; margin-bottom: 1rem; }
.onglets button { flex: 1; justify-content: center; }
.onglets button.actif { background: var(--rose); border-color: var(--rose); color: #2a0d19; font-weight: 600; }

.message { padding: .7rem .9rem; border-radius: var(--radius); margin: .8rem 0; font-size: .95rem; }
.message.erreur { background: #45222a; border: 1px solid #7a3a48; color: #ffd0da; }
.message.ok { background: #1e3d33; border: 1px solid #2f6b58; color: #c9ffe9; }

/* ---------- liste de projets ---------- */
.projets { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.projet {
  background: var(--fond2); border: 1px solid var(--bord); border-radius: 16px;
  padding: 1rem; display: flex; flex-direction: column; gap: .55rem;
}
.projet h3 { font-size: 1.1rem; margin: 0; word-break: break-word; }
.projet .date { color: var(--doux); font-size: .82rem; }
.projet .actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }

.vide { color: var(--doux); text-align: center; padding: 2rem 1rem; }

/* ---------- editeur ---------- */
.editeur-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.zone { flex: 1; display: flex; min-height: 0; }
.colonne { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.col-code { flex: 1 1 50%; border-right: 1px solid var(--bord); }
.col-apercu { flex: 1 1 50%; }
.entete-col {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .45rem .7rem; background: var(--fond2); border-bottom: 1px solid var(--bord);
  font-size: .9rem; color: var(--doux);
}
.entete-col strong { color: var(--texte); font-size: .95rem; }
#apercu { flex: 1; width: 100%; border: 0; background: #fff; min-height: 0; }

.etat { font-size: .88rem; color: var(--menthe); min-width: 8.5rem; }
.etat.attente { color: var(--jaune); }
.etat.erreur { color: var(--rouge); }

.CodeMirror { height: 100% !important; font-size: 15.5px !important; line-height: 1.55 !important; font-family: "SF Mono", Menlo, Consolas, monospace !important; }
.cm-wrap { flex: 1; min-height: 0; overflow: hidden; }

/* ---------- panneau fichiers ---------- */
.panneau-fichiers {
  border-top: 1px solid var(--bord);
  background: var(--fond2);
  max-height: 34vh; display: flex; flex-direction: column;
}
.panneau-fichiers .entete-col { border-bottom: 1px solid var(--bord); border-top: 0; }
.depot { flex: 1; overflow: auto; padding: .5rem .7rem; }
.depot.survol { outline: 3px dashed var(--rose); outline-offset: -6px; background: #241b2b; }
.fichier { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; border-bottom: 1px solid #2c2538; flex-wrap: wrap; }
.fichier .ic { width: 1.7rem; text-align: center; font-size: 1.1rem; }
.fichier .nom { flex: 1; min-width: 7rem; word-break: break-all; font-size: .92rem; }
.fichier .taille { color: var(--doux); font-size: .78rem; }
.fichier img.vignette { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; background: #000; }

.modale-fond {
  position: fixed; inset: 0; background: rgba(8,6,12,.75);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50;
}
.modale { background: var(--fond2); border: 1px solid var(--bord); border-radius: 18px; padding: 1.25rem; max-width: 26rem; width: 100%; text-align: center; }
.modale img { width: 100%; max-width: 280px; background: #fff; border-radius: 12px; padding: 8px; }
.modale .lien { word-break: break-all; font-size: .85rem; color: var(--doux); margin: .6rem 0; }

.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--menthe); color: #08281e; padding: .6rem 1.1rem; border-radius: 999px;
  font-weight: 600; z-index: 99; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

/* ---------- tableau prof ---------- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { color: var(--doux); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .zone { flex-direction: column; }
  .col-code, .col-apercu { flex: 1 1 auto; border-right: 0; }
  .col-code { border-bottom: 1px solid var(--bord); min-height: 45vh; }
  .col-apercu { min-height: 45vh; }
  .editeur-page { height: auto; min-height: 100vh; overflow: auto; }
  .CodeMirror { height: 45vh !important; }
  .panneau-fichiers { max-height: none; }
}
