/* ===================================================================
   Design system — IDS Vérification de Site
   Les jetons et composants de l'interface. Renommé le 13/09/2026 sur
   l'ordre d'AKIM : la feuille portait le nom d'un design system tiers,
   arrivé avec le dossier de départ (input/dossier-de-depart/
   05-design-system.md). Valeurs inchangées, préfixe `--ids-`.
   =================================================================== */

/* --- 1. Variables CSS (:root) --- */
:root {
  --ids-primary: #2563EB;
  --ids-primary-dark: #1D4ED8;
  --ids-primary-light: #DBEAFE;
  --ids-text: #111827;
  /* Un seul gris attenue, et il tient le seuil d'accessibilite sur les quatre
     fonds ou il est employe. L'ancien #9CA3AF donnait 2,54 pour 1 sur blanc et
     portait plus de 480 occurrences : toutes les dates et toutes les indications
     de fraicheur du controle. Sur un outil dont l'objet est de savoir QUAND un
     site a ete verifie, l'information temporelle etait la moins lisible. */
  --ids-text-attenue: #5F6875;
  --ids-text-muted: var(--ids-text-attenue);
  --term-attenue: #8B98AC;   /* le gris du terminal, sur son fond sombre */
  --ids-border: #D5DAE3;
  --ids-bg: #EDF0F5;
  --ids-sidebar: #F3F4F6;

  /* Detacher les surfaces : la page est plus foncee que la carte, le filet est
     plus franc, et la carte porte une elevation. Sans cela une carte blanche sur
     le fond de page se detache a 1,045 pour 1, c'est-a-dire pas du tout. */
  --ids-surface: #FFFFFF;
  --ids-border-fort: #C3CAD6;
  --ids-elevation-1: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --ids-survol: #EEF2F8;
  --ids-thead: #F1F3F8;
  --ids-thead-texte: #4B5563;   /* l'en-tete de tableau s'assombrit avec son fond */

  /* Echelle typographique : six degres, un rapport de 1,2 environ, un plancher a
     11px. Avant, 96,9 % du texte tenait entre 10 et 14px et le titre de page ne
     pesait que 1,46 fois le corps : quand tout a le meme poids, l'oeil doit lire
     pour comprendre. Trois graisses seulement — la 500 ne se distingue pas de la
     400 a l'oeil et disparait au profit de la 600. */
  --pas-legende: 11px;
  --pas-petit:   12px;
  --pas-corps:   14px;
  --pas-fort:    16px;
  --pas-section: 20px;
  --pas-page:    24px;
  --pas-chiffre: 28px;
  --graisse-corps: 400;
  --graisse-appui: 600;
  --graisse-titre: 700;

  /* Le parcours au clavier : un anneau unique, identique partout. Il n'existait
     qu'une regle de focus dans tout le systeme, et elle supprimait le contour du
     navigateur pour un halo a 1,15 pour 1 — autant dire rien. */
  --ids-focus: #1D4ED8;
  --ids-focus-halo: rgba(29,78,216,.35);

  /* La longueur de ligne confortable. Mesure avant : jusqu'a 231 caracteres a
     1920px sur /parametres. A cette longueur l'oeil perd le debut de la ligne
     suivante a chaque retour — c'est le « il faut se concentrer pour lire ». */
  --mesure-prose: 68ch;
  --mesure-prose-etroite: 52ch;
}

/* --- 2. Reset & Typographie --- */
* { font-family: 'Inter', system-ui, sans-serif; box-sizing: border-box; }
body { background: var(--ids-bg); color: var(--ids-text); -webkit-font-smoothing: antialiased; margin: 0; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* --- 3. Tags (pills) --- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 9999px; font-size: var(--pas-legende); font-weight: var(--graisse-appui); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.tag-gray { background: #F3F4F6; color: #4B5563; }
.tag-blue { background: #DBEAFE; color: #1D4ED8; }
.tag-purple { background: #EDE9FE; color: #6D28D9; }
.tag-amber { background: #FEF3C7; color: #B45309; }
.tag-orange { background: #FFEDD5; color: #C2410C; }
.tag-red { background: #FEE2E2; color: #B91C1C; }
.tag-green { background: #D1FAE5; color: #047857; }
.tag-cyan { background: #CFFAFE; color: #0E7490; }
.tag-pink { background: #FCE7F3; color: #BE185D; }

/* --- 4. Boutons --- */
.btn { padding: 9px 16px; border-radius: 8px; font-size: var(--pas-corps); font-weight: var(--graisse-appui); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.15s ease; border: 1px solid transparent; }
.btn-primary { background: var(--ids-primary); color: white; }
.btn-primary:hover { background: var(--ids-primary-dark); }
.btn-secondary { background: white; color: var(--ids-text); border-color: var(--ids-border); }
.btn-secondary:hover { background: var(--ids-bg); }
.btn-danger { background: #DC2626; color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost { background: transparent; color: var(--ids-text); }
.btn-ghost:hover { background: var(--ids-bg); }

/* --- 5. Inputs & Labels --- */
.input { width: 100%; padding: 9px 12px; background: white; border: 1px solid var(--ids-border); border-radius: 8px; font-size: var(--pas-corps); transition: all 0.15s ease; }
.input:focus { border-color: var(--ids-primary); }
.label { font-size: var(--pas-corps); font-weight: var(--graisse-appui); color: var(--ids-text); margin-bottom: 6px; display: block; }
.label .req { color: #EF4444; margin-left: 2px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.chk input { width: 16px; height: 16px; accent-color: var(--ids-primary); }

/* --- 6. Cartes --- */
.card-hover { transition: all 0.2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08); }

/* --- 7. Avatars --- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-size: 12px; font-weight: 600; background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%); color: white; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.av-amber { background: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%); }
.av-green { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.av-purple { background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%); }
.av-pink { background: linear-gradient(135deg, #EC4899 0%, #BE185D 100%); }
.av-cyan { background: linear-gradient(135deg, #06B6D4 0%, #0E7490 100%); }
.av-red { background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%); }
.av-gray { background: linear-gradient(135deg, #6B7280 0%, #374151 100%); }

/* --- 8. Navigation sidebar --- */
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 7px; color: #4B5563; font-weight: var(--graisse-appui); font-size: var(--pas-corps); cursor: pointer; transition: all 0.15s ease; text-decoration: none; }
.nav-item:hover { background: white; color: var(--ids-text); }
.nav-item.active { background: white; color: var(--ids-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.nav-item.active .nav-icon { color: var(--ids-primary); }

/* --- 9. Progress bars --- */
.progress-bar { height: 6px; background: #E5E7EB; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--ids-primary); border-radius: 3px; transition: width 0.4s ease; }

/* --- 10. Modales --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fadeIn 0.15s ease; }
.modal { background: white; border-radius: 12px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); animation: modalIn 0.2s ease; }
.modal-wide { max-width: 900px; }
.modal-xwide { max-width: 1100px; }

/* --- 11. Toasts --- */
#toasts { position: fixed; top: 80px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: white; border-radius: 10px; padding: 12px 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px; border-left: 4px solid var(--ids-primary); min-width: 280px; animation: toastIn 0.25s ease; }
.toast-success { border-left-color: #10B981; }
.toast-warning { border-left-color: #F59E0B; }
.toast-error { border-left-color: #EF4444; }

/* --- 12. Tables --- */
.table { width: 100%; font-size: var(--pas-corps); }
.table thead { background: var(--ids-thead); }
.table th { padding: 12px 16px; text-align: left; font-weight: var(--graisse-appui); font-size: var(--pas-petit); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ids-thead-texte); border-bottom: 1px solid var(--ids-border-fort); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--ids-border); }
.table tbody tr:hover { background: var(--ids-survol); cursor: pointer; }

/* --- 13. Badge notification --- */
.badge-notif { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; background: #EF4444; color: white; font-size: 10px; font-weight: 600; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* --- 14. Audit code --- */
.audit-code { font-family: monospace; font-size: var(--pas-petit); background: #F3F4F6; padding: 2px 6px; border-radius: 4px; }

/* --- 15. Login background --- */
.login-bg { background: linear-gradient(135deg, #EFF6FF 0%, #F3F4F6 100%); min-height: 100vh; }

/* --- 16. Priorites (dots) --- */
.prio-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.prio-basse { background: #9CA3AF; }
.prio-normale { background: #3B82F6; }
.prio-haute { background: #F59E0B; }
.prio-critique { background: #EF4444; }

/* --- 17. Switch toggle --- */
.switch { width: 36px; height: 20px; background: #D1D5DB; border-radius: 9999px; position: relative; cursor: pointer; transition: 0.2s; }
.switch.on { background: var(--ids-primary); }
.switch::after { content: ''; position: absolute; width: 16px; height: 16px; background: white; border-radius: 50%; top: 2px; left: 2px; transition: 0.2s; }
.switch.on::after { left: 18px; }

/* --- 18. Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* --- 19. IDS specifiques --- */
.check-row { display: grid; grid-template-columns: 60px 1fr 100px 120px 140px; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--ids-border); font-size: var(--pas-corps); align-items: center; }
.check-row:last-child { border-bottom: none; }
.check-pass { border-left: 3px solid #10B981; padding-left: 9px; }
.check-warn { border-left: 3px solid #F59E0B; padding-left: 9px; }
.check-fail { border-left: 3px solid #EF4444; padding-left: 9px; }
.check-skip { border-left: 3px solid #9CA3AF; padding-left: 9px; }

.score-ring { position: relative; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring .bg-ring { stroke: #E5E7EB; }
.score-ring .fg-ring { transition: stroke-dashoffset 0.4s ease; }
.score-value { font-size: var(--pas-corps); font-weight: var(--graisse-titre); }

.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ids-border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.diagnostic-panel { background: #FEF3C7; border: 1px solid #FDE68A; border-radius: 8px; padding: 12px; }
.diagnostic-panel.critical { background: #FEE2E2; border-color: #FCA5A5; }
.diagnostic-panel.info { background: #DBEAFE; border-color: #93C5FD; }

.sparkline { height: 32px; display: flex; align-items: flex-end; gap: 2px; }
.sparkline .bar { flex: 1; background: var(--ids-primary); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.3; transition: opacity 0.15s; }
.sparkline .bar.green { background: #10B981; opacity: 0.7; }
.sparkline .bar.red { background: #EF4444; opacity: 0.7; }
.sparkline .bar.amber { background: #F59E0B; opacity: 0.7; }

.run-progress { position: fixed; top: 0; left: 240px; right: 0; z-index: 30; background: white; border-bottom: 1px solid var(--ids-border); padding: 8px 32px; display: none; animation: fadeIn 0.2s ease; }
.run-progress.active { display: flex; align-items: center; gap: 16px; }

/* --- 19b. Terminal live --- */
.terminal { background: #0F172A; color: #E2E8F0; font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace; font-size: 12px; border-radius: 10px; padding: 16px; overflow-y: auto; line-height: 1.65; }
.terminal-line { white-space: pre-wrap; word-break: break-word; }
.term-info { color: #94A3B8; }
.term-ok { color: #34D399; }
.term-warn { color: #FBBF24; }
.term-err { color: #F87171; }
.term-cmd { color: #60A5FA; font-weight: 600; }
.term-muted { color: var(--term-attenue); }
.terminal-toolbar { background: #1E293B; padding: 8px 14px; border-radius: 10px 10px 0 0; display: flex; align-items: center; gap: 10px; font-size: 12px; color: #CBD5E1; }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.term-body { border-radius: 0 0 10px 10px; }
.cursor-blink { display: inline-block; width: 7px; height: 13px; background: #34D399; vertical-align: middle; animation: blink 1s infinite; }

/* --- 19c. Diff d'import --- */
.diff-line { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 5px 10px; font-size: var(--pas-petit); font-family: 'SF Mono', 'Menlo', monospace; border-left: 3px solid transparent; }
.diff-add { background: #ECFDF5; border-left-color: #10B981; color: #065F46; }
.diff-mod { background: #FFFBEB; border-left-color: #F59E0B; color: #92400E; }
.diff-del { background: #FEF2F2; border-left-color: #EF4444; color: #991B1B; text-decoration: line-through; }
.diff-eq { color: #9CA3AF; }
.diff-marker { text-align: center; font-weight: 700; }

/* --- 19d. Drop zone --- */
.dropzone { border: 2px dashed var(--ids-border); border-radius: 12px; padding: 32px; text-align: center; background: var(--ids-bg); transition: all 0.2s ease; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--ids-primary); background: #EFF6FF; }

/* --- 19e. Boutons domaine distant --- */
.btn[data-remote="true"] { opacity: 0.5; cursor: not-allowed; position: relative; }
.btn[data-remote="true"]:hover::after { content: attr(data-remote-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #111827; color: white; padding: 6px 10px; border-radius: 6px; font-size: 11px; white-space: nowrap; margin-bottom: 4px; }

/* --- 20. Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }


/* --- 21. L'echelle typographique s'impose aux gabarits ---------------------
   Les gabarits emploient des tailles arbitraires (text-[13px], text-[15px]...)
   qui produisaient 39 niveaux distincts dans un seul premier ecran. Chacune est
   ramenee a son degre de l'echelle. La specificite passe par body pour primer
   sur les utilitaires quel que soit l'ordre d'injection. Aucune taille nouvelle
   n'apparait dans les gabarits : toute valeur y reste un jeton. */
body .text-\[10px\], body .text-\[11px\] { font-size: var(--pas-legende); }
body .text-\[12px\]                        { font-size: var(--pas-petit); }
body .text-\[13px\], body .text-\[14px\] { font-size: var(--pas-corps); }
body .text-\[15px\], body .text-\[16px\] { font-size: var(--pas-fort); }
body .text-\[17px\], body .text-\[18px\],
body .text-\[20px\]                        { font-size: var(--pas-section); }
body .text-\[19px\], body .text-\[22px\] { font-size: var(--pas-page); }
body .text-sm                               { font-size: var(--pas-corps); }
body h1                                     { font-size: var(--pas-page); font-weight: var(--graisse-titre); }
body .font-medium                           { font-weight: var(--graisse-appui); }

/* --- 22. Le focus clavier, dessine une fois pour toutes ------------------- */
.input:focus-visible,
.btn:focus-visible,
a:focus-visible,
.nav-item:focus-visible,
.onglet:focus-visible,
button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ids-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ids-focus-halo);
  border-radius: 6px;
}

/* --- 23. La prose est bornee en largeur ---------------------------------- */
.prose,
.brique-question,
.diagnostic-panel,
.diagnostic-panel p,
.diagnostic-panel > div { max-width: var(--mesure-prose); }

/* --- 24. Le gris attenue des gabarits passe par le jeton ------------------ */
body .text-gray-300,
body .text-gray-400,
body .text-gray-500,
body .text-gray-600 { color: var(--ids-text-attenue); }
