/* AMT Journal — Administración: usuarios, códigos de acceso y mentorías (editor de curso y temario) */
.ad { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ad-head { margin-bottom: 0; align-items: center; }
.ad-tabs { overflow-x: auto; scrollbar-width: none; }
.ad-tabs::-webkit-scrollbar { display: none; }
.ad-tabs .tabs button { white-space: nowrap; }
.ad-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ad .err { font-size: 12px; color: var(--neg); }

.ad-acc-c1 { --acc: var(--c1); } .ad-acc-c2 { --acc: var(--c2); } .ad-acc-c3 { --acc: var(--c3); }
.ad-acc-c4 { --acc: var(--c4); } .ad-acc-c5 { --acc: var(--c5); } .ad-acc-c6 { --acc: var(--c6); }

.ad-demo {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 6px 11px; border: 1px solid var(--warn-line); border-radius: var(--r-md); background: var(--warn-soft);
  font-size: 12.5px; color: var(--text-2);
}
.ad-demo .ic { color: var(--warn); flex: none; }

.ad-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 56px 0; font-size: 13px; color: var(--text-3); }
.ad-muted { color: var(--text-3); }
.ad-note { font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.ad-quiet { font-size: 13px; line-height: 1.55; color: var(--text-3); }
.ad-pad { padding: 4px 18px 18px; }
.ad-wrap { white-space: normal; overflow-wrap: anywhere; }
.ad-optional { margin-left: 4px; font-size: 11.5px; font-weight: 400; color: var(--text-4); }
.ad-spin { width: 12px; height: 12px; border-width: 1.5px; }

/* ---------- barra de la lista (búsqueda, filtros, acción) ---------- */
.ad-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 58px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.ad-bar-cta { margin-left: auto; }
.ad-count { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.ad-search { position: relative; display: block; flex: 1 1 260px; max-width: 380px; }
.ad-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.ad-search .input { padding-left: 34px; }
.ad-list { transition: opacity .16s; }
.ad-list.is-busy { opacity: .55; }

/* ---------- tablas ---------- */
.ad-tbl td { vertical-align: middle; }
.ad-tbl .ad-col-act { width: 1%; text-align: right; }
.ad-tbl tr.is-off .ad-chip, .ad-tbl tr.is-off td.num { color: var(--text-3); }
.ad-cell-note { white-space: normal !important; min-width: 140px; max-width: 260px; overflow-wrap: anywhere; line-height: 1.45; color: var(--text-2); }
.ad-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ad-stack-sub { max-width: 240px; font-size: 12px; color: var(--text-3); }
.ad-del:hover { color: var(--neg); background: var(--neg-soft); }
.ad-src { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ad-src .ic { color: var(--text-3); }
.ad-until { display: inline-flex; align-items: center; gap: 8px; }

.ad-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ad-avatar { flex: none; width: 32px; height: 32px; font-size: 12.5px; }
.ad-person-text { min-width: 0; }
.ad-person-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; }
.ad-person-sub { max-width: 280px; margin-top: 1px; font-size: 12px; color: var(--text-3); }

.ad-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 24px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: rgba(255, 255, 255, .03);
  font-size: 12px; color: var(--text-2); white-space: nowrap; transition: border-color .14s, color .14s;
}
.ad-chip:hover { border-color: var(--line-strong); color: var(--text); }
.ad-chip .ic { color: var(--text-3); }
.ad-code { display: flex; align-items: center; gap: 8px; }
.ad-code .ad-chip { color: var(--text); letter-spacing: .02em; }

/* ---------- formularios de los diálogos ---------- */
.ad-form { display: flex; flex-direction: column; gap: 16px; }
.ad-tid-input { text-transform: uppercase; }
.ad-tid-input::placeholder { text-transform: none; }

/* control segmentado con radios */
.ad-choice {
  display: inline-flex; flex-wrap: wrap; align-self: flex-start; gap: 2px; max-width: 100%; padding: 2px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md); background: rgba(255, 255, 255, .025);
}
.ad-choice-opt { position: relative; cursor: pointer; }
.ad-choice-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ad-choice-opt span {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; transition: color .14s, background .14s;
}
.ad-choice-opt:hover span { color: var(--text); }
.ad-choice-opt input:checked + span { background: rgba(255, 255, 255, .085); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.ad-choice-opt input:focus-visible + span { outline: 2px solid rgba(61, 123, 255, .7); outline-offset: 1px; }

/* lista de opciones (vigencia de Premium) */
.ad-opts { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); }
.ad-opt { position: relative; display: flex; align-items: center; gap: 11px; padding: 11px 13px; cursor: pointer; font-size: 13.5px; transition: background .14s; }
.ad-opt + .ad-opt { border-top: 1px solid var(--line-soft); }
.ad-opt:hover { background: var(--hover); }
.ad-opt:has(input:checked) { background: var(--blue-soft); }
.ad-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ad-opt-dot { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--inset); transition: border-color .14s; }
.ad-opt-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); transform: scale(0); transition: transform .16s var(--ease); }
.ad-opt input:checked ~ .ad-opt-dot { border-color: var(--blue); }
.ad-opt input:checked ~ .ad-opt-dot::after { transform: scale(1); }
.ad-opt input:focus-visible ~ .ad-opt-dot { outline: 2px solid rgba(61, 123, 255, .7); outline-offset: 2px; }
.ad-opt-label { flex: 1; min-width: 0; color: var(--text-2); }
.ad-opt input:checked ~ .ad-opt-label { color: var(--text); font-weight: 500; }
.ad-opt-hint { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* código recién creado */
.ad-created { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 4px; text-align: center; }
.ad-created-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--blue-line); background: var(--blue-soft); color: var(--blue); }
.ad-created-title { font-size: 14px; font-weight: 600; }
.ad-bigcode {
  display: flex; align-items: center; justify-content: center; gap: 10px 16px; flex-wrap: wrap; width: 100%; margin-top: 4px; padding: 18px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--inset);
}
.ad-bigcode .mono { font-size: 22px; font-weight: 500; letter-spacing: .06em; color: var(--text); user-select: all; overflow-wrap: anywhere; }
.ad-created-meta { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.ad-created .ad-note { max-width: 380px; }

/* ---------- lista de mentorías ---------- */
.ad-courses { display: flex; flex-direction: column; }
.ad-course {
  display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.25fr) 76px minmax(0, 1.3fr) 104px 16px;
  align-items: center; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); transition: background .12s;
}
.ad-course:last-child { border-bottom: none; }
a.ad-course:hover { background: rgba(255, 255, 255, .025); }
a.ad-course:focus-visible { outline-offset: -2px; }
.ad-course-head { padding-top: 10px; padding-bottom: 10px; }
.ad-thumb {
  display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--acc, var(--blue)) 32%, transparent); background: color-mix(in srgb, var(--acc, var(--blue)) 11%, transparent); color: var(--acc, var(--blue));
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-course-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ad-course-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ad-course-sub { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.ad-course-cell { min-width: 0; font-size: 13px; color: var(--text-2); }
.ad-course-go { color: var(--text-4); }

/* ---------- editor de mentoría ---------- */
.ad-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); transition: color .14s; }
.ad-back:hover { color: var(--text); }
.ad-ed { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ad-ed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 4px; }
.ad-ed-titles { flex: 1 1 320px; min-width: 0; }
.ad-ed-titles .page-title { overflow-wrap: anywhere; }
.ad-ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 388px; gap: 16px; align-items: start; }
.ad-ed-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ad-fields { display: flex; flex-direction: column; gap: 16px; }
.ad-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ad-label-row label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.ad-counter { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ad-req { color: var(--blue); }
.ad-desc { min-height: 148px; }
.ad-sec-head { align-items: flex-start; flex-wrap: wrap; padding-bottom: 2px; }
.ad-tools { flex-wrap: wrap; }
.ad-badge { margin-left: 4px; padding: 1px 6px; border-radius: var(--r-xs); background: rgba(255, 255, 255, .05); font-size: 11px; font-weight: 500; color: var(--text-3); }
.ad-badge:empty { display: none; }
.ad-block-err { display: block; margin-bottom: 10px; }
.ad-students { margin-top: 10px; }
.ad-students .tbl-wrap { border-top: 1px solid var(--line-soft); }

/* etiquetas */
.ad-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; padding: 5px 6px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--inset); cursor: text; transition: border-color .16s, box-shadow .16s;
}
.ad-tags:hover { border-color: var(--line-strong); }
.ad-tags:focus-within { border-color: rgba(61, 123, 255, .65); box-shadow: 0 0 0 3px rgba(61, 123, 255, .14); }
.ad-tag {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 24px; padding: 0 3px 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-xs); background: rgba(255, 255, 255, .045);
  font-size: 12px; font-weight: 500; color: var(--text); overflow-wrap: anywhere;
}
.ad-tag button { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: var(--r-xs); color: var(--text-3); }
.ad-tag button:hover { color: var(--text); background: var(--active); }
.ad-tag-input { flex: 1 1 110px; min-width: 90px; height: 24px; padding: 0 6px; border: none; background: none; font-size: 13.5px; }
.ad-tag-input::placeholder { color: var(--text-4); }
.ad-tag-input:focus-visible { outline: none; }

/* portada y color */
.ad-cover {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md);
  background: radial-gradient(90% 120% at 82% 112%, color-mix(in srgb, var(--acc, var(--blue)) 24%, transparent), transparent 70%), var(--inset);
}
.ad-cover img { width: 100%; height: 100%; object-fit: cover; }
.ad-cover-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; font-size: 12px; color: var(--text-3); }
.ad-cover-empty .ic { color: var(--acc, var(--blue)); }
.ad-cover-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); }
.ad-cover-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ad-cover-acts .hint { margin-left: auto; font-size: 12px; color: var(--text-3); }
.ad-cover-acts + .err { display: block; margin-top: 8px; }
.ad-file { cursor: pointer; }
.ad-file.is-disabled { opacity: .45; pointer-events: none; }
.ad-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.ad-swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--bg-1); background: var(--acc); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .14s, transform .14s; }
.ad-swatch:hover { transform: scale(1.06); }
.ad-swatch.is-active { box-shadow: 0 0 0 2px var(--text); }

/* mentores */
.ad-inline { display: flex; gap: 8px; }
.ad-inline .input { flex: 1; min-width: 0; }
.ad-mentors { display: flex; flex-direction: column; }
.ad-mentor { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ad-mentor:first-child { padding-top: 0; }
.ad-mentor:last-child { padding-bottom: 0; border-bottom: none; }
.ad-mentor .ad-person { flex: 1 1 160px; }
.ad-mentor .err { flex-basis: 100%; }

/* temario */
.ad-mods { display: flex; flex-direction: column; gap: 10px; }
.ad-mod { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: rgba(255, 255, 255, .012); }
.ad-mod-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 10px 10px 8px; }
.ad-mod.is-open > .ad-mod-head { border-bottom: 1px solid var(--line-soft); }
.ad-mod-toggle .ic { transform: rotate(-90deg); transition: transform .2s var(--ease); }
.ad-mod.is-open .ad-mod-toggle .ic { transform: none; }
.ad-mod-num {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .03); font-size: 12px; font-weight: 600; color: var(--text-2);
}
.ad-mod-title { flex: 1 1 220px; min-width: 0; }
.ad-mod-title .input { font-weight: 600; }
.ad-mod-meta { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.ad-mod-err { flex-basis: 100%; padding-left: 72px; }
.ad-acts { flex: none; display: flex; align-items: center; gap: 2px; }
.ad-mod-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 12px 12px; }
.ad-lessons { display: flex; flex-direction: column; gap: 8px; }
.ad-les {
  display: grid; align-items: center; gap: 0 10px;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.2fr) max-content max-content;
  grid-template-areas: "num title url opts acts" ". errs errs errs errs";
}
.ad-les-num { grid-area: num; padding-right: 2px; font-size: 12px; color: var(--text-3); text-align: right; }
.ad-les-title { grid-area: title; }
.ad-url { grid-area: url; position: relative; min-width: 0; }
.ad-url .input { padding-right: 76px; }
.ad-vkind {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border: 1px solid var(--blue-line); border-radius: var(--r-xs); background: var(--blue-soft);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--blue); pointer-events: none;
}
.ad-les-opts { grid-area: opts; display: flex; align-items: center; gap: 12px; }
.ad-les-min { flex: none; width: 88px; }
.ad-les-min .input { padding-right: 38px; -moz-appearance: textfield; appearance: textfield; }
.ad-les-min .input::-webkit-inner-spin-button, .ad-les-min .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ad-les-prev { font-size: 12.5px; white-space: nowrap; }
.ad-les .ad-acts { grid-area: acts; justify-self: end; }
.ad-les-errs { grid-area: errs; display: flex; flex-direction: column; }
.ad-les-errs .err { margin-top: 5px; }
.ad-add-row {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: color .14s, border-color .14s, background .14s;
}
.ad-add-row:hover { color: var(--text); border-color: var(--text-3); background: var(--hover); }
.ad-mods + .ad-add-row { width: 100%; margin-top: 10px; }
.ad-add-lesson { align-self: flex-start; height: 30px; margin-left: 44px; font-size: 12.5px; }
.ad-mod-body > .ad-quiet { margin-left: 44px; }

/* eliminar */
.ad-danger { border-color: var(--neg-line); }
.ad-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding: 16px 18px; }
.ad-danger-row .ad-note { max-width: 62ch; margin-top: 3px; }

/* barra de guardado */
.ad-savebar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  margin-top: 4px; padding: 10px 12px 10px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--bg-2); box-shadow: var(--shadow-pop); animation: fade-up .3s var(--ease) both;
}
.ad-savebar-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.ad-savebar-msg { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; }
.ad-savebar-msg::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.ad-ed.is-new .ad-savebar-msg { font-weight: 400; color: var(--text-2); }
.ad-ed.is-new .ad-savebar-msg::before { background: var(--blue); }
.ad-savebar-err { font-size: 12px; color: var(--neg); overflow-wrap: anywhere; }
.ad-savebar-acts { display: flex; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .ad-les {
    row-gap: 8px;
    grid-template-columns: 34px minmax(0, 1fr) max-content;
    grid-template-areas: "num title acts" ". url opts" ". errs errs";
  }
  .ad-les + .ad-les { padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .ad-lessons { gap: 10px; }
  .ad-les-errs .err { margin-top: 0; }
}
@media (max-width: 1100px) {
  .ad-ed-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .ad-course-head { display: none; }
  .ad-course { grid-template-columns: 44px minmax(0, 1fr) 16px; gap: 8px 14px; align-items: start; }
  .ad-course-go { grid-row: 1; grid-column: 3; align-self: center; }
  .ad-course-cell { grid-column: 2 / -1; display: flex; align-items: baseline; gap: 10px; }
  .ad-course-cell[data-label]::before {
    content: attr(data-label); flex: none; width: 74px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--text-3);
  }
}
@media (max-width: 760px) {
  /* las tablas pasan a fichas: cada fila es un bloque con sus datos etiquetados */
  .ad-tbl, .ad-tbl tbody { display: block; }
  .ad-tbl thead { display: none; }
  .ad-tbl tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  .ad-tbl tbody tr:last-child { border-bottom: none; }
  .ad-tbl td { display: block; min-width: 0; padding: 0 !important; border: none !important; white-space: normal; }
  .ad-tbl td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 5px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--text-3);
  }
  .ad-tbl td.ad-cell-main { grid-column: 1 / -1; padding-right: 44px !important; }
  .ad-tbl td.ad-col-act { position: absolute; top: 12px; right: 10px; width: auto; }
  .ad-cell-note { max-width: none; }
  .ad-code { flex-wrap: wrap; }
  .ad-person-sub { max-width: none; }
  .ad-students .tbl-wrap { border-top: none; }
  .ad-students .ad-tbl tr:first-child { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 640px) {
  .ad-bar { padding: 12px 14px; }
  .ad-search { max-width: none; flex-basis: 100%; }
  .ad-bar-cta { margin-left: auto; }
  .ad-les {
    grid-template-columns: 26px minmax(0, 1fr) max-content;
    grid-template-areas: "num title title" "url url url" "opts opts acts" "errs errs errs";
  }
  .ad-les-num { text-align: left; }
  .ad-add-lesson, .ad-mod-body > .ad-quiet { margin-left: 0; }
  .ad-mod-err { padding-left: 0; }
  .ad-mod-meta { order: 5; flex-basis: 100%; padding-left: 72px; }
  .ad-cover-acts .hint { margin-left: 0; flex-basis: 100%; }
  .ad-inline { flex-wrap: wrap; }
  .ad-inline .btn { flex: 1 1 auto; }
  .ad-savebar { bottom: 10px; }
  .ad-savebar-acts { flex: 1 1 auto; }
  .ad-savebar-acts .btn { flex: 1 1 auto; }
  .ad-danger-row .btn { width: 100%; }
}
