/* =====================================================================
   Lycée Errached — feuille de style
   Couleurs reprises du logo officiel (bleu #0E4CAF).
   ===================================================================== */
:root {
  --blue: #0e4caf;
  --blue-600: #0b3f93;
  --navy: #0a2a63;
  --blue-50: #eef3fc;
  --blue-100: #dbe6f8;
  --gold: #d4a02a;
  --gold-50: #fbf4e2;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #14213d;
  --muted: #5d6b84;
  --line: #e2e8f2;
  --danger: #c0392b;
  --danger-50: #fdeeec;
  --ok: #17803d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 80, .06), 0 4px 16px rgba(16, 35, 80, .06);
  --shadow-hover: 0 2px 4px rgba(16, 35, 80, .08), 0 12px 28px rgba(16, 35, 80, .12);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
[dir="rtl"] body { font-family: var(--font-ar); }
[dir="rtl"] .flip { transform: scaleX(-1); }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(14, 76, 175, .35); outline-offset: 2px; border-radius: 6px; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-items: center; }
.boot img { border-radius: 20px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.97); } }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 2px 8px rgba(14, 76, 175, .25); }
.brand span { display: flex; flex-direction: column; min-width: 0; }
.brand b { font-size: 1.05rem; font-weight: 800; color: var(--navy); white-space: nowrap; }
.brand small { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mainnav { display: flex; gap: .25rem; margin-inline-start: auto; }
.nav-i {
  position: relative; display: flex; align-items: center; gap: .45rem; padding: .55rem .85rem;
  border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .92rem; transition: background .2s, color .2s;
}
.nav-i:hover { background: var(--blue-50); color: var(--blue); }
.nav-i.on { background: var(--blue); color: #fff; }
.dot {
  font-style: normal; font-size: .7rem; font-weight: 700; background: var(--gold); color: #fff;
  min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; border-radius: 999px; display: inline-grid; place-items: center;
}
.top-actions { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; }
.mainnav + .top-actions { margin-inline-start: 0; }
.lang { display: flex; background: var(--blue-50); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; padding: .35rem .7rem; border-radius: 999px; cursor: pointer;
  font-size: .82rem; font-weight: 700; color: var(--blue-600); transition: background .2s, color .2s;
}
.lang button[lang="ar"] { font-family: var(--font-ar); }
.lang button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(14, 76, 175, .2); }
.icon-btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: .45rem .75rem; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .88rem;
  transition: border-color .2s, color .2s, background .2s;
}
.icon-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-50); }

/* ---------- Mise en page ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.narrow { max-width: 460px; margin: 1.5rem auto; }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 1.25rem 1rem 1.5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-levels { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-subjects { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.block { margin-top: 2.25rem; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.block-head h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; color: var(--navy); }
.block-head h2 .ic { color: var(--gold); }
.link { display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; font-size: .92rem; }
.sec-title { text-align: center; font-size: 1.3rem; color: var(--navy); margin: 0 0 1.1rem; }
.sec-sub { display: flex; align-items: center; gap: .5rem; font-size: 1rem; color: var(--muted); font-weight: 600; margin: 0 0 1rem; }
.row-end { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.row-end .push { margin-inline-end: auto; }

/* ---------- Cartes ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
a.card { color: inherit; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--blue-100); }
.grid > .card { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Accueil ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; color: #fff; text-align: center;
  background: linear-gradient(140deg, var(--navy) 0%, var(--blue) 55%, #2a6ad6 100%);
  padding: 2.75rem 1.25rem 2.5rem; margin-bottom: 2rem; box-shadow: 0 18px 40px rgba(10, 42, 99, .25);
}
.hero-bg {
  position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: radial-gradient(circle at 15% 20%, #fff 0 2px, transparent 3px), radial-gradient(circle at 85% 70%, #fff 0 2px, transparent 3px);
  background-size: 46px 46px, 62px 62px;
}
.hero-in { position: relative; max-width: 760px; margin: 0 auto; }
.hero-logo {
  width: 132px; height: 132px; margin: 0 auto 1.2rem; border-radius: 28px;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .15), 0 12px 30px rgba(0, 0, 0, .25); animation: rise .6s var(--ease) both;
}
.hero h1 { font-size: clamp(1.55rem, 3.6vw, 2.35rem); font-weight: 800; }
.hero .lead { font-size: clamp(1rem, 2vw, 1.1rem); opacity: .92; margin: .9rem auto 1.4rem; max-width: 640px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.chips li {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 600;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); padding: .4rem .85rem; border-radius: 999px;
}
.spaces { max-width: 900px; margin: 0 auto; }
.space-card { display: flex; flex-direction: column; gap: 1rem; padding: 1.6rem; position: relative; overflow: hidden; }
.space-card::after {
  content: ''; position: absolute; inset-inline-end: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: var(--blue-50); transition: transform .4s var(--ease);
}
.space-teacher::after { background: var(--gold-50); }
.space-card:hover::after { transform: scale(1.25); }
.space-ic {
  position: relative; z-index: 1; width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
  background: var(--blue); color: #fff; box-shadow: 0 8px 18px rgba(14, 76, 175, .3);
}
.space-ic .ic { width: 30px; height: 30px; }
.space-teacher .space-ic { background: linear-gradient(135deg, #e0ad38, #b9851a); box-shadow: 0 8px 18px rgba(212, 160, 42, .35); }
.space-txt { position: relative; z-index: 1; display: flex; flex-direction: column; gap: .35rem; }
.space-txt b { font-size: 1.3rem; color: var(--navy); }
.space-txt small { color: var(--muted); font-size: .95rem; }
.space-card .btn { position: relative; z-index: 1; align-self: flex-start; }
.space-teacher .btn { background: var(--navy); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent;
  background: var(--blue); color: #fff; padding: .62rem 1.1rem; border-radius: var(--radius-sm); font-weight: 650;
  font-size: .95rem; cursor: pointer; transition: background .2s, transform .1s, box-shadow .2s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--blue-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: .8rem 1.35rem; font-size: 1rem; }
.btn-sm { padding: .42rem .75rem; font-size: .85rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--blue-50); border-color: var(--blue-100); }
.btn-soft { background: var(--blue-50); color: var(--blue); }
.btn-soft:hover { background: var(--blue-100); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a02e22; }
.danger { color: var(--danger) !important; }
.btn-ghost.danger:hover { background: var(--danger-50); border-color: #f3c5bf; }
.spin {
  width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Connexion ---------- */
.login-card { padding: 2rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; animation: rise .4s var(--ease) both; }
.login-card h1 { font-size: 1.35rem; text-align: center; color: var(--navy); }
.login-card > p { text-align: center; margin: -.4rem 0 .3rem; font-size: .92rem; }
.login-ic {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; color: #fff;
  background: var(--blue); box-shadow: 0 8px 18px rgba(14, 76, 175, .3);
}
.login-ic.teacher { background: linear-gradient(135deg, #e0ad38, #b9851a); }
.login-ic .ic { width: 32px; height: 32px; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .9rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }
.field small { font-size: .8rem; }
input:not([type=radio]):not([type=file]), select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: var(--radius-sm);
  padding: .7rem .85rem; font-size: 1rem; transition: border-color .2s, box-shadow .2s; min-height: 46px;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(14, 76, 175, .12); }
select:disabled { background: #f3f5f9; color: var(--muted); }
.input-ic { position: relative; }
.input-ic > .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: .85rem; color: var(--muted); pointer-events: none; }
.input-ic input { padding-inline-start: 2.6rem !important; }
.input-ic input[type=password], .input-ic input[name=password] { padding-inline-end: 3rem !important; }
.eye {
  position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: .35rem; border: 0; background: transparent;
  width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer;
}
.eye:hover { background: var(--blue-50); color: var(--blue); }
.form-err {
  background: var(--danger-50); color: var(--danger); border: 1px solid #f3c5bf; border-radius: var(--radius-sm);
  padding: .7rem .9rem; font-size: .92rem; font-weight: 500; white-space: pre-line;
}

/* ---------- En-tête de page ---------- */
.page-head { margin-bottom: 1.4rem; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; font-size: .84rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--blue); }
.crumbs .ic { width: .95em; height: .95em; opacity: .6; }
.crumbs span { color: var(--text); font-weight: 600; }
.page-title { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.page-title h1 { font-size: clamp(1.35rem, 3vw, 1.75rem); color: var(--navy); font-weight: 800; flex: 1; min-width: 0; }
.page-actions { display: flex; gap: .5rem; }
.back {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .88rem; transition: background .2s;
}
.back:hover { background: var(--blue-50); }
.sub-ctx { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin: -.8rem 0 1.1rem; font-weight: 500; }
.sub-ctx .ic { color: var(--blue); }

/* ---------- Recherche ---------- */
.searchbar {
  display: flex; align-items: center; gap: .5rem; background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: .3rem .35rem; padding-inline-start: 1rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s;
}
.searchbar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(14, 76, 175, .12); }
.searchbar > .ic { color: var(--muted); }
.searchbar input { border: 0 !important; box-shadow: none !important; padding: .5rem 0 !important; min-height: 40px !important; background: transparent !important; }
.searchbar .btn { border-radius: 999px; }

/* ---------- Niveaux, classes, matières ---------- */
.level-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.15rem; }
.lvl-num {
  width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.45rem;
  color: var(--blue); background: var(--blue-50); border: 1px solid var(--blue-100);
}
.lvl-num.sm .ic { width: 24px; height: 24px; }
.lvl-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lvl-txt b { font-size: 1.02rem; }
.lvl-txt small { color: var(--muted); font-size: .84rem; }
.go { color: var(--muted); transition: transform .25s var(--ease), color .2s; }
a.card:hover .go { color: var(--blue); transform: translateX(3px); }
[dir="rtl"] a.card:hover .go { transform: scaleX(-1) translateX(3px); }
.subject-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .75rem; padding: 1.4rem 1rem; }
.subj-ic {
  width: 60px; height: 60px; border-radius: 17px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--c1, #0e4caf), var(--c2, #3b7be0));
  box-shadow: 0 8px 18px -6px var(--c1, #0e4caf);
  transition: transform .25s var(--ease);
}
a.card:hover .subj-ic { transform: scale(1.07) rotate(-3deg); }
.subj-ic .ic { width: 30px; height: 30px; }
.lvl-num.sm[style] { color: #fff; border: 0; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 6px 14px -6px var(--c1); }
.subject-card b { font-size: .98rem; }

/* ---------- Publications ---------- */
.seg { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.seg a, .seg-input label span {
  display: inline-block; padding: .45rem .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  color: var(--muted); font-weight: 600; font-size: .88rem; cursor: pointer; transition: all .2s;
}
.seg a:hover, .seg-input label span:hover { border-color: var(--blue-100); color: var(--blue); }
.seg a.on, .seg-input input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg-input { margin: 0; }
.seg-input input { position: absolute; opacity: 0; pointer-events: none; }
.seg-input input:focus-visible + span { outline: 3px solid rgba(14, 76, 175, .35); }
.courses { display: grid; gap: 1rem; }
.course {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow);
  animation: rise .4s var(--ease) both; border-inline-start: 4px solid var(--blue);
}
.course-top { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .55rem; }
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.tag .ic { width: .95em; height: .95em; }
.t-course { background: var(--blue-50); color: var(--blue); }
.t-exercise { background: #e8f6ee; color: #17803d; }
.t-homework { background: #fdf0e3; color: #b45a10; }
.t-other { background: #f0eef8; color: #5a48a8; }
.t-new { background: var(--gold-50); color: #9a6c06; }
.course h3 { font-size: 1.1rem; color: var(--navy); word-break: break-word; }
.ctx { display: inline-flex; align-items: center; gap: .35rem; font-size: .86rem; font-weight: 600; margin-top: .3rem; }
.ctx .ic { width: 1em; height: 1em; }
.desc { margin: .5rem 0 0; color: #3b4863; white-space: pre-line; word-break: break-word; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .85rem; color: var(--muted); margin-top: .7rem; }
.meta span { display: inline-flex; align-items: center; gap: .35rem; }
.meta .ic { width: 1em; height: 1em; }
.files { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .5rem; }
.file {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem; border-radius: var(--radius-sm);
  background: #f8fafd; border: 1px solid var(--line);
}
.file.bad { background: var(--danger-50); border-color: #f3c5bf; }
.file.bad small { color: var(--danger); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fname { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { color: var(--muted); font-size: .8rem; }
.file-act { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.file-act label.btn { cursor: pointer; }
.fbadge {
  position: relative; width: 42px; height: 48px; flex: none; display: grid; place-items: center; color: #7a8599;
}
.fbadge .ic { width: 42px; height: 48px; stroke-width: 1.2; }
.fbadge b {
  position: absolute; bottom: 7px; font-size: .58rem; font-weight: 800; color: #fff; background: #7a8599;
  padding: .05rem .25rem; border-radius: 4px; letter-spacing: .02em; direction: ltr;
}
.k-pdf { color: #d93025; } .k-pdf b { background: #d93025; }
.k-doc { color: #2b5797; } .k-doc b { background: #2b5797; }
.k-ppt { color: #d24726; } .k-ppt b { background: #d24726; }
.k-xls { color: #1e7145; } .k-xls b { background: #1e7145; }
.k-img { color: #7b3fbf; } .k-img b { background: #7b3fbf; }
.course-admin { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--line); }

/* ---------- Tableau de bord professeur ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center; }
.stat > span { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.stat:nth-child(3) > span { background: var(--gold-50); color: #9a6c06; }
.stat b { font-size: 1.5rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat small { color: var(--muted); font-size: .84rem; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.4fr); gap: .75rem; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* ---------- Formulaire de publication ---------- */
.form { padding: 1.5rem; }
section.form { margin-top: 1.25rem; }
.step { border: 0; padding: 0; margin: 0 0 1.4rem; min-width: 0; transition: opacity .2s; }
.step:disabled { opacity: .5; }
.step legend { display: flex; align-items: center; gap: .6rem; font-weight: 750; font-size: 1.05rem; color: var(--navy); margin-bottom: .9rem; padding: 0; }
.step legend i {
  font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-size: .9rem;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; cursor: pointer;
  border: 2px dashed var(--blue-100); border-radius: var(--radius); padding: 1.6rem 1rem; background: #fafcff; transition: all .2s;
}
.drop:hover, .drop.over { border-color: var(--blue); background: var(--blue-50); }
.drop-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); margin-bottom: .2rem; }
.drop b { color: var(--blue); }
.drop small { font-size: .82rem; }
.picked:empty { display: none; }
.progress { display: flex; flex-direction: column; gap: .4rem; margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.bar { height: 8px; background: var(--blue-50); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 5%; background: linear-gradient(90deg, var(--blue), #3b7be0); border-radius: 99px; transition: width .4s var(--ease); }
.busy { display: flex; align-items: center; gap: .6rem; color: var(--blue); font-weight: 600; margin: .8rem 0; }
section.form .files { margin-bottom: 1rem; }

/* ---------- États ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 2.5rem 1rem; color: var(--muted); }
.state-box {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 2.2rem 1.2rem;
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.state-box > .ic { width: 40px; height: 40px; color: var(--blue-100); }
.state-box.err > .ic { color: var(--danger); }
.state-box p { margin: 0; max-width: 520px; }
.state-box h2 { color: var(--navy); font-size: 1.2rem; }
.narrow .state-box { margin-bottom: 1rem; }

/* ---------- Notifications ---------- */
#toasts { position: fixed; z-index: 60; inset-inline-end: 1rem; top: 5rem; display: flex; flex-direction: column; gap: .6rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; align-items: flex-start; gap: .6rem; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem .9rem; box-shadow: var(--shadow-hover); animation: toastIn .35s var(--ease) both; font-size: .92rem;
  border-inline-start: 4px solid var(--ok);
}
.toast > .ic { color: var(--ok); margin-top: .1rem; }
.toast-err { border-inline-start-color: var(--danger); } .toast-err > .ic { color: var(--danger); }
.toast-info { border-inline-start-color: var(--gold); } .toast-info > .ic { color: var(--gold); }
.toast span { flex: 1; }
.toast-act { font-weight: 700; white-space: nowrap; }
.toast-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .4s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

/* ---------- Fenêtres ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 70; background: rgba(10, 25, 55, .5); display: grid; place-items: center; padding: 1rem;
  animation: fade .2s both; backdrop-filter: blur(3px);
}
.modal-wrap.out { opacity: 0; transition: opacity .18s; }
.modal { background: #fff; border-radius: 16px; padding: 1.4rem; width: min(440px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); animation: rise .25s var(--ease) both; }
.modal-wide { width: min(980px, 100%); }
.confirm-ic { color: var(--danger); display: flex; justify-content: center; }
.confirm-ic .ic { width: 42px; height: 42px; }
.confirm-msg { text-align: center; font-weight: 500; margin: .8rem 0 0; word-break: break-word; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.viewer-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer { background: #f1f4f9; border-radius: 10px; display: grid; place-items: center; max-height: 70vh; overflow: auto; }
.viewer img { max-height: 70vh; width: auto; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Tablette ---------- */
@media (max-width: 960px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .grow { grid-column: 1 / -1; }
  .nav-i { padding: .55rem .65rem; }
}

/* ---------- Smartphone ---------- */
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
  .topbar-in { padding: .5rem .75rem; gap: .5rem; }
  .brand img { width: 38px; height: 38px; }
  .brand b { font-size: .98rem; }
  .icon-btn .lbl { display: none; }
  .icon-btn { padding: .5rem; }
  .lang button { padding: .32rem .55rem; }
  /* Barre de navigation en bas de l'écran */
  .mainnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; margin: 0; gap: 0;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16, 35, 80, .08);
    padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .nav-i { flex: 1; flex-direction: column; gap: .15rem; font-size: .7rem; padding: .4rem .2rem; border-radius: 12px; }
  .nav-i .ic { width: 1.4em; height: 1.4em; }
  .nav-i.on { background: var(--blue-50); color: var(--blue); }
  .nav-i .dot { position: absolute; top: .15rem; inset-inline-start: calc(50% + .35rem); }
  .top-actions { margin-inline-start: auto !important; }
  main { padding: 1rem .8rem 2rem; }
  main.with-nav { padding-bottom: 6rem; }
  .foot { padding-bottom: 1rem; }
  main.with-nav + .foot { padding-bottom: 5.5rem; }
  .hero { padding: 2rem 1rem; border-radius: 18px; margin-bottom: 1.5rem; }
  .hero-logo { width: 104px; height: 104px; border-radius: 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-levels { grid-template-columns: 1fr; gap: .7rem; }
  .grid-subjects { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .space-card { padding: 1.25rem; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .space-txt { flex: 1; min-width: 180px; }
  .space-card .btn { width: 100%; }
  .stats { gap: .5rem; }
  .stat { grid-template-columns: 1fr; text-align: center; padding: .8rem .4rem; justify-items: center; }
  .stat > span { grid-row: auto; width: 36px; height: 36px; margin-bottom: .3rem; }
  .stat b { font-size: 1.25rem; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:nth-child(3) { grid-column: 1 / -1; }
  .row2 { grid-template-columns: 1fr; }
  .form { padding: 1.1rem; }
  .page-title .page-actions { width: 100%; }
  .page-title .page-actions .btn { flex: 1; }
  .back span { display: none; }
  .back { padding: .5rem; }
  .file { flex-wrap: wrap; }
  .file-act { width: 100%; }
  .file-act .btn { flex: 1; }
  .course { padding: 1rem; }
  .searchbar .btn { display: none; }
  #toasts { top: auto; bottom: 5.5rem; inset-inline: .75rem; max-width: none; }
  .row-end .btn { flex: 1; }
  .row-end .push { flex-basis: 100%; order: 3; margin: 0; }
}
@media (max-width: 380px) {
  .brand small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Page d'accueil (design « Proposition C améliorée », fond clair)
   ===================================================================== */
main.home { max-width: none; padding: 0 0 3rem; }
.h-in { max-width: 1240px; margin: 0 auto; padding: 0 32px; position: relative; }
.h-hero {
  position: relative; overflow: hidden; background: #f3f6fd;
  background-image: radial-gradient(rgba(14, 76, 175, .07) 1.2px, transparent 1.2px); background-size: 28px 28px;
}
.h-hero::before {
  content: ''; position: absolute; inset-inline-end: -180px; top: -220px; width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 143, 240, .22) 0%, rgba(94, 143, 240, 0) 70%); pointer-events: none;
}
.h-hero::after {
  content: ''; position: absolute; inset-inline-start: -200px; bottom: -160px; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 199, 92, .18) 0%, rgba(242, 199, 92, 0) 70%); pointer-events: none;
}
.h-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 56px; align-items: center; padding-top: 56px; padding-bottom: 130px; z-index: 1; }
.h-copy { display: flex; flex-direction: column; gap: 26px; animation: rise .5s var(--ease) both; }
.h-title { margin: 0; font-size: clamp(2.3rem, 4.4vw, 3.75rem); line-height: 1.07; letter-spacing: -0.035em; font-weight: 800; color: var(--navy); }
[dir="rtl"] .h-title { letter-spacing: 0; line-height: 1.3; }
.h-name { position: relative; display: inline-block; color: var(--blue); white-space: nowrap; }
.h-name svg { position: absolute; inset-inline-start: 0; bottom: -10px; width: 100%; height: 14px; }
.h-name path { fill: none; stroke: #f2c75c; stroke-width: 5; stroke-linecap: round; }
.h-lead { margin: 4px 0 0; font-size: 18.5px; line-height: 1.65; color: #4a5872; max-width: 540px; }

.h-photo { position: relative; justify-self: center; width: 100%; max-width: 470px; aspect-ratio: 470 / 560; animation: rise .6s .1s var(--ease) both; }
.h-block { position: absolute; inset: 26px -26px -26px 26px; border-radius: 36px; background: #dfe8fb; }
[dir="rtl"] .h-block { inset: 26px 26px -26px -26px; }
.h-ring { position: absolute; inset: -40px -60px -40px -40px; border-radius: 50%; border: 2px dashed rgba(14, 76, 175, .18); }
.h-img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; border-radius: 36px; box-shadow: 0 40px 70px -30px rgba(10, 42, 99, .35); }
.h-chip {
  position: absolute; display: flex; align-items: center; gap: 10px; background: #fff; color: var(--navy);
  border-radius: 16px; padding: 10px 14px; box-shadow: 0 18px 40px -16px rgba(10, 42, 99, .45); font-size: 13.5px; font-weight: 700;
  animation: float 6s ease-in-out infinite;
}
.h-chip-content { top: 34px; inset-inline-start: -46px; }
.h-chip-news { bottom: 54px; inset-inline-start: -54px; padding: 12px 16px; max-width: 300px; animation-delay: -3s; }
.h-tiles { display: flex; }
.h-tiles span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 0 0 2px #fff; }
.h-tiles span + span { margin-inline-start: -6px; }
.h-tiles .ic { width: 17px; height: 17px; }
.h-bell { flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--blue); color: #fff; display: grid; place-items: center; }
.h-news-txt { display: flex; flex-direction: column; min-width: 0; }
.h-news-txt b { font-size: 14px; }
.h-news-txt small { font-size: 12.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-langs {
  position: absolute; inset-inline-end: -50px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px;
  background: #fff; border-radius: 18px; padding: 8px; box-shadow: 0 18px 40px -16px rgba(10, 42, 99, .45);
}
.h-langs button {
  width: 42px; height: 42px; border: 0; border-radius: 11px; color: #fff; font-weight: 800; font-size: 13px; cursor: pointer;
  opacity: .55; transition: opacity .2s, transform .2s; outline-offset: 2px;
}
.h-langs button:hover { opacity: .85; transform: scale(1.06); }
.h-langs button.on { opacity: 1; box-shadow: 0 0 0 3px #fff, 0 0 0 5px currentColor; }
.h-langs .l-ar { background: #059669; font-family: var(--font-ar); font-size: 17px; }
.h-langs .l-fr { background: #1e40af; }
.h-langs .l-en { background: #be123c; }
.h-langs .l-ar.on { color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #059669; }
.h-langs .l-fr.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #1e40af; }
.h-langs .l-en.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #be123c; }
.h-wave { position: absolute; left: 0; bottom: -1px; width: 100%; height: 90px; display: block; z-index: 1; }
.h-wave path { fill: var(--bg); }
@keyframes float { 50% { transform: translateY(-6px); } }

.h-h2 { margin: 0 0 24px; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.h-in > .h-h2 { margin-top: 40px; }
.h-spaces { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.h-space {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  min-height: 300px; padding: 32px; border-radius: 28px; text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.h-space:hover { transform: translateY(-4px); box-shadow: 0 24px 40px -24px rgba(10, 42, 99, .5); }
.h-space-student { background: #e9e4ff; color: #1b1840; }
.h-space-teacher { background: #fbf1d8; color: #3a2a05; }
.h-disc { position: absolute; inset-inline-end: -40px; bottom: -60px; width: 340px; height: 340px; border-radius: 50%; background: #f6e2ad; }
.h-space-txt { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; max-width: 54%; }
.h-space-txt b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.h-space-teacher .h-space-txt b { color: var(--navy); }
.h-space-txt small { font-size: 15px; line-height: 1.55; }
.h-space-student small { color: #4d4975; }
.h-space-teacher small { color: #5c4a1e; }
.h-tag { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #fff; padding: 6px 10px; border-radius: 999px; }
.h-space-student .h-tag { color: #4f3bd6; }
.h-space-teacher .h-tag { color: #8a5d00; }
.h-go { position: relative; z-index: 1; align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 13px 20px; border-radius: 12px; color: #fff; font-weight: 700; font-size: 15px; }
.h-space-student .h-go { background: #4f3bd6; }
.h-space-teacher .h-go { background: var(--navy); }
.h-space img { position: absolute; inset-inline-end: -10px; bottom: -6px; width: 320px; height: auto; transition: transform .35s var(--ease); }
.h-space-teacher img { width: 300px; bottom: 0; }
.h-space:hover img { transform: translateY(-4px) scale(1.02); }
[dir="rtl"] .h-space img { transform: scaleX(-1); }
[dir="rtl"] .h-space:hover img { transform: scaleX(-1) translateY(-4px) scale(1.02); }

.h-path { margin-top: 72px; }
.h-kicker { display: block; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #c99522; margin-bottom: 8px; }
[dir="rtl"] .h-kicker { letter-spacing: 0; }
.h-ladder { display: flex; align-items: flex-end; gap: 12px; }
.h-step {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 16px;
  border-radius: 18px 18px 6px 6px; text-decoration: none; color: var(--navy); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.h-step:hover { transform: translateY(-6px); box-shadow: 0 20px 30px -20px rgba(10, 42, 99, .6); }
.h-num { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: rgba(255, 255, 255, .22); }
.h-step-txt { display: flex; flex-direction: column; gap: 4px; }
.h-step-txt b { font-size: 14px; line-height: 1.3; }
.h-step-txt small { font-size: 12px; opacity: .85; }
.h-step.s0 { height: 120px; background: #fff; border: 1px solid #dfe6f3; }
.h-step.s0 .h-num { background: #e7eefc; color: var(--blue); }
.h-step.s1 { height: 156px; background: #f2f6fe; border: 1px solid #d8e2f5; }
.h-step.s1 .h-num { background: #dbe6fb; color: var(--blue); }
.h-step.s2 { height: 192px; background: #e3ecfc; border: 1px solid #cddaf3; }
.h-step.s2 .h-num { background: #fff; color: var(--blue); }
.h-step.s3 { height: 228px; background: #5f8fe0; color: #fff; }
.h-step.s4 { height: 264px; background: #2f6ad0; color: #fff; }
.h-step.s5 { height: 300px; background: var(--blue); color: #fff; }
.h-step.s6 { height: 348px; background: var(--navy); color: #fff; box-shadow: 0 24px 40px -22px rgba(10, 42, 99, .8); }
.h-step.s6 b { font-size: 16px; color: #f2c75c; }
.h-cap { width: 44px; height: 44px; background: #f2c75c; color: var(--navy); }
.h-cap .ic { width: 24px; height: 24px; }
.h-floor { height: 10px; border-radius: 999px; background: #dfe6f3; margin-top: 2px; }

@media (max-width: 960px) {
  .h-grid { gap: 40px; }
  .h-chip-content, .h-chip-news { inset-inline-start: -20px; }
  .h-langs { inset-inline-end: -18px; }
}
@media (max-width: 760px) {
  .h-in { padding: 0 18px; }
  .h-grid { grid-template-columns: minmax(0, 1fr); padding-top: 30px; padding-bottom: 100px; gap: 44px; }
  .h-lead { font-size: 16.5px; }
  .h-photo { max-width: 330px; }
  .h-ring { inset: -24px -30px -24px -24px; }
  .h-block { inset: 18px -16px -18px 18px; }
  [dir="rtl"] .h-block { inset: 18px 18px -18px -16px; }
  .h-chip { font-size: 12.5px; padding: 8px 11px; }
  .h-chip-content { top: 18px; inset-inline-start: -12px; }
  .h-chip-news { bottom: 26px; inset-inline-start: -12px; max-width: 250px; }
  .h-langs { inset-inline-end: -14px; padding: 6px; gap: 6px; }
  .h-langs button { width: 38px; height: 38px; }
  .h-spaces { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .h-space { min-height: 250px; padding: 24px; }
  .h-space-txt { max-width: 58%; }
  .h-space-txt b { font-size: 23px; }
  .h-space img { width: 190px; }
  .h-space-teacher { min-height: 270px; }
  .h-space-teacher img { width: 165px; }
  .h-disc { width: 220px; height: 220px; bottom: -50px; }
  .h-path { margin-top: 52px; }
  .h-ladder { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .h-step { height: auto !important; flex-direction: row; justify-content: flex-start; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; }
  .h-num { flex: none; }
  .h-step.s6 { padding: 14px; }
  .h-floor { display: none; }
}
