:root {
  --morado: #8C30CC; --morado-osc: #6A1FA3; --morado-cl: #F1E6FA; --lateral: #3B1466;
  --verde: #24AC68; --verde-osc: #17804C; --verde-cl: #E3F5EC;
  --fondo: #F6F4FA; --texto: #1A1A1F; --gris: #6B6878; --borde: #E4DFEC; --blanco: #fff;
  --error: #D32F2F; --error-cl: #FDECEC; --ok-cl: #E3F5EC; --aviso: #8A5A00; --aviso-cl: #FFF3D6;
  --radio: 14px; --sombra: 0 1px 3px rgba(59, 20, 102, .10); --ancho-lateral: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--texto); background: var(--fondo); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; font-weight: 800; letter-spacing: -.01em; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; font-weight: 700; }
p { margin: 0 0 .75rem; } .sub { color: var(--gris); }
a { color: var(--morado-osc); }
[hidden] { display: none !important; }
.lateral { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--ancho-lateral); display: flex; flex-direction: column; padding: 1rem .8rem; overflow-y: auto; color: var(--blanco); background: linear-gradient(180deg, var(--lateral) 0%, #2A0D4A 100%); transition: transform .2s; }
.logo-caja { background: var(--blanco); border-radius: 14px; padding: .6rem .8rem; text-align: center; }
.logo-caja img { display: block; max-width: 100%; height: auto; max-height: 64px; margin: 0 auto; }
.logo-texto { color: #111; font-size: 1.3rem; font-weight: 800; } .logo-texto b { color: var(--morado); }
.lema { margin: .8rem .4rem .2rem; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #C9A9EA; }
.lateral nav { flex: 1 1 auto; }
.lateral .grupo { margin: 1rem .6rem .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #B88BE0; }
.lateral nav a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; margin-bottom: 2px; border-radius: 10px; color: #F3E9FB; text-decoration: none; cursor: pointer; }
.lateral nav a:hover { background: rgba(255, 255, 255, .09); }
.lateral nav a.activo { background: var(--morado); color: var(--blanco); font-weight: 700; box-shadow: 0 2px 8px rgba(140, 48, 204, .45); }
.burbuja { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--error); color: var(--blanco); font-size: .78rem; font-weight: 700; }
.usuario { display: flex; flex-direction: column; gap: .1rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid rgba(255, 255, 255, .15); }
.usuario span { font-size: .85rem; color: #C9A9EA; }
.btn-salir { margin-top: .6rem; padding: .55rem; font: inherit; font-weight: 600; color: var(--blanco); background: transparent; border: 1px solid #E57373; border-radius: 10px; cursor: pointer; }
.btn-salir:hover { background: rgba(229, 57, 53, .28); }
.principal { min-height: 100vh; }
body.con-menu .principal { margin-left: var(--ancho-lateral); }
.barra-movil { display: none; }
.contenedor { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.2rem; margin-bottom: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--blanco); border: 1px solid var(--borde); border-left: 4px solid var(--morado); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem 1.1rem; }
.kpi small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.kpi .n { font-size: 2rem; font-weight: 800; line-height: 1.2; } .kpi.verde { border-left-color: var(--verde); } .kpi.rojo { border-left-color: var(--error); } .kpi.ambar { border-left-color: #F5A000; }
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .marca-grande { text-align: center; color: var(--morado-osc); font-size: 1.4rem; margin-bottom: 1rem; }
.campo { display: block; margin-bottom: .9rem; } .campo span { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { width: 100%; font: inherit; color: inherit; padding: .7rem .8rem; background: var(--blanco); border: 1px solid var(--borde); border-radius: 10px; min-height: 46px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #D9B6F2; outline-offset: 1px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; font: inherit; font-weight: 600; padding: .75rem 1.2rem; min-height: 46px; color: var(--blanco); background: var(--morado); border: 0; border-radius: 10px; cursor: pointer; }
.btn:hover { background: var(--morado-osc); } .btn[disabled] { opacity: .55; cursor: not-allowed; } .btn-bloque { width: 100%; }
.btn-secundario { color: var(--morado-osc); background: var(--morado-cl); } .btn-secundario:hover { background: #E5D0F5; }
.btn-ok { background: var(--verde); } .btn-ok:hover { background: var(--verde-osc); }
.btn-peligro { background: var(--error); } .btn-peligro:hover { background: #A82323; }
.btn-texto { font: inherit; background: none; border: 0; padding: .45rem .6rem; color: var(--morado-osc); cursor: pointer; text-decoration: underline; }
.fila { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; } .fila > .campo { flex: 1 1 200px; margin-bottom: 0; }
.espacio { margin-top: 1rem; }
.aviso { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 40; max-width: min(92vw, 520px); padding: .8rem 1.1rem; border-radius: 10px; background: var(--texto); color: var(--blanco); box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.aviso.ok { background: var(--verde-osc); } .aviso.error { background: var(--error); }
.mensaje { padding: .7rem .9rem; border-radius: 10px; margin-bottom: .9rem; background: var(--ok-cl); color: var(--verde-osc); }
.mensaje.error { background: var(--error-cl); color: var(--error); } .mensaje.info { background: var(--aviso-cl); color: var(--aviso); }
.grid-horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; margin-top: .75rem; }
.hora { font: inherit; padding: .6rem .2rem; min-height: 44px; border-radius: 10px; border: 1px solid var(--borde); cursor: pointer; }
.hora.libre { background: var(--ok-cl); color: var(--verde-osc); border-color: #B7DCC8; } .hora.libre:hover { background: #CFEBDC; }
.hora.ocupada { background: var(--error-cl); color: var(--error); border-color: #F0C4C0; cursor: not-allowed; }
.hora.pasada, .hora.fuera { background: #EEEBF3; color: #8D8899; cursor: not-allowed; }
.hora.sel { background: var(--morado); color: var(--blanco); border-color: var(--morado-osc); font-weight: 700; }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--gris); margin-top: .5rem; }
.leyenda i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.cita { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .8rem 0; border-top: 1px solid var(--borde); } .cita:first-child { border-top: 0; } .cita b { display: block; }
.etiqueta { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--verde-cl); color: var(--verde-osc); }
.etiqueta.en_curso { background: var(--aviso-cl); color: var(--aviso); } .etiqueta.cancelada, .etiqueta.no_asistio { background: var(--error-cl); color: var(--error); } .etiqueta.completada { background: var(--morado-cl); color: var(--morado-osc); }
.cargando { text-align: center; color: var(--gris); padding: 2rem 0; }
@media (max-width: 900px) {
  .lateral { transform: translateX(-100%); } body.menu-abierto .lateral { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
  body.con-menu .principal { margin-left: 0; }
  body.con-menu .barra-movil { display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 20; padding: .6rem 1rem; color: var(--blanco); background: var(--lateral); font-weight: 700; }
  .barra-movil button { font-size: 1.4rem; color: var(--blanco); background: none; border: 0; cursor: pointer; }
  .contenedor { padding: 1rem; }
}
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: .9rem; }
.acciones { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cita .sub { display: block; }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(20, 5, 40, .55); }
.modal-caja { width: 100%; max-width: 440px; margin: 0; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input[type=checkbox] { width: 20px; height: 20px; min-width: 20px; margin: 0; accent-color: #8C30CC; }
.check input[type=checkbox]:disabled { cursor: default; }
.modal-caja { max-height: 92vh; overflow-y: auto; }
.modal-caja.ancha { width: min(920px, 96vw); max-width: 920px; }
.cuadricula { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 14px; }
.modal-caja .grid-horas { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.modal-caja .hora { padding: 7px 0; font-size: 14px; }
#mi-f { align-items: flex-end; }
#mi-f input, #mi-f select { height: 48px; box-sizing: border-box; }

/* Pantalla de usuarios: ancho completo y filas en columnas alineadas */
main.ancho { max-width: none; }
.us-fila { display: grid; grid-template-columns: minmax(240px, 1fr) 150px 110px 340px; align-items: center; gap: .5rem 1rem; padding: .8rem 0; border-top: 1px solid var(--borde); }
.us-cab { font-weight: 700; font-size: .8rem; text-transform: uppercase; color: #5F5873; border-top: 0; padding-bottom: .4rem; }
.us-fila b, .us-fila .sub { display: block; }
.us-fila .us-acc { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 900px) {
  .us-fila { grid-template-columns: 1fr 1fr; }
  .us-cab { display: none; }
  .us-fila .us-acc { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}
.tabla-ficha { overflow-x: auto; }
.tabla-ficha table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla-ficha th, .tabla-ficha td { padding: .45rem .6rem; border-bottom: 1px solid #e6e0f0; text-align: left; white-space: nowrap; }
.tabla-ficha th { font-weight: 600; }
.mdl-fondo { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.mdl { background: #fff; border-radius: 14px; width: 100%; max-width: 500px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.mdl-cab { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem .4rem; }
.mdl-cab h2 { margin: 0; font-size: 1.15rem; }
.mdl-x { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #667085; }
.mdl-cuerpo { padding: 0 1.2rem 1rem; }
.mdl-fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.mdl-pie { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem; background: #F7F8FA; border-radius: 0 0 14px 14px; }
.cal-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cal-seg { display: inline-flex; border-radius: 10px; overflow: hidden; background: #EEF1F6; }
.cal-seg button { border: 0; background: transparent; padding: .45rem .9rem; cursor: pointer; font-weight: 600; color: #667085; }
.cal-seg button.on { background: #2563EB; color: #fff; }
.cal-rango { font-weight: 700; min-width: 11rem; text-align: center; text-transform: capitalize; }
.cal-scroll { background: #fff; border: 1px solid #E5E8EF; border-radius: 12px; overflow: auto; max-height: 72vh; margin-top: .8rem; }
.cal-cab { display: grid; position: sticky; top: 0; z-index: 3; background: #F7F8FA; border-bottom: 1px solid #E5E8EF; }
.cal-dh { padding: .55rem .3rem; text-align: center; font-weight: 700; font-size: .85rem; }
.cal-dh.hoy { color: #0891B2; }
.cal-cuerpo { display: grid; position: relative; }
.cal-horas { position: relative; border-right: 1px solid #E5E8EF; }
.cal-horas span { position: absolute; right: 6px; transform: translateY(-50%); font-size: .7rem; color: #98A2B3; background: #fff; padding: 0 2px; }
.cal-col { position: relative; border-right: 1px solid #EEF1F6; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 19px, #F1F3F7 19px, #F1F3F7 20px), repeating-linear-gradient(to bottom, transparent 0, transparent 79px, #DDE2EA 79px, #DDE2EA 80px); }
.cal-col.hoy { background-color: #FFF9E0; }
.cal-ev { position: absolute; border-left: 4px solid #8B5CF6; border-radius: 6px; padding: 2px 5px; font-size: .72rem; line-height: 1.25; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.cal-ev b { display: block; } .cal-ev span, .cal-ev small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ahora { position: absolute; left: 0; right: 0; height: 2px; background: #D32F2F; z-index: 2; pointer-events: none; }
.cal-mes { margin-top: .8rem; background: #fff; border: 1px solid #E5E8EF; border-radius: 12px; overflow: hidden; }
.cal-mes-cab, .cal-mes-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-mes-cab div { padding: .5rem; text-align: center; font-weight: 700; font-size: .8rem; background: #F7F8FA; text-transform: uppercase; }
.cal-celda { min-height: 96px; padding: 4px; border-top: 1px solid #EEF1F6; border-right: 1px solid #EEF1F6; cursor: pointer; overflow: hidden; }
.cal-celda.fuera { background: #FAFBFC; color: #98A2B3; }
.cal-celda.hoy { background: #FFF9E0; }
.cal-celda .n { font-weight: 700; font-size: .8rem; margin-bottom: 2px; }
.cal-mini { border-left: 3px solid #8B5CF6; background: #F3F0FB; border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.nu-foto { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.nu-ini { display: flex; align-items: center; justify-content: center; background: #EDE7F9; color: #6B2FA0; font-weight: 700; }
.nu-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ch-col { position: relative; border-right: 1px solid #EEF1F6; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 11px, #F1F3F7 11px, #F1F3F7 12px), repeating-linear-gradient(to bottom, transparent 0, transparent 47px, #DDE2EA 47px, #DDE2EA 48px); }
.ch-blk { position: absolute; left: 3px; right: 3px; border-left: 4px solid #24AC68; border-radius: 6px; padding: 2px 5px; font-size: .72rem; line-height: 1.25; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.ch-blk b, .ch-blk span { display: block; }
