/*
 v180.6.22.5 — SaaS Enterprise Global Readability + Academic Context
 Objetivo: corregir de raíz controles con fondo claro/texto claro en todos los roles,
 sin romper los formularios claros ya estabilizados.
*/
:root{
  --saas-input-bg:#f8fafc;
  --saas-input-text:#0f172a;
  --saas-input-muted:#475569;
  --saas-input-border:#93c5fd;
  --saas-focus:#38bdf8;
  --saas-dark-card:#0f1f3a;
  --saas-dark-card-2:#132849;
}

/* CONTROL GLOBAL: evita texto invisible en inputs claros */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea,
.form-control,
.form-select,
.form-input,
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="text"],
input[type="url"],
input[type="tel"]{
  background-color:var(--saas-input-bg) !important;
  color:var(--saas-input-text) !important;
  -webkit-text-fill-color:var(--saas-input-text) !important;
  border:1px solid var(--saas-input-border) !important;
  caret-color:#0f172a !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.75) !important;
}

textarea,
[contenteditable="true"],
.rich-editor,
.descripcion-editor,
.editor-area{
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
  caret-color:#0f172a !important;
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder{
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
  opacity:1 !important;
}

select option,
select optgroup{
  background:#ffffff !important;
  color:#0f172a !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus{
  outline:0 !important;
  border-color:var(--saas-focus) !important;
  box-shadow:
    0 0 0 3px rgba(56,189,248,.22),
    inset 0 1px 0 rgba(255,255,255,.75) !important;
}

input[readonly],
textarea[readonly],
input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled{
  background:#e2e8f0 !important;
  color:#1e293b !important;
  -webkit-text-fill-color:#1e293b !important;
  opacity:1 !important;
}

/* Autofill Chrome/Edge: evita amarillo/blanco con texto invisible */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill{
  -webkit-text-fill-color:#0f172a !important;
  box-shadow:0 0 0 1000px #f8fafc inset !important;
  transition:background-color 9999s ease-out 0s !important;
}

/* Fechas y controles internos */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator{
  filter:invert(0) !important;
  opacity:.85 !important;
}

/* Tablas/cards claras dentro de dark UI */
.table-light-fix,
.readability-card,
.quick-data,
.datos-rapidos,
.emtp-card,
.table-wrap{
  color:#0f172a !important;
}
.table-light-fix *,
.readability-card *,
.quick-data *,
.datos-rapidos *,
.emtp-card *,
.table-wrap *{
  color:inherit;
}

/* Login: controles siempre legibles */
.login-card input,
.auth-card input,
.auth-panel input,
.login-form input,
.login-card select,
.auth-card select,
.login-card textarea,
.auth-card textarea{
  background:rgba(248,250,252,.96) !important;
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
  border-color:rgba(147,197,253,.85) !important;
}
.login-card input::placeholder,
.auth-card input::placeholder,
.auth-panel input::placeholder,
.login-form input::placeholder{
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
}

/* Botones: hover visible global sin destruir variantes existentes */
button,
.btn,
a.btn,
input[type="submit"]{
  transition:transform .16s ease, box-shadow .16s ease, filter .16s ease, border-color .16s ease !important;
}
button:hover,
.btn:hover,
a.btn:hover,
input[type="submit"]:hover{
  transform:translateY(-1px);
  filter:brightness(1.06);
}

/* Contexto académico persistente */
.academic-context-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  margin:0 0 16px 0;
  border:1px solid rgba(96,165,250,.34);
  border-radius:18px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.16), transparent 34%),
    linear-gradient(135deg, rgba(15,23,42,.96), rgba(15,36,68,.94));
  box-shadow:0 18px 36px rgba(2,8,23,.28);
  color:#eff6ff;
}
.academic-context-banner .ctx-kicker{
  display:block;
  color:#7dd3fc;
  font-size:11px;
  font-weight:950;
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:5px;
}
.academic-context-banner .ctx-title{
  display:block;
  font-size:clamp(18px,2.1vw,25px);
  line-height:1.15;
  font-weight:950;
  color:#fff;
}
.academic-context-banner .ctx-subtitle{
  display:block;
  margin-top:4px;
  color:#cbd5e1;
  font-size:13px;
  font-weight:750;
}
.academic-context-banner .ctx-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.academic-context-banner .ctx-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  background:rgba(37,99,235,.18);
  border:1px solid rgba(96,165,250,.36);
  color:#dbeafe !important;
  font-weight:900;
  text-decoration:none;
  white-space:nowrap;
}
.academic-context-banner .ctx-pill.is-active{
  background:linear-gradient(135deg,#2563eb,#7c3aed);
  color:#fff !important;
  box-shadow:0 12px 26px rgba(37,99,235,.28);
}

@media(max-width:780px){
  .academic-context-banner{
    align-items:flex-start;
    flex-direction:column;
  }
  .academic-context-banner .ctx-actions{
    width:100%;
    justify-content:flex-start;
  }
}

/* Workflow docente visible y consistente */
.workflow-bar{
  display:flex !important;
  justify-content:space-between !important;
  align-items:center !important;
  gap:14px !important;
  padding:14px 16px !important;
  margin-bottom:16px !important;
  border-radius:18px !important;
  border:1px solid rgba(96,165,250,.34) !important;
  background:linear-gradient(135deg,rgba(15,23,42,.98),rgba(15,36,68,.94)) !important;
  box-shadow:0 14px 30px rgba(2,8,23,.25) !important;
}
.workflow-title{
  color:#ffffff !important;
  font-size:15px !important;
  font-weight:950 !important;
}
.workflow-sub{
  color:#bae6fd !important;
  font-size:13px !important;
  font-weight:850 !important;
  margin-top:3px !important;
}
.workflow-actions{
  display:flex !important;
  gap:8px !important;
  flex-wrap:wrap !important;
}
.workflow-actions a{
  min-height:34px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 12px !important;
  border-radius:999px !important;
  text-decoration:none !important;
  font-weight:900 !important;
  color:#dbeafe !important;
  background:rgba(15,23,42,.74) !important;
  border:1px solid rgba(147,197,253,.30) !important;
}
.workflow-actions a.active{
  color:#ffffff !important;
  background:linear-gradient(135deg,#2563eb,#7c3aed) !important;
  border-color:rgba(191,219,254,.55) !important;
  box-shadow:0 10px 22px rgba(37,99,235,.30) !important;
}
.workflow-actions a.back{
  background:linear-gradient(135deg,#059669,#22c55e) !important;
  color:#052e16 !important;
  border-color:rgba(187,247,208,.55) !important;
}
.workflow-actions a:hover{transform:translateY(-1px) !important;filter:brightness(1.08) !important}

@media(max-width:780px){
  .workflow-bar{align-items:flex-start !important;flex-direction:column !important}
  .workflow-actions{width:100% !important}
}


/* v180.6.22.5 — Global Enterprise Dark Readability Final
   Corrige de raíz controles claros con texto invisible y normaliza vistas alumno/docente.
   Mantiene inputs claros legibles cuando el contenedor es claro, y fuerza dark SaaS en panels legacy. */

/* Base segura para todos los controles, todos los roles */
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html body select,
html body textarea,
html body .form-control,
html body .form-select,
html body .form-input,
html body [contenteditable="true"]{
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
  background:#f8fafc !important;
  border:1px solid #93c5fd !important;
  caret-color:#0f172a !important;
  text-shadow:none !important;
}

html body input::placeholder,
html body textarea::placeholder,
html body .form-control::placeholder{
  color:#64748b !important;
  -webkit-text-fill-color:#64748b !important;
  opacity:1 !important;
}

html body input:focus,
html body select:focus,
html body textarea:focus,
html body [contenteditable="true"]:focus{
  outline:0 !important;
  border-color:#38bdf8 !important;
  box-shadow:0 0 0 3px rgba(56,189,248,.24), inset 0 1px 0 rgba(255,255,255,.75) !important;
}

/* Login/autofill: evita blanco con texto invisible */
html body input:-webkit-autofill,
html body input:-webkit-autofill:hover,
html body input:-webkit-autofill:focus,
html body textarea:-webkit-autofill,
html body select:-webkit-autofill{
  -webkit-text-fill-color:#0f172a !important;
  box-shadow:0 0 0 1000px #f8fafc inset !important;
  border:1px solid #93c5fd !important;
}

/* Panels oscuros enterprise: si se usan controles dark nativos, siguen legibles */
.saas-dark-control,
.dark-control{
  background:#10213d !important;
  color:#eaf2ff !important;
  -webkit-text-fill-color:#eaf2ff !important;
  border-color:rgba(96,165,250,.36) !important;
}

/* Alumno/actividades: unifica a estética dark SaaS como panel/calificaciones */
.ac-shell{
  max-width:1180px !important;
  margin:0 auto !important;
  color:#eaf2ff !important;
}
.ac-shell .ac-card{
  background:linear-gradient(180deg,#0f213d,#0b1a31) !important;
  color:#eaf2ff !important;
  border:1px solid rgba(96,165,250,.34) !important;
  box-shadow:0 18px 44px rgba(2,8,23,.35) !important;
}
.ac-shell .ac-title{
  color:#7dd3fc !important;
  text-shadow:none !important;
}
.ac-shell .ac-head,
.ac-shell .ac-kpi,
.ac-shell .ac-item{
  background:linear-gradient(180deg,#122746,#0d1d36) !important;
  color:#eaf2ff !important;
  border:1px solid rgba(96,165,250,.34) !important;
  box-shadow:0 14px 34px rgba(2,8,23,.26), inset 0 1px 0 rgba(255,255,255,.04) !important;
}
.ac-shell .ac-head *,
.ac-shell .ac-kpi *,
.ac-shell .ac-item *{
  text-shadow:none !important;
}
.ac-shell .ac-head h2,
.ac-shell .ac-item h3,
.ac-shell .ac-kpi strong,
.ac-shell .ac-teacher b{
  color:#ffffff !important;
}
.ac-shell .ac-sub,
.ac-shell .ac-meta,
.ac-shell .ac-help,
.ac-shell .ac-kpi small,
.ac-shell .ac-teacher small{
  color:#c7d8f4 !important;
}
.ac-shell .ac-kpi strong{
  font-size:clamp(28px,4vw,40px) !important;
  line-height:1 !important;
}
.ac-shell .ac-editor-wrap,
.ac-shell .ac-file-input span{
  background:#eaf3ff !important;
  color:#0f172a !important;
  border-color:#93c5fd !important;
}
.ac-shell .ac-editor,
.ac-shell input,
.ac-shell textarea,
.ac-shell select{
  background:#f8fafc !important;
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
}
.ac-shell .ac-toolbar{
  background:#dbeafe !important;
  border-color:#93c5fd !important;
}
.ac-shell .ac-tool,
.ac-shell .ac-size,
.ac-shell .ac-color{
  background:linear-gradient(180deg,#10213d,#071426) !important;
  color:#f8fbff !important;
  -webkit-text-fill-color:#f8fbff !important;
  border-color:rgba(96,165,250,.38) !important;
  box-shadow:0 8px 18px rgba(2,8,23,.20) !important;
}
.ac-shell .ac-link{
  background:linear-gradient(180deg,#2563eb,#1d4ed8) !important;
  color:#fff !important;
  border-color:#60a5fa !important;
}
.ac-shell .ac-link.delivered{
  background:linear-gradient(180deg,#059669,#047857) !important;
  color:#ecfdf5 !important;
  border-color:#34d399 !important;
}
.ac-shell .tag{
  color:#0f172a !important;
  text-shadow:none !important;
}

/* Chat: evita que el selector/listado se vea con contraste roto */
.chatpro input,
.chatpro select,
.chatpro textarea{
  background:#f8fafc !important;
  color:#0f172a !important;
  -webkit-text-fill-color:#0f172a !important;
}
.chatpro-contact{
  border-color:rgba(96,165,250,.24) !important;
}
.chatpro-contact:hover{
  transform:translateY(-1px);
  filter:brightness(1.08);
}

/* Tablas/resumen: texto de etiquetas más nítido */
.kpi small,
.summary-card small,
.stat-card small,
.resumen small,
[class*="kpi"] small{
  color:#c7d8f4 !important;
  opacity:1 !important;
  text-shadow:none !important;
}


/* v180.6.22.7 - global dark form readability reinforcement */
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html body select, html body textarea, html body .form-control, html body .form-select {
  color:#0f172a !important; background-color:#f8fbff !important; border-color:rgba(96,165,250,.55) !important;
}
html body input::placeholder, html body textarea::placeholder { color:#64748b !important; opacity:1 !important; }
html body input:focus, html body select:focus, html body textarea:focus, html body .form-control:focus, html body .form-select:focus {
  color:#0f172a !important; background:#ffffff !important; border-color:#38bdf8 !important; box-shadow:0 0 0 3px rgba(56,189,248,.22),0 10px 24px rgba(37,99,235,.16) !important;
}
html body input[readonly], html body textarea[readonly], html body input:disabled, html body select:disabled, html body textarea:disabled {
  color:#1e293b !important; background:#e8eef7 !important; opacity:1 !important;
}
html body input:-webkit-autofill, html body input:-webkit-autofill:hover, html body input:-webkit-autofill:focus {
  -webkit-text-fill-color:#0f172a !important; box-shadow:0 0 0 1000px #f8fbff inset !important;
}
