/* ══════════════════════════════════════════════════════════════════
   QHSE — qhse.css : thème du module.
   Accent BLEU (distingue le QHSE de la V2, verte) ; le VERT est réservé à l'état « valide » (et « Terminé »).
   Orange = à préparer / bientôt expiré ; rouge = expiré / refusé / début proche.
   Polices : Manrope (texte) + IBM Plex Mono (chiffres, dates), comme la V2.
   Contient aussi les styles des composants de vendor/v2/ui.js (fenêtres, toast, pager, zone de dépôt), stylés par
   shell.css dans la V2.
   ══════════════════════════════════════════════════════════════════ */
:root {
  --accent: #1e5aa8;        /* bleu QHSE */
  --accent-soft: #e8f0fb;   /* fond clair bleu */
  --accent-ink: #163f75;
  --bg: #f5f7fa;
  --side: #f6f8fc;
  --panel: #ffffff;
  --line: #e2e7ef;
  --line-soft: #eef1f6;
  --ink: #1b2533;
  --ink-2: #3d4757;
  --muted: #627084;
  --ok: #15803d;  --ok-soft: #e6f4ea;  --ok-ink: #145a37;     /* « valide » SEULEMENT */
  --warn: #b45309; --warn-soft: #fdf3e2; --warn-ink: #8a4a00;
  --danger: #b42318; --danger-soft: #fdecea; --danger-ink: #9b1c13;
  --info-soft: #e6eefb; --info-ink: #1e4a8f;
  --grey-soft: #f1f2f4;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; }
.mono { font-family: var(--mono); }
.qh-muted { color: var(--muted); }
.qh-red { color: var(--danger); font-weight: 700; }
button { font: inherit; }

/* ───────────── Coquille ───────────── */
.qh-app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.qh-side { display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; background: var(--side); border-right: 1px solid #dfe5ef; }
.qh-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 14px; }
.qh-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.qh-brand-t { display: flex; flex-direction: column; line-height: 1.2; }
.qh-brand-t b { color: var(--accent); font-size: 15px; }
.qh-brand-t small { color: var(--muted); font-size: 11px; }
.qh-nav { display: flex; flex-direction: column; gap: 2px; }
.qh-nav-sec { padding: 12px 10px 4px; font: 600 10.5px/1.2 var(--mono); letter-spacing: .8px; color: var(--muted); }
.qh-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
a.qh-nav-item:hover { background: #edf2fa; }
.qh-nav-item.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.qh-nav-item.is-soon { color: #a3abb8; cursor: default; }
.qh-soon { padding: 1px 7px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); font-size: 11px; font-weight: 600; }
.qh-side-grow { flex: 1; }
.qh-side-note { padding: 10px; border-radius: 10px; background: #eef1f6; font-size: 11.5px; color: var(--muted); }
.qh-side-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 6px 0; font-size: 12px; }
.qh-user { width: 100%; color: var(--ink-2); font-weight: 600; }
.qh-env { font: 500 11.5px/1 var(--mono); padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.qh-env.is-refused { background: var(--danger-soft); color: var(--danger); }
.qh-errs { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 9px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.qh-errs.has-errs { border-color: #f1b8b2; background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.qh-ver { width: 100%; color: var(--muted); font-size: 11px; }
.qh-main { min-width: 0; padding: 22px 30px 40px; }
.qh-main:focus { outline: none; }

/* ───────────── Page ───────────── */
.qh-page { display: flex; flex-direction: column; gap: 14px; }
.qh-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qh-head h1 { font-size: 22px; font-weight: 700; }
.qh-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.qh-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qh-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qh-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.qh-card-h h2 { font-size: 14px; font-weight: 700; }
.qh-card-h span { color: var(--muted); font-size: 12.5px; }
.qh-card-b { padding: 12px 16px; }
.qh-soon-card { padding: 22px; }
.qh-soon-card h2 { font-size: 16px; margin-bottom: 6px; }
.qh-loading { display: flex; align-items: center; gap: 10px; padding: 24px 4px; color: var(--muted); }
.qh-denied { max-width: 620px; margin: 40px auto; padding: 24px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.qh-denied h1 { font-size: 20px; margin-bottom: 6px; }
.qh-denied p { margin: 0; color: var(--ink-2); }
.qh-empty { padding: 18px 16px; color: var(--muted); }
.qh-alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid transparent; font-size: 13px; }
.qh-alert-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: #f5c2bd; }
.qh-alert-warn { background: var(--warn-soft); color: var(--warn-ink); border-color: #efd3a8; }
.qh-alert-info { background: var(--info-soft); color: var(--info-ink); border-color: #c8d8f2; }
.qh-note { font-size: 12px; color: var(--muted); padding: 10px 16px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid #d3d9e3; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: #f6f8fb; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn { background: var(--warn-soft); border-color: #e0b27a; color: var(--warn-ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-link { border: none; background: none; padding: 0; height: auto; color: var(--accent); font-weight: 600; }

/* Pastilles de filtre */
.qh-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qh-pills-label { font-size: 12px; color: var(--muted); }
.qh-pill { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid #d3d9e3; background: #fff; color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.qh-pill.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.qh-pill.is-on.blue { background: var(--accent); border-color: var(--accent); }

/* Badges (états, retours) */
.qh-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-todo { background: #fdf0e1; color: var(--warn-ink); }
.b-progress { background: var(--info-soft); color: var(--info-ink); }
.b-done, .b-ok { background: #e1f2e7; color: var(--ok-ink); }
.b-ko { background: #fde7e4; color: var(--danger); }
.b-wait { background: #eef4fc; color: var(--info-ink); }
.b-none { background: transparent; color: #a3abb8; padding-left: 0; }
.b-oblig { background: var(--grey-soft); color: var(--ink-2); font-weight: 600; font-size: 11px; }

/* Cases de validité */
.v-cell { display: inline-block; max-width: 100%; padding: 4px 7px; border-radius: 6px; font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; background: none; text-align: left; }
button.v-cell { cursor: pointer; }
button.v-cell:hover { border-color: #b9c6dc; }
.v-ok { background: #e9f5ee; color: var(--ok-ink); }
.v-warn { background: #fdf0e1; color: var(--warn-ink); }
.v-ko { background: #fde7e4; color: var(--danger); }
.v-missing { background: #f1f2f4; color: #7c8594; }
.v-na { color: #b8bfca; font-weight: 500; }
.v-pp { margin-left: 4px; font-size: 10px; opacity: .8; }

/* Tableaux */
.qh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qh-table th { text-align: left; padding: 9px 12px; font: 600 10.5px/1.3 var(--mono); color: var(--muted); letter-spacing: .3px; text-transform: uppercase; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; }
.qh-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.qh-table tr:last-child td { border-bottom: none; }
.qh-table .sub { display: block; font-size: 12px; color: var(--muted); }
.qh-table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.qh-scroll { overflow-x: auto; }
.qh-matrix th { white-space: normal; min-width: 92px; }
.qh-matrix td:first-child, .qh-matrix th:first-child { position: sticky; left: 0; background: #fff; min-width: 170px; }
.qh-matrix th:first-child { background: #fbfcfe; }
.qh-pager { display: flex; justify-content: flex-end; padding: 8px 12px; }

/* Tableau de bord */
.qh-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; flex-wrap: wrap; }
.qh-banner.is-ok { background: #e9f5ee; border-color: #b7d9c4; color: var(--ok-ink); }
.qh-banner.is-todo { background: #fdf6ec; border-color: #efd3a8; color: var(--warn-ink); }
.qh-banner .ic { font-size: 16px; font-weight: 700; }
.qh-banner .grow { flex: 1; }
.qh-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.qh-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; color: inherit; text-decoration: none; }
a.qh-kpi:hover { border-color: #b9c6dc; }
.qh-kpi .lbl { font-size: 13px; color: var(--muted); }
.qh-kpi .val { font-size: 26px; font-weight: 700; font-family: var(--mono); }
.qh-kpi .val.is-alert { color: var(--warn-ink); }
.qh-kpi .sub { font-size: 12px; color: var(--muted); }
.qh-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.qh-action { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 14px; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; }
.qh-action:hover { background: #f8fafd; }
.qh-action .dot { width: 8px; height: 8px; border-radius: 999px; }
.qh-action.p-red .dot { background: var(--danger); }
.qh-action.p-orange .dot { background: #e08a1e; }
.qh-action .t { display: flex; flex-direction: column; }
.qh-action .t b { font-size: 13.5px; }
.qh-action .t span { font-size: 12px; color: var(--muted); }
.qh-action .when { font-size: 12px; font-weight: 600; text-align: right; }
.qh-action.p-red .when { color: var(--danger); }
.qh-action.p-orange .when { color: var(--warn-ink); }
.qh-action .chev { color: #b7bfcc; }
.qh-upc { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.qh-upc .d { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 8px; background: #f2f4f8; }
.qh-upc .d b { font-size: 16px; font-family: var(--mono); }
.qh-upc .d span { font-size: 10.5px; color: var(--muted); }

/* Recherche de projet, fenêtres de dépôt */
.qh-search-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.qh-search-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; cursor: pointer; }
.qh-search-item:hover { border-color: var(--accent); }
.qh-search-item[disabled] { cursor: default; opacity: .6; }
.qh-search-item .sub { display: block; font-size: 12px; color: var(--muted); }
.qh-dep { display: flex; flex-direction: column; gap: 12px; }
.qh-dep-cur { padding: 10px 12px; border-radius: 8px; background: #f6f8fb; font-size: 13px; }
.qh-dep-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.qh-rgpd { font-size: 12px; color: var(--muted); }
.qh-errpanel ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.qh-errpanel p { margin: 0; color: var(--muted); }

/* ───────────── Composants de vendor/v2/ui.js ───────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.input { height: 36px; padding: 0 10px; border: 1px solid #d3d9e3; border-radius: 8px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.input:focus { outline: 2px solid #bcd0ee; border-color: var(--accent); }
.qh-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(15, 23, 42, .38); overflow-y: auto; }
.overlay.open { display: flex; }
.overlay.qd-stacked { z-index: 60; }
.modal { width: 100%; max-width: 560px; background: #fff; border-radius: 14px; box-shadow: 0 18px 44px rgba(15, 23, 42, .22); }
.modal-h { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 6px; }
.modal-h h3 { font-size: 17px; }
.modal-h p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.mh-ic, .cf-ic { flex: none; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.mh-ic svg, .cf-ic svg { width: 17px; height: 17px; }
.cf-ic.danger { background: var(--danger-soft); color: var(--danger); }
.modal-b { padding: 12px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.cf-head { display: flex; gap: 12px; align-items: flex-start; }
.cf-head h3 { font-size: 16px; }
.cf-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; display: flex; align-items: center; gap: 8px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: #1b2533; color: #fff; font-size: 13px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 16px; height: 16px; flex: none; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 30px; height: 30px; border: 1px solid #d3d9e3; border-radius: 7px; background: #fff; font-size: 12.5px; cursor: pointer; }
.pager button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager button[disabled] { opacity: .45; cursor: default; }
.pager svg { width: 14px; height: 14px; vertical-align: middle; }
.pager .dots { padding: 0 4px; color: var(--muted); }
.qd-dropzone { position: relative; padding: 18px 14px; border: 1.5px dashed #c3ccd9; border-radius: 10px; background: #fbfcfe; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.qd-dropzone.over { border-color: var(--ok); background: #f1f9f4; }
.qd-dropzone[data-drop="nofile"] { border-color: #e0a04a; background: #fdf8ef; }
.qd-dropzone.is-busy { cursor: progress; }
.qd-drop-msg-on { color: var(--warn-ink); }
.qd-drop-note { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.qd-drop-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; background: rgba(255, 255, 255, .86); border-radius: 10px; }
.qd-drop-busy[hidden] { display: none; }
.qd-spin { display: inline-block; width: 16px; height: 16px; border: 2px solid #c3d3ea; border-top-color: var(--accent); border-radius: 50%; animation: qh-spin .8s linear infinite; }
@keyframes qh-spin { to { transform: rotate(360deg); } }

/* ───────────── Petits écrans ───────────── */
@media (max-width: 900px) {
  .qh-app { grid-template-columns: 1fr; }
  .qh-side { border-right: none; border-bottom: 1px solid #dfe5ef; }
  .qh-nav { flex-direction: row; flex-wrap: wrap; }
  .qh-side-grow { display: none; }
  .qh-main { padding: 16px; }
  .qh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qh-two { grid-template-columns: 1fr; }
}
