/* Page /urbaxol_tableau.php : tableau de bord des priorités de rénovation (s'appuie sur articles-page.css et home.css) */
.ub-body { background: var(--paper, #faf8f4); }
.ub { --dark: #1d2230; --orange: #e8590c; max-width: none; margin: 0; padding: 18px 20px 28px; }

.ub-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.ub-tete h1 { font-family: var(--serif); font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 2px 0 0; }
.ub .ub-retour { display: inline-block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.ub .ub-retour:hover { color: var(--ink); }
.ub .ub-guide { margin-left: 14px; color: var(--accent); font-weight: 500; }
.ub-tete-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ub-tete-actions .home-btn { padding: 8px 13px; font-size: 13px; }
.ub-indispo { display: flex; gap: 12px; align-items: baseline; max-width: 640px; padding: 16px 18px; font-size: 15px; background: #fff4e6; border: 1px solid #ffd8a8; border-radius: 12px; }
.ub-indispo i { color: var(--orange); }
.ub-indispo p { margin: 0; }

/* Chiffres clés */
.ub-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ub-kpi { padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.ub-kpi b { display: block; font-size: 24px; font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.ub-kpi span { display: block; margin-top: 2px; font-size: 13px; color: var(--ink); }
.ub-kpi small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Filtres : une ligne au-dessus de tout ce qu'ils filtrent */
.ub-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.ub-filtres-liste { display: contents; }
.ub-adresse { width: 190px; padding: 6px 12px; font: inherit; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.ub-adresse:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(80, 89, 156, .15); }
.ub-filtre { position: relative; }
.ub-filtre summary { display: flex; align-items: center; gap: 6px; padding: 6px 11px; font-size: 13px; font-weight: 500; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.ub-filtre summary::-webkit-details-marker { display: none; }
.ub-filtre summary i { font-size: 10px; color: var(--muted); }
.ub-filtre summary b:empty { display: none; }
.ub-filtre summary b { min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; color: #fff; background: var(--dark); border-radius: 99px; }
.ub-filtre.is-actif summary { border-color: var(--dark); }
.ub-filtre-choix { position: absolute; z-index: 1200; top: calc(100% + 4px); left: 0; min-width: 240px; max-width: 360px; max-height: 340px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px -12px rgba(29, 34, 48, .35); }
.ub-filtre-choix label { display: flex; align-items: center; gap: 7px; margin: 0; padding: 5px 7px; font-size: 13px; font-weight: 400; line-height: 1.3; border-radius: 6px; cursor: pointer; }
.ub-filtre-choix label:hover { background: var(--paper); }
.ub-filtre-choix input { flex: none; margin: 0; }
.ub-filtre-choix i, .ub-barre-lib i, .ub-legende i, .ub-themes i, .ub-op-theme i, .ub-op-titre i, .ub-popup-op i { flex: none; display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.ub-vue { display: flex; align-items: center; gap: 6px; margin: 0 0 0 6px; font-size: 13px; font-weight: 500; }
.ub-vue input { margin: 0; }
.ub-raz { padding: 6px 10px; font-size: 13px; color: #c92a2a; background: none; border: 0; border-radius: 999px; cursor: pointer; }
.ub-raz:hover { background: #fff5f5; }
.ub-compte { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Carte à gauche (reste à l'écran), graphiques et opérations à droite */
.ub-corps { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, 1fr); gap: 14px; align-items: start; }
.ub-carte-zone { position: sticky; top: 12px; height: calc(100vh - 110px); min-height: 460px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ub-carte { height: 100%; background: #eef0f2; }
.ub-chargement { position: absolute; z-index: 900; left: 50%; top: 45%; transform: translateX(-50%); margin: 0; padding: 10px 16px; font-size: 14px; color: #fff; background: rgba(29, 34, 48, .9); border-radius: 10px; }
.ub-chargement[hidden] { display: none; }
.ub-legende { position: absolute; z-index: 800; left: 54px; top: 10px; width: min(290px, calc(100% - 120px)); max-height: calc(100% - 40px); overflow-y: auto; padding: 10px 12px; font-size: 12.5px; background: rgba(255, 255, 255, .96); border-radius: 10px; box-shadow: 0 4px 14px rgba(29, 34, 48, .18); }
.ub-legende > label { display: block; margin: 0 0 4px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ub-legende select { width: 100%; padding: 5px 7px; font: inherit; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.ub-legende ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 1px; }
.ub-legende li button, .ub-leg-autres { display: flex; align-items: center; gap: 7px; width: 100%; padding: 3px 5px; font: inherit; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 5px; cursor: pointer; }
.ub-legende li button:hover { background: #f1f3f5; }
.ub-legende li span { flex: 1; line-height: 1.3; }
.ub-legende li small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ub-legende li button.is-off { opacity: .45; }
.ub-legende li button.is-sel span { font-weight: 600; }
.ub-leg-autres { cursor: default; }
.ub-leg-unite { padding: 0 5px; font-size: 11.5px; color: var(--muted); }
.ub-legende .ub-contours { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; padding-top: 7px; font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink); border-top: 1px solid var(--line); }
.ub-contours input { margin: 0; }

.ub-droite { min-width: 0; padding: 14px 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.ub-onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.ub-onglets button { padding: 8px; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 9px; cursor: pointer; }
.ub-onglets button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(29, 34, 48, .12); font-weight: 600; }
.ub-onglets i { color: var(--accent); margin-right: 4px; }
.ub-onglets span { font-weight: 400; color: var(--muted); }

.ub-mesure { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.ub-mesure span { margin-right: 4px; }
.ub-mesure button { padding: 3px 10px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--muted); background: #f1f3f5; border: 0; border-radius: 999px; cursor: pointer; }
.ub-mesure button.is-active { color: #fff; background: var(--dark); }
.ub-classes { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0 0 6px; padding: 0; font-size: 12.5px; }
.ub-classes li { display: flex; align-items: center; gap: 5px; }
.ub-classes i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.ub-classes small { color: var(--muted); }

/* Graphiques : barres horizontales empilées par classe de priorité */
.ub-graphe { margin-top: 16px; }
.ub-graphe h3 { margin: 0 0 6px; font-family: inherit; font-size: 14px; font-weight: 600; }
.ub-graphe h3 small { font-weight: 400; color: var(--muted); }
.ub-barre { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 8px; width: 100%; padding: 3px 4px; font: inherit; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.ub-barre:hover, .ub-barre:focus-visible { background: #f4f5f7; }
.ub-barre.is-off { opacity: .4; }
.ub-barre.is-sel .ub-barre-lib { font-weight: 600; }
.ub-barre-lib { display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
.ub-barre-piste { display: flex; gap: 2px; height: 14px; }
.ub-barre-piste span { height: 100%; min-width: 2px; }
.ub-barre-piste span:last-child { border-radius: 0 4px 4px 0; }
.ub-barre-val { min-width: 40px; font-size: 12.5px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ub-histo { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; height: 130px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.ub-histo-barre { position: relative; display: flex; align-items: flex-end; height: 100%; padding: 0; background: none; border: 0; border-radius: 4px 4px 0 0; cursor: pointer; }
.ub-histo-barre:hover { background: #f4f5f7; }
.ub-histo-barre.is-off { opacity: .35; }
.ub-histo-barre span { display: block; width: 100%; min-height: 1px; border-radius: 4px 4px 0 0; }
.ub-histo-barre em { position: absolute; left: 0; bottom: -18px; font-size: 11px; font-style: normal; color: var(--muted); }
.ub-note { margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.ub-infobulle { position: fixed; z-index: 2000; display: grid; gap: 1px; max-width: 280px; padding: 7px 10px; font-size: 12.5px; color: #3b4152; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(29, 34, 48, .18); pointer-events: none; }
.ub-infobulle[hidden] { display: none; }
.ub-infobulle b { font-size: 14px; color: var(--ink); }

/* Opérations groupées */
.ub-aide { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.ub-themes { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ub-themes button { display: flex; align-items: center; gap: 6px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--ink); background: #f1f3f5; border: 0; border-radius: 999px; cursor: pointer; }
.ub-themes button small { color: var(--muted); }
.ub-themes button.is-active { color: #fff; background: var(--dark); }
.ub-themes button.is-active small { color: #cfd3dc; }
.ub-themes button:disabled { opacity: .45; cursor: default; }
.ub-table-zone { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.ub-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ub-table th { position: sticky; top: 0; z-index: 1; padding: 7px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; background: var(--paper); border-bottom: 1px solid var(--line); }
.ub-table th[data-tri] { cursor: pointer; user-select: none; }
.ub-table th.is-tri { color: var(--ink); }
.ub-table th.is-tri::after { content: ' ▾'; }
.ub-table th.is-tri[aria-sort=ascending]::after { content: ' ▴'; }
.ub-table td { padding: 7px 8px; vertical-align: top; border-bottom: 1px solid #f0f1f3; }
.ub-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ub-table tbody tr[data-op] { cursor: pointer; }
.ub-table tbody tr[data-op]:hover, .ub-table tbody tr[data-op]:focus { background: #f6f7f9; outline: none; }
.ub-table tbody tr.is-sel { background: #edf2ff; }
.ub-table td small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.ub-op-theme { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.ub-pastille { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; vertical-align: 1px; }
.ub-vide { color: var(--muted); text-align: center; }
.ub-export-ops { margin-top: 10px; padding: 7px 12px; font-size: 13px; }

.ub-op-detail { position: relative; margin-bottom: 12px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.ub-op-fermer { position: absolute; top: 8px; right: 8px; padding: 3px 7px; color: var(--muted); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.ub-op-fermer:hover { background: #eceef1; }
.ub-op-titre { display: flex; align-items: center; gap: 7px; margin: 0 26px 2px 0; font-size: 15px; font-weight: 600; }
.ub-op-levier { margin: 0 0 10px; font-size: 13px; color: #3b4152; }
.ub-op-chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.ub-op-chiffres div { padding: 7px 8px; background: #fff; border-radius: 8px; }
.ub-op-chiffres b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.ub-op-chiffres span { font-size: 11.5px; color: var(--muted); }
.ub-op-barre { display: flex; gap: 2px; height: 10px; margin-bottom: 10px; }
.ub-op-barre span:first-child { border-radius: 4px 0 0 4px; }
.ub-op-barre span:last-child { border-radius: 0 4px 4px 0; }
.ub-op-detail dl { margin: 0 0 10px; font-size: 12.5px; }
.ub-op-detail dt { font-weight: 600; color: var(--muted); }
.ub-op-detail dd { margin: 0 0 5px; }
.ub-op-detail .home-btn { padding: 7px 12px; font-size: 13px; }

/* Fiche d'un bâtiment */
.leaflet-popup-content .ub-popup { margin: 0; border-collapse: collapse; font-size: 12.5px; }
.ub-popup th { padding: 2px 8px 2px 0; font-weight: 500; color: #667; text-align: left; vertical-align: top; white-space: nowrap; }
.ub-popup td { padding: 2px 0; }
.ub-popup-ops { margin: 8px 0 4px !important; font-size: 12px; font-weight: 600; }
.ub-popup-op { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 3px; padding: 4px 7px; font: inherit; font-size: 12px; text-align: left; background: #f1f3f5; border: 0; border-radius: 6px; cursor: pointer; }
.ub-popup-op:hover { background: #e6e8ec; }

@media (max-width: 980px) {
  .ub { padding: 14px 16px 24px; }
  .ub-corps { grid-template-columns: 1fr; }
  .ub-carte-zone { position: relative; top: 0; height: 60vh; min-height: 360px; }
  .ub-compte { margin-left: 0; width: 100%; }
  .ub-op-chiffres { grid-template-columns: repeat(2, 1fr); }
}

/* Démonstration publique (urbaxol_demo.php) */
.ub-demo { margin: 8px 0 0; max-width: 720px; font-size: 14px; line-height: 1.5; color: var(--muted, #5c6170); }
.ub-demo i { color: var(--accent, #e8590c); margin-right: 4px; }
