.title-magistraturas {
  font-size: 1.5rem;
  color: #000;
  font-weight: 700 !important;
}

/* =========================
   CARD GENERAL DEL TABLERO
   ========================= */
.table-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin: 20px 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.table-card .table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  background: #fff;
}

.table-card table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  margin: 0;
}

/* =========================
   HEADERS
   ========================= */
.table-card th {
  text-transform: uppercase;
  font-size: 0.82em;
  padding: 12px 10px;
  word-break: normal;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.04);
}

.table-card th:last-child {
  border-right: none;
}

#tabla-distritos-locales > thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.bg-header-p {
  background: #5e0081;
  color: #fff;
}

.bg-header-g {
  background: #f1f1f1;
  color: #000;
}

.bg-header-w {
  background-color: #fff;
}

.bg-header-w .single-img {
  max-width: 40px;
  width: 100%;
  height: auto;
}

.bg-header-w .double-img {
  max-width: 80px;
  width: 100%;
  height: auto;
}

/* =========================
   CELDAS
   ========================= */
.table-card td {
  padding: 12px 10px;
  text-align: center;
  font-size: 0.93em;
  word-break: normal;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  border-right: 1px solid rgba(0, 0, 0, 0.04);
  background: #fff;
}

.table-card td:last-child {
  border-right: none;
}

#tabla-distritos-locales th:first-child,
#tabla-distritos-locales td:first-child {
  min-width: 220px;
}

.district-align {
  text-align: left !important;
  font-weight: 700;
  white-space: nowrap;
}

.subtabla-inner td:first-child,
.subtabla-inner th:first-child {
  text-align: left !important;
  font-weight: 700;
  min-width: 180px;
}

/* =========================
   FILAS DISTRITALES
   ========================= */
.table-card tbody tr.accordion:nth-child(odd) {
  background-color: #ffffff;
}

.table-card tbody tr.accordion:nth-child(even) {
  background-color: rgba(113, 35, 129, 0.035);
}

.table-card tr.accordion {
  cursor: pointer;
}

.table-card tr.accordion:hover {
  background-color: rgba(80, 37, 94, 0.06) !important;
  transition: background 0.2s ease;
}

#tabla-distritos-locales tr.accordion,
#tabla-distritos-locales tr.accordion td {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Flecha giratoria */
#tabla-distritos-locales tr.accordion .accordion-icon {
  display: inline-block;
  width: 12px;
  margin-right: 8px;
  transition: transform 0.25s ease;
  transform-origin: center;
}

#tabla-distritos-locales tr.accordion.is-open .accordion-icon {
  transform: rotate(90deg);
}

/* =========================
   SUBTABLA
   ========================= */
#tabla-distritos-locales tr.sub-table-container > td {
  padding: 12px 14px !important;
  background: #fff;
  vertical-align: top;
}

#tabla-distritos-locales .subtabla {
  display: block;
  width: 100%;
  overflow: visible;
  background: #fff;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 14px;
  margin: 6px 0 10px;
}

#tabla-distritos-locales .subtabla strong {
  display: block;
  margin-bottom: 12px;
  text-align: left;
  color: #2c2c2c;
}

#tabla-distritos-locales .contenido-tabla {
  display: block;
  width: 100%;
  margin-top: 10px;
  overflow-x: auto;
  overflow-y: visible;
}

#tabla-distritos-locales .search-casilla {
  display: block;
}

#tabla-distritos-locales .subtabla-inner {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#tabla-distritos-locales .subtabla-inner th,
#tabla-distritos-locales .subtabla-inner td {
  white-space: nowrap;
  text-align: center;
}

/* =========================
   FILAS RESUMEN
   ========================= */
#tabla-distritos-locales .fila-resumen td {
  font-weight: 700;
}

#tabla-distritos-locales .fila-resumen-total td {
  background: rgba(113, 35, 129, 0.08);
  color: #2f1637;
}

#tabla-distritos-locales .fila-resumen-porcentaje td {
  background: rgba(113, 35, 129, 0.04);
  color: #4d2958;
}

/* =========================
   CELDAS ESPECIALES
   ========================= */
.color-nulos {
  background-color: #f3f3f3 !important;
}

/* =========================
   PAGINACIÓN
   ========================= */
.pagination {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 7px 12px;
  background-color: #50255e;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.pagination button:hover:not([disabled]) {
  background-color: #6a3c80;
  transform: translateY(-1px);
}

.pagination button[disabled] {
  background-color: #ccc;
  cursor: not-allowed;
}

.pagination .page-btn.active {
  background-color: rgba(80, 37, 94, 0.95);
  font-weight: bold;
}

.pagination .dots {
  color: #666;
  user-select: none;
}

/* =========================
   TABLA RP
   ========================= */
.rp-section {
  margin-top: 50px;
}

#tabla-rp-total td,
#tabla-rp-total th {
  text-align: center;
  vertical-align: middle;
}

#tabla-rp-total tbody tr {
  background-color: #ffffff;
}

#tabla-rp-total tbody tr:hover {
  background-color: rgba(80, 37, 94, 0.05);
  transition: background 0.2s ease;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 767px) {
  .table-card th,
  .table-card td {
    padding: 8px 6px;
    font-size: 0.84em;
  }

  .table-card {
    margin: 10px 0;
    border-radius: 14px;
  }

  #tabla-distritos-locales .subtabla {
    overflow-x: auto;
  }

  #tabla-distritos-locales .subtabla-inner {
    min-width: 1450px;
  }

  #tabla-distritos-locales th:first-child,
  #tabla-distritos-locales td:first-child {
    min-width: 190px;
  }
}