.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid #cbd5df;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  background: #f5f7f9;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 6px 10px -8px rgba(6, 42, 80, .35);
}

.format-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #062a50;
  font-size: 12px;
  font-weight: 800;
}

.format-label select {
  width: auto;
  min-width: 125px;
  padding: 7px 30px 7px 9px;
}

.toolbar-separator {
  width: 1px;
  height: 28px;
  background: #cbd5df;
}

.format-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #062a50;
  cursor: pointer;
}

.format-button:hover,
.format-button:focus {
  border-color: #cbd5df;
  background: #fff;
}

.content-editor {
  min-height: 440px;
  margin-top: 0;
  overflow: auto;
  border-radius: 0 0 9px 9px;
  background: #fff;
  white-space: normal;
  resize: vertical;
}

.content-editor:focus {
  border-color: #d5a93f;
  box-shadow: 0 0 0 3px #fbf5e6;
  outline: none;
}

.adjustment-files {
  padding: 10px;
  border: 1px dashed #aebbc8;
  background: #f8fafc;
}

.attachment-list {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef4f8;
  color: var(--navy);
  font-size: .88rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.attachment-item + .attachment-item {
  border-top: 1px solid #d8e2ea;
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-attachment {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #a12626;
  font-weight: 700;
  cursor: pointer;
}

.regeneration-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef6fb;
  color: #062a50;
  font-weight: 700;
}

.progress-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #b9d3e5;
  border-top-color: #0b5a91;
  border-radius: 50%;
  animation: progress-spin .8s linear infinite;
}

@keyframes progress-spin {
  to { transform: rotate(360deg); }
}

/* W4: una sola forma de figura, venga de la IA o de una subida de la
   docente -antes convivian ".generated-figure" (con <figcaption> mostrando
   el texto alternativo) y una segunda forma sin rotulo ni numero; el
   renumerado solo tocaba una de las dos. El ancho es una clase, nunca
   estilo en linea: el CSP lo anularia en silencio. */
.guide-figure {
  margin: 1.2rem auto;
  text-align: center;
}

.guide-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
}

.figura-ancho-25 { width: 25%; }
.figura-ancho-50 { width: 50%; }
.figura-ancho-75 { width: 75%; }
.figura-ancho-100 { width: 100%; }

/* El alt describe la imagen para quien no la ve; el pie es para quien la
   ve. Confundirlos deja al lector de pantalla oyendo el texto dos veces. El
   alt se queda en el atributo del <img> y no se pinta aqui. */
.figure-caption {
  margin: 1.2rem 0 .45rem;
  color: #062a50;
  text-align: center;
}

.figure-note {
  margin: -.6rem 0 1.25rem;
  color: #66758a;
  font-size: .86rem;
  text-align: center;
}

.visual-modal-overlay{position:fixed;inset:0;z-index:80;display:grid;place-items:center;padding:24px;background:#031a32c9;backdrop-filter:blur(5px)}
.visual-modal-card{width:min(760px,100%);max-height:calc(100vh - 48px);overflow:auto;padding:30px;border-radius:18px;background:#fff;box-shadow:0 30px 90px #0007}
.visual-modal-card h2{margin:0 0 10px;color:#062a50}
.visual-summary{display:grid;grid-template-columns:1fr 2fr;gap:12px;margin:20px 0}
.visual-summary div{padding:12px;border:1px solid #d9e1e8;border-radius:9px}
.visual-summary dt{font-size:.78rem;font-weight:800;color:#607080}
.visual-summary dd{margin:6px 0 0}
.visual-summary .visual-anchor-row{grid-column:1/-1}
.visual-summary #visual-anchor{color:#33475b;font-style:italic}
.propose-resources-panel{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:18px 0 6px;padding:12px 14px;border:1px solid #d9e1e8;border-radius:10px;background:#f7fafc}
.propose-resources-panel label{margin:0;font-size:.85rem;font-weight:700;color:#062a50;white-space:nowrap}
.propose-resources-panel select{flex:0 1 240px;min-width:180px;padding:8px 10px;border:1px solid #cbd5df;border-radius:8px;font:inherit;background:#fff;color:#062a50}
.propose-resources-panel .button{margin:0;flex:0 0 auto}
.propose-resources-panel #guide-resources-ai-usage{flex-basis:100%;margin:0;font-size:.82rem;color:#607080}
.propose-resources-panel .propose-resources-here{display:inline-flex;align-items:center;gap:7px;margin:0;font-size:.85rem;font-weight:600;color:#062a50;white-space:nowrap;cursor:pointer}
.propose-resources-panel .propose-resources-here input{width:auto;margin:0;flex:0 0 auto}
.propose-resources-panel #propose-resources-anchor{flex-basis:100%;margin:0;font-size:.82rem;color:#33475b;font-style:italic}
@media(max-width:640px){.propose-resources-panel{align-items:stretch}.propose-resources-panel select,.propose-resources-panel .button{flex:1 1 100%}}
.legacy-resources{margin-top:18px;padding:16px;border:1px solid #d9e1e8;border-radius:12px;background:#fbfcfd}
.legacy-resources h4{margin:0 0 4px;color:#062a50;font-size:1rem}
.legacy-resource-list{display:grid;gap:8px;margin-top:12px;max-height:430px;overflow-y:auto;padding-right:4px}
.legacy-resource-row{display:grid;grid-template-columns:1fr auto;gap:4px 12px;align-items:center;padding:10px 12px;border:1px solid #e2e8ee;border-left:4px solid #607080;border-radius:9px;background:#fff}
.legacy-resource-row[data-tool="Genially"]{border-left-color:#d5a93f}
.legacy-resource-row[data-tool="YouTube"]{border-left-color:#b3261e}
.legacy-resource-row[data-tool="Educaplay"]{border-left-color:#2f7d5d}
.legacy-resource-tool{grid-column:1;margin:0;font-size:.75rem;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#607080}
.legacy-resource-title{grid-column:1;margin:0;font-size:.95rem;font-weight:700;color:#062a50;line-height:1.3}
.legacy-resource-meta{grid-column:1;margin:0;font-size:.75rem;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:#607080}
.legacy-resource-used{grid-column:1;margin:0;font-size:.78rem;color:#7a5300;background:#fff8e6;border:1px solid #f0e0b8;border-radius:6px;padding:3px 8px;justify-self:start}
.legacy-resource-row.usado{background:#f7f9fb;border-color:#d8e0e8}
.legacy-resource-row.usado .legacy-resource-title{color:#48607a}
.legacy-resource-more{margin-top:2px;padding:10px 12px;border:1px solid #e2e8ee;border-radius:9px;background:#fff}
.legacy-resource-more>summary{cursor:pointer;font-size:.85rem;font-weight:700;color:#062a50}
.legacy-resource-more .legacy-resource-list{max-height:none;margin-top:10px;padding-right:0}
.legacy-resource-url{grid-column:1;margin:0;font-size:.85rem;color:#062a50;word-break:break-all}
.legacy-resource-context{grid-column:1;margin:0;font-size:.8rem;color:#607080;font-style:italic}
.legacy-resource-row .button{grid-column:2;grid-row:1/5;margin:0;white-space:nowrap;align-self:center}
/* Fila 45 y 46: los enlaces del contenido y su barra de acciones. */
.content-editor a{color:#0b4a86;text-decoration:underline;text-underline-offset:2px}
.content-editor a:hover{color:#062a50}
.link-bubble{position:fixed;z-index:60;display:flex;gap:2px;padding:3px;border:1px solid #d9e1e8;border-radius:9px;background:#fff;box-shadow:0 8px 20px -10px rgba(6,42,80,.45)}
.link-bubble[hidden]{display:none}
.link-bubble button{font:inherit;font-size:.8rem;font-weight:700;color:#062a50;background:none;border:none;border-radius:6px;padding:5px 11px;cursor:pointer;white-space:nowrap}
.link-bubble button:hover{background:#eef2f6}
.resource-proposals{margin-top:20px;padding:16px;border:1px solid #d9e1e8;border-radius:12px;background:#f7fafc}
.resource-proposals h4{margin:0 0 4px;color:#062a50;font-size:1rem}
.resource-proposal-list{display:grid;gap:10px;margin-top:12px}
.resource-proposal-card{display:grid;gap:6px;padding:14px;border:1px solid #d9e1e8;border-left:4px solid #d5a93f;border-radius:9px;background:#fff}
.resource-proposal-card strong{color:#062a50}
.resource-proposal-card p{margin:0}
.resource-proposal-meta{font-size:.82rem;color:#607080}
.resource-proposal-purpose{font-size:.9rem;color:#33475b}
.resource-proposal-anchor{font-size:.85rem;color:#33475b;font-style:italic}
.resource-proposal-leadin{font-size:.86rem;color:#1c4a3a;background:#eef6f1;border-left:3px solid #2f7d5d;border-radius:0 6px 6px 0;padding:7px 10px;margin:0}
.resource-proposal-status{font-size:.85rem;color:#2f6d52;font-weight:600}
.resource-proposal-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.resource-proposal-card[data-state="done"]{border-left-color:#2f7d5d}
.resource-proposal-card[data-state="skipped"]{border-left-color:#b9c3cc;opacity:.65}
.resource-proposal-card[data-state="skipped"] .resource-proposal-status{color:#607080;font-weight:400}
.visual-styles{display:grid;gap:10px;padding:16px;border:1px solid #cbd5df}
.visual-style-option{display:grid!important;grid-template-columns:auto 1fr;align-items:start!important;gap:10px!important;padding:12px;border:1px solid #d9e1e8;border-radius:9px;cursor:pointer}
.visual-style-option:has(input:checked){border-color:#d5a93f;background:#fbf5e6}
.visual-style-option input{width:auto;margin-top:3px}
.visual-style-option strong,.visual-style-option small{display:block}
.visual-style-option small{margin-top:4px;color:#607080}
.visual-modification{display:grid;gap:12px;margin-top:16px;padding:16px;border-radius:10px;background:#f5f7f9}
.visual-modification label{display:grid;gap:6px;font-weight:700;color:#062a50}
.visual-base-prompt{display:grid;gap:6px}
.visual-base-prompt span{font-weight:700;color:#062a50}
.visual-base-prompt p{margin:0;max-height:9.5em;overflow:auto;padding:10px;border:1px solid #d9e1e8;border-radius:8px;background:#fff;color:#33475b;font-size:.9rem;line-height:1.5;font-weight:400}
.visual-progress{display:flex;align-items:center;gap:10px;margin-top:16px;padding:12px;border-radius:9px;background:#edf4fa;color:#062a50}
.visual-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:20px}
@media(max-width:640px){.visual-summary{grid-template-columns:1fr}.visual-actions .button{width:100%}}

.content-editor h2 {
  margin: 1.35em 0 .55em;
  color: #062a50;
  font-size: 1.42rem;
  line-height: 1.25;
}

.content-editor h3 {
  margin: 1.15em 0 .45em;
  color: #0b3a68;
  font-size: 1.16rem;
  line-height: 1.3;
}

.content-editor p {
  margin: .65em 0;
}

.content-editor ul,
.content-editor ol {
  margin: .7em 0;
  padding-left: 1.65em;
}

.content-editor li + li {
  margin-top: .35em;
}

.table-caption {
  margin: 1.2rem 0 .45rem;
  color: #062a50;
}

/* W3: nota debajo de una tabla insertada desde la barra. */
.table-note {
  margin: -.6rem 0 1.25rem;
  color: #66758a;
  font-size: .86rem;
}

.generated-table-wrapper {
  max-width: 100%;
  margin: 0 0 1.25rem;
  overflow-x: auto;
}

.generated-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .94rem;
}

.generated-table th,
.generated-table td {
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid #aebbc8;
  text-align: left;
  vertical-align: top;
}

.generated-table th {
  background: #dce6f1;
  color: #062a50;
  font-weight: 800;
}

.generated-table tbody tr:nth-child(even) {
  background: #f7f9fb;
}

@media (max-width: 700px) {
  .editor-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .format-label {
    width: 100%;
  }

  .format-label select {
    flex: 1;
  }
}

.week-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.week-tabs {
  display: flex;
  flex: 1;
  gap: 7px;
  overflow-x: auto;
  padding: 3px 0;
}

.week-tab {
  min-width: 42px;
  height: 38px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fff;
  color: #66758a;
  cursor: pointer;
}

.week-tab.current { border-color: #d5a93f; box-shadow: 0 0 0 2px #fbf5e6; color: #062a50; }
.week-tab.approved { border-color: #8cc9a5; background: #edf9f1; color: #14532d; }
.week-tab.review { border-color: #e4c46b; background: #fff8df; color: #654d08; }
.week-tab:disabled { cursor: not-allowed; opacity: .48; }
.content-editor[contenteditable="false"] { background: #f5f7f9; cursor: default; }

@media (max-width: 700px) {
  .week-navigation { align-items: stretch; flex-direction: column; }
  #download-word { width: 100%; }
}

/* UAT-036: fórmulas */
.guide-formula { text-align: center; margin: 0.8rem 0; }
.guide-formula[data-formula-display="inline"] { text-align: left; }
.guide-formula-error { font-family: ui-monospace, monospace; color: #b45309; }

/* UAT-036 paso 4: panel de fórmula */
.formula-field { display: block; }
.formula-field textarea { width: 100%; min-height: 5rem; font-family: ui-monospace, monospace; }
.formula-preview-box { margin: .8rem 0; padding: .8rem; border: 1px solid #d4d4d8; border-radius: .4rem; min-height: 3rem; text-align: center; }
.formula-mode-field { display: flex; gap: 1.2rem; margin-bottom: .8rem; }
.formula-mode-field label { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.guide-formula { cursor: pointer; }
.guide-formula:hover { background: #eef2ff; border-radius: .3rem; }

/* UAT-036: reemplaza el style inline de Temml, bloqueado por la CSP. */
math.tml-display { display: block math; }

/* Alineacion de texto: la CSP no permite estilos en linea (style sobrevive
   en el HTML pero el navegador no lo aplica), asi que viaja como clase. La
   izquierda no lleva clase: es la normal. */
.align-center { text-align: center; }
.align-right { text-align: right; }
