:root {
  --bg: #0B1120; --bar: #0D1527; --panel: #111A2E; --panel-2: #16223B; --line: #1F2D4A; --line-2: #2B3D60;
  --text: #E2E8F0; --soft: #CBD5E1; --muted: #94A3B8;
  --accent: #22D3EE; --accent-hover: #67E8F9; --ok: #4ADE80; --ko: #F87171; --warn: #FACC15;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --title: "Space Grotesk", Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, sans-serif; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--title); line-height: 1.2; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* boutons */
.btn { border: 0; border-radius: 9px; padding: 11px 16px; font-weight: 700; background: var(--accent); color: #04121A; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--accent-hover); color: #04121A; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--soft); border: 1px solid var(--line); font-weight: 600; padding: 10px 16px; }
.btn.ghost:hover { border-color: var(--line-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--ko); border: 1px solid #5B2330; font-weight: 600; padding: 10px 16px; }
.btn.muted { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; padding: 10px 14px; }

/* en-tête */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: var(--bar); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--title); font-weight: 700; font-size: 19px; }
.brand:hover { color: var(--text); }
.logo { font-family: var(--mono); color: var(--accent); }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.topnav a { padding: 10px 14px; border-radius: 8px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.topnav a.on { background: var(--panel-2); color: var(--text); font-weight: 600; }
.badge { background: var(--warn); color: #1A1500; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.pill { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #164E63; color: #CFFAFE; border: 0; font-weight: 700; font-size: 14px; }

main { max-width: 1280px; margin: 0 auto; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
main.wide { max-width: 1376px; padding-top: 22px; gap: 16px; }
.sub { margin: 0; color: var(--muted); }
.back { font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.grow { flex: 999 1 520px; min-width: 0; }
.side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 14px; }

/* cartes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: var(--text); }
a.card:hover { border-color: var(--line-2); color: var(--text); }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--c, var(--accent)); }
.bar.thick { height: 8px; }
.meta { color: var(--muted); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--soft); }
.tag.green { background: #0F2A1C; border-color: #1E5133; color: #86EFAC; }
.tag.dim { color: var(--muted); }
.swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; display: inline-block; }

.hero h1 { margin: 0; font-size: 34px; }
.resume { flex: 1 1 380px; display: flex; flex-direction: column; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .v { font-family: var(--title); font-size: 30px; font-weight: 700; }
.stat .v small { font-size: 16px; color: var(--muted); font-weight: 500; }
.stat.warn { border-color: #3F3A12; }
.stat.warn .k { color: var(--warn); font-weight: 600; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-head h2 { margin: 0; font-size: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.track { display: flex; flex-direction: column; gap: 10px; }
.track strong { font-size: 16px; }

/* parcours */
.title-line { display: flex; align-items: center; gap: 12px; }
.title-line h1 { margin: 0; font-size: 32px; }
.progress-box { flex: 1 1 280px; padding: 14px 18px; align-self: flex-end; }
.objs { display: flex; flex-wrap: wrap; gap: 8px; }
.obj { font-size: 13px; padding: 5px 12px; border-radius: 8px; background: var(--panel-2); border: 1px dashed var(--line-2); color: var(--muted); }
.obj.lab { border: 1px solid #155E75; color: #A5F3FC; background: #0B2A33; }
.obj.done { border: 1px solid #1E5133; color: #86EFAC; background: #0F2A1C; }
.module { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.module.progress { border-color: #1E5133; }
.module-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.state { font-size: 12px; border-radius: 99px; padding: 2px 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.state.progress { color: #86EFAC; border-color: #1E5133; }
.state.done { color: #04121A; background: var(--ok); border-color: var(--ok); font-weight: 600; }
.lab-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); color: var(--text); }
.lab-link:hover { color: var(--text); outline: 1px solid var(--accent); }
.lab-link span { display: flex; gap: 10px; align-items: center; }
.ok-text { color: var(--ok); font-weight: 600; font-size: 14px; }
.ico { width: 18px; height: 18px; fill: none; stroke-width: 2.4; flex: none; }

/* lab */
.lab-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.lab-head h1 { margin: 0; font-size: 24px; flex: 1 1 auto; }
.lab-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.lab-left { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 170px); overflow: auto; }
.lab-right { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 6px; }
.tabs button { font-size: 14px; border-radius: 8px; padding: 8px 16px; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tabs button.on { background: #0B2A33; color: var(--accent); border-color: var(--accent); }
.steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.step { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; border: 1px solid transparent; }
.step.ko { background: #1E1418; border-color: #5B2330; }
.step.todo { border: 1px dashed var(--line-2); }
.step .circle { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #475569; flex: none; margin-top: 3px; }
.step .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.step .detail { font-size: 13px; color: #FCA5A5; }
.step details { font-size: 13px; color: var(--muted); }
.step summary { cursor: pointer; }
.step code { font-family: var(--mono); font-size: 12.5px; color: var(--soft); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.timer { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--muted); }
#term { flex: 1; min-height: 480px; background: #050A14; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.term-empty { flex: 1; min-height: 480px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); text-align: center; padding: 20px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }

.lesson { font-size: 14.5px; }
.lesson h1 { font-size: 21px; margin: 4px 0 8px; }
.lesson h2 { font-size: 17px; color: var(--accent); margin: 18px 0 8px; }
.lesson code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.lesson pre { background: #050A14; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; }
.lesson pre code { background: none; padding: 0; }
.lesson table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.lesson blockquote { margin: 12px 0; padding: 10px 14px; background: #1D1A0D; color: #FDE68A; border-radius: 8px; }

/* veille */
.vitem { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.vitem.examen { border-color: #3F3A12; }
.vitem .actions { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.kind { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: #1E1B4B; color: #C7D2FE; }
.kind.examen { background: #3F3A12; color: #FDE68A; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--panel-2); }
.img-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--panel-2); border-radius: 10px; }
.empty { color: var(--muted); padding: 14px 0; }

/* connexion */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.login .logo-big { width: 56px; height: 56px; border-radius: 14px; background: #0B2A33; border: 1px solid #155E75; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 22px; color: var(--accent); margin: 0 auto; }
.login form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login input { font: inherit; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); }
.error { color: var(--ko); font-size: 14px; min-height: 20px; }

/* navigation mobile */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; display: none; border-top: 1px solid var(--line); background: var(--bar); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 12px; color: var(--muted); font-size: 12px; }
.bottomnav a.on { color: var(--accent); font-weight: 600; }
.bottomnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }

@media (max-width: 760px) {
  .topbar { padding: 12px 18px; }
  .topnav a, .topnav .pill { display: none; }
  main { padding: 18px 18px 96px; gap: 18px; }
  .bottomnav { display: flex; }
  .hero h1 { font-size: 26px; }
  .title-line h1 { font-size: 26px; }
  .lab-left { max-height: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 24px; }
  .stat.warn { grid-column: 1 / -1; }
  .hero .sub { display: none; }
  .progress-box { align-self: stretch; }
  #term, .term-empty { min-height: 380px; }
}

.bn-badge { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--warn); color: #1A1500; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; line-height: 17px; }
.progress-box strong { white-space: nowrap; }
