/* Theme iTeam University : marine, bordeaux, or, Montserrat */
:root {
  --navy: #1B2A4A;
  --navy-dark: #111D35;
  --navy-light: #2A3F6A;
  --burgundy: #8B1A2B;
  --burgundy-light: #A01830;
  --burgundy-dark: #6B1525;
  --gold: #D4A830;
  --white: #FFFFFF;
  --light-gray: #F5F5F5;
  --medium-gray: #E0E0E0;
  --muted: #64748B;
  --ok: #1E7A46;
  --ok-bg: #E6F4EC;
  --warn: #9A5B00;
  --warn-bg: #FFF3DC;
  --err-bg: #FBE9EC;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, .12);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-full: 50px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--navy);
  background: var(--light-gray);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}
a { color: var(--burgundy); text-decoration: none; }
a:hover { color: var(--burgundy-light); }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 48px; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }

/* ---------- en-tete */
.top-bar { background: var(--navy-dark); color: var(--white); font-size: .75rem; font-weight: 600; padding: 7px 0; }
.top-bar span { color: var(--gold); }
.entete { background: var(--white); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 10; }
.entete-in { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.marque img { height: 50px; display: block; }
nav { display: flex; align-items: center; gap: 22px; }
.nav-lien { color: var(--navy); font-weight: 600; position: relative; }
.nav-lien::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--burgundy); transform: scaleX(0); transition: transform .25s; }
.nav-lien:hover::after { transform: scaleX(1); }
.session { font-size: .8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.session a { font-weight: 600; }
.pastille { font-size: .75rem; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-full); background: var(--medium-gray); color: var(--navy); white-space: nowrap; }
.pastille.pret { background: var(--ok-bg); color: var(--ok); }
.pastille.chargement { background: var(--warn-bg); color: var(--warn); }
.pastille.erreur { background: var(--err-bg); color: var(--burgundy); }

/* ---------- pied */
.pied { background: var(--navy); color: rgba(255, 255, 255, .75); font-size: .8rem; }
.pied-in { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 22px; padding-bottom: 22px; }
.pied img { height: 38px; }
.pied p { margin: 0; }

/* ---------- bandeau */
.bandeau {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  border-radius: var(--radius-md);
  padding: 30px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.bandeau::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(212, 168, 48, .18); }
.bandeau h1 { color: var(--white); }
.bandeau p { margin: 0 0 18px; opacity: .85; max-width: 640px; line-height: 1.5; }
.bandeau .sur-titre { color: var(--gold); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.form-ligne { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.form-ligne input { flex: 1; min-width: 220px; }

/* ---------- elements */
input[type=text], input[type=number], input:not([type]), textarea {
  font: inherit; color: var(--navy); background: var(--white);
  border: 1.5px solid var(--medium-gray); border-radius: var(--radius-sm); padding: 10px 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(139, 26, 43, .12); }
input.modifie { border-color: var(--gold); background: #FFFBEF; }
.btn {
  font: inherit; font-weight: 600; font-size: .9rem; border: 0; cursor: pointer;
  padding: 10px 20px; border-radius: var(--radius-full); display: inline-flex; align-items: center; gap: 8px;
  background: var(--burgundy); color: var(--white); transition: background .2s, transform .1s;
}
.btn:hover { background: var(--burgundy-light); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.or { background: var(--gold); color: var(--navy-dark); }
.btn.or:hover { background: #E2B947; }
.btn.contour { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--medium-gray); }
.btn.contour:hover { box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn.danger { background: transparent; color: var(--burgundy); box-shadow: inset 0 0 0 1.5px rgba(139, 26, 43, .35); }
.btn.danger:hover { background: var(--err-bg); }
.btn.petit { padding: 6px 14px; font-size: .8rem; }

.carte { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 22px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.examen-carte { display: block; color: var(--navy); border-top: 4px solid var(--burgundy); transition: transform .2s, box-shadow .2s; }
.examen-carte:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); color: var(--navy); }
.examen-carte h3 { font-size: 1.05rem; }
.examen-carte .date { color: var(--muted); font-size: .8rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-full); background: var(--light-gray); }
.chip.ok, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn, .badge.a_verifier { background: var(--warn-bg); color: var(--warn); }
.chip.cours { background: #E8EEF9; color: var(--navy-light); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap; }
.vide-etat { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- page examen */
.fil { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.fil a { color: var(--muted); }
.titre-ligne { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.tuile { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 16px 18px; border-left: 4px solid var(--navy); }
.tuile b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.tuile span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.tuile.ok { border-left-color: var(--ok); } .tuile.ok b { color: var(--ok); }
.tuile.warn { border-left-color: var(--gold); } .tuile.warn b { color: var(--warn); }

.depot {
  display: block;
  border: 2px dashed rgba(139, 26, 43, .4); border-radius: var(--radius-md); background: var(--white);
  padding: 26px; text-align: center; cursor: pointer; transition: background .2s, border-color .2s; margin-bottom: 14px;
}
.depot:hover, .depot.survol { background: #FBF4F5; border-color: var(--burgundy); }
.depot b { color: var(--burgundy); }
.depot small { display: block; color: var(--muted); margin-top: 6px; }
.depot .icone { font-size: 1.8rem; color: var(--burgundy); line-height: 1; margin-bottom: 6px; }
.fichiers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 26px; }
.fichier { display: grid; grid-template-columns: 1fr 220px auto; align-items: center; gap: 14px; background: var(--white); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow-sm); font-size: .85rem; }
.fichier .nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fichier .erreur { color: var(--burgundy); font-size: .78rem; font-weight: 500; }
.barre { height: 8px; border-radius: 4px; background: var(--light-gray); overflow: hidden; }
.barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--burgundy), var(--gold)); transition: width .4s; }
.barre.indet i { width: 35% !important; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.onglets { display: flex; gap: 4px; border-bottom: 2px solid var(--medium-gray); margin-bottom: 14px; align-items: flex-end; flex-wrap: wrap; }
.onglet { font: inherit; font-weight: 600; background: none; border: 0; padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.onglet.actif { color: var(--burgundy); border-bottom-color: var(--burgundy); }
.onglets .filtre { margin-left: auto; font-size: .85rem; padding-bottom: 8px; display: flex; gap: 6px; align-items: center; cursor: pointer; }

.tableau-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { background: var(--navy); color: var(--white); text-align: left; font-weight: 600; padding: 11px 12px; white-space: nowrap; font-size: .78rem; }
td { padding: 10px 12px; border-bottom: 1px solid var(--light-gray); vertical-align: top; }
tr:hover td { background: #FAFBFD; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.total { font-weight: 800; color: var(--burgundy); }
td.code { font-weight: 700; font-variant-numeric: tabular-nums; }
.raisons { margin: 0; padding-left: 16px; color: var(--warn); font-size: .78rem; max-width: 420px; }
.raisons li { margin: 2px 0; }
.faible { color: var(--burgundy); font-weight: 700; }

/* ---------- revue d'une feuille */
.revue { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }
.apercu { position: sticky; top: 96px; padding: 10px; }
.apercu img { width: 100%; display: block; border-radius: var(--radius-sm); cursor: zoom-in; }
.apercu.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(17, 29, 53, .92); padding: 20px; overflow: auto; border-radius: 0; }
.apercu.zoom img { width: auto; max-width: none; height: auto; margin: 0 auto; cursor: zoom-out; }
.alertes { background: var(--warn-bg); border-left: 4px solid var(--gold); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; font-size: .85rem; }
.alertes.ok { background: var(--ok-bg); border-left-color: var(--ok); color: var(--ok); font-weight: 600; }
.alertes ul { margin: 6px 0 0; padding-left: 18px; color: var(--warn); }
.section { margin-bottom: 18px; }
.section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--burgundy); margin-bottom: 10px; }
.champ { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.zone-img { background: var(--white); border: 1px solid var(--medium-gray); border-radius: var(--radius-sm); height: 58px; width: 100%; object-fit: contain; display: block; }
.ligne-note { display: grid; grid-template-columns: 26px 1fr 84px 18px 1fr 84px 54px; gap: 8px; align-items: center; margin-bottom: 8px; }
.ligne-note .n { font-weight: 800; color: var(--muted); text-align: center; }
.ligne-note input { width: 100%; text-align: center; font-weight: 700; padding: 8px 6px; }
.ligne-note .slash { text-align: center; color: var(--muted); font-weight: 700; }
.conf { font-size: .72rem; font-weight: 700; text-align: center; border-radius: var(--radius-full); padding: 3px 0; background: var(--ok-bg); color: var(--ok); }
.conf.bas { background: var(--err-bg); color: var(--burgundy); }
.conf.na { background: var(--light-gray); color: var(--muted); }
.somme { font-size: .82rem; color: var(--muted); margin: 4px 0 0 34px; }
.somme b { color: var(--navy); }
.somme .ecart { color: var(--burgundy); font-weight: 700; }
.feuille-num { display: flex; gap: 8px; align-items: center; }
.feuille-num input { width: 70px; text-align: center; font-weight: 700; }
.barre-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; border-top: 1px solid var(--medium-gray); padding-top: 16px; margin-top: 8px; }
.case { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; margin: 10px 0; cursor: pointer; }
.case input { margin-top: 3px; accent-color: var(--burgundy); }
textarea { width: 100%; min-height: 54px; resize: vertical; }
.nav-feuilles { display: flex; gap: 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); background: var(--navy-dark); color: var(--white); padding: 12px 22px; border-radius: var(--radius-full); font-weight: 600; font-size: .88rem; opacity: 0; pointer-events: none; transition: .3s; z-index: 100; box-shadow: var(--shadow-md); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { background: var(--burgundy); }

@media (max-width: 960px) {
  .revue { grid-template-columns: 1fr; }
  .apercu { position: static; }
  .tuiles { grid-template-columns: repeat(2, 1fr); }
  .fichier { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .entete-in { height: 64px; }
  .marque img { height: 38px; }
  .session { display: none; }
  .bandeau { padding: 22px 20px; }
  .champ { grid-template-columns: 1fr; }
  .ligne-note { grid-template-columns: 22px 1fr 64px 12px 1fr 64px; }
  .ligne-note .conf { display: none; }
  .pied-in { flex-direction: column; text-align: center; }
}
