/* SIG-FDSU RDC — Tableau de bord (Phase C). Identité sombre institutionnelle :
   fond #0B1220, cartes #131C2E, bordures #1F2A40, accents #2E6BE6 / #4CAF50 /
   #E63946 / #F5A623. Le thème clair reprend les variables du thème. */

#dh-root {
  --dh-bg: #0B1220;
  --dh-card: #131C2E;
  --dh-border: #1F2A40;
  --dh-blue: #2E6BE6;
  --dh-green: #4CAF50;
  --dh-red: #E63946;
  --dh-orange: #F5A623;
  --dh-text: var(--text, #e2e8f0);
  --dh-muted: var(--text-muted, #94a3b8);
  display: grid;
  gap: 16px;
  min-width: 0;
}
[data-theme="light"] #dh-root {
  --dh-card: var(--surface, #ffffff);
  --dh-border: var(--border, rgba(15, 23, 42, 0.12));
  --dh-bg: var(--bg, #f1f5f9);
}

/* ── Barre de filtres ─────────────────────────────────────────────────── */
.dh-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.dh-subtitle { margin: 0; color: var(--dh-muted); font-size: 0.9rem; max-width: 46ch; }
.dh-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.dh-filter { display: grid; gap: 3px; font-size: 0.7rem; color: var(--dh-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dh-filter select, .dh-search {
  background: var(--dh-card); color: var(--dh-text); border: 1px solid var(--dh-border);
  border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 0.85rem; text-transform: none; letter-spacing: 0; min-width: 150px;
}
.dh-filter select:focus-visible, .dh-search:focus-visible, .dh-card button:focus-visible, .dh-card tr:focus-visible, .dh-filters button:focus-visible {
  outline: 2px solid var(--dh-blue); outline-offset: 2px;
}
.dh-filter--disabled select { opacity: 0.55; cursor: not-allowed; }
.dh-reset { background: transparent; color: var(--dh-text); border: 1px solid var(--dh-border); border-radius: 10px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: 0.85rem; }
.dh-reset:hover { border-color: var(--dh-blue); }
.dh-filter-note { margin: 0; flex-basis: 100%; font-size: 0.8rem; color: var(--dh-orange); }

/* ── KPI principaux (cartes existantes, compactées) ───────────────────── */
#dh-root .dh-kpis.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; }
#dh-root .dh-kpis .summary-card { min-height: 0; padding: 14px 16px; }
#dh-root .dh-kpis .summary-value { font-size: 1.7rem; line-height: 1.1; }
.dh-kpi-tag {
  display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: 0.68rem;
  border: 1px solid var(--dh-border); color: var(--dh-muted);
}
.dh-kpi-tag:not([hidden]) { display: inline-block; }
.dh-kpi-tag.is-filter { color: var(--dh-orange); border-color: rgba(245, 166, 35, 0.5); }

/* ── Grille des rangées ───────────────────────────────────────────────── */
.dh-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); align-items: stretch; }
.dh-card {
  background: var(--dh-card); border: 1px solid var(--dh-border); border-radius: 14px;
  padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 12px;
}
.dh-card.is-simulation { border-color: var(--dh-orange); box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.35); }
.dh-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dh-card h2 { margin: 0; font-size: 1rem; font-weight: 650; }
.dh-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--dh-muted); }
.dh-muted { color: var(--dh-muted); font-size: 0.85rem; margin: 0; }
.dh-foot { margin: 0; font-size: 0.74rem; color: var(--dh-muted); line-height: 1.4; }
.dh-source { margin: 0; font-size: 0.74rem; color: var(--dh-muted); }

/* Bascule Réel / Simulation */
.dh-seg { display: inline-flex; border: 1px solid var(--dh-border); border-radius: 10px; overflow: hidden; }
.dh-seg-btn { background: transparent; color: var(--dh-muted); border: 0; padding: 6px 10px; font: inherit; font-size: 0.74rem; cursor: pointer; }
.dh-seg-btn.is-active { background: var(--dh-blue); color: #fff; }
.dh-seg-btn--sim.is-active { background: var(--dh-orange); color: #0B1220; font-weight: 650; }
.dh-sim-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-radius: 10px;
  background: repeating-linear-gradient(135deg, rgba(245, 166, 35, 0.22) 0 10px, rgba(245, 166, 35, 0.12) 10px 20px);
  border: 1px solid var(--dh-orange); color: #fde7bd; font-size: 0.78rem;
}
.dh-sim-banner strong { color: var(--dh-orange); letter-spacing: 0.03em; }
.dh-sim-banner span { flex: 1 1 220px; }
.dh-sim-exit { background: var(--dh-orange); color: #0B1220; border: 0; border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 0.76rem; font-weight: 650; cursor: pointer; }

/* Graphiques */
.dh-chart-wrap { min-height: 200px; }
.dh-line { width: 100%; height: auto; display: block; }
.dh-grid { stroke: rgba(148, 163, 184, 0.16); stroke-width: 1; }
.dh-axis { fill: var(--dh-muted); font-size: 10px; }
.dh-area { fill: rgba(46, 107, 230, 0.14); }
.dh-line-planned { fill: none; stroke: var(--dh-muted); stroke-width: 2; stroke-dasharray: 5 4; }
.dh-line-realized { fill: none; stroke: var(--dh-blue); stroke-width: 2.5; }
.dh-line.is-simulated .dh-line-planned { stroke: #fde7bd; }
.dh-line.is-simulated .dh-line-realized { stroke: var(--dh-orange); stroke-dasharray: 2 3; }
.dh-watermark { fill: rgba(245, 166, 35, 0.16); font-size: 64px; font-weight: 800; letter-spacing: 0.1em; }
.dh-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--dh-muted); }
.dh-legend li { display: flex; align-items: center; gap: 6px; }
.dh-legend--col { flex-direction: column; gap: 10px; flex: 1; }
.dh-legend--col li { color: var(--dh-text); justify-content: flex-start; }
.dh-legend--col b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dh-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dh-key--planned { background: var(--dh-muted); }
.dh-key--realized { background: var(--dh-blue); }
.dh-key--sim { background: var(--dh-orange); }

/* État « historique en cours de constitution » */
.dh-initial { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; padding: 14px; border: 1px dashed var(--dh-border); border-radius: 12px; }
.dh-initial-title { margin: 0 0 4px; font-weight: 650; font-size: 0.95rem; }
.dh-meta { margin: 12px 0 0; display: grid; gap: 8px; }
.dh-meta div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px; font-size: 0.8rem; }
.dh-meta dt { color: var(--dh-muted); }
.dh-meta dd { margin: 0; }
.dh-meta dd span { color: var(--dh-muted); }
.dh-feeds-title { margin: 0 0 8px; font-size: 0.78rem; color: var(--dh-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dh-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.dh-chips li { border: 1px solid var(--dh-border); border-radius: 999px; padding: 3px 10px; font-size: 0.74rem; color: var(--dh-muted); }

/* Donut */
.dh-donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dh-donut { width: 150px; height: 150px; flex: 0 0 auto; }
.dh-donut-value { fill: var(--dh-text); font-size: 24px; font-weight: 700; }
.dh-donut-label { fill: var(--dh-muted); font-size: 8.5px; }

/* À traiter */
.dh-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dh-todo-row {
  width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 14px; align-items: center; gap: 10px;
  text-align: left; background: transparent; color: var(--dh-text); border: 1px solid var(--dh-border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; font: inherit;
}
.dh-todo-row:hover { border-color: var(--dh-blue); background: rgba(46, 107, 230, 0.08); }
.dh-todo-text { display: grid; gap: 2px; min-width: 0; }
.dh-todo-text strong { font-size: 0.86rem; font-weight: 600; }
.dh-todo-text small { color: var(--dh-muted); font-size: 0.72rem; }
.dh-todo-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.dh-todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dh-muted); }
.dh-todo-row.is-attention .dh-todo-dot { background: var(--dh-red); }
.dh-todo-row.is-info .dh-todo-dot { background: var(--dh-orange); }
.dh-todo-row.is-clear .dh-todo-dot { background: var(--dh-green); }
.dh-todo-row.is-clear .dh-todo-count, .dh-todo-row.is-unavailable .dh-todo-count { color: var(--dh-muted); font-weight: 500; font-size: 0.8rem; }
.dh-chev { color: var(--dh-muted); }
.dh-skel { height: 48px; border-radius: 10px; background: linear-gradient(90deg, rgba(148,163,184,0.08), rgba(148,163,184,0.16), rgba(148,163,184,0.08)); }
.dh-badge { background: var(--dh-red); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 0.78rem; font-weight: 700; }
.dh-clear { margin: 0; color: var(--dh-green); font-size: 0.85rem; }

/* Carte */
.dh-map-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dh-basemap { display: inline-flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--dh-muted); }
.dh-open { margin-left: auto; background: var(--dh-blue); color: #fff; border: 0; border-radius: 10px; padding: 7px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.dh-open:hover { filter: brightness(1.1); }
#dh-map-card .dashboard-national-map { height: 340px; margin: 0; border-radius: 12px; }
.dh-map-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.74rem; color: var(--dh-muted); }
.dh-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dh-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dh-tip { background: #0B1220; color: #e2e8f0; border: 1px solid #1F2A40; border-radius: 8px; font-size: 0.78rem; }

/* Table */
.dh-table-wrap { overflow-x: auto; }
.dh-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.dh-table th, .dh-table td { padding: 7px 10px; border-bottom: 1px solid var(--dh-border); text-align: left; white-space: nowrap; }
.dh-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.dh-table thead th { color: var(--dh-muted); font-weight: 600; font-size: 0.74rem; }
.dh-th { background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.dh-table tbody tr { cursor: pointer; }
.dh-table tbody tr:hover { background: rgba(46, 107, 230, 0.1); }
.dh-table tbody tr.is-selected { background: rgba(46, 107, 230, 0.22); }
.dh-table tbody th { font-weight: 600; }
.dh-table tfoot th, .dh-table tfoot td { border-bottom: 0; font-weight: 700; }
.dh-pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; font-size: 0.78rem; color: var(--dh-muted); }
.dh-pbtn { background: transparent; color: var(--dh-text); border: 1px solid var(--dh-border); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; }
.dh-pbtn:disabled { opacity: 0.4; cursor: default; }

/* Accès rapides */
.dh-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dh-quick button {
  display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; color: var(--dh-text);
  border: 1px solid var(--dh-border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; font-size: 0.84rem;
}
.dh-quick button:hover { border-color: var(--dh-blue); background: rgba(46, 107, 230, 0.08); }
.dh-quick svg { flex: 0 0 auto; color: var(--dh-blue); }
.dh-quick small { display: block; color: var(--dh-muted); font-size: 0.7rem; }

/* Titre de la section sectorielle conservée */
.dh-section-title { margin: 8px 0 -4px; font-size: 0.8rem; color: var(--dh-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dh-row { grid-template-columns: minmax(0, 1fr); }
  .dh-initial { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #dh-root .dh-kpis .summary-card { padding: 10px 12px; }
  .dh-filters { width: 100%; }
  .dh-filter { flex: 1 1 140px; }
  .dh-filter select { min-width: 0; width: 100%; }
  .dh-quick { grid-template-columns: minmax(0, 1fr); }
  .dh-meta div { grid-template-columns: minmax(0, 1fr); }
  #dh-map-card .dashboard-national-map { height: 260px; }
}

.dh-kpi-tag[hidden] { display: none !important; }

/* Légende injectée par la couche UX générique : remplacée par la légende du Dashboard. */
#dashboard-national-map .ux-map-legend { display: none; }
#ux-legend-dashboard-national { display: none !important; }

.dh-link { align-self: flex-start; background: transparent; border: 0; color: var(--dh-blue); font: inherit; font-size: 0.82rem; cursor: pointer; padding: 0; margin-top: auto; }
.dh-link:hover { text-decoration: underline; }

/* Tableau « Situation par province » : colonnes Avancement / Tendance (prêtes pour l'historique) */
.dh-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dh-table th, .dh-table td { padding: 7px 8px; }
.dh-na { color: var(--dh-muted); cursor: help; }
.dh-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--dh-border); color: var(--dh-muted); font-size: 0.7rem; cursor: help; }
.dh-trend { font-size: 0.78rem; font-weight: 600; }
.dh-trend.is-up { color: var(--dh-green); }
.dh-trend.is-down { color: var(--dh-red); }
.dh-trend.is-flat { color: var(--dh-muted); }
.dh-sim-val { color: var(--dh-orange) !important; font-style: italic; }
.dh-card.is-simulation .dh-table tbody td:nth-last-child(-n+2) { background: repeating-linear-gradient(135deg, rgba(245, 166, 35, 0.10) 0 8px, transparent 8px 16px); }

/* Appel à l'action vers l'Observatoire (fin naturelle du Dashboard) */
.dh-cta { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.dh-cta h2 { margin: 0; font-size: 0.98rem; }
.dh-cta p { margin: 2px 0 0; font-size: 0.8rem; color: var(--dh-muted); max-width: 70ch; }

/* ═══════════════════════════════════════════════════════════════════════════
   PASSE UX FINALE — compacité, alignements, respiration (CSS/layout uniquement).
   Aucune police ni bibliothèque supplémentaire. Feuille chargée en dernier : les
   règles ci-dessous l'emportent à spécificité égale sur les feuilles du shell.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header global compact (≈ −25 %) ───────────────────────────────────── */
.app-shell .main-content { padding: 10px 20px 14px; gap: 10px; }
.app-shell .topbar { padding: 4px 12px; border-radius: 14px; gap: 12px; min-height: 0; }
.app-shell .topbar-actions { flex: 1 1 auto; min-width: 0; justify-content: flex-end; gap: 10px; }
.app-shell .global-search-field, .app-shell .topbar .search-field { flex: 1 1 340px; width: auto; max-width: 640px; min-width: 200px; }
.app-shell .topbar .search-field input { padding: 6px 14px 6px 38px; border-radius: 12px; font-size: 0.88rem; }
.app-shell .topbar #command-center-trigger { padding-top: 4px; padding-bottom: 4px; }
.app-shell .topbar .profile-card { padding: 3px 10px; gap: 10px; }
.app-shell .topbar .profile-avatar { width: 30px; height: 30px; font-size: 0.75rem; }
.app-shell .topbar .notification-button, .app-shell .topbar .sidebar-toggle-btn { width: 34px; height: 34px; }

/* Version : information secondaire, très discrète */
.app-shell .topbar-pill { padding: 1px 8px; font-size: 0.66rem; font-weight: 500; background: transparent; border: 1px solid rgba(148, 163, 184, 0.28); color: #94a3b8; border-radius: 999px; }

/* Sur le Dashboard le titre vit dans le contenu : le header ne garde que les contrôles
   (le <h1> du header reste dans le DOM, masqué visuellement, pour l'accessibilité). */
body[data-active-module="dashboard"] .topbar-left {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ── Sidebar compacte (248 px) ─────────────────────────────────────────── */
.app-shell:not([data-sidebar-mode="compact"]) .sidebar { padding: 10px 10px; }
.app-shell .brand { gap: 10px; margin-bottom: 10px; }
.app-shell:not([data-sidebar-mode="compact"]) .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.app-shell:not([data-sidebar-mode="compact"]) .brand-mark svg { width: 30px; height: 30px; }
.app-shell .brand-title { font-size: 0.95rem; }
.app-shell .nav-item { padding: 5px 9px; gap: 9px; border-radius: 9px; }
.app-shell .nav-icon { width: 26px; height: 26px; border-radius: 8px; }
.app-shell .nav-group-toggle { padding: 5px 8px; }
.app-shell .nav-menu, .app-shell .nav-group { gap: 4px; }

/* ── Titre de page + filtres : une ligne compacte ───────────────────────── */
.dh-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin: 0; }
.dh-heading { display: grid; gap: 1px; min-width: 0; }
.dh-title { margin: 0; font-size: 1.55rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.dh-subtitle { margin: 0; font-size: 0.8rem; max-width: none; }
.dh-filters { gap: 8px; align-items: center; flex-wrap: wrap; }
.dh-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; text-transform: none; letter-spacing: 0; color: var(--dh-muted); }
.dh-filter select { min-width: 0; padding: 5px 8px; border-radius: 9px; font-size: 0.8rem; height: 32px; }
.dh-filter--disabled select { opacity: 0.5; }
.dh-reset { padding: 5px 10px; height: 32px; border-radius: 9px; font-size: 0.8rem; }
.dh-reset-label { display: none; }
.dh-filter-note { flex-basis: 100%; font-size: 0.74rem; }

/* ── Rythme vertical ────────────────────────────────────────────────────── */
#dh-root { gap: 10px; }
.dh-row { gap: 10px; }
.dh-card { padding: 12px 14px; gap: 10px; border-radius: 12px; }
.dh-card h2 { font-size: 0.95rem; }
.dh-sub { font-size: 0.74rem; }
.dh-card-head { gap: 8px; }
.dh-seg-btn { padding: 4px 9px; font-size: 0.72rem; }

/* ── KPI compacts (5 sur une ligne dès ≈ 1180 px) ──────────────────────── */
#dh-root .dh-kpis.summary-grid { gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
#dh-root .dh-kpis .summary-card { padding: 8px 12px; gap: 10px; min-height: 0; border-radius: 12px; }
#dh-root .dh-kpis .dashboard-icon { width: 30px; height: 30px; border-radius: 9px; }
#dh-root .dh-kpis .dashboard-metric { gap: 0; }
#dh-root .dh-kpis .summary-label { font-size: 0.66rem; margin: 0; letter-spacing: 0.06em; line-height: 1.2; }
#dh-root .dh-kpis .summary-value { font-size: 1.45rem; margin: 0; line-height: 1.1; }
#dh-root .dh-kpis .dashboard-metric-note { font-size: 0.66rem; margin: 2px 0 0; padding: 1px 7px; opacity: 0.9; }
.dh-kpi-tag { margin-top: 2px; font-size: 0.62rem; padding: 0 7px; }

/* ── Évolution + À traiter ──────────────────────────────────────────────── */
.dh-initial { padding: 10px 12px; gap: 14px; }
.dh-meta { margin-top: 8px; gap: 5px; }
.dh-meta div { font-size: 0.76rem; grid-template-columns: 130px minmax(0, 1fr); }
.dh-initial-title { font-size: 0.9rem; }
.dh-todo { gap: 6px; }
.dh-todo-row { padding: 7px 10px; gap: 8px; border-radius: 9px; }
.dh-todo-text strong { font-size: 0.82rem; }
.dh-todo-text small { font-size: 0.68rem; }
.dh-badge { font-size: 0.72rem; padding: 0 8px; }

/* ── Carte + Portefeuille : même ligne fonctionnelle ───────────────────── */
#dh-map-card .dashboard-national-map { height: 300px; }
#dh-portfolio .dh-donut-row { flex: 1; align-content: center; justify-content: center; gap: 24px; }
#dh-portfolio .dh-donut { width: 140px; height: 140px; }
#dh-portfolio .dh-legend--col { flex: 0 1 220px; }
.dh-map-legend { font-size: 0.7rem; }

/* ── Situation par province : tableau exécutif ──────────────────────────── */
.dh-row--tail { align-items: start; }
.dh-table { font-size: 0.8rem; }
.dh-table th, .dh-table td { padding: 5px 8px; }
.dh-table thead th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--dh-border); padding-top: 3px; }
.dh-table tbody tr:nth-child(even) { background: rgba(148, 163, 184, 0.035); }
.dh-table tbody tr:hover { background: rgba(46, 107, 230, 0.12); }
.dh-table tbody th { font-weight: 600; }
.dh-table .is-num { font-variant-numeric: tabular-nums; }
.dh-table tfoot th, .dh-table tfoot td { border-top: 1px solid var(--dh-border); }
.dh-pager { gap: 8px; font-size: 0.74rem; }
.dh-pbtn { padding: 3px 10px; border-radius: 8px; }
.dh-search { padding: 5px 10px; font-size: 0.78rem; min-width: 160px; height: 30px; }
.dh-pill { font-size: 0.66rem; padding: 0 7px; }

/* ── Accès rapides : secondaires ────────────────────────────────────────── */
.dh-quick { gap: 6px; }
.dh-quick button { padding: 6px 9px; gap: 8px; font-size: 0.78rem; border-radius: 9px; }
.dh-quick small { font-size: 0.64rem; }
.dh-quick svg { width: 16px; height: 16px; }

/* ── Accès Observatoire : compact, fin du Dashboard ────────────────────── */
.dh-cta { padding: 10px 14px; }
.dh-cta h2 { font-size: 0.92rem; }
.dh-cta p { font-size: 0.76rem; }
.dh-cta .dh-open { padding: 6px 12px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dh-row--tail { align-items: stretch; }
}
@media (max-width: 760px) {
  .dh-toolbar { align-items: flex-start; }
  .dh-reset-label { display: inline; }
  .dh-filters { width: 100%; }
  .dh-filter { flex: 1 1 140px; }
  .dh-filter select { flex: 1; min-width: 0; }
  .dh-title { font-size: 1.3rem; }
}
@media (max-width: 640px) {
  #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #dh-root .dh-kpis .summary-value { font-size: 1.3rem; }
  #dh-map-card .dashboard-national-map { height: 240px; }
  .dh-head-tools { width: 100%; }
}

/* Ajustements après revue : barre de recherche alignée à gauche (le titre vit dans le contenu),
   états initiaux qui remplissent leur carte. */
.app-shell .topbar-actions { justify-content: flex-start; }
.app-shell .global-search-field, .app-shell .topbar .search-field { flex: 1 1 340px; max-width: 760px; margin-right: auto; }
body:not([data-active-module="dashboard"]) .app-shell .topbar-actions, body:not([data-active-module="dashboard"]) .topbar-actions { justify-content: flex-end; }
#dh-evolution .dh-initial { flex: 1; align-content: start; }

/* Mobile : KPI en 2 colonnes compactes (la règle générique les passait pleine largeur dès qu'une note existe). */
@media (max-width: 640px) {
  #dh-root .dh-kpis .dashboard-card { grid-column: auto !important; padding: 8px 10px; }
  #dh-root .dh-kpis .dashboard-icon { display: none; }
  #dh-root .dh-kpis .dashboard-metric-note { white-space: normal; line-height: 1.25; }
}

/* Fond Routes / Satellite : fond neutre du conteneur pendant le chargement progressif des tuiles
   (sans lui, les cases non chargées laissent voir le fond sombre et apparaissent comme des rectangles).
   Le fond Institutionnel garde #0B1220. */
#dashboard-national-map.dh-bm-routes.leaflet-container { background: #e9e5dc; }
#dashboard-national-map.dh-bm-satellite.leaflet-container { background: #1b2733; }

/* Autres modules (header global partagé) : titre sur une ligne quand c'est possible, recherche jamais écrasée.
   Correction de régression du shell compact (CCN : titre sur 2 lignes → header de 90 px, placeholder tronqué). */
body:not([data-active-module="dashboard"]) .app-shell .page-title { font-size: clamp(1.2rem, 1.45vw, 1.6rem); line-height: 1.15; }
body:not([data-active-module="dashboard"]) .app-shell .page-context { font-size: 0.64rem; margin-bottom: 1px; }
.app-shell .topbar-left { flex: 0 1 auto; min-width: 0; }
.app-shell .global-search-field, .app-shell .topbar .search-field { min-width: 260px; }

/* ── Passe UX (validation visuelle Phase 5) ────────────────────────────────────────────────────────── */
/* KPI de premier niveau : 6 cartes plus compactes (Sites, Localités, CCN, Missions, Population couverte, Programmes actifs). */
#dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
#dh-root .dh-kpis .summary-card { padding: 6px 10px; gap: 8px; }
#dh-root .dh-kpis .dashboard-icon { width: 26px; height: 26px; border-radius: 8px; }
#dh-root .dh-kpis .summary-label { font-size: 0.62rem; }
#dh-root .dh-kpis .summary-value { font-size: 1.3rem; }
#dh-root .dh-kpis .dashboard-metric-note { font-size: 0.62rem; margin-top: 1px; padding: 0 6px; }
#dh-root .dh-kpis .summary-card.is-focus { box-shadow: 0 0 0 1px var(--dh-blue); }
@media (max-width: 1280px) { #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Comptes enregistrés : hors des KPI de premier niveau (le détail vit dans Administration › Activité & Usage). */
.dh-admin-tile { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--dh-border); }
.dh-admin-tile .summary-card { padding: 6px 10px; gap: 8px; min-height: 0; opacity: 0.9; }
.dh-admin-tile .dashboard-icon { width: 24px; height: 24px; border-radius: 7px; }
.dh-admin-tile .summary-label { font-size: 0.62rem; margin: 0; }
.dh-admin-tile .summary-value { font-size: 1.05rem; margin: 0; line-height: 1.1; }
.dh-admin-tile .dashboard-metric-note { font-size: 0.62rem; margin: 1px 0 0; padding: 0 6px; }

/* Évolution des déploiements : bloc compact tant que l'historique est en constitution. */
.dh-row:has(#dh-evolution) { align-items: start; }
#dh-evolution { gap: 6px; }
#dh-evolution .dh-initial--compact { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px 10px; }
#dh-evolution .dh-initial--compact .dh-initial-title { margin: 0; font-size: 0.82rem; }
#dh-evolution .dh-initial--compact .dh-initial-title .dh-muted { font-weight: 400; font-size: 0.72rem; }
.dh-meta--inline { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.dh-meta--inline div { display: flex; gap: 6px; grid-template-columns: none; font-size: 0.74rem; }
#dh-evolution .dh-initial-feeds { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
#dh-evolution .dh-initial-feeds .dh-feeds-title { margin: 0; font-size: 0.68rem; }
#dh-evolution .dh-chips li { padding: 1px 8px; font-size: 0.68rem; }

/* À traiter : poids visuel réduit (la hiérarchie reste KPI → synthèse → analyses → actions). */
#dh-attention .dh-todo { gap: 4px; }
#dh-attention .dh-todo-row { padding: 5px 9px; border-radius: 8px; }
#dh-attention .dh-todo-text strong { font-size: 0.78rem; }
#dh-attention .dh-todo-text small { font-size: 0.64rem; }
#dh-attention .dh-foot { font-size: 0.64rem; margin: 4px 0 0; }
#dh-attention .dh-sub { font-size: 0.7rem; }

/* Deux colonnes indépendantes : Évolution + Carte | À traiter + Portefeuille (aucun vide sous un bloc compact). */
.dh-row--cols { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); gap: 10px; align-items: start; }
.dh-col { display: grid; gap: 10px; min-width: 0; align-content: start; }
@media (max-width: 1180px) { .dh-row--cols { grid-template-columns: minmax(0, 1fr); } }
#dh-root .dh-kpis .summary-label { letter-spacing: 0.03em; }

/* Programmes actifs : aucune page Programmes dédiée → carte volontairement non cliquable (jamais une fausse destination). */
#dh-root .dh-kpis .summary-card.dh-kpi--static { cursor: default; }
#dh-root .dh-kpis .summary-card.dh-kpi--static:hover { transform: none; }

/* ── 6 KPI sur une seule ligne en écran large (≥ 1281 px) : cartes compactes, libellés et sous-textes sur une ligne ── */
#dh-root .dh-kpis.summary-grid { gap: 6px; }
#dh-root .dh-kpis .summary-card { padding: 5px 8px; gap: 6px; min-width: 0; }
#dh-root .dh-kpis .dashboard-icon { width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto; }
#dh-root .dh-kpis .dashboard-icon svg { width: 13px; height: 13px; }
#dh-root .dh-kpis .dashboard-metric { min-width: 0; }
#dh-root .dh-kpis .summary-label { font-size: 0.6rem; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dh-root .dh-kpis .summary-value { font-size: 1.3rem; font-weight: 700; }
#dh-root .dh-kpis .dashboard-metric-note { font-size: 0.6rem; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; opacity: 0.8; }
#dh-root .dh-kpis .dh-kpi-tag { font-size: 0.58rem; padding: 0 5px; }
@media (max-width: 1280px) { #dh-root .dh-kpis .summary-label, #dh-root .dh-kpis .dashboard-metric-note { white-space: normal; overflow: visible; } }

/* ── 6 KPI sur UNE ligne : règles pilotées par la largeur RÉELLE du conteneur du Dashboard (et non du viewport) ───────────── */
#dh-root { container-type: inline-size; container-name: dhk; }
.dh-kpis .ks { display: none; }
@container dhk (min-width: 860px) {
  #dh-root .dh-kpis.summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  #dh-root .dh-kpis .summary-card { padding: 5px 8px; gap: 6px; min-width: 0; }
  #dh-root .dh-kpis .summary-label, #dh-root .dh-kpis .dashboard-metric-note { white-space: nowrap; overflow: hidden; text-overflow: clip; }
  #dh-root .dh-kpis .summary-label { font-size: 0.6rem; letter-spacing: 0; }
  #dh-root .dh-kpis .ks { display: inline; }
  #dh-root .dh-kpis .kl { display: none; }
}
@container dhk (min-width: 1200px) {
  #dh-root .dh-kpis .ks { display: none; }
  #dh-root .dh-kpis .kl { display: inline; }
}
@container dhk (min-width: 860px) and (max-width: 1439px) {
  #dh-root .dh-kpis .dashboard-icon { display: none; }
}
@container dhk (min-width: 1440px) {
  #dh-root .dh-kpis .summary-label { letter-spacing: 0.02em; }
}
