/* GED du CHEL : feuille de style. Aucune ressource externe (fonctionne sans accès à Internet). */

:root {
  --fond: #F2F5F7;
  --carte: #FFFFFF;
  --encre: #16242E;
  --encre-douce: #4A5B66;
  --trait: #D5DDE2;
  --trait-doux: #E6EBEE;
  --bandeau: #0B3D52;
  --accent: #0B5C7A;
  --accent-fonce: #083F54;
  --alerte: #7A3D00;
  --danger: #8C1D18;
  --rayon: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-fonce); }

h1 { margin: 0; font-size: 28px; font-weight: 600; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
p { margin: 0 0 12px; }

:focus-visible { outline: 3px solid #F2A33A; outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--encre-douce); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.warn { color: var(--alerte); font-weight: 500; }

.ref { font-family: 'IBM Plex Mono', Consolas, 'Courier New', monospace; font-size: 13px; }
.ref-box { display: inline-block; background: var(--carte); border: 1px solid var(--trait); border-radius: 6px; padding: 4px 10px; }

/* ---------- Bandeau ---------- */

.topbar {
  background: var(--bandeau);
  color: #FFFFFF;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #FFFFFF; text-decoration: none; font-weight: 600; font-size: 18px; }
.brand:hover { color: #FFFFFF; }
.brand-logo { height: 40px; width: auto; display: block; }
.search { flex: 1 1 280px; min-width: 0; display: flex; gap: 8px; }
.search input[type="search"] { flex: 1 1 auto; min-width: 0; border-color: #9FC3D1; }
.userbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; }
.userbox form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; min-height: 44px; color: #FFFFFF; font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Structure ---------- */

.shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.shell-bare { justify-content: center; }
.nav {
  flex: 1 1 200px;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--encre); text-decoration: none; }
.nav a:hover { background: #EEF3F5; }
.nav a.active { background: #E3EEF2; color: var(--bandeau); font-weight: 600; }
.nav a.nav-cta { margin-top: 8px; justify-content: center; color: #FFFFFF; }
.nav a.nav-cta:hover { background: var(--accent-fonce); }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.shell-bare .main { flex: 0 1 420px; }

.footer { text-align: center; padding: 16px 24px 24px; font-size: 13px; color: var(--encre-douce); }

/* ---------- Blocs ---------- */

.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-head p { margin: 0; }
.crumbs { font-size: 14px; color: var(--encre-douce); }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.card { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 20px; }
.card > :last-child { margin-bottom: 0; }
.card-accent { border: 2px solid var(--accent); display: flex; flex-direction: column; gap: 12px; }
.card-accent > * { margin: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.stats { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 180px; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; }
.stat-num { font-size: 32px; font-weight: 600; color: var(--bandeau); line-height: 1.2; }
.stat-label { font-weight: 500; }

.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.col-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.admin-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.admin-grid .card { flex: 1 1 320px; min-width: 0; }

.info { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.info dt { font-size: 13px; color: var(--encre-douce); }
.info dd { margin: 0; font-weight: 500; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-fonce); color: #FFFFFF; }
.btn-secondary { background: #FFFFFF; color: var(--encre); border-color: #5F7380; }
.btn-secondary:hover { background: #EEF3F5; color: var(--encre); }
.btn-ghost { background: transparent; color: #FFFFFF; border-color: #FFFFFF; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-danger { background: #FFFFFF; color: var(--danger); border: 2px solid var(--danger); }
.btn-danger:hover { background: #FBEDEC; }
.btn-block { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.actions-end { justify-content: flex-end; }
.rowlink { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; margin-right: 12px; }

/* ---------- Pastilles d'état ---------- */

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge-applicable { background: #DDF0E6; color: #0F5132; }
.badge-brouillon { background: #E6EAED; color: #36454F; }
.badge-verification { background: #DCEAF7; color: #0B3F73; }
.badge-approbation { background: #E6E0F5; color: #3B2A7A; }
.badge-archive { background: #D3D8DC; color: #1F2A33; }
.badge-erreur { background: #FBE6CF; color: var(--alerte); }

/* ---------- Tableaux ---------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; min-width: 640px; border-collapse: collapse; }
table.data th { text-align: left; font-size: 13px; font-weight: 500; color: var(--encre-douce); padding: 8px 12px; border-bottom: 1px solid var(--trait); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--trait-doux); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }

/* ---------- Formulaires ---------- */

label, .label { font-size: 13px; font-weight: 500; color: var(--encre-douce); }

input[type="text"], input[type="search"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #8FA1AC;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  color: var(--encre);
  background: #FFFFFF;
}
textarea { padding: 12px; min-height: 96px; resize: vertical; }
input[type="file"] { width: 100%; min-height: 44px; font: inherit; }
input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.field-check label { font-size: 15px; font-weight: 400; color: var(--encre); }

.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-sections { display: flex; flex-direction: column; gap: 24px; }
.form-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.form-grid .field { flex: 1 1 240px; }
.form-grid .field-full { flex: 1 1 100%; }
.dropbox { border: 1px dashed #8FA1AC; border-radius: 6px; padding: 16px; background: #F7F9FA; }

.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.filters .field { flex: 1 1 160px; }
.filters .field-wide { flex: 2 1 260px; }
.filters .field-check { flex: 0 0 auto; }
.filters-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.row-form { padding: 12px 0; border-top: 1px solid var(--trait-doux); }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form .field { flex: 0 1 200px; }

.checks { border: 0; padding: 0; margin: 16px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.checks legend { font-size: 13px; font-weight: 500; color: var(--encre-douce); padding: 0; margin-bottom: 4px; }

/* ---------- Messages ---------- */

.flash { padding: 12px 16px; border-radius: 6px; font-weight: 500; }
.flash-success { background: #DDF0E6; color: #0F5132; }
.flash-error { background: #FBE6CF; color: var(--alerte); }

/* ---------- Connexion et diagnostic ---------- */

.login-card { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.login-card p { margin: 0; }

.diag { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.diag-detail { display: block; color: var(--encre-douce); overflow-wrap: anywhere; }

@media print {
  .topbar, .nav, .footer, .actions, .filters { display: none; }
  body { background: #FFFFFF; }
}

/* ===================== Version 0.2.0 : circuit de validation et certification ===================== */

[hidden] { display: none !important; }

h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.mono { font-family: 'IBM Plex Mono', Consolas, 'Courier New', monospace; font-size: 13px; }

.badge-diffusion { background: #0B3D52; color: #FFFFFF; }
.badge-niveau-standard { background: #E6EAED; color: #36454F; }
.badge-niveau-imperatif { background: #0B3D52; color: #FFFFFF; }
.badge-niveau-avance { background: #E6E0F5; color: #3B2A7A; }
.badge-couv-couvert { background: #DDF0E6; color: #0F5132; }
.badge-couv-sans { background: #FBE6CF; color: var(--alerte); }
.badge-couv-encours { background: #DCEAF7; color: #0B3F73; }
.badge-couv-na { background: #E6EAED; color: #36454F; }

.flash-info { background: #DCEAF7; color: #0B3F73; font-weight: 400; }
.stat-alerte { color: var(--alerte); }

/* Bloc secondaire à l'intérieur d'une carte */
.subform { border-top: 1px solid var(--trait-doux); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.subform > * { margin: 0; }
details.subform > summary { cursor: pointer; font-weight: 500; min-height: 44px; display: list-item; padding: 10px 0; }

/* Cartouche du circuit */
.circuit { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.circuit-step { flex: 1 1 150px; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--trait); background: #F7F9FA; }
.circuit-label { font-size: 13px; font-weight: 600; color: var(--encre-douce); }
.circuit-qui { font-weight: 500; overflow-wrap: anywhere; }
.circuit-etat { font-size: 13px; color: var(--encre-douce); }
.circuit-fait { border-color: #B7D9C6; background: #F1F9F4; }
.circuit-fait .circuit-label { color: #0F5132; }
.circuit-encours { border: 2px solid var(--accent); background: #FFFFFF; }
.circuit-encours .circuit-label { color: var(--bandeau); }

.echanges { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.echanges li { border-left: 3px solid #8FA1AC; padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 2px; }

/* Critères de certification */
.criteres { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.critere-titre { display: block; font-weight: 500; }

.picker { display: flex; flex-direction: column; gap: 12px; }
.picker-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--trait); border-radius: 6px; padding: 4px 12px 12px; }
.picker-group { position: sticky; top: 0; background: #FFFFFF; font-size: 13px; font-weight: 600; color: var(--bandeau); padding: 10px 0 6px; border-bottom: 1px solid var(--trait-doux); }
.picker-row { align-items: flex-start; padding: 8px 0; min-height: 44px; }
.picker-row input[type="checkbox"] { margin-top: 2px; }

.sum-chapitre { cursor: pointer; font-size: 18px; font-weight: 600; padding: 6px 0; }
.sum-objectif { cursor: pointer; font-weight: 600; padding: 12px 0; }
details.objectif { border-top: 1px solid var(--trait-doux); }

.aide { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.section-titre { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--trait); }
.section-titre input { font-weight: 600; }
.section-objectif { border-top: 1px solid var(--trait); }
.filters .field-num { flex: 0 0 auto; }
.filters .field-niveau { flex: 0 1 150px; }
