/* =============================================================
   SINGLE TABLÓN — mobile first
============================================================= */

.tablon-single {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

/* ── Estudio dot ─────────────────────────────────────────── */
.tablon-single__estudio {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tablon-single__estudio .estudio-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Registros table — mobile first ─────────────────────── */
.tablon-registros {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2.5rem;
}

/* Hide header on mobile */
.tablon-registros thead {
  display: none;
}

/* Each row stacks as a flex column on mobile */
.tablon-registros tbody tr {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-black);
}

.tablon-registros tbody td {
  padding: 0;
  border: none;
}

/* Nombre first on mobile */
.tablon__col-nombre {
  order: -1;
}

/* Fecha second on mobile */
.tablon__col-fecha {
  order: 0;
}

/* Hide empty fecha cell */
.tablon__col-fecha:empty {
  display: none;
}

/* Link styling — always underlined on mobile */
.tablon-registros a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Registros anidados (Elemento raíz + hijos) ──────────
   Ver dpa_tablon_render_tabla() y assets/js/tablon-registros.js.
   Los hijos llevan [hidden]; hay que forzarlo porque las filas tienen
   display: flex / table-row. */
.tablon-registros tbody tr[hidden] {
  display: none;
}

.tablon-registro--raiz {
  cursor: pointer;
}

/* Raíz e hijos comparten exactamente el mismo padding-left: el texto
   queda alineado por construcción. La flecha del raíz va en posición
   absoluta dentro de ese hueco, así su tamaño no afecta al texto. */
.tablon-registros {
  --tablon-sangria: 1.5rem;
}

.tablon-registro--raiz .tablon__nombre,
.tablon-registro--hijo .tablon__nombre {
  position: relative;
  padding-left: var(--tablon-sangria);
}

/* El botón ocupa el hueco de la sangría y la altura de la primera
   línea de texto (20px = line-height de .body-medium; 1lh donde se
   soporte), así la flecha queda centrada con la primera línea aunque
   el nombre ocupe varias. */
.tablon-registro__toggle {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: var(--tablon-sangria);
  height: 20px;
  height: 1lh;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit; /* misma font-size/line-height que el texto (em y 1lh) */
  cursor: pointer;
}

.tablon-registro__toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Flecha hacia abajo (triángulo sólido) */
.tablon-registro__flecha {
  display: block;
  width: 0;
  height: 0;
  border-left: 0.5em solid transparent;
  border-right: 0.5em solid transparent;
  border-top: 0.55em solid currentColor;
}

/* ── Back button ─────────────────────────────────────────── */
.tablon-single__back {
  display: flex;
  justify-content: center;
  padding: 2rem 0 1rem;
}

/* =============================================================
   TABLET  ≥ 640px
============================================================= */
@media (min-width: 640px) {
  .tablon-single {
    padding-top: 4rem;
    padding-bottom: 5rem;
  }

  /* Restore normal table layout */
  .tablon-registros thead {
    display: table-header-group;
  }

  .tablon-registros thead th {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-black);
    text-align: left;
    vertical-align: top;
  }

  .tablon-registros tbody tr {
    display: table-row;
    padding: 0;
    border-bottom: none;
  }

  .tablon-registros tbody tr:first-child {
    border-top: none;
  }

  .tablon-registros tbody td {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-black);
  }

  /* Nombre: full width */
  .tablon__col-nombre {
    order: 0;
    padding-right: 2rem;
  }

  /* Fecha: compact, left-aligned, no wrap */
  .tablon__col-fecha {
    order: 0;
    width: 130px;
    white-space: nowrap;
  }

  /* Links: no underline by default, underline on hover */
  .tablon-registros a {
    text-decoration: none;
  }

  .tablon-registros a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
  }
}
