/* ═══════════════════════════════════════════════════════════════════════
   Infra QMS — mdcg-module.css
   Styles pour les vues Documents & Normes et Destinataires du module PR-7M
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Shell dashboard ──────────────────────────────────────────────────── */
.mdcg-dash-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6366f1;
  padding: 4px 0 2px;
  border-bottom: 1.5px solid #e0e7ff;
  margin-bottom: -4px;
}

.mdcg-dash-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 24px 28px 32px;
  gap: 20px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

.mdcg-dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .mdcg-dash-row { grid-template-columns: 1fr; }
}

.mdcg-dash-panel {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 22px;
}

.mdcg-dash-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e1b4b;
  margin-bottom: 14px;
}
.mdcg-dash-panel-hint {
  font-weight: 400;
  font-size: 11px;
  color: #9ca3af;
}

.mdcg-dash-voir-tout {
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  opacity: .75;
  transition: opacity .15s;
}
.mdcg-dash-voir-tout:hover { opacity: 1; text-decoration: underline; }

/* ── Graphique horizontal ────────────────────────────────────────────── */
.mdcg-chart-wrap { display: flex; flex-direction: column; gap: 9px; }

.mdcg-chart-row { display: flex; align-items: center; gap: 12px; }

.mdcg-chart-month {
  width: 50px;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-align: right;
  flex-shrink: 0;
}

.mdcg-chart-track {
  flex: 1;
  height: 26px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: visible;
  position: relative;
}

.mdcg-chart-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #a5b4fc, #6366f1);
  transition: width .6s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 9px;
  min-width: 24px;
}
.mdcg-chart-zero .mdcg-chart-fill { background: #f3f4f6; min-width: 0; }

.mdcg-chart-val {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.mdcg-chart-val-out {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.mdcg-chart-zero-lbl {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #d1d5db;
}

/* ── Sections pills ──────────────────────────────────────────────────── */
.mdcg-sect-pills { display: flex; flex-wrap: wrap; gap: 7px; }

.mdcg-sect-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: #f5f3ff;
  border: 1px solid #c7d2fe;
  font-size: 12px;
  font-weight: 500;
  color: #3730a3;
  cursor: pointer;
  transition: all .15s;
  line-height: 1;
}
.mdcg-sect-pill:hover { background: #ede9fe; border-color: #818cf8; color: #4338ca; }

.mdcg-sect-count {
  background: #fff;
  border: 1px solid #e0e7ff;
  color: #6366f1;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  line-height: 1.4;
}

/* ── Liste doc items (dashboard) ─────────────────────────────────────── */
.mdcg-doc-list { display: flex; flex-direction: column; }

.mdcg-doc-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 6px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s;
}
.mdcg-doc-item:last-child { border-bottom: none; }
.mdcg-doc-item:hover { background: #fafafe; }

.mdcg-doc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: #6366f1;
  box-shadow: 0 0 0 3px #e0e7ff;
}
.mdcg-doc-dot-old { background: #d1d5db; box-shadow: none; }

.mdcg-doc-content { flex: 1; min-width: 0; }

.mdcg-doc-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #1e1b4b;
  line-height: 1.4;
  margin-bottom: 5px;
}

.mdcg-doc-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mdcg-doc-pub-sm { font-size: 11.5px; color: #9ca3af; }

.mdcg-doc-item-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mdcg-doc-item-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: #4338ca;
  text-decoration: none;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(99,102,241,.08);
  transition: background .15s;
}
.mdcg-doc-item-links a:hover { background: rgba(99,102,241,.15); }
.mdcg-doc-item-links svg { fill: none; stroke: #4338ca; stroke-width: 2; width: 13px; height: 13px; flex-shrink: 0; }

.mdcg-empty-small {
  color: #9ca3af;
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

/* ── Shell commun ─────────────────────────────────────────────────────── */
.mdcg-docs-shell,
.mdcg-recip-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 24px 28px 32px;
  gap: 20px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* ── En-tête commun ───────────────────────────────────────────────────── */
.mdcg-docs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mdcg-docs-title {
  font-size: 20px;
  font-weight: 800;
  color: #1e1b4b;
  margin: 0;
  line-height: 1.3;
}

.mdcg-docs-sub {
  font-size: 13px;
  color: #6b7280;
  margin: 4px 0 0;
}

.mdcg-docs-src-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid #c7d2fe;
  border-radius: 8px;
  background: #f5f3ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.mdcg-docs-src-link:hover {
  background: #ede9fe;
  border-color: #818cf8;
}

/* ── Barre de recherche + filtres ────────────────────────────────────── */
.mdcg-docs-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mdcg-docs-search-wrap {
  position: relative;
}

.mdcg-docs-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px 9px 34px;
  border: 1.5px solid #e5e7eb;
  border-radius: 9px;
  font-size: 13px;
  color: #111827;
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mdcg-docs-search:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ── Pills de section ─────────────────────────────────────────────────── */
.mdcg-section-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mdcg-section-pill {
  padding: 4px 11px;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.mdcg-section-pill:hover { background: #f3f4f6; border-color: #d1d5db; }
.mdcg-section-pill.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  font-weight: 700;
}

/* ── Liste de documents ───────────────────────────────────────────────── */
.mdcg-docs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mdcg-doc-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mdcg-doc-card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 2px 12px rgba(99,102,241,.09);
}

.mdcg-doc-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mdcg-doc-ref-badge {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--mono, monospace);
  white-space: nowrap;
}

.mdcg-doc-section-tag {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mdcg-doc-date {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

.mdcg-doc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  line-height: 1.45;
}

.mdcg-doc-pub {
  font-size: 12px;
  color: #6b7280;
}

.mdcg-doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.mdcg-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: #f5f3ff;
  border: 1px solid #c7d2fe;
  border-radius: 5px;
  color: #4338ca;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.mdcg-doc-link:hover { background: #ede9fe; }

/* ── Footer / load-more ───────────────────────────────────────────────── */
.mdcg-docs-footer {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.mdcg-btn-load-more {
  padding: 9px 28px;
  border: 1.5px solid #c7d2fe;
  border-radius: 8px;
  background: #f5f3ff;
  color: #4338ca;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.mdcg-btn-load-more:hover { background: #ede9fe; border-color: #818cf8; }

/* ── États de chargement / erreur / vide ─────────────────────────────── */
.mdcg-loading {
  padding: 32px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

.mdcg-error {
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 13px;
}

.mdcg-empty {
  padding: 48px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ── Table Destinataires ──────────────────────────────────────────────── */
.mdcg-recip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.mdcg-recip-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  border-bottom: 1.5px solid #f3f4f6;
  background: #fafafa;
}
.mdcg-recip-table tbody tr:hover td { background: #fafafa; }
.mdcg-recip-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
  vertical-align: middle;
}

.mdcg-email-link { color: #4338ca; text-decoration: none; }
.mdcg-email-link:hover { text-decoration: underline; }

/* ── Toggle switch ────────────────────────────────────────────────────── */
.mdcg-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  vertical-align: middle;
  margin-right: 8px;
}
.mdcg-toggle input { display: none; }
.mdcg-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.mdcg-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.mdcg-toggle input:checked + .mdcg-toggle-slider { background: #22c55e; }
.mdcg-toggle input:checked + .mdcg-toggle-slider::before { transform: translateX(16px); }

.mdcg-recip-status { font-size: 12px; font-weight: 600; }
.mdcg-recip-status.active  { color: #15803d; }
.mdcg-recip-status.inactive { color: #9ca3af; }

/* ── Bouton Ajouter destinataire ─────────────────────────────────────── */
.mdcg-btn-add-recip {
  padding: 8px 16px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.mdcg-btn-add-recip:hover { background: #4338ca; }

/* ── Bouton Supprimer destinataire ───────────────────────────────────── */
.mdcg-btn-del-recip {
  padding: 5px 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.mdcg-btn-del-recip:hover { background: #fee2e2; }
