/* =============================================================================
   EMS Wise FA — feuille de style
   Thèmes clair / sombre, animations fluides (désactivées si l'utilisateur préfère moins de mouvement)
   ============================================================================= */
:root {
  --bg: #eef2f7;
  --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(59, 130, 246, .08), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(30, 58, 95, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf1f7;
  --line: #dbe2ea;
  --line-2: #c5cfdc;
  --text: #142033;
  --muted: #5f6f86;
  --heading: #16325a;
  --navy: #1e3a5f;
  --navy-2: #2c5282;
  --accent: #3b82f6;
  --ok: #15803d;
  --ok-bg: #e6f6ec;
  --ok-line: #34a464;
  --warn: #a15c00;
  --warn-bg: #fff3d6;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --info-bg: #e5eefc;
  --discord: #5865f2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -8px rgba(15, 23, 42, .12);
  --shadow-lg: 0 20px 50px -20px rgba(15, 23, 42, .35);
  --topbar: rgba(22, 44, 74, .92);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* Thème sombre : automatique selon l'appareil, ou forcé par le bouton 🌙 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1120; --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(59, 130, 246, .12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, .06), transparent 60%);
    --surface: #111a2c; --surface-2: #162238; --surface-3: #1c2a44; --line: #23324d; --line-2: #2f4263;
    --text: #e4eaf4; --muted: #94a3bb; --heading: #d6e4ff; --navy: #3d6fb5; --navy-2: #5288d6; --accent: #60a5fa;
    --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .14); --ok-line: #22c55e; --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .14);
    --bad: #f87171; --bad-bg: rgba(239, 68, 68, .14); --info-bg: rgba(96, 165, 250, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
    --topbar: rgba(10, 17, 32, .85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1120; --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(59, 130, 246, .12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, .06), transparent 60%);
  --surface: #111a2c; --surface-2: #162238; --surface-3: #1c2a44; --line: #23324d; --line-2: #2f4263;
  --text: #e4eaf4; --muted: #94a3bb; --heading: #d6e4ff; --navy: #3d6fb5; --navy-2: #5288d6; --accent: #60a5fa;
  --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .14); --ok-line: #22c55e; --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .14);
  --bad: #f87171; --bad-bg: rgba(239, 68, 68, .14); --info-bg: rgba(96, 165, 250, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
  --topbar: rgba(10, 17, 32, .85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); background-image: var(--bg-glow); background-attachment: fixed;
  color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
::selection { background: rgba(59, 130, 246, .25); }
a { color: var(--navy-2); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; color: var(--heading); letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1150px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 860px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* --- Cartes --- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease), background-color .3s;
}
.card + .card { margin-top: 16px; }

/* --- Boutons --- */
button, .btn {
  font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); padding: 8px 14px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; line-height: 1.3;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .2s, transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
button:hover, .btn:hover { border-color: var(--line-2); text-decoration: none; box-shadow: var(--shadow-sm); }
button:active, .btn:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primary { background: linear-gradient(180deg, var(--navy-2), var(--navy)); border-color: var(--navy); color: #fff; box-shadow: 0 4px 14px -6px rgba(30, 58, 95, .6); }
.primary:hover { filter: brightness(1.08); border-color: var(--navy); }
.discord { background: linear-gradient(180deg, #6873f5, #5865f2); border-color: var(--discord); color: #fff; font-weight: 600; box-shadow: 0 6px 18px -8px rgba(88, 101, 242, .8); }
.discord:hover { filter: brightness(1.08); }
.danger { color: var(--bad); }
.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.success.solid { background: var(--ok-line); border-color: var(--ok-line); color: #fff; }
.mini { padding: 4px 10px; font-size: .84rem; border-radius: 8px; }
.big { padding: 12px 22px; font-size: 1.03rem; font-weight: 650; }
.full { width: 100%; }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

/* --- Formulaires --- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s, background-color .3s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; }
label { display: block; font-size: .84rem; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

/* --- En-tête officiel des documents --- */
.letterhead { display: flex; align-items: center; gap: 18px; }
.letterhead img { width: 76px; height: 76px; object-fit: contain; }
.letterhead .sep { width: 2px; align-self: stretch; background: var(--navy); }
.letterhead .org { font-weight: 800; color: var(--heading); text-transform: uppercase; line-height: 1.1; font-size: 1.15rem; letter-spacing: .3px; }
.letterhead .tag { color: var(--heading); font-size: .78rem; letter-spacing: .5px; text-transform: uppercase; margin-top: 4px; }
.doc-title { text-align: center; margin: 22px 0 6px; }
.doc-title h1 { font-size: 1.7rem; margin: 0; }
.doc-title .sub { color: var(--navy-2); font-weight: 700; font-size: .85rem; letter-spacing: .4px; text-transform: uppercase; }
.consignes { color: var(--muted); font-size: .92rem; margin: 18px 0; }
.section-title { text-align: center; color: var(--heading); font-weight: 800; letter-spacing: .5px; margin: 28px 0 12px; }
.doc-footer { text-align: center; color: var(--muted); font-size: .75rem; letter-spacing: .4px; text-transform: uppercase; margin-top: 28px; }

/* --- Barre du haut (verre dépoli) --- */
.topbar {
  background: var(--topbar); color: #fff; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar .wrap { padding-top: 8px; padding-bottom: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: nowrap; }
.topbar img { width: 34px; height: 34px; }
.brand { font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.topbar button, .topbar .btn { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .18); }
.topbar button:hover { background: rgba(255, 255, 255, .14); }
.who { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: #dbe4f0; min-width: 0; }
.who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; background: var(--surface-3); object-fit: cover; flex-shrink: 0; }
.search-trigger { display: inline-flex; gap: 10px; align-items: center; min-width: 230px; justify-content: space-between; color: #c8d5e6 !important; }
.search-trigger kbd, kbd { font: 600 .72rem var(--font); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); border-radius: 5px; padding: 1px 6px; }
@media (max-width: 760px) { .search-trigger { min-width: 0; } .search-trigger .label, .search-trigger kbd, .who span { display: none; } }

/* --- Tableaux --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: .76rem; text-transform: uppercase; letter-spacing: .4px; background: var(--surface-2); position: sticky; top: 0; }
tbody tr { transition: background-color .15s; }
tbody tr:hover td { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 10px; }
.person .sub { color: var(--muted); font-size: .8rem; }

/* --- Badges --- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--navy-2); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat b { display: block; font-size: 1.4rem; color: var(--heading); }
.stat span { color: var(--muted); font-size: .85rem; }
.scorebar { width: 90px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 8px; }
.scorebar div { height: 100%; border-radius: 3px; transition: width .6s var(--ease); }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; }

/* --- Questionnaires (style document) --- */
.q { padding: 12px 0; break-inside: avoid; }
.q + .q { border-top: 1px dashed var(--line); }
.q .qtext { font-weight: 700; color: var(--heading); margin-bottom: 6px; }
.q .cat { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .3px; }
.opt { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; margin: 4px 0 4px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); transition: background-color .15s, border-color .15s, transform .12s; }
.opt:hover { background: var(--surface-2); }
.opt:active { transform: scale(.995); }
.opt input { width: auto; margin: 4px 0 0; accent-color: var(--navy-2); }
.opt .letter { font-weight: 700; min-width: 1.3em; color: var(--navy-2); }
.opt.selected { border-color: var(--navy-2); background: var(--info-bg); }
.opt.review { cursor: default; }
.opt.review:hover { background: transparent; }
.opt.correct { border-color: var(--ok-line); }
.opt.chosen-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.opt.chosen-bad { background: var(--bad-bg); border-color: var(--bad); }
.opt .tagr { margin-left: auto; padding-left: 10px; }
.hint { color: var(--bad); font-weight: 700; text-decoration: underline; text-align: center; margin-top: 8px; }
.answer-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }

.timerbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--topbar); color: #fff; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.timerbar .wrap { padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.clock { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 800; }
.clock.low { color: #ffb4b4; animation: pulse 1s ease-in-out infinite; }
.progress { height: 4px; background: rgba(255, 255, 255, .15); }
.progress div { height: 100%; background: linear-gradient(90deg, #60a5fa, #a5f3fc); transition: width .4s var(--ease); }

/* --- Alertes, toasts --- */
.alert { border-radius: var(--radius-sm); padding: 11px 14px; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert.info { background: var(--info-bg); color: var(--heading); border-color: color-mix(in srgb, var(--navy-2) 25%, transparent); }
.center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.toast-stack { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
.toast { background: #13233b; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: toastIn .35s var(--ease); pointer-events: auto; max-width: 100%; border: 1px solid rgba(255, 255, 255, .08); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }
.noselect { user-select: none; -webkit-user-select: none; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty::before { content: '🗂️'; display: block; font-size: 1.8rem; margin-bottom: 6px; opacity: .6; }

/* Les documents (copies, grilles, règlement, connexion) restent sur « papier » clair, même en thème sombre */
.paper, .reg {
  --surface: #ffffff; --surface-2: #f6f8fb; --surface-3: #edf1f7; --line: #dbe2ea; --line-2: #c5cfdc; --text: #142033; --muted: #5f6f86;
  --heading: #16325a; --navy: #1e3a5f; --navy-2: #2c5282; --accent: #3b82f6; --ok: #15803d; --ok-bg: #e6f6ec; --warn: #a15c00; --warn-bg: #fff3d6;
  --bad: #c62828; --bad-bg: #fdecec; --info-bg: #e5eefc; color-scheme: light;
  color: var(--text);
}
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-lg); }
@media (max-width: 600px) { .paper { padding: 18px 14px; } .letterhead img { width: 56px; height: 56px; } .letterhead .org { font-size: .95rem; } }

/* ===================== Intranet : barre latérale ===================== */
.app-layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: calc(100vh - 51px); }
.sidebar { background: color-mix(in srgb, var(--surface) 92%, transparent); border-right: 1px solid var(--line); padding: 14px 10px 40px; position: sticky; top: calc(51px + env(safe-area-inset-top, 0px)); height: calc(100vh - 51px); overflow-y: auto; scrollbar-width: thin; }
.sidebar .group { margin-top: 16px; }
.sidebar .group-title { font-size: .68rem; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); padding: 6px 12px; }
.sidebar a, .sidebar .disabled { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--text); font-size: .93rem; position: relative; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.sidebar a:hover { background: var(--surface-3); text-decoration: none; transform: translateX(2px); }
.sidebar a.active { background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: 0 6px 16px -8px rgba(30, 58, 95, .7); }
.sidebar a .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 1px 7px; animation: pop .4s var(--ease); }
.sidebar .disabled { color: var(--muted); opacity: .6; cursor: not-allowed; }
.sidebar .soon { margin-left: auto; font-size: .68rem; background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 99px; }
.main { padding: 26px 26px 70px; min-width: 0; }
.topbar .burger { display: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; display: inline-block; flex-shrink: 0; }
.live-dot.on { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: live 2s infinite; }
@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; width: 280px; transform: translateX(-105%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); background: var(--surface); }
  .sidebar.open { transform: none; }
  .topbar .burger { display: inline-flex; }
  .main { padding: 18px 14px 70px; }
}
.backdrop { position: fixed; inset: 0; background: rgba(5, 10, 20, .45); z-index: 35; animation: fadeIn .2s; backdrop-filter: blur(2px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border-radius: 99px; padding: 5px 14px; font-size: .87rem; }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: block; color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .25s var(--ease), border-color .2s, box-shadow .25s; }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
a.kpi:hover { border-color: var(--navy-2); text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi b { display: block; font-size: 2rem; color: var(--heading); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .85rem; }
.kpi.alert-kpi b { color: var(--bad); }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 8px; transition: background-color .15s; }
a.list-item:hover { background: var(--surface-2); }
.list-item:last-child { border-bottom: none; }
.datebox { min-width: 54px; text-align: center; background: var(--info-bg); border-radius: 10px; padding: 5px 6px; line-height: 1.1; }
.datebox b { display: block; font-size: 1.2rem; color: var(--heading); }
.datebox span { font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* Chronologie (RDV, suivi de formation) */
.timeline { position: relative; margin-left: 10px; padding-left: 22px; border-left: 2px solid var(--line); }
.timeline .entry { position: relative; margin-bottom: 16px; }
.timeline .entry::before { content: ''; position: absolute; left: -29px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy-2); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--line); }
.timeline .entry.planifie::before { background: var(--warn); }
.timeline .entry.annule::before, .timeline .entry.absent::before { background: #94a3b8; }
.note-block { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--navy-2); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.note-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 3px 11px; font-size: .85rem; background: var(--surface); cursor: pointer; transition: all .15s; }
.chip input { width: auto; margin: 0; accent-color: var(--navy-2); }
.chip.on { background: var(--info-bg); border-color: var(--navy-2); color: var(--heading); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
@media (max-width: 1050px) { .two-col { grid-template-columns: 1fr; } }
dl.info { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; }
dl.info dt { color: var(--muted); font-size: .85rem; }
dl.info dd { margin: 0; }

/* --- Squelettes de chargement --- */
.skeleton { display: grid; gap: 14px; }
.sk { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%); background-size: 300% 100%; border-radius: 10px; animation: shimmer 1.3s linear infinite; }
.sk.h1 { height: 34px; width: 40%; }
.sk.line { height: 14px; }
.sk.block { height: 120px; border-radius: var(--radius); }
.sk.kpi { height: 92px; border-radius: var(--radius); }

/* --- Recherche rapide (Ctrl+K) --- */
.palette-wrap { position: fixed; inset: 0; z-index: 300; background: rgba(5, 10, 20, .5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 14px 14px; animation: fadeIn .15s; }
.palette { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: popIn .22s var(--ease); }
.palette input { border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 1.05rem; box-shadow: none !important; }
.palette .results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette .res { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); cursor: pointer; }
.palette .res .k { font-size: .75rem; color: var(--muted); margin-left: auto; }
.palette .res.sel, .palette .res:hover { background: var(--info-bg); text-decoration: none; }
.palette .group-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 8px 12px 4px; }
.palette .foot { border-top: 1px solid var(--line); padding: 8px 14px; font-size: .78rem; color: var(--muted); display: flex; gap: 14px; }
.palette .foot kbd { background: var(--surface-3); border-color: var(--line); color: var(--text); }

/* ===================== Site public ===================== */
.pub-nav { position: sticky; top: 0; z-index: 30; background: transparent; color: #fff; transition: background-color .3s, box-shadow .3s, padding .3s; }
.pub-nav.scrolled { background: var(--topbar); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); box-shadow: 0 8px 30px -12px rgba(0, 0, 0, .4); }
.pub-nav .wrap { display: flex; align-items: center; gap: 14px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; transition: padding .3s; }
.pub-nav.scrolled .wrap { padding-top: 8px; padding-bottom: 8px; }
.pub-nav img { width: 40px; height: 40px; }
.pub-nav .brand { font-size: 1.15rem; }
.pub-nav a { color: #dbe4f0; }
.pub-nav a:hover { color: #fff; text-decoration: none; }
.pub-nav .links { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.pub-nav .btn { color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); }
@media (max-width: 700px) { .pub-nav .links a:not(.btn) { display: none; } }
.hero { position: relative; overflow: hidden; color: #fff; background: #0f2240; margin-top: -68px; padding-top: 68px; }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: float 14s ease-in-out infinite; }
.hero::before { width: 520px; height: 520px; background: #2c5282; top: -160px; right: -120px; }
.hero::after { width: 420px; height: 420px; background: #0ea5e9; bottom: -200px; left: -120px; opacity: .35; animation-delay: -6s; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 34px; align-items: center; padding-top: 70px; padding-bottom: 86px; }
.hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 14px; letter-spacing: -.02em; }
.hero h1 .grad { background: linear-gradient(90deg, #93c5fd, #a5f3fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #cbd8ea; font-size: 1.08rem; max-width: 620px; }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); padding: 5px 12px; border-radius: 99px; font-size: .82rem; color: #dbe4f0; margin-bottom: 16px; }
.hero img.seal { width: 200px; height: 200px; border-radius: 50%; background: #fff; padding: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 0 10px rgba(255, 255, 255, .06); animation: float 9s ease-in-out infinite; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero .cta .btn { background: #fff; color: #16325a; border-color: #fff; font-weight: 700; }
.hero .cta .btn.ghost { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .4); }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 30px; }
.hero-stats div b { display: block; font-size: 1.6rem; color: #fff; }
.hero-stats div span { font-size: .82rem; color: #a9bad3; }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; padding-top: 40px; } .hero img.seal { width: 120px; height: 120px; order: -1; } }
.section { padding: 64px 0; }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); text-align: center; margin-bottom: 8px; }
.section .lead { text-align: center; color: var(--muted); margin: 0 auto 30px; max-width: 640px; }
.section.alt { background: color-mix(in srgb, var(--surface-3) 70%, transparent); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); transition: transform .3s var(--ease), box-shadow .3s, border-color .2s; position: relative; overflow: hidden; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.feature .icon { font-size: 1.6rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: var(--info-bg); }
.feature h3 { margin: 14px 0 6px; font-size: 1.08rem; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.feature.soon { opacity: .7; }
.pub-footer { background: #0b1830; color: #a9b8cc; text-align: center; padding: 30px 16px; font-size: .85rem; }
.theme-toggle { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

/* Apparition au défilement */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ===================== Pôle ASD : grille d'évaluation ===================== */
.grid-doc h1 { font-size: 1.6rem; margin: 10px 0 14px; }
.grid-meta { display: grid; grid-template-columns: max-content minmax(0, 340px); gap: 6px 12px; justify-content: center; margin-bottom: 18px; align-items: center; }
.grid-meta dt { font-weight: 700; font-size: .85rem; text-align: right; color: var(--heading); }
.grid-meta dd { margin: 0; border-bottom: 1px solid var(--line); padding: 3px 4px; min-height: 1.6em; }
.grid-table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.grid-table th, .grid-table td { border: 1px solid #b8c4d4; padding: 8px 10px; white-space: normal; }
.grid-table th { background: var(--navy); color: #fff; text-transform: none; font-size: .9rem; letter-spacing: 0; position: static; }
.grid-table td.c { text-align: center; }
.grid-table input { max-width: 110px; text-align: center; padding: 5px 6px; }
.grid-table tr.total td { background: var(--surface-3); font-weight: 800; color: var(--heading); }
.grid-table tr.hl td { background: var(--info-bg); font-weight: 700; transition: background-color .3s; }
.result-pill { display: inline-block; padding: 7px 18px; border-radius: 99px; font-weight: 800; font-size: 1.05rem; animation: pop .35s var(--ease); }
.result-pill.accepte { background: var(--ok-bg); color: var(--ok); }
.result-pill.ameliorer { background: var(--warn-bg); color: var(--warn); }
.result-pill.refuse { background: var(--bad-bg); color: var(--bad); }

/* ===================== Pôle ASD : règlement ===================== */
.reg { max-width: 920px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-left: 10px solid #1e3a5f; border-radius: var(--radius); padding: 30px 34px; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.reg-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: 14px; }
.reg-head img { width: 84px; height: 84px; }
.reg-head .gov { border-left: 2px solid var(--navy); padding-left: 14px; color: var(--navy); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; font-size: .9rem; line-height: 1.5; }
.reg-head .ref { margin-left: auto; text-align: right; font-size: .75rem; font-weight: 700; color: var(--navy); text-transform: uppercase; }
.reg h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.6rem, 4.5vw, 2.6rem); line-height: 1.05; margin: 18px 0 6px; color: #0f2340; }
.reg h1 small { display: block; font-size: .55em; font-weight: 400; letter-spacing: 1px; }
.reg .subtitle { color: var(--navy); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; font-size: .85rem; margin-bottom: 18px; }
.reg-box { background: #eef3f9; border: 1px solid #cfdbea; border-radius: 8px; padding: 14px 18px; display: flex; gap: 16px; align-items: flex-start; margin: 14px 0; }
.reg-box .ico { font-size: 2rem; line-height: 1; min-width: 46px; text-align: center; }
.reg-box h3 { margin: 0 0 4px; font-size: .95rem; text-transform: uppercase; letter-spacing: .5px; }
.reg-box p { margin: 0; color: #334155; }
.reg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 16px 0; }
.reg-art { border: 1px solid #cfdbea; border-radius: 8px; padding: 0 16px 14px; background: #fff; overflow: hidden; }
.reg-art .num { display: inline-block; background: #1e3a5f; color: #fff; font-weight: 800; font-size: 1.3rem; padding: 6px 12px; margin-right: 10px; }
.reg-art h3 { display: inline; font-size: .95rem; text-transform: uppercase; }
.reg-art p { color: #334155; font-size: .93rem; margin: 12px 0 0; }
.reg-sign { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-top: 20px; }
.reg-sign .who b { display: block; font-size: 1.1rem; color: #0f2340; }
.reg-sign img { width: 100px; }

/* ===================== Animations ===================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.main.page-enter > * { animation: fadeUp .4s var(--ease) both; }
.main.page-enter > *:nth-child(2) { animation-delay: .04s; }
.main.page-enter > *:nth-child(3) { animation-delay: .08s; }
.main.page-enter > *:nth-child(4) { animation-delay: .12s; }
.main.page-enter > *:nth-child(n+5) { animation-delay: .16s; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  :root { color-scheme: light; }
  .topbar, .sidebar, .no-print, .toast-stack, .pub-nav, .backdrop { display: none !important; }
  .app-layout { display: block; }
  .main { padding: 0; }
  body { background: #fff; color: #000; }
  .card, .paper, .reg { border: none; box-shadow: none; }
  .main.page-enter > * { animation: none; }
}

/* ---- Certificats d'aptitude (entretiens FIB / SASP) ---- */
.cert-models { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cert-model { display: flex; flex-direction: column; gap: 2px; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s; position: relative; }
.cert-model input { position: absolute; opacity: 0; pointer-events: none; }
.cert-model b { font-size: 1.15rem; color: var(--heading); }
.cert-model span { color: var(--muted); font-size: .85rem; }
.cert-model:has(input:checked) { border-color: var(--navy-2); background: var(--info-bg); }
.cert-model.soon { opacity: .55; cursor: not-allowed; }
.cert-model .badge { align-self: flex-start; margin-top: 4px; }
.cert-rules { margin: 12px 0 0; padding-left: 20px; font-weight: 600; }
.cert-part { margin-top: 22px; }
.cert-part > h2 { background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 1rem; text-transform: uppercase; letter-spacing: .3px; }
.cert-part > h3 { margin: 16px 0 6px; color: var(--navy-2); }
.cert-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 8px; background: var(--surface); transition: opacity .2s; }
.cert-item.unpicked { opacity: .6; }
.cert-answer { display: grid; gap: 8px; margin-top: 8px; }
.cert-answer textarea { min-height: 52px; }
.evals { display: flex; flex-wrap: wrap; gap: 6px; }
.evals .chip input { position: absolute; opacity: 0; pointer-events: none; }
.evals .chip { position: relative; user-select: none; }
.evals .chip.ev-ok.on { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.evals .chip.ev-moyen.on { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.evals .chip.ev-ko.on { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.cert-sign { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.8rem; color: var(--navy); }
@media print {
  .cert-item { break-inside: avoid; }
  .evals .chip:not(.on) { display: none; }
  .cert-item textarea { border: none; resize: none; padding: 0; }
}

/* ===== Statistiques ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stat-chart h3 { margin: 0 0 12px; font-size: 1rem; }
.stat-chart .bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; }
.stat-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.stat-chart .bar { width: 100%; max-width: 46px; min-height: 3px; border-radius: 6px 6px 2px 2px; transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.stat-chart .v { font-size: .8rem; font-weight: 700; margin-bottom: 4px; }
.stat-chart .m { font-size: .72rem; color: var(--muted); margin-top: 6px; white-space: nowrap; }