:root {
  --geinstal-verde: #66bc29;
  --geinstal-azul: #002942;
  --geinstal-negro: #000000;
  --geinstal-blanco: #F5F5F5;
  --gris-texto: #333333;
  --gris-claro: #e2e6e9;
  --rojo-error: #c0392b;
  --font-family: "Aptos", "Calibri", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-family);
  background: var(--geinstal-blanco);
  color: var(--gris-texto);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--geinstal-azul);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: block;
  height: 30px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text small {
  font-size: 11.5px;
  color: var(--geinstal-verde);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.user-box.hidden { display: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

.btn-ghost:hover { background: rgba(255,255,255,0.1); }

.view.wide { max-width: 1000px; }

.view {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.footer {
  text-align: center;
  font-size: 11px;
  color: #7a7a7a;
  padding: 16px;
}

/* --- Tarjetas / layout general --- */

.card {
  background: #fff;
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gris-claro);
}

/* --- Pantalla de login (sin cabecera, tarjeta centrada) --- */

.app-shell.pre-auth .topbar,
.app-shell.pre-auth .footer {
  display: none;
}
.app-shell.pre-auth .view {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  min-height: 100vh;
  padding: 24px 18px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-logo {
  margin-bottom: 18px;
}
.login-logo img {
  display: block;
  max-width: 210px;
  width: 100%;
  height: auto;
  margin: 0 auto;
}
.login-title {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--geinstal-verde);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 22px;
}
.login-card form {
  text-align: left;
}
.login-footer {
  text-align: center;
  font-size: 11.5px;
  color: #999;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--gris-claro);
}


h1 {
  color: var(--geinstal-azul);
  font-size: 22px;
  margin: 0 0 6px;
}

h2 {
  color: var(--geinstal-verde);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 18px;
}

p.lead {
  color: #555;
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--geinstal-azul);
  margin-bottom: 6px;
}

input[type="email"], input[type="password"], input[type="text"], textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c7ccd1;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 18px;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus { outline: 2px solid var(--geinstal-verde); border-color: var(--geinstal-verde); }

textarea { resize: vertical; line-height: 1.45; background: #fff; }
select { background: #fff; }
.hidden { display: none; }

.btn-primary {
  background: var(--geinstal-verde);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}

.btn-primary:hover { filter: brightness(0.95); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--geinstal-azul);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.error-msg {
  background: #fdecea;
  color: var(--rojo-error);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* --- Progreso --- */

.progress-track {
  height: 8px;
  background: var(--gris-claro);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 22px;
}
.progress-fill {
  height: 100%;
  background: var(--geinstal-verde);
  transition: width 0.25s ease;
}
.progress-label {
  font-size: 12px;
  color: #777;
  margin-bottom: 6px;
}

/* --- Mockup de email/SMS falso dentro de la pregunta --- */

.mockup-email {
  border: 1px solid var(--gris-claro);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  font-size: 13px;
}
.mockup-header {
  background: #f0f2f4;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gris-claro);
}
.mockup-header div { margin: 2px 0; }
.mockup-header .label { color: #888; display: inline-block; width: 55px; }
.mockup-subject { font-weight: 700; color: var(--geinstal-azul); }
.mockup-body {
  padding: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #fff;
}
.mockup-attachment {
  margin: 10px 14px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f4;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
}

/* --- Opciones de respuesta --- */

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.option-item {
  border: 1px solid #c7ccd1;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.option-item:hover { border-color: var(--geinstal-verde); }
.option-item.selected {
  border-color: var(--geinstal-verde);
  background: rgba(102, 188, 41, 0.08);
  font-weight: 600;
}
.option-item.correct {
  border-color: var(--geinstal-verde);
  background: rgba(102, 188, 41, 0.15);
}
.option-item.incorrect {
  border-color: var(--rojo-error);
  background: rgba(192, 57, 43, 0.08);
}

.explanation-box {
  margin-top: 6px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f0f6ea;
  border: 1px solid var(--geinstal-verde);
  font-size: 13px;
  line-height: 1.5;
  color: #2d3b1f;
}
.explanation-box.wrong {
  background: #fdecea;
  border-color: var(--rojo-error);
  color: #5c2019;
}

.lesson-points {
  margin: 0 0 18px 0;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 14px;
}
.lesson-points li {
  margin-bottom: 8px;
}


/* --- Resultado final --- */

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 0 auto 22px;
  border: 6px solid var(--geinstal-verde);
  color: var(--geinstal-azul);
}
.score-circle.fail { border-color: var(--rojo-error); }
.score-circle .num { font-size: 30px; font-weight: 800; }
.score-circle .pct { font-size: 12px; color: #777; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.pill.pass { background: rgba(102,188,41,0.15); color: #3a6b17; }
.pill.fail { background: rgba(192,57,43,0.12); color: var(--rojo-error); }

/* --- Menu simple de inicio (curso / examen) --- */

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 6px;
}
@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr; }
}
.menu-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: #fff;
  border: 2px solid var(--gris-claro);
  border-radius: 10px;
  padding: 18px 16px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.menu-option:hover:not(:disabled) {
  border-color: var(--geinstal-verde);
  transform: translateY(-1px);
}
.menu-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.menu-option-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--geinstal-azul);
}
.menu-option-desc {
  font-size: 12.5px;
  color: #666;
}

/* --- Niveles del curso (Iniciacion / Intermedio / Experto) --- */

.level-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.level-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
  border: 2px solid var(--gris-claro);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.level-card:hover:not(.locked) {
  border-color: var(--geinstal-verde);
  transform: translateY(-1px);
}
.level-card.locked {
  cursor: not-allowed;
  background: #fafafa;
  opacity: 0.75;
}
.level-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.level-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.level-card-heading {
  flex: 1;
  min-width: 0;
}
.level-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--geinstal-azul);
}
.level-tagline {
  font-size: 12.5px;
  color: #666;
  margin-top: 2px;
}
.level-lock {
  font-size: 18px;
  flex-shrink: 0;
}
.level-arrow {
  font-size: 22px;
  color: var(--geinstal-verde);
  flex-shrink: 0;
}
.level-locked-msg {
  font-size: 12.5px;
  color: #888;
  margin: 0;
}
.level-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.level-back {
  margin-bottom: 12px;
  padding: 6px 12px;
  border-color: var(--gris-claro);
  color: var(--geinstal-azul);
  background: transparent;
  border-width: 1px;
  border-style: solid;
}
.level-back:hover {
  background: var(--geinstal-blanco);
}



/* --- Tabla admin --- */

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--gris-claro);
}
table.admin-table th {
  color: var(--geinstal-azul);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gris-claro);
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tag {
  font-size: 11px;
  background: var(--gris-claro);
  padding: 3px 9px;
  border-radius: 12px;
  color: #555;
}

@media (max-width: 480px) {
  .view { padding: 18px 12px 36px; }
  .card { padding: 20px; }
}

/* --- Administracion: pestanas y gestor de preguntas --- */

a.btn-secondary { text-decoration: none; display: inline-block; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.q-btn-auto { width: auto; }

.btn-danger {
  background: #fff;
  color: var(--rojo-error);
  border: 1px solid var(--rojo-error);
  padding: 11px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover:not(:disabled) { background: #fdecea; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
  background: #fff;
  border: 1px solid #c7ccd1;
  color: #666;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.btn-icon:hover:not(:disabled) { border-color: var(--rojo-error); color: var(--rojo-error); }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }

.pill.neutral { background: #eceff1; color: #5a6670; }

.admin-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--gris-claro);
  margin-bottom: 22px;
}
.admin-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
}
.admin-tab:hover { color: var(--geinstal-azul); }
.admin-tab.active { color: var(--geinstal-azul); border-bottom-color: var(--geinstal-verde); }

.q-flash {
  background: #f0f6ea;
  border: 1px solid var(--geinstal-verde);
  color: #2d3b1f;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.q-level-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.q-level-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid var(--gris-claro);
  border-radius: 8px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--geinstal-azul);
  cursor: pointer;
}
.q-level-tab:hover { border-color: var(--geinstal-verde); }
.q-level-tab.active { border-color: var(--geinstal-verde); background: rgba(102,188,41,0.1); }
.q-level-count {
  background: var(--geinstal-azul);
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11.5px;
}

.q-toolbar {
  display: grid;
  grid-template-columns: 1fr 220px 160px;
  gap: 10px;
  margin-top: 4px;
}
.q-toolbar input[type="text"], .q-toolbar select { margin-bottom: 0; }
@media (max-width: 720px) {
  .q-toolbar { grid-template-columns: 1fr; }
}
.q-actions-row { margin-top: 14px; align-items: center; flex-wrap: wrap; }
.q-count { font-size: 12.5px; color: #777; margin: 16px 0 10px; }

.q-card {
  border: 1px solid var(--gris-claro);
  border-left: 4px solid #c7ccd1;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: #fff;
}
.q-card.is-reviewed { border-left-color: var(--geinstal-verde); }
.q-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.q-id {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  background: var(--geinstal-azul);
  color: #fff;
  padding: 3px 9px;
  border-radius: 6px;
}
.q-prompt {
  font-size: 15px;
  font-weight: 700;
  color: var(--geinstal-azul);
  line-height: 1.4;
  margin-bottom: 12px;
}
.q-options {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.q-options li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f7f8f9;
  color: #555;
}
.q-options li.correct {
  background: rgba(102,188,41,0.14);
  color: #1f3d0a;
  font-weight: 600;
}
.q-mark { font-weight: 800; flex-shrink: 0; width: 14px; }
.q-options li.correct .q-mark { color: #3a6b17; }
.q-card .explanation-box { margin-bottom: 12px; }
.q-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--gris-claro);
  padding-top: 12px;
}
.q-meta { font-size: 11.5px; color: #888; }
.q-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.q-card-actions .btn-secondary, .q-card-actions .btn-danger { padding: 8px 14px; }

.qf-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--geinstal-verde);
  margin: 6px 0 12px;
}
.qf-option {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.qf-option input[type="text"] { margin-bottom: 0; flex: 1; }
.qf-correct {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12.5px;
}
.qf-preview {
  margin-top: 24px;
  padding: 18px;
  border: 2px dashed var(--gris-claro);
  border-radius: 10px;
  background: #fafbfa;
}

