:root {
  --nav: #1d2b38;
  --nav-texto: #e7edf3;
  --acento: #2d6a8f;
  --acento-oscuro: #1f4f6c;
  --texto: #2d3b45;
  --texto-suave: #5f6f7c;
  --borde: #d7dde2;
  --fondo: #ffffff;
  --fondo-suave: #f5f7f9;
  --peligro: #b3261e;
  --exito: #2e7d32;
  --radio: 6px;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--texto);
  font-size: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); line-height: 1.45; }
body.con-nav { padding-left: 84px; }
a { color: var(--acento); }
h1 { font-size: 1.7rem; font-weight: 400; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; font-weight: 500; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .5rem; }
.oculto { display: none !important; }

/* Barra lateral global, al estilo Canvas */
.nav-global {
  position: fixed; inset: 0 auto 0 0; width: 84px; background: var(--nav);
  display: flex; flex-direction: column; align-items: stretch; z-index: 10; overflow-y: auto;
}
.nav-global a, .nav-global button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px;
  color: var(--nav-texto); text-decoration: none; font-size: .75rem; background: none; border: 0;
  cursor: pointer; font-family: inherit; border-left: 4px solid transparent;
}
.nav-global a:hover, .nav-global button:hover { background: rgba(255, 255, 255, .08); }
.nav-global a.activo { background: #fff; color: var(--nav); border-left-color: var(--acento); }
.nav-global svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nav-global .marca { font-weight: 700; font-size: 1.05rem; letter-spacing: .05em; padding: 18px 4px; }
.nav-global .salir { margin-top: auto; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--acento); color: #fff;
  display: grid; place-items: center; font-size: .8rem; font-weight: 600;
}
.nav-global a.activo .avatar { background: var(--nav); }

/* Contenido */
.contenido { padding: 24px 32px 48px; max-width: 1200px; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--borde); padding-bottom: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.cabecera h1 { margin: 0; }
.migas { color: var(--texto-suave); font-size: .95rem; }
.migas a { text-decoration: none; }
.vacio { color: var(--texto-suave); padding: 24px; border: 1px dashed var(--borde); border-radius: var(--radio); text-align: center; }

/* Botones y formularios */
.boton, .boton-sec, .boton-peligro {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radio); padding: 8px 14px;
  font: inherit; font-size: .95rem; cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.boton { background: var(--acento); color: #fff; }
.boton:hover { background: var(--acento-oscuro); }
.boton-sec { background: var(--fondo-suave); border-color: var(--borde); color: var(--texto); }
.boton-sec:hover { background: #e9edf1; }
.boton-peligro { background: #fff; border-color: var(--peligro); color: var(--peligro); }
.boton-peligro:hover { background: #fbeceb; }
.boton-icono { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--texto-suave); }
button:disabled { opacity: .6; cursor: wait; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }

.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.campo label { font-weight: 600; font-size: .9rem; }
.campo small { color: var(--texto-suave); }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; color: var(--texto); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
.error { color: var(--peligro); font-size: .92rem; min-height: 1.2em; margin: 4px 0 10px; }

/* Pantalla de ingreso */
.ingreso { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #1d2b38 0%, #2d6a8f 100%); padding: 16px; }
.ingreso-caja { background: #fff; border-radius: 10px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.ingreso-caja h1 { font-weight: 600; margin-bottom: 4px; }
.ingreso-caja p { color: var(--texto-suave); margin: 0 0 20px; }
.ingreso-caja .boton { width: 100%; justify-content: center; padding: 10px; }

/* Panel de cursos */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.tarjeta { border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; background: #fff; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); transition: box-shadow .15s; }
.tarjeta:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.tarjeta-color { height: 130px; position: relative; }
.tarjeta-color span { position: absolute; left: 14px; bottom: 10px; color: rgba(255, 255, 255, .9); font-size: .85rem; }
.tarjeta-texto { padding: 12px 14px 16px; }
.tarjeta-texto strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.tarjeta-texto small { color: var(--texto-suave); display: block; }
.tarjeta.archivada { opacity: .6; }

/* Curso */
.curso { display: grid; grid-template-columns: 190px 1fr; gap: 28px; }
.nav-curso { display: flex; flex-direction: column; gap: 2px; }
.nav-curso a { padding: 7px 10px; text-decoration: none; border-left: 3px solid transparent; color: var(--acento); }
.nav-curso a.activo { border-left-color: var(--texto); color: var(--texto); font-weight: 600; }
.nav-curso a.pronto { color: var(--texto-suave); }
.nav-curso a.pronto::after { content: ' · pronto'; font-size: .75rem; }
.banda { height: 10px; border-radius: var(--radio); margin-bottom: 18px; }
.bloque { border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px; margin-bottom: 20px; }
.etiquetas { display: flex; gap: 8px; flex-wrap: wrap; }
.etiqueta { display: inline-flex; align-items: center; gap: 6px; background: var(--fondo-suave); border: 1px solid var(--borde); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .9rem; }
.etiqueta button { border: 0; background: none; cursor: pointer; color: var(--texto-suave); font-size: 1.1rem; line-height: 1; }
.colores { display: flex; gap: 8px; flex-wrap: wrap; }
.colores button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colores button.elegido { border-color: var(--texto); }

/* Tablas */
.tabla-caja { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
th { background: var(--fondo-suave); font-weight: 600; }
td .acciones { flex-wrap: nowrap; }
.inactivo td { color: var(--texto-suave); }
.chip { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--fondo-suave); border: 1px solid var(--borde); white-space: nowrap; }

/* Pestañas de administración */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin-bottom: 20px; flex-wrap: wrap; }
.pestanas button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; cursor: pointer; color: var(--texto-suave); }
.pestanas button.activa { border-bottom-color: var(--acento); color: var(--texto); font-weight: 600; }
.filtros { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filtros input, .filtros select { width: auto; min-width: 180px; }

/* Credenciales generadas */
.credenciales { background: #fff8e1; border: 1px solid #f0d58a; border-radius: var(--radio); padding: 14px 16px; margin: 14px 0; }
.credenciales code { font-size: 1.05rem; background: #fff; padding: 2px 6px; border-radius: 4px; }

/* Modal y avisos */
.modal-fondo { position: fixed; inset: 0; background: rgba(20, 30, 40, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-cabeza, .modal-pie { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; gap: 8px; }
.modal-cabeza { border-bottom: 1px solid var(--borde); }
.modal-cabeza h2 { margin: 0; }
.modal-cuerpo { padding: 18px; overflow-y: auto; }
.modal-pie { border-top: 1px solid var(--borde); justify-content: flex-end; }
.aviso { position: fixed; right: 20px; bottom: 20px; padding: 12px 16px; border-radius: var(--radio); color: #fff; z-index: 60; max-width: 360px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.aviso-ok { background: var(--exito); }
.aviso-error { background: var(--peligro); }

@media (max-width: 760px) {
  body.con-nav { padding-left: 0; padding-bottom: 64px; }
  .nav-global { inset: auto 0 0 0; width: auto; height: 64px; flex-direction: row; justify-content: space-around; }
  .nav-global .marca { display: none; }
  .nav-global a, .nav-global button { padding: 8px 4px; border-left: 0; flex: 1; }
  .nav-global .salir { margin-top: 0; }
  .contenido { padding: 16px; }
  .curso { grid-template-columns: 1fr; }
  .nav-curso { flex-direction: row; overflow-x: auto; }
  .nav-curso a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .nav-curso a.activo { border-bottom-color: var(--texto); }
}
.angosto { max-width: 460px; }
.logo-ingreso { display: block; margin: 0 auto 12px; width: 120px; height: auto; }
.ingreso-caja h1 { text-align: center; }
.ingreso-caja > p { text-align: center; }
.nav-global .marca img { width: 52px; height: auto; display: block; }
