/* admin.css — Estilos del panel de administración del CHDCLM.
   Se carga DESPUÉS de main.css y solo en páginas dentro de /admin/. */

/* ============================================================ */
/* === LAYOUT BASE                                          === */
/* ============================================================ */

body.is-admin {
  background: var(--ink-50);
  font-size: 15px;
  line-height: 1.5;
  /* Anula el padding-top que el main.css aplica para el header flotante */
  padding-top: 0;
  /* En el admin usamos sans-serif (Inter) también para titulares.
     El serif Fraunces queda para el sitio público; el admin pide algo más
     funcional/legible a alta densidad. */
  --font-display: var(--font-body);
}

/* Pesos y tracking más adecuados para Inter en tamaños grandes
   (Inter 500 se ve más fino que Fraunces 500; subimos a 600). */
body.is-admin .admin-content__header h1,
body.is-admin .admin-stat__value,
body.is-admin .admin-module h3,
body.is-admin .admin-module__metric strong,
body.is-admin .admin-login-card h1 {
  font-weight: 600;
  letter-spacing: -0.012em;
  font-style: normal;
}

/* El subtítulo "admin" del brand del sidebar queda en Inter normal */
body.is-admin .admin-sidebar__brand span {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
}

body.is-admin .site-header,
body.is-admin .site-footer { display: none; }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================ */
/* === SIDEBAR                                              === */
/* ============================================================ */

.admin-sidebar {
  width: 240px;
  background: var(--teal-900);
  color: rgba(255, 255, 255, 0.92);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  z-index: 50;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
  box-sizing: border-box;
}

.admin-sidebar__brand img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  user-select: none;
  /* Mismo tamaño en expandido y plegado — así no se deforma ni causa
     shift vertical en el resto del menú. */
}

.admin-sidebar__brand span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
}

.admin-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.admin-sidebar__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  padding: 18px 12px 6px;
  font-weight: 600;
}

.admin-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
}

.admin-sidebar__item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.admin-sidebar__item.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-weight: 600;
}

.admin-sidebar__item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.admin-sidebar__item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.admin-sidebar__item.is-active svg { opacity: 1; }

.admin-sidebar__logout {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__logout .admin-sidebar__item:hover {
  background: rgba(165, 28, 48, 0.22);   /* hint del color --accent */
  color: var(--white);
}

/* ============================================================ */
/* === MAIN (topbar + content)                              === */
/* ============================================================ */

.admin-main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--ink-100);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-500);
}

.admin-breadcrumb a {
  color: var(--ink-500);
  text-decoration: none;
}

.admin-breadcrumb a:hover { color: var(--teal-700); }

.admin-breadcrumb .current {
  color: var(--ink-900);
  font-weight: 500;
}

.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-topbar__search {
  position: relative;
  width: 260px;
}

.admin-topbar__search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--ink-100);
  border-radius: 100px;
  padding: 0 14px 0 38px;
  font-size: 14px;
  background: var(--ink-50);
  transition: all 0.2s;
}

.admin-topbar__search input:focus {
  outline: none;
  border-color: var(--teal-500);
  background: var(--white);
}

.admin-topbar__search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
}

.admin-topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 100px;
  background: var(--ink-50);
  cursor: pointer;
  transition: background 0.2s;
}

.admin-topbar__user:hover { background: var(--ink-100); }

.admin-topbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal-700);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.admin-topbar__user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-700);
}

.admin-topbar__bell {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-50);
  color: var(--ink-500);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.admin-topbar__bell:hover { background: var(--ink-100); color: var(--teal-700); }

.admin-topbar__bell-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--white);
}

/* ============================================================ */
/* === CONTENT AREA                                         === */
/* ============================================================ */

.admin-content {
  padding: 32px;
  flex: 1;
}

.admin-content__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
  flex-wrap: wrap;
}

.admin-content__header h1 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  margin: 0;
}

.admin-content__header p {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 15px;
}

.admin-content__actions {
  display: flex;
  gap: 10px;
}

/* ============================================================ */
/* === CARDS / WIDGETS                                      === */
/* ============================================================ */

.admin-card {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--ink-100);
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgba(14, 143, 148, 0.04);
}

/* Variante de altura fija con scroll interno — útil en dashboards densos */
.admin-card--fixed {
  display: flex;
  flex-direction: column;
  max-height: 340px;
}
.admin-card--fixed .admin-card__head { flex-shrink: 0; }
.admin-card--fixed .admin-card__body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  margin: 0 -8px;            /* compensa para que el scrollbar no toque el padding */
  padding: 0 8px;
}
.admin-card--fixed .admin-card__body::-webkit-scrollbar { width: 6px; }
.admin-card--fixed .admin-card__body::-webkit-scrollbar-thumb {
  background: var(--ink-100); border-radius: 100px;
}
.admin-card--fixed .admin-card__body::-webkit-scrollbar-thumb:hover { background: var(--ink-200, #c7c7c7); }

.admin-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.admin-card__title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-500);
  margin: 0;
}

.admin-card__link {
  font-size: 13px;
  color: var(--teal-700);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-card__link:hover { color: var(--teal-900); }

/* Stat cards (4-up arriba del dashboard) */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.admin-stat {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--ink-100);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.admin-stat:hover {
  border-color: var(--aqua-200);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14, 143, 148, 0.08);
}

.admin-stat__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--aqua-50);
  color: var(--teal-700);
  flex-shrink: 0;
}

.admin-stat--accent .admin-stat__icon {
  background: var(--accent-50);
  color: var(--accent);
}

.admin-stat__body { flex: 1; min-width: 0; }

.admin-stat__value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.admin-stat__label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 6px;
}

.admin-stat__sub {
  font-size: 13.5px;
  color: var(--ink-500);
  line-height: 1.35;
}

.admin-stat__sub strong {
  color: var(--accent);
  font-weight: 600;
}

/* Grid 2x2 para las secciones por área */
.admin-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

/* Mini-tarjetas por área del dashboard:
   muestran SOLO un indicador de estado, sin totales redundantes. */
.admin-area-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.admin-area-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--ink-100);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.admin-area-card:hover {
  border-color: var(--aqua-200);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(14, 143, 148, 0.08);
}

.admin-area-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--aqua-50);
  color: var(--teal-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-area-card__body { flex: 1; min-width: 0; }

.admin-area-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 2px;
}

.admin-area-card__status {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-500);
}

.admin-area-card__status--ok   { color: #1E6B2C; }
.admin-area-card__status--warn { color: var(--accent); font-weight: 600; }

.admin-area-card__chevron {
  color: var(--ink-300);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .admin-area-grid { grid-template-columns: repeat(2, 1fr); }
}

.admin-module {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--ink-100);
  padding: 22px 24px;
}

.admin-module h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink-900);
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-module__metrics {
  display: flex;
  gap: 24px;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
}

.admin-module__metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-900);
  font-weight: 500;
  line-height: 1;
  margin-bottom: 3px;
}

.admin-module__metric span {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
}

.admin-module__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-module__list li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--ink-700);
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink-100);
}

.admin-module__list li:last-child { border-bottom: 0; }

.admin-module__list a {
  color: var(--teal-700);
  text-decoration: none;
  font-weight: 500;
}

.admin-module__list a:hover { text-decoration: underline; }

/* ============================================================ */
/* === BADGES (estados)                                     === */
/* ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.badge--ok      { background: #E1F5DE; color: #1E6B2C; }
.badge--warn    { background: #FFF4D6; color: #8A5A0B; }
.badge--orange  { background: #FFE6CC; color: #B5530A; }
.badge--purple  { background: #EDE9FE; color: #6D28D9; }
.badge--error   { background: var(--accent-50); color: var(--accent); }
.badge--info    { background: var(--aqua-50); color: var(--teal-700); }
.badge--neutral { background: var(--ink-100); color: var(--ink-500); }

/* ============================================================ */
/* === ALERTAS Y ACTIVIDAD                                  === */
/* ============================================================ */

.admin-alert-list,
.admin-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-alert {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--ink-50);
  margin-bottom: 8px;
  transition: background 0.2s;
}

.admin-alert:hover { background: var(--aqua-50); }

.admin-alert__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-alert--warn .admin-alert__icon  { background: #FFF4D6; color: #8A5A0B; }
.admin-alert--error .admin-alert__icon { background: var(--accent-50); color: var(--accent); }
.admin-alert--info .admin-alert__icon  { background: var(--aqua-100); color: var(--teal-700); }

.admin-alert__body { flex: 1; min-width: 0; }

.admin-alert__title {
  font-weight: 600;
  color: var(--ink-900);
  font-size: 14.5px;
  margin: 0 0 2px;
}

.admin-alert__meta {
  font-size: 13px;
  color: var(--ink-500);
}

.admin-alert__action {
  font-size: 13px;
  color: var(--teal-700);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.admin-alert__action:hover { color: var(--teal-900); }

.admin-activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-100);
  font-size: 14px;
}

.admin-activity-item:last-child { border-bottom: 0; }

.admin-activity-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-500);
  flex-shrink: 0;
}

.admin-activity-item__text { flex: 1; color: var(--ink-700); }

.admin-activity-item__text strong { color: var(--ink-900); font-weight: 600; }

.admin-activity-item__time {
  font-size: 12.5px;
  color: var(--ink-400);
  white-space: nowrap;
}

/* ============================================================ */
/* === TABLAS (lista de colegiados, cursos, etc.)           === */
/* ============================================================ */

.admin-table-wrap {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--ink-100);
  overflow-x: auto;   /* en pantallas estrechas (portátiles) la tabla se desliza
                         en horizontal en vez de apelotonar las columnas */
}

/* Tabla de datos densa (p. ej. colegiados): columnas ordenadas, paddings algo
   más compactos y un ancho mínimo para que no se aplaste; bajo ese ancho, el
   contenedor hace scroll horizontal. */
.admin-table--fit { table-layout: fixed; min-width: 1060px; }
.admin-table--fit thead th,
.admin-table--fit tbody td { box-sizing: border-box; padding-left: 12px; padding-right: 12px; }

/* Trunca con puntos suspensivos el texto largo (email, nombre) para que no
   ensanche la columna; el valor completo se ve en el tooltip (title). */
.cell-ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead th {
  text-align: left;
  padding: 14px 18px;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-500);
}

.admin-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700);
}

.admin-table tbody tr:last-child td { border-bottom: 0; }

.admin-table tbody tr:hover { background: var(--ink-50); }

.admin-table .nombre {
  color: var(--ink-900);
  font-weight: 500;
}

.admin-table .acciones {
  text-align: right;
  white-space: nowrap;
}

/* Variante: columna de acciones alineada a la izquierda (bajo el encabezado),
   p. ej. el listado de cursos. Se mantiene como celda de tabla (vertical-align
   normal con el resto de columnas) y se separan el icono (ver) y el botón
   (publicar/despublicar) con margen, para que no queden pegados ni haya clics
   accidentales al mover el ratón rápido. */
.admin-table--acc-left .acciones {
  text-align: left;
  vertical-align: middle;
}
.admin-table--acc-left .acciones > * { vertical-align: middle; }
.admin-table--acc-left .acciones > * + * { margin-left: 16px; }
.admin-table--acc-left .acciones form { margin: 0; }

.admin-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.18s;
}

.admin-icon-btn:hover { background: var(--ink-100); color: var(--teal-700); }
.admin-icon-btn.is-danger:hover { background: var(--accent-50); color: var(--accent); }

/* ============================================================ */
/* === FILTROS Y TOOLBAR                                    === */
/* ============================================================ */

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.admin-toolbar__search {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.admin-toolbar__search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  padding: 0 14px 0 38px;
  font-size: 14px;
  background: var(--white);
}

.admin-toolbar__search input:focus {
  outline: none;
  border-color: var(--teal-500);
}

.admin-toolbar__search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
}

.admin-toolbar select {
  height: 38px;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  padding: 0 32px 0 14px;
  font-size: 14px;
  background: var(--white);
  cursor: pointer;
}

.admin-toolbar select:focus {
  outline: none;
  border-color: var(--teal-500);
}

/* ============================================================ */
/* === LOGIN ADMIN                                          === */
/* ============================================================ */

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--aqua-200) 0%, var(--aqua-100) 55%, var(--aqua-50) 100%);
  padding: 32px;
}

.admin-login-card {
  background: var(--white);
  border-radius: 18px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(14, 143, 148, 0.18);
}

.admin-login-card__logo {
  height: 44px;
  display: block;
  margin: 0 auto 28px;
}

.admin-login-card h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  text-align: center;
  margin: 0 0 6px;
}

.admin-login-card p.lead {
  text-align: center;
  color: var(--ink-500);
  font-size: 14.5px;
  margin: 0 0 28px;
}

/* ============================================================ */
/* === RESPONSIVE                                           === */
/* ============================================================ */

@media (max-width: 1100px) {
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-modules-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .admin-sidebar { width: 64px; padding-left: 8px; padding-right: 8px; }
  .admin-sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .admin-sidebar__brand span,
  .admin-sidebar__item span,
  .admin-sidebar__group-label { display: none; }
  .admin-sidebar__item { justify-content: center; padding: 10px 12px; }
  .admin-main { margin-left: 64px; }
  .admin-topbar { padding: 0 16px; }
  .admin-topbar__search { display: none; }
  .admin-topbar__user-name { display: none; }
  .admin-content { padding: 20px 16px; }
  .admin-stats-grid { grid-template-columns: 1fr; }
  /* En móvil el sidebar va siempre plegado: el toggle no tendría sentido */
  .admin-sidebar-toggle { display: none; }
}

/* ============================================================ */
/* === MODAL <dialog> (set password, etc.)                  === */
/* ============================================================ */
dialog.admin-modal {
  border: 0;
  border-radius: 14px;
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  color: var(--ink-700);
  background: var(--white);
}
dialog.admin-modal::backdrop {
  background: rgba(15, 23, 42, .45);
}
dialog.admin-modal .field { margin-bottom: 12px; }
dialog.admin-modal h3 { font-family: var(--font-body); }

/* ════════════════════════════════════════════════════════════════════════
   Bulk action bar (selección masiva en listado de colegiados)
════════════════════════════════════════════════════════════════════════ */
.admin-bulk-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--teal-700);
  color: #fff;
  border-radius: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(14, 143, 148, 0.22);
}
.admin-bulk-bar[hidden] { display: none; }
.admin-bulk-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-bulk-bar__count { font-size: 14px; }
.admin-bulk-bar__count strong { font-size: 16px; }
.admin-bulk-bar .btn-primary { background: #fff; color: var(--teal-700); }
.admin-bulk-bar .btn-primary:hover { background: var(--aqua-50); }
.admin-bulk-bar .btn-ghost { color: #fff; opacity: .85; }
.admin-bulk-bar .btn-ghost:hover { opacity: 1; background: rgba(255,255,255,0.12); }

.bulk-actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.16);
  min-width: 280px;
  padding: 6px 0;
  z-index: 100;
}
.bulk-actions-menu[hidden] { display: none; }
.bulk-actions-menu hr {
  border: 0;
  border-top: 1px solid var(--ink-100);
  margin: 4px 0;
}
.bulk-action-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--ink-700);
  cursor: pointer;
  font-weight: 500;
}
.bulk-action-item:hover { background: var(--aqua-50); }
.bulk-action-item--accent { color: var(--accent); }
.bulk-action-item[data-color="accent"] { color: var(--accent); }

/* ════════════════════════════════════════════════════════════════════════
   Bulk action bar v2 — botones inline (sin dropdown)
   Más eficiente: 1 clic en lugar de 2. El filtrado por estado decide qué
   botones se muestran, así nunca aparecen acciones inaplicables.
════════════════════════════════════════════════════════════════════════ */
.admin-bulk-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-bulk-bar__info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.admin-bulk-bar__count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.admin-bulk-bar__count strong { font-size: 16px; }
.admin-bulk-bar__summary {
  font-size: 12.5px;
  opacity: .85;
  white-space: nowrap;
}
.admin-bulk-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms, border-color 160ms, transform 80ms;
}
.bulk-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.5); }
.bulk-btn:active { transform: scale(0.97); }
.bulk-btn[hidden] { display: none; }
.bulk-btn--ok {
  background: #fff;
  color: var(--teal-700);
  border-color: #fff;
}
.bulk-btn--ok:hover { background: var(--aqua-50); }
.bulk-btn--ko {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 200, 200, 0.4);
  color: #ffe2e2;
}
.bulk-btn--ko:hover { background: rgba(255, 200, 200, 0.18); border-color: rgba(255, 200, 200, 0.7); color: #fff; }
.bulk-btn--neutral {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.bulk-btn-sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
}
.bulk-btn-sep[hidden] { display: none; }
.bulk-btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  opacity: .85;
  transition: opacity 160ms, background 160ms;
}
.bulk-btn-cancel:hover { opacity: 1; background: rgba(255, 255, 255, 0.22); }

/* Encabezados de tabla sortables (admin/colegiados.php) */
.admin-table th .sort-th {
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 4px;
  transition: background 120ms, color 120ms;
}
.admin-table th .sort-th:hover {
  background: var(--ink-50);
  color: var(--teal-700);
}

/* Rango de fechas en la toolbar de filtros */
.admin-date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  font-size: 13px;
}
.admin-date-range__label {
  color: var(--ink-500);
  font-weight: 500;
  white-space: nowrap;
}
.admin-date-range input[type="date"] {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 2px;
  color: var(--ink-700);
  min-width: 120px;
}
.admin-date-range input[type="date"]:focus { outline: 1px solid var(--teal-700); border-radius: 4px; }
.admin-date-range__sep { color: var(--ink-400); font-size: 12px; }

/* ════════════════════════════════════════════════════════════════════════
   Sidebar plegable manual
   ════════════════════════════════════════════════════════════════════════
   Cuando la clase `admin-sidebar-collapsed` está en el <html> (set via JS
   en cuanto se lee localStorage, antes incluso de renderizar el body), el
   sidebar pasa a 64 px mostrando solo iconos y el contenido principal se
   amplía. Mismo patrón que el responsive ≤800 px, pero controlable por
   el usuario en cualquier resolución. */

.admin-sidebar,
.admin-main {
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1),
              margin-left 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Solo cambia el padding HORIZONTAL al plegar — los verticales se mantienen
   para evitar que los elementos del menú se desplacen arriba/abajo entre
   estados. */
html.admin-sidebar-collapsed .admin-sidebar {
  width: 64px;
  padding-left: 8px;
  padding-right: 8px;
}
html.admin-sidebar-collapsed .admin-sidebar__brand {
  justify-content: center;
  /* Quitamos el padding lateral: con el sidebar a 64 px y su padding 8 px,
     el brand ya queda en un contenedor de 48 px. Si añadiéramos 8 px más
     a cada lado en el brand, solo quedarían 32 px y un logo cuadrado de
     40 px sería clampado por max-width:100% → se vería deformado. */
  padding-left: 0;
  padding-right: 0;
}
html.admin-sidebar-collapsed .admin-sidebar__brand span,
html.admin-sidebar-collapsed .admin-sidebar__item span,
html.admin-sidebar-collapsed .admin-sidebar__group-label {
  display: none;
}
html.admin-sidebar-collapsed .admin-sidebar__item {
  justify-content: center;
  /* mantenemos vertical 10px como en expandido para que no haya shift */
  padding: 10px 12px;
}
html.admin-sidebar-collapsed .admin-main {
  margin-left: 64px;
}

/* En el estado plegado los items revelan su nombre en tooltip nativo del
   navegador (atributo title); además, los iconos pasan a opacidad 1 para
   compensar la pérdida visual del texto. */
html.admin-sidebar-collapsed .admin-sidebar__item svg { opacity: 1; }

/* ─── Toggle estilo "pestaña" que sobresale del borde derecho ─── */
.admin-sidebar { position: fixed; }   /* ya estaba, asegura el contexto */
.admin-sidebar-toggle {
  position: absolute;
  top: 30px;                          /* alineado con la altura del brand */
  right: -14px;                       /* sobresale 14 px hacia el contenido */
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--teal-700);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 51;                        /* sobre el sidebar (z:50) */
  transition: background 160ms, transform 160ms;
}
.admin-sidebar-toggle:hover {
  background: var(--aqua-50);
  transform: scale(1.08);
}
.admin-sidebar-toggle:active { transform: scale(0.95); }
.admin-sidebar-toggle:focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 2px;
}
.admin-sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
html.admin-sidebar-collapsed .admin-sidebar-toggle svg {
  transform: rotate(180deg);          /* flecha apunta a la derecha cuando está plegado */
}

/* En pantallas estrechas (<800px) el sidebar siempre va plegado y el
   botón de toggle deja de tener sentido (no hay sitio para expandirlo).
   Lo ocultamos para no confundir al usuario. */
@media (max-width: 800px) {
  .admin-sidebar-toggle { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   GRUPOS Y PRECIOS (alta/edición de curso)
   Una fila por grupo: casilla de admisión + campo de precio.
   ════════════════════════════════════════════════════════════════════════ */
.grupo-precio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  margin-bottom: 10px;
}
.grupo-precio__check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}
.grupo-precio__check input { width: 17px; height: 17px; flex: none; cursor: pointer; }
.grupo-precio__price {
  position: relative;
  flex: none;
  width: 150px;
}
.grupo-precio__price input {
  width: 100%;
  padding-right: 26px;
  text-align: right;
}
.grupo-precio__price input:disabled {
  background: var(--ink-50);
  color: var(--ink-300);
}
.grupo-precio__eur {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  font-size: 14px;
  pointer-events: none;
}
@media (max-width: 560px) {
  .grupo-precio { flex-direction: column; align-items: stretch; gap: 10px; }
  .grupo-precio__price { width: 100%; }
}

/* Cabeceras ordenables client-side (tabla de inscripciones del curso) */
.admin-table th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.admin-table th.th-sort:hover { color: var(--teal-700); }
.admin-table th.th-sort__arr,
.admin-table th .th-sort__arr {
  color: var(--teal-700);
  font-size: 12px;
}

/* ════════════════════════════════════════════════════════════════════════
   PAGINACIÓN de listados (admin/_paginacion.php)
   ════════════════════════════════════════════════════════════════════════ */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 18px;
  padding: 12px 4px;
  font-size: 13.5px;
  color: var(--ink-500);
}
.admin-pagination__info strong { color: var(--ink-700); }
.admin-pagination__perpage {
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-pagination__opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--ink-100);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink-500);
  font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.admin-pagination__opt:hover { border-color: var(--teal-500); color: var(--teal-700); }
.admin-pagination__opt.is-active {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: #fff;
}
.admin-pagination__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-pagination__page { color: var(--ink-700); font-weight: 500; white-space: nowrap; }
.admin-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  color: var(--ink-700);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.admin-pagination__btn:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--ink-50); }
.admin-pagination__btn.is-disabled { opacity: .4; pointer-events: none; }

/* ─── Barra para insertar imágenes en el cuerpo de una noticia ───────── */
.cuerpo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cuerpo-toolbar__label {
  font-size: 12px;
  color: var(--ink-500);
  margin-right: 2px;
}
.cuerpo-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-700);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cuerpo-toolbar__btn:hover { background: var(--aqua-50); border-color: var(--aqua-400); color: var(--teal-700); }
.cuerpo-toolbar__btn:disabled { opacity: .55; cursor: default; }
.cuerpo-toolbar__btn svg { flex: none; color: var(--teal-700); }
.cuerpo-toolbar__status { font-size: 12px; color: var(--teal-700); }
.cuerpo-toolbar__status.is-error { color: var(--accent); }

/* Vista previa del cuerpo en la ficha de noticia: main.css resetea p{margin:0},
   así que aquí devolvemos la separación entre párrafos y mostramos las
   imágenes insertadas en miniatura, imitando cómo quedarán en la web. */
.cuerpo-preview p { margin: 0 0 12px; }
.cuerpo-preview > *:last-child { margin-bottom: 0; }
.cuerpo-preview::after { content: ""; display: block; clear: both; }
.cuerpo-preview .art-img { margin: 4px 0 14px; }
.cuerpo-preview .art-img img { max-width: 100%; height: auto; display: block; border-radius: 8px; }
.cuerpo-preview .art-img--left  { float: left;  width: min(40%, 220px); margin: 4px 14px 10px 0; }
.cuerpo-preview .art-img--right { float: right; width: min(40%, 220px); margin: 4px 0 10px 14px; }
.cuerpo-preview .art-img figcaption { font-size: 11px; font-style: italic; color: var(--ink-500); margin-top: 4px; }
.cuerpo-preview h2, .cuerpo-preview h3 { clear: both; margin: 14px 0 8px; font-size: 15px; }
