/* Tableau de bord Solaryo territoire (solaryo_tableau.php ; s'appuie sur articles-page.css et home.css) */
.tb-body { background: var(--paper, #faf8f4); }
.tb { --dark: #1d2230; --orange: #e8590c; max-width: 1360px; margin: 0 auto; padding: 28px 24px 60px; }
.tb h2 { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.tb small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

.tb-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.tb-tete h1 { font-family: var(--serif); font-size: 38px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin: 4px 0 6px; }
.tb-sous { margin: 0; color: var(--muted); font-size: 14px; }
.tb-liens { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-liens .home-btn { padding: 8px 14px; font-size: 13px; }

.tb-alerte { display: flex; gap: 10px; align-items: baseline; padding: 14px 16px; font-size: 15px; color: #7c2d12; background: #fff4e6; border: 1px solid #ffd8a8; border-radius: 12px; }

/* chiffres clés */
.tb-chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tb-tuile { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; padding: 18px 20px; background: var(--dark); color: #fff; border-radius: 16px; }
.tb-tuile i { grid-row: span 3; align-self: center; font-size: 22px; color: #fbc43c; }
.tb-tuile b { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.tb-unite { font-size: 14px; font-weight: 600; color: #fff3b0; }
.tb-lib { font-size: 13px; color: rgba(255, 255, 255, .72); }
.tb-note { margin: 8px 2px 18px; font-size: 12.5px; color: var(--muted); }

/* sources */
.tb-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tb-source { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.tb-source h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.tb-source h3 i { color: var(--orange); margin-right: 4px; }
.tb dl { margin: 0; display: grid; gap: 4px; }
.tb dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.tb dt { font-weight: 400; color: var(--muted); }
.tb dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }

/* consommation de la commune */
.tb-conso h3 { margin: 14px 0 8px; font-size: 14px; font-weight: 700; }
.tb-conso h3 small { display: inline; margin-left: 4px; }
.tb-conso .tb-deux { gap: 24px; }
.tb-conso-phrase { margin: 6px 0 10px; font-size: 17px; line-height: 1.45; }
.tb-conso-phrase b { font-family: var(--serif); font-size: 24px; color: var(--orange); }
.tb-jauge { position: relative; height: 14px; background: #f0ede6; border-radius: 7px; overflow: hidden; }
.tb-jauge span { display: block; height: 100%; background: #f07f24; border-radius: 7px; }
.tb-conso-autres { display: flex !important; flex-wrap: wrap; gap: 8px; margin-top: 16px !important; }
.tb-conso-autres > div { justify-content: flex-start !important; gap: 8px !important; padding: 6px 12px; background: var(--paper); border-radius: 9px; }
.tb-conso-autres dd { font-weight: 600; }

/* carte et fiche */
.tb-grille { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; margin-bottom: 18px; }
.tb-carte { height: 520px; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }
.tb-fiche { max-height: 520px; overflow-y: auto; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.tb-fiche-vide { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tb-fiche-vide i { color: var(--orange); margin-right: 4px; }
.tb-fiche-type { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--orange); }
.tb-fiche h3 { margin: 4px 0 12px; font-size: 19px; font-weight: 700; line-height: 1.2; }
.tb-fiche h4 { margin: 16px 0 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tb-fiche-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tb-fiche-chiffres div { padding: 8px; background: var(--paper); border-radius: 10px; text-align: center; }
.tb-fiche-chiffres b { display: block; font-size: 15px; }
.tb-fiche-chiffres span { font-size: 11.5px; color: var(--muted); }
.tb-fiche a { color: var(--accent); }
.tb-prudence { padding: 8px 10px; background: #fff4e6; border-radius: 8px; color: #7c2d12 !important; }

/* blocs */
.tb-bloc { margin-bottom: 18px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.tb-bloc-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.tb-aide { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.tb-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tb-deux .tb-bloc { margin-bottom: 18px; }

.tb-onglets { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.tb-onglets button { padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 9px; cursor: pointer; }
.tb-onglets button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(29, 34, 48, .12); font-weight: 600; }
.tb-onglets i { color: var(--orange); margin-right: 4px; }

.tb-filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.tb-filtres label { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; }
.tb-filtres select, .tb-filtres input { padding: 7px 9px; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; max-width: 260px; }
.tb-filtres [hidden] { display: none; }
.tb-export { margin-left: auto; padding: 8px 13px; font-size: 13px; }
.tb-resume { margin: 0 0 8px; font-size: 14px; }
.tb-resume small { display: inline; }

/* tables */
.tb-table-zone { overflow-x: auto; }
.tb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tb-table th { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tb-table th button { padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.tb-table th.trie { color: var(--ink); }
.tb-table td { padding: 7px 8px; border-bottom: 1px solid #f0ede6; vertical-align: top; }
.tb-table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-table .rang { width: 32px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-table tbody tr[data-id], .tb-table tbody tr[data-siren] { cursor: pointer; }
.tb-table tbody tr[data-id]:hover, .tb-table tbody tr[data-siren]:hover { background: var(--paper); }
.tb-table tr.is-choisi { background: #fff4e6 !important; box-shadow: inset 3px 0 0 var(--orange); }
.tb-table .tb-plus td { text-align: center; padding: 12px; }
.tb-gris { color: var(--muted); }
.tb-pastille { display: inline-block; width: 11px; height: 11px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(29, 34, 48, .2); }

/* barres */
.tb-barres { display: grid; gap: 8px; }
.tb-barre { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.tb-barre-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-barre-piste { height: 14px; }
.tb-barre-piste span { display: block; height: 100%; background: #f07f24; border-radius: 0 4px 4px 0; }
.tb-barre-val { min-width: 54px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.tb-methode ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.tb-telecharger { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 0; font-size: 13.5px; }
.tb-telecharger a { color: var(--accent); font-weight: 500; }

@media (max-width: 900px) {
  .tb { padding: 18px 16px 40px; }
  .tb-tete h1 { font-size: 30px; }
  .tb-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-tuile b { font-size: 26px; }
  .tb-grille, .tb-deux { grid-template-columns: 1fr; }
  .tb-carte { height: 380px; }
  .tb-fiche { max-height: none; }
  .tb-export { margin-left: 0; }
}

/* démonstration (solaryo_tableau_demo.php) */
.tb-demo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 18px; padding: 14px 18px;
  background: #fff8e6; border: 1px solid #f3d58a; border-radius: 14px; }
.tb-demo p { margin: 0; flex: 1 1 420px; }

/* vue 3D par-dessus la carte (toityo3d.js) ; seul le bouton « 2D » reste visible */
.tb-carte-bloc { position: relative; }
.tb-carte3d { position: absolute !important; inset: 0; z-index: 800; border-radius: 14px; overflow: hidden; background: #dfe3e8; }
.tb-carte-bloc.en-3d .leaflet-control-zoom, .tb-carte-bloc.en-3d .leaflet-control-layers { display: none; }
.tb-carte-bloc.en-3d .tb-bouton3d { position: relative; z-index: 900; }
.tb-carte-bloc.en-3d .leaflet-top.leaflet-left { z-index: 900; }
.tb-bouton3d { width: 34px; height: 34px; padding: 0; font: 700 13px/34px "Inter", system-ui, sans-serif; color: #1d2230; background: #fff;
  border: 2px solid rgba(0, 0, 0, .2); border-radius: 4px; background-clip: padding-box; cursor: pointer; }
.tb-bouton3d:hover { background: #f4f4f4; }

/* infobulles de la carte et de la 3D : carte sombre, pastille du soleil reçu */
.leaflet-tooltip.tb-bulle, .toityo3d-bulle .maplibregl-popup-content {
  display: flex; flex-direction: column; gap: 2px; min-width: 210px; max-width: 290px; padding: 10px 13px 11px; white-space: normal;
  font: 13px/1.35 "Inter", system-ui, sans-serif; color: #e9ebf2; background: #1d2230; border: 0; border-radius: 12px;
  box-shadow: 0 14px 30px -12px rgba(10, 12, 20, .65), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}
.toityo3d-bulle { pointer-events: none; }
.leaflet-tooltip.tb-bulle::before { display: none; }
.toityo3d-bulle.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .toityo3d-bulle.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.toityo3d-bulle.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: #1d2230; }
.toityo3d-bulle.maplibregl-popup-anchor-top .maplibregl-popup-tip, .toityo3d-bulle.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.toityo3d-bulle.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: #1d2230; }
.toityo3d-bulle.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #1d2230; }
.toityo3d-bulle.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #1d2230; }
.bl-type { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #f4a259; }
.bl-type i { margin-right: 2px; }
.bl-titre { font-size: 14px; font-weight: 600; color: #fff; }
.bl-valeur { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 7px; white-space: nowrap; margin-top: 3px; font-size: 15px; font-weight: 700; color: #fff; }
.bl-valeur i { flex: none; align-self: center; width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .18); }
.bl-valeur em { font-style: normal; font-weight: 500; font-size: 12.5px; color: #aeb4c4; }
.bl-detail { font-size: 12px; color: #c4c9d6; }
.bl-aide { margin-top: 4px; font-size: 11px; color: #8b92a5; }
