:root{
  --navy:#0E1D62; --navy-2:#23306B; --navy-deep:#0A1444; --navy-hover:#0A1547;
  --yellow:#FFDC60; --yellow-2:#F2CB40;
  --cream:#F4EFE6; --sand:#ECE4D5; --ink:#1A1A1A; --muted:#6B7280;
  --border:#E3DED2; --border-2:#D1D5DB; --white:#fff;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{font-family:'Raleway',Arial,sans-serif;color:var(--ink);background:var(--cream);line-height:1.55;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;min-height:100vh}
a{color:var(--navy);text-decoration:none}
::selection{background:var(--yellow);color:var(--navy)}

/* ===== App bar ===== */
.appbar{display:flex;align-items:center;gap:24px;background:var(--navy);color:#fff;padding:12px 24px}
.appbar-brand{display:flex;align-items:center;gap:11px;min-width:0}
.brand-mark{width:26px;height:26px;border-radius:7px;background:var(--yellow);flex-shrink:0}
.client-logo{width:30px;height:30px;border-radius:7px;object-fit:contain;background:#fff;flex-shrink:0}
.appbar-title{font-weight:800;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.appbar-title .sep{opacity:.5;margin:0 4px}
.appnav{display:flex;gap:6px;margin-left:8px;flex-wrap:wrap}
.appnav a{color:rgba(255,255,255,.78);font-weight:600;font-size:14px;padding:7px 13px;border-radius:8px;transition:background .15s,color .15s}
.appnav a:hover{color:#fff;background:rgba(255,255,255,.08)}
.appnav a.active{color:var(--navy);background:var(--yellow)}
.appuser{display:flex;align-items:center;gap:10px;margin-left:auto}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--yellow);color:var(--navy);font-weight:800;font-size:13px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.appuser-meta{display:flex;flex-direction:column;line-height:1.15}
.appuser-meta b{font-size:13px}
.appuser-meta small{font-size:11px;color:rgba(255,255,255,.6)}
.appuser-logout{color:rgba(255,255,255,.7);font-size:12px;font-weight:600;border:1px solid rgba(255,255,255,.2);padding:6px 11px;border-radius:999px;margin-left:6px}
.appuser-logout:hover{color:#fff;border-color:rgba(255,255,255,.45)}
@media(max-width:760px){.appuser-meta{display:none}.appbar{gap:12px;flex-wrap:wrap}}

/* ===== Main / footer ===== */
.appmain{flex:1;width:100%;max-width:1040px;margin:0 auto;padding:34px 24px}
.appmain.plain{display:flex;align-items:center;justify-content:center}
.appfoot{text-align:center;color:var(--muted);font-size:13px;padding:26px}

h1{color:var(--navy);font-weight:800;font-size:30px;line-height:1.12}
h2{color:var(--navy);font-weight:800;font-size:20px}
h3{color:var(--navy);font-weight:800;font-size:17px}
h4{color:var(--navy);font-weight:700;font-size:15px}
.muted{color:var(--muted)}
.error{color:#c0392b;font-weight:700}
.eyebrow{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}

/* ===== Hero ===== */
.hero{margin-bottom:24px}
.hero h1{margin:4px 0 6px}
.hero-sub{color:var(--muted);font-size:15px}
.progress{height:8px;border-radius:999px;background:var(--sand);margin-top:12px;max-width:420px;overflow:hidden}
.progress span{display:block;height:100%;background:var(--yellow);border-radius:999px}

/* ===== Bento ===== */
.bento{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:18px;margin-bottom:30px}
@media(max-width:860px){.bento{grid-template-columns:1fr}}
.bento-card{background:var(--white);border:1px solid var(--border);border-radius:16px;padding:22px;display:flex;flex-direction:column;gap:6px}
.bento-card h3{margin-top:2px}
.bento-card.resume{background:var(--navy);color:#fff;justify-content:space-between}
.bento-card.resume .eyebrow,.bento-card.resume .muted{color:rgba(255,255,255,.7)}
.bento-card.resume h3{color:#fff}
.link-arrow{margin-top:auto;color:var(--yellow);font-weight:700;font-size:14px}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.link-mini{font-size:13px;font-weight:700;color:var(--navy)}
.mini-cols{display:flex;gap:10px;margin-top:14px}
.mini-cols div{flex:1;background:var(--cream);border-radius:10px;padding:12px;text-align:center}
.mini-cols .num{display:block;font-size:24px;font-weight:800;color:var(--navy)}
.mini-cols .num.accent{color:var(--yellow-2)}
.mini-cols .lbl{font-size:11px;color:var(--muted)}
.assistant-card{background:var(--sand);border-color:transparent}
.btn-ghost{margin-top:auto;align-self:flex-start;background:var(--white);color:var(--navy);font-weight:700;font-size:13px;border:1px solid var(--border-2);padding:9px 15px;border-radius:8px}
.btn-ghost:hover{border-color:var(--navy)}

/* ===== Ressources épinglées / grilles ===== */
.pinned{margin-top:10px}
.pinned .card-head{margin-bottom:14px}
.res-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.res-card{background:var(--white);border:1px solid var(--border);border-radius:14px;padding:18px;display:flex;flex-direction:column;gap:10px}
.res-card h4{margin:2px 0}
.res-card .btn-mini{align-self:flex-start;margin-top:auto}

/* ===== Tags par type ===== */
.tag{display:inline-block;align-self:flex-start;font-size:11px;font-weight:700;padding:3px 9px;border-radius:6px;text-transform:capitalize;letter-spacing:.02em;background:var(--sand);color:var(--navy)}
.tag-prompt{background:#FFF3C9;color:#8A6D00}
.tag-skill{background:#E5E9FF;color:#2B3A8F}
.tag-tuto_video{background:#FFE3D6;color:#A1471F}
.tag-mode_operatoire{background:#DCF1E6;color:#1F6B47}
.tag-fichier{background:#ECE4D5;color:#5A4A2A}

/* ===== Boutons ===== */
.btn{display:inline-block;background:var(--navy);color:#fff;font-weight:700;font-size:15px;font-family:inherit;border:0;padding:12px 20px;border-radius:9px;cursor:pointer}
.btn:hover{background:var(--navy-hover)}
.btn-mini{background:var(--yellow);color:var(--navy);font-weight:700;font-size:13px;font-family:inherit;border:0;padding:7px 13px;border-radius:7px;cursor:pointer}
.btn-mini:hover{background:var(--yellow-2)}

/* ===== Carte (login, etc.) ===== */
.card{background:var(--white);border:1px solid var(--border);border-radius:16px;padding:30px}
.card.narrow{max-width:430px;width:100%}
.link-card{display:block;transition:border-color .15s}
.link-card:hover{border-color:var(--navy)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:20px}
@media(max-width:640px){.grid2{grid-template-columns:1fr}}

/* ===== Formulaires ===== */
.stack{display:flex;flex-direction:column;gap:12px;margin-top:16px}
.stack.narrow{max-width:440px}
input,select,textarea{font-family:inherit;font-size:15px;padding:11px 14px;border:1px solid var(--border-2);border-radius:9px;width:100%;background:#fff}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--navy);box-shadow:0 0 0 3px rgba(14,29,98,.12)}

/* ===== Filtres / listes ===== */
.filters{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}
.filters a{font-size:13px;font-weight:700;padding:7px 13px;border:1px solid var(--border-2);border-radius:999px;color:var(--navy);background:#fff}
.filters a.active{background:var(--navy);color:#fff;border-color:var(--navy)}
.res-list{list-style:none;display:flex;flex-direction:column;gap:8px}
.res-item{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:13px 16px}
.res-item a{font-weight:700}

/* ===== Détail ressource ===== */
.markdown{background:#fff;border:1px solid var(--border);border-radius:14px;padding:22px;margin:18px 0}
.markdown h1,.markdown h2,.markdown h3{margin-top:14px}
.markdown p{margin:8px 0}
.video{position:relative;padding-bottom:56.25%;height:0;margin:18px 0;border-radius:14px;overflow:hidden;background:var(--navy-2)}
.video iframe{position:absolute;inset:0;width:100%;height:100%;border:0}

/* ===== Feuille de route (kanban) ===== */
.roadmap{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:18px}
@media(max-width:760px){.roadmap{grid-template-columns:1fr}}
.col{background:#fff;border:1px solid var(--border);border-radius:14px;padding:16px}
.cas{background:var(--cream);border-radius:10px;padding:11px 13px;margin-bottom:8px;font-weight:600;font-size:14px}
.cas p{font-weight:400;font-size:12px;margin-top:3px}

/* ===== Assistant (stub) ===== */
.assistant-stub{background:#fff;border:1px solid var(--border);border-radius:16px;padding:24px;margin-top:10px}
.suggestions{display:flex;gap:8px;flex-wrap:wrap}
.chip{background:var(--cream);color:var(--navy);font-weight:600;font-size:13px;padding:8px 14px;border-radius:999px;border:1px solid var(--border)}
.stub-note{margin-top:18px;color:var(--muted)}

/* ===== Détail ressource ===== */
.crumb{font-size:13px;color:var(--muted);margin-bottom:8px}
.crumb a{font-weight:600}
.detail-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:18px;align-items:start}
@media(max-width:760px){.detail-grid{grid-template-columns:1fr}}
.detail-aside{display:flex;flex-direction:column;gap:0}
.block{background:#fff;border:1px solid var(--border);border-radius:14px;padding:20px;margin-bottom:16px}
.block h3{margin-bottom:10px}
.prompt-box{background:var(--cream);border:1px dashed var(--border-2);border-radius:10px;padding:16px;font-family:inherit;font-size:14px;white-space:pre-wrap;color:var(--ink);margin-bottom:14px}
.ticks{list-style:none;display:flex;flex-direction:column;gap:8px}
.ticks li{padding-left:22px;position:relative;font-size:14px}
.ticks li::before{content:"";position:absolute;left:0;top:7px;width:10px;height:10px;border-radius:3px;background:var(--yellow)}
.steps{margin-left:18px;display:flex;flex-direction:column;gap:8px}
.steps li{font-size:15px;padding-left:4px}
.linked{list-style:none;display:flex;flex-direction:column;gap:8px}
.linked a{font-weight:700}
.video-empty{display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,.75);font-weight:700}

/* ===== Feuille de route (cartes riches) ===== */
.head-row{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.col-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.col-head .count{background:var(--cream);color:var(--navy);font-weight:800;font-size:13px;min-width:24px;height:24px;border-radius:999px;display:flex;align-items:center;justify-content:center;padding:0 7px}
.cas-card{display:block;background:#fff;border:1px solid var(--border);border-radius:12px;padding:14px;margin-bottom:10px;transition:border-color .15s}
.cas-card:hover{border-color:var(--navy)}
.cas-card h4{margin-bottom:4px}
.cas-card .muted{font-size:13px}
.badge-time{display:inline-block;margin-top:8px;background:var(--cream);color:var(--navy);font-size:11px;font-weight:700;padding:3px 9px;border-radius:999px}
.empty{padding:6px 2px}

/* ===== Statuts ===== */
.statut-identifie{background:var(--sand);color:#5A4A2A}
.statut-en_cours{background:#FFF3C9;color:#8A6D00}
.statut-adopte{background:#DCF1E6;color:#1F6B47}

/* ===== Page cas d'usage : encart latéral ===== */
.stats-block{display:flex;flex-direction:column;gap:14px}
.stat-line{display:flex;flex-direction:column;gap:4px}
.stat-line .lbl{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.stat-line b{font-size:15px;color:var(--navy)}
.chips{display:flex;flex-wrap:wrap;gap:6px}

/* ===== Formulaire cas ===== */
.form-card{max-width:640px}
.form-card label{display:block;font-weight:700;font-size:14px;color:var(--navy);margin-bottom:16px}
.form-card label .opt{font-weight:400;color:var(--muted)}
.form-card input,.form-card textarea{margin-top:7px;font-weight:400}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}

/* ===== Admin ===== */
.admin-page{max-width:920px;margin:0 auto;padding:34px 30px}
.admin-page h1{margin-bottom:4px}
.admin-page h2{margin-top:32px}
.admin-page h3{margin-top:20px;margin-bottom:2px;font-size:15px}
.admin-page > p{margin-top:6px}
.admin-page .crumb{margin-bottom:6px}
.admin-page .stack{max-width:480px}
.admin-page .res-item .actions{display:flex;gap:8px;align-items:center}
.admin-page .res-item form{display:inline;margin:0}

/* ===== Divers ===== */
.dev-box{background:#FFF8E1;border:1px dashed var(--yellow-2);border-radius:10px;padding:14px;margin:16px 0;word-break:break-all}

/* ===== Éditeur de texte riche ===== */
.rich-editor{margin-top:7px;border:1px solid var(--border-2);border-radius:9px;overflow:hidden;background:#fff}
.rich-editor:focus-within{border-color:var(--navy);box-shadow:0 0 0 3px rgba(14,29,98,.12)}
.rich-toolbar{display:flex;gap:2px;flex-wrap:wrap;padding:6px;border-bottom:1px solid var(--border);background:#FAF8F3}
.rich-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-family:inherit;color:var(--navy);background:#fff;border:1px solid var(--border-2);border-radius:6px;cursor:pointer;padding:0}
.rich-btn:hover{background:var(--yellow);border-color:var(--yellow-2)}
.rich-content{min-height:90px;padding:11px 14px;font-size:15px;font-weight:400;line-height:1.55;color:var(--ink);outline:none}
.rich-content:empty:before{content:attr(data-placeholder);color:var(--muted)}
.rich-content p{margin:0 0 8px}
.rich-content ul,.rich-content ol{margin:0 0 8px;padding-left:22px}
.rich-content a{color:var(--navy);text-decoration:underline}
textarea.rich-source{display:none}

/* ===== Sélection multi-collaborateurs ===== */
.chk-list{display:flex;flex-direction:column;gap:6px;margin-top:7px}
.chk-list label{display:flex;align-items:center;gap:8px;font-weight:500;font-size:14px;color:var(--ink);margin:0}
.chk-list input[type=checkbox]{width:auto;margin:0}
.rich-rendu p{margin:0 0 8px}
.rich-rendu ul,.rich-rendu ol{margin:0 0 8px;padding-left:22px}

/* ===== Design system admin (cards / sections / champs) - charte LEIO ===== */
.admin-page.admin-wide{max-width:1000px}
.page-head{margin-bottom:6px}
.page-head .crumb{margin-bottom:8px}
.page-head h1{margin:0 0 4px;font-size:26px;letter-spacing:-0.02em}
.page-head .sub{font-size:14px;color:var(--muted);margin:0}

.form-sections{display:flex;flex-direction:column;gap:18px;margin-top:20px}
.fcard{background:#fff;border:1px solid var(--border);border-radius:16px;padding:24px 26px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.fcard-head{margin-bottom:18px;display:flex;align-items:baseline;gap:10px}
.fcard-head .num{width:24px;height:24px;border-radius:7px;background:var(--cream);color:var(--navy);font-weight:800;font-size:12px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.fcard-head h3{margin:0;font-size:15.5px;font-weight:800;color:var(--navy);letter-spacing:-0.01em}
.fcard-head p{margin:2px 0 0;font-size:12.5px;color:var(--muted);font-weight:500}

.fgrid{display:grid;gap:18px}
.fgrid.cols-2{grid-template-columns:1fr 1fr}
.field{display:flex;flex-direction:column;gap:7px;min-width:0}
.field > .field-label{font-size:13px;font-weight:700;color:var(--navy);margin:0}
.field .hint{font-size:12.5px;color:var(--muted);margin:-3px 0 1px;font-weight:500}
.field > input,.field > select,.field > textarea{margin:0}
.field .rich-editor{margin:0}

.actions-bar{display:flex;justify-content:flex-end;align-items:center;gap:12px;margin-top:2px}
.actions-bar .muted{margin-right:auto}

@media (max-width:760px){.fgrid.cols-2{grid-template-columns:1fr}}

/* ===== Recherche de ressources (autocomplete) ===== */
.res-search{position:relative}
.res-menu{position:absolute;z-index:20;left:0;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--border-2);border-radius:10px;box-shadow:0 8px 24px rgba(16,24,40,.10);overflow:hidden;max-height:280px;overflow-y:auto}
.res-menu-item{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px 13px;cursor:pointer;font-size:14px;color:var(--navy);font-weight:600}
.res-menu-item:hover{background:var(--cream)}
.res-menu-item .muted{font-weight:500;font-size:12px}
.res-menu-empty{padding:11px 13px;color:var(--muted);font-size:13.5px}

/* ===== Chips (ressources sélectionnées) ===== */
.chips-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.chip{display:inline-flex;align-items:center;gap:8px;background:var(--cream);border:1px solid var(--border);color:var(--navy);font-weight:700;font-size:13px;padding:6px 8px 6px 12px;border-radius:999px}
.chip .muted{font-weight:500}
.chip-x{border:0;background:transparent;color:var(--muted);font-size:16px;line-height:1;cursor:pointer;padding:0 2px}
.chip-x:hover{color:var(--navy)}

/* ===== Étapes (marche à suivre) ===== */
.steps-list{display:flex;flex-direction:column;gap:14px}
.step{border:1px solid var(--border);border-radius:14px;padding:16px;background:#FCFBF8}
.step.dragging{opacity:.55;border-style:dashed;border-color:var(--navy)}
.step-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.step-handle{cursor:grab;color:var(--muted);font-size:16px;user-select:none;padding:0 2px}
.step-handle:active{cursor:grabbing}
.step-num{width:24px;height:24px;border-radius:999px;background:var(--yellow);color:var(--navy);font-weight:800;font-size:13px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.step-titre{flex:1;font-weight:700}
.step-del{flex-shrink:0;background:#fff;color:var(--muted);border:1px solid var(--border-2);font-family:inherit;font-size:12.5px;font-weight:700;padding:7px 11px;border-radius:8px;cursor:pointer}
.step-del:hover{color:#B42318;border-color:#FDA29B}
.step .step-rich{margin-bottom:12px}
.step-res-label{font-size:12px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.add-step{margin-top:14px;background:#fff;border:1px dashed var(--border-2);color:var(--navy);font-family:inherit;font-weight:700;font-size:14px;padding:11px 16px;border-radius:10px;cursor:pointer;width:100%}
.add-step:hover{border-color:var(--navy);background:var(--cream)}

/* ===== Vidéo intégrée (fiche chantier client) ===== */
.cas-video{position:relative;padding-top:56.25%;border-radius:14px;overflow:hidden;background:#000}
.cas-video iframe{position:absolute;inset:0;width:100%;height:100%;border:0}

/* ===== Contenu riche : blocs de code, images, vidéo (éditeur + rendu client) ===== */
.rich-content h3{font-size:17px;font-weight:800;color:var(--navy);margin:12px 0 6px}
.rich-content img,.rich-rendu img{max-width:100%;height:auto;border-radius:10px;margin:8px 0}
.rich-content pre.cb,.rich-rendu pre.cb{background:#0E1D62;color:#fff;border-radius:12px;padding:16px 18px;margin:10px 0;overflow-x:auto}
.rich-content pre.cb code,.rich-rendu pre.cb code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13.5px;line-height:1.6;white-space:pre-wrap;color:rgba(255,255,255,0.92)}
.embed-video{position:relative;padding-top:56.25%;border-radius:12px;overflow:hidden;background:#000;margin:10px 0}
.embed-video iframe{position:absolute;inset:0;width:100%;height:100%;border:0}

/* bloc de code côté client : en-tête + bouton copier */
.codeblock{position:relative;margin:14px 0}
.codeblock .cb-copy{position:absolute;top:10px;right:10px;display:inline-flex;align-items:center;gap:6px;padding:6px 11px;border-radius:8px;border:1px solid rgba(255,255,255,0.22);background:rgba(255,255,255,0.10);color:#fff;font-family:inherit;font-weight:700;font-size:12px;cursor:pointer}
.codeblock .cb-copy:hover{background:rgba(255,255,255,0.18)}
.codeblock pre.cb{margin:0}

/* ===== Listes admin (en-tête de section + lignes) ===== */
.list-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:26px 0 12px}
.list-head h2{margin:0;font-size:16px;font-weight:800;color:var(--navy)}
.list-head .sub{font-size:13px;color:var(--muted);margin:2px 0 0;font-weight:500}
.res-list{margin:0}
.res-item{transition:border-color .12s}
.res-item a{font-weight:700;color:var(--navy);text-decoration:none}
.res-item .btn-mini{font-weight:700}
.empty-note{background:#fff;border:1px dashed var(--border-2);border-radius:12px;padding:18px;color:var(--muted);font-size:13.5px;text-align:center}
