:root {
  /* Papel cálido + tinta + verde académico */
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #f8f3e9;
  --border: #e5ddcb;
  --border-strong: #d6cbb2;
  --text: #2a251d;
  --muted: #736a58;
  --faint: #9c9280;
  /* --navy / --blue se mantienen como nombres, pero ahora son la gama VERDE
     para que todas las reglas existentes hereden el color nuevo sin tocarlas. */
  --navy: #35654e;
  --navy-700: #294f3c;
  --blue: #3c7358;
  --blue-soft: #e7efe6;
  --gold: #b0782b;
  --gold-soft: #f3ead6;
  --green: #2f855a;
  --red: #c0392f;
  --amber: #b7791f;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(58, 46, 25, .05), 0 2px 8px rgba(58, 46, 25, .05);
  --shadow-md: 0 10px 34px rgba(58, 46, 25, .12);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --serif: "Newsreader", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130d;
    --surface: #211c14;
    --surface-2: #1b1710;
    --border: #362f22;
    --border-strong: #473e2d;
    --text: #ece4d5;
    --muted: #a89e88;
    --faint: #766c58;
    --navy: #86c0a2;
    --navy-700: #a2d3b9;
    --blue: #7cb79b;
    --blue-soft: #21281f;
    --gold: #d3a35a;
    --gold-soft: #2b2416;
    --green: #6fbf95;
    --red: #e07a6f;
    --amber: #d8a24a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 34px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--gold-soft) 0%, transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, var(--blue-soft) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .panel-head h2, .wordmark { font-family: var(--display); font-weight: 500; }

/* ---------- Barra superior ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--navy), var(--navy-700));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.wordmark { font-size: 20px; font-weight: 500; letter-spacing: .1px; }
.wordmark .accent { color: var(--gold); font-style: italic; font-weight: 500; }
.brand-text span { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.appbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.userbox { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.userbox .uname { font-size: 12.5px; font-weight: 600; color: var(--text); margin-left: 4px; }
@media (max-width: 560px) {
  .appbar { padding: 10px 14px; }
  .userbox .linkbtn { font-size: 12px; padding: 4px 7px; }
}
.linkbtn {
  background: none; border: none; padding: 5px 9px; font: inherit; font-size: 12.5px;
  font-weight: 500; color: var(--muted); cursor: pointer; border-radius: 7px;
  transition: color .12s, background .12s;
}
.linkbtn:hover { color: var(--navy); background: var(--blue-soft); text-decoration: none; }

/* ---------- Login / solicitud de acceso ---------- */
.authwrap {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
}
.authcard {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px 28px 28px;
}
.authwrap .brand-mark { display: none; }
.authcard::before {
  content: "Resumí (esta)";
  display: block;
  font-family: var(--display);
  font-size: 24px;
  color: var(--navy);
  text-align: center;
  margin: 22px 0 4px;
}
.authcard::after {
  content: "Apuntes y resúmenes de clase con IA";
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
}
.tabs { display: flex; gap: 4px; margin: 4px 0 18px; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 12px 8px; background: none; border: none; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--navy); border-bottom-color: var(--blue); }
.authform { display: flex; flex-direction: column; gap: 14px; }
.authform .btn-primary { min-width: 0; width: 100%; margin-top: 4px; }
.formmsg { font-size: 12.5px; color: var(--red); margin: 2px 0 0; min-height: 1em; }
.formmsg.ok { color: var(--green); }

/* ---------- Panel de administración ---------- */
.tablewrap { overflow-x: auto; }
.utable { width: 100%; border-collapse: collapse; font-size: 13px; }
.utable th, .utable td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.utable th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }
.utable td.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.badge.approved { color: var(--green); border-color: var(--green); }
.badge.pending { color: var(--amber); border-color: var(--amber); }
.badge.rejected, .badge.disabled { color: var(--red); border-color: var(--red); }
.minibtn {
  padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px;
}
.minibtn:hover { border-color: var(--blue); }
.minibtn.ok { color: var(--green); border-color: var(--green); }
.minibtn.danger { color: var(--red); border-color: var(--red); }

.pub-url {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  word-break: break-all;
  padding: 8px 12px;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
#adminView .panel p { font-size: 13px; color: var(--muted); margin: 4px 0; }

.badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.chk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}
.chk-row input { accent-color: var(--blue); width: 16px; height: 16px; }

/* Historial */
.hlist { display: flex; flex-direction: column; gap: 8px; }
.hitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .12s;
}
.hitem:hover { border-color: var(--blue); }
.hitem .htitle { font-weight: 600; font-size: 13.5px; }
.hitem .hmeta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hitem .hstatus { font-size: 11px; font-weight: 700; text-transform: uppercase; }

/* Lote de varios audios */
.brow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.brow .bname { flex: 0 0 180px; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .bbar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.brow .bbar > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--navy), var(--blue)); transition: width .4s; }
.brow .bstatus { flex: 0 0 140px; font-size: 12px; color: var(--muted); text-align: right; }
.brow a.bview { font-size: 12px; font-weight: 600; color: var(--blue); text-decoration: none; }

/* Flashcards */
.fcard {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface-2);
}
.fcard summary { color: var(--text); font-weight: 600; font-size: 13.5px; }
.fcard p { margin: 8px 0 0; font-size: 13.5px; }

/* ---------- Tour guiado ---------- */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.tour-overlay.hidden { display: none; }

.tour-spot {
  position: fixed;
  z-index: 1001;
  border-radius: 10px;
  border: 2px solid var(--blue);
  box-shadow: 0 0 0 9999px rgba(15, 19, 25, .62), 0 0 0 5px rgba(46, 134, 222, .25);
  transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
  pointer-events: none;
}
/* Paso sin objetivo concreto: el punto queda en tamaño 0, así su sombra
   (9999px de expansión) oscurece la pantalla entera sin dejar ningún hueco. */

.tour-card {
  position: fixed;
  z-index: 1002;
  width: 320px;
  max-width: calc(100vw - 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px 20px 20px;
  transition: top .3s ease, left .3s ease;
}
.tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.tour-step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}
.tour-card h3 { margin: 0 0 8px; font-size: 16px; color: var(--navy); }
.tour-card p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.tour-actions { display: flex; justify-content: space-between; gap: 10px; }
.tour-actions .btn-primary { min-width: 0; flex: 1; padding: 10px 16px; font-size: 13.5px; }
.tour-actions .minibtn { padding: 9px 14px; }
.chip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.chip-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.chip-pill.on { color: var(--text); }
.chip-pill.on i { background: var(--green); }

/* ---------- Layout ---------- */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .1px;
  color: var(--text);
}
.step-badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--display);
  flex-shrink: 0;
}

/* ---------- Zona de subida ---------- */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 20px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  transition: border-color .15s, background .15s;
}
.drop.hover { border-color: var(--blue); background: var(--blue-soft); }
.drop-ic { color: var(--faint); }
.drop p { margin: 0; }
.hint { font-size: 12px; color: var(--faint); }
.fileinfo { font-size: 13px; font-weight: 600; color: var(--blue); margin-top: 6px !important; }

.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Formulario ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}
label .opt { font-weight: 400; color: var(--faint); }

select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="search"],
textarea {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
input[type="date"] {
  color-scheme: light;
  min-height: 41px;
}
@media (prefers-color-scheme: dark) { input[type="date"] { color-scheme: dark; } }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23736a58' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
textarea { resize: vertical; min-height: 54px; }

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

/* Evita que el autorrelleno del navegador pinte el campo de blanco */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px var(--surface) inset;
}

.note {
  margin: 18px 0 0;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
}

/* ---------- Formatos (chips) ---------- */
.formats {
  margin: 18px 0 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.formats legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.formats .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 8px 0 0;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: all .12s;
}
.formats .chip input { accent-color: var(--blue); margin: 0; }
.formats .chip:has(input:checked) {
  color: var(--navy);
  background: var(--blue-soft);
  border-color: var(--blue);
}

/* ---------- Botón principal ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
  min-width: 260px;
  padding: 13px 26px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(160deg, var(--navy), var(--navy-700));
  border: none;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-sm);
  transition: filter .12s, transform .05s, box-shadow .12s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-md); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.hidden { display: none !important; }

/* ---------- Stepper ---------- */
.stepper {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.stepper li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stepper li span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.stepper li.active { color: var(--navy); border-color: var(--blue); background: var(--blue-soft); }
.stepper li.active span { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.stepper li.done { color: var(--muted); }
.stepper li.done span { background: var(--green); }
@media (max-width: 620px) {
  .stepper { flex-direction: column; }
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 10px;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), var(--blue));
  transition: width .4s ease;
}
.jobmsg { font-size: 13.5px; margin: 4px 0 8px; color: var(--text); }
.jobmsg.err { color: var(--red); font-weight: 600; }
.jobmsg.ok { color: var(--green); font-weight: 600; }

details { margin-top: 8px; }
summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
summary:hover { color: var(--text); }

.log,
.transcript {
  margin-top: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  max-height: 280px;
  overflow: auto;
}

/* ---------- Resultados ---------- */
.res-h {
  margin: 26px 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold);
}
.res-h:first-child { margin-top: 4px; }

.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.downloads a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s;
}
.downloads a:hover { border-color: var(--blue); background: var(--blue-soft); }
.downloads a::before {
  content: "";
  width: 15px; height: 15px;
  background: var(--blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0l-4-4m4 4l4-4M5 21h14'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0l-4-4m4 4l4-4M5 21h14'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* El resumen se muestra como un "documento" impreso */
.doc {
  padding: 40px 46px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(180deg, var(--gold-soft), var(--border)) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.72;
  color: var(--text);
  max-width: 68ch;
  margin: 0 auto;
}
.doc > :first-child { margin-top: 0; }
.doc h1 {
  font-family: var(--display); font-size: 27px; font-weight: 500; color: var(--navy);
  margin: 26px 0 14px; line-height: 1.2;
}
.doc h2 {
  font-family: var(--display); font-size: 21px; font-weight: 500; color: var(--text);
  margin: 30px 0 10px; padding-bottom: 6px;
  border-bottom: 2px solid var(--blue-soft);
}
.doc h3 { font-family: var(--display); font-size: 17.5px; font-weight: 600; color: var(--navy); margin: 20px 0 6px; }
.doc p { margin: 11px 0; }
.doc ul, .doc ol { margin: 11px 0 11px 24px; padding: 0; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--gold); }
.doc strong { color: var(--navy); font-weight: 600; }
.doc em { color: var(--muted); }
.doc code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.doc a { color: var(--navy); text-decoration-color: var(--gold); text-underline-offset: 3px; }

.foot {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  padding: 8px 12px;
  max-width: 60ch;
  margin: 0 auto;
}

/* ============ Fase 18: estudiar mejor ============ */

/* Historial: casilla para combinar */
.hitem .hcheck { accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.hitem .hcheck:disabled { opacity: .35; }
.combine-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; padding: 12px 14px;
  background: var(--blue-soft); border: 1px solid var(--blue); border-radius: var(--radius-sm);
}
.combine-bar select { padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.chk-inline input { accent-color: var(--blue); }

/* Importar desde YouTube */
.yt-row { display: flex; gap: 8px; margin-top: 12px; }
.yt-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px;
}
.yt-row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* Vista previa en vivo */
.live-preview {
  margin-top: 12px; padding: 10px 12px; text-align: left;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.live-tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--red); margin-bottom: 4px;
}
.live-preview p { margin: 0; font-size: 13px; color: var(--text); max-height: 120px; overflow-y: auto; }
.live-preview .hint { margin-top: 6px; }

/* Cajas de estudio (chat / examen) */
.study-box {
  margin-top: 14px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; margin-bottom: 10px; }
.chat-msg { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; max-width: 90%; }
.chat-msg.user { align-self: flex-end; background: var(--blue); color: #fff; }
.chat-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.chat-msg.bot p:first-child { margin-top: 0; }
.chat-msg.bot p:last-child { margin-bottom: 0; }
.chat-input { display: flex; gap: 8px; }
.chat-input input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px;
}
.chat-input input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* Cuestionario */
.quiz-q { padding: 12px 0; border-bottom: 1px solid var(--border); }
.quiz-q:last-of-type { border-bottom: none; }
.quiz-stem { font-weight: 600; font-size: 13.5px; margin: 0 0 8px; }
.quiz-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px;
  border-radius: 6px; font-size: 13px; cursor: pointer;
}
.quiz-opt input { accent-color: var(--blue); margin-top: 2px; }
.quiz-opt.right { background: rgba(18, 183, 106, .14); }
.quiz-opt.wrong { background: rgba(225, 75, 75, .14); }
.quiz-expl { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; padding-left: 8px; }

/* Repaso espaciado */
.review-progress { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.review-card {
  padding: 20px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.review-src { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin-bottom: 10px; }
.review-q { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.5; }
.review-a {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 14.5px; color: var(--text); line-height: 1.6;
}
.review-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
#reviewGrade { display: flex; gap: 10px; }

/* ============ Fase 19: producto académico ============ */

/* Accesibilidad */
.a11y-panel {
  position: fixed; right: 12px; top: 54px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.a11y-size { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.a11y-size .minibtn { padding: 4px 8px; }
/* El tamaño afecta a las zonas de lectura: resumen, chat, repaso, examen, transcripción. */
:root[data-text-size="1"] .doc,
:root[data-text-size="1"] .chat-msg,
:root[data-text-size="1"] .review-q,
:root[data-text-size="1"] .review-a,
:root[data-text-size="1"] .quiz-stem,
:root[data-text-size="1"] #transcript { font-size: 16px; line-height: 1.75; }
:root[data-text-size="2"] .doc,
:root[data-text-size="2"] .chat-msg,
:root[data-text-size="2"] .review-q,
:root[data-text-size="2"] .review-a,
:root[data-text-size="2"] .quiz-stem,
:root[data-text-size="2"] #transcript { font-size: 19px; line-height: 1.85; }
:root[data-text-size="-1"] .doc,
:root[data-text-size="-1"] #transcript { font-size: 12.5px; }
:root.a11y-dyslexia, :root.a11y-dyslexia body,
:root.a11y-dyslexia .doc, :root.a11y-dyslexia input, :root.a11y-dyslexia textarea, :root.a11y-dyslexia select {
  font-family: "Comic Sans MS", "Trebuchet MS", Verdana, sans-serif !important;
  letter-spacing: .02em; line-height: 1.7;
}
:root.a11y-contrast {
  --text: #000; --muted: #333; --border: #888; --border-strong: #555; --bg: #fff; --surface: #fff;
}
@media (prefers-color-scheme: dark) {
  :root.a11y-contrast { --text: #fff; --muted: #ddd; --border: #999; --bg: #000; --surface: #0a0a0a; }
}

/* Comodidad de lectura: cabecera del panel */
.a11y-title {
  margin: 0 0 2px; font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--text);
}

/* Materias */
.slist { display: flex; flex-direction: column; gap: 10px; }
.sitem {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 15px 18px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.sitem-main { display: flex; flex-direction: column; gap: 4px; }
.sitem .htitle { font-family: var(--display); font-size: 16px; font-weight: 600; }
.sitem-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.exam-set {
  display: inline-flex; align-items: center; gap: 6px; flex-direction: row;
  font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em;
}
.exam-set input[type="date"] { min-height: 32px; padding: 4px 8px; font-size: 12px; width: auto; }
.exam-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; width: fit-content;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--blue-soft); color: var(--navy);
}
.exam-badge.soon { background: var(--gold-soft); color: var(--gold); }
.exam-badge.past { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.subj-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold); font-weight: 600; font-size: 11px;
}

/* Progreso */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; }
.stat-card {
  padding: 20px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center;
}
.stat-value { font-family: var(--display); font-size: 34px; font-weight: 500; color: var(--navy); line-height: 1; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 8px; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Materia en el panel de resultados */
.res-subject { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.res-subject select {
  padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text);
}

/* Mapa conceptual */
.mindmap-box {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: 10px; overflow-x: auto; text-align: center;
}
.mindmap-box svg { max-width: 100%; height: auto; }

/* Modo examen: pestañas y preguntas de desarrollo */
.quiz-mode-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.quiz-mode-tab {
  padding: 6px 12px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.quiz-mode-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.quiz-q.open .open-answer {
  width: 100%; margin-top: 8px; padding: 8px 10px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); font-family: inherit;
}
.open-result { margin-top: 8px; font-size: 13px; }
.open-result p { margin: 4px 0; }
.open-score { display: inline-block; font-family: var(--display); font-weight: 600; font-size: 16px; padding: 2px 9px; border-radius: 6px; }
.open-score.ok { background: var(--blue-soft); color: var(--green); }
.open-score.bad { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

/* ---- Ajustes finales de tipografía / calidez ---- */
.hitem .htitle, .brow .bname { font-family: var(--display); font-size: 15px; font-weight: 600; }
.review-q { font-family: var(--display); font-weight: 500; }
.review-card {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(180deg, var(--gold-soft), var(--border)) border-box;
  border: 1px solid transparent;
}
.tour-card h3 { font-family: var(--display); font-weight: 500; }
.res-subject select { min-height: 34px; }
.note { border-left-width: 3px; border-left-color: var(--gold); }
.chip-pill.on i { background: var(--green); }
.formmsg.ok { color: var(--green); }
/* La franja del progreso, más cálida */
.bar-fill { background: linear-gradient(90deg, var(--navy), var(--gold)); }
/* El "documento" con menos padding en móvil */
@media (max-width: 620px) {
  .doc { padding: 26px 22px; font-size: 16px; }
  .panel { padding: 20px 18px; }
  main { padding: 24px 16px 70px; }
}
