:root {
  --bg: #0f0b1e; --card: #1b1533; --card-2: #16112b; --line: #2e2450; --line-soft: #241c42;
  --accent: #b45cf0; --accent-2: #7c4dff;
  --text: #eee6ff; --muted: #9d8fc4;
  --ok: #8ff0c0; --warn: #f0d48f; --err: #f09ab0; --info: #8fc6f0;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, #241a44, var(--bg)); color: var(--text);
}
.wrap { max-width: 1020px; margin: 0 auto; padding: 24px 16px 64px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; margin-bottom: 20px;
}
.card.center { max-width: 420px; margin: 48px auto; }
.brand { font-family: "Cinzel", serif; font-size: 26px; margin: 0; text-align: center; letter-spacing: 1px; }
.subtitle { text-align: center; color: var(--muted); margin: 4px 0 20px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: none; color: var(--muted); padding: 10px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 15px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.form input, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #120d24; color: var(--text); font-size: 15px;
}
.form input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180, 92, 240, .18); }
button[type=submit], .btn {
  cursor: pointer; margin-top: 18px; width: 100%; padding: 12px; border-radius: 10px;
  border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-weight: 700; font-size: 15px; transition: filter .15s ease, transform .15s ease;
}
button[type=submit]:hover, .btn:hover { filter: brightness(1.12); }
.btn { width: auto; margin-top: 0; padding: 9px 16px; display: inline-block; text-decoration: none; text-align: center; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn:disabled { opacity: .6; cursor: default; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.msg.ok { background: #173a2a; color: var(--ok); border-color: #2a6b4c; }
.msg.err { background: #3a1720; color: var(--err); border-color: #6b2a3c; }
.muted { color: var(--muted); }

/* --- Header del panel ------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -24px -16px 24px; padding: 14px 16px;
  background: rgba(15, 11, 30, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mini { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin: 0 0 2px; }
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700; font-size: 18px;
}

/* --- Tarjetas de resumen ---------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.stat .ico { font-size: 22px; }
.stat .num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--muted); }

/* --- Secciones --------------------------------------------------------- */
.section-title { font-size: 16px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.section-sub { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.card.destacada { border-color: var(--accent); box-shadow: 0 0 24px rgba(180, 92, 240, .12); }

/* --- Cards de curso ----------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.curso {
  position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  background: var(--card-2); display: flex; flex-direction: column; gap: 10px; overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.curso::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.curso:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.curso h3 { margin: 0; font-size: 17px; }
.curso p { margin: 0; font-size: 14px; }
.curso .pie { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.curso-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.precio { font-size: 22px; font-weight: 700; }
.precio small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* --- Badges de estado (color + punto + texto) --------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 3px 10px; border-radius: 20px; background: #2e2450; color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.activa, .badge.aprobado { background: #173a2a; color: var(--ok); }
.badge.pendiente_pago, .badge.pendiente { background: #3a2f17; color: var(--warn); }
.badge.rechazado, .badge.cancelado, .badge.cancelada { background: #3a1720; color: var(--err); }
.badge.completada { background: #17293a; color: var(--info); }

/* --- Pagos pendientes ---------------------------------------------------- */
.pago-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card-2); margin-bottom: 10px;
}
.pago-row:last-child { margin-bottom: 0; }
.pago-row .detalle { flex: 1 1 200px; min-width: 0; }
.pago-row .detalle strong { display: block; }
.pago-row .monto { font-size: 18px; font-weight: 700; }

/* --- Tablas --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: rgba(180, 92, 240, .05); }
th.num, td.num { text-align: right; }

/* --- Empty states ----------------------------------------------------------- */
.empty { text-align: center; padding: 22px 12px; color: var(--muted); }
.empty .ico { font-size: 34px; display: block; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 14px; }

/* --- Layout perfil / contraseña ----------------------------------------------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.two-col .card { margin-bottom: 0; }
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 16px; }
}
.result-icon { font-size: 48px; text-align: center; }
