:root {
  --navy: #0F172A; --blue: #0369A1; --blue-dark: #075985; --bg: #F8FAFC; --card: #fff;
  --line: #E2E8F0; --muted: #475569; --red: #DC2626; --green: #15803D; --amber: #B45309;
  --tint: #E0F2FE;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--navy); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1 { font-size: 1.75rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* En-tête produit */
header.app { background: #fff; border-bottom: 1px solid var(--line); }
header.app .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--navy); }
.logo { background: var(--navy); color: #fff; border-radius: 6px; padding: 4px 8px; font-size: .85rem; letter-spacing: .05em; }
nav.main { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
nav.main a { text-decoration: none; color: var(--muted); font-weight: 500; }
nav.main a[aria-current="page"] { color: var(--navy); border-bottom: 2px solid var(--blue); padding-bottom: 2px; }

main { padding: 32px 0 120px; }
.screen[hidden] { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: #fff; color: var(--blue); }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn.danger { background: #fff; color: var(--red); border-color: #FCA5A5; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: var(--tint); color: var(--blue-dark); }
.badge.ok { background: #DCFCE7; color: #166534; }
.badge.wait { background: #FEF3C7; color: #92400E; }
.badge.off { background: #F1F5F9; color: var(--muted); }
.badge.exp { background: #FEE2E2; color: #991B1B; }

label { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--blue); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field input[type="email"], .field input[type="password"], input[type="search"], select {
  min-height: 44px; border: 1px solid #94A3B8; border-radius: 8px; padding: 0 12px; font: inherit; background: #fff; }

/* Connexion */
.login { max-width: 420px; margin: 48px auto; padding: 32px; }
.check { display: flex; align-items: center; gap: 10px; }

/* Catalogue */
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; }
.course { padding: 20px; display: grid; gap: 12px; align-content: start; position: relative; }
.course.selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.course .top { display: flex; gap: 12px; align-items: flex-start; }
.course .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; color: var(--muted); }
.course .pick { display: flex; gap: 10px; align-items: center; font-weight: 600; }

.basket { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15,23,42,.08); }
.basket .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; padding-top: 14px; padding-bottom: 14px; }
.basket fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.basket legend { float: left; margin-right: 10px; font-weight: 600; font-size: .875rem; }
.basket .count { font-weight: 700; }
.basket .go { margin-left: auto; }

/* Page cours */
.toolbar { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; padding: 16px 20px; margin: 20px 0; }
.toolbar fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.toolbar legend { float: left; font-weight: 600; margin-right: 6px; }
.seg { display: inline-flex; border: 1px solid #94A3B8; border-radius: 8px; overflow: hidden; }
.seg label { padding: 10px 14px; font-weight: 500; display: flex; align-items: center; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label + label { border-left: 1px solid #94A3B8; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--navy); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: -3px; }

.full { padding: 20px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; background: var(--tint); border-color: #7DD3FC; }
.full .kicker { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-dark); }
.rows { margin-top: 16px; }
.row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 90px 110px auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .num { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .size, .row .date { font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .acts { display: flex; gap: 8px; }
@media (max-width: 720px) {
  .row { grid-template-columns: 44px minmax(0,1fr); }
  .row .size, .row .date { grid-column: 2; }
  .row .acts { grid-column: 1 / -1; }
}

/* Sélection */
.group { margin-top: 20px; }
.group h2 { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: minmax(0,1fr) 90px auto; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); }
.dl:first-of-type { border-top: 0; }
.notice { padding: 14px 20px; margin-top: 20px; border-left: 0; background: #FFFBEB; border-color: #FCD34D; }
.summary { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 16px 20px; margin-top: 20px; }

/* Admin */
.adminbar { background: var(--navy); }
.adminbar .wrap { color: #fff; }
.adminbar .brand { color: #fff; }
.adminbar nav.main a { color: #CBD5E1; }
.adminbar nav.main a[aria-current="page"] { color: #fff; border-color: #38BDF8; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0; }
.filters input[type="search"] { flex: 1 1 280px; }
.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 860px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #F1F5F9; }
tbody tr:hover { background: #F8FAFC; }
.drawer { margin-top: 24px; padding: 20px; display: grid; gap: 16px; }
.invite { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invite code { flex: 1 1 360px; background: #F1F5F9; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .85rem; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.kpi { padding: 16px 20px; text-decoration: none; color: inherit; }
.kpi strong { display: block; font-size: 1.75rem; }

/* Propres à l'appli */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--navy); text-decoration: underline; }
.btn.block { width: 100%; }
.error { color: var(--red); font-weight: 600; margin: 0 0 12px; }
.flash { padding: 12px 16px; margin: 0 0 20px; }
.course:has(.pick input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
h2.section { margin: 32px 0 12px; }
.player { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.player header { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 8px 16px; background: var(--navy); color: #fff; }
.player header a { color: #fff; }
.player iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.acts-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lines { white-space: pre-line; }
