/**
 * [B] ODS Frontend Display - Main Stylesheet
 *
 * Palette:
 * - Primary: var(--bdw-navy) (navy)
 * - Secondary: #f5a623 (gold)
 * - Background cards: #f8f9fa
 * - Text main: #212529
 * - ODS colors: official UN colors
 */

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
	--bdw-navy:         #1e3270;
	--bdw-navy-dark:    #162756;
	--bdw-blue:         #6b9fd4;
	--bdw-text-muted:   #536079; /* was #6b7a9a — darkened for WCAG AA */
	--bdw-text-hint:    #7a8fa0; /* was #9aabb8 */
	--bdw-text-body:    #2c3a56;
	--bdw-ghost:        #f0f4fb;
	--bdw-surface:      #f8faff;
	--bdw-border:       #e4eaf5;
	--bdw-border-input: #d0d7e3;
}

/* ── Base & Reset ───────────────────────────────────────────────────────── */
.bdw-display-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	color: #212529;
	line-height: 1.6;
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
}

.bdw-display-wrapper *,
.bdw-display-wrapper *::before,
.bdw-display-wrapper *::after {
	box-sizing: border-box;
}

.bdw-display-wrapper h1,
.bdw-display-wrapper h2,
.bdw-display-wrapper h3,
.bdw-display-wrapper h4,
.bdw-display-wrapper h5,
.bdw-display-wrapper h6 {
	margin-top: 0;
	color: var(--bdw-navy);
	font-weight: 600;
}

.bdw-display-wrapper a {
	color: var(--bdw-navy);
	text-decoration: none;
}

.bdw-display-wrapper a:hover {
	text-decoration: underline;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.bdw-breadcrumb {
	margin-bottom: 20px;
	font-size: 0.95rem;
}

.bdw-breadcrumb-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.bdw-breadcrumb-item {
	display: flex;
	align-items: center;
	gap: 8px;
}

.bdw-breadcrumb-item:not(:last-child)::after {
	content: '/';
	color: #adb5bd;
}

.bdw-breadcrumb-link {
	color: var(--bdw-navy);
	text-decoration: none;
	transition: color 0.2s ease;
}

.bdw-breadcrumb-link:hover {
	color: #2a4580;
	text-decoration: underline;
}

.bdw-breadcrumb-current {
	color: #6c757d;
	font-weight: 500;
}

/* ── Error Messages & Fallbacks ──────────────────────────────────────────── */
.bdw-display-error,
.bdw-display-loading,
.bdw-display-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 40px 20px;
	border-radius: 10px;
	margin: 20px 0;
	background: #f8f9fa;
	border: 1px dashed #dee2e6;
	color: #6c757d;
	min-height: 200px;
}

.bdw-display-error {
	background: #fff5f5;
	border: 1px solid #ffc9c9;
	color: #e03131;
}

.bdw-display-loading {
	color: var(--bdw-navy);
	background: rgba(248, 249, 250, 0.7);
}

.bdw-display-loading::after {
	content: '';
	width: 24px;
	height: 24px;
	margin-top: 15px;
	border: 3px solid var(--bdw-navy);
	border-right-color: transparent;
	border-radius: 50%;
	animation: bdw-spin 1s linear infinite;
}

@keyframes bdw-spin {
	to { transform: rotate(360deg); }
}

/* ── Header Section ──────────────────────────────────────────────────────── */
.bdw-municipality-header {
	background: linear-gradient(135deg, var(--bdw-navy) 0%, #2a4580 100%);
	color: white;
	padding: 30px;
	border-radius: 12px;
	margin-bottom: 30px;
	box-shadow: 0 4px 12px rgba(30, 50, 112, 0.15);
	position: relative;
	overflow: hidden;
}

/* On the municipality page the header fuses with the sticky nav above it */
.bdw-municipality-wrapper .bdw-municipality-header {
	border-radius: 0 0 12px 12px;
}

/* [ods_display_comparator embedded="1"] (municipio ficha "Comparador" section):
   hides the widget's own hero/<h1>, since the page it's nested in already has
   one. The standalone /comparador/ page never sets this modifier class. */
.bdw-comparator-wrapper--embedded > .bdw-municipality-header {
	display: none;
}

.bdw-municipality-header::before {
	content: '';
	position: absolute;
	top: -50%;
	right: -20%;
	width: 400px;
	height: 400px;
	background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
	pointer-events: none;
}

.bdw-municipality-header__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.bdw-municipality-header__info {
	flex: 1;
	min-width: 0;
}

.bdw-municipality-header h1 {
	color: white;
	font-size: 2.2rem;
	margin: 0 0 10px 0;
	line-height: 1.2;
}

.bdw-municipality-meta {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	font-size: 0.9rem;
	opacity: 0.9;
	margin-bottom: 0;
}

.bdw-municipality-meta span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: rgba(255,255,255,0.12);
	padding: 4px 12px;
	border-radius: 20px;
	font-weight: 500;
	white-space: nowrap;
}

/* ── Demographic Stats Grid ────────────────────────────────────────────── */
.bdw-municipality-stats {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
	gap: 12px;
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid rgba(255,255,255,0.15);
}

.bdw-municipality-stat {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	background: rgba(255,255,255,0.08);
	border-radius: 10px;
	padding: 10px 14px;
	transition: background 0.2s ease;
	min-width: 0;
	overflow: hidden;
}

.bdw-municipality-stat:hover {
	background: rgba(255,255,255,0.14);
}

.bdw-municipality-stat__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.bdw-municipality-stat__value {
	font-size: 1.05rem;
	font-weight: 700;
	color: white;
	line-height: 1.3;
	word-break: break-word;
}

.bdw-municipality-stat__value small {
	font-size: 0.75rem;
	font-weight: 500;
	opacity: 0.8;
}

.bdw-municipality-stat__label {
	font-size: 0.78rem;
	opacity: 0.75;
	line-height: 1.3;
	white-space: normal;
}

.bdw-municipality-stat__year {
	font-size: 0.72rem;
	opacity: 0.7;
}

.bdw-global-score {
	margin-top: 20px;
	max-width: 300px;
}

.bdw-global-score-label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.9rem;
	opacity: 0.9;
	font-weight: 500;
}

/* ── Year Selector ──────────────────────────────────────────────────────── */
.bdw-year-selector {
	display: flex;
	gap: 10px;
	margin-bottom: 30px;
	padding: 20px;
	background: #f8f9fa;
	border-radius: 10px;
	flex-wrap: wrap;
}

.bdw-year-selector label {
	font-weight: 600;
	color: var(--bdw-navy);
	display: flex;
	align-items: center;
}

.bdw-year-btn {
	padding: 8px 16px;
	border: 2px solid var(--bdw-navy);
	background: white;
	color: var(--bdw-navy);
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.2s;
	font-weight: 500;
}

.bdw-year-btn:hover {
	background: var(--bdw-navy);
	color: white;
}

.bdw-year-btn.active {
	background: var(--bdw-navy);
	color: white;
}

/* ── "Más recientes" button ────────────────────────────────────────────── */
.bdw-year-btn--latest {
	border-color: #16a34a;
	color: #16a34a;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.bdw-year-btn--latest:hover,
.bdw-year-btn--latest.active {
	background: #16a34a;
	border-color: #16a34a;
	color: white;
}

/* ── Year mode banner ──────────────────────────────────────────────────── */
.bdw-year-mode-banner {
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 0.88rem;
	line-height: 1.5;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.bdw-year-mode-banner--latest {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}
.bdw-year-mode-banner--latest::before {
	content: '✦';
	font-size: 1rem;
}
.bdw-year-mode-banner--year {
	background: #eff6ff;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}
.bdw-year-mode-banner--year::before {
	content: '📅';
	font-size: 1rem;
}

/* ── Data year badge (shown in latest mode) ────────────────────────────── */
.bdw-data-year-badge {
	display: inline-block;
	background: #e0f2fe;
	color: #0369a1;
	font-size: 0.72rem;
	font-weight: 600;
	padding: 1px 6px;
	border-radius: 4px;
	margin-left: 4px;
	vertical-align: middle;
	letter-spacing: 0.02em;
}

/* ── Hero score badge + actions column ─────────────────────────────────── */
.bdw-municipality-header__actions-score {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	flex-shrink: 0;
}

.bdw-hero-score-badge {
	text-align: center;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	padding: 12px 22px;
	min-width: 140px;
}

.bdw-hero-score-badge__num {
	display: block;
	font-size: 2.2rem;
	font-weight: 800;
	line-height: 1;
	color: white;
}

.bdw-hero-score-badge__label {
	display: block;
	margin-top: 4px;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.85;
}

/* ── Section blocks (Resumen por ODS / Indicadores / Info demográfica / Evolución) ── */
.bdw-section-block {
	margin-bottom: 40px;
}

.bdw-section-block__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.bdw-section-block__header h2 {
	margin: 0;
	font-size: 1.4rem;
}

.bdw-section-export {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.bdw-export-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 20px;
	border: 1px solid #dfe4ee;
	background: white;
	color: var(--bdw-navy);
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.bdw-export-btn:hover {
	background: #f5f7fd;
}

.bdw-export-btn--primary {
	background: var(--bdw-navy);
	border-color: var(--bdw-navy);
	color: white;
}

.bdw-export-btn--primary:hover {
	background: #16264d;
}

/* ── Indicadores: flat table (all ODS together) ────────────────────────── */
.bdw-table-wrap {
	overflow-x: auto;
	border: 1px solid #eef1f6;
	border-radius: 10px;
}

.bdw-indicators-flat-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.bdw-indicators-flat-table th,
.bdw-indicators-flat-table td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid #f0f2f7;
	white-space: nowrap;
}

.bdw-indicators-flat-table th {
	background: var(--bdw-navy);
	color: white;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.bdw-indicators-flat-table td:nth-child(2) {
	white-space: normal;
	min-width: 220px;
}

.bdw-indicators-flat-table tbody tr:hover {
	background: #f8f9fc;
}

.bdw-indicators-flat-table .bdw-num {
	text-align: right;
	font-weight: 700;
	white-space: nowrap;
}

.bdw-state-pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
	color: white;
	white-space: nowrap;
}

.bdw-state-pill--green  { background: #4CAF50; }
.bdw-state-pill--yellow { background: #FFC107; color: #3a2f00; }
.bdw-state-pill--orange { background: #fd7e14; }
.bdw-state-pill--red    { background: #F44336; }
.bdw-state-pill--none   { background: #9E9E9E; }

/* ── Indicadores: columna del icono de ficha de metadatos ─────────────── */
.bdw-col-meta {
	width: 1%;
	text-align: center;
	white-space: nowrap;
}

.bdw-meta-icon-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.05rem;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 6px;
	opacity: 0.8;
	transition: opacity 0.15s ease, background 0.15s ease;
}

.bdw-meta-icon-btn:hover,
.bdw-meta-icon-btn:focus-visible {
	opacity: 1;
	background: #eef1f8;
}

.bdw-meta-icon-btn:focus-visible {
	outline: 2px solid #f5a623;
	outline-offset: 1px;
}

/* ── Ficha de metadatos (contenido inyectado en el modal desde
   b-ods-catalog-editor) — mismo aspecto que la ficha imprimible/pública ── */
.bdw-metadata-modal .bdw-oce-ficha-table {
	width: 100%;
	border-collapse: collapse;
}

.bdw-metadata-modal .bdw-oce-ficha-table th,
.bdw-metadata-modal .bdw-oce-ficha-table td {
	border: 1px solid #e2e5ee;
	padding: 10px 12px;
	text-align: left;
	vertical-align: top;
	font-size: 0.92rem;
}

.bdw-metadata-modal .bdw-oce-ficha-table th {
	width: 34%;
	background: #f6f7fb;
	font-weight: 700;
}

.bdw-metadata-modal .bdw-oce-ficha-table a {
	word-break: break-all;
}

/* ── Información demográfica: card grid (style shared con "Datos abiertos") ── */
.bdw-demog-info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 14px;
}

.bdw-demog-info-card {
	background: white;
	border: 1px solid #eef1f6;
	border-radius: 10px;
	padding: 16px;
}

.bdw-demog-info-card__label {
	font-size: 0.8rem;
	color: var(--bdw-text-muted);
	margin-bottom: 6px;
}

.bdw-demog-info-card__value {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--bdw-navy);
}

.bdw-demog-info-card__value small {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--bdw-text-muted);
}

.bdw-demog-info-card__year {
	margin-top: 4px;
	font-size: 0.72rem;
	color: var(--bdw-text-muted);
}

/* ── Goal detail panel (inline, next to the wheel — not an overlay) ────── */
.bdw-goal-panel {
	display: none;
}

.bdw-goal-panel.active {
	display: block;
}

.bdw-goal-modal {
	max-width: none;
}

.bdw-goal-modal .bdw-modal__content {
	max-height: 640px;
	overflow-y: auto;
}

body.bdw-modal-open {
	overflow: hidden;
}

/* ── Footer: Noticias / Iniciativas / Eventos ──────────────────────────── */
.bdw-muni-links {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
	padding: 24px 0 40px;
	margin-top: 10px;
	border-top: 1px solid #eef1f6;
}

.bdw-muni-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 20px;
	border-radius: 20px;
	background: #f5f7fd;
	color: var(--bdw-navy);
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s;
}

.bdw-muni-link:hover {
	background: #e8eef9;
	color: var(--bdw-navy);
}

/* [ods_alerts_subscribe] (odslocal-alerts) sitting in this footer row: match
 * the pill style of its bdw-muni-link siblings instead of that plugin's own
 * rectangular button — scoped to this footer only, doesn't touch how the
 * button looks anywhere else (e.g. the /mis-alertas/ dashboard). */
.bdw-muni-links .odsl-alerts-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 20px;
	border-radius: 20px;
	font-weight: 600;
	font-size: inherit;
	border: none;
}
.bdw-muni-links .odsl-alerts-btn--primary,
.bdw-muni-links .odsl-alerts-btn--secondary {
	background: #f5f7fd;
	color: var(--bdw-navy);
}
.bdw-muni-links .odsl-alerts-btn--primary:hover,
.bdw-muni-links .odsl-alerts-btn--secondary:hover {
	background: #e8eef9;
	color: var(--bdw-navy);
}

/* ── Main Layout (ODS Wheel + goal detail panel, same width as the other
 * page sections). ── */
.bdw-display-main {
	margin-bottom: 30px;
}

/* ── ODS Wheel Section ──────────────────────────────────────────────────── */
.bdw-wheel-section {
	background: white;
	border-radius: 12px;
	padding: 30px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
	display: flex;
	flex-direction: column;
}

.bdw-wheel-row {
	display: flex;
	gap: 24px;
	align-items: flex-start;
}

.bdw-wheel-col {
	flex: 0 0 auto;
	width: min(420px, 100%);
}

.bdw-goal-panel-host {
	flex: 1 1 360px;
	min-width: 280px;
}

@media (max-width: 900px) {
	.bdw-wheel-row {
		flex-direction: column;
	}
	.bdw-wheel-col {
		width: 100%;
	}
}

.bdw-wheel-section h2 {
	text-align: center;
	margin-bottom: 20px;
	font-size: 1.4rem;
}

.bdw-wheel-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 400px;
	flex: 1;
}

.bdw-wheel-svg {
	max-width: 100%;
	height: auto;
}

.bdw-wheel-sector {
	cursor: pointer;
	transition: all 0.3s ease;
	stroke: white;
	stroke-width: 2;
}

.bdw-wheel-sector:hover {
	stroke-width: 4;
	filter: brightness(1.1);
}

.bdw-wheel-sector.active {
	stroke: #f5a623;
	stroke-width: 5;
	filter: drop-shadow(0 0 8px rgba(245, 166, 35, 0.5));
}

.bdw-wheel-sector.no-data {
	opacity: 0.4;
}

.bdw-wheel-progress-bg {
	fill: #f0f2f5;
	stroke: none;
}

.bdw-wheel-guide-circle {
	fill: none;
	stroke: #ccc;
	stroke-width: 0.8;
	stroke-dasharray: 3 3;
}

.bdw-wheel-scale-label {
	font-size: 8px;
	fill: #999;
	text-anchor: middle;
	dominant-baseline: central;
	pointer-events: none;
}

.bdw-wheel-progress-bar {
	opacity: 0.92;
	transition: opacity 0.2s ease;
}

.bdw-wheel-progress-bar:hover {
	opacity: 1;
	filter: brightness(1.08);
}

.bdw-wheel-center {
	fill: white;
	stroke: #e0e0e0;
	stroke-width: 2;
}

/* Clickable wheel centre — resets the selected ODS (shows overview). */
.bdw-wheel-center-btn {
	cursor: pointer;
}

.bdw-wheel-center-btn:focus-visible {
	outline: 2px solid #19486A;
	outline-offset: 2px;
	border-radius: 50%;
}

.bdw-wheel-label {
	font-size: 10px;
	font-weight: 600;
	text-anchor: middle;
	dominant-baseline: central;
	pointer-events: none;
	fill: white;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.bdw-wheel-icon {
	font-size: 7px;
	text-anchor: middle;
	dominant-baseline: central;
	pointer-events: none;
}

.bdw-wheel-empty-label {
	font-size: 13px;
	fill: #adb5bd;
	font-style: italic;
	text-anchor: middle;
	dominant-baseline: central;
	pointer-events: none;
	font-family: inherit;
}

/* ── Side Panel ──────────────────────────────────────────────────────────── */
.bdw-panel-section {
	background: white;
	border-radius: 12px;
	padding: 30px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.bdw-panel-header {
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 2px solid #f1f3f5;
}

.bdw-panel-title {
	font-size: 1.5rem;
	color: var(--bdw-navy);
	margin: 0 0 10px 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.bdw-panel-ods-icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: 700;
	font-size: 0.9rem;
}

.bdw-panel-meta {
	color: #666;
	font-size: 0.9rem;
}

/* ── Target Tabs ─────────────────────────────────────────────────────────── */
.bdw-target-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.bdw-target-tab {
	padding: 8px 14px;
	border: 1px solid #dee2e6;
	background: white;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 500;
	transition: all 0.2s;
}

.bdw-target-tab:hover {
	background: #f8f9fa;
	border-color: #adb5bd;
}

.bdw-target-tab.active {
	background: var(--bdw-navy);
	color: white;
	border-color: var(--bdw-navy);
}

/* ── Dashboard Tabs ───────────────────────────────────────────────────────── */
.bdw-dashboard-tabs {
	display: flex;
	gap: 10px;
	border-bottom: 2px solid #e9ecef;
	margin-bottom: 30px;
	flex-wrap: wrap;
}

.bdw-tab-btn {
	background: transparent;
	border: none;
	padding: 15px 20px;
	font-size: 1rem;
	font-weight: 600;
	color: #6c757d;
	cursor: pointer;
	position: relative;
	transition: color 0.2s ease;
}

.bdw-tab-btn:hover {
	color: var(--bdw-navy);
}

.bdw-tab-btn.active {
	color: var(--bdw-navy);
}

.bdw-tab-btn.active::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 100%;
	height: 3px;
	background: var(--bdw-navy);
	border-radius: 3px 3px 0 0;
}

.bdw-tab-content {
	display: none;
	animation: bdw-fade-in 0.3s ease;
}

.bdw-tab-content.active {
	display: block;
}

@keyframes bdw-fade-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ── Indicators List ─────────────────────────────────────────────────────── */
.bdw-indicators-list {
	flex: 1;
	max-height: 550px;
	overflow-y: auto;
	padding-right: 10px;
}

.bdw-indicators-list::-webkit-scrollbar {
	width: 6px;
}

.bdw-indicators-list::-webkit-scrollbar-track {
	background: #f1f3f5;
	border-radius: 4px;
}

.bdw-indicators-list::-webkit-scrollbar-thumb {
	background: #cdd4dc;
	border-radius: 4px;
}

.bdw-indicator-item {
	border: 1px solid #e9ecef;
	border-radius: 10px;
	padding: 20px;
	margin-bottom: 15px;
	background: #ffffff;
	box-shadow: 0 2px 6px rgba(0,0,0,0.02);
	transition: all 0.2s ease;
}

.bdw-indicator-item:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	border-color: #dee2e6;
	transform: translateY(-2px);
}

.bdw-indicator-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 12px;
	gap: 15px;
}

.bdw-indicator-code {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	color: #fff;
	background: var(--bdw-navy);
	border-radius: 4px;
	padding: 1px 5px;
	margin-right: 6px;
	vertical-align: middle;
	letter-spacing: 0.02em;
	opacity: 0.85;
}

.bdw-indicator-title {
	font-weight: 600;
	color: #212529;
	font-size: 1rem;
	flex: 1;
	margin: 0;
}

.bdw-indicator-meta {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
}

/* ── Semáforo (Traffic Light) ────────────────────────────────────────────── */
.bdw-semaforo {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
	border: 2px solid white;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ── Wheel actions + help modal ─────────────────────────────────────────── */
.bdw-wheel-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 12px;
}

.bdw-wheel-help-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 14px;
	border: 1.5px solid #ddd;
	border-radius: 8px;
	background: #f8f9fb;
	color: #555;
	font-size: 0.82rem;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}

.bdw-wheel-help-btn:hover {
	border-color: #0A97D9;
	background: #eef7fc;
	color: #0A97D9;
}

.bdw-wheel-help-btn__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #0A97D9;
	color: #fff;
	font-weight: 800;
	font-size: 11px;
	font-family: serif;
	line-height: 1;
}

.bdw-wheel-help-modal {
	margin-top: 16px;
	padding: 20px;
	background: #f8f9fb;
	border: 1px solid #dfe6ee;
	border-radius: 12px;
	position: relative;
}

.bdw-wheel-help-modal__content h3 {
	margin: 0 0 10px;
	font-size: 1rem;
	color: var(--bdw-navy, #1e3270);
}

.bdw-wheel-help-modal__content p {
	margin: 0 0 8px;
	font-size: 0.88rem;
	line-height: 1.5;
	color: #444;
}

.bdw-wheel-help-modal__content ul {
	list-style: none;
	padding: 0;
	margin: 0 0 10px;
}

.bdw-wheel-help-modal__content li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 0;
	font-size: 0.85rem;
	color: #444;
}

.bdw-wheel-help-modal__content li .bdw-semaforo {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.bdw-wheel-help-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	font-size: 1.4rem;
	cursor: pointer;
	color: #999;
	line-height: 1;
}

.bdw-wheel-help-modal__close:hover {
	color: #333;
}

/* ── Wheel centre text ─────────────────────────────────────────────────── */
.bdw-wheel-center-score {
	font-size: 14px;
	font-weight: 800;
	fill: #1e3270;
	text-anchor: middle;
	dominant-baseline: middle;
}

.bdw-wheel-center-label {
	font-size: 7px;
	fill: #666;
	text-anchor: middle;
	dominant-baseline: middle;
}

/* ── Panel overview (wheel-centre reset → all ODS) ─────────────────────── */
.bdw-overview-goal {
	margin-bottom: 22px;
}

.bdw-overview-goal-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 700;
	color: #19486A;
	padding-bottom: 8px;
	border-bottom: 1px solid #f1f3f5;
}

.bdw-overview-goal-title .bdw-panel-ods-icon {
	width: 28px;
	height: 28px;
	font-size: 0.85rem;
}

.bdw-overview-goal-score {
	margin-left: auto;
	font-size: 0.85rem;
	font-weight: 800;
	color: #333;
}

.bdw-semaforo--green {
	background: #4CAF50;
}

.bdw-semaforo--yellow {
	background: #FFC107;
}

.bdw-semaforo--red {
	background: #F44336;
}

.bdw-semaforo--orange {
	background: #fd7e14;
}

.bdw-semaforo--none {
	background: #9E9E9E;
}

.bdw-semaforo--lg {
	width: 28px;
	height: 28px;
}

/* ── Value Display ───────────────────────────────────────────────────────── */
.bdw-indicator-value-wrapper {
	display: flex;
	align-items: baseline;
	gap: 4px;
	margin-bottom: 8px;
}

.bdw-indicator-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--bdw-navy);
}

.bdw-indicator-unit {
	font-size: 0.9rem;
	color: #666;
}

.bdw-trend-wrapper {
	margin-bottom: 12px;
}

.bdw-indicator-no-data {
	color: #6c757d; /* WCAG AA contrast on white (~5.7:1); was #999 (~2.85:1) */
	font-style: italic;
	font-size: 0.95rem;
}

/* ── Progress Bar ───────────────────────────────────────────────────────── */
.bdw-progress {
	background: #e9ecef;
	border-radius: 10px;
	height: 14px;
	position: relative;
	margin: 15px 0;
	overflow: hidden;
}

.bdw-progress--lg {
	height: 24px;
	border-radius: 12px;
}

.bdw-progress__bar {
	height: 100%;
	border-radius: 10px;
	transition: width 0.5s ease;
}

.bdw-progress--lg .bdw-progress__bar {
	border-radius: 12px;
}

.bdw-progress__bar--green {
	background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.bdw-progress__bar--yellow {
	background: linear-gradient(90deg, #FFC107, #FFD54F);
}

.bdw-progress__bar--red {
	background: linear-gradient(90deg, #F44336, #EF5350);
}

.bdw-progress__bar--orange {
	background: linear-gradient(90deg, #fd7e14, #FF9800);
}

.bdw-progress__bar--none {
	background: #9E9E9E;
}

/* ── Indicator Info Button + Popover ────────────────────────────────────── */
.bdw-indicator-info-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-left: 6px;
	padding: 0;
	border: 1.5px solid #0A97D9;
	border-radius: 50%;
	background: transparent;
	color: #0A97D9;
	font-size: 12px;
	font-weight: 700;
	font-style: italic;
	font-family: serif;
	cursor: pointer;
	vertical-align: middle;
	line-height: 1;
	transition: background .15s, color .15s;
}

.bdw-indicator-info-btn:hover,
.bdw-indicator-info-btn:focus {
	background: #0A97D9;
	color: #fff;
	outline: none;
}

.bdw-indicator-info-popover {
	position: relative;
	margin: 10px 0;
	padding: 16px;
	background: #f8f9fb;
	border: 1px solid #dfe6ee;
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(0,0,0,.08);
	font-size: 0.88rem;
	line-height: 1.55;
	z-index: 10;
}

.bdw-indicator-info-popover__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 10px;
	gap: 8px;
}

.bdw-indicator-info-popover__header strong {
	color: var(--bdw-navy, #1e3270);
	font-size: 0.92rem;
}

.bdw-indicator-info-popover__close {
	background: none;
	border: none;
	font-size: 1.3rem;
	cursor: pointer;
	color: #999;
	line-height: 1;
	padding: 0 2px;
}

.bdw-indicator-info-popover__close:hover {
	color: #333;
}

.bdw-indicator-info-popover__row {
	margin-bottom: 8px;
}

.bdw-indicator-info-popover__label {
	display: block;
	font-weight: 700;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #888;
	margin-bottom: 2px;
}

.bdw-indicator-info-popover__row p {
	margin: 0;
	color: #444;
}

.bdw-indicator-info-popover__thresholds {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-top: 4px;
}

/* ── Threshold Bar (4-color segments + value marker) ───────────────────── */
.bdw-threshold-bar {
	position: relative;
	margin: 16px 0 28px;
}

.bdw-threshold-bar__track {
	position: relative;
	height: 18px;
	border-radius: 9px;
	overflow: hidden;
	display: flex;
}

.bdw-threshold-bar__seg {
	position: absolute;
	top: 0;
	height: 100%;
	opacity: 0.85;
}

.bdw-threshold-bar__seg:first-child {
	border-radius: 9px 0 0 9px;
}

.bdw-threshold-bar__seg:last-child {
	border-radius: 0 9px 9px 0;
}

.bdw-threshold-bar__marker {
	position: absolute;
	top: -10px;
	transform: translateX(-50%);
	z-index: 2;
}

.bdw-threshold-bar__value {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 6px;
	color: #fff;
	font-weight: 700;
	font-size: 0.85rem;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(0,0,0,0.25);
	position: relative;
}

.bdw-threshold-bar__value::after {
	content: '';
	position: absolute;
	bottom: -5px;
	left: 50%;
	transform: translateX(-50%);
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 5px solid currentColor;
}

.bdw-threshold-bar__labels {
	position: relative;
	height: 18px;
	margin-top: 4px;
	font-size: 0.7rem;
	color: #666;
}

.bdw-threshold-bar__labels span {
	position: absolute;
	transform: translateX(-50%);
	white-space: nowrap;
}

/* Map popup "Ver ficha" link (replaces inline onclick button) */
.bdw-map-popup-link {
	display: inline-block;
	margin-top: 6px;
	padding: 4px 10px;
	background: var(--bdw-navy);
	color: #fff !important;
	border-radius: 4px;
	text-decoration: none;
	font-size: 12px;
	font-weight: 600;
}
.bdw-map-popup-link:hover,
.bdw-map-popup-link:focus {
	background: #2a4490;
	color: #fff !important;
	text-decoration: none;
}

.bdw-progress__label {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.75rem;
	font-weight: 700;
	color: white;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.bdw-progress--lg .bdw-progress__label {
	font-size: 0.95rem;
	right: 15px;
}

/* ── Trend Arrow ─────────────────────────────────────────────────────────── */
.bdw-trend {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.85rem;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 4px;
	background: #f8f9fa;
}

/* Trend badges are always neutral gray (client request, Reunión 07/2026):
 * "creciente / decreciente / constante" describe the direction of change over
 * time, NOT compliance, so they must never use the green/red compliance hues
 * to avoid confusion with the semáforo states. All variants map to the same
 * gray so any class emitted by getTrendClass() renders identically. */
.bdw-trend--increasing,
.bdw-trend--decreasing,
.bdw-trend--neutral,
.bdw-trend--bad {
	color: #616161;
	background: #f5f5f5;
}

.bdw-trend-arrow {
	font-size: 1.1em;
	line-height: 1;
}

/* ── Thresholds Info ──────────────────────────────────────────────────────── */
.bdw-thresholds {
	display: flex;
	gap: 15px;
	font-size: 0.8rem;
	color: #666;
	margin-top: 10px;
}

.bdw-threshold {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* ── History Button ──────────────────────────────────────────────────────── */
.bdw-history-btn {
	background: var(--bdw-navy);
	color: white;
	border: none;
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 500;
	transition: background 0.2s;
	margin-top: 10px;
}

.bdw-history-btn:hover {
	background: #2a4580;
}

/* ── Pending Value Alert ─────────────────────────────────────────────────── */
.bdw-pending-alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	background: #fff8e1;
	border: 1px solid #ffcc02;
	border-left: 4px solid #f5a623;
	border-radius: 8px;
	padding: 12px 14px;
	margin: 8px 0;
	font-size: 0.88rem;
	line-height: 1.5;
}
.bdw-pending-alert__icon {
	font-size: 1.3rem;
	color: #f5a623;
	flex-shrink: 0;
	line-height: 1;
	margin-top: 2px;
}
.bdw-pending-alert__body {
	flex: 1;
	min-width: 0;
}
.bdw-pending-alert__value {
	margin-bottom: 4px;
}
.bdw-pending-alert__value strong {
	color: #8a6d3b;
}
.bdw-pending-alert__meta {
	color: #6b5a33;
	font-size: 0.82rem;
}
.bdw-pending-badge {
	display: inline-block;
	background: #f5a623;
	color: #fff;
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 0.75rem;
	font-weight: 600;
	margin-left: 6px;
	vertical-align: middle;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}
.bdw-indicator-value--pending {
	opacity: 0.7;
	font-style: italic;
}
.bdw-indicator-value--pending .bdw-indicator-value::after {
	content: ' *';
	color: #f5a623;
	font-weight: bold;
}

/* ── Indicator History Timeline ──────────────────────────────────────────── */
.bdw-history-timeline {
	margin-top: 10px;
	border-top: 1px solid #e9ecef;
	padding-top: 10px;
}
.bdw-history-timeline__title {
	font-size: 0.85rem;
	font-weight: 600;
	color: #495057;
	margin-bottom: 8px;
	cursor: pointer;
	user-select: none;
}
.bdw-history-timeline__title::before {
	content: '\25B6';
	display: inline-block;
	margin-right: 6px;
	font-size: 0.7rem;
	transition: transform 0.2s;
}
.bdw-history-timeline__title.open::before {
	transform: rotate(90deg);
}
.bdw-history-timeline__list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 300px;
	overflow-y: auto;
}
.bdw-history-timeline__item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f0;
	font-size: 0.82rem;
	line-height: 1.4;
}
.bdw-history-timeline__item:last-child {
	border-bottom: none;
}
.bdw-history-status {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
	margin-top: 4px;
}
.bdw-history-status--approved { background: #4C9F38; }
.bdw-history-status--pending  { background: #f5a623; }
.bdw-history-status--rejected { background: #E5243B; }
.bdw-history-status--superseded { background: #adb5bd; }
.bdw-history-timeline__details {
	flex: 1;
	min-width: 0;
}
.bdw-history-timeline__value {
	font-weight: 600;
	color: #212529;
}
.bdw-history-timeline__meta {
	color: #6c757d;
	font-size: 0.78rem;
}

/* ── Goals Grid (Bottom Section) ────────────────────────────────────────── */
.bdw-goals-section-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 40px;
	padding-bottom: 14px;
	border-bottom: 2px solid #e9ecef;
}

.bdw-goals-section-title h2 {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--bdw-navy);
}

.bdw-goals-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
	margin-top: 20px;
	align-items: stretch;
}

.bdw-goal-card {
	background: white;
	border-radius: 12px;
	padding: 18px 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	cursor: pointer;
	border: 1px solid #edf0f4;
	border-top: 4px solid var(--ods-color, #888);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.bdw-goal-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(30, 50, 112, 0.10);
	border-color: #dfe5ec;
}

.bdw-goal-card.is-active {
	border-top-width: 6px;
	box-shadow: 0 8px 28px rgba(30, 50, 112, 0.20);
	transform: translateY(-2px);
	border-color: var(--ods-color, var(--bdw-navy));
}

.bdw-goal-card.is-no-data .bdw-goal-card__bar {
	background: repeating-linear-gradient(
		45deg,
		#f1f3f5,
		#f1f3f5 4px,
		#e2e6ea 4px,
		#e2e6ea 8px
	);
}

.bdw-goal-card.is-no-data .bdw-goal-card__percentage {
	color: #adb5bd;
	font-weight: 500;
	font-size: 0.9rem;
}

.bdw-goal-card__header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 0;
}

.bdw-goal-card__icon {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	color: white;
	font-weight: 700;
	flex-shrink: 0;
	box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.bdw-goal-card__icon-prefix {
	font-size: 0.55rem;
	line-height: 1;
	letter-spacing: 0.04em;
	opacity: 0.88;
	font-weight: 600;
}

.bdw-goal-card__icon-num {
	font-size: 1rem;
	line-height: 1;
	font-weight: 900;
}

.bdw-goal-card__title {
	display: block;
	font-size: 0.92rem;
	font-weight: 600;
	color: #212529;
	margin: 0;
	line-height: 1.3;
}

/* Progress bar inside goal cards */
.bdw-goal-card__progress {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bdw-goal-card__bar {
	height: 6px;
	background: #f1f3f5;
	border-radius: 3px;
	overflow: hidden;
}

.bdw-goal-card__bar-fill {
	height: 100%;
	border-radius: 3px;
	transition: width 0.6s ease;
	min-width: 0;
}

.bdw-goal-card__score-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.bdw-goal-card__score {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 0;
}

.bdw-goal-card__percentage {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--bdw-navy);
}

.bdw-goal-card__mini-semaforo {
	display: flex;
	gap: 4px;
	align-items: center;
}

.bdw-goal-card__mini-semaforo span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.bdw-goal-card__meta {
	font-size: 0.78rem;
	color: #6c757d;
	padding-top: 8px;
	border-top: 1px solid #f1f3f5;
	margin-top: auto;
}

/* ── Mini Indicators List (Inside Cards) ─────────────────────────────────── */
.bdw-mini-indicators {
	list-style: none;
	padding: 0;
	margin: 15px 0 0 0;
	border-top: 1px solid #e9ecef;
	padding-top: 15px;
}

.bdw-mini-indicator {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	font-size: 0.9rem;
	border-bottom: 1px dashed #f1f3f5;
}

.bdw-mini-indicator:last-child {
	border-bottom: none;
}

.bdw-mini-name {
	flex: 1;
	color: #495057;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bdw-mini-value {
	font-weight: 600;
	color: #212529;
}

/* ── Overview Top Lists ─────────────────────────────────────────────────── */
.bdw-overview-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}

.bdw-overview-card {
	background: white;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
}

.bdw-overview-card h3 {
	font-size: 1.1rem;
	margin-bottom: 15px;
	padding-bottom: 10px;
	border-bottom: 1px solid #f1f3f5;
}

.bdw-top-list-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.bdw-top-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px dashed #f1f3f5;
}

.bdw-top-item:last-child {
	border-bottom: none;
}

.bdw-top-badge {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: 700;
	font-size: 0.85rem;
	flex-shrink: 0;
}

.bdw-top-name {
	flex: 1;
	font-size: 0.95rem;
	color: #495057;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bdw-top-score {
	font-weight: 700;
	font-size: 1rem;
}

.bdw-top-score--high {
	color: #2e7d32;
}

.bdw-top-score--low {
	color: #c62828;
}

/* ── Dashboard Chart Containers ─────────────────────────────────────────── */
.bdw-donut-chart {
	height: 250px;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── ODS Cards in Dashboard ─────────────────────────────────────────────── */
.bdw-ods-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
}

.bdw-ods-card {
	background: white;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
}

.bdw-ods-card-header {
	display: flex;
	align-items: center;
	gap: 15px;
	border-bottom: 2px solid;
	padding-bottom: 15px;
	margin-bottom: 15px;
}

.bdw-ods-card-icon {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: 700;
	font-size: 0.9rem;
	flex-shrink: 0;
}

.bdw-ods-card-header h4 {
	margin: 0;
	font-size: 1.1rem;
	line-height: 1.3;
}

.bdw-ods-card-score {
	display: flex;
	align-items: center;
	gap: 15px;
	margin-bottom: 10px;
}

.bdw-ods-card-score .bdw-progress {
	flex: 1;
	margin: 0;
}

.bdw-ods-card-score > span {
	font-weight: 700;
	font-size: 1.2rem;
	color: var(--bdw-navy);
	min-width: 60px;
	text-align: right;
}

.bdw-ods-card-meta {
	font-size: 0.85rem;
	color: #666;
	margin-bottom: 15px;
}

.bdw-ods-card-expand {
	width: 100%;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	padding: 10px;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 500;
	color: var(--bdw-navy);
	transition: all 0.2s ease;
}

.bdw-ods-card-expand:hover {
	background: #e9ecef;
}

.bdw-ods-card-indicators {
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px dashed #e9ecef;
}

/* ── Ranking Tab ────────────────────────────────────────────────────────── */
.bdw-ranking-controls {
	margin-bottom: 20px;
	display: flex;
	justify-content: flex-end;
}

.bdw-ranking-search {
	padding: 10px 15px;
	border: 1px solid #ced4da;
	border-radius: 6px;
	width: 100%;
	max-width: 350px;
	font-size: 1rem;
	transition: border-color 0.2s ease;
}

.bdw-ranking-search:focus {
	outline: none;
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.1);
}

.bdw-ranking-table-wrapper {
	background: white;
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
	overflow: hidden;
	overflow-x: auto;
}

.bdw-ranking-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	min-width: 600px;
}

.bdw-ranking-table th {
	background: #f8f9fa;
	color: #495057;
	font-weight: 600;
	padding: 15px 20px;
	border-bottom: 2px solid #e9ecef;
}

.bdw-ranking-table td {
	padding: 15px 20px;
	border-bottom: 1px solid #e9ecef;
	vertical-align: middle;
}

.bdw-ranking-table tr:last-child td {
	border-bottom: none;
}

.bdw-ranking-table tbody tr:hover {
	background: #f8f9fa;
}

.bdw-ranking-table a {
	font-weight: 600;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.bdw-modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 10000;
	justify-content: center;
	align-items: center;
	padding: 20px;
}

.bdw-modal-overlay.active {
	display: flex;
}

.bdw-modal {
	background: white;
	border-radius: 16px;
	width: 100%;
	max-width: 800px;
	max-height: 90vh;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: bdw-modal-in 0.3s ease;
}

@keyframes bdw-modal-in {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.bdw-modal__header {
	background: var(--bdw-navy);
	color: white;
	padding: 20px 25px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.bdw-modal__title {
	margin: 0;
	font-size: 1.3rem;
	color: white;
}

.bdw-modal__close {
	background: none;
	border: none;
	color: white;
	font-size: 1.8rem;
	cursor: pointer;
	padding: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background 0.2s;
}

.bdw-modal__close:hover {
	background: rgba(255, 255, 255, 0.2);
}

.bdw-modal__content {
	padding: 25px;
	overflow-y: auto;
}

.bdw-modal__chart-container {
	height: 350px;
	position: relative;
}

/* ── Map Section ──────────────────────────────────────────────────────────── */
.bdw-display-map-wrapper {
	background: white;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bdw-display-map-controls {
	display: flex;
	gap: 15px;
	margin-bottom: 20px;
	align-items: center;
	flex-wrap: wrap;
}

.bdw-display-map-controls label {
	font-weight: 600;
	color: var(--bdw-navy);
}

.bdw-display-map-controls select {
	padding: 8px 12px;
	border: 1px solid #dee2e6;
	border-radius: 6px;
	font-size: 0.9rem;
}

.bdw-display-map-container {
	border-radius: 10px;
	overflow: hidden;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.bdw-display-map-fallback {
	padding: 40px;
	text-align: center;
	color: #666;
}

/* ── Compare Section ──────────────────────────────────────────────────────── */
.bdw-compare-table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
	background: white;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #f1f3f5;
}

.bdw-compare-table th,
.bdw-compare-table td {
	padding: 15px 20px;
	text-align: left;
	border-bottom: 1px solid #e9ecef;
}

.bdw-compare-table th {
	background: #f8f9fa;
	color: #495057;
	font-weight: 600;
	border-bottom: 2px solid #e9ecef;
}

.bdw-compare-table tr:hover {
	background: #f8f9fa;
}

.bdw-compare-bar {
	display: flex;
	align-items: center;
	gap: 10px;
}

.bdw-compare-bar__fill {
	height: 20px;
	border-radius: 10px;
	min-width: 4px;
	transition: width 0.5s ease;
}

.bdw-compare-bar__value {
	font-weight: 600;
	min-width: 40px;
}

/* ── Accessibility ───────────────────────────────────────────────────────── */
.bdw-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

.bdw-wheel-sector:focus {
	outline: 3px solid #f5a623;
	outline-offset: 2px;
}

.bdw-target-tab:focus,
.bdw-history-btn:focus,
.bdw-year-btn:focus {
	outline: 2px solid #f5a623;
	outline-offset: 2px;
}

/* ── Indicator Detail Page ────────────────────────────────────────────────── */
.bdw-ods-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 20px;
	font-weight: 700;
	font-size: 0.9rem;
	margin-bottom: 15px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bdw-indicator-section {
	background: white;
	border-radius: 12px;
	padding: 30px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	margin-bottom: 30px;
}

.bdw-indicator-section h3 {
	margin-bottom: 20px;
	padding-bottom: 10px;
	border-bottom: 2px solid #f1f3f5;
}

.bdw-formula {
	display: block;
	background: #f8f9fa;
	padding: 15px;
	border-radius: 6px;
	border: 1px solid #e9ecef;
	font-family: monospace;
	white-space: pre-wrap;
	word-break: break-all;
}

.bdw-thresholds-box {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
}

.bdw-threshold-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 15px 20px;
	border-radius: 8px;
	background: #f8f9fa;
	font-weight: 500;
	flex: 1;
	min-width: 200px;
}

.bdw-ranking-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}

.bdw-ranking-top,
.bdw-ranking-bottom {
	background: #f8f9fa;
	padding: 20px;
	border-radius: 8px;
}

.bdw-ranking-top h4,
.bdw-ranking-bottom h4 {
	margin-bottom: 15px;
	color: #495057;
}

.bdw-ranking-top ol,
.bdw-ranking-bottom ol {
	padding-left: 20px;
	margin: 0;
}

.bdw-ranking-top li,
.bdw-ranking-bottom li {
	margin-bottom: 10px;
}

.bdw-evolution-chart {
	height: 400px;
	position: relative;
}

@media (max-width: 768px) {
	.bdw-ranking-columns {
		grid-template-columns: 1fr;
	}
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.bdw-display-wrapper {
		padding: 10px;
	}

	.bdw-municipality-header {
		padding: 20px;
	}

	.bdw-municipality-header__top {
		flex-direction: column;
	}

	.bdw-municipality-header h1 {
		font-size: 1.5rem;
	}

	.bdw-municipality-stats {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.bdw-municipality-stat {
		padding: 8px 10px;
	}

	.bdw-wheel-container {
		min-height: 300px;
	}

	.bdw-wheel-label {
		display: none;
	}

	.bdw-wheel-icon {
		display: none;
	}

	.bdw-goals-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.bdw-indicator-header {
		flex-direction: column;
		gap: 10px;
	}

	.bdw-thresholds {
		flex-direction: column;
		gap: 5px;
	}

	.bdw-modal {
		max-width: 100%;
		max-height: 95vh;
		margin: 10px;
	}

	.bdw-modal__header {
		padding: 15px 20px;
	}

	.bdw-modal__content {
		padding: 15px;
	}

	.bdw-modal__chart-container {
		height: 250px;
	}
}

@media (max-width: 480px) {
	.bdw-year-selector {
		justify-content: center;
	}

	.bdw-year-btn {
		padding: 6px 12px;
		font-size: 0.85rem;
	}

	.bdw-target-tabs {
		justify-content: center;
	}

	.bdw-panel-title {
		font-size: 1.2rem;
	}

	.bdw-municipality-stats {
		grid-template-columns: repeat(2, 1fr);
	}

	.bdw-goals-grid {
		grid-template-columns: 1fr;
	}

	.bdw-municipality-header h1 {
		font-size: 1.3rem;
	}
}

/* ── Entry Portal — Municipality Picker (searchable autocomplete) ──────── */
.bdw-entry-muni-picker {
	position: relative;
	width: 100%;
}

.bdw-entry-muni-search {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid #ced4da;
	border-radius: 6px;
	background: #fff;
	font-size: 0.95rem;
	color: #212529;
}

.bdw-entry-muni-search:focus-visible {
	outline: none;
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.18);
}

.bdw-entry-muni-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 50;
	max-height: 320px;
	overflow-y: auto;
	margin: 0;
	padding: 4px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #ced4da;
	border-radius: 6px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
}

.bdw-entry-muni-dropdown[hidden] {
	display: none;
}

.bdw-entry-muni-option {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 8px 12px;
	cursor: pointer;
	transition: background 0.12s;
}

.bdw-entry-muni-option:hover,
.bdw-entry-muni-option.is-active {
	background: #f1f3f5;
}

.bdw-entry-muni-name {
	font-weight: 500;
	color: #212529;
}

.bdw-entry-muni-code {
	font-size: 0.78rem;
	color: #6c757d;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	flex-shrink: 0;
}

.bdw-entry-muni-empty {
	padding: 10px 12px;
	color: #6c757d;
	font-style: italic;
	font-size: 0.88rem;
	cursor: default;
}

.bdw-entry-muni-empty--error {
	color: #b02a37;
	font-style: normal;
}

.bdw-entry-muni-empty--loading {
	color: var(--bdw-navy);
	font-style: normal;
}

.bdw-entry-muni-chip {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 8px;
	padding: 6px 10px;
	background: #e7f1ff;
	border: 1px solid #b6d4fe;
	border-radius: 6px;
	font-size: 0.9rem;
	color: #0a58ca;
}

.bdw-entry-muni-chip[hidden] {
	display: none;
}

.bdw-entry-muni-chip-code {
	color: #6c757d;
	font-weight: 400;
}

.bdw-entry-muni-chip-remove {
	background: transparent;
	border: 0;
	cursor: pointer;
	color: #6c757d;
	font-size: 1rem;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 4px;
}

.bdw-entry-muni-chip-remove:hover,
.bdw-entry-muni-chip-remove:focus-visible {
	background: rgba(10, 88, 202, 0.12);
	color: #0a58ca;
	outline: none;
}

/* ── Entry Portal — Goal Accordion ─────────────────────────────────────── */
.bdw-entry-goal {
	border: 1px solid #dee2e6;
	border-radius: 8px;
	margin-bottom: 12px;
	overflow: hidden;
}

.bdw-entry-goal-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #f8f9fa;
	cursor: pointer;
	user-select: none;
	transition: background 0.2s;
}

.bdw-entry-goal-header:hover {
	background: #e9ecef;
}

.bdw-entry-goal-icon {
	min-width: 36px;
	height: 36px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: 700;
	font-size: 0.75rem;
	text-align: center;
	flex-shrink: 0;
}

.bdw-entry-goal-name {
	flex: 1;
	margin: 0;
	font-size: 0.95rem;
	color: #212529;
}

.bdw-entry-goal-progress {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.8rem;
	color: #6c757d;
}

.bdw-entry-goal-count {
	white-space: nowrap;
}

.bdw-progress-mini {
	width: 60px;
	height: 6px;
	background: #dee2e6;
	border-radius: 3px;
	overflow: hidden;
}

.bdw-progress-mini .bdw-progress__bar {
	height: 100%;
	transition: width 0.3s ease;
}

.bdw-entry-goal-toggle {
	background: none;
	border: none;
	font-size: 0.85rem;
	color: #6c757d;
	cursor: pointer;
	padding: 4px;
	transition: transform 0.2s;
}

.bdw-entry-goal-toggle[aria-expanded="true"] {
	transform: rotate(180deg);
}

.bdw-entry-goal-body {
	padding: 16px;
	border-top: 1px solid #dee2e6;
}

/* ── Entry Portal — Indicator Cards ─────────────────────────────────────── */
.bdw-entry-indicators-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px;
}

.bdw-entry-indicator-card {
	background: #fff;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 14px;
	transition: box-shadow 0.2s;
}

.bdw-entry-indicator-card:hover {
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.bdw-entry-indicator-card.is-filled {
	border-left: 4px solid #4CAF50;
}

.bdw-entry-indicator-card.is-missing {
	border-left: 4px solid #9E9E9E;
}

/* Dirty indicator: card was modified and has unsaved changes. Wins over the
 * filled/missing color. The badge sits on the header line so the user can see
 * at a glance which cards will be sent on "Guardar todos los cambios". */
.bdw-entry-indicator-card.is-dirty {
	border-left-color: #f5a623;
	box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.35);
}
.bdw-entry-indicator-card.is-dirty .bdw-entry-ind-code::after {
	content: " •";
	color: #f5a623;
	font-weight: 700;
}

.bdw-entry-ind-header {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 8px;
}

.bdw-entry-ind-code {
	font-size: 0.7rem;
	font-weight: 700;
	color: #6c757d;
	background: #f0f0f0;
	padding: 2px 6px;
	border-radius: 4px;
	white-space: nowrap;
	flex-shrink: 0;
}

.bdw-entry-ind-name {
	margin: 0;
	font-size: 0.85rem;
	color: #212529;
	line-height: 1.3;
	flex: 1;
}

.bdw-entry-ind-body {
	margin-top: 10px;
}

.bdw-entry-hint,
.bdw-entry-source,
.bdw-entry-prev,
.bdw-entry-thresholds {
	display: block;
	font-size: 0.75rem;
	color: #6c757d;
	margin: 4px 0;
}

.bdw-entry-hint {
	font-style: italic;
}

.bdw-entry-meta {
	display: flex;
	gap: 10px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.bdw-form-group--inline {
	min-width: 110px;
}

.bdw-form-group--notes {
	flex: 1;
	min-width: 140px;
}

/* ── Entry Portal — "mira" icon: source / evidence URL / justificante ────── */
.bdw-entry-input-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.bdw-entry-input-row .bdw-entry-field {
	flex: 1 1 auto;
	min-width: 0;
}

.bdw-entry-extra-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 1.5px solid #1a56db;
	background: none;
	color: #1a56db;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.bdw-entry-extra-btn:hover,
.bdw-entry-extra-btn.active {
	background: #1a56db;
	color: #fff;
}

.bdw-entry-extra-fields {
	margin-top: 8px;
	padding: 8px;
	background: #f8fafc;
	border: 1px solid #dee2e6;
	border-radius: 6px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bdw-entry-extra-fields input.bdw-entry-field {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid #ced4da;
	border-radius: 4px;
	font-size: 12px;
}

.bdw-entry-draft-badge {
	font-size: 10px;
	color: #92540a;
	font-style: italic;
	white-space: nowrap;
}

.bdw-history-btn--secondary {
	background: #fff;
	color: #1a56db;
	border: 1.5px solid #1a56db;
}

.bdw-history-btn--secondary:hover {
	background: #e8f0fe;
}

/* ── Entry Portal — Toast ────────────────────────────────────────────────── */
.bdw-entry-toast {
	display: none;
	position: sticky;
	top: 10px;
	z-index: 200;
	padding: 10px 18px;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 500;
	margin-bottom: 12px;
	border: 1px solid transparent;
}

.bdw-entry-toast--success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.bdw-entry-toast--warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.bdw-entry-toast--error   { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.bdw-entry-toast--info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }

/* ── Indicator Rankings ──────────────────────────────────────────────────── */
.bdw-ranking-columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 600px) {
	.bdw-ranking-columns { grid-template-columns: 1fr; }
}

.bdw-ranking-top ol,
.bdw-ranking-bottom ol {
	padding: 0;
	margin: 0;
	list-style: none;
}

.bdw-ranking-top li,
.bdw-ranking-bottom li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid #f0f0f0;
	font-size: 0.88rem;
}

.bdw-ranking-pos {
	color: #6c757d;
	min-width: 22px;
	font-size: 0.8rem;
}

.bdw-ranking-name {
	flex: 1;
}

.bdw-ranking-value {
	font-weight: 700;
	color: var(--bdw-navy);
	white-space: nowrap;
}

/* ── Ranking table row - no data ─────────────────────────────────────────── */
.bdw-row--nodata td {
	color: #adb5bd;
}

/* ── Indicator section ──────────────────────────────────────────────────── */
.bdw-indicator-section {
	background: #fff;
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
}

/* ── Tooltip ────────────────────────────────────────────────────────────── */
.bdw-tooltip {
	position: absolute;
	background: var(--bdw-navy);
	color: white;
	padding: 10px 15px;
	border-radius: 8px;
	font-size: 0.9rem;
	pointer-events: none;
	z-index: 10000;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	max-width: 250px;
	text-align: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transform: translateY(10px);
}

.bdw-tooltip.visible {
	opacity: 1;
	transform: translateY(0);
}

.bdw-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--bdw-navy);
}
.bdw-comparator-section,.bdw-embed-config,.bdw-search-section,.bdw-embed-preview,.bdw-embed-code{background:#fff;border-radius:12px;padding:20px;box-shadow:0 4px 12px rgba(0,0,0,.05);border:1px solid #f1f3f5;margin-bottom:20px;}

/* ── Search page ────────────────────────────────────────────────────── */
.bdw-search-bar-wrap { margin: 20px 0; }
.bdw-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 40px;
    padding: 8px 20px;
    transition: border-color 0.2s;
}
.bdw-search-bar:focus-within { border-color: var(--bdw-navy); box-shadow: 0 0 0 3px rgba(30,50,112,.1); }
.bdw-search-icon { font-size: 1.2rem; }
.bdw-search-input.bdw-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
}
.bdw-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #999;
    padding: 2px 6px;
    border-radius: 50%;
    transition: background 0.15s;
}
.bdw-search-clear:hover { background: #f1f3f5; color: #333; }
.bdw-search-total { color: #666; font-size: 0.9rem; margin-bottom: 16px; }
.bdw-search-section { margin-bottom: 24px; }
.bdw-search-section-title { font-size: 1rem; color: var(--bdw-navy); border-bottom: 2px solid #f1f3f5; padding-bottom: 8px; margin-bottom: 12px; }
.bdw-search-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bdw-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.15s;
}
.bdw-search-item:hover { background: #e9f0fb; }
.bdw-search-item-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; width: 100%; }
.bdw-search-item-name { flex: 1; font-weight: 500; }
.bdw-search-item-meta { font-size: 0.8rem; color: #888; }
.bdw-search-item mark { background: #fff3cd; padding: 0 2px; border-radius: 2px; }
.bdw-goal-badge[data-goal] {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 52px; padding: 3px 8px; border-radius: 6px;
    color: #fff; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
    background: var(--bdw-navy);
}
/* Per-goal ODS official colors */
.bdw-goal-badge[data-goal="1"]  { background: #E5243B; }
.bdw-goal-badge[data-goal="2"]  { background: #DDA63A; }
.bdw-goal-badge[data-goal="3"]  { background: #4C9F38; }
.bdw-goal-badge[data-goal="4"]  { background: #C5192D; }
.bdw-goal-badge[data-goal="5"]  { background: #FF3A21; }
.bdw-goal-badge[data-goal="6"]  { background: #26BDE2; }
.bdw-goal-badge[data-goal="7"]  { background: #FCC30B; color: #333; }
.bdw-goal-badge[data-goal="8"]  { background: #A21942; }
.bdw-goal-badge[data-goal="9"]  { background: #FD6925; }
.bdw-goal-badge[data-goal="10"] { background: #DD1367; }
.bdw-goal-badge[data-goal="11"] { background: #FD9D24; color: #333; }
.bdw-goal-badge[data-goal="12"] { background: #BF8B2E; }
.bdw-goal-badge[data-goal="13"] { background: #3F7E44; }
.bdw-goal-badge[data-goal="14"] { background: #0A97D9; }
.bdw-goal-badge[data-goal="15"] { background: #56C02B; }
.bdw-goal-badge[data-goal="16"] { background: #00689D; }
.bdw-goal-badge[data-goal="17"] { background: #19486A; }
.bdw-goal-badge[data-goal="18"] { background: #6B4C9A; }
.bdw-goal-badge[data-goal="19"] { background: #2E8B57; }
.bdw-goal-badge[data-goal="20"] { background: #D4622A; }
.bdw-goal-badge[data-goal="21"] { background: #1B6CA8; }
.bdw-search-placeholder { text-align: center; color: #999; padding: 40px 20px; }

/* ── Mobile ODS wheel fallback ──────────────────────────────────────── */
.bdw-wheel-mobile-list { display: none; }
@media (max-width: 640px) {
    .bdw-wheel-svg { display: none; }
    .bdw-wheel-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 0;
        margin: 0;
        list-style: none;
    }
    .bdw-wheel-mobile-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        border-radius: 10px;
        cursor: pointer;
        transition: filter 0.15s, transform 0.1s;
    }
    .bdw-wheel-mobile-item:hover { filter: brightness(1.07); }
    .bdw-wheel-mobile-item.active { outline: 3px solid var(--bdw-navy); }
    .bdw-wheel-mobile-badge {
        min-width: 48px;
        text-align: center;
        padding: 4px 8px;
        border-radius: 6px;
        color: #fff;
        font-weight: 700;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    .bdw-wheel-mobile-name { font-size: 0.9rem; font-weight: 500; flex: 1; }
    .bdw-wheel-mobile-meta { font-size: 0.8rem; color: #555; font-weight: 500; }
}
.bdw-comparator-config,.bdw-embed-config{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-end;}
.bdw-form-group{display:flex;flex-direction:column;gap:6px;min-width:200px;}
.bdw-form-group label{font-weight:600;color:var(--bdw-navy);}
.bdw-select,.bdw-search-input,.bdw-embed-textarea{padding:10px 12px;border:1px solid #ced4da;border-radius:6px;background:#fff;font-size:14px;}
.bdw-btn,.bdw-btn-primary{background:var(--bdw-navy);color:#fff;border:none;border-radius:6px;padding:10px 14px;cursor:pointer;font-weight:600;}
.bdw-btn-primary:hover{background:#2a4580;}
.bdw-muni-pills{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;}
.bdw-pill{display:inline-flex;gap:6px;align-items:center;background:#e8f4fd;border:1px solid #b3d9f5;padding:5px 10px;border-radius:999px;font-size:12px;}
.bdw-pill-remove{background:none;border:none;cursor:pointer;color:#dc3232;font-size:16px;line-height:1;}
/* Vistoria 2026-09-16: el reset global de <button> del tema (Hello Elementor
 * reset.css: padding 8px 16px, border-radius 3px, display:block…) se colaba
 * en la "×" de los chips y la sacaba de la cápsula. Dimensiones explícitas y
 * con más especificidad que el reset del tema. */
.bdw-display-wrapper .bdw-pill{white-space:nowrap;}
.bdw-display-wrapper .bdw-pill .bdw-pill-remove{
	display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;
	width:20px;height:20px;min-height:0;min-width:0;padding:0;margin:0;
	border:0;border-radius:50%;background:transparent;color:#dc3232;
	font-size:16px;line-height:1;font-weight:700;box-sizing:border-box;
}
.bdw-display-wrapper .bdw-pill .bdw-pill-remove:hover{background:rgba(220,50,50,.12);}
.bdw-toast{position:sticky;top:12px;z-index:999;background:var(--bdw-navy);color:#fff;padding:10px 14px;border-radius:8px;margin-bottom:10px;}
.bdw-toast--success{background:#2e7d32}.bdw-toast--warning{background:#e89b1a}.bdw-toast--error{background:#c62828}.bdw-toast--info{background:var(--bdw-navy)}
.bdw-search-list{list-style:none;padding:0;margin:0}.bdw-search-list li{padding:8px 0;border-bottom:1px solid #f0f0f0}.bdw-search-result{display:flex;gap:10px;align-items:center}.bdw-search-result-badge,.bdw-search-result-code{display:inline-block;background:#f0f0f0;padding:2px 6px;border-radius:4px;font-size:12px;font-weight:700}
.bdw-embed-textarea{width:100%;min-height:120px;font-family:monospace}

/* ────────────────────────────────────────────────────────────────────────
 * UX/UI polish — v3.1.3
 * Accessibility (focus-visible, reduced motion), contrast, scroll hints.
 * Kept in a single block at the end so existing specificity is preserved.
 * ──────────────────────────────────────────────────────────────────────── */

/* Focus-visible for all primary interactive controls.
 * Using :focus-visible avoids showing the outline on mouse click while
 * still giving keyboard users a clear indicator. */
.bdw-display-wrapper .bdw-tab-btn:focus-visible,
.bdw-display-wrapper .bdw-target-tab:focus-visible,
.bdw-display-wrapper .bdw-history-btn:focus-visible,
.bdw-display-wrapper .bdw-year-btn:focus-visible,
.bdw-display-wrapper .bdw-mode-btn:focus-visible,
.bdw-display-wrapper .bdw-goal-card:focus-visible,
.bdw-display-wrapper .bdw-ods-card-expand:focus-visible,
.bdw-display-wrapper .bdw-entry-goal-header:focus-visible,
.bdw-display-wrapper .bdw-entry-goal-toggle:focus-visible,
.bdw-display-wrapper .bdw-pill-remove:focus-visible,
.bdw-display-wrapper .bdw-btn:focus-visible,
.bdw-display-wrapper .bdw-btn-primary:focus-visible,
.bdw-display-wrapper .bdw-btn-secondary:focus-visible,
.bdw-display-wrapper .bdw-wheel-mobile-item:focus-visible,
.bdw-display-wrapper .bdw-search-item-link:focus-visible,
.bdw-display-wrapper .bdw-search-clear:focus-visible,
.bdw-modal__close:focus-visible,
.bdw-breadcrumb-link:focus-visible {
	outline: 2px solid #f5a623;
	outline-offset: 2px;
	border-radius: 4px;
}

/* Form inputs use a softer ring (inner shadow) to match native patterns. */
.bdw-display-wrapper .bdw-select:focus-visible,
.bdw-display-wrapper .bdw-search-input:focus-visible,
.bdw-display-wrapper .bdw-entry-field:focus-visible,
.bdw-display-wrapper .bdw-ranking-search:focus-visible {
	outline: none;
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.18);
}

/* Goal cards and mobile wheel items behave as buttons → make clear they are
 * interactive for keyboard users, and prevent the text being selected on
 * double-click which is confusing. */
.bdw-goal-card,
.bdw-wheel-mobile-item {
	user-select: none;
}

/* Darken muted text for WCAG AA. Existing templates use .bdw-no-data for
 * "sin datos" copy which was previously #999 (fails AA on white). */
.bdw-no-data {
	color: #6c757d;
}

/* Thin scrollbar on tables that may overflow on narrow screens. */
.bdw-ranking-table-wrapper,
.bdw-compare-table-wrap {
	scrollbar-width: thin;
}

/* Year selector: scrollable on narrow screens, preserving wrap on desktop. */
@media (max-width: 640px) {
	.bdw-year-selector {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
		padding: 14px;
		/* Vistoria 2026-09-16 (móvil): con `justify-content:center` (regla
		 * ≤480px) y overflow, la fila centra su contenido desbordado y el
		 * primer botón ("✦ Datos actuales") queda cortado por la izquierda,
		 * sin poder hacer scroll hasta él. Un carrusel siempre empieza a la
		 * izquierda. */
		justify-content: flex-start;
	}
	.bdw-year-selector .bdw-year-btn {
		flex: 0 0 auto;
	}
}

/* Responsive indicators list: drop fixed height on mobile so content flows. */
@media (max-width: 768px) {
	.bdw-indicators-list {
		max-height: none;
		overflow-y: visible;
		padding-right: 0;
	}
}

/* Sticky toast in the entry portal: convert to a fixed banner on small
 * screens so it is never clipped by a scrolling ancestor. */
@media (max-width: 768px) {
	.bdw-entry-toast {
		position: fixed;
		left: 10px;
		right: 10px;
		top: auto;
		bottom: 10px;
		z-index: 1000;
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
	}
}

/* Disabled state for buttons (save batch, compare, export). */
.bdw-display-wrapper button[disabled],
.bdw-display-wrapper .bdw-btn[disabled],
.bdw-display-wrapper .bdw-btn-primary[disabled],
.bdw-display-wrapper .bdw-btn-secondary[disabled],
.bdw-display-wrapper .bdw-history-btn[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
	pointer-events: none;
}

/* Print-action button in the municipality header. */
.bdw-municipality-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
	align-self: flex-start;
}
.bdw-municipality-actions .bdw-action-btn {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 0.85rem;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
.bdw-municipality-actions .bdw-action-btn:hover,
.bdw-municipality-actions .bdw-action-btn:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	border-color: rgba(255, 255, 255, 0.55);
	text-decoration: none;
	color: #fff;
}
@media (max-width: 640px) {
	.bdw-municipality-actions {
		margin-top: 10px;
		justify-content: flex-start;
	}
}

/* Respect users who prefer reduced motion: disable non-essential animations,
 * keep opacity transitions for state changes. */
@media (prefers-reduced-motion: reduce) {
	.bdw-display-wrapper *,
	.bdw-display-wrapper *::before,
	.bdw-display-wrapper *::after,
	.bdw-modal *,
	.bdw-tooltip {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
	.bdw-display-loading::after {
		animation: none !important;
		/* Replace the spinner with a static dot so "loading" stays visible. */
		border-right-color: var(--bdw-navy);
	}
}

/* ────────────────────────────────────────────────────────────────────────
 * Frontend UX polish — v3.3.2
 * Small, additive improvements for shortcode widgets and Elementor embeds.
 * ──────────────────────────────────────────────────────────────────────── */

.bdw-display-wrapper {
	--bdw-color-primary: var(--bdw-navy);
	--bdw-color-primary-soft: #edf2ff;
	--bdw-color-gold: #f5a623;
	--bdw-color-text: #212529;
	--bdw-color-muted: #5f6b7a;
	--bdw-color-border: #dfe5ec;
	--bdw-color-surface: #ffffff;
	--bdw-color-subtle: #f7f9fc;
	--bdw-shadow-soft: 0 10px 26px rgba(30, 50, 112, 0.08);
	--bdw-radius: 12px;
}

.bdw-display-wrapper input,
.bdw-display-wrapper select,
.bdw-display-wrapper button,
.bdw-display-wrapper textarea {
	font: inherit;
}

.bdw-helper-text,
.bdw-hint {
	display: block;
	color: var(--bdw-color-muted);
	font-size: 0.92rem;
	line-height: 1.55;
	margin: -4px 0 14px;
}

.bdw-display-wrapper .bdw-comparator-section,
.bdw-display-wrapper .bdw-search-section,
.bdw-display-wrapper .bdw-embed-preview,
.bdw-display-wrapper .bdw-embed-code,
.bdw-display-wrapper .bdw-indicator-section {
	border-color: var(--bdw-color-border);
	box-shadow: var(--bdw-shadow-soft);
}

.bdw-comparator-search {
	display: grid;
	grid-template-columns: minmax(220px, 1fr) auto;
	gap: 10px;
	align-items: stretch;
}

.bdw-comparator-search .bdw-search-input {
	width: 100%;
	min-height: 44px;
}

.bdw-muni-pills {
	min-height: 34px;
}

.bdw-pill {
	background: var(--bdw-color-primary-soft);
	border-color: #c9d6f5;
	color: var(--bdw-color-primary);
	font-weight: 700;
}

.bdw-comparator-modes,
.bdw-comparator-actions,
.bdw-evolution-range {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin: 18px 0;
}

.bdw-comparator-modes {
	padding: 6px;
	border: 1px solid var(--bdw-color-border);
	border-radius: 999px;
	background: var(--bdw-color-surface);
	width: fit-content;
	box-shadow: 0 6px 18px rgba(30, 50, 112, 0.06);
}

.bdw-mode-btn {
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--bdw-color-primary);
	cursor: pointer;
	font-weight: 800;
	padding: 9px 16px;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bdw-mode-btn:hover,
.bdw-mode-btn.active {
	background: var(--bdw-color-primary);
	color: #ffffff;
	text-decoration: none;
}

.bdw-mode-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.bdw-mode-btn:disabled:hover {
	background: transparent;
	color: var(--bdw-color-primary);
}

.bdw-evolution-range {
	padding: 14px;
	border: 1px solid var(--bdw-color-border);
	border-radius: var(--bdw-radius);
	background: var(--bdw-color-subtle);
}

.bdw-evolution-range label {
	color: var(--bdw-color-primary);
	font-weight: 800;
}

.bdw-evolution-range select {
	min-height: 40px;
	border: 1px solid var(--bdw-color-border);
	border-radius: 8px;
	background: #ffffff;
	padding: 8px 10px;
}

.bdw-comparator-actions {
	padding-top: 4px;
}

.bdw-display-wrapper .bdw-btn,
.bdw-display-wrapper .bdw-btn-primary,
.bdw-display-wrapper .bdw-btn-secondary {
	min-height: 42px;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-decoration: none;
}

.bdw-display-wrapper .bdw-btn-secondary {
	background: #ffffff;
	border: 1px solid var(--bdw-color-border);
	color: var(--bdw-color-primary);
}

.bdw-display-wrapper .bdw-btn-secondary:hover {
	background: var(--bdw-color-primary-soft);
	text-decoration: none;
}

.bdw-empty-state {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 20px;
	align-items: start;
	margin: 24px 0;
	padding: 28px;
	border: 1px solid var(--bdw-color-border);
	border-radius: var(--bdw-radius);
	background: linear-gradient(180deg, #ffffff 0%, var(--bdw-color-subtle) 100%);
	box-shadow: var(--bdw-shadow-soft);
}

.bdw-empty-state-icon {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--bdw-color-primary);
	color: #ffffff;
	font-size: 1.35rem;
	font-weight: 900;
	line-height: 1;
}

.bdw-empty-state h2 {
	margin: 0 0 8px;
	color: var(--bdw-color-primary);
	font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.bdw-empty-state p {
	margin: 0;
	color: var(--bdw-color-muted);
	max-width: 760px;
}

.bdw-empty-state-list {
	display: grid;
	gap: 6px;
	margin: 16px 0 0;
	padding-left: 20px;
	color: var(--bdw-color-text);
}

.bdw-entry-goal-header[role="button"] {
	cursor: pointer;
}

.bdw-entry-goal-toggle {
	min-width: 36px;
	min-height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}

.bdw-entry-goal-header[aria-expanded="true"] .bdw-entry-goal-toggle {
	transform: rotate(180deg);
}

.bdw-dashboard-tabs {
	gap: 4px;
}

.bdw-tab-btn {
	min-height: 42px;
}

.bdw-search-result,
.bdw-search-list li {
	border-radius: 8px;
	transition: background 0.15s ease, transform 0.15s ease;
}

.bdw-search-list li:hover {
	background: var(--bdw-color-subtle);
	transform: translateX(2px);
}

.bdw-display-wrapper .bdw-display-loading,
.bdw-display-wrapper .bdw-display-empty {
	min-height: 160px;
}

@media (max-width: 768px) {
	.bdw-display-wrapper {
		padding: 14px;
	}

	.bdw-comparator-search,
	.bdw-empty-state {
		grid-template-columns: 1fr;
	}

	.bdw-comparator-modes {
		width: 100%;
		border-radius: var(--bdw-radius);
	}

	.bdw-mode-btn {
		flex: 1 1 140px;
	}

	.bdw-comparator-actions .bdw-btn,
	.bdw-comparator-actions .bdw-btn-primary,
	.bdw-comparator-actions .bdw-btn-secondary,
	.bdw-comparator-search .bdw-btn,
	.bdw-comparator-search .bdw-btn-primary {
		width: 100%;
	}

	.bdw-evolution-range select {
		flex: 1 1 120px;
	}
}

@media (max-width: 640px) {
	.bdw-dashboard-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
		padding-bottom: 4px;
	}

	.bdw-dashboard-tabs .bdw-tab-btn {
		flex: 0 0 auto;
		white-space: nowrap;
	}
}

/* ── Header: "Dato más reciente" badge ──────────────────────────────────── */
.bdw-municipality-stats-notice {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0 4px;
	margin-top: 10px;
}

.bdw-latest-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.32);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	padding: 3px 10px;
	border-radius: 20px;
}

/* ── Evolución Demográfica — Section title ──────────────────────────────── */
.bdw-demographics-section-title {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 1400px;
	margin: 40px auto 0;
	padding: 0 20px 10px;
	border-bottom: 2px solid #e9ecef;
}

.bdw-demographics-section-title h2 {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--bdw-navy);
}

/* ── Demographics container ─────────────────────────────────────────────── */
.bdw-demographics-detail {
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px 20px 40px;
}

/* ── Demographics year selector ─────────────────────────────────────────── */
.bdw-demog-year-selector {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 24px;
	padding: 12px 16px;
	background: #f0f3f8;
	border-radius: 10px;
}

.bdw-demog-year-selector label {
	font-weight: 600;
	color: var(--bdw-navy);
	font-size: 0.9rem;
	margin-right: 4px;
}

@media (max-width: 640px) {
	.bdw-demog-year-selector {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}
	.bdw-demog-year-selector .bdw-year-btn {
		flex: 0 0 auto;
	}
}

/* ── Category block ─────────────────────────────────────────────────────── */
.bdw-demog-category {
	margin-bottom: 20px;
	border: 1px solid #e4e8ef;
	border-radius: 12px;
	overflow: hidden;
}

.bdw-demog-category__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	background: #f0f3f8;
	cursor: pointer;
	user-select: none;
	transition: background 0.15s ease;
}

.bdw-demog-category__header:hover {
	background: #e4eaf5;
}

.bdw-demog-category__header:focus-visible {
	outline: 2px solid var(--bdw-navy);
	outline-offset: -2px;
}

.bdw-demog-category__icon {
	font-size: 1.1rem;
	line-height: 1;
}

.bdw-demog-category__label {
	flex: 1;
	font-weight: 700;
	color: var(--bdw-navy);
	font-size: 0.95rem;
}

.bdw-demog-category__toggle {
	font-size: 1rem;
	color: var(--bdw-navy);
	transition: transform 0.2s ease;
}

.bdw-demog-category__header[aria-expanded="false"] .bdw-demog-category__toggle {
	transform: rotate(-90deg);
}

.bdw-demog-category__body {
	padding: 16px;
	background: #fff;
	transition: none;
}

.bdw-demog-category__body.is-collapsed {
	display: none;
}

/* ── Indicators grid ────────────────────────────────────────────────────── */
.bdw-demog-indicators-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
	gap: 14px;
}

/* ── Single indicator card ──────────────────────────────────────────────── */
.bdw-demog-indicator {
	background: #f8f9fa;
	border: 1px solid #e4e8ef;
	border-radius: 10px;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	transition: box-shadow 0.15s ease;
}

.bdw-demog-indicator:hover {
	box-shadow: 0 2px 10px rgba(30, 50, 112, 0.1);
}

.bdw-demog-indicator__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 6px;
}

.bdw-demog-indicator__label {
	font-size: 0.8rem;
	color: #495057;
	line-height: 1.35;
	flex: 1;
}

.bdw-demog-indicator__year {
	font-size: 0.72rem;
	color: #6c757d;
	background: #e9ecef;
	padding: 1px 6px;
	border-radius: 10px;
	white-space: nowrap;
	flex-shrink: 0;
}

.bdw-demog-indicator__value {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--bdw-navy);
	line-height: 1.2;
}

.bdw-demog-indicator__value small {
	font-size: 0.75rem;
	font-weight: 500;
	color: #6c757d;
	margin-left: 2px;
}

/* Chart wrapper — only present in .has-chart cards */
.bdw-demog-indicator__chart-wrap {
	margin-top: 8px;
	height: 110px;
	position: relative;
}

.bdw-demog-chart {
	width: 100% !important;
	height: 100% !important;
}

/* ── Evidence links in submission timeline ──────────────────────────────── */
.bdw-evidence-link {
	font-size: 0.72rem;
	color: var(--bdw-navy);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.bdw-demog-indicators-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
	}
}

@media (max-width: 480px) {
	.bdw-demog-indicators-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.bdw-demog-category__header {
		padding: 12px 14px;
	}

	.bdw-demog-category__body {
		padding: 12px;
	}
}

/* ══════════════════════════════════════════════════════════════════════════
   Comparativa entre municipios
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Section title ───────────────────────────────────────────────────────── */
.bdw-compare-section-title {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 1400px;
	margin: 48px auto 0;
	padding: 0 20px 12px;
	border-bottom: 2px solid #e9ecef;
}

.bdw-compare-section-title h2 {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 800;
	color: var(--bdw-navy);
	letter-spacing: -0.01em;
}

/* ── Outer container ─────────────────────────────────────────────────────── */
.bdw-compare-detail {
	max-width: 1400px;
	margin: 0 auto;
	padding: 28px 20px 64px;
}

/* ── Main UI card ────────────────────────────────────────────────────────── */
.bdw-compare-ui {
	background: #fff;
	border: 1px solid #e8edf7;
	border-radius: 16px;
	padding: 28px 28px 32px;
	box-shadow: 0 2px 12px rgba(30, 50, 112, 0.06);
}

/* ── Type tabs (segmented control) ──────────────────────────────────────── */
.bdw-compare-type-tabs {
	display: inline-flex;
	gap: 0;
	margin-bottom: 28px;
	background: #f0f4fb;
	border-radius: 28px;
	padding: 4px;
	border: 1px solid #e0e8f5;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.bdw-compare-type-tab {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 22px;
	border: none;
	border-radius: 22px;
	background: transparent;
	color: var(--bdw-text-muted);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, box-shadow 0.2s;
	white-space: nowrap;
	letter-spacing: 0.01em;
}

.bdw-compare-type-tab:hover:not(.active) {
	color: var(--bdw-navy);
	background: rgba(30, 50, 112, 0.06);
}

.bdw-compare-type-tab.active {
	background: #fff;
	color: var(--bdw-navy);
	box-shadow: 0 2px 8px rgba(30, 50, 112, 0.15);
}

/* ── Controls grid ───────────────────────────────────────────────────────── */
.bdw-compare-controls {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-bottom: 28px;
}

@media (max-width: 700px) {
	.bdw-compare-controls {
		grid-template-columns: 1fr;
	}
}

.bdw-compare-col {
	background: #f8faff;
	border: 1px solid #e8edf7;
	border-radius: 12px;
	padding: 18px 20px;
}

.bdw-compare-label {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 0.78rem;
	font-weight: 700;
	color: #3a4460;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 12px;
}

.bdw-compare-label-hint {
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
	color: var(--bdw-text-hint);
	font-size: 0.8rem;
}

/* ── Indicator select ────────────────────────────────────────────────────── */
.bdw-compare-indicator-panel {
	position: relative;
}

.bdw-compare-select {
	width: 100%;
	padding: 10px 36px 10px 14px;
	border: 1.5px solid #d0d7e3;
	border-radius: 8px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
	background-size: 16px;
	font-size: 0.9rem;
	color: var(--bdw-text-body);
	cursor: pointer;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
	appearance: none;
	-webkit-appearance: none;
}

.bdw-compare-select:focus {
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.1);
}

/* ── Municipality search ─────────────────────────────────────────────────── */
.bdw-compare-muni-wrap,
.bdw-compare-ods-wrap {
	position: relative;
}

.bdw-compare-muni-input {
	width: 100%;
	padding: 10px 14px 10px 42px;
	border: 1.5px solid #d0d7e3;
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--bdw-text-body);
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
	box-sizing: border-box;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab8cc' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 13px center;
	background-size: 16px;
}

.bdw-compare-muni-input:focus {
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.1);
}

.bdw-compare-muni-input:disabled {
	background-color: #f4f6fa;
	color: #999;
	cursor: not-allowed;
}

/* ── Autocomplete dropdown ───────────────────────────────────────────────── */
.bdw-compare-suggestions {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #d0d7e3;
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0,0,0,0.1);
	z-index: 200;
	list-style: none;
	margin: 0;
	padding: 4px 0;
	max-height: 240px;
	overflow-y: auto;
}

.bdw-compare-suggestion {
	padding: 10px 14px;
	font-size: 0.88rem;
	cursor: pointer;
	color: var(--bdw-text-body);
	border-radius: 6px;
	margin: 0 4px;
	transition: background 0.1s;
}

.bdw-compare-suggestion:hover,
.bdw-compare-suggestion:focus {
	background: #f0f4fb;
	color: var(--bdw-navy);
	outline: none;
}

.bdw-compare-suggestion small {
	color: var(--bdw-text-hint);
	font-size: 0.78rem;
	margin-left: 4px;
}

/* ── Chips ───────────────────────────────────────────────────────────────── */
.bdw-compare-chips,
#bdw-compare-ods-selected {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
	min-height: 34px;
}

.bdw-compare-chip {
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 5px 5px 5px 12px;
	background: #e8edf7;
	border-radius: 20px;
	font-size: 0.82rem;
	color: var(--bdw-navy);
	font-weight: 600;
	border: 1px solid rgba(30, 50, 112, 0.1);
	max-width: min(220px, 100%);
}

.bdw-compare-chip--base {
	background: var(--bdw-navy);
	color: #fff;
	border-color: transparent;
	padding-right: 14px;
}

.bdw-compare-chip--ods {
	background: #d4e6f1;
	color: var(--bdw-navy);
	max-width: 100%;
	white-space: normal;
	border-color: rgba(30, 80, 150, 0.15);
}

.bdw-compare-chip__x {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.1);
	border: none;
	cursor: pointer;
	font-size: 0.75rem;
	line-height: 1;
	padding: 0;
	color: inherit;
	margin-left: 6px;
	transition: background 0.12s;
}

.bdw-compare-chip--base .bdw-compare-chip__x {
	background: rgba(255, 255, 255, 0.2);
}

.bdw-compare-chip__x:hover {
	background: rgba(0, 0, 0, 0.2);
}

.bdw-compare-chip--base .bdw-compare-chip__x:hover {
	background: rgba(255, 255, 255, 0.35);
}

/* ── ODS search wrap ─────────────────────────────────────────────────────── */
.bdw-compare-ods-wrap {
	position: relative;
}

/* ── Missing-data notice ─────────────────────────────────────────────────── */
.bdw-compare-missing-notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 11px 16px;
	background: #fffbf0;
	border: 1px solid #e8c84a;
	border-radius: 8px;
	color: #6b4e00;
	font-size: 0.85rem;
	line-height: 1.5;
	margin-bottom: 16px;
}

.bdw-compare-missing-notice__icon {
	font-size: 1rem;
	flex-shrink: 0;
	margin-top: 1px;
}

.bdw-compare-table__missing td {
	opacity: 0.55;
	font-style: italic;
}

.bdw-compare-no-data-label {
	font-style: italic;
	color: #aab4c0;
	font-size: 0.82rem;
}

/* ── Hint banner ─────────────────────────────────────────────────────────── */
.bdw-compare-hint {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 22px 24px;
	background: #f8f9ff;
	border: 1.5px dashed #c8d4ea;
	border-radius: 12px;
	color: #5a6a8a;
	font-size: 0.9rem;
	line-height: 1.55;
}

.bdw-compare-hint-icon {
	font-size: 1.8rem;
	flex-shrink: 0;
	line-height: 1;
}

.bdw-compare-hint-sm {
	font-size: 0.85rem;
	color: #888;
	margin: 4px 0 0;
}

/* ── Results ─────────────────────────────────────────────────────────────── */
.bdw-compare-results-header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
	padding-bottom: 14px;
	border-bottom: 2px solid #e9ecef;
}

.bdw-compare-results-title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 800;
	color: var(--bdw-navy);
	letter-spacing: -0.01em;
}

.bdw-compare-unit-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 8px;
	background: #e8edf7;
	border-radius: 12px;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--bdw-navy);
	vertical-align: middle;
}

/* ── Color-mode switch + compliance legend ───────────────────────────────── */
.bdw-compare-colorswitch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
	flex-wrap: wrap;
}
.bdw-compare-colorswitch-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: #6c757d;
}
.bdw-compare-colorswitch-track {
	display: inline-flex;
	background: #eef1f6;
	border: 1px solid #dce1ea;
	border-radius: 999px;
	padding: 3px;
	gap: 2px;
}
.bdw-compare-colorswitch-btn {
	appearance: none;
	border: 0;
	background: transparent;
	cursor: pointer;
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #6c757d;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
}
.bdw-compare-colorswitch-btn:hover { color: var(--bdw-color-primary, #19486A); }
.bdw-compare-colorswitch-btn.is-active {
	background: #fff;
	color: var(--bdw-color-primary, #19486A);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.bdw-compare-colorswitch-btn:focus-visible {
	outline: 2px solid var(--bdw-color-primary, #19486A);
	outline-offset: 2px;
}
.bdw-compare-compliance-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin: -12px 0 20px;
	font-size: 0.82rem;
	color: #556;
}
.bdw-compare-compliance-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bdw-compare-compliance-legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Chart canvas ────────────────────────────────────────────────────────── */
.bdw-compare-chart-wrap {
	position: relative;
	margin-bottom: 24px;
	padding: 16px;
	background: #f8faff;
	border-radius: 10px;
	min-height: 120px;
}

.bdw-compare-chart {
	width: 100% !important;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.bdw-compare-table-wrap {
	overflow: auto;
	border: 1px solid #e9ecef;
	border-radius: 10px;
}

.bdw-compare-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88rem;
}

.bdw-compare-table th,
.bdw-compare-table td {
	padding: 11px 16px;
	text-align: left;
	border-bottom: 1px solid #e9ecef;
}

.bdw-compare-table th {
	font-weight: 700;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #fff;
	background: var(--bdw-navy);
	white-space: nowrap;
	border-bottom: none;
}

.bdw-compare-table tbody tr:last-child td {
	border-bottom: none;
}

.bdw-compare-table tbody tr:nth-child(even) td {
	background: #f8f9ff;
}

.bdw-compare-table tbody tr:hover td {
	background: #f0f4fb;
}

.bdw-compare-table__base td {
	background: #eef1f9 !important;
	font-weight: 700;
}

.bdw-compare-table__base:hover td {
	background: #e4e9f4 !important;
}

.bdw-compare-table__val {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.bdw-compare-base-badge {
	display: inline-block;
	font-size: 0.7rem;
	color: #fff;
	background: var(--bdw-navy);
	border-radius: 10px;
	padding: 2px 8px;
	margin-left: 6px;
	font-weight: 700;
	vertical-align: middle;
}

/* ── Print row ───────────────────────────────────────────────────────────── */
.bdw-compare-print-row {
	display: flex;
	justify-content: flex-end;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #e9ecef;
}

.bdw-compare-print-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 22px;
	background: var(--bdw-navy);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
	box-shadow: 0 2px 8px rgba(30, 50, 112, 0.2);
}

.bdw-compare-print-btn:hover {
	background: var(--bdw-navy-dark);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(30, 50, 112, 0.28);
}

/* ── In-page section navigation (municipality page) ───────────────── */
.bdw-page-nav {
	display: flex;
	align-items: stretch;
	gap: 0;
	background: #fff;
	border: 1px solid #e4eaf5;
	border-radius: 0 0 14px 14px;
	padding: 0 10px;
	margin-bottom: 28px;
	min-height: 50px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	box-shadow: 0 3px 10px rgba(30, 50, 112, 0.07);
	position: sticky;
	top: 0;
	z-index: 220;
	transition: box-shadow 0.2s;
}

/* Client request (2026-07): the nav is now the topmost element on the page
 * (above the hero), so it sits flush against the header *below* it instead
 * of above — flip the fused corner/border from the old order. */
.bdw-municipality-wrapper .bdw-page-nav {
	border-bottom: none;
	border-radius: 14px 14px 0 0;
	margin-bottom: 0;
}

/* Offset section anchors so they aren't hidden behind the sticky nav */
#bdw-section-ods,
#bdw-section-goals,
#bdw-section-indicators,
#bdw-section-demographics,
#bdw-section-demographics-evolution,
#bdw-section-compare,
#bdw-section-comparador,
#bdw-section-ranking {
	scroll-margin-top: 60px;
}
.admin-bar #bdw-section-ods,
.admin-bar #bdw-section-goals,
.admin-bar #bdw-section-indicators,
.admin-bar #bdw-section-demographics,
.admin-bar #bdw-section-demographics-evolution,
.admin-bar #bdw-section-compare,
.admin-bar #bdw-section-comparador,
.admin-bar #bdw-section-ranking {
	scroll-margin-top: 96px;
}

/* When stuck to the top of the viewport, strengthen the shadow so it
 * clearly separates from the content scrolling beneath it. */
.bdw-page-nav.is-stuck {
	border-top: 1px solid #e4eaf5;
	border-radius: 14px;
	box-shadow: 0 6px 20px rgba(30, 50, 112, 0.14);
}

/* WordPress admin bar offsets */
.admin-bar .bdw-page-nav {
	top: 32px;
}
@media screen and (max-width: 782px) {
	.admin-bar .bdw-page-nav {
		top: 46px;
	}
}

.bdw-page-nav::-webkit-scrollbar {
	display: none;
}

.bdw-page-nav__hint {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	align-self: center;
	padding: 0 14px 0 6px;
	margin-right: 2px;
	border-right: 1px solid #e4eaf5;
	font-size: 0.74rem;
	font-weight: 600;
	color: #aab4c8;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
	pointer-events: none;
	user-select: none;
}

.bdw-page-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 0 20px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--bdw-text-muted);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s, background 0.15s;
	flex-shrink: 0;
	position: relative;
	border-bottom: 3px solid transparent;
}

.bdw-page-nav__link:hover {
	background: #f5f7fd;
	color: var(--bdw-navy);
	text-decoration: none;
	border-bottom-color: rgba(30, 50, 112, 0.2);
}

.bdw-page-nav__link.is-active {
	color: var(--bdw-navy);
	background: #eef2fb;
	border-bottom-color: var(--bdw-navy);
}

.bdw-page-nav__link.is-active:hover {
	background: #e8eef9;
	color: var(--bdw-navy);
}

.bdw-page-nav__icon {
	font-size: 1rem;
	line-height: 1;
}

@media (max-width: 480px) {
	.bdw-page-nav__hint,
	.bdw-page-nav__label {
		display: none;
	}
	.bdw-page-nav__link {
		padding: 0 12px;
	}
}

/* ── Year selector: horizontal scroll on narrow viewports ─────────── */
/* The --scrollable modifier keeps buttons on one row on mobile so they
 * scroll horizontally instead of wrapping to a messy multi-line block. */
.bdw-year-selector--scrollable {
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 8px;
	justify-content: flex-start; /* ver nota en la regla ≤640px */
}

@media (min-width: 641px) {
	.bdw-year-selector--scrollable {
		flex-wrap: wrap;
		overflow-x: visible;
		padding-bottom: 20px;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
 * RESPONSIVE IMPROVEMENTS — v3.4.0
 * Melhorias abrangentes para todos os breakpoints do frontend.
 * Ordem: 1024 · 900 · 768 (additive) · 640 (additive) · 480 (additive) · 380
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── Large tablet (≤1024px) ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
	/* Reduce inner padding on panels so content has more horizontal room */
	.bdw-wheel-section,
	.bdw-panel-section {
		padding: 24px;
	}

	/* Slightly smaller title on tablets before the 768px breakpoint kicks in */
	.bdw-municipality-header h1 {
		font-size: 1.9rem;
	}

	/* Indicator detail page sections */
	.bdw-indicator-section {
		padding: 24px;
	}

	/* Ensure ODS grid collapses gracefully before it hits auto-fill limits */
	.bdw-ods-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
	}

	.bdw-overview-grid {
		grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
	}
}

/* ── Small tablet / large phablet (≤900px) ───────────────────────────────── */
@media (max-width: 900px) {
	/* Compare-type segmented control: let it wrap on medium screens */
	.bdw-compare-type-tabs {
		display: flex;
		flex-wrap: wrap;
		width: 100%;
		border-radius: 12px;
		justify-content: stretch;
	}

	.bdw-compare-type-tab {
		flex: 1 1 auto;
		justify-content: center;
		text-align: center;
	}

	/* Tighten grid minimums so columns don't leave awkward gaps */
	.bdw-ods-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
	}

	.bdw-overview-grid {
		grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
	}

	/* Goals grid: allow columns as small as 220px on tablets */
	.bdw-goals-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
	}
}

/* ── Mobile (≤768px) — additive to existing rules ────────────────────────── */
@media (max-width: 768px) {
	/* Reduce inner padding on all card-like panels */
	.bdw-wheel-section,
	.bdw-panel-section {
		padding: 18px;
	}

	.bdw-indicator-section {
		padding: 18px;
	}

	/* Comparator widget card */
	.bdw-compare-ui {
		padding: 18px 16px 20px;
		border-radius: 12px;
	}

	/* Type tabs already set to flex-wrap at 900px; reinforce on 768px */
	.bdw-compare-type-tabs {
		width: 100%;
		border-radius: 12px;
	}

	.bdw-compare-type-tab {
		flex: 1 1 auto;
		justify-content: center;
		text-align: center;
	}

	/* Charts: reduce fixed height so they don't dominate small viewports */
	.bdw-evolution-chart {
		height: 280px;
	}

	/* Indicator value: slightly smaller for tighter cards */
	.bdw-indicator-value {
		font-size: 1.3rem;
	}

	/* Thresholds box on the indicator detail page: stack vertically */
	.bdw-thresholds-box {
		flex-direction: column;
		gap: 12px;
	}

	.bdw-threshold-item {
		min-width: 0;
		width: 100%;
	}

	/* Ranking search: stretch to full width on mobile */
	.bdw-ranking-controls {
		justify-content: stretch;
	}

	.bdw-ranking-search {
		max-width: 100%;
	}

	/* ODS / overview grids: tighter minimums */
	.bdw-ods-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
	}

	.bdw-overview-grid {
		grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
	}

	/* Breadcrumb: smaller font to avoid wrapping on every separator */
	.bdw-breadcrumb {
		font-size: 0.85rem;
	}

	/* Section titles: reduce horizontal padding to match wrapper on mobile */
	.bdw-compare-section-title,
	.bdw-demographics-section-title {
		padding: 0 14px 10px;
	}

	/* Section containers: tighter padding */
	.bdw-compare-detail,
	.bdw-demographics-detail {
		padding: 16px 14px 40px;
	}

	/* Compare hint banner: slightly more compact */
	.bdw-compare-hint {
		padding: 18px 20px;
		gap: 12px;
		font-size: 0.88rem;
	}

	/* Sticky page-nav: extend edge-to-edge on mobile for a cleaner look */
	.bdw-page-nav {
		border-left: none;
		border-right: none;
		border-radius: 0;
	}
}

/* ── Narrow mobile (≤640px) — additive ───────────────────────────────────── */
@media (max-width: 640px) {
	/* Compare ui: slightly more padding reduction */
	.bdw-compare-ui {
		padding: 16px 14px 18px;
	}

	/* Goals grid: force 2 columns earlier than 480 for landscape phones */
	.bdw-goals-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ── Small mobile (≤480px) — additive to existing rules ─────────────────── */
@media (max-width: 480px) {
	/* Panels: further padding reduction */
	.bdw-wheel-section,
	.bdw-panel-section {
		padding: 14px;
	}

	.bdw-indicator-section {
		padding: 14px;
	}

	/* Compare type tabs: smaller text + padding */
	.bdw-compare-type-tab {
		padding: 8px 12px;
		font-size: 0.82rem;
	}

	/* Hint banner: hide decorative icon and reduce padding */
	.bdw-compare-hint {
		padding: 12px 14px;
		font-size: 0.83rem;
	}

	.bdw-compare-hint-icon {
		display: none;
	}

	/* Compare UI inner card */
	.bdw-compare-ui {
		padding: 12px 12px 16px;
	}

	/* Modal chart: shorter on small screens */
	.bdw-modal__chart-container {
		height: 190px;
	}

	/* Indicator value font: keep readable without overflowing the card */
	.bdw-indicator-value {
		font-size: 1.15rem;
	}

	/* ODS grid: 2 columns on small phones */
	.bdw-ods-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Overview: single column so cards have enough width for their content */
	.bdw-overview-grid {
		grid-template-columns: 1fr;
	}

	/* Form groups: reset hard min-width that can overflow flex containers */
	.bdw-form-group {
		min-width: 0;
		width: 100%;
	}

	/* Threshold items: full-width stacked */
	.bdw-threshold-item {
		width: 100%;
		min-width: 0;
		flex: 1 1 100%;
	}

	/* Entry portal indicator cards: single column */
	.bdw-entry-indicators-grid {
		grid-template-columns: 1fr;
	}

	/* Evolution chart: further height reduction */
	.bdw-evolution-chart {
		height: 220px;
	}

	/* Section containers: tightest padding */
	.bdw-compare-section-title,
	.bdw-demographics-section-title {
		padding: 0 10px 8px;
		margin-top: 28px;
	}

	.bdw-compare-detail,
	.bdw-demographics-detail {
		padding: 12px 10px 32px;
	}

	/* Donut chart: reduce height to avoid excessive whitespace */
	.bdw-donut-chart {
		height: 200px;
	}
}

/* ── Extra small (≤380px) — covers very narrow phones ───────────────────── */
@media (max-width: 380px) {
	/* Wrapper: minimal side padding */
	.bdw-display-wrapper {
		padding: 8px;
	}

	/* Header: maximum compactness */
	.bdw-municipality-header {
		padding: 14px;
	}

	.bdw-municipality-header h1 {
		font-size: 1.1rem;
	}

	/* Demographics stat cards: single column on tiny screens */
	.bdw-municipality-stats {
		grid-template-columns: 1fr;
	}

	/* Year buttons: smallest usable size */
	.bdw-year-btn {
		padding: 5px 10px;
		font-size: 0.78rem;
	}

	/* Goals grid: single column */
	.bdw-goals-grid {
		grid-template-columns: 1fr;
	}

	/* ODS grid: single column */
	.bdw-ods-grid {
		grid-template-columns: 1fr;
	}

	/* Entry portal indicator cards */
	.bdw-entry-indicators-grid {
		grid-template-columns: 1fr;
	}

	/* Modal chart: minimum usable height */
	.bdw-modal__chart-container {
		height: 160px;
	}

	/* Compare type tabs: tightest state */
	.bdw-compare-type-tabs {
		padding: 3px;
	}

	.bdw-compare-type-tab {
		padding: 7px 10px;
		font-size: 0.78rem;
	}

	/* Hide secondary hint text to reduce noise */
	.bdw-compare-hint-sm {
		display: none;
	}

	/* Evolution chart */
	.bdw-evolution-chart {
		height: 180px;
	}

	/* Donut chart */
	.bdw-donut-chart {
		height: 170px;
	}

	/* Panel: tightest padding */
	.bdw-wheel-section,
	.bdw-panel-section {
		padding: 12px;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
 * UX / UI IMPROVEMENTS — v3.12.0
 * Bug fixes, progressive enhancement and polish for all frontend components.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── Scroll padding: anchor links land below the sticky page-nav ─────────── */
:root {
	scroll-padding-top: 62px;
}

.admin-bar {
	scroll-padding-top: 94px;
}

@media screen and (max-width: 782px) {
	.admin-bar {
		scroll-padding-top: 108px;
	}
}

/* ── Fluid header typography ─────────────────────────────────────────────── */
/* Replaces the static cascade with a clamp() that scales smoothly from
 * 1.35 rem on narrow phones up to 2.2 rem on wide screens. The per-breakpoint
 * overrides in the responsive blocks still serve as floor values. */
.bdw-municipality-header h1 {
	font-size: clamp(1.35rem, 3.5vw, 2.2rem);
}

/* ── Goal card title: clamp to 2 lines ───────────────────────────────────── */
/* Prevents long goal names from expanding cards unpredictably. */
.bdw-goal-card__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

/* ── Goal card: smooth percentage transition ─────────────────────────────── */
.bdw-goal-card__percentage {
	transition: color 0.3s ease, opacity 0.3s ease;
}

/* ── Goal card: improved focus ring ─────────────────────────────────────── */
.bdw-goal-card:focus-visible {
	outline: 3px solid var(--bdw-color-gold, #f5a623);
	outline-offset: 3px;
	border-radius: var(--bdw-radius, 12px);
}

/* ── Hover transforms: disable on true touch devices ────────────────────── */
/* `hover: none` matches phones/tablets where hover is not a primary modality,
 * preventing translateY reflows triggered by tap events. */
@media (hover: none) {
	.bdw-goal-card:hover,
	.bdw-indicator-item:hover,
	.bdw-compare-print-btn:hover,
	.bdw-search-list li:hover {
		transform: none;
	}
}

/* ── Tap highlight: remove native blue flash on interactive elements ─────── */
.bdw-goal-card,
.bdw-year-btn,
.bdw-tab-btn,
.bdw-target-tab,
.bdw-mode-btn,
.bdw-compare-type-tab,
.bdw-wheel-mobile-item,
.bdw-entry-goal-header,
.bdw-search-item-link,
.bdw-page-nav__link,
.bdw-action-btn {
	-webkit-tap-highlight-color: transparent;
}

/* ── Flex truncation fixes ───────────────────────────────────────────────── */
/* min-width: 0 prevents flex children from escaping their container when
 * they contain long text paired with overflow: hidden / text-overflow: ellipsis. */
.bdw-mini-name,
.bdw-top-name,
.bdw-entry-goal-name,
.bdw-goal-card__header {
	min-width: 0;
}

/* ── Panel section: reset fixed height in single-column layout ───────────── */
/* height: 100% creates an excessively tall empty state when the grid collapses
 * to a single column at ≤1024 px. */
@media (max-width: 1024px) {
	.bdw-panel-section {
		height: auto;
	}
}

/* ── Ranking table: sticky column headers ────────────────────────────────── */
/* Keeps headers visible when scrolling through long ranking lists. */
.bdw-ranking-table-wrapper {
	position: relative;
}

.bdw-ranking-table th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: #f8f9fa;
}

/* ── Year mode banner: initial state before JS applies a modifier ─────────── */
/* On first render the banner has no modifier class; this rule ensures it
 * always shows with the "latest" appearance instead of being unstyled. */
.bdw-year-mode-banner:not(.bdw-year-mode-banner--year) {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

/* ── Loading state: shimmer pulse ────────────────────────────────────────── */
@keyframes bdw-pulse-load {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.6; }
}

.bdw-display-loading {
	animation: bdw-pulse-load 1.8s ease-in-out infinite;
}

/* The `prefers-reduced-motion` block near the top of the file already sets
 * animation-duration: 0.001ms on all children of .bdw-display-wrapper, so
 * the pulse is automatically suppressed in that environment. */

/* ── Modal content: always show a scroll handle on tall content ──────────── */
.bdw-modal__content {
	overflow-y: auto;
	max-height: calc(90vh - 80px);
}

/* ── Search: non-linkable goal items should not look interactive ─────────── */
.bdw-search-item--goal {
	cursor: default;
}

/* ── Search sections: consistent vertical rhythm ─────────────────────────── */
.bdw-search-section + .bdw-search-section {
	margin-top: 12px;
}

/* ── ODS-card expand button: always stretch full width ───────────────────── */
.bdw-ods-card-expand {
	width: 100%;
	text-align: center;
}

/* ── Print CSS: hide page nav in all print scenarios ─────────────────────── */
@media print {
	.bdw-page-nav {
		display: none !important;
	}
}

/* ── Per-section "Imprimir / PDF" export ─────────────────────────────────
 * Triggered by ods-export-utils.js (exportPdf): adds `body.bdw-is-printing`
 * + `data-printing="<section>"`, then this hides everything except the
 * matching [data-capture] section — same technique as b-ods-datos
 * (assets/css/datos.css: `.is-printing` / `.is-printing *`). */
@media print {
	body.bdw-is-printing * {
		visibility: hidden !important;
	}
	body.bdw-is-printing[data-printing="goals"] #bdw-section-goals,
	body.bdw-is-printing[data-printing="goals"] #bdw-section-goals *,
	body.bdw-is-printing[data-printing="indicators"] #bdw-section-indicators,
	body.bdw-is-printing[data-printing="indicators"] #bdw-section-indicators *,
	body.bdw-is-printing[data-printing="demographics-info"] #bdw-section-demographics,
	body.bdw-is-printing[data-printing="demographics-info"] #bdw-section-demographics *,
	body.bdw-is-printing[data-printing="evolution"] #bdw-section-demographics-evolution,
	body.bdw-is-printing[data-printing="evolution"] #bdw-section-demographics-evolution * {
		visibility: visible !important;
	}
	body.bdw-is-printing #bdw-section-goals,
	body.bdw-is-printing #bdw-section-indicators,
	body.bdw-is-printing #bdw-section-demographics,
	body.bdw-is-printing #bdw-section-demographics-evolution {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		background: #fff !important;
	}
	body.bdw-is-printing .bdw-section-export {
		display: none !important;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
 * UX / UI IMPROVEMENTS — v3.13.0
 * Dark mode, micro-interactions, skeleton loading, table polish,
 * entry portal evidence classes, smooth scroll, print improvements,
 * accessibility enhancements.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Dark mode via prefers-color-scheme ─────────────────────────────────
 *
 * DESACTIVADO el 2026-09-02 a petición del cliente.
 *
 * Motivo: el tema del sitio NO tiene modo oscuro — el <body> se queda en
 * #EDEBE7 pase lo que pase. Así que en un móvil con el sistema en oscuro
 * sólo se volvían oscuros los bloques de este plugin, y la ficha de
 * municipio quedaba con el contenido en azul marino sobre una página clara:
 * ni oscuro ni claro, y muy distinto de lo que se ve en escritorio.
 *
 * La regla se neutraliza añadiendo "and (max-width: 0px)" al prelude, que
 * nunca puede cumplirse. Se hace así en lugar de borrar las ~670 líneas
 * para poder reactivarlo en un minuto el día que el tema tenga modo oscuro
 * de verdad: basta con quitar ese " and (max-width: 0px)" de las DOS
 * media queries marcadas con "DARK-MODE-OFF" en este archivo.
 * ------------------------------------------------------------------------ */
/* DARK-MODE-OFF */
@media (prefers-color-scheme: dark) and (max-width: 0px) {
	.bdw-display-wrapper {
		--bdw-navy:         #7b9ee8;
		--bdw-navy-dark:    #6b8dd4;
		--bdw-text-muted:   #9aa8bc;
		--bdw-text-hint:    #7a8a9e;
		--bdw-text-body:    #c8d0dc;
		--bdw-ghost:        #1a2235;
		--bdw-surface:      #161e2e;
		--bdw-border:       #2a3548;
		--bdw-border-input: #3a4860;
		--bdw-color-primary: var(--bdw-navy);
		--bdw-color-primary-soft: #1e2a42;
		--bdw-color-text:    #dce4f0;
		--bdw-color-muted:   #8a98ac;
		--bdw-color-border:  #2a3548;
		--bdw-color-surface: #161e2e;
		--bdw-color-subtle:  #1a2235;
		--bdw-shadow-soft:   0 10px 26px rgba(0, 0, 0, 0.3);
		color: #dce4f0;
	}

	.bdw-display-wrapper,
	.bdw-wheel-section,
	.bdw-panel-section,
	.bdw-overview-card,
	.bdw-ods-card,
	.bdw-indicator-section,
	.bdw-display-map-wrapper,
	.bdw-comparator-section,
	.bdw-search-section,
	.bdw-embed-config,
	.bdw-embed-preview,
	.bdw-embed-code,
	.bdw-compare-ui,
	.bdw-ranking-table-wrapper {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-text);
	}

	.bdw-display-wrapper h1,
	.bdw-display-wrapper h2,
	.bdw-display-wrapper h3,
	.bdw-display-wrapper h4,
	.bdw-display-wrapper h5,
	.bdw-display-wrapper h6 {
		color: var(--bdw-color-primary);
	}

	.bdw-display-wrapper a {
		color: var(--bdw-color-primary);
	}

	.bdw-display-error {
		background: #2a1515;
		border-color: #5c2020;
		color: #f5a3a3;
	}

	.bdw-display-loading {
		background: rgba(22, 30, 46, 0.8);
		color: var(--bdw-color-primary);
	}

	.bdw-display-empty {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-muted);
	}

	.bdw-year-selector,
	.bdw-ranking-table th,
	.bdw-compare-table th,
	.bdw-entry-goal-header,
	.bdw-demog-category__header,
	.bdw-demog-indicator,
	.bdw-compare-col {
		background: var(--bdw-color-subtle);
	}

	.bdw-ranking-table td,
	.bdw-compare-table td,
	.bdw-indicator-item {
		border-color: var(--bdw-color-border);
	}

	.bdw-ranking-table tbody tr:hover,
	.bdw-compare-table tbody tr:hover,
	.bdw-indicator-item {
		background: var(--bdw-color-subtle);
	}

	.bdw-indicator-item {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-indicator-title {
		color: var(--bdw-color-text);
	}

	.bdw-indicator-value {
		color: var(--bdw-color-primary);
	}

	.bdw-indicator-no-data,
	.bdw-no-data {
		color: var(--bdw-color-muted);
	}

	.bdw-goal-card {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-goal-card__title {
		color: var(--bdw-color-text);
	}

	.bdw-goal-card__percentage {
		color: var(--bdw-color-primary);
	}

	.bdw-goal-card__meta {
		color: var(--bdw-color-muted);
		border-color: var(--bdw-color-border);
	}

	.bdw-mini-name,
	.bdw-top-name {
		color: var(--bdw-color-muted);
	}

	.bdw-mini-value,
	.bdw-top-score {
		color: var(--bdw-color-text);
	}

	.bdw-entry-indicator-card {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-entry-ind-code {
		background: var(--bdw-color-subtle);
		color: var(--bdw-color-muted);
	}

	.bdw-entry-ind-name {
		color: var(--bdw-color-text);
	}

	.bdw-entry-field,
	.bdw-entry-muni-search,
	.bdw-select,
	.bdw-search-input,
	.bdw-compare-select,
	.bdw-compare-muni-input,
	.bdw-ranking-search {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-border-input);
		color: var(--bdw-color-text);
	}

	.bdw-entry-field::placeholder,
	.bdw-search-input::placeholder {
		color: var(--bdw-color-muted);
	}

	.bdw-entry-muni-dropdown,
	.bdw-compare-suggestions,
	.bdw-entry-muni-option {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-border-input);
	}

	.bdw-entry-muni-option:hover,
	.bdw-entry-muni-option.is-active,
	.bdw-compare-suggestion:hover {
		background: var(--bdw-color-subtle);
	}

	.bdw-entry-muni-name {
		color: var(--bdw-color-text);
	}

	.bdw-entry-muni-code {
		color: var(--bdw-color-muted);
	}

	.bdw-entry-hint,
	.bdw-entry-source,
	.bdw-entry-prev,
	.bdw-entry-thresholds {
		color: var(--bdw-color-muted);
	}

	.bdw-panel-meta,
	.bdw-ods-card-meta,
	.bdw-thresholds,
	.bdw-threshold {
		color: var(--bdw-color-muted);
	}

	.bdw-compare-hint {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-muted);
	}

	.bdw-compare-missing-notice {
		background: #2a2410;
		border-color: #5a4a10;
		color: #d4b860;
	}

	.bdw-compare-table tbody tr:nth-child(even) td {
		background: var(--bdw-color-subtle);
	}

	.bdw-compare-table__base td {
		background: var(--bdw-color-primary-soft) !important;
	}

	.bdw-compare-table__base:hover td {
		background: #243352 !important;
	}

	.bdw-compare-no-data-label {
		color: var(--bdw-color-muted);
	}

	.bdw-search-item {
		background: var(--bdw-color-subtle);
	}

	.bdw-search-item:hover {
		background: var(--bdw-color-primary-soft);
	}

	.bdw-search-item mark {
		background: #3a3520;
		color: #e8d060;
	}

	.bdw-search-item-meta {
		color: var(--bdw-color-muted);
	}

	.bdw-search-placeholder {
		color: var(--bdw-color-muted);
	}

	.bdw-breadcrumb-current {
		color: var(--bdw-color-muted);
	}

	.bdw-breadcrumb-link {
		color: var(--bdw-color-primary);
	}

	.bdw-tab-btn {
		color: var(--bdw-color-muted);
	}

	.bdw-tab-btn.active {
		color: var(--bdw-color-primary);
	}

	.bdw-tab-btn.active::after {
		background: var(--bdw-color-primary);
	}

	.bdw-target-tab {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-text);
	}

	.bdw-target-tab.active {
		background: var(--bdw-color-primary);
		color: #fff;
		border-color: var(--bdw-color-primary);
	}

	.bdw-mode-btn {
		color: var(--bdw-color-primary);
	}

	.bdw-mode-btn:hover,
	.bdw-mode-btn.active {
		background: var(--bdw-color-primary);
		color: #fff;
	}

	.bdw-compare-type-tabs {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
	}

	.bdw-compare-type-tab {
		color: var(--bdw-color-muted);
	}

	.bdw-compare-type-tab.active {
		background: var(--bdw-color-surface);
		color: var(--bdw-color-primary);
	}

	.bdw-compare-type-tab:hover:not(.active) {
		background: rgba(123, 158, 232, 0.1);
		color: var(--bdw-color-primary);
	}

	.bdw-compare-chip {
		background: var(--bdw-color-primary-soft);
		border-color: rgba(123, 158, 232, 0.15);
		color: var(--bdw-color-primary);
	}

	.bdw-compare-chip--base {
		background: var(--bdw-color-primary);
		color: #fff;
	}

	.bdw-compare-chip--ods {
		background: var(--bdw-color-primary-soft);
	}

	.bdw-pill {
		background: var(--bdw-color-primary-soft);
		border-color: rgba(123, 158, 232, 0.2);
		color: var(--bdw-color-primary);
	}

	.bdw-btn-secondary {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-primary);
	}

	.bdw-btn-secondary:hover {
		background: var(--bdw-color-primary-soft);
	}

	.bdw-ods-card-expand {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
		color: var(--bdw-color-primary);
	}

	.bdw-ods-card-expand:hover {
		background: var(--bdw-color-primary-soft);
	}

	.bdw-formula {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
	}

	.bdw-threshold-item {
		background: var(--bdw-color-subtle);
	}

	.bdw-ranking-top,
	.bdw-ranking-bottom {
		background: var(--bdw-color-subtle);
	}

	.bdw-ranking-top h4,
	.bdw-ranking-bottom h4 {
		color: var(--bdw-color-muted);
	}

	.bdw-ranking-name {
		color: var(--bdw-color-text);
	}

	.bdw-ranking-value {
		color: var(--bdw-color-primary);
	}

	.bdw-row--nodata td {
		color: var(--bdw-color-muted);
	}

	.bdw-demog-indicator {
		background: var(--bdw-color-subtle);
		border-color: var(--bdw-color-border);
	}

	.bdw-demog-indicator__label {
		color: var(--bdw-color-muted);
	}

	.bdw-demog-indicator__value {
		color: var(--bdw-color-primary);
	}

	.bdw-demog-indicator__year {
		background: var(--bdw-color-border);
		color: var(--bdw-color-muted);
	}

	.bdw-demog-year-selector {
		background: var(--bdw-color-subtle);
	}

	.bdw-entry-goal {
		border-color: var(--bdw-color-border);
	}

	.bdw-entry-goal-header {
		background: var(--bdw-color-subtle);
	}

	.bdw-entry-goal-header:hover {
		background: var(--bdw-color-primary-soft);
	}

	.bdw-entry-goal-name {
		color: var(--bdw-color-text);
	}

	.bdw-entry-goal-progress {
		color: var(--bdw-color-muted);
	}

	.bdw-progress-mini {
		background: var(--bdw-color-border);
	}

	.bdw-progress {
		background: var(--bdw-color-border);
	}

	.bdw-entry-toast--success { background: #1a3a1a; color: #6fdc6f; border-color: #2a5a2a; }
	.bdw-entry-toast--warning { background: #3a3010; color: #e8c84a; border-color: #5a4a10; }
	.bdw-entry-toast--error   { background: #3a1a1a; color: #f5a3a3; border-color: #5a2a2a; }
	.bdw-entry-toast--info    { background: #1a2a3a; color: #7bb8f5; border-color: #2a4a5a; }

	.bdw-toast--success { background: #1a3a1a; }
	.bdw-toast--warning { background: #3a3010; }
	.bdw-toast--error   { background: #3a1a1a; }
	.bdw-toast--info    { background: var(--bdw-color-primary); }

	.bdw-entry-muni-chip {
		background: var(--bdw-color-primary-soft);
		border-color: rgba(123, 158, 232, 0.2);
		color: var(--bdw-color-primary);
	}

	.bdw-compare-chart-wrap {
		background: var(--bdw-color-subtle);
	}

	.bdw-compare-unit-badge {
		background: var(--bdw-color-primary-soft);
		color: var(--bdw-color-primary);
	}

	.bdw-compare-base-badge {
		background: var(--bdw-color-primary);
	}

	.bdw-compare-print-btn {
		background: var(--bdw-color-primary);
	}

	.bdw-compare-print-btn:hover {
		background: var(--bdw-navy-dark);
	}

	.bdw-history-btn {
		background: var(--bdw-color-primary);
	}

	.bdw-history-btn:hover {
		background: var(--bdw-navy-dark);
	}

	.bdw-map-popup-link {
		background: var(--bdw-color-primary);
	}

	.bdw-map-popup-link:hover,
	.bdw-map-popup-link:focus {
		background: var(--bdw-navy-dark);
	}

	.bdw-empty-state {
		background: linear-gradient(180deg, var(--bdw-color-surface) 0%, var(--bdw-color-subtle) 100%);
		border-color: var(--bdw-color-border);
	}

	.bdw-empty-state h2 {
		color: var(--bdw-color-primary);
	}

	.bdw-empty-state p {
		color: var(--bdw-color-muted);
	}

	.bdw-page-nav {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-page-nav__link {
		color: var(--bdw-color-muted);
	}

	.bdw-page-nav__link:hover {
		background: var(--bdw-color-subtle);
		color: var(--bdw-color-primary);
	}

	.bdw-page-nav__link.is-active {
		color: var(--bdw-color-primary);
		background: var(--bdw-color-primary-soft);
	}

	.bdw-page-nav__hint {
		color: var(--bdw-color-muted);
		border-color: var(--bdw-color-border);
	}

	.bdw-municipality-header {
		background: linear-gradient(135deg, #1a2a44 0%, #243460 100%);
	}

	.bdw-municipality-meta span {
		background: rgba(255, 255, 255, 0.08);
	}

	.bdw-municipality-stat {
		background: rgba(255, 255, 255, 0.05);
	}

	.bdw-municipality-stat:hover {
		background: rgba(255, 255, 255, 0.1);
	}

	.bdw-modal {
		background: var(--bdw-color-surface);
	}

	.bdw-modal__header {
		background: var(--bdw-color-primary);
	}

	.bdw-meta-icon-btn:hover,
	.bdw-meta-icon-btn:focus-visible {
		background: rgba(255, 255, 255, 0.1);
	}

	.bdw-metadata-modal .bdw-oce-ficha-table th,
	.bdw-metadata-modal .bdw-oce-ficha-table td {
		border-color: var(--bdw-color-border);
	}

	.bdw-metadata-modal .bdw-oce-ficha-table th {
		background: rgba(255, 255, 255, 0.06);
	}

	.bdw-tooltip {
		background: var(--bdw-color-primary);
	}

	.bdw-tooltip::after {
		border-top-color: var(--bdw-color-primary);
	}

	.bdw-display-map-fallback {
		color: var(--bdw-color-muted);
	}

	.bdw-helper-text,
	.bdw-hint {
		color: var(--bdw-color-muted);
	}

	.bdw-compare-label {
		color: var(--bdw-color-muted);
	}

	.bdw-compare-label-hint {
		color: var(--bdw-text-hint);
	}

	.bdw-search-bar {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-search-clear {
		color: var(--bdw-color-muted);
	}

	.bdw-search-clear:hover {
		background: var(--bdw-color-subtle);
		color: var(--bdw-color-text);
	}

	.bdw-search-total {
		color: var(--bdw-color-muted);
	}

	.bdw-search-section-title {
		color: var(--bdw-color-primary);
		border-color: var(--bdw-color-border);
	}

	.bdw-evidence-link {
		color: var(--bdw-color-primary);
	}

	.bdw-entry-evidence-upload {
		background: var(--bdw-color-primary-soft) !important;
		border-color: rgba(123, 158, 232, 0.25) !important;
	}

	.bdw-entry-evidence-upload label {
		color: var(--bdw-color-primary) !important;
	}

	.bdw-entry-evidence-upload small {
		color: var(--bdw-color-muted) !important;
	}

	.bdw-entry-evidence-upload input[type="file"] {
		background: var(--bdw-color-surface) !important;
		border-color: var(--bdw-border-input) !important;
		color: var(--bdw-color-text) !important;
	}

	.bdw-entry-extra-btn {
		border-color: var(--bdw-color-primary);
		color: var(--bdw-color-primary);
	}

	.bdw-entry-extra-btn:hover,
	.bdw-entry-extra-btn.active {
		background: var(--bdw-color-primary);
		color: #fff;
	}

	.bdw-entry-extra-fields {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-color-border);
	}

	.bdw-entry-extra-fields input.bdw-entry-field {
		background: var(--bdw-color-surface);
		border-color: var(--bdw-border-input);
		color: var(--bdw-color-text);
	}

	.bdw-history-btn--secondary {
		background: var(--bdw-color-surface);
		color: var(--bdw-color-primary);
		border-color: var(--bdw-color-primary);
	}

	.bdw-history-btn--secondary:hover {
		background: var(--bdw-color-primary-soft);
	}
}

/* ── 2. Micro-interactions ────────────────────────────────────────────────── */
/* Buttons: subtle scale on active for tactile feedback */
.bdw-display-wrapper .bdw-btn:active,
.bdw-display-wrapper .bdw-btn-primary:active,
.bdw-display-wrapper .bdw-btn-secondary:active,
.bdw-display-wrapper .bdw-history-btn:active,
.bdw-display-wrapper .bdw-compare-print-btn:active,
.bdw-display-wrapper .bdw-ods-card-expand:active {
	transform: scale(0.97);
}

/* Year buttons: active feedback */
.bdw-year-btn:active {
	transform: scale(0.95);
}

/* Tab buttons: active feedback */
.bdw-tab-btn:active,
.bdw-target-tab:active,
.bdw-mode-btn:active,
.bdw-compare-type-tab:active {
	transform: scale(0.97);
}

/* Goal cards: active press feedback */
.bdw-goal-card:active {
	transform: scale(0.98);
}

/* Indicator items: subtle left-border accent on hover */
.bdw-indicator-item {
	border-left: 3px solid transparent;
	transition: border-left-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.bdw-indicator-item:hover {
	border-left-color: var(--bdw-navy);
}

/* Chips: active press feedback */
.bdw-pill:active,
.bdw-compare-chip:active {
	transform: scale(0.95);
}

/* Search bar: focus glow */
.bdw-search-bar:focus-within {
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.12);
}

/* Modal overlay: fade-in transition */
.bdw-modal-overlay {
	transition: opacity 0.2s ease;
}

.bdw-modal-overlay.active {
	animation: bdw-modal-overlay-in 0.2s ease;
}

@keyframes bdw-modal-overlay-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* ── 3. Skeleton loading states ───────────────────────────────────────────── */
.bdw-skeleton {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: bdw-skeleton-shimmer 1.5s ease-in-out infinite;
	border-radius: 6px;
}

@keyframes bdw-skeleton-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.bdw-skeleton-card {
	height: 120px;
	border-radius: 12px;
	margin-bottom: 16px;
}

.bdw-skeleton-line {
	height: 14px;
	margin-bottom: 8px;
}

.bdw-skeleton-line--short {
	width: 60%;
}

.bdw-skeleton-line--very-short {
	width: 30%;
}

/* ── 4. Comparator results table: caption styling ─────────────────────────── */
.bdw-compare-table caption {
	padding: 12px 16px;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--bdw-navy);
	text-align: left;
	background: var(--bdw-color-subtle, #f8faff);
	border-bottom: 1px solid var(--bdw-color-border, #e9ecef);
	caption-side: top;
}

/* Comparator table: responsive card layout on mobile */
@media (max-width: 640px) {
	.bdw-compare-table-wrap:has(.bdw-compare-table) {
		overflow: visible;
	}

	.bdw-compare-table thead {
		display: none;
	}

	.bdw-compare-table,
	.bdw-compare-table tbody,
	.bdw-compare-table tr,
	.bdw-compare-table td {
		display: block;
		width: 100%;
	}

	.bdw-compare-table tr {
		margin-bottom: 12px;
		border: 1px solid var(--bdw-color-border, #e9ecef);
		border-radius: 10px;
		overflow: hidden;
	}

	.bdw-compare-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px 14px;
		border-bottom: 1px solid var(--bdw-color-border, #f0f0f0);
	}

	.bdw-compare-table td::before {
		content: attr(data-label);
		font-weight: 600;
		font-size: 0.78rem;
		color: var(--bdw-color-muted, #6c757d);
		text-transform: uppercase;
		letter-spacing: 0.04em;
		margin-right: 12px;
		flex-shrink: 0;
	}

	.bdw-compare-table tr:last-child td,
	.bdw-compare-table td:last-child {
		border-bottom: none;
	}

	.bdw-compare-table tbody tr:nth-child(even) td {
		background: transparent;
	}
}

/* ── 5. Entry portal evidence upload: proper CSS classes ──────────────────── */
.bdw-entry-evidence-upload {
	margin-top: 8px;
	padding: 10px;
	border: 1px solid #b6d4fe;
	border-radius: 6px;
	background: #e8f0fe;
}

.bdw-entry-evidence-upload label {
	font-size: 12px;
	font-weight: 600;
	color: #1a56db;
	display: block;
}

.bdw-entry-evidence-upload input[type="file"] {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 4px 6px;
	border: 1px solid #ced4da;
	border-radius: 4px;
	background: #fff;
	font-size: 11px;
}

.bdw-entry-evidence-upload small {
	display: block;
	color: #555;
	font-size: 11px;
	margin-top: 3px;
}

.bdw-evidence-status {
	margin-top: 4px;
	font-size: 11px;
}

/* ── 6. Smooth scroll behavior ────────────────────────────────────────────── */
.bdw-display-wrapper {
	scroll-behavior: smooth;
}

/* ── 7. Print improvements ────────────────────────────────────────────────── */
@media print {
	.bdw-display-wrapper {
		max-width: none;
		padding: 0;
	}

	.bdw-municipality-header {
		box-shadow: none;
		border-radius: 0;
		padding: 16px;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.bdw-wheel-section,
	.bdw-panel-section,
	.bdw-goal-card,
	.bdw-indicator-item,
	.bdw-overview-card,
	.bdw-ods-card {
		box-shadow: none;
		border: 1px solid #ccc;
		break-inside: avoid;
	}

	.bdw-goal-card {
		break-inside: avoid;
	}

	.bdw-goals-grid {
		gap: 10px;
	}

	.bdw-year-selector,
	.bdw-comparator-section,
	.bdw-compare-detail,
	.bdw-demographics-detail,
	.bdw-search-bar-wrap,
	.bdw-entry-portal-wrapper,
	.bdw-display-map-controls {
		display: none !important;
	}

	.bdw-display-main {
		grid-template-columns: 1fr;
	}

	.bdw-indicators-list {
		max-height: none;
		overflow: visible;
	}

	.bdw-modal-overlay {
		display: none !important;
	}

	.bdw-compare-table-wrap {
		overflow: visible;
	}

	.bdw-compare-table {
		font-size: 0.8rem;
	}

	.bdw-compare-table th {
		background: #f0f0f0 !important;
		color: #333 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* ── 8. Accessibility enhancements ────────────────────────────────────────── */
/* Skip link for keyboard users */
.bw-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 99999;
	padding: 8px 16px;
	background: var(--bdw-navy);
	color: #fff;
	border-radius: 0 0 8px 0;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
}

.bw-skip-link:focus {
	left: 0;
}

/* Better aria-current styling for page nav */
.bdw-page-nav__link[aria-current="true"] {
	color: var(--bdw-navy);
	background: #eef2fb;
	border-bottom-color: var(--bdw-navy);
}

/* Improved focus ring for modal close */
.bdw-modal__close:focus-visible {
	outline: 3px solid var(--bdw-color-gold, #f5a623);
	outline-offset: 2px;
}

/* Better focus ring for autocomplete inputs */
.bdw-entry-muni-search:focus-visible,
.bdw-compare-muni-input:focus-visible {
	border-color: var(--bdw-navy);
	box-shadow: 0 0 0 3px rgba(30, 50, 112, 0.18);
}

/* Screen reader only heading for autocomplete results */
.bdw-autocomplete-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── 9. Reduced motion: disable skeleton shimmer ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.bdw-skeleton {
		animation: none;
		background: #e0e0e0;
	}

	.bdw-display-wrapper {
		scroll-behavior: auto;
	}

	.bdw-modal-overlay {
		transition: none;
	}
}

/* ── 10. High contrast mode support ───────────────────────────────────────── */
@media (prefers-contrast: high) {
	.bdw-display-wrapper .bdw-goal-card,
	.bdw-display-wrapper .bdw-indicator-item,
	.bdw-display-wrapper .bdw-overview-card,
	.bdw-display-wrapper .bdw-ods-card,
	.bdw-display-wrapper .bdw-panel-section,
	.bdw-display-wrapper .bdw-wheel-section {
		border-width: 2px;
	}

	.bdw-display-wrapper .bdw-semaforo {
		border-width: 3px;
	}

	.bdw-display-wrapper .bdw-year-btn,
	.bdw-display-wrapper .bdw-tab-btn,
	.bdw-display-wrapper .bdw-target-tab,
	.bdw-display-wrapper .bdw-mode-btn {
		border-width: 2px;
		font-weight: 700;
	}
}

/* ── 11. Comparator button loading state ──────────────────────────────────── */
.bdw-btn-primary.is-loading,
.bdw-btn.is-loading {
	pointer-events: none;
	opacity: 0.7;
	position: relative;
}

.bdw-btn-primary.is-loading::after,
.bdw-btn.is-loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 6px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: bdw-spin 0.8s linear infinite;
	vertical-align: middle;
}

/* ── 12. Entry portal: unsaved changes indicator ──────────────────────────── */
.bdw-entry-unsaved-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f5a623;
	margin-left: 6px;
	animation: bdw-pulse-load 1.5s ease-in-out infinite;
}

.bdw-entry-unsaved-dot[hidden] {
	display: none;
}

/* ── 13. Better empty state for comparator results ────────────────────────── */
.bdw-comparator-results:empty::before {
	content: '';
	display: block;
	min-height: 120px;
}

/* ── 14. Improved scrollbar styling for dropdowns ─────────────────────────── */
.bdw-entry-muni-dropdown,
.bdw-compare-suggestions {
	scrollbar-width: thin;
	scrollbar-color: #c0c8d4 transparent;
}

.bdw-entry-muni-dropdown::-webkit-scrollbar,
.bdw-compare-suggestions::-webkit-scrollbar {
	width: 5px;
}

.bdw-entry-muni-dropdown::-webkit-scrollbar-thumb,
.bdw-compare-suggestions::-webkit-scrollbar-thumb {
	background: #c0c8d4;
	border-radius: 4px;
}

/* ── 15. Footer spacing for embedded widgets ──────────────────────────────── */
.bdw-embed-wrapper {
	margin-bottom: 40px;
}

.bdw-embed-preview iframe {
	border: 1px solid var(--bdw-color-border, #e9ecef);
	border-radius: 10px;
	width: 100%;
	min-height: 400px;
}

/* ── 16. Alert page: improved placeholder styling ─────────────────────────── */
.bdw-alerts-empty {
	text-align: center;
	padding: 48px 24px;
}

.bdw-alerts-empty__icon {
	font-size: 3rem;
	line-height: 1;
	margin-bottom: 16px;
	opacity: 0.5;
}

.bdw-alerts-empty__title {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--bdw-navy);
	margin: 0 0 8px;
}

.bdw-alerts-empty__text {
	color: var(--bdw-color-muted, #6c757d);
	max-width: 480px;
	margin: 0 auto;
	line-height: 1.6;
}

/* ── 17. Indicator detail: improved threshold colors ──────────────────────── */
.bdw-threshold-item--green {
	background: #e8f5e9;
	border-left: 4px solid #4CAF50;
}

.bdw-threshold-item--yellow {
	background: #fff8e1;
	border-left: 4px solid #FFC107;
}

.bdw-threshold-item--red {
	background: #ffebee;
	border-left: 4px solid #F44336;
}

/* DARK-MODE-OFF — ver la nota larga en el bloque 1 de dark mode. */
@media (prefers-color-scheme: dark) and (max-width: 0px) {
	.bdw-threshold-item--green {
		background: #1a2e1a;
		border-left-color: #4CAF50;
	}

	.bdw-threshold-item--yellow {
		background: #2e2810;
		border-left-color: #FFC107;
	}

	.bdw-threshold-item--red {
		background: #2e1a1a;
		border-left-color: #F44336;
	}
}

/* ═══════════════════════════════════════════════════════════════════════════
 * RESPONSIVE REFINEMENT — v3.20
 * Pasada de diseño (tablet + móvil) sobre la ficha de municipio, el rosco
 * de ODS y los modales.
 *
 * REGLAS DEL BLOQUE
 *  1. Todo vive dentro de @media (max-width / hover / orientation): el
 *     render de escritorio (>1024px) no cambia ni un píxel.
 *  2. Se tocan sobre todo propiedades de layout (grid, flex, padding,
 *     tamaño). Los colores se toman de las custom properties existentes
 *     (--bdw-navy, --bdw-border, --bdw-surface…), que ya son conscientes
 *     del modo oscuro, así que este bloque —que va después del bloque
 *     prefers-color-scheme— no lo pisa.
 *  3. Ninguna regla usa !important.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────────────────
 * 1 · EL ROSCO DE ODS
 * Antes: por debajo de 640px el SVG se ocultaba (display:none) y sólo
 * quedaba una lista de texto; y entre 641 y 768px pasaba lo contrario —
 * el rosco se veía pero sin etiquetas ni iconos y sin lista, o sea un
 * donut mudo que no se podía interpretar.
 * Ahora: el rosco SIEMPRE se ve, y la lista lo acompaña como leyenda
 * táctil bajo él. Cada elemento de la lista es también el botón de
 * selección del ODS, igual que los sectores.
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
	/* En una sola columna el panel de detalle no necesita el mínimo de
	 * 280px, que en pantallas de 320px provocaba desbordamiento lateral. */
	.bdw-goal-panel-host {
		min-width: 0;
		flex: 1 1 auto;
		width: 100%;
	}

	.bdw-wheel-row { gap: 18px; }
}

@media (max-width: 768px) {
	/* El contenedor pasa a columna: rosco arriba, leyenda debajo. */
	.bdw-wheel-container {
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		min-height: 0;
		gap: 16px;
	}

	/* Revierte el display:none de la regla de ≤640px. */
	.bdw-wheel-svg {
		display: block;
		width: min(92vw, 400px);
		max-width: 100%;
		height: auto;
		margin: 0 auto;
	}

	.bdw-wheel-mobile-list {
		display: flex;
		flex-direction: column;
		gap: 6px;
		width: 100%;
		padding: 0;
		margin: 0;
		list-style: none;
	}

	/* Rejilla de 2 filas: el badge del ODS ocupa la columna izquierda
	 * completa y el nombre + porcentaje se apilan a su derecha. Antes iban
	 * los tres en una sola línea flex y el nombre quedaba estrujado. */
	.bdw-wheel-mobile-item {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		grid-template-areas:
			"badge name"
			"badge meta";
		column-gap: 12px;
		row-gap: 2px;
		align-items: center;
		padding: 10px 12px;
		border-radius: 12px;
		border: 1px solid rgba(30, 50, 112, 0.06);
		cursor: pointer;
		transition: filter 0.15s, transform 0.1s;
	}
	.bdw-wheel-mobile-item:active { transform: scale(0.99); }
	.bdw-wheel-mobile-badge {
		grid-area: badge;
		align-self: center;
		min-width: 46px;
		text-align: center;
		padding: 5px 8px;
		border-radius: 7px;
		color: #fff;
		font-weight: 700;
		font-size: 0.82rem;
		line-height: 1.15;
	}
	.bdw-wheel-mobile-name {
		grid-area: name;
		font-size: 0.88rem;
		font-weight: 600;
		line-height: 1.25;
	}
	.bdw-wheel-mobile-meta {
		grid-area: meta;
		font-size: 0.76rem;
		font-weight: 600;
		opacity: 0.7;
	}

	/* La sección deja de tener el aire de escritorio. */
	.bdw-wheel-section h2 { font-size: 1.15rem; margin-bottom: 14px; }

	/* Acciones bajo el rosco con altura táctil. */
	.bdw-wheel-actions { gap: 10px; margin-top: 14px; }
	.bdw-wheel-help-btn,
	.bdw-wheel-download-btn { min-height: 40px; padding: 8px 16px; }
}

@media (max-width: 480px) {
	.bdw-wheel-svg { width: min(94vw, 340px); }
	.bdw-wheel-mobile-item { padding: 9px 10px; column-gap: 10px; }
	.bdw-wheel-mobile-badge { min-width: 42px; font-size: 0.78rem; }
	.bdw-wheel-mobile-name { font-size: 0.84rem; }
	.bdw-wheel-mobile-meta { font-size: 0.72rem; }

	/* El panel de ayuda del rosco: aire y botón de cierre táctil. */
	.bdw-wheel-help-modal { padding: 16px 14px; }
	.bdw-wheel-help-modal__close {
		top: 6px;
		right: 6px;
		width: 36px;
		height: 36px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.bdw-wheel-actions { flex-direction: column; }
	.bdw-wheel-help-btn,
	.bdw-wheel-download-btn { width: 100%; justify-content: center; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 2 · MODAL → HOJA INFERIOR (bottom sheet) EN MÓVIL
 * El patrón centrado con márgenes deja franjas oscuras arriba y abajo y
 * obliga a estirar el pulgar hasta la esquina superior derecha para cerrar.
 * En móvil se ancla abajo, a ancho completo, con scroll interno correcto
 * (flex + min-height:0) y respetando la barra gestual.
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.bdw-modal-overlay {
		padding: 0;
		align-items: flex-end;
	}

	.bdw-modal {
		width: 100%;
		max-width: 100%;
		margin: 0;
		border-radius: 18px 18px 0 0;
		max-height: 90vh;
		max-height: 90dvh;
		display: flex;
		flex-direction: column;
		animation: bdw-sheet-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
	}

	.bdw-modal__header {
		border-radius: 18px 18px 0 0;
		padding: 14px 16px;
		flex-shrink: 0;
		gap: 12px;
	}

	.bdw-modal__title {
		font-size: 1.02rem;
		line-height: 1.3;
		min-width: 0;
	}

	.bdw-modal__close { flex-shrink: 0; }

	/* min-height:0 es lo que permite que el hijo flex realmente scrollee;
	 * el max-height fijo de 90vh-80px se anula porque aquí manda el flex. */
	.bdw-modal__content {
		flex: 1 1 auto;
		min-height: 0;
		max-height: none;
		padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
		overscroll-behavior: contain;
	}

	.bdw-modal__chart-container { height: 230px; }

	/* Ficha de metadatos: la tabla de dos columnas (34% / 66%) es
	 * ilegible en 360px — se apila etiqueta sobre valor. */
	.bdw-metadata-modal .bdw-oce-ficha-table,
	.bdw-metadata-modal .bdw-oce-ficha-table tbody,
	.bdw-metadata-modal .bdw-oce-ficha-table tr { display: block; width: 100%; }
	.bdw-metadata-modal .bdw-oce-ficha-table th,
	.bdw-metadata-modal .bdw-oce-ficha-table td {
		display: block;
		width: auto;
		border: none;
		padding: 8px 12px;
	}
	.bdw-metadata-modal .bdw-oce-ficha-table th {
		padding-bottom: 2px;
		font-size: 0.74rem;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		background: transparent;
	}
	.bdw-metadata-modal .bdw-oce-ficha-table tr {
		border: 1px solid var(--bdw-border);
		border-radius: 10px;
		margin-bottom: 8px;
		overflow: hidden;
	}
}

@keyframes bdw-sheet-in {
	from { transform: translateY(100%); opacity: 0.6; }
	to   { transform: translateY(0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.bdw-modal { animation: none; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 3 · CABECERA DE LA FICHA DE MUNICIPIO
 * En móvil el bloque de puntuación caía en una columna alineada a la
 * derecha, dejando un hueco muerto a la izquierda, y los botones de acción
 * quedaban desalineados con el resto.
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.bdw-municipality-header {
		padding: 20px 16px;
		border-radius: 0 0 14px 14px;
	}

	/* El halo decorativo es enorme en pantallas pequeñas: se atenúa. */
	.bdw-municipality-header::before { width: 260px; height: 260px; right: -30%; }

	.bdw-municipality-header__top { gap: 14px; }
	.bdw-municipality-header__info { width: 100%; }

	/* Puntuación + acciones pasan a una fila a lo ancho, alineadas entre sí. */
	.bdw-municipality-header__actions-score {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;
		width: 100%;
		gap: 10px;
	}

	/* La medalla de puntuación se aplana: cifra y etiqueta en línea. */
	.bdw-hero-score-badge {
		display: flex;
		align-items: baseline;
		gap: 10px;
		min-width: 0;
		padding: 10px 16px;
		text-align: left;
	}
	.bdw-hero-score-badge__num { font-size: 1.85rem; }
	.bdw-hero-score-badge__label { margin-top: 0; }

	.bdw-municipality-actions {
		align-self: center;
		flex-wrap: wrap;
		gap: 8px;
	}
	.bdw-municipality-actions .bdw-action-btn { min-height: 38px; display: inline-flex; align-items: center; }

	.bdw-municipality-meta { gap: 8px; font-size: 0.84rem; }
	.bdw-municipality-meta span { padding: 4px 10px; }

	.bdw-municipality-stats { gap: 10px; margin-top: 16px; padding-top: 14px; }
	.bdw-municipality-stat { padding: 9px 12px; gap: 8px; }
	.bdw-municipality-stat__value { font-size: 1rem; }
}

@media (max-width: 480px) {
	.bdw-municipality-header { padding: 16px 14px; }
	.bdw-hero-score-badge { padding: 9px 14px; }
	.bdw-hero-score-badge__num { font-size: 1.6rem; }
	.bdw-municipality-stat__value { font-size: 0.95rem; }
	.bdw-municipality-stat__label { font-size: 0.74rem; }
}

@media (max-width: 380px) {
	/* Dos columnas apretadas se leen mejor que una pila de seis tarjetas:
	 * se mantiene la rejilla y se reduce la tipografía. */
	.bdw-municipality-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
	.bdw-municipality-stat { padding: 8px 10px; gap: 6px; }
	.bdw-municipality-stat__value { font-size: 0.9rem; }
	.bdw-municipality-stat__label { font-size: 0.7rem; }
	.bdw-hero-score-badge__num { font-size: 1.45rem; }
	.bdw-hero-score-badge__label { font-size: 0.62rem; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 4 · NAVEGACIÓN DE SECCIÓN (barra pegajosa de la ficha)
 * A ≤480px se ocultaban las etiquetas y quedaba una fila de emojis sin
 * contexto. Se recuperan los textos y se apoya en el scroll horizontal,
 * que ya existía.
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
	.bdw-page-nav {
		padding: 0 6px;
		min-height: 46px;
		scroll-snap-type: x proximity;
	}
	.bdw-page-nav__hint { display: none; }
	.bdw-page-nav__label { display: inline; }
	.bdw-page-nav__link {
		padding: 0 12px;
		font-size: 0.8rem;
		gap: 6px;
		scroll-snap-align: start;
	}
	.bdw-page-nav__icon { font-size: 0.95rem; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 5 · SECCIONES, TABLAS Y EXPORTACIÓN
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.bdw-section-block { margin-bottom: 28px; }
	.bdw-section-block__header { gap: 10px; margin-bottom: 12px; }
	.bdw-section-block__header h2 { font-size: 1.15rem; }

	/* Los botones de exportar comparten la fila a partes iguales. */
	.bdw-section-export { width: 100%; gap: 8px; }
	.bdw-export-btn {
		flex: 1 1 auto;
		justify-content: center;
		min-height: 40px;
		padding: 8px 12px;
	}

	/* Scroll horizontal contenido: no arrastra la página al deslizar la tabla. */
	.bdw-table-wrap,
	.bdw-ranking-table-wrapper {
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
	}
	.bdw-indicators-flat-table { font-size: 0.84rem; }
	.bdw-indicators-flat-table th,
	.bdw-indicators-flat-table td { padding: 9px 10px; }
	.bdw-indicators-flat-table td:nth-child(2) { min-width: 190px; }

	/* Rejilla demográfica: mínimos más pequeños para no dejar una sola
	 * columna con tarjetas gigantes. */
	.bdw-demog-info-grid { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }

	/* Enlaces del pie de la ficha: píldoras a ancho completo, dos por fila. */
	.bdw-muni-links { gap: 8px; padding: 20px 0 28px; }
	.bdw-muni-link,
	.bdw-muni-links .odsl-alerts-btn {
		flex: 1 1 calc(50% - 4px);
		justify-content: center;
		min-height: 42px;
		padding: 10px 14px;
	}

	/* Selector de año más compacto. */
	.bdw-year-selector { padding: 14px; margin-bottom: 22px; gap: 8px; }
}

@media (max-width: 480px) {
	.bdw-section-block__header h2 { font-size: 1.05rem; }
	.bdw-export-btn { font-size: 0.78rem; padding: 8px 10px; }
	.bdw-indicators-flat-table { font-size: 0.8rem; }
	.bdw-indicators-flat-table th,
	.bdw-indicators-flat-table td { padding: 8px 9px; }
	.bdw-state-pill { font-size: 0.72rem; padding: 3px 8px; }
	.bdw-demog-info-grid { grid-template-columns: 1fr 1fr; }
	.bdw-muni-link,
	.bdw-muni-links .odsl-alerts-btn { flex: 1 1 100%; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 6 · TARJETAS DE ODS (rejilla inferior de la ficha)
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.bdw-goals-grid { gap: 10px; margin-top: 16px; }
	.bdw-goal-card { padding: 14px 14px; gap: 10px; border-radius: 10px; }
	.bdw-goal-card__header { gap: 10px; }
	.bdw-goal-card__icon { width: 40px; height: 40px; }
	.bdw-goal-card__icon-num { font-size: 0.9rem; }
	.bdw-goal-card__title { font-size: 0.85rem; }
	.bdw-goals-section-title { margin-top: 28px; }
	.bdw-goals-section-title h2 { font-size: 1.08rem; }
}

@media (max-width: 380px) {
	/* Una columna, pero con la tarjeta ya compacta del breakpoint anterior. */
	.bdw-goal-card { padding: 13px 13px; }
	.bdw-goal-card__icon { width: 38px; height: 38px; }
}

/* ───────────────────────────────────────────────────────────────────────────
 * 7 · TÁCTIL: sin estados hover residuales tras el tap
 * ─────────────────────────────────────────────────────────────────────── */
@media (hover: none) {
	.bdw-goal-card:hover { transform: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
	.bdw-goal-card.is-active { transform: none; }
	.bdw-wheel-mobile-item:hover { filter: none; }
	.bdw-wheel-sector:hover { stroke-width: 2; filter: none; }
}

/* ── Rosco: legibilidad de etiquetas por tamaño real, no por dispositivo ───
 * El SVG usa un viewBox de 400 unidades, así que el tamaño aparente de una
 * etiqueta es 10px × (ancho_renderizado / 400):
 *
 *   ancho 312px (móvil 390)  → 7,8px   ilegible  → etiquetas fuera, lista
 *   ancho 400px (móvil 480)  → 10px    justo     → frontera
 *   ancho 534px (tablet 768) → 13,4px  cómodo    → etiquetas dentro
 *
 * Por eso la frontera se pone en 480px de viewport y no en los 768px que
 * había antes: entre 481 y 768 el rosco es perfectamente legible y la lista
 * de 17 elementos sólo añadía ~950px de scroll sin aportar nada.
 * ───────────────────────────────────────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
	.bdw-wheel-label { display: block; }
	.bdw-wheel-mobile-list { display: none; }
	/* Aprovecha todo el ancho de la columna en tablet en vez de quedarse
	 * en los 400px del breakpoint móvil. */
	.bdw-wheel-svg { width: min(100%, 470px); }
}

/* Los iconos emoji quedan por debajo de 9px en cuanto el rosco baja de
 * ~520px: a ese tamaño son manchas, no símbolos. Los números sí se leen. */
@media (max-width: 900px) {
	.bdw-wheel-icon { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
 * ESQUEMA DE COLOR FIJO EN CLARO — 2026-09-02
 *
 * Complemento de DARK-MODE-OFF. Aunque ya no se apliquen las reglas de modo
 * oscuro, el navegador de un móvil con el sistema en oscuro seguiría pintando
 * en oscuro los controles nativos que hay dentro de la ficha: los <select> de
 * año e indicador, los <input> del portal de aportación, las casillas y las
 * barras de scroll internas. Quedaban cajas negras sobre tarjetas blancas.
 *
 * color-scheme: light se lo dice al navegador de forma explícita. No pinta
 * nada por sí mismo: sólo fija qué paleta usa el UA para esos widgets.
 * ═══════════════════════════════════════════════════════════════════════════ */
.bdw-display-wrapper,
.bdw-municipality-wrapper,
.bdw-comparator-wrapper {
	color-scheme: light;
}


/* ═══════════════════════════════════════════════════════════════════════════
 * SCROLL HORIZONTAL EN TODA LA FICHA — 2026-09-02
 *
 * En producción, a 380px, el documento medía 895px de ancho: la página se
 * desplazaba en horizontal, dejaba una franja beige enorme a la derecha y
 * empujaba el botón de accesibilidad fuera de la pantalla.
 *
 * CAUSA (aislada ocultando nodos uno a uno):
 * la tabla de indicadores mide 900px y vive dentro de .bdw-table-wrap, que
 * tiene overflow-x: auto y la recorta bien. Pero su cabecera incluye
 *     <th class="bdw-col-meta"><span class="screen-reader-text">…</span></th>
 * y ese span es position: absolute. Como .bdw-table-wrap era position:
 * static, su bloque contenedor NO era el contenedor con scroll sino un
 * ancestro de más arriba, así que el span quedaba anclado en la posición
 * estática de la última columna (x≈894) SIN que nadie lo recortara, y
 * estiraba el documento hasta 895px él solito.
 *
 * SOLUCIÓN: position: relative en el envoltorio. Con eso el contenedor con
 * scroll pasa a ser el bloque contenedor del span, que se recorta como el
 * resto del contenido. Verificado en producción: 895px → 380px, y la tabla
 * sigue desplazándose por dentro (scrollWidth 900 sobre clientWidth 343).
 *
 * Se aplica a todos los tamaños porque el defecto no era sólo de móvil.
 * ═══════════════════════════════════════════════════════════════════════════ */
.bdw-display-wrapper .bdw-table-wrap {
	position: relative;
}

/* Red de seguridad: cualquier otro texto sólo-para-lectores dentro de la
 * ficha se ancla a la esquina del bloque en vez de a su posición estática,
 * que es lo que lo mandaba a x≈894. */
.bdw-display-wrapper .screen-reader-text {
	inset-inline-start: 0;
	top: 0;
}

/* ── El "diente" de la barra de secciones ──────────────────────────────────
 * La barra tiene las esquinas superiores redondeadas (14px), pero el fondo
 * de la pestaña activa era un rectángulo con esquinas rectas que llegaba
 * hasta arriba del todo. Al ser "Metas ODS" la primera, su bloque azulado
 * chocaba contra la curva del contenedor y se leía como un escalón: las
 * pestañas inactivas parecían más altas.
 *
 * Redondear el fondo activo por arriba lo encaja dentro del contenedor y el
 * escalón desaparece. El subrayado inferior no cambia: sigue recto.
 * NOTA: esto también afecta al escritorio, donde el escalón era idéntico.
 * ───────────────────────────────────────────────────────────────────────── */
.bdw-page-nav__link.is-active {
	border-radius: 10px 10px 0 0;
}

/* ── Columna "Metadatos" de la tabla de Indicadores — 2026-09-25 ──────────
 * El icono ℹ️ se veía como un punto y la columna parecía vacía. WordPress
 * sustituye el emoji por <img class="emoji">, y el reset del tema
 * (img { max-width: 100% }) hace que un <img> con max-width en porcentaje
 * aporte 0 al ancho mínimo: en una columna de width:1% el icono quedaba en
 * ~2px. Además el reset de <button> (misma especificidad, cargado después)
 * le ponía borde/color rosa. Selectores con más peso y max-width:none.
 * ───────────────────────────────────────────────────────────────────────── */
.bdw-display-wrapper button.bdw-meta-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	border-radius: 6px;
	color: inherit;
	font-size: 1.05rem;
	line-height: 1;
	padding: 4px 6px;
	min-width: 0;
	white-space: nowrap;
}
.bdw-display-wrapper button.bdw-meta-icon-btn:hover,
.bdw-display-wrapper button.bdw-meta-icon-btn:focus-visible {
	background: #eef1f8;
	color: inherit;
}
.bdw-display-wrapper .bdw-meta-icon-btn img.emoji {
	max-width: none;
}
.bdw-display-wrapper .bdw-indicators-flat-table .bdw-col-code {
	white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
 * REVISIÓN UX/UI DEL FRONTEND — 2026-10-01 (3.22.3)
 * Problemas vistos en producción a 390px de ancho.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* 1 · Tarjetas "Resumen por ODS": repeat(2, 1fr) equivale a
 * minmax(auto, 1fr), así que el contenido mínimo de la tarjeta empujaba la
 * columna derecha 2px fuera de la pantalla (el body recorta y quedaba
 * cortada). minmax(0, 1fr) reparte el ancho real. */
@media (max-width: 768px) {
	.bdw-display-wrapper .bdw-goals-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 480px) {
	.bdw-display-wrapper .bdw-goals-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 2 · Evolución demográfica: a 390px las dos columnas dejaban ~140px por
 * tarjeta; el título ocupaba 5 líneas y el gráfico quedaba diminuto. Una
 * columna hasta 480px. */
@media (max-width: 480px) {
	.bdw-display-wrapper .bdw-demog-indicators-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 3 · Tabla "Indicadores" en el móvil: con 7 columnas y scroll horizontal,
 * las columnas Valor / Valor objetivo / Estado quedaban fuera de la vista
 * (la columna "Valor" parecía vacía). En pantallas estrechas cada fila pasa
 * a ser una tarjeta con etiquetas (data-label). Sólo en pantalla: la
 * impresión sigue usando la tabla (print.css). */
@media screen and (max-width: 640px) {
	.bdw-display-wrapper .bdw-table-wrap {
		overflow-x: visible;
		border: 0;
		border-radius: 0;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table,
	.bdw-display-wrapper .bdw-indicators-flat-table tbody,
	.bdw-display-wrapper .bdw-indicators-flat-table tr,
	.bdw-display-wrapper .bdw-indicators-flat-table td {
		display: block;
		width: auto;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table tbody tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 8px 12px;
		position: relative;
		padding: 12px 14px;
		margin-bottom: 10px;
		background: #fff;
		border: 1px solid #e4eaf5;
		border-radius: 12px;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table tbody tr:hover {
		background: #fff;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table td {
		padding: 0;
		border: 0;
		text-align: left;
		white-space: normal;
		min-width: 0;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table td.bdw-col-code {
		grid-column: 1 / -1;
		font-size: 0.72rem;
		font-weight: 700;
		color: var(--bdw-navy, #19486A);
		padding-right: 40px;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table td.bdw-col-name {
		grid-column: 1 / -1;
		min-width: 0;
		font-weight: 600;
		line-height: 1.35;
		padding-right: 32px;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table td[data-label]::before {
		content: attr(data-label);
		display: block;
		font-size: 0.68rem;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: #6b7280;
		margin-bottom: 2px;
	}
	.bdw-display-wrapper .bdw-indicators-flat-table td.bdw-col-meta {
		position: absolute;
		top: 8px;
		right: 8px;
		width: auto;
	}
}
@media screen and (max-width: 640px) {
	/* Sin la cebra de la tabla (del tema: table tbody>tr:nth-child(odd)>td):
	 * dentro de la tarjeta cada celda salía como una caja gris. */
	.bdw-display-wrapper .bdw-indicators-flat-table tbody tr td {
		background: transparent;
	}
}
