/* ==========================================================================
   Influentia RDC — socle visuel commun (site public, espace apprenant, admin)
   Couleurs tirées du logo : bleu « Influentia » + jaune de l'ampoule.
   ========================================================================== */

:root {
  --ink: #081430;
  --ink-2: #0E2152;
  --ink-3: #18306B;
  --paper: #F3F6FB;
  --white: #FFFFFF;
  --sky: #1E9BE6;
  --sky-deep: #0A6CB5;
  --sky-soft: #E3F2FD;
  --bulb: #FFC633;
  --bulb-deep: #B7860A;
  --bulb-soft: #FFF4D1;
  --mint: #12B886;
  --mint-soft: #DDF7EE;
  --danger: #D92D20;
  --danger-soft: #FEE9E7;
  --warn: #B54708;
  --warn-soft: #FEF0C7;

  --text: #0C1A38;
  --text-2: #43526E;
  --muted: #6A7892;
  --line: #DCE3EE;
  --line-2: #E9EEF5;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-2xl: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  --fs-3xl: clamp(2.5rem, 1.5rem + 4.2vw, 4.75rem);
  --fs-hero: clamp(2.9rem, 1.4rem + 6.4vw, 7rem);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --shadow-1: 0 1px 2px rgba(8, 20, 48, .06), 0 1px 1px rgba(8, 20, 48, .04);
  --shadow-2: 0 10px 30px -12px rgba(8, 20, 48, .22);
  --shadow-3: 0 30px 80px -30px rgba(8, 20, 48, .45);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--sky-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 700; color: inherit; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); letter-spacing: -0.015em; }
h4 { font-size: var(--fs-lg); letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
::selection { background: var(--bulb); color: var(--ink); }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

.ic { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 9999; background: var(--bulb); color: var(--ink); padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.lead { font-size: clamp(1.0625rem, 1rem + .4vw, 1.3rem); line-height: 1.55; color: var(--text-2); max-width: 62ch; }
.measure { max-width: 68ch; }
.stack > * + * { margin-top: var(--stack, 1rem); }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* ---------- Boutons ---------- */
.btn {
  --b-bg: var(--ink); --b-fg: #fff; --b-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 46px; padding: .7rem 1.25rem;
  border-radius: 999px; border: 1.5px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 600; font-size: var(--fs-sm); line-height: 1.1; letter-spacing: .005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s, color .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { color: var(--b-fg); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-bulb { --b-bg: var(--bulb); --b-fg: var(--ink); }
.btn-bulb:hover { --b-bg: #FFD45E; }
.btn-sky { --b-bg: var(--sky-deep); --b-fg: #fff; }
.btn-sky:hover { --b-bg: #085C9C; }
.btn-ghost { --b-bg: transparent; --b-fg: var(--text); --b-bd: var(--line); }
.btn-ghost:hover { --b-bd: var(--ink); --b-fg: var(--ink); box-shadow: none; }
.btn-ghost-light { --b-bg: rgba(255,255,255,.04); --b-fg: #fff; --b-bd: rgba(255,255,255,.28); }
.btn-ghost-light:hover { --b-bd: #fff; box-shadow: none; }
.btn-wa { --b-bg: #1FAF56; --b-fg: #fff; }
.btn-wa:hover { --b-bg: #18974A; }
.btn-danger { --b-bg: var(--danger); --b-fg: #fff; }
.btn-soft { --b-bg: var(--line-2); --b-fg: var(--text); }
.btn-soft:hover { --b-bg: var(--line); box-shadow: none; }
.btn-sm { min-height: 36px; padding: .45rem .9rem; font-size: var(--fs-xs); }
.btn-lg { min-height: 54px; padding: .9rem 1.6rem; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; text-decoration: none; color: var(--sky-deep); }
.link-arrow .ic { transition: transform .2s var(--ease); }
.link-arrow:hover .ic { transform: translateX(3px); }

/* ---------- Pastilles d'état ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600; line-height: 1.3; background: var(--line-2); color: var(--text-2); white-space: nowrap; }
.chip .ic { width: 1em; height: 1em; }
.chip-ok { background: var(--mint-soft); color: #0B7A59; }
.chip-sky { background: var(--sky-soft); color: var(--sky-deep); }
.chip-bulb { background: var(--bulb-soft); color: #7A5600; }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-ink { background: var(--ink); color: #fff; }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--r-md); margin-bottom: 1rem; font-size: var(--fs-sm); border: 1px solid transparent; }
.alert > .ic { margin-top: .15rem; width: 1.2em; height: 1.2em; }
.alert a { color: inherit; font-weight: 700; }
.alert-success { background: var(--mint-soft); color: #075E45; border-color: #B5EBD8; }
.alert-error { background: var(--danger-soft); color: #9A1B12; border-color: #F9C7C2; }
.alert-warning { background: var(--warn-soft); color: #7A3204; border-color: #FBD98A; }
.alert-info { background: var(--sky-soft); color: #08497A; border-color: #BFE0F8; }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=url], .field input[type=search], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: .7rem .9rem;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--text);
  font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236A7892' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px rgba(30, 155, 230, .16); }
.field input[type=file] { padding: .55rem; min-height: 0; border: 1.5px dashed var(--line); border-radius: 12px; background: var(--paper); width: 100%; font-size: var(--fs-sm); }
.input-wrap { position: relative; }
.input-wrap .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.input-wrap .toggle-pass:hover { color: var(--ink); background: var(--line-2); }
.input-wrap input { padding-right: 3rem !important; }
.check { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--sky-deep); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Barre de progression ---------- */
.progress { --p: 0; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: calc(var(--p) * 1%); background: linear-gradient(90deg, var(--sky), var(--sky-deep)); border-radius: inherit; transition: width .6s var(--ease); }
.progress.is-done > span { background: var(--mint); }

.ring { --p: 0; --size: 64px; --stroke: 7px; width: var(--size); height: var(--size); position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--line-2); }
.ring .bar { stroke: var(--sky); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring.is-done .bar { stroke: var(--mint); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: calc(var(--size) * .22); letter-spacing: -.02em; }

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; z-index: 1200; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 20, 48, .62); backdrop-filter: blur(6px); animation: fadeIn .2s ease; }
.modal-panel { position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: var(--r-lg); padding: clamp(20px, 4vw, 32px); box-shadow: var(--shadow-3); animation: popIn .25s var(--ease); }
.modal-panel.wide { max-width: 760px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-panel h3 { padding-right: 40px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Toast ---------- */
.toast-zone { position: fixed; z-index: 1500; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .85rem 1rem; border-radius: 14px; box-shadow: var(--shadow-3); display: flex; gap: .6rem; align-items: center; font-size: var(--fs-sm); animation: popIn .25s var(--ease); pointer-events: auto; }
.toast.ok .ic { color: var(--mint); }
.toast.err .ic { color: #FF8A80; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-xs); padding: .7rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .85rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFCFE; }

.empty { text-align: center; padding: clamp(28px, 6vw, 56px) 20px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--sky); }
.empty h3 { color: var(--text); font-size: var(--fs-lg); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bulb); color: var(--ink); font-weight: 700; font-family: var(--font-display); flex: none; font-size: .95rem; }
