/* =========================================================================
   MonKinéSud by MonRFS — mks-core.css
   Charte FIGÉE « Performance Lab » (Consolidation V3 §A) — namespace .mks-
   Design system commun à toutes les pages. Ne pas dériver les tokens.
   ========================================================================= */

/* ---- A.1 Tokens couleur (à reprendre tel quel) ------------------------- */
:root{
  /* fonds & structure */
  --mks-bg:#F7F8FA;
  --mks-card:#FFFFFF;
  --mks-line:#E5E9F0;
  --mks-line2:#D5DCE8;
  /* identité */
  --mks-ink:#0E2A47;
  --mks-ink2:#1E3A5F;
  --mks-lime:#8BC700;
  --mks-lime-d:#74A800;
  --mks-blue-data:#3B6FB5;
  /* texte */
  --mks-muted:#64748B;
  --mks-muted2:#94A3B8;
  /* feux fonctionnels */
  --mks-red:#EF4444; --mks-orange:#F59E0B; --mks-yellow:#FACC15; --mks-green:#22C55E;
  /* variantes zones de force (fond de barre) */
  --mks-z-red:#FCA5A5; --mks-z-orange:#FCD34D; --mks-z-green:#86EFAC;
  /* ombres */
  --mks-shadow-card:0 8px 28px rgba(14,42,71,.08);
  --mks-shadow-float:0 20px 50px rgba(14,42,71,.10);
  /* rayons */
  --mks-r-card:18px; --mks-r-input:10px; --mks-r-chip:16px;
}

/* ---- Reset léger ------------------------------------------------------- */
*{margin:0;padding:0;box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}

/* ---- A.2 Typographie -------------------------------------------------- */
body{
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  background:var(--mks-bg); color:var(--mks-ink);
  -webkit-font-smoothing:antialiased; line-height:1.5;
}
.mks-mono,.mks-num,.mks-h1,.mks-h2,.mks-h3,.mks-score{
  font-family:'Space Grotesk','Inter',sans-serif;
}
.mks-h1{font-size:28px; font-weight:700; color:var(--mks-ink); letter-spacing:-.5px;}
.mks-h2{font-size:18px; font-weight:600; color:var(--mks-ink);}
.mks-h3{font-size:15px; font-weight:600; color:var(--mks-ink2);}
.mks-num{font-weight:700;}
.mks-muted{color:var(--mks-muted);} .mks-muted2{color:var(--mks-muted2);}

/* ---- Layout ----------------------------------------------------------- */
.mks-wrap{max-width:780px; margin:0 auto; padding:20px;}
.mks-wrap--wide{max-width:1040px;}
.mks-row{display:grid; gap:14px;}
.mks-row.f2{grid-template-columns:1fr 1fr;}
.mks-row.f3{grid-template-columns:1fr 1fr 1fr;}
@media(max-width:560px){ .mks-row.f2,.mks-row.f3{grid-template-columns:1fr;} }

/* ---- Topbar ----------------------------------------------------------- */
.mks-topbar{position:sticky; top:0; z-index:100; background:#fff;
  border-bottom:1px solid var(--mks-line); box-shadow:0 2px 12px rgba(14,42,71,.06);}
.mks-topbar .mks-inner{max-width:780px; margin:0 auto; padding:14px 20px;
  display:flex; justify-content:space-between; align-items:center; gap:12px;}
.mks-logo{font-family:'Space Grotesk'; font-weight:700; font-size:18px; color:var(--mks-ink);}
.mks-logo span{color:var(--mks-lime-d);}
.mks-pid{font-family:'Space Grotesk'; font-size:12px; background:var(--mks-ink); color:#fff;
  padding:5px 10px; border-radius:7px; letter-spacing:1px;}

/* ---- B.5 Cartes ------------------------------------------------------- */
.mks-card{background:var(--mks-card); border:1px solid var(--mks-line);
  border-radius:var(--mks-r-card); box-shadow:var(--mks-shadow-card); overflow:hidden;}
.mks-card__head{display:flex; align-items:center; gap:12px; padding:18px 22px;
  background:linear-gradient(180deg,#fff,#fafbfd); border-bottom:1px solid var(--mks-line);}
.mks-card__head .mks-nb{width:30px; height:30px; border-radius:9px; background:var(--mks-ink);
  color:#fff; font-family:'Space Grotesk'; font-weight:700; font-size:14px;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.mks-card__head h2{font-family:'Space Grotesk'; font-size:17px; color:var(--mks-ink); flex:1;}
.mks-card__head .mks-sub{font-size:11px; color:var(--mks-muted2); font-weight:400;}
.mks-card__body{padding:20px 22px;}

/* ---- Champs / inputs -------------------------------------------------- */
.mks-field{margin-bottom:14px;}
.mks-field label{display:block; font-size:12px; font-weight:600; color:var(--mks-ink2); margin-bottom:5px;}
.mks-field label .mks-hint{font-weight:400; color:var(--mks-muted2); font-size:11px;}
.mks-input,.mks-select,.mks-textarea{
  width:100%; padding:11px 13px; border:1px solid var(--mks-line2);
  border-radius:var(--mks-r-input); font-family:'Inter'; font-size:15px;
  color:var(--mks-ink); background:#fff;}
.mks-textarea{resize:vertical; min-height:60px;}
.mks-input:focus,.mks-select:focus,.mks-textarea:focus{
  outline:none; border-color:var(--mks-lime-d); box-shadow:0 0 0 3px rgba(139,199,0,.12);}
.mks-num-input{font-family:'Space Grotesk'; text-align:center;}
/* champ pré-rempli depuis bilan précédent (vert pâle) */
.mks-field--prefilled .mks-input,.mks-field--prefilled .mks-select{background:#FAFCF5;}
.mks-input--invalid{border-color:var(--mks-red)!important; box-shadow:0 0 0 3px rgba(239,68,68,.12);}

/* ---- Boutons ---------------------------------------------------------- */
.mks-btn{display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:'Inter'; font-weight:600; font-size:15px; padding:13px 22px;
  border-radius:var(--mks-r-input); border:1px solid transparent; cursor:pointer;
  transition:.18s; text-decoration:none; min-height:48px;}
.mks-btn--primary{background:var(--mks-lime-d); color:#fff;}
.mks-btn--primary:hover{background:var(--mks-lime); box-shadow:0 6px 18px rgba(139,199,0,.3);}
.mks-btn--ink{background:var(--mks-ink); color:#fff;}
.mks-btn--ink:hover{background:var(--mks-ink2);}
.mks-btn--ghost{background:#fff; color:var(--mks-ink2); border-color:var(--mks-line2);}
.mks-btn--ghost:hover{border-color:var(--mks-lime-d); color:var(--mks-ink);}
.mks-btn[disabled]{opacity:.45; cursor:not-allowed;}
.mks-btn--block{width:100%;}

/* ---- A.5 Chips / statuts couleur ------------------------------------- */
.mks-chip{display:inline-flex; align-items:center; gap:6px; font-family:'Space Grotesk';
  font-size:13px; font-weight:700; padding:4px 12px; border-radius:14px;
  background:var(--mks-bg); color:var(--mks-muted);}
.mks-chip.g{background:#DCFCE7; color:#15803D;}
.mks-chip.y{background:#FEF9C3; color:#A16207;}
.mks-chip.o{background:#FEF3C7; color:#B45309;}
.mks-chip.r{background:#FEE2E2; color:#B91C1C;}
.mks-chip.x{background:var(--mks-bg); color:var(--mks-muted2);}
/* texte coloré résultat (live) */
.mks-res.g{color:var(--mks-green);} .mks-res.y{color:#CA8A04;}
.mks-res.o{color:var(--mks-orange);} .mks-res.r{color:var(--mks-red);} .mks-res.x{color:var(--mks-muted2);}

/* ---- Encart info / alerte -------------------------------------------- */
.mks-tip{font-size:11px; color:var(--mks-muted); background:var(--mks-bg);
  border-radius:8px; padding:8px 12px; margin-top:10px;}
.mks-alert{background:#FEF2F2; border:1px solid #FECACA; border-radius:12px; padding:14px 16px;}
.mks-alert .mks-alert__t{font-weight:700; color:#B91C1C; font-size:13px; margin-bottom:6px;}
.mks-alert ul{margin-left:18px; font-size:13px; color:#7F1D1D;}

/* ---- Modal ------------------------------------------------------------ */
.mks-modal{position:fixed; inset:0; background:rgba(14,42,71,.6); z-index:300;
  display:none; padding:20px; overflow-y:auto;}
.mks-modal.show{display:block;}
.mks-modal__inner{max-width:640px; margin:20px auto; background:#fff; border-radius:18px; overflow:hidden;}
.mks-modal__head{padding:20px 24px; border-bottom:1px solid var(--mks-line);
  display:flex; justify-content:space-between; align-items:center;}
.mks-modal__head h3{font-family:'Space Grotesk'; font-size:18px; color:var(--mks-ink);}
.mks-modal__x{font-size:24px; color:var(--mks-muted); cursor:pointer; line-height:1; background:none; border:none;}
.mks-modal__body{padding:18px 24px 24px;}

/* ---- Disclaimer pédagogique ------------------------------------------ */
.mks-disclaimer{font-size:11px; color:var(--mks-muted2); text-align:center;
  padding:16px 20px; line-height:1.5;}

/* ---- Mode sombre (optionnel, spec §7.3) -------------------------------
   Activé via html[data-mks-theme="dark"] (toggle MKS.toggleTheme).
   Le dashboard reste TOUJOURS clair (document imprimable).               */
html[data-mks-theme="dark"]{
  --mks-bg:#101B2D; --mks-card:#172538; --mks-line:#26374F; --mks-line2:#324560;
  --mks-ink:#E8EFF8; --mks-ink2:#C6D4E5; --mks-muted:#8FA3BC; --mks-muted2:#67809C;
  --mks-shadow-card:0 8px 28px rgba(0,0,0,.35);
}
html[data-mks-theme="dark"] body{background:#0B1422; color:var(--mks-ink);}
html[data-mks-theme="dark"] body.mks-saisie{background:#0B1422;}
html[data-mks-theme="dark"] .mks-topbar,
html[data-mks-theme="dark"] .mks-actionbar,
html[data-mks-theme="dark"] .mks-block,
html[data-mks-theme="dark"] .mks-modal__inner,
html[data-mks-theme="dark"] .mks-auth{background:var(--mks-card);}
html[data-mks-theme="dark"] .mks-block__head{background:linear-gradient(180deg,var(--mks-card),#13202F); border-color:var(--mks-line);}
html[data-mks-theme="dark"] .mks-input,
html[data-mks-theme="dark"] .mks-select,
html[data-mks-theme="dark"] .mks-textarea,
html[data-mks-theme="dark"] .mks-mini input,
html[data-mks-theme="dark"] .mks-mini select,
html[data-mks-theme="dark"] .mks-qcard .qscore{background:#0F1A2B; color:var(--mks-ink); border-color:var(--mks-line2);}
html[data-mks-theme="dark"] .mks-field--prefilled .mks-input,
html[data-mks-theme="dark"] .mks-field--prefilled .mks-select{background:#15251C;}
html[data-mks-theme="dark"] .mks-well-line .wbtns button,
html[data-mks-theme="dark"] .mks-eva .opt,
html[data-mks-theme="dark"] .mks-checks label,
html[data-mks-theme="dark"] .mks-q-opts button{background:#0F1A2B; color:var(--mks-ink2); border-color:var(--mks-line2);}
html[data-mks-theme="dark"] .mks-btn--ghost{background:transparent; color:var(--mks-ink2); border-color:var(--mks-line2);}
html[data-mks-theme="dark"] .mks-hero{background:linear-gradient(180deg,#12203A,#0B1422); border-color:var(--mks-line);}
html[data-mks-theme="dark"] .mks-prat,
html[data-mks-theme="dark"] .mks-teg-btn,
html[data-mks-theme="dark"] .mks-teg-card,
html[data-mks-theme="dark"] .mks-artic-card,
html[data-mks-theme="dark"] .mks-hist-item,
html[data-mks-theme="dark"] .mks-qcard,
html[data-mks-theme="dark"] .mks-bilat,
html[data-mks-theme="dark"] .mks-stair__head,
html[data-mks-theme="dark"] .mks-consent,
html[data-mks-theme="dark"] .mks-well-legend{background:#13202F; border-color:var(--mks-line);}
html[data-mks-theme="dark"] .mks-bilat .mks-bilat__row .mks-bilat{background:#0F1A2B;}
html[data-mks-theme="dark"] .mks-pv-card,
html[data-mks-theme="dark"] .mks-footer{background:var(--mks-card); border-color:var(--mks-line);}
html[data-mks-theme="dark"] .mks-tip,
html[data-mks-theme="dark"] .mks-chip{background:#13202F;}
html[data-mks-theme="dark"] .mks-theme-btn{background:var(--mks-card); color:#FACC15;}
html[data-mks-theme="dark"] .mks-draftbar{background:#2A2412; border-color:#564A1B; color:#FACC15;}
/* éléments à fond --mks-ink (devenu clair en dark) → accent lime, texte sombre */
html[data-mks-theme="dark"] .mks-pid,
html[data-mks-theme="dark"] .mks-block__head .nb,
html[data-mks-theme="dark"] .mks-stair__head .sn,
html[data-mks-theme="dark"] .mks-hist-item .artic{background:var(--mks-lime-d); color:#0B1422;}
html[data-mks-theme="dark"] .mks-well-line .wbtns button.sel,
html[data-mks-theme="dark"] .mks-q-opts button.sel{background:var(--mks-lime-d); color:#0B1422; border-color:var(--mks-lime-d);}
html[data-mks-theme="dark"] .mks-btn--ink{background:var(--mks-lime-d); color:#0B1422;}

/* ---- Utilitaires ------------------------------------------------------ */
.mks-hidden{display:none!important;}
.mks-mt{margin-top:14px;} .mks-mb{margin-bottom:14px;}
.mks-center{text-align:center;}
.mks-flex{display:flex; gap:12px; align-items:center;}
.mks-flex--between{justify-content:space-between;}
.mks-spacer{flex:1;}
