:root {
  --blue: #087bb7;
  --blue-dark: #07537b;
  --teal: #00a99d;
  --green: #60c825;
  --ink: #303438;
  --muted: #697176;
  --line: #dce2e5;
  --paper: #ffffff;
  --surface: #f3f5f3;
  --panel: #e9eeee;
  --shadow: 0 20px 50px rgba(26, 38, 48, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  zoom: 0.85;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.5;
}

@supports not (zoom: 1) {
  body {
    width: 117.647%;
    transform: scale(0.85);
    transform-origin: top left;
  }
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.is-hidden-field { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(18px, 4vw, 58px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  color: var(--blue-dark);
}

.brand img { width: 148px; height: auto; display: block; }
.brand span { padding-left: 14px; border-left: 1px solid var(--line); }

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav button,
.section-tabs button,
.library-tabs button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #42494e;
  font-weight: 800;
}

.topnav button { padding: 10px 14px; }

.topnav button.active,
.section-tabs button.active,
.library-tabs button.active {
  background: var(--blue);
  color: white;
}

.logout-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid rgba(163, 59, 47, 0.35);
  border-radius: 4px;
  background: #fff5f3;
  color: #a33b2f;
  font-weight: 900;
}

.logout-button[hidden] { display: none; }

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--ink);
}

.view { display: none; }
.view.active { display: block; }

.profile-cover {
  position: relative;
  min-height: calc(100vh - 76px);
  overflow: hidden;
  color: white;
}

.cover-image,
.cover-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cover-image { object-fit: cover; object-position: center top; }
.cover-shade { background: linear-gradient(90deg, rgba(30, 35, 39, 0.78), rgba(30, 35, 39, 0.28) 62%, rgba(30, 35, 39, 0.08)); }

.cover-content {
  position: relative;
  width: min(1180px, calc(100% - 36px));
  padding: clamp(84px, 13vw, 150px) 0 110px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.light { color: #e1f5ff; }

h1, h2, h3, h4 { margin: 0; line-height: 1.08; letter-spacing: 0; }
h1 { font-size: clamp(46px, 8vw, 88px); }
h2 { font-size: clamp(34px, 5vw, 58px); }
h3 { font-size: clamp(24px, 3vw, 36px); }

.cover-main {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 0.75fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
}

.cover-entry > p:not(.eyebrow) {
  width: min(700px, 100%);
  margin: 22px 0 0;
  font-size: clamp(18px, 2vw, 24px);
}

.profile-select-card,
.available-menu {
  padding: 24px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-select-card {
  width: min(656px, 100%);
  min-height: auto;
  margin-top: 32px;
}

.profile-select-card label {
  display: block;
  margin-bottom: 10px;
  font-weight: 900;
}

.select-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.select-row select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.available-menu {
  display: grid;
  gap: 14px;
}

.available-menu .eyebrow {
  color: var(--blue-dark);
}

.available-menu h2 {
  color: var(--blue);
  font-size: clamp(30px, 4vw, 46px);
}

.available-section {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.available-section > div:first-child span {
  display: block;
  color: var(--blue);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.available-section > div:first-child strong {
  display: block;
  margin-top: 6px;
  color: var(--blue-dark);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-course-list {
  display: grid;
  gap: 8px;
}

.cover-course-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfc;
}

.cover-course-item strong {
  display: block;
}

.cover-course-item span {
  color: var(--muted);
  font-size: 13px;
}

.item-cover {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.item-cover.small {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 6px;
}

.page-head,
.admin-view,
.user-view {
  padding: clamp(42px, 6vw, 74px) clamp(18px, 5vw, 72px);
}

.page-head { padding-bottom: 24px; }
.page-head > p:not(.eyebrow) { max-width: 820px; color: var(--muted); font-size: 18px; }
.page-head.small { padding: 0 0 22px; }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) 1fr;
  gap: 20px;
}

.side-panel,
.admin-panel,
.course-index,
.lesson-player,
.resource-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  align-self: start;
  position: sticky;
  top: 100px;
  padding: 22px;
}

.side-panel img { width: 170px; margin-bottom: 22px; }
.side-panel strong, .side-panel span { display: block; }
.side-panel span { color: var(--muted); }

.section-tabs {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.section-tabs button {
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: #f3f7f8;
}

.admin-panel,
.user-panel {
  display: none;
}

.admin-panel.active,
.user-panel.active {
  display: block;
}

.admin-panel {
  padding: clamp(22px, 4vw, 34px);
}

.panel-title,
.lesson-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef7fb;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.form-grid textarea,
.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.form-grid textarea { resize: vertical; }
.form-grid label:has(textarea), .form-grid button, .form-status { grid-column: 1 / -1; }

.form-status {
  min-height: 24px;
  color: var(--blue-dark);
  font-weight: 800;
}

.import-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.button.primary { background: var(--blue); border-color: var(--blue); color: white; }

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.admin-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfc;
}

.admin-item strong { display: block; }
.admin-item span { color: var(--muted); font-size: 14px; }
.admin-item .item-body { min-width: 0; }

.admin-item .item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.mini-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--blue-dark);
  font-weight: 900;
}

.mini-button.danger {
  color: #a33b2f;
  border-color: rgba(163, 59, 47, 0.35);
}

.mini-button.danger:hover {
  background: #fff5f3;
}

.login-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-dialog::backdrop {
  background: rgba(22, 29, 34, 0.62);
  backdrop-filter: blur(4px);
}

.login-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 28px;
  background: white;
}

.login-card label {
  display: grid;
  gap: 7px;
  font-weight: 900;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfc;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.user-hero {
  min-height: 310px;
  display: flex;
  align-items: end;
  padding: clamp(32px, 6vw, 62px);
  color: white;
  background:
    linear-gradient(90deg, rgba(33, 39, 43, 0.82), rgba(33, 39, 43, 0.42)),
    url("../img/imagen-institucional.png") center top / cover;
  border-radius: 0 0 8px 8px;
}

.user-hero p:not(.eyebrow) { max-width: 780px; font-size: 19px; }

.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
}

.library-tabs button {
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--line);
}

.course-picker {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 2fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.course-picker label {
  font-weight: 900;
}

.course-picker select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #fbfcfc;
  font-weight: 800;
}

.course-progress-card {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(26, 38, 48, 0.08);
}

.progress-summary,
.approval-grid {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.progress-summary strong {
  color: var(--blue-dark);
  font-size: 22px;
}

.progress-summary > span {
  color: var(--blue);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf0;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 180ms ease;
}

.approval-grid span {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef7fb;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 900;
}

.certificate-button {
  justify-self: end;
  min-width: 220px;
}

.certificate-button:disabled,
.certificate-card:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.course-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.course-index,
.lesson-player {
  padding: 22px;
}

.lesson-player {
  min-width: 0;
  overflow: hidden;
  display: grid;
  gap: 14px;
}

.lesson-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.video-block {
  background: white;
}

.module-index {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.module-group {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.module-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  font-weight: 900;
  text-align: left;
}

.module-heading span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.module-heading i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--blue-dark);
  font-style: normal;
  font-weight: 900;
  background: white;
}

.module-heading:hover strong {
  color: var(--blue);
}

.module-group.is-collapsed {
  background: #fbfcfc;
}

.lesson-list {
  display: grid;
  gap: 7px;
}

.lesson-list[hidden] {
  display: none !important;
}

.lesson-button {
  width: 100%;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfc;
  color: var(--ink);
}

.lesson-button.active {
  border-color: var(--blue);
  box-shadow: inset 4px 0 0 var(--blue);
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(62vh, 620px);
  background: #111;
  border-radius: 8px;
  overflow: hidden;
}

.lesson-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
}

.lesson-objective {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.lesson-nav-controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.button.secondary {
  background: white;
  border-color: var(--line);
  color: var(--blue-dark);
}

.lesson-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  margin-top: 0;
  align-items: start;
}

.lesson-support {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.lesson-support .eyebrow {
  margin-bottom: 10px;
}

.asset-grid,
.task-grid,
.resource-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 0;
}

.asset-link,
.resource-card {
  padding: 11px 12px;
  border-radius: 8px;
}

.resource-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

button.resource-card {
  border: 1px solid var(--line);
  color: inherit;
}

.resource-card.locked {
  background: #f4f6f6;
}

.resource-cover {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.asset-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  background: #f4fafb;
  color: var(--blue-dark);
  font-weight: 900;
}

.asset-link strong {
  font-size: 15px;
  line-height: 1.2;
}

.asset-link span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-link {
  background: #f3faf8;
  color: #08715f;
}

.quiz-box {
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 0;
  border-left: 4px solid var(--teal);
  background: transparent;
}

.quiz-item {
  padding: 10px 12px;
  background: #f4faf8;
  border: 1px solid transparent;
  border-radius: 4px;
}

.quiz-item.is-correct {
  border-color: rgba(96, 200, 37, 0.55);
  background: #f3fbef;
}

.quiz-item.is-incorrect {
  border-color: rgba(184, 55, 55, 0.45);
  background: #fff5f3;
}

.quiz-item p {
  margin: 6px 0;
}

.quiz-box label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.quiz-check {
  margin-top: 10px;
}

.quiz-result {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 900;
}

.quiz-result.correct {
  color: #2e7d19;
}

.quiz-result.incorrect {
  color: #a33b2f;
}

.quiz-result.pending {
  color: var(--blue-dark);
}

.empty-state {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--muted);
  background: #f5f7f7;
  border: 1px dashed var(--line);
  border-radius: 4px;
}

.resource-card strong { display: block; margin-bottom: 8px; font-size: 20px; }
.resource-card span { color: var(--muted); }

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 30px 18px;
  background: white;
  border-top: 1px solid var(--line);
  font-weight: 900;
}

.footer img { width: 160px; display: block; }

@media (max-width: 980px) {
  .menu-button { display: block; }
  .topnav {
    position: absolute;
    top: 75px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 18px 18px;
    background: white;
    border-bottom: 1px solid var(--line);
  }
  .topnav.open { display: flex; }
  .topnav button { text-align: left; }
  .cover-main,
  .available-section,
  .admin-layout,
  .course-shell,
  .asset-grid,
  .task-grid,
  .resource-grid,
  .form-grid,
  .course-picker,
  .lesson-workspace {
    grid-template-columns: 1fr;
  }
  .side-panel { position: static; }
  .form-grid label:has(textarea), .form-grid button { grid-column: auto; }
  .select-row { grid-template-columns: 1fr; }
  .video-frame { max-height: 58vh; }
  .admin-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .admin-item .item-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .brand img { width: 118px; }
  .brand span { font-size: 14px; padding-left: 10px; }
  .profile-cover { min-height: 760px; }
  .cover-shade { background: linear-gradient(180deg, rgba(30,35,39,0.16), rgba(30,35,39,0.88)); }
  .cover-content { width: calc(100% - 36px); padding-top: 320px; }
  .panel-title, .lesson-head, .footer { flex-direction: column; }
  .lesson-nav-controls {
    flex-direction: column;
  }
  .course-index,
  .lesson-player {
    padding: 16px;
  }
  .video-frame {
    max-height: 46vh;
  }
}
