/* Aprobar — estilos */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --ink: #1b2032;
  --ink-2: #3c4459;
  --muted: #697089;
  --line: #e3e6f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --lec: #2563eb;
  --lec-soft: #e7efff;
  --ej: #0f8a5f;
  --ej-soft: #e3f6ee;
  --danger: #c52b45;
  --danger-soft: #fdecef;
  --ok: #0f8a5f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 50, .05), 0 6px 20px rgba(20, 24, 50, .06);
  --shadow-lg: 0 12px 40px rgba(40, 40, 120, .14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3, .h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; }
.link { font-weight: 600; font-size: .9rem; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 56px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; margin-right: auto; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font: 700 22px/1 Georgia, serif; box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.brand-txt small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink-2); font-weight: 600; font-size: .93rem; padding: 8px 12px; border-radius: 999px; text-decoration: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav .nav-out { color: var(--danger); }
.nav-toggle { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 42px; height: 42px; font-size: 20px; cursor: pointer; }

/* ---------- Pie ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; color: var(--muted); font-size: .88rem; }
.footer a { color: var(--muted); }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  font: 600 .95rem/1 var(--font); padding: 12px 18px; border-radius: 12px; cursor: pointer;
  text-decoration: none !important; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:hover { background: #4338ca; box-shadow: 0 6px 18px rgba(79, 70, 229, .28); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #f2c4cd; }
.btn.danger:hover { background: var(--danger-soft); box-shadow: none; }
.btn.sm { padding: 7px 11px; font-size: .84rem; border-radius: 9px; }
.btn.big { padding: 15px 26px; font-size: 1.05rem; }
.icon {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; font-size: .7rem; display: inline-grid; place-items: center;
}
.icon:hover:not(:disabled) { background: var(--surface-2); }
.icon:disabled { opacity: .3; cursor: default; }
.icon.danger { color: var(--danger); }

input[type=text], input[type=search], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.form label input, .form label select, .form label textarea { font-weight: 400; }
.form .check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; }
.form .check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input[type=text] { width: auto; flex: 1 1 200px; padding: 8px 11px; }
.grow { flex: 1; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.cols-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.cols-form label { flex: 1 1 240px; }

.seg { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend { font-weight: 600; font-size: .92rem; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.form .seg-opt { flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.seg-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg-opt input { accent-color: var(--brand); }

.drop {
  position: relative; border: 2px dashed #c9cde3; border-radius: var(--radius); background: var(--surface-2);
  padding: 30px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  align-items: center;
}
.form .drop { font-weight: 500; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-ico { font-size: 28px; color: var(--brand); }
.drop b { color: var(--ink); }
.drop small { color: var(--muted); font-weight: 400; }
.drop.compact { padding: 18px; }
.drop-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; position: relative; z-index: 1; pointer-events: none; }
.drop-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .84rem; font-weight: 500; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-size: .95rem; border: 1px solid; }
.alert.ok { background: var(--ej-soft); border-color: #b8e6d2; color: #0b5e41; }
.alert.err { background: var(--danger-soft); border-color: #f2c4cd; color: #8f1d31; }
.results { margin-bottom: 20px; }

.code { background: #161a2c; color: #e6e8f5; padding: 16px; border-radius: 12px; overflow-x: auto; font-size: .85rem; line-height: 1.55; white-space: pre-wrap; }
.help summary { cursor: pointer; font-weight: 700; }
.help[open] summary { margin-bottom: 12px; }
.plain { margin: 0; padding-left: 18px; }

/* ---------- Portada ---------- */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f3f2ff 100%); border: 1px solid var(--line);
  border-radius: 24px; padding: clamp(24px, 5vw, 52px); box-shadow: var(--shadow); margin-bottom: 36px; overflow: hidden;
}
.eyebrow { display: inline-block; font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); background: linear-gradient(135deg, var(--ink) 30%, var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search { display: flex; gap: 8px; margin-top: 22px; max-width: 560px; }
.search input { flex: 1; padding: 14px 16px; border-radius: 14px; font-size: 1rem; box-shadow: var(--shadow); }
.search button { border: 0; background: var(--ink); color: #fff; font: 600 .95rem var(--font); padding: 0 20px; border-radius: 14px; cursor: pointer; }
.hero-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero-art span {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 20px; font: 700 clamp(1.6rem, 3.5vw, 2.4rem) Georgia, serif;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--brand);
}
.hero-art span:nth-child(2n) { color: var(--brand-2); transform: translateY(12px); }
.hero-art span:nth-child(3n) { color: var(--ej); }

.block { margin-bottom: 40px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }
.empty.small { padding: 12px 16px; font-size: .9rem; text-align: left; }
.empty-box { background: var(--surface); border: 1px dashed #c9cde3; border-radius: var(--radius); padding: 32px; text-align: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden; min-height: 180px;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent, var(--brand)); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d5d8ea; }
.card h3 { font-size: 1.2rem; margin: 6px 0 6px; }
.card p { color: var(--muted); font-size: .92rem; margin-bottom: 14px; }
.card-top { font-size: .78rem; font-weight: 700; color: var(--accent, var(--brand)); text-transform: uppercase; letter-spacing: .08em; }
.card-foot { margin-top: auto; display: flex; gap: 12px; align-items: center; font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.card-foot .go { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); transition: background .15s, color .15s; }
.card:hover .go { background: var(--accent, var(--brand)); color: #fff; }
.c0 { --accent: #4f46e5; } .c1 { --accent: #0f8a5f; } .c2 { --accent: #d9480f; }
.c3 { --accent: #7c3aed; } .c4 { --accent: #0e7490; } .c5 { --accent: #be185d; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.b-lec { background: var(--lec-soft); color: var(--lec); }
.b-ej { background: var(--ej-soft); color: var(--ej); }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; background: #fff3d6; color: #8a5a00; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; color: var(--ink); text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.row-item:hover { border-color: #cfd3ea; box-shadow: var(--shadow); transform: translateX(2px); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-main b { font-weight: 600; }
.row-main small { color: var(--muted); font-size: .86rem; }
.row-go { color: var(--muted); font-weight: 700; }
.row-item:hover .row-go { color: var(--brand); }

/* ---------- Curso ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.page-head { margin-bottom: 24px; }
.tabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 999px; margin-top: 8px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; font: 600 .9rem var(--font); color: var(--ink-2); padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.tabs button small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.tabs button.on { background: var(--ink); color: #fff; }
.tabs button.on small { color: #c8cbe0; }
.unidad { margin-bottom: 30px; }
.unidad-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.unidad-head h2 { margin: 0; }
.unidad-num { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; }

/* ---------- Visor ---------- */
.viewer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.viewer-head h1 { margin-top: 10px; }
.viewer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.viewer iframe { display: block; width: 100%; min-height: 75vh; border: 0; background: #fff; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.pager-a { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; color: var(--ink); text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.pager-a:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.pager-a small { color: var(--brand); font-weight: 700; font-size: .8rem; }
.pager-a.next { text-align: right; grid-column: 2; }

.notfound { text-align: center; padding: 60px 0; }
.notfound .big { font-size: 5rem; font-weight: 800; color: var(--brand); margin: 0; line-height: 1; }
.notfound .lead { margin: 0 auto 22px; }

/* ---------- Panel ---------- */
.is-admin { background: #f3f4f9; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar select { width: auto; min-width: 220px; }
.toolbar input { width: auto; flex: 1 1 200px; }
.adm-curso { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.adm-curso-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.adm-curso-head h2 { margin: 0; }
.adm-unidad { margin: 14px 0 18px; }
.adm-unidad h3 { color: var(--ink-2); }
.adm-unidad h3 small { color: var(--muted); font-weight: 600; background: var(--surface-2); padding: 1px 8px; border-radius: 999px; font-size: .78rem; margin-left: 4px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:first-child td { border-top: 0; }
.tbl tr.is-hidden td { opacity: .6; }
.t-ord { width: 74px; white-space: nowrap; }
.t-title a { color: var(--ink); font-weight: 600; }
.t-title small { display: block; font-size: .78rem; }
.t-act { text-align: right; white-space: nowrap; }
.t-act .inline { margin-left: 4px; }
.adm-curso-edit .in-title { font-weight: 700; font-size: 1.05rem; flex: 1 1 240px; }
.unidades { margin: 10px 0 14px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.unidades li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unidades li::marker { color: var(--muted); font-weight: 700; }
.login { max-width: 420px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-lg); }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px 16px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 10px; }
  .search { flex-direction: column; }
  .search button { padding: 14px; }
  .pager { grid-template-columns: 1fr; }
  .pager-a.next { grid-column: 1; }
  .viewer iframe { min-height: 70vh; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { border-top: 1px solid var(--line); padding: 10px 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
  .tbl tr:first-child { border-top: 0; }
  .tbl td { border: 0; padding: 0; }
  .tbl .t-ord { grid-row: span 2; width: auto; }
  .tbl .t-title { grid-column: 2; }
  .tbl .t-act { grid-column: 1 / -1; text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; }
  .t-act .inline { margin-left: 0; }
}
.tbl td:nth-child(2) { width: 112px; }
@media (max-width: 760px) {
  .card { min-height: 0; }
  .tbl td:nth-child(2) { width: auto; }
}
