/* ==========================================================================
   Quién es quién en el Gobierno de España — Estilos oficiales
   Fijate Tools
   ========================================================================== */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema claro por defecto */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;

  --map-fill: #e2e8f0;
  --map-stroke: #cbd5e1;
  --map-highlight: #bfdbfe;
  --map-active: #2563eb;
  --map-text: #334155;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #151d2c;
  --bg-card-subtle: #1e293b;
  --bg-input: #1a2333;
  --border-color: #273549;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.15);

  --map-fill: #1e293b;
  --map-stroke: #334155;
  --map-highlight: #2563eb;
  --map-active: #60a5fa;
  --map-text: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.6);
}

/* Reglas de contención de layout obligatorio */
html, body {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.text-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

/* Contenedor central canónico */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta intro / resumen cívico */
.gob-intro-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.gob-intro-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gob-intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background-color: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.gob-intro-updated {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.gob-intro-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.gob-intro-desc {
  margin: 0 0 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 900px;
}

/* KPIs principales */
.gob-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.gob-kpi-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.gob-kpi-label {
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.gob-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.gob-kpi-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Tabs de navegación (Activo vs Histórico) */
.gob-view-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.gob-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.gob-tab-btn:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
}

.gob-tab-btn.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Sección mapa y distribución territorial */
.gob-map-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.gob-section-heading {
  margin-bottom: 1.25rem;
}

.heading-with-icon {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent);
}

.heading-with-icon h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0 0;
}

.gob-map-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: center;
}

.gob-map-wrapper {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
}

.spain-svg-map {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.06));
}

.map-region {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 1.2;
  cursor: pointer;
  transition: fill 0.25s ease, stroke 0.25s ease, filter 0.2s ease;
}

/* Escala coroplética según número de ministros */
/* 7 ministros (Madrid) */
#map-MD {
  fill: #1d4ed8;
  stroke: #1e40af;
}

/* 3 ministros (Comunitat Valenciana, Castilla y León) */
#map-VC,
#map-CL {
  fill: #2563eb;
  stroke: #1d4ed8;
}

/* 2 ministros (Cataluña, Castilla-La Mancha) */
#map-CT,
#map-CM {
  fill: #60a5fa;
  stroke: #3b82f6;
}

/* 1 ministro (Andalucía, Galicia, Canarias, Extremadura, Navarra, País Vasco) */
#map-AN,
#map-GA,
#map-CN,
#map-EX,
#map-NC,
#map-PV {
  fill: #93c5fd;
  stroke: #60a5fa;
}

/* 0 ministros (resto de CCAA y ciudades autónomas) */
#map-AR,
#map-AS,
#map-CB,
#map-RI,
#map-MC,
#map-IB,
#map-CE,
#map-ML {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
}

[data-theme="dark"] #map-MD {
  fill: #3b82f6;
  stroke: #60a5fa;
}

[data-theme="dark"] #map-VC,
[data-theme="dark"] #map-CL {
  fill: #2563eb;
  stroke: #3b82f6;
}

[data-theme="dark"] #map-CT,
[data-theme="dark"] #map-CM {
  fill: #1d4ed8;
  stroke: #2563eb;
}

[data-theme="dark"] #map-AN,
[data-theme="dark"] #map-GA,
[data-theme="dark"] #map-CN,
[data-theme="dark"] #map-EX,
[data-theme="dark"] #map-NC,
[data-theme="dark"] #map-PV {
  fill: #1e3a8a;
  stroke: #1d4ed8;
}

[data-theme="dark"] #map-AR,
[data-theme="dark"] #map-AS,
[data-theme="dark"] #map-CB,
[data-theme="dark"] #map-RI,
[data-theme="dark"] #map-MC,
[data-theme="dark"] #map-IB,
[data-theme="dark"] #map-CE,
[data-theme="dark"] #map-ML {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
}

.map-region:hover {
  fill: #f59e0b !important;
  stroke: #d97706 !important;
  stroke-width: 2;
  filter: brightness(1.08);
}

.map-region.active {
  fill: #ea580c !important;
  stroke: #c2410c !important;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(234, 88, 12, 0.45));
}

.map-label,
.map-label-highlight,
.map-label-muted,
.map-label-mini {
  font-family: var(--font-main);
  pointer-events: none;
  user-select: none;
  paint-order: stroke fill;
  stroke: var(--bg-card);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-label-highlight {
  font-size: 11px;
  font-weight: 700;
  fill: var(--text-main);
}

.map-label-md {
  font-size: 12px;
  font-weight: 800;
  fill: #1e3a8a;
}

[data-theme="dark"] .map-label-md {
  fill: #93c5fd;
}

.map-label-muted {
  font-size: 9.5px;
  font-weight: 500;
  fill: var(--text-muted);
  opacity: 0.9;
  stroke-width: 2.5px;
}

.map-label-mini {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  fill: var(--text-muted);
}

.map-island-box {
  fill: rgba(0, 0, 0, 0.02);
  stroke: var(--border-color);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

[data-theme="dark"] .map-island-box {
  fill: rgba(255, 255, 255, 0.02);
}

.gob-ccaa-pills-panel {
  display: flex;
  flex-direction: column;
}

.ccaa-panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ccaa-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ccaa-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
}

.ccaa-pill:hover {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

.ccaa-pill.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background-color: rgba(0, 0, 0, 0.15);
  font-size: 0.7rem;
  font-weight: 700;
}

.ccaa-pill.active .badge-count {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Barra de controles y filtros */
.gob-controls-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.gob-search-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.gob-search-input {
  width: 100%;
  height: 42px;
  padding: 0 2.25rem 0 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gob-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gob-select-group {
  display: flex;
  gap: 0.75rem;
  flex: 2 1 450px;
  flex-wrap: wrap;
}

.select-wrapper {
  position: relative;
  flex: 1 1 130px;
  min-width: 0;
}

.gob-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 2.5rem 0 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.875rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background-image: 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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.gob-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.coalition-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.coalition-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.party-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.party-pill:hover {
  border-color: var(--accent);
}

.party-pill.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Contador de resultados */
.gob-results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.btn-reset-filters {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Rejilla de tarjetas de ministros */
.gob-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.gob-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.gob-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.gob-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: linear-gradient(180deg, var(--bg-card-subtle) 0%, var(--bg-card) 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.gob-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  transition: transform 0.35s ease;
}

.gob-card:hover .gob-card-img {
  transform: scale(1.03);
}

.gob-card-order-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.gob-card-party-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gob-card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

.gob-card-rank {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.gob-card-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.35rem 0;
  line-height: 1.25;
}

.gob-card-portfolio {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
  line-height: 1.4;
}

.gob-card-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  font-size: 0.825rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-key {
  color: var(--text-muted);
}

.meta-val {
  color: var(--text-main);
  font-weight: 600;
}

.meta-salary {
  color: #10b981;
}

.btn-card-details {
  width: 100%;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-details:hover {
  background-color: var(--accent);
  color: #ffffff;
}

/* Estado de carga y vacío */
.gob-loading-state,
.gob-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.gob-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

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

/* Modal accesible de ficha en detalle */
.gob-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gob-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.gob-modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.gob-modal-overlay.open .gob-modal-card {
  transform: translateY(0);
}

.gob-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.15s ease;
}

.gob-modal-close:hover {
  background-color: var(--accent-light);
  color: var(--accent);
}

.gob-modal-body {
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Estructura interior del modal */
.modal-header-profile {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.modal-avatar-box {
  position: relative;
  width: 140px;
  height: 180px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-card-subtle);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.modal-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.modal-header-info {
  flex: 1 1 auto;
}

.modal-rank-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.modal-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  color: var(--text-main);
}

.modal-portfolio {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Secciones de detalle en modal */
.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-section-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-patrimonio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.patrimonio-box {
  background-color: var(--bg-card-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.patrimonio-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.patrimonio-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.patrimonio-resumen {
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: var(--bg-card-subtle);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0;
}

.modal-info-block {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.6;
}

.modal-info-block strong {
  color: var(--text-muted);
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.modal-links-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

.btn-official-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn-official-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Acordeón FAQ institucional */
.gob-faq-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.gob-faq-main-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 1.25rem 0;
  color: var(--text-main);
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

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

.faq-item details summary {
  padding: 1rem 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item details summary::-webkit-details-marker {
  display: none;
}

.faq-item details summary:after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.faq-item details[open] summary:after {
  content: "−";
}

.faq-answer {
  padding: 0 0 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.6;
}

.faq-answer p {
  margin: 0;
}

/* ==========================================================================
   Vista de organigrama y jerarquía institucional
   ========================================================================== */
.gob-hierarchy-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  scroll-margin-top: 85px;
}

.hierarchy-intro-box {
  background: linear-gradient(135deg, rgba(227, 7, 19, 0.05), rgba(59, 130, 246, 0.05));
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.hierarchy-intro-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.hierarchy-intro-title svg {
  color: var(--accent);
}

.hierarchy-intro-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.hierarchy-tier {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.hierarchy-tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.hierarchy-tier-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hierarchy-tier-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--accent-light);
  color: var(--accent);
}

.hierarchy-presidencia-row {
  display: flex;
  justify-content: center;
}

.hierarchy-card-featured {
  max-width: 480px;
  width: 100%;
  border: 2px solid var(--accent);
}

.hierarchy-vice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.hierarchy-ministerios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.hierarchy-card-compact {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hierarchy-card-compact:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.hierarchy-card-avatar {
  width: 64px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
}

.hierarchy-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
}

.hierarchy-card-info {
  flex: 1 1 auto;
  min-width: 0;
}

.hierarchy-card-rank {
  display: block;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.hierarchy-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.2rem 0;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hierarchy-card-portfolio {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hierarchy-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hierarchy-card-party {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  color: #ffffff;
}

.hierarchy-btn-view {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hierarchy-btn-view:hover {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.hierarchy-connector-vertical {
  width: 2px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 auto;
}

/* Responsive queries */
@media (max-width: 1024px) {
  .gob-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gob-map-container {
    grid-template-columns: 1fr;
  }

  .gob-ccaa-pills-panel {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
  }
}

@media (max-width: 768px) {
  .gob-intro-card {
    padding: 1.25rem;
  }

  .gob-kpi-grid {
    grid-template-columns: 1fr;
  }

  .gob-cards-grid {
    grid-template-columns: 1fr;
  }

  .modal-header-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .modal-tags {
    justify-content: center;
  }

  .modal-patrimonio-grid {
    grid-template-columns: 1fr;
  }

  .gob-select-group {
    flex-direction: column;
  }

  .select-wrapper {
    flex: 1 1 100%;
  }

  .gob-tab-btn {
    width: 100%;
    justify-content: center;
  }

  .gob-view-tabs {
    flex-direction: column;
  }
}
