:root {
  --primary: #263b50;
  --dark: #17202a;
  --accent: #d64a3a;
  --secondary: #edf2f7;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(rgba(247, 250, 252, .9), rgba(247, 250, 252, .94)),
    url("/assets/fondo.jpg") center top / cover fixed;
  color: var(--dark);
}
a { color: inherit; }
.topbar {
  min-height: 68px;
  padding: 12px 24px;
  background: rgba(38, 59, 80, .96);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, .18);
}
.brand { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.brand img { width: 220px; height: 52px; object-fit: contain; object-position: left center; }
.brand span {
  border-left: 1px solid rgba(255,255,255,.24);
  padding-left: 14px;
  color: rgba(255,255,255,.88);
}
.topbar nav { display: flex; gap: 10px; font-size: 14px; font-weight: 700; }
.topbar a {
  align-items: center;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  gap: 7px;
  padding: 9px 10px;
  text-decoration: none;
}
.topbar a:hover { color: var(--accent); }
.topbar .nav-logout {
  background: var(--accent);
  color: #fff;
}
.topbar .nav-logout:hover {
  background: #b93629;
  color: #fff;
}
.nav-icon {
  display: inline-grid;
  font-size: 13px;
  line-height: 1;
  place-items: center;
}
.container { max-width: 1180px; margin: 0 auto; padding: 36px 20px; }
.page-header {
  align-items: center;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(23, 32, 42, .04);
}
.page-header h1 {
  color: var(--primary);
  margin: 8px 0;
}
.page-title-accent {
  color: var(--accent);
  display: block;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.15;
}
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.page-header p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.stats-strip {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat-card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
}
.stat-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}
.stat-card strong {
  color: var(--primary);
  font-size: 28px;
}
.academic-shell {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: 260px minmax(0, 1fr);
}
.course-main { min-width: 0; }
.course-sidebar {
  position: sticky;
  top: 18px;
}
.course-sidebar h2 {
  color: var(--primary);
  margin: 10px 0 18px;
}
.sidebar-link {
  border-radius: 6px;
  color: var(--primary);
  display: block;
  font-weight: 800;
  margin-top: 8px;
  padding: 11px 12px;
  text-decoration: none;
}
.sidebar-link:hover,
.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}
.hero {
  background:
    linear-gradient(135deg, rgba(38, 59, 80, .96), rgba(23, 32, 42, .94)),
    url("/assets/fondo.jpg") center / cover;
  color: #fff;
  padding: 34px;
  border-radius: 8px;
}
.hero p { color: rgba(255,255,255,.78); line-height: 1.8; }
.hero-split {
  align-items: end;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) auto;
}
.hero-split h1 { margin: 12px 0 8px; }
.hero-metrics {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  min-width: 170px;
  padding: 18px;
}
.hero-metrics strong { color: #fff; font-size: 34px; line-height: 1; }
.hero-metrics span { color: rgba(255,255,255,.76); font-size: 13px; margin-bottom: 10px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(23, 32, 42, .04);
}
.card h2, .card h3 { color: var(--primary); margin-top: 0; }
.muted { color: var(--muted); line-height: 1.75; text-align: justify; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent); }
.btn-light { background: var(--secondary); color: var(--primary); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 700; color: var(--primary); }
.form input, .form textarea, .form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
}
.password-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
}
.password-wrap input {
  border-radius: 6px 0 0 6px;
}
.password-toggle {
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: var(--secondary);
  color: var(--primary);
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
}
.password-toggle:hover {
  background: var(--primary);
  color: #fff;
}
.login {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.login .card { width: min(440px, 100%); }
.not-found-card {
  text-align: center;
}
.not-found-card h1 {
  color: var(--primary);
  margin: 8px 0;
}
.not-found-card .btn {
  margin-top: 12px;
}
.not-found-code {
  color: var(--accent);
  display: block;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
}
.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.badge-accent { background: rgba(214, 74, 58, .18); color: #fff; }
.line-label {
  align-items: center;
  color: var(--accent);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.line-label::before {
  background: var(--accent);
  content: "";
  display: inline-block;
  height: 2px;
  width: 28px;
}
.instructor-card {
  border-top: 4px solid var(--accent);
  display: grid;
  gap: 10px;
}
.simple-list { display: grid; gap: 12px; }
.simple-item {
  align-items: center;
  background: rgba(237, 242, 247, .72);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: 48px minmax(0, 1fr);
  padding: 14px;
}
.simple-item h3 { margin: 0 0 4px; }
.simple-item p { color: var(--muted); margin: 0 0 6px; }
.assigned-users-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 430px;
  overflow-y: auto;
}
.assigned-user-row {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .9fr);
  padding: 12px 14px;
}
.assigned-user-row:nth-child(odd) { background: rgba(237, 242, 247, .68); }
.assigned-user-row:nth-child(even) { background: #fff; }
.assigned-user-row + .assigned-user-row { border-top: 1px solid var(--border); }
.assigned-user-row strong {
  color: var(--primary);
  font-size: 14px;
}
.assigned-user-row a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
  text-decoration: none;
}
.assigned-user-row a:hover { color: var(--accent); }
.avatar {
  background: var(--primary);
  border-radius: 8px;
  color: #fff;
  display: grid;
  font-size: 20px;
  font-weight: 900;
  height: 48px;
  place-items: center;
  width: 48px;
}
.instructor-card h2 { margin-bottom: 0; }
.mail-link {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.mail-link:hover { color: var(--accent); }
.preview-form {
  border-left: 4px solid var(--primary);
}
.section-heading {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-heading h2 { margin: 8px 0 0; }
.resource-list { display: grid; gap: 14px; }
.module-list { display: grid; gap: 14px; }
.module-item {
  align-items: start;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 18px;
}
.module-number {
  background: rgba(214, 74, 58, .12);
  border: 1px solid rgba(214, 74, 58, .24);
  border-radius: 8px;
  color: var(--accent);
  display: grid;
  font-weight: 900;
  height: 42px;
  place-items: center;
  width: 42px;
}
.module-item h3 { color: var(--primary); margin: 8px 0; }
.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.resource-row {
  align-items: center;
  background: rgba(237, 242, 247, .72);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 230px;
  padding: 18px;
}
.resource-row h3 {
  color: var(--primary);
  margin: 8px 0;
}
.resource-actions {
  align-items: stretch;
  display: grid;
  gap: 10px;
}
.course-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.course-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(23, 32, 42, .04);
  min-height: 320px;
  overflow: hidden;
  position: relative;
}
.course-card-link {
  color: inherit;
  display: grid;
  grid-template-rows: 180px minmax(0, 1fr);
  height: 100%;
  text-decoration: none;
}
.course-card img {
  height: 180px;
  object-fit: cover;
  width: 100%;
}
.course-default-img { opacity: .58; }
.course-card-link div { padding: 18px; }
.course-card .muted,
.clamp-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card h2 {
  color: var(--primary);
  margin: 10px 0 8px;
}
.course-edit,
.course-actions {
  background: #fff;
  border: 1px solid rgba(38, 59, 80, .24);
  box-shadow: 0 10px 24px rgba(23, 32, 42, .18);
}
.course-edit {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
}
.course-actions {
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
}
.course-actions .icon-btn {
  box-shadow: none;
}
.course-actions .course-edit {
  position: static;
}
.course-hero {
  background-position: center;
  background-size: cover;
}
.youtube-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 170px;
  object-fit: cover;
  width: 100%;
}
.file-pill {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
  display: inline-flex;
  gap: 8px;
}
.file-icon {
  background: var(--primary);
  border-radius: 4px 6px 4px 4px;
  display: inline-block;
  flex: 0 0 auto;
  height: 24px;
  position: relative;
  width: 19px;
}
.file-icon::before {
  border-left: 7px solid rgba(255, 255, 255, .68);
  border-top: 7px solid rgba(255, 255, 255, .92);
  content: "";
  position: absolute;
  right: 0;
  top: 0;
}
.file-icon::after {
  background: rgba(255, 255, 255, .82);
  border-radius: 999px;
  bottom: 5px;
  content: "";
  height: 3px;
  left: 4px;
  position: absolute;
  width: 11px;
}
.file-icon-pdf { background: #d64a3a; }
.file-icon-doc { background: #2f6fc2; }
.file-icon-xls { background: #2f8b57; }
.file-icon-ppt { background: #c85b2f; }
.file-icon-zip { background: #8a6f2d; }
.file-icon-default { background: #6b7280; }
.file-ext {
  background: rgba(38, 59, 80, .12);
  border-radius: 4px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  padding: 3px 5px;
}
.row-actions {
  display: inline-flex;
  gap: 8px;
}
.inline-form {
  display: inline-flex;
  margin: 0;
}
.inline-form .icon-btn {
  border: 1px solid rgba(38, 59, 80, .14);
}
.temario-card {
  border: 1px solid rgba(38, 59, 80, .16);
  box-shadow: 0 2px 10px rgba(23, 32, 42, .04);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.temario-card:hover {
  border-color: rgba(214, 74, 58, .42);
  box-shadow: 0 10px 26px rgba(23, 32, 42, .1);
  transform: translateY(-1px);
}
.temario-card.is-hidden {
  opacity: .48;
}
.temario-head {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}
.temario-head a {
  color: inherit;
  text-decoration: none;
}
.selected-files {
  display: grid;
  gap: 8px;
}
.selected-file {
  align-items: center;
  background: rgba(237, 242, 247, .82);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
}
.selected-file button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}
.attached-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  overflow: hidden;
}
.attached-list > strong {
  background: rgba(237, 242, 247, .82);
  color: var(--primary);
  padding: 10px 12px;
}
.attached-item {
  align-items: center;
  display: flex !important;
  gap: 12px !important;
  justify-content: space-between;
  padding: 10px 12px;
}
.attached-item + .attached-item {
  border-top: 1px solid var(--border);
}
.attached-item span {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}
.locked { opacity: .52; filter: grayscale(1); }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 12px; text-align: left; vertical-align: top; }
.table th { color: var(--primary); font-size: 13px; text-transform: uppercase; }
.data-card { padding: 0; overflow: hidden; }
.table-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 10px;
}
.table-header h2 { margin-bottom: 4px; }
.table-header .muted { margin: 0; }
.table-filters {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr) 180px 180px;
  padding: 0 22px 16px;
}
.table-filters input,
.table-filters select,
[data-assign-search] {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  padding: 11px 12px;
}
.table-wrap { overflow-x: auto; }
.crm-table {
  background: transparent;
  min-width: 980px;
}
.crm-table th {
  background: rgba(237, 242, 247, .78);
  position: sticky;
  top: 0;
}
.crm-table td { background: rgba(255,255,255,.72); }
.assign-table {
  min-width: 760px;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pagination button {
  background: var(--secondary);
  border: 0;
  border-radius: 6px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 11px;
}
.pagination button.active {
  background: var(--primary);
  color: #fff;
}
.user-cell {
  align-items: center;
  display: flex;
  gap: 10px;
}
.avatar.small {
  border-radius: 6px;
  font-size: 14px;
  height: 32px;
  width: 32px;
}
.role-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 10px;
  text-transform: capitalize;
}
.role-cliente,
.role-capacitor,
.role-administrador { background: rgba(38, 59, 80, .12); color: #263b50; }
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 10px;
}
.status-activo { background: #e8f7ed; color: #17613a; }
.status-deshabilitado { background: #fdeceb; color: #9f2d24; }
.icon-btn {
  align-items: center;
  background: rgba(38, 59, 80, .08);
  border: 1px solid rgba(38, 59, 80, .14);
  border-radius: 6px;
  color: var(--primary);
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  text-decoration: none;
  width: 34px;
}
.icon-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.modal-overlay {
  align-items: center;
  background: rgba(23, 32, 42, .68);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 80;
}
.modal-overlay:target { display: flex; }
.modal-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 42, .28);
  max-height: min(720px, 90vh);
  overflow-y: auto;
  padding: 22px;
  width: min(560px, 100%);
}
.modal-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 0 0 14px;
  position: sticky;
  top: -22px;
  z-index: 2;
}
.modal-header h2 {
  color: var(--primary);
  margin: 0;
}
.modal-close {
  color: var(--muted);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.modal-close:hover { color: var(--accent); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.check-row {
  align-items: center;
  background: rgba(237, 242, 247, .72);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  padding: 11px 12px;
}
.check-row input {
  height: 16px;
  width: 16px;
}
.flash { margin: 18px auto 0; max-width: 1180px; padding: 12px 16px; border-radius: 6px; font-weight: 700; }
.flash.success { background: #e8f7ed; color: #17613a; }
.flash.error { background: #fdeceb; color: #9f2d24; }
.video { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: 8px; background: #000; }
.footer {
  margin-top: 32px;
  padding: 28px 20px;
  background: rgba(23, 32, 42, .96);
  color: rgba(255,255,255,.76);
}
.footer-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  max-width: 1180px;
}
.footer-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  max-width: 660px;
}
.footer-brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.footer strong {
  color: #fff;
  display: block;
  margin-bottom: 4px;
}
.footer p {
  margin: 0;
  line-height: 1.6;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}
.footer-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
}
.footer-nav a:hover {
  color: var(--accent);
}
.footer-copy {
  border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  font-size: 12px;
  margin: 32px auto 0 !important;
  max-width: 1180px;
  padding-top: 20px;
  text-align: center;
}
@media (max-width: 820px) {
  .grid-2, .grid-3, .stats-strip, .course-grid { grid-template-columns: 1fr; }
  .table-filters { grid-template-columns: 1fr; }
  .academic-shell, .hero-split, .resource-row { grid-template-columns: 1fr; }
  .assigned-user-row { grid-template-columns: 1fr; }
  .assigned-user-row a { text-align: left; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; width: 100%; }
  .course-sidebar { position: static; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand img { width: 190px; }
  .footer-inner, .footer-brand, .footer-nav { align-items: flex-start; flex-direction: column; }
}
