/* ==========================================================================
   VCodePro — Portal académico
   Capa de estilos sobre styles.css (reutiliza los mismos tokens de diseño).
   ========================================================================== */

:root {
  --pt-side-w: 246px;
  --pt-top-h: 58px;
  --ok-soft: #dcfce7;
  --warn-soft: #fef3c7;
  --err-soft: #fee2e2;
  --info-soft: #dbeafe;
}
html[data-theme="dark"] {
  --ok-soft: #10291b;
  --warn-soft: #2e2510;
  --err-soft: #2e1416;
  --info-soft: #10233c;
}

body.portal { background: var(--bg-alt); }

/* ---------- Barra superior ---------- */
.pt-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--pt-top-h); padding: 0 16px;
  background: var(--darker); color: #fff;
  border-bottom: 1px solid #000;
}
.pt-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; letter-spacing: -.02em; }
.pt-brand:hover { text-decoration: none; opacity: .9; }
.pt-brand .pro { color: #4cc2ff; }
.pt-brand em {
  font-style: normal; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #9fb0c3; border-left: 1px solid #3a424e; margin-left: 6px; padding-left: 10px;
}
.pt-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pt-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent;
  color: #b9c8d9; cursor: pointer;
}
.pt-icon:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.pt-icon svg { width: 19px; height: 19px; }
.pt-dot {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: #e5484d; color: #fff; font-size: 10px; font-style: normal;
  font-weight: 700; display: grid; place-items: center;
}
.pt-burger { display: none; width: 36px; height: 36px; border: 0; background: transparent; cursor: pointer; }
.pt-burger span, .pt-burger span::before, .pt-burger span::after {
  display: block; width: 18px; height: 2px; background: #cfd9e4; border-radius: 2px; position: relative;
}
.pt-burger span::before, .pt-burger span::after { content: ""; position: absolute; }
.pt-burger span::before { transform: translateY(-6px); }
.pt-burger span::after { transform: translateY(6px); }

.pt-user { position: relative; }
.pt-avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(135deg, #0a97e6, #1663e0); color: #fff; font-weight: 700; font-size: .82rem;
  cursor: pointer; display: grid; place-items: center;
}
.pt-drop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: 8px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 60;
}
.pt-drop-h { margin: 4px 8px 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); font-size: .86rem; color: var(--muted); }
.pt-drop-h strong { color: var(--text-strong); font-size: .95rem; }
.pt-drop a { display: flex; align-items: center; gap: 8px; padding: .5rem .6rem; border-radius: 8px; color: var(--text); font-size: .92rem; }
.pt-drop a:hover { background: var(--bg-alt); text-decoration: none; }
.pt-drop a svg { width: 16px; height: 16px; }
.pt-salir { color: var(--err) !important; border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: .6rem !important; border-radius: 0 0 8px 8px; }

/* ---------- Estructura ---------- */
.pt-shell { display: grid; grid-template-columns: var(--pt-side-w) minmax(0, 1fr); align-items: start; }

.pt-side {
  position: sticky; top: var(--pt-top-h); height: calc(100vh - var(--pt-top-h));
  overflow-y: auto; padding: 18px 12px 28px;
  background: var(--bg-elev); border-right: 1px solid var(--border);
}
.pt-side-h {
  margin: 14px 10px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.pt-side ul { list-style: none; margin: 0 0 4px; padding: 0; }
.pt-side a {
  display: flex; align-items: center; gap: 10px; padding: .52rem .65rem; margin-bottom: 2px;
  border-radius: 8px; color: var(--text); font-size: .93rem; font-weight: 500;
}
.pt-side a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.pt-side a:hover { background: var(--bg-alt); text-decoration: none; }
.pt-side a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pt-side a.on svg { color: var(--brand); }
.pt-side-col {
  margin: 20px 10px 0; padding-top: 12px; border-top: 1px solid var(--border-soft);
  font-size: .8rem; color: var(--muted);
}

.pt-main { padding: 26px 30px 60px; max-width: 1320px; width: 100%; min-height: calc(100vh - var(--pt-top-h)); }
.pt-full { max-width: none; }

.pt-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.pt-head h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.pt-sub { color: var(--muted); margin: .35rem 0 0; max-width: 70ch; }
.pt-head-acc { display: flex; flex-wrap: wrap; gap: 10px; }
.pt-migas { margin-bottom: .4rem; }
.pt-migas ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: .84rem; color: var(--muted); }
.pt-migas li + li::before { content: "/"; margin-right: 6px; color: var(--border); }

.pt-foot {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  padding: 16px 30px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem;
  background: var(--bg-elev);
}

/* ---------- Autenticación ---------- */
.pt-auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--darker);
}
.auth-aside {
  padding: 56px 52px; color: var(--dark-text);
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(10,151,230,.28), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(34,211,238,.18), transparent 60%),
    var(--darker);
  display: flex; flex-direction: column; justify-content: center;
}
.auth-aside h2 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.5rem); }
.auth-aside p { color: var(--dark-muted); max-width: 46ch; }
.auth-aside .brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 1.15rem; margin-bottom: 2.5rem; }
.auth-aside .brand .pro { color: #4cc2ff; }
.auth-puntos { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 14px; }
.auth-puntos li { display: flex; gap: 12px; color: var(--dark-muted); font-size: .96rem; }
.auth-puntos b { display: block; color: #fff; font-weight: 600; }
.auth-puntos i {
  flex: none; width: 26px; height: 26px; border-radius: 8px; background: rgba(76,194,255,.16);
  color: #4cc2ff; display: grid; place-items: center; font-style: normal; font-size: .85rem; font-weight: 700;
}
.auth-panel { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-caja { width: 100%; max-width: 420px; }
.auth-caja h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.auth-caja > p { color: var(--muted); margin-bottom: 1.6rem; }
.auth-pie { margin-top: 1.4rem; font-size: .92rem; color: var(--muted); text-align: center; }
.auth-tabs { display: flex; gap: 6px; background: var(--bg-alt); padding: 4px; border-radius: 10px; margin-bottom: 1.4rem; }
.auth-tabs a { flex: 1; text-align: center; padding: .5rem; border-radius: 7px; font-size: .92rem; font-weight: 600; color: var(--muted); }
.auth-tabs a:hover { text-decoration: none; }
.auth-tabs a.on { background: var(--bg-elev); color: var(--text-strong); box-shadow: var(--shadow-sm); }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 1rem; }
.campo > label, .campo-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--text-strong); }
.campo .pista { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="url"], input[type="tel"], select, textarea {
  width: 100%; padding: .62rem .8rem; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,120,212,.18);
}
input[disabled], select[disabled], textarea[disabled] { background: var(--bg-alt); color: var(--muted); cursor: not-allowed; }
.campo-fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.campo-fila-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .92rem; margin-bottom: .5rem; }
.check input { width: auto; margin-top: .22rem; accent-color: var(--brand); }
.form-acc { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 1.2rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin: 0 0 20px; }
legend { padding: 0 8px; font-weight: 700; font-size: .95rem; color: var(--text-strong); }

/* ---------- Avisos ---------- */
.aviso {
  padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.1rem; font-size: .93rem;
  border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start;
}
.aviso-ok   { background: var(--ok-soft);   border-color: rgba(26,127,55,.35);  color: var(--ok); }
.aviso-err  { background: var(--err-soft);  border-color: rgba(207,34,46,.35);  color: var(--err); }
.aviso-warn { background: var(--warn-soft); border-color: rgba(191,135,0,.35);  color: var(--warn); }
.aviso-info { background: var(--info-soft); border-color: rgba(0,120,212,.3);   color: var(--brand); }
html[data-theme="dark"] .aviso-ok { color: #6ee7a8; }
html[data-theme="dark"] .aviso-err { color: #ff9a9f; }
html[data-theme="dark"] .aviso-warn { color: #fbd38d; }
html[data-theme="dark"] .aviso-info { color: #7fd0ff; }

/* ---------- Tarjetas y KPI ---------- */
.panel {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 20px;
}
.panel-h { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-h h2, .panel-h h3 { margin: 0; font-size: 1.05rem; }
.panel-h p { margin: 0; color: var(--muted); font-size: .88rem; }
.panel-plano { padding: 0; overflow: hidden; }
.panel-plano .panel-h { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border-soft); }

.rejilla { display: grid; gap: 18px; }
.rej-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.rej-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.rej-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.rej-lat { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }

.kpi {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px;
}
.kpi b { font-size: 1.9rem; line-height: 1.1; color: var(--text-strong); letter-spacing: -.03em; }
.kpi span { color: var(--muted); font-size: .88rem; }
.kpi em { font-style: normal; font-size: .8rem; color: var(--muted); opacity: .85; margin-top: 4px; }
.kpi-brand b { color: var(--brand); }
.kpi-ok b { color: var(--ok); }
.kpi-warn b { color: var(--warn); }
.kpi-err b { color: var(--err); }

/* ---------- Chips y etiquetas ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: .16rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.chip-gris  { background: var(--bg-alt); color: var(--muted); border-color: var(--border); }
.chip-azul  { background: var(--info-soft); color: var(--brand); border-color: rgba(0,120,212,.3); }
.chip-verde { background: var(--ok-soft); color: var(--ok); border-color: rgba(26,127,55,.3); }
.chip-ambar { background: var(--warn-soft); color: var(--warn); border-color: rgba(191,135,0,.3); }
.chip-rojo  { background: var(--err-soft); color: var(--err); border-color: rgba(207,34,46,.3); }
html[data-theme="dark"] .chip-verde { color: #6ee7a8; }
html[data-theme="dark"] .chip-rojo { color: #ff9a9f; }
html[data-theme="dark"] .chip-ambar { color: #fbd38d; }
html[data-theme="dark"] .chip-azul { color: #7fd0ff; }
.chip-crit { background: var(--bg-alt); border-color: var(--border); color: var(--text); font-family: var(--mono); }

/* ---------- Tablas ---------- */
.tabla-caja { overflow-x: auto; border-radius: var(--radius-lg); }
table.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--bg-elev); }
table.tabla th {
  text-align: left; padding: .7rem .85rem; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: var(--bg-alt); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tabla td { padding: .72rem .85rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tabla tbody tr:hover { background: var(--bg-alt); }
table.tabla tbody tr:last-child td { border-bottom: 0; }
table.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tabla .acc { text-align: right; white-space: nowrap; }
/* Una celda con varios botones se envuelve antes que salirse del panel: con
   nowrap, el último botón quedaba fuera del área visible y no se podía pulsar. */
table.tabla td.acc:has(.btn-fila) { white-space: normal; }
table.tabla td.acc .btn-fila { flex-wrap: wrap; justify-content: flex-end; }
.tabla-mini td, .tabla-mini th { padding: .5rem .6rem; font-size: .86rem; }

/* ---------- Barras de progreso ---------- */
.barra { height: 7px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; border: 1px solid var(--border-soft); }
.barra i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s ease; }
.barra-ok i { background: var(--ok); }
.barra-warn i { background: var(--warn); }
.barra-err i { background: var(--err); }

/* ---------- Botones extra ---------- */
.btn-xs { padding: .3rem .65rem; font-size: .8rem; border-radius: 6px; }
.btn-err { background: var(--err); }
.btn-err:hover { background: #a40e19; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #14682c; }
.btn-fila { display: inline-flex; gap: 6px; }
.acciones-barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.acciones-barra form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acciones-barra input, .acciones-barra select { width: auto; min-width: 170px; }
.crece { flex: 1; }

/* ---------- Estados vacíos ---------- */
.vacio {
  text-align: center; padding: 46px 20px; border: 1px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elev); color: var(--muted);
}
.vacio h3 { margin-bottom: .3rem; }
.vacio p { margin: 0 auto 1rem; max-width: 46ch; }

/* ---------- Actividades ---------- */
.act-tarjeta {
  display: flex; flex-direction: column; gap: 10px; padding: 18px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.act-tarjeta:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.act-tarjeta h3 { margin: 0; font-size: 1.02rem; line-height: 1.35; }
.act-tarjeta h3 a { color: var(--text-strong); }
.act-tarjeta p { margin: 0; color: var(--muted); font-size: .89rem; }
.act-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.act-cod { font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .04em; }

.fases { display: grid; gap: 14px; counter-reset: fase; }
.fase {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); overflow: hidden;
}
.fase > summary {
  list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 12px; align-items: center;
  font-weight: 600; color: var(--text-strong);
}
.fase > summary::-webkit-details-marker { display: none; }
.fase > summary:hover { background: var(--bg-alt); }
.fase-n {
  flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: .82rem; font-weight: 700;
}
.fase[data-hecha="1"] .fase-n { background: var(--ok-soft); color: var(--ok); }
.fase-cuerpo { padding: 4px 18px 18px 56px; }
.fase-cuerpo .entregable {
  margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0; font-size: .9rem;
}
.fase-tag { margin-left: auto; font-size: .76rem; color: var(--muted); font-weight: 500; }

/* ---------- Rúbrica ---------- */
.rubrica { display: grid; gap: 14px; }
.rub-crit { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; background: var(--bg-elev); }
.rub-crit header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.rub-letra {
  width: 30px; height: 30px; border-radius: 8px; background: var(--darker); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: none;
}
.rub-niveles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; font-size: .85rem; }
.rub-niveles div { padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-alt); }
.rub-niveles b { display: block; color: var(--brand); font-size: .78rem; margin-bottom: 4px; }
.rub-puntos { display: flex; flex-wrap: wrap; gap: 5px; }
.rub-puntos input { position: absolute; opacity: 0; pointer-events: none; }
.rub-puntos label {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-alt); font-size: .88rem; font-weight: 600;
}
.rub-puntos input:checked + label { background: var(--brand); color: #fff; border-color: var(--brand); }
.rub-puntos input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Línea de tiempo / bitácora ---------- */
.linea { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.linea li { position: relative; padding: 0 0 20px 18px; }
.linea li::before {
  content: ""; position: absolute; left: -27px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg-elev); border: 2px solid var(--brand);
}
.linea h4 { margin: 0 0 .2rem; font-size: .97rem; }
.linea time { font-size: .8rem; color: var(--muted); }
.linea p { margin: .35rem 0 0; font-size: .92rem; color: var(--muted); }

/* ---------- Matriz de seguimiento ---------- */
.matriz { border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.matriz th.rot { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 190px; padding: 10px 6px; font-size: .76rem; }
.matriz td.celda { text-align: center; padding: .35rem; }
.mz {
  display: inline-grid; place-items: center; width: 30px; height: 26px; border-radius: 6px;
  font-size: .74rem; font-weight: 700; border: 1px solid var(--border);
}
.mz-pendiente { background: var(--bg-alt); color: var(--muted); }
.mz-en_progreso { background: var(--info-soft); color: var(--brand); }
.mz-entregada { background: var(--warn-soft); color: var(--warn); }
.mz-revisada { background: var(--ok-soft); color: var(--ok); }
.mz-rehacer { background: var(--err-soft); color: var(--err); }
.leyenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); margin-top: 12px; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); display: block; }

/* ---------- Insignias ---------- */
.insignias { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ins {
  text-align: center; padding: 18px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elev);
}
.ins .cara { font-size: 2rem; line-height: 1; margin-bottom: 8px; }
.ins b { display: block; font-size: .92rem; }
.ins span { font-size: .8rem; color: var(--muted); }
.ins-off { opacity: .42; filter: grayscale(1); }

/* ---------- Paginación ---------- */
.pag { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.pag a, .pag span {
  min-width: 36px; padding: .38rem .6rem; text-align: center; border-radius: 8px;
  border: 1px solid var(--border); font-size: .88rem; color: var(--text); background: var(--bg-elev);
}
.pag a:hover { background: var(--bg-alt); text-decoration: none; }
.pag .on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Detalles varios ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.2rem; font-size: .93rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); }
.mono { font-family: var(--mono); font-size: .88em; }
.mt-1 { margin-top: .6rem; } .mt-2 { margin-top: 1.2rem; } .mt-3 { margin-top: 1.8rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1.2rem; }
.txt-muted { color: var(--muted); }
.txt-sm { font-size: .87rem; }
.txt-c { text-align: center; }
.prosa p { margin-bottom: .8rem; } .prosa ul, .prosa ol { margin: 0 0 .9rem; } .prosa li { margin-bottom: .3rem; }
.prosa h3 { margin-top: 1.4rem; font-size: 1.02rem; }
.codigo {
  background: #1f2430; color: #d5dce6; border-radius: var(--radius); padding: 14px 16px;
  overflow-x: auto; font-family: var(--mono); font-size: .84rem; line-height: 1.6;
}
.copiar { cursor: pointer; }

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
  .rej-lat { grid-template-columns: 1fr; }
  .pt-auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 860px) {
  .pt-shell { grid-template-columns: 1fr; }
  .pt-burger { display: grid; place-items: center; }
  .pt-side {
    position: fixed; top: var(--pt-top-h); left: 0; width: 84%; max-width: 300px; height: calc(100vh - var(--pt-top-h));
    transform: translateX(-102%); transition: transform .22s ease; z-index: 50; box-shadow: var(--shadow-lg);
  }
  .pt-side.abierto { transform: none; }
  .pt-main { padding: 20px 16px 50px; }
  .pt-foot { padding: 14px 16px; }
  .pt-velo { position: fixed; inset: var(--pt-top-h) 0 0; background: rgba(0,0,0,.45); z-index: 45; }
}
@media (max-width: 560px) {
  .pt-head { align-items: flex-start; }
  .fase-cuerpo { padding-left: 18px; }
  .dl { grid-template-columns: 1fr; gap: .2rem; }
  .dl dd { margin-bottom: .6rem; }
}
@media print {
  .pt-top, .pt-side, .pt-foot, .pt-head-acc, .no-print { display: none !important; }
  .pt-shell { grid-template-columns: 1fr; }
  .panel { border-color: #ccc; break-inside: avoid; }
  body.portal { background: #fff; }
}

/* ---------- Editor de texto enriquecido ---------- */
/* Lo construye assets/js/editor.js sobre un <textarea data-rico>. La caja
   imita el aspecto de un campo normal para que no rompa los formularios. */
.rico {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.rico:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,120,212,.18); }

.rico-barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 5px 6px; background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.rico-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 7px;
  font: inherit; font-size: .86rem; line-height: 1; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 5px;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.rico-btn:hover { background: var(--bg-elev); border-color: var(--border); }
.rico-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.rico-btn.es-activo { background: var(--brand); border-color: var(--brand); color: #fff; }
.rico-btn.es-negrita { font-weight: 800; }
.rico-btn.es-cursiva { font-style: italic; font-family: Georgia, serif; }
.rico-btn.es-subrayado { text-decoration: underline; }
.rico-btn.es-codigo { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .74rem; }
.rico-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }

.rico-area {
  min-height: 150px; max-height: 60vh; overflow-y: auto;
  padding: .7rem .85rem; font-size: .95rem; line-height: 1.6; color: var(--text);
}
.rico-area:focus { outline: 0; }
/* Marcador de posición: solo cuando el editor está realmente vacío. */
.rico-area.es-vacio::before {
  content: attr(data-vacio); color: var(--muted); pointer-events: none; display: block;
}
.rico-area > *:first-child { margin-top: 0; }
.rico-area > *:last-child { margin-bottom: 0; }
.rico-area p { margin: 0 0 .65rem; }
.rico-area h3 { font-size: 1.02rem; margin: .9rem 0 .45rem; color: var(--text-strong); }
.rico-area h4 { font-size: .95rem; margin: .8rem 0 .4rem; color: var(--text-strong); }
.rico-area ul, .rico-area ol { margin: 0 0 .65rem; padding-left: 1.45rem; }
.rico-area li { margin-bottom: .2rem; }
.rico-area blockquote {
  margin: 0 0 .65rem; padding: .1rem 0 .1rem .8rem;
  border-left: 3px solid var(--brand); color: var(--muted); font-style: italic;
}
.rico-area pre {
  margin: 0 0 .65rem; padding: .6rem .75rem; overflow-x: auto;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86rem;
  line-height: 1.5; white-space: pre-wrap;
}
.rico-area code {
  padding: .1rem .3rem; background: var(--bg-alt); border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .87em;
}
.rico-area pre code { padding: 0; background: none; }
.rico-area a { color: var(--brand); text-decoration: underline; }

.rico-pie {
  display: flex; justify-content: flex-end; padding: 4px 9px;
  background: var(--bg-alt); border-top: 1px solid var(--border);
}
.rico-cuenta { font-size: .76rem; color: var(--muted); }

/* Actividad ya calificada: se consulta, no se edita. */
.rico-bloqueado { background: var(--bg-alt); }
.rico-bloqueado .rico-area { color: var(--muted); }

/* Lectura del contenido enriquecido fuera del editor (p. ej. al calificar). */
.rico-lectura > *:first-child { margin-top: 0; }
.rico-lectura > *:last-child { margin-bottom: 0; }
.rico-lectura p { margin: 0 0 .6rem; }
.rico-lectura h3 { font-size: 1rem; margin: .85rem 0 .4rem; color: var(--text-strong); }
.rico-lectura h4 { font-size: .93rem; margin: .75rem 0 .35rem; color: var(--text-strong); }
.rico-lectura ul, .rico-lectura ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.rico-lectura li { margin-bottom: .18rem; }
.rico-lectura blockquote {
  margin: 0 0 .6rem; padding: .1rem 0 .1rem .8rem;
  border-left: 3px solid var(--border); color: var(--muted); font-style: italic;
}
.rico-lectura pre {
  margin: 0 0 .6rem; padding: .55rem .7rem; overflow-x: auto;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .85rem;
  white-space: pre-wrap;
}
.rico-lectura code {
  padding: .1rem .3rem; background: var(--bg-alt); border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .87em;
}
.rico-lectura pre code { padding: 0; background: none; }
.rico-lectura a { color: var(--brand); text-decoration: underline; }
.rico-lectura img { display: none; }
.rico.es-falta { border-color: var(--err); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }

/* ---------- Adjuntos de una entrega ---------- */
.adj { margin-top: .75rem; }
.adj-titulo { font-weight: 600; font-size: .88rem; color: var(--text-strong); margin: 0 0 .4rem; }

.adj-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.adj-lista:empty { display: none; }
.adj-lista li {
  display: flex; align-items: center; gap: 9px;
  padding: .45rem .6rem; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.adj-tipo {
  flex: none; min-width: 44px; padding: .18rem .35rem; text-align: center;
  font-size: .66rem; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: var(--darker); border-radius: 4px;
}
.adj-lista a {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .9rem; color: var(--text-strong);
}
.adj-peso { flex: none; font-size: .76rem; color: var(--muted); }
.adj-quitar {
  flex: none; width: 24px; height: 24px; padding: 0; line-height: 1;
  font-size: 1.05rem; color: var(--muted); background: transparent;
  border: 1px solid transparent; border-radius: 5px; cursor: pointer;
}
.adj-quitar:hover { color: var(--err); border-color: var(--border); background: var(--bg-alt); }
.adj-quitar:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.adj-zona {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  margin-top: 8px; padding: .85rem; text-align: center; cursor: pointer;
  background: var(--bg-alt); border: 1px dashed var(--border);
  border-radius: var(--radius); transition: border-color .15s, background .15s;
}
.adj-zona:hover, .adj-zona.es-encima { border-color: var(--brand); background: var(--bg-elev); }
.adj-zona:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.adj-invita { font-size: .88rem; color: var(--text); }
.adj-invita b { color: var(--brand); }
.adj-formatos { font-size: .74rem; color: var(--muted); }

.adj-estado { margin: .4rem 0 0; font-size: .8rem; color: var(--muted); min-height: 1em; }
.adj-estado.es-ok { color: var(--ok); }
.adj-estado.es-error { color: var(--err); }

/* ---------- Asistente de IA ---------- */
.ia-progreso {
  height: 6px; margin: 0 0 12px; overflow: hidden;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 99px;
}
.ia-progreso i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s; }

tr.es-procesando { background: var(--info-soft); }
tr.es-listo      { background: var(--ok-soft); }
tr.es-fallo      { background: var(--err-soft); cursor: help; }

.pista.es-ok    { color: var(--ok); }
.pista.es-error { color: var(--err); }

/* Distintivo de lo que propuso la máquina y todavía no ha firmado nadie. */
.ia-marca {
  display: inline-flex; align-items: center; gap: 5px;
  padding: .15rem .45rem; font-size: .72rem; font-weight: 600;
  color: var(--text-strong); background: var(--warn-soft);
  border: 1px solid var(--border); border-radius: 99px;
}
.ia-caja {
  padding: .7rem .85rem; margin-top: .6rem;
  background: var(--bg-alt); border: 1px dashed var(--border); border-radius: var(--radius);
}
.ia-caja > h4 { margin: 0 0 .4rem; font-size: .86rem; color: var(--text-strong); }

/* ---------- Panel plegable (formularios que no deben robar sitio) ---------- */
/* Un formulario de alta que vive siempre abierto en un lateral le quita a la
   tabla el ancho que necesita. Aquí se pliega y solo se abre al usarlo. */
details.plegable { padding: 0; }
details.plegable > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: .85rem 1.1rem; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--text-strong);
  border-radius: var(--radius-lg);
}
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::after {
  content: "+"; flex: none; width: 22px; height: 22px; line-height: 20px; text-align: center;
  font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 6px;
}
details.plegable[open] > summary::after { content: "−"; }
details.plegable > summary:hover { background: var(--bg-alt); }
details.plegable[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.plegable-cuerpo { padding: 1.1rem; }

/* ---------- Tabla de usuarios ---------- */
.tabla-usuarios td { padding-top: .55rem; padding-bottom: .55rem; }
.tabla-usuarios .col-rol,
.tabla-usuarios .col-acceso { white-space: nowrap; }
.tabla-usuarios .col-colegio {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tabla-usuarios .chip { margin-left: 4px; vertical-align: 1px; }
.tabla-usuarios tr.es-editando { background: var(--info-soft); }
.tabla-pie { padding: .7rem .85rem; margin: 0; border-top: 1px solid var(--border-soft); }

/* Botones algo más compactos: en esta tabla hay hasta cinco por fila. */
.tabla-usuarios td.acc .btn-fila { gap: 5px; }
.tabla-usuarios td.acc .btn-xs { padding: .26rem .5rem; font-size: .76rem; }

/* ---------- Dictado por voz en el editor ---------- */
.rico-btn.rico-mic { gap: 5px; padding: 0 9px; }
.rico-btn.rico-mic span { font-size: .78rem; font-weight: 600; }
.rico-btn.es-dictando {
  background: var(--err); border-color: var(--err); color: #fff;
  animation: vcp-pulso 1.4s ease-in-out infinite;
}
.rico-dictado {
  flex: 1 1 160px; min-width: 0; margin-left: 6px;
  font-size: .78rem; font-style: italic; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes vcp-pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.45); }
  50%      { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

/* ---------- Notas de voz ---------- */
/* Vacío hasta que voz.js lo monta: sin JavaScript no debe verse una caja hueca. */
.voz:empty { display: none; }
.voz {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px; padding: .55rem .75rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
}
.voz-boton { display: inline-flex; align-items: center; gap: 6px; }
.voz.voz-grabando { border-color: var(--err); background: var(--err-soft); }
.voz-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--err); animation: vcp-pulso 1.4s ease-in-out infinite; }
.voz-tiempo { font-variant-numeric: tabular-nums; font-size: .9rem; font-weight: 700; color: var(--text-strong); }
.voz-tiempo.es-final { color: var(--err); }
.voz-dato { font-size: .78rem; color: var(--muted); }
.voz-dato.es-error { color: var(--err); }
.voz-nivel {
  flex: 1 1 80px; max-width: 160px; height: 6px; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 99px;
}
.voz-nivel i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.voz-previa { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.voz-previa audio { flex: 1 1 240px; height: 34px; max-width: 100%; }
.voz-barra { flex: 1 1 100%; height: 5px; overflow: hidden; background: var(--bg-elev); border-radius: 99px; }
.voz-barra i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }

.adj-lista li.es-audio { flex-wrap: wrap; }
.adj-lista li.es-audio audio { flex: 1 1 220px; height: 34px; min-width: 0; }
.adj-tipo-voz { background: var(--err); }
.adj-duracion { flex: none; font-size: .76rem; font-variant-numeric: tabular-nums; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .rico-btn.es-dictando, .voz-punto { animation: none; }
}