/* =====================================================================
   MHT Activity Hub · Identidad visual Master Hub Training
   Colores tomados del logotipo oficial:
     Azul marino  #1E2744   (anillos y "Hub")
     Azul cielo   #5DAFE1   (conectores y círculos)
     Gris grafito #5A5B5F   ("Master" y "Training")
   Tipografías: Futura (títulos), Gotham (interfaz), Avenir (texto),
                Raleway Italic (acentos)
   ===================================================================== */

/* ---------- Fuentes ---------- */
@font-face { font-family: "Futura MHT"; src: url("../fonts/futura-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Futura MHT"; src: url("../fonts/futura-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Gotham MHT"; src: url("../fonts/gotham-book.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gotham MHT"; src: url("../fonts/gotham-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Avenir MHT"; src: url("../fonts/avenir-roman.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Avenir MHT"; src: url("../fonts/avenir-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Avenir MHT"; src: url("../fonts/avenir-heavy.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Raleway MHT"; src: url("../fonts/raleway-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --mht-navy: #1E2744;
  --mht-navy-2: #2A3560;
  --mht-navy-3: #151C33;
  --mht-sky: #5DAFE1;
  --mht-sky-2: #3D97D0;
  --mht-sky-soft: #E8F4FC;
  --mht-ice: #EEF9FD;
  --mht-graphite: #5A5B5F;
  --mht-mist: #DADEE8;
  --mht-bg: #F4F7FB;
  --mht-card: #FFFFFF;
  --mht-text: #1E2744;
  --mht-muted: #6B7287;
  --mht-border: #E2E7F0;
  --mht-success: #1F9D6B;
  --mht-danger: #D64550;
  --mht-warning: #E8A23A;
  --mht-radius: 16px;
  --mht-radius-sm: 10px;
  --mht-shadow: 0 1px 2px rgba(30, 39, 68, .06), 0 8px 24px rgba(30, 39, 68, .06);
  --mht-shadow-lg: 0 12px 40px rgba(30, 39, 68, .14);
  --font-display: "Futura MHT", "Futura", "Century Gothic", "Trebuchet MS", sans-serif;
  --font-ui: "Gotham MHT", "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Avenir MHT", "Avenir", "Nunito Sans", "Segoe UI", Arial, sans-serif;
  --font-accent: "Raleway MHT", "Raleway", Georgia, serif;

  /* Bootstrap overrides */
  --bs-primary: #1E2744;
  --bs-primary-rgb: 30, 39, 68;
  --bs-info: #5DAFE1;
  --bs-info-rgb: 93, 175, 225;
  --bs-success: #1F9D6B;
  --bs-success-rgb: 31, 157, 107;
  --bs-danger: #D64550;
  --bs-danger-rgb: 214, 69, 80;
  --bs-warning: #E8A23A;
  --bs-warning-rgb: 232, 162, 58;
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--mht-text);
  --bs-body-bg: var(--mht-bg);
  --bs-border-color: var(--mht-border);
  --bs-link-color: #2C7FB8;
  --bs-link-color-rgb: 44, 127, 184;
  --bs-link-hover-color: var(--mht-navy);
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 14px;
}

html, body { min-height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--mht-bg);
  color: var(--mht-text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display-font { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; color: var(--mht-navy); }
h4, h5, h6, .ui-font, .btn, .nav, .badge, .form-label, th, .table thead { font-family: var(--font-ui); }
h4, h5, h6 { font-weight: 700; color: var(--mht-navy); }
.accent-font { font-family: var(--font-accent); font-style: italic; }
.text-sky { color: var(--mht-sky-2) !important; }
.text-navy { color: var(--mht-navy) !important; }
.text-graphite { color: var(--mht-graphite) !important; }
.bg-navy { background: var(--mht-navy) !important; color: #fff; }
.bg-sky-soft { background: var(--mht-sky-soft) !important; }
.small-label { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mht-muted); }

/* ---------- Botones ---------- */
.btn { border-radius: 10px; font-weight: 700; font-size: .9rem; letter-spacing: .01em; padding: .55rem 1rem; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; border-radius: 12px; }
.btn-primary { --bs-btn-bg: var(--mht-navy); --bs-btn-border-color: var(--mht-navy); --bs-btn-hover-bg: var(--mht-navy-2); --bs-btn-hover-border-color: var(--mht-navy-2); --bs-btn-active-bg: var(--mht-navy-3); --bs-btn-disabled-bg: var(--mht-navy); --bs-btn-disabled-border-color: var(--mht-navy); }
.btn-sky { --bs-btn-color: #fff; --bs-btn-bg: var(--mht-sky-2); --bs-btn-border-color: var(--mht-sky-2); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #2C86BF; --bs-btn-hover-border-color: #2C86BF; --bs-btn-active-bg: #23709F; --bs-btn-active-color: #fff; }
.btn-outline-primary { --bs-btn-color: var(--mht-navy); --bs-btn-border-color: #C4CBDB; --bs-btn-hover-bg: var(--mht-navy); --bs-btn-hover-border-color: var(--mht-navy); --bs-btn-active-bg: var(--mht-navy); }
.btn-soft { background: var(--mht-sky-soft); color: var(--mht-navy); border: 1px solid transparent; }
.btn-soft:hover { background: #D5EBF9; color: var(--mht-navy); }
.btn-assign { background: linear-gradient(135deg, var(--mht-sky-2), var(--mht-sky)); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(61, 151, 208, .35); }
.btn-assign:hover { color: #fff; filter: brightness(1.05); transform: translateY(-1px); }
.btn:focus-visible, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 .2rem rgba(93, 175, 225, .35); border-color: var(--mht-sky); }

/* ---------- Formularios ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #D3DAE6; padding: .55rem .8rem; }
.form-label { font-size: .8rem; font-weight: 700; color: var(--mht-navy); margin-bottom: .3rem; }
.form-text { font-size: .78rem; }
.form-check-input:checked { background-color: var(--mht-sky-2); border-color: var(--mht-sky-2); }
.form-switch { padding-left: 3.1em; }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-left: -3.1em; margin-top: .1em; }

/* ---------- Tarjetas ---------- */
.card { border: 1px solid var(--mht-border); border-radius: var(--mht-radius); box-shadow: var(--mht-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--mht-border); font-family: var(--font-ui); font-weight: 700; padding: 1rem 1.25rem; }
.card-body { padding: 1.25rem; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; border-color: var(--mht-border); }
.table thead th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mht-muted); font-weight: 700; background: #F8FAFD; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { background: #F6FAFE; }
.badge { font-weight: 700; letter-spacing: .02em; }
.badge-status { font-size: .72rem; padding: .4em .7em; }
.badge-lang { background: var(--mht-navy); color: #fff; font-size: .68rem; }
.badge-level { background: var(--mht-sky-soft); color: var(--mht-navy); font-size: .68rem; }
.alert { border-radius: 12px; border: 0; }
.alert-info { background: var(--mht-sky-soft); color: var(--mht-navy); }
.modal-content { border-radius: 18px; border: 0; box-shadow: var(--mht-shadow-lg); }
.modal-header { border-bottom-color: var(--mht-border); }
.modal-footer { border-top-color: var(--mht-border); }
.dropdown-menu { border-radius: 12px; border-color: var(--mht-border); box-shadow: var(--mht-shadow-lg); font-size: .9rem; }
.dropdown-item { padding: .5rem 1rem; }
.dropdown-item i { width: 1.4rem; display: inline-block; color: var(--mht-muted); }
.nav-pills .nav-link { color: var(--mht-navy); font-weight: 700; font-size: .88rem; border-radius: 10px; }
.nav-pills .nav-link.active { background: var(--mht-navy); }
.nav-tabs .nav-link { font-weight: 700; color: var(--mht-muted); border: 0; border-bottom: 3px solid transparent; }
.nav-tabs .nav-link.active { color: var(--mht-navy); border-bottom-color: var(--mht-sky); background: transparent; }
.progress { border-radius: 99px; background: var(--mht-mist); }
.progress-bar { background: var(--mht-sky-2); }

/* =====================================================================
   PANEL ADMINISTRADOR
   ===================================================================== */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 262px; flex-shrink: 0; background: var(--mht-navy); color: #fff;
  position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column;
  background-image: radial-gradient(circle at 120% 105%, rgba(93, 175, 225, .25) 0, transparent 45%);
  transition: transform .25s ease;
}
.sidebar-brand { padding: 1.4rem 1.3rem 1rem; display: flex; flex-direction: column; gap: .35rem; }
.sidebar-brand img { width: 100%; max-width: 200px; height: auto; }
.sidebar-brand .app-name { font-family: var(--font-display); font-weight: 700; font-size: .95rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mht-sky); padding-left: .2rem; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .5rem .8rem 1rem; }
.sidebar .nav-section { font-family: var(--font-ui); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 1rem .8rem .4rem; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: .8rem; padding: .62rem .85rem; margin-bottom: 2px; border-radius: 10px;
  color: rgba(255,255,255,.82); text-decoration: none; font-family: var(--font-ui); font-size: .88rem; font-weight: 400;
}
.sidebar a.nav-item i { font-size: 1.1rem; width: 1.25rem; text-align: center; color: rgba(255,255,255,.6); }
.sidebar a.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav-item.active { background: var(--mht-sky); color: var(--mht-navy); font-weight: 700; box-shadow: 0 6px 18px rgba(93,175,225,.3); }
.sidebar a.nav-item.active i { color: var(--mht-navy); }
.sidebar a.nav-item.cta { background: rgba(93,175,225,.14); color: #fff; border: 1px dashed rgba(93,175,225,.55); }
.sidebar a.nav-item.cta.active { background: var(--mht-sky); color: var(--mht-navy); border-style: solid; }
.sidebar-foot { padding: 1rem 1.3rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: rgba(255,255,255,.6); }
.sidebar-foot .accent-font { color: var(--mht-sky); }

.admin-main { flex: 1; margin-left: 262px; min-width: 0; position: relative; }
.admin-main::before {
  content: ""; position: fixed; right: -60px; bottom: -40px; width: 420px; height: 540px;
  background: url("../img/imagotipo.jpg") no-repeat center / contain; mix-blend-mode: multiply;
  opacity: .55; pointer-events: none; z-index: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 1030; background: rgba(244, 247, 251, .88); backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 1rem; padding: .8rem 1.8rem; border-bottom: 1px solid var(--mht-border);
}
.topbar .search { max-width: 380px; flex: 1; position: relative; }
.topbar .search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--mht-muted); }
.topbar .search input { padding-left: 2.3rem; background: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mht-navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-weight: 700; font-size: .85rem; }
.avatar.sky { background: var(--mht-sky); color: var(--mht-navy); }
.content { padding: 1.8rem; position: relative; z-index: 1; max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.85rem; margin: 0; }
.page-head .lead-sub { color: var(--mht-muted); margin: .2rem 0 0; font-size: .95rem; }
.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--mht-shadow-lg); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 1.1rem; }
  .topbar { padding: .7rem 1rem; }
  .sidebar-backdrop.show { position: fixed; inset: 0; background: rgba(21, 28, 51, .45); z-index: 1035; }
}

/* ---------- Estadísticas ---------- */
.stat-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-icon.navy { background: var(--mht-navy); color: #fff; }
.stat-icon.sky { background: var(--mht-sky-soft); color: var(--mht-sky-2); }
.stat-icon.green { background: #E3F5EE; color: var(--mht-success); }
.stat-icon.amber { background: #FDF1DF; color: #B97814; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--mht-navy); }
.stat-label { font-family: var(--font-ui); font-size: .76rem; color: var(--mht-muted); margin-top: .25rem; }

.welcome-card {
  background: var(--mht-navy); color: #fff; border: 0; overflow: hidden; position: relative;
  background-image: radial-gradient(circle at 95% 20%, rgba(93,175,225,.35) 0, transparent 40%);
}
.welcome-card h2 { color: #fff; }
.welcome-card .iso { position: absolute; right: -30px; bottom: -40px; width: 230px; opacity: .18; }
.flow-steps { display: flex; flex-wrap: wrap; gap: .5rem; }
.flow-step { display: inline-flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff; padding: .4rem .75rem; border-radius: 99px; font-family: var(--font-ui); font-size: .78rem; text-decoration: none; }
.flow-step:hover { background: rgba(93,175,225,.25); color: #fff; }
.flow-step .n { width: 20px; height: 20px; border-radius: 50%; background: var(--mht-sky); color: var(--mht-navy); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; }

/* ---------- Tarjetas de actividad ---------- */
.activity-card { overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; height: 100%; display: flex; flex-direction: column; }
.activity-card:hover { transform: translateY(-3px); box-shadow: var(--mht-shadow-lg); }
.activity-thumb {
  height: 112px; display: flex; align-items: center; justify-content: center; position: relative; color: #fff;
  background: var(--thumb, var(--mht-navy)); overflow: hidden;
}
.activity-thumb::after {
  content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 22px solid rgba(255,255,255,.12);
  right: -45px; top: -45px;
}
.activity-thumb::before {
  content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; background: rgba(93,175,225,.35);
  left: -18px; bottom: -22px;
}
.activity-thumb i { font-size: 2.6rem; position: relative; z-index: 1; }
.activity-thumb .type-chip { position: absolute; left: .8rem; top: .7rem; z-index: 1; background: rgba(255,255,255,.18); padding: .2rem .55rem; border-radius: 99px; font-family: var(--font-ui); font-size: .68rem; font-weight: 700; backdrop-filter: blur(4px); }
.activity-thumb .archived-chip { position: absolute; right: .8rem; top: .7rem; z-index: 1; background: var(--mht-warning); color: #fff; padding: .15rem .5rem; border-radius: 99px; font-size: .66rem; font-weight: 700; font-family: var(--font-ui); }
.activity-card .card-body { flex: 1; display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem; }
.activity-card .title { font-family: var(--font-ui); font-weight: 700; font-size: .98rem; color: var(--mht-navy); text-decoration: none; line-height: 1.3; }
.activity-card .title:hover { color: var(--mht-sky-2); }
.activity-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .78rem; color: var(--mht-muted); }
.activity-meta i { margin-right: .2rem; }
.activity-card .card-footer { background: #FAFCFE; border-top: 1px solid var(--mht-border); display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 1rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--mht-border); background: #fff; color: var(--mht-navy); }
.icon-btn:hover { background: var(--mht-sky-soft); border-color: var(--mht-sky); }

.folder-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 10px; background: #fff; border: 1px solid var(--mht-border); color: var(--mht-navy); text-decoration: none; font-family: var(--font-ui); font-size: .82rem; }
.folder-chip i { color: var(--fc, var(--mht-sky)); }
.folder-chip.active, .folder-chip:hover { border-color: var(--mht-sky); background: var(--mht-sky-soft); color: var(--mht-navy); }

/* ---------- Selector de plantilla ---------- */
.tpl-card {
  display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; border-radius: 14px; border: 2px solid var(--mht-border);
  background: #fff; cursor: pointer; height: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; text-align: left; width: 100%;
}
.tpl-card:hover { border-color: var(--mht-sky); transform: translateY(-2px); }
.tpl-card.selected { border-color: var(--mht-navy); box-shadow: 0 0 0 4px rgba(93,175,225,.25); }
.tpl-card .tpl-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--tc, var(--mht-navy)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.tpl-card h6 { margin: 0 0 .2rem; font-size: .92rem; }
.tpl-card p { margin: 0; font-size: .78rem; color: var(--mht-muted); line-height: 1.35; }
.tpl-card.soon { opacity: .55; cursor: not-allowed; border-style: dashed; }
.tpl-card.soon .tpl-icon { background: var(--mht-mist); color: var(--mht-graphite); }

.mode-switch { display: inline-flex; background: #fff; border: 1px solid var(--mht-border); border-radius: 12px; padding: 4px; gap: 4px; }
.mode-switch button { border: 0; background: transparent; padding: .55rem 1rem; border-radius: 9px; font-family: var(--font-ui); font-weight: 700; font-size: .85rem; color: var(--mht-muted); }
.mode-switch button.active { background: var(--mht-navy); color: #fff; }

.paste-area {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.55; min-height: 320px;
  background: #FBFDFF; border: 2px dashed #BFD9EE; border-radius: 14px; padding: 1rem; resize: vertical;
}
.paste-area:focus { border-style: solid; background: #fff; }
.example-box { background: var(--mht-navy); color: #DCE8F5; border-radius: 14px; padding: 1rem 1.1rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; white-space: pre-wrap; max-height: 300px; overflow: auto; }
.example-box .hl { color: var(--mht-sky); font-weight: 700; }
.preview-list { display: flex; flex-direction: column; gap: .6rem; }
.preview-item { background: #fff; border: 1px solid var(--mht-border); border-left: 4px solid var(--mht-sky); border-radius: 12px; padding: .8rem 1rem; }
.preview-item .num { font-family: var(--font-ui); font-size: .7rem; font-weight: 700; color: var(--mht-sky-2); text-transform: uppercase; letter-spacing: .06em; }
.preview-item .opt { display: inline-block; padding: .15rem .55rem; border-radius: 8px; background: #F1F4F9; margin: .15rem .2rem 0 0; font-size: .85rem; }
.preview-item .opt.ok { background: #E3F5EE; color: #146B4A; font-weight: 700; }
.blank-pill { display: inline-block; padding: 0 .45rem; border-radius: 6px; background: var(--mht-sky-soft); color: var(--mht-navy); font-weight: 700; border: 1px dashed var(--mht-sky); }

/* Editor manual */
.editor-item { background: #fff; border: 1px solid var(--mht-border); border-radius: 14px; padding: 1rem; position: relative; }
.editor-item + .editor-item { margin-top: .8rem; }
.editor-item .handle { font-family: var(--font-ui); font-weight: 700; color: var(--mht-sky-2); font-size: .78rem; }
.editor-item .remove-item { position: absolute; top: .6rem; right: .6rem; }
.media-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 99px; background: var(--mht-sky-soft); color: var(--mht-navy); font-size: .75rem; font-family: var(--font-ui); }
.media-pill img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }

/* =====================================================================
   LOGIN / PORTAL
   ===================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-brand {
  position: relative; overflow: hidden; background: var(--mht-navy); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background-image: radial-gradient(circle at 85% 15%, rgba(93,175,225,.28) 0, transparent 42%), radial-gradient(circle at 10% 95%, rgba(93,175,225,.18) 0, transparent 40%);
}
.auth-brand .iso-bg { position: absolute; right: -90px; bottom: -80px; width: 520px; opacity: .12; }
.auth-brand .logo { width: 240px; }
.auth-brand h1 { color: #fff; font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.08; margin: 0; }
.auth-brand h1 span { color: var(--mht-sky); }
.auth-brand .tagline { font-family: var(--font-accent); font-style: italic; font-size: 1.2rem; color: #CFE4F5; }
.auth-brand .langs { display: flex; gap: .5rem; }
.auth-brand .langs span { border: 1px solid rgba(255,255,255,.25); border-radius: 99px; padding: .3rem .8rem; font-family: var(--font-ui); font-size: .78rem; font-weight: 700; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; position: relative; }
.auth-form::after { content: ""; position: absolute; inset: auto 0 0 auto; width: 260px; height: 330px; background: url("../img/imagotipo.jpg") no-repeat right bottom / contain; opacity: .7; pointer-events: none; mix-blend-mode: multiply; }
.auth-box { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-box .logo-mobile { display: none; width: 210px; margin-bottom: 1.5rem; }
.auth-box h2 { font-size: 1.7rem; }
.code-input { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .35em; text-align: center; text-transform: uppercase; font-weight: 700; }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-box .logo-mobile { display: block; }
}

/* =====================================================================
   VISTA DEL ALUMNO
   ===================================================================== */
.student-top { background: var(--mht-navy); color: #fff; padding: .7rem 0; position: sticky; top: 0; z-index: 1030; }
.student-top .logo { height: 40px; }
.student-top a { color: #fff; text-decoration: none; }
.student-top .nav-link { color: rgba(255,255,255,.8); font-family: var(--font-ui); font-size: .85rem; }
.student-top .nav-link.active, .student-top .nav-link:hover { color: var(--mht-sky); }
.student-wrap { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 4rem; position: relative; }
.student-body { background: var(--mht-bg); min-height: 100vh; position: relative; }
.student-body::before { content: ""; position: fixed; left: -80px; bottom: -60px; width: 380px; height: 480px; background: url("../img/imagotipo.jpg") no-repeat left bottom / contain; opacity: .55; pointer-events: none; mix-blend-mode: multiply; z-index: 0; }
.student-wrap > * { position: relative; z-index: 1; }
.task-card { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; }
.task-card .tpl-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--tc, var(--mht-navy)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.task-card h5 { font-size: 1rem; margin: 0 0 .2rem; }

/* Reproductor de actividad */
.play-shell { min-height: 100vh; background: var(--mht-bg); display: flex; flex-direction: column; }
.play-bar { background: #fff; border-bottom: 1px solid var(--mht-border); padding: .6rem 1rem; display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 20; }
.play-bar .iso { width: 34px; height: 34px; }
.play-bar .title { font-family: var(--font-ui); font-weight: 700; font-size: .92rem; color: var(--mht-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.play-timer { font-family: var(--font-display); font-weight: 700; color: var(--mht-navy); background: var(--mht-sky-soft); border-radius: 99px; padding: .25rem .8rem; font-size: .95rem; }
.play-timer.warn { background: #FDE8EA; color: var(--mht-danger); }
.play-progress { height: 6px; border-radius: 0; background: var(--mht-mist); }
.play-main { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
.play-intro { text-align: center; padding: 2rem 1.2rem; }
.play-intro .iso { width: 92px; margin-bottom: 1rem; }
.play-intro h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.intro-facts { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1.2rem 0; }
.intro-facts span { background: #fff; border: 1px solid var(--mht-border); border-radius: 99px; padding: .4rem .9rem; font-family: var(--font-ui); font-size: .8rem; color: var(--mht-navy); }
.intro-facts i { color: var(--mht-sky-2); margin-right: .3rem; }
.instructions-box { background: #fff; border-left: 4px solid var(--mht-sky); border-radius: 12px; padding: 1rem 1.2rem; text-align: left; margin: 1rem auto; max-width: 620px; white-space: pre-line; }
.btn-start { font-size: 1.1rem; padding: .9rem 2.2rem; border-radius: 14px; }

.q-card { background: #fff; border-radius: 20px; box-shadow: var(--mht-shadow); border: 1px solid var(--mht-border); padding: 1.6rem; }
.q-count { font-family: var(--font-ui); font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mht-sky-2); }
.q-text { font-family: var(--font-ui); font-weight: 700; font-size: clamp(1.15rem, 3vw, 1.5rem); color: var(--mht-navy); line-height: 1.35; margin: .4rem 0 1.2rem; }
.q-image { max-width: 100%; max-height: 300px; border-radius: 14px; display: block; margin: 0 auto 1.2rem; object-fit: contain; background: #F4F7FB; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.choice {
  display: flex; align-items: center; gap: .8rem; padding: .95rem 1rem; border-radius: 14px; border: 2px solid var(--mht-border); background: #fff;
  font-family: var(--font-ui); font-size: 1rem; color: var(--mht-navy); text-align: left; cursor: pointer; transition: all .12s ease; width: 100%;
}
.choice .key { width: 32px; height: 32px; border-radius: 9px; background: var(--mht-sky-soft); color: var(--mht-navy); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .85rem; }
.choice:hover { border-color: var(--mht-sky); background: #FAFDFF; }
.choice.selected { border-color: var(--mht-navy); background: var(--mht-navy); color: #fff; }
.choice.selected .key { background: var(--mht-sky); color: var(--mht-navy); }
.choice.correct { border-color: var(--mht-success); background: #E3F5EE; color: #145C41; }
.choice.wrong { border-color: var(--mht-danger); background: #FDE8EA; color: #8E2630; }
.tf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.tf-grid .choice { justify-content: center; font-size: 1.15rem; padding: 1.3rem; }
.tf-grid .choice i { font-size: 1.4rem; }

.fill-sentence { font-family: var(--font-ui); font-size: clamp(1.05rem, 2.6vw, 1.3rem); line-height: 2.3; color: var(--mht-navy); }
.fill-sentence select, .fill-sentence input { display: inline-block; width: auto; min-width: 120px; vertical-align: baseline; border: 2px solid var(--mht-sky); border-radius: 10px; padding: .15rem .5rem; font-weight: 700; color: var(--mht-navy); background: var(--mht-sky-soft); font-size: inherit; line-height: 1.4; }
.fill-sentence input:focus, .fill-sentence select:focus { outline: none; border-color: var(--mht-navy); background: #fff; }
.write-input { font-size: 1.15rem; padding: .85rem 1rem; border-width: 2px; }

/* Arrastrar y soltar */
.token-bank, .token-line { display: flex; flex-wrap: wrap; gap: .5rem; min-height: 62px; padding: .7rem; border-radius: 14px; }
.token-bank { background: #F1F5FA; }
.token-line { background: #fff; border: 2px dashed #BFD9EE; }
.token-line.drop-hover, .group-drop.drop-hover { border-color: var(--mht-navy); background: var(--mht-sky-soft); }
.token {
  padding: .55rem .9rem; border-radius: 10px; background: #fff; border: 2px solid var(--mht-border); font-family: var(--font-ui); font-weight: 700;
  color: var(--mht-navy); cursor: grab; user-select: none; touch-action: none; box-shadow: 0 2px 0 var(--mht-mist); font-size: .98rem;
}
.token:active { cursor: grabbing; }
.token.placed { background: var(--mht-navy); color: #fff; border-color: var(--mht-navy); box-shadow: 0 2px 0 var(--mht-navy-3); }
.token.dragging { opacity: .4; }
.token.ghost { position: fixed; pointer-events: none; z-index: 9999; opacity: .95; transform: rotate(-2deg) scale(1.05); box-shadow: var(--mht-shadow-lg); }
.groups-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin-top: 1rem; }
.group-drop { border: 2px dashed #BFD9EE; border-radius: 16px; background: #fff; min-height: 150px; display: flex; flex-direction: column; }
.group-drop h6 { margin: 0; padding: .7rem .9rem; background: var(--mht-navy); color: #fff; border-radius: 13px 13px 0 0; font-size: .9rem; text-align: center; }
.group-drop .zone { flex: 1; display: flex; flex-wrap: wrap; gap: .4rem; padding: .7rem; align-content: flex-start; }
.seq-list { display: flex; flex-direction: column; gap: .5rem; }
.seq-item { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border-radius: 12px; background: #fff; border: 2px solid var(--mht-border); font-family: var(--font-ui); color: var(--mht-navy); touch-action: none; user-select: none; cursor: grab; }
.seq-item .n { width: 28px; height: 28px; border-radius: 8px; background: var(--mht-navy); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.seq-item .arrows { margin-left: auto; display: flex; gap: .25rem; }
.seq-item .arrows button { border: 0; background: var(--mht-sky-soft); color: var(--mht-navy); width: 32px; height: 32px; border-radius: 8px; }
.seq-item.dragging { opacity: .5; border-style: dashed; }

/* Relacionar */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1rem; }
.match-left, .match-right { display: flex; flex-direction: column; gap: .6rem; }
.match-card { padding: .8rem .9rem; border-radius: 12px; border: 2px solid var(--mht-border); background: #fff; font-family: var(--font-ui); font-weight: 700; color: var(--mht-navy); cursor: pointer; display: flex; align-items: center; gap: .6rem; min-height: 56px; text-align: left; width: 100%; }
.match-card img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }
.match-card:hover { border-color: var(--mht-sky); }
.match-card.active { border-color: var(--mht-navy); box-shadow: 0 0 0 3px rgba(93,175,225,.35); }
.match-card.paired { background: var(--pc, var(--mht-sky-soft)); border-color: var(--pb, var(--mht-sky)); }
.match-card .pair-n { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; background: var(--pb, var(--mht-navy)); color: #fff; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }

/* Flashcards */
.flashcard { perspective: 1200px; width: 100%; max-width: 460px; height: 280px; margin: 0 auto 1.2rem; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.3,.7,.3,1); transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 4vw, 2rem); }
.flashcard-face.front { background: var(--mht-navy); color: #fff; background-image: radial-gradient(circle at 90% 10%, rgba(93,175,225,.35) 0, transparent 45%); }
.flashcard-face.back { background: #fff; color: var(--mht-navy); border: 3px solid var(--mht-sky); transform: rotateY(180deg); }
.flashcard-face small { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; opacity: .65; margin-top: 1rem; font-weight: 400; }
.flashcard-face img { max-height: 150px; max-width: 90%; border-radius: 12px; margin-bottom: .6rem; }

/* Reproductor de audio */
.mht-audio { display: flex; align-items: center; gap: .6rem; background: var(--mht-navy); color: #fff; border-radius: 14px; padding: .55rem .7rem; margin-bottom: 1rem; flex-wrap: wrap; }
.mht-audio.small { background: var(--mht-sky-soft); color: var(--mht-navy); padding: .4rem .55rem; display: inline-flex; }
.mht-audio button { border: 0; background: rgba(255,255,255,.12); color: inherit; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.mht-audio.small button { background: #fff; width: 32px; height: 32px; font-size: 1rem; }
.mht-audio .play-btn { background: var(--mht-sky); color: var(--mht-navy); }
.mht-audio.small .play-btn { background: var(--mht-navy); color: #fff; }
.mht-audio .track { flex: 1; min-width: 100px; height: 6px; background: rgba(255,255,255,.2); border-radius: 99px; position: relative; cursor: pointer; }
.mht-audio.small .track { background: #C9DDEC; min-width: 80px; }
.mht-audio .track .fill { position: absolute; inset: 0 auto 0 0; background: var(--mht-sky); border-radius: 99px; width: 0; }
.mht-audio.small .track .fill { background: var(--mht-navy); }
.mht-audio .time { font-family: var(--font-ui); font-size: .75rem; min-width: 76px; text-align: center; opacity: .85; }
.mht-audio .speed { display: inline-flex; gap: 2px; background: rgba(255,255,255,.1); border-radius: 8px; padding: 2px; }
.mht-audio.small .speed { background: #fff; }
.mht-audio .speed button { width: auto; height: 28px; padding: 0 .45rem; font-size: .72rem; font-family: var(--font-ui); font-weight: 700; background: transparent; }
.mht-audio .speed button.on { background: var(--mht-sky); color: var(--mht-navy); }
.mht-audio .plays-left { font-family: var(--font-ui); font-size: .7rem; opacity: .8; }
.mht-audio.locked { opacity: .55; }

.play-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--mht-border); padding: .7rem 1rem; display: flex; justify-content: center; gap: .6rem; z-index: 20; }
.play-nav .inner { width: 100%; max-width: 820px; display: flex; justify-content: space-between; gap: .6rem; align-items: center; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--mht-mist); cursor: pointer; }
.dots span.done { background: var(--mht-sky); }
.dots span.cur { background: var(--mht-navy); transform: scale(1.3); }

/* Resultado final */
.score-ring { --p: 0; width: 170px; height: 170px; border-radius: 50%; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--ring, var(--mht-sky-2)) calc(var(--p) * 1%), var(--mht-mist) 0); }
.score-ring .inner { width: 136px; height: 136px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .pct { font-family: var(--font-display); font-weight: 700; font-size: 2.3rem; color: var(--mht-navy); line-height: 1; }
.review-row { border-radius: 12px; padding: .8rem 1rem; background: #fff; border: 1px solid var(--mht-border); border-left: 4px solid var(--mht-success); }
.review-row.bad { border-left-color: var(--mht-danger); }
.review-row + .review-row { margin-top: .5rem; }
.leaderboard li { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--mht-border); }
.leaderboard .pos { width: 28px; height: 28px; border-radius: 50%; background: var(--mht-sky-soft); color: var(--mht-navy); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-family: var(--font-ui); }
.leaderboard li:nth-child(1) .pos { background: #F5C451; }
.leaderboard li:nth-child(2) .pos { background: #CFD6E2; }
.leaderboard li:nth-child(3) .pos { background: #E3A774; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--mht-muted); }
.empty-state img { width: 110px; opacity: .9; margin-bottom: 1rem; }
.empty-state h5 { color: var(--mht-navy); }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.copy-field { display: flex; gap: .4rem; }
.copy-field input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: #F8FAFD; }
.code-badge { font-family: var(--font-display); font-weight: 700; letter-spacing: .18em; background: var(--mht-navy); color: #fff; padding: .3rem .7rem; border-radius: 8px; }

@media (max-width: 575.98px) {
  .q-card { padding: 1.1rem; border-radius: 16px; }
  .match-grid { gap: .5rem; }
  .match-card { padding: .6rem; font-size: .88rem; }
  .tf-grid .choice { padding: 1rem; }
  .page-head h1 { font-size: 1.5rem; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .admin-main { margin: 0; }
  .admin-main::before { display: none; }
}

/* ---------- Utilidades compartidas ---------- */
.min-w-0 { min-width: 0; }
.tpl-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--tc, var(--mht-navy)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
td .tpl-icon, .list-group-item .tpl-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 1.05rem; }
.preview-item .opt { color: var(--mht-navy); }
