:root{
  --bg:#f6f7fb; --card:#fff; --text:#1c2230; --muted:#667085; --line:#e4e7ee;
  --accent:#1f4fd1; --accent-soft:#e8eefc; --danger:#c62828; --ok:#1b7f4b; --radius:14px;
}
*{box-sizing:border-box}
html,body{margin:0}
body{font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--text);line-height:1.5;-webkit-font-smoothing:antialiased}
a{color:var(--accent)}
.wrap{max-width:980px;margin:0 auto;padding:0 20px}
header.top{background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
header.top .wrap{display:flex;align-items:center;justify-content:space-between;height:64px;gap:12px}
.brand{font-weight:700;font-size:1.1rem;color:var(--text);text-decoration:none;letter-spacing:-.01em}
.brand span{color:var(--accent)}
nav a{margin-left:18px;text-decoration:none;color:var(--muted);font-weight:500}
nav a:hover,nav a.active{color:var(--accent)}
main{padding:36px 0 60px}
h1{font-size:1.9rem;letter-spacing:-.02em;margin:0 0 6px}
h2{font-size:1.2rem;margin:0 0 14px}
.sub{color:var(--muted);margin:0 0 28px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:22px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.stack>*+*{margin-top:16px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:720px){.grid2{grid-template-columns:1fr}nav a{margin-left:12px}}
label{display:block;font-weight:600;font-size:.9rem;margin-bottom:6px}
input[type=text],input[type=email],input[type=password],textarea,select{
  width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:10px;font:inherit;background:#fff;color:var(--text)}
textarea{min-height:90px;resize:vertical}
input:focus,textarea:focus,select:focus{outline:2px solid var(--accent-soft);border-color:var(--accent)}
.btn{display:inline-flex;align-items:center;gap:6px;border:0;border-radius:10px;padding:10px 16px;font:inherit;font-weight:600;cursor:pointer;background:var(--accent);color:#fff;text-decoration:none}
.btn:hover{filter:brightness(1.08)}
.btn:disabled{opacity:.55;cursor:wait}
.btn.ghost{background:var(--accent-soft);color:var(--accent)}
.btn.danger{background:#fdecec;color:var(--danger)}
.btn.sm{padding:6px 10px;font-size:.85rem;border-radius:8px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.spacer{flex:1}
.muted{color:var(--muted)}
.small{font-size:.85rem}
.msg{padding:10px 14px;border-radius:10px;font-size:.92rem;margin-top:12px}
.msg.err{background:#fdecec;color:var(--danger)}
.msg.ok{background:#e7f6ee;color:var(--ok)}
.hidden{display:none!important}
.badge{display:inline-block;font-size:.72rem;font-weight:700;padding:3px 8px;border-radius:999px;background:var(--accent-soft);color:var(--accent);text-transform:uppercase;letter-spacing:.03em}
.badge.all{background:#fff4e0;color:#a15c00}
.doc{display:flex;gap:16px;align-items:flex-start;padding:16px 0;border-top:1px solid var(--line)}
.doc:first-child{border-top:0;padding-top:0}
.doc .ico{flex:none;width:42px;height:42px;border-radius:10px;background:#fdecec;color:#c62828;display:grid;place-items:center;font-weight:800;font-size:.72rem}
.doc .body{flex:1;min-width:0}
.doc .title{font-weight:600}
.doc .comment{background:var(--bg);border-left:3px solid var(--accent);padding:8px 12px;border-radius:6px;margin-top:8px;white-space:pre-wrap;font-size:.93rem}
.ann{background:linear-gradient(0deg,#fffaf0,#fffaf0);border:1px solid #f5dfb3;border-radius:12px;padding:12px 14px;white-space:pre-wrap}
.ann+.ann{margin-top:10px}
.ann .date{font-size:.78rem;color:#a15c00;font-weight:600;margin-bottom:2px}
.tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:22px;flex-wrap:wrap}
.tabs button{border:0;background:none;padding:10px 14px;font:inherit;font-weight:600;color:var(--muted);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs button.active{color:var(--accent);border-color:var(--accent)}
table{width:100%;border-collapse:collapse;font-size:.93rem}
th,td{text-align:left;padding:10px 8px;border-top:1px solid var(--line);vertical-align:top}
th{color:var(--muted);font-weight:600;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em;border-top:0}
.code{font-family:ui-monospace,Consolas,monospace;font-weight:700;background:var(--bg);padding:3px 8px;border-radius:6px;letter-spacing:.08em}
.checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:6px;max-height:200px;overflow:auto;border:1px solid var(--line);border-radius:10px;padding:10px}
.checks label{font-weight:500;display:flex;gap:8px;align-items:center;margin:0}
.radio{display:flex;gap:18px;margin-bottom:10px}
.radio label{font-weight:500;display:flex;gap:6px;align-items:center;margin:0}
.empty{color:var(--muted);text-align:center;padding:26px 0}
.hero{padding:40px 0 10px}
.hero h1{font-size:2.4rem}
footer{color:var(--muted);font-size:.85rem;text-align:center;padding:30px 0}
.drop{border:2px dashed var(--line);border-radius:12px;padding:18px;text-align:center;color:var(--muted);cursor:pointer}
.drop.over{border-color:var(--accent);background:var(--accent-soft)}
/* ---------- v2 ---------- */
.modal{position:fixed;inset:0;background:rgba(15,20,35,.55);display:none;align-items:center;justify-content:center;z-index:50;padding:16px}
.modal.open{display:flex}
.modal-box{background:#fff;border-radius:16px;max-width:620px;width:100%;max-height:92vh;overflow:auto;padding:22px;box-shadow:0 20px 50px rgba(0,0,0,.25)}
.modal-box.wide{max-width:1100px;height:92vh;display:flex;flex-direction:column;padding:14px}
.modal-head{padding:4px 4px 12px}
.viewer-body{flex:1;min-height:0;background:#eef0f5;border-radius:10px;overflow:auto;display:flex;align-items:flex-start;justify-content:center}
.viewer-body iframe{width:100%;height:100%;border:0;background:#fff}
.viewer-body img{max-width:100%;height:auto;display:block;margin:auto}
.folder{border:1px solid var(--line);border-radius:12px;background:#fff;margin-bottom:10px;overflow:hidden}
.folder>summary{list-style:none;cursor:pointer;padding:14px 16px;font-weight:700;display:flex;align-items:center;gap:10px}
.folder>summary::-webkit-details-marker{display:none}
.folder>summary::before{content:"▸";color:var(--muted);transition:transform .15s}
.folder[open]>summary::before{transform:rotate(90deg)}
.folder .count{margin-left:auto;font-size:.8rem;color:var(--muted);font-weight:600}
.folder .inner{padding:0 16px 14px}
.chap{margin:6px 0 4px;font-size:.8rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;padding-top:10px;border-top:1px dashed var(--line)}
.chap:first-child{border-top:0;padding-top:0}
.pill{display:inline-block;font-size:.75rem;font-weight:700;padding:3px 9px;border-radius:999px;white-space:nowrap}
.pill.todo{background:#e8eefc;color:#1f4fd1}.pill.late{background:#fdecec;color:#c62828}
.pill.done{background:#e7f6ee;color:#1b7f4b}.pill.graded{background:#f1e8fd;color:#6b2bd1}
.pill.wait{background:#f2f4f7;color:#667085}
.ico.devoir{background:#e8eefc;color:#1f4fd1}.ico.qcm{background:#f1e8fd;color:#6b2bd1}
.grade{font-size:1.4rem;font-weight:800;color:#6b2bd1}
.q{border:1px solid var(--line);border-radius:12px;padding:14px;margin-bottom:12px}
.q .qt{font-weight:600;margin-bottom:8px;white-space:pre-wrap}
.q label{font-weight:500;display:flex;gap:10px;align-items:flex-start;padding:8px 10px;border-radius:8px;margin:0;cursor:pointer}
.q label:hover{background:var(--bg)}
.q label.ok{background:#e7f6ee}.q label.bad{background:#fdecec}
.thread{display:flex;flex-direction:column;gap:8px;max-height:420px;overflow:auto;padding:4px}
.bubble{max-width:80%;padding:10px 13px;border-radius:14px;white-space:pre-wrap;font-size:.94rem}
.bubble.me{align-self:flex-end;background:var(--accent);color:#fff;border-bottom-right-radius:4px}
.bubble.them{align-self:flex-start;background:#f2f4f7;border-bottom-left-radius:4px}
.bubble .meta{font-size:.72rem;opacity:.75;margin-top:4px}
.dot{display:inline-block;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#e5484d;color:#fff;font-size:.72rem;font-weight:800;line-height:20px;text-align:center;margin-left:6px}
.tabs button .dot{margin-left:6px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
@media(max-width:720px){.grid3{grid-template-columns:1fr}.bubble{max-width:92%}}
.stat{background:var(--bg);border-radius:12px;padding:12px 14px}
.stat b{display:block;font-size:1.5rem}
.list-row{display:flex;gap:10px;align-items:center;padding:10px 0;border-top:1px solid var(--line);flex-wrap:wrap}
.list-row:first-child{border-top:0}
.chip{display:inline-flex;align-items:center;gap:6px;background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:4px 10px;font-size:.85rem}
.chip button{border:0;background:none;cursor:pointer;color:var(--muted);padding:0;font-size:.9rem}
.seg{display:inline-flex;background:var(--bg);border-radius:10px;padding:3px;gap:3px}
.seg button{border:0;background:none;padding:8px 14px;border-radius:8px;font:inherit;font-weight:600;color:var(--muted);cursor:pointer}
.seg button.active{background:#fff;color:var(--accent);box-shadow:0 1px 2px rgba(0,0,0,.08)}
input[type=datetime-local]{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:10px;font:inherit}
.hint{font-size:.82rem;color:var(--muted);margin-top:4px}
.msggrid{grid-template-columns:260px 1fr}
@media(max-width:720px){.msggrid{grid-template-columns:1fr}}
/* ---------- QCM interactif ---------- */
.qz{max-width:760px;margin:0 auto}
.qz-top{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:8px}
.qz-count{font-weight:800;color:var(--accent)}
.qz-bar{height:6px;background:var(--line);border-radius:99px;overflow:hidden;margin-bottom:18px}
.qz-bar span{display:block;height:100%;background:var(--accent);border-radius:99px;transition:width .25s}
.qz-q{font-size:1.2rem;font-weight:700;line-height:1.4;margin-bottom:16px;white-space:pre-wrap}
.qz-choices{display:grid;gap:10px}
.qz-opt{display:flex;align-items:center;gap:12px;width:100%;text-align:left;border:2px solid var(--line);background:#fff;border-radius:12px;padding:13px 14px;font:inherit;font-size:1rem;cursor:pointer;color:var(--text);transition:border-color .12s,background .12s}
.qz-opt:hover{border-color:#b9c6ef;background:#fafbff}
.qz-opt.sel{border-color:var(--accent);background:var(--accent-soft)}
.qz-letter{flex:none;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-weight:800;background:var(--bg);color:var(--muted);font-size:.85rem}
.qz-opt.sel .qz-letter{background:var(--accent);color:#fff}
.qz-nav{display:flex;align-items:center;gap:10px;margin-top:20px;flex-wrap:wrap}
.qz-nav .btn:disabled{opacity:.35;cursor:default}
.qz-dots{flex:1;display:flex;gap:5px;justify-content:center;flex-wrap:wrap}
.qz-dot{width:28px;height:28px;border-radius:50%;border:1px solid var(--line);background:#fff;font:inherit;font-size:.75rem;font-weight:700;color:var(--muted);cursor:pointer;padding:0}
.qz-dot.ok{background:var(--accent-soft);color:var(--accent);border-color:#c9d6f7}
.qz-dot.cur{background:var(--accent);color:#fff;border-color:var(--accent)}
@media(max-width:600px){.qz-q{font-size:1.05rem}.qz-dots{order:3;flex-basis:100%}.qz-nav .btn{flex:1;justify-content:center}}
.qz-result{text-align:center;padding:10px 0 6px}
.qz-emoji{font-size:3rem;line-height:1}
.qz-big{font-size:3rem;font-weight:800;letter-spacing:-.02em;margin:4px 0}
.qz-kpis{display:flex;justify-content:center;gap:12px;margin:6px 0 12px;flex-wrap:wrap}
.qz-kpis div{background:var(--bg);border-radius:12px;padding:10px 18px;min-width:120px}
.qz-kpis b{display:block;font-size:1.4rem}.qz-kpis span{font-size:.8rem;color:var(--muted)}
.qz-counts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.qz-review{margin-top:20px;display:grid;gap:10px}
.qz-rv{border:1px solid var(--line);border-left:4px solid #1b7f4b;border-radius:10px;padding:12px 14px;background:#fff}
.qz-rv.ko{border-left-color:#c62828}
.qz-tag{flex:none;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-size:.8rem;font-weight:800;background:#e7f6ee;color:#1b7f4b}
.qz-rv.ko .qz-tag{background:#fdecec;color:#c62828}
.qz-rv-lines{margin:8px 0 0 32px;display:grid;gap:4px;font-size:.94rem}
.qz-expl{background:#fffaf0;border:1px solid #f5dfb3;border-radius:8px;padding:8px 10px;margin-top:4px}
.qz-paste{width:100%;min-height:320px;font-family:ui-monospace,Consolas,monospace;font-size:.9rem;line-height:1.5}
.qz-warn{border-radius:10px;padding:10px 14px;font-size:.9rem}
.qz-warn.ok{background:#e7f6ee;color:#1b7f4b}.qz-warn.err{background:#fdecec;color:#c62828}
.qz-check .qz-rv{border-left-color:var(--accent)}
.qz-check .good{color:#1b7f4b;font-weight:700}
.modal-box.qcmbox{max-width:820px}
/* ---------- A retenir (cartes) ---------- */
.fc{border:2px solid var(--line);border-radius:16px;padding:34px 22px;text-align:center;background:#fff;min-height:200px;display:flex;flex-direction:column;justify-content:center}
.fc.flip{border-color:#b9c6ef;background:#fafbff}
.fc-label{font-size:.75rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:10px}
.fc-front{font-size:1.25rem;font-weight:700;white-space:pre-wrap}
.fc-back{font-size:1.35rem;font-weight:800;color:var(--accent);margin-top:16px;padding-top:16px;border-top:1px dashed var(--line);white-space:pre-wrap}
.memo-hero{background:linear-gradient(135deg,#fff7e6,#fff);border:1px solid #f5dfb3}
.ico.memo{background:#fff4e0;color:#a15c00}
.pill.memo{background:#fff4e0;color:#a15c00}
.badge.new{background:#e5484d;color:#fff}
.join{display:inline-flex;align-items:center;gap:8px;background:#1b7f4b;color:#fff;font-weight:800;padding:13px 20px;border-radius:12px;text-decoration:none;font-size:1.05rem}
.join:hover{filter:brightness(1.08)}
.next-course{border:2px solid #c9d6f7;background:linear-gradient(135deg,#eef3ff,#fff)}
.dash-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:760px){.dash-grid{grid-template-columns:1fr}}
.todo-row{display:flex;gap:10px;align-items:center;padding:10px 0;border-top:1px solid var(--line);cursor:pointer}
.todo-row:first-child{border-top:0}
.todo-row:hover .title{color:var(--accent)}
.prog{height:8px;background:var(--line);border-radius:99px;overflow:hidden;margin-top:4px}
.prog span{display:block;height:100%;background:var(--accent)}
.sess{border:1px solid var(--line);border-radius:12px;padding:14px;background:#fff;margin-bottom:10px}
.sess.past{background:#fbfbfd}
.sess-date{font-weight:800}
.tabs{overflow-x:auto;flex-wrap:nowrap;scrollbar-width:thin}
.tabs button{white-space:nowrap}
.todo-row .ico{font-size:.62rem;flex:none}
.tabs button{padding:10px 11px}
@media(min-width:900px){.tabs{flex-wrap:wrap;overflow:visible}}
/* ---------- v5 : bibliotheque ---------- */
.btn.ok{background:#e7f6ee;color:var(--ok)}
.filebtn{display:inline-flex;gap:2px}
.filebtn .btn:first-child{border-top-right-radius:0;border-bottom-right-radius:0}
.filebtn .btn+.btn{border-top-left-radius:0;border-bottom-left-radius:0;padding-left:8px;padding-right:8px}
label.inline{display:inline-flex;gap:8px;align-items:center;font-weight:500;margin:0}
.ac-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}
.ac{border:1px solid var(--line);background:#fff;border-radius:999px;padding:3px 10px;font:inherit;font-size:.8rem;font-weight:600;cursor:pointer;color:var(--muted)}
.ac.on{background:#e7f6ee;border-color:#bfe5cf;color:var(--ok)}
.ac.off{background:#fff;color:#98a2b3}
.ac:hover{filter:brightness(.97);border-color:var(--accent)}
.uses{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.use{font-size:.8rem;background:var(--bg);border-radius:8px;padding:2px 8px;color:var(--text);text-decoration:none}
a.use:hover{background:var(--accent-soft);color:var(--accent)}
.att-row{display:flex;gap:10px;align-items:center;border:1px solid var(--line);border-radius:10px;padding:8px 10px;background:#fff;flex-wrap:wrap}
.att-row select{width:auto;padding:6px 8px;font-size:.85rem}
.ico-sm{flex:none;width:32px;height:32px;border-radius:8px;background:#fdecec;color:#c62828;display:grid;place-items:center;font-weight:800;font-size:.62rem}
.lp-list{display:flex;flex-direction:column;gap:2px;max-height:52vh;overflow:auto;border:1px solid var(--line);border-radius:10px;padding:6px}
.lp-list label{display:flex;gap:10px;align-items:center;padding:8px;border-radius:8px;margin:0;font-weight:500;cursor:pointer}
.lp-list label:hover{background:var(--bg)}
.lp-list input{width:auto}
.usage-bar{display:inline-block;width:140px;height:8px;border-radius:99px;background:var(--line);vertical-align:middle;overflow:hidden;margin-left:8px}
.usage-bar span{display:block;height:100%;background:var(--accent)}
.att-list{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.att-list:empty{display:none}
/* v5.1 : sur telephone, tous les onglets sont visibles (grille) au lieu d'une bande a faire defiler */
@media(max-width:899px){
  .tabs{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));overflow:visible;gap:4px;padding-bottom:8px}
  .tabs button{border:1px solid var(--line);border-radius:10px;margin:0;text-align:left;white-space:normal;background:#fff;padding:9px 10px}
  .tabs button.active{background:var(--accent-soft);border-color:var(--accent)}
  .seg{display:flex;flex-wrap:wrap}
}
/* v5.2 : petites notifications en bas de l'ecran */
#toasts{position:fixed;right:16px;bottom:16px;z-index:80;display:flex;flex-direction:column;gap:8px;max-width:min(360px,calc(100vw - 32px))}
.toast{background:#1c2230;color:#fff;border-radius:12px;padding:12px 14px;box-shadow:0 10px 30px rgba(0,0,0,.25);font-size:.92rem;cursor:pointer;animation:toastin .25s ease}
@keyframes toastin{from{transform:translateY(10px);opacity:0}to{transform:none;opacity:1}}
.toast-undo{margin-left:8px;border:0;border-radius:8px;padding:4px 10px;font:inherit;font-weight:700;background:#fff;color:#1c2230;cursor:pointer}
nav a#undoBtn{color:var(--accent);font-weight:700}
