/* ===== Horario SENA ===== */
:root {
    --verde: #39A900;
    --verde-osc: #2d8500;
    --verde-claro: #eaf6e1;
    --azul: #0d6efd;
    --ambar: #f59f00;
    --rojo: #dc3545;
    --texto: #1f2933;
    --suave: #6b7785;
    --borde: #e3e7ec;
    --fondo: #f4f6f8;
    --tarjeta: #ffffff;
    --radio: 10px;
    --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--texto);
    background: var(--fondo);
}
a { color: var(--verde-osc); }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 0; }
[hidden] { display: none !important; }

.texto-suave { color: var(--suave); margin: 0; }
.pequeno { font-size: .85rem; margin-top: .8rem; }
.centrado { text-align: center; }
.espaciador { flex: 1; }

/* ----- Barra superior ----- */
.barra {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 1.5rem;
    padding: .6rem 1.5rem;
    background: var(--verde); color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.marca { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.logo {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: #fff; color: var(--verde); font-weight: 800;
}
.logo-grande { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 14px; background: var(--verde); color: #fff; }
.menu { display: flex; gap: .25rem; flex: 1; }
.menu a {
    color: rgba(255, 255, 255, .88); text-decoration: none;
    padding: .45rem .8rem; border-radius: 7px; font-weight: 500; white-space: nowrap;
}
.menu a:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.menu a.activo { background: rgba(0, 0, 0, .18); color: #fff; }
.salir { display: flex; align-items: center; gap: .7rem; margin: 0; }
.usuario { font-size: .9rem; opacity: .95; white-space: nowrap; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; margin-left: auto; }

/* Menú desplegable del usuario (nombre → cambiar contraseña / salir) */
.menu-usuario { position: relative; }
.menu-usuario > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem; border-radius: 7px; color: #fff; white-space: nowrap;
}
.menu-usuario > summary::-webkit-details-marker { display: none; }
.menu-usuario > summary::after { content: "▾"; font-size: .75rem; opacity: .85; }
.menu-usuario > summary:hover { background: rgba(255, 255, 255, .15); }
.menu-usuario[open] > summary { background: rgba(0, 0, 0, .18); }
.menu-usuario-panel {
    position: absolute; right: 0; top: calc(100% + .4rem); z-index: 60;
    min-width: 200px; padding: .4rem;
    background: var(--tarjeta); color: var(--texto);
    border: 1px solid var(--borde); border-radius: var(--radio);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
    display: flex; flex-direction: column; gap: .25rem;
}
.menu-usuario-panel form { margin: 0; }
.menu-usuario-panel .item-menu {
    display: block; width: 100%; text-align: left;
    background: none; border: 0; cursor: pointer;
    padding: .55rem .7rem; border-radius: 7px;
    font: inherit; font-size: .92rem; color: var(--texto);
}
.menu-usuario-panel .item-menu:hover { background: var(--verde-claro); color: var(--verde-osc); }
.menu-usuario-panel .item-peligro { color: var(--rojo); }
.menu-usuario-panel .item-peligro:hover { background: #fdecee; color: var(--rojo); }

.contenido { max-width: 1320px; margin: 0 auto; padding: 1.5rem; }

/* ----- Tarjetas y rejillas ----- */
.tarjeta {
    background: var(--tarjeta); border: 1px solid var(--borde);
    border-radius: var(--radio); box-shadow: var(--sombra);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.rejilla-2 > .tarjeta { margin-bottom: 0; }
.rejilla-2 { margin-bottom: 1.25rem; }
.rejilla-lateral { grid-template-columns: 1fr 340px; align-items: start; }
.ancho-medio { max-width: 760px; }

.encabezado-pagina { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.encabezado-pagina > div { max-width: 760px; }

/* ----- Botones ----- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--borde);
    background: #fff; color: var(--texto); font: inherit; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: #f1f3f5; }
.btn-primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-primario:hover { background: var(--verde-osc); }
.btn-peligro { color: var(--rojo); border-color: #f1c1c6; }
.btn-peligro:hover { background: #fdecee; }
.btn-claro { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .4); color: #fff; }
.btn-claro:hover { background: rgba(255, 255, 255, .28); }
.btn-fantasma { background: transparent; border-style: dashed; color: var(--suave); }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; }
.btn-bloque { width: 100%; }

/* ----- Formularios ----- */
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
.formulario label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], select, textarea {
    width: 100%; padding: .55rem .7rem; font: inherit; font-weight: 400;
    border: 1px solid #cfd6de; border-radius: 8px; background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(57, 169, 0, .35); border-color: var(--verde); }
input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid #cfd6de; border-radius: 8px; background: #fff; }
textarea { resize: vertical; }
label.check { flex-direction: row !important; align-items: center; gap: .5rem !important; font-weight: 500 !important; cursor: pointer; }
label.check input { width: auto; }
.fila-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 1rem; }
fieldset.asociar { border: 1px solid var(--borde); border-radius: 8px; padding: .6rem .9rem .1rem; margin: 0 0 .9rem; }
fieldset.asociar legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.segmentado { display: flex; gap: .5rem; margin-bottom: .7rem; }
.segmentado label { flex-direction: row; align-items: center; gap: .35rem; margin: 0; font-weight: 500; cursor: pointer;
    padding: .35rem .8rem; border: 1px solid var(--borde); border-radius: 20px; }
.segmentado label:has(input:checked) { background: var(--verde-claro); border-color: var(--verde); color: var(--verde-osc); }
.segmentado input { width: auto; margin: 0; }
.error-form { color: var(--rojo); font-weight: 600; margin: 0 0 .5rem; }
.en-linea { display: flex; gap: .6rem; align-items: center; }
.en-linea select { width: auto; }

/* ----- Alertas y avisos ----- */
.alerta { position: relative; padding: .8rem 2.5rem .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alerta-success { background: #eaf6e1; border-color: #bfe3a7; color: #2a5d0e; }
.alerta-danger { background: #fdecee; border-color: #f5c2c7; color: #842029; }
.alerta-warning { background: #fff8e1; border-color: #ffe08a; color: #7a5b00; }
.alerta-info { background: #e7f1ff; border-color: #b6d4fe; color: #084298; }
.cerrar { position: absolute; top: .5rem; right: .7rem; background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.cerrar:hover { opacity: 1; }
.aviso-vacio { text-align: center; padding: 2rem; border: 2px dashed #cfe8bf; background: #fbfdf9; }
.aviso-vacio p { color: var(--suave); }

.toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 150%);
    background: #1f2933; color: #fff; padding: .7rem 1.2rem; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25); z-index: 1000; transition: transform .25s; font-weight: 500;
}
.toast.visible { transform: translate(-50%, 0); }
.toast-error { background: var(--rojo); }

/* ----- Chips ----- */
.chip {
    --color: #6c757d;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .15rem .55rem; border-radius: 20px; font-size: .78rem; font-weight: 600;
    background: color-mix(in srgb, var(--color) 14%, white); color: color-mix(in srgb, var(--color) 75%, black);
    white-space: nowrap;
}
.chip .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--color); }
.chip-gris { --color: #6c757d; }
.chip-verde { --color: var(--verde); }
.leyenda { display: flex; flex-wrap: wrap; gap: .35rem; margin-left: auto; }

/* ----- Estadísticas ----- */
.estadisticas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
    display: flex; flex-direction: column; padding: 1rem 1.25rem; border-radius: var(--radio);
    background: #fff; border: 1px solid var(--borde); border-left: 5px solid var(--azul);
    text-decoration: none; color: var(--suave); box-shadow: var(--sombra); font-weight: 500;
}
.stat-num { font-size: 1.9rem; font-weight: 800; color: var(--texto); line-height: 1.1; }
.stat-progreso { border-left-color: var(--ambar); }
.stat-hecho { border-left-color: var(--verde); }
.stat-neutro { border-left-color: #adb5bd; }

/* ----- Listas del inicio ----- */
.lista-clases, .lista-tareas, .lista-simple { list-style: none; padding: 0; margin: 0; }
.lista-clases li, .lista-tareas li {
    --color: var(--verde);
    display: flex; flex-direction: column; gap: .1rem;
    padding: .6rem .8rem; border-left: 4px solid var(--color);
    background: #fafbfc; border-radius: 6px; margin-bottom: .5rem;
}
.lista-tareas li { cursor: pointer; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.lista-tareas li:hover { background: #f1f3f5; }
.lista-tareas .titulo { font-weight: 600; flex: 1 1 60%; }
.lista-tareas small { width: 100%; color: var(--suave); }
.lista-tareas li.vencida small { color: var(--rojo); font-weight: 600; }
.lista-simple li { padding: .45rem 0; border-bottom: 1px solid var(--borde); }
.lista-simple li:last-child { border-bottom: 0; }

/* ----- Tablas ----- */
.tabla-scroll { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); background: #f8f9fa; }
.tabla th, .tabla td { padding: .55rem .7rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla .acciones { display: flex; gap: .4rem; justify-content: flex-end; }
.tabla .acciones form { margin: 0; }
.barra-acciones { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; position: sticky; bottom: 0;
    background: var(--fondo); padding: 1rem 0; border-top: 1px solid var(--borde); }
.barra-acciones form { margin: 0; }

/* ----- Subida de archivo ----- */
.zona-archivo {
    position: relative; display: flex !important; flex-direction: column; align-items: center; justify-content: center;
    gap: .4rem; padding: 2.2rem 1rem; border: 2px dashed #b9dca3; border-radius: var(--radio);
    background: #fbfdf9; cursor: pointer; text-align: center; font-weight: 500 !important; transition: background .15s;
}
.zona-archivo:hover, .zona-archivo.arrastrando { background: var(--verde-claro); border-color: var(--verde); }
.zona-archivo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.zona-icono { font-size: 2.2rem; }
.zona-nombre { color: var(--verde-osc); font-weight: 700; }
details.ayuda { background: #f8f9fa; border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; }
details.ayuda summary { cursor: pointer; font-weight: 600; }
details.ayuda ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--suave); }

/* ----- Filtros ----- */
.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem 1rem; padding: .9rem 1.25rem; }
.filtros label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--suave); }
.filtros select, .filtros input[type=date] { min-width: 140px; padding: .4rem .6rem; }
.filtros label.check { color: var(--texto); padding-bottom: .45rem; }

/* ----- Modal ----- */
.modal {
    width: min(620px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
    border: 0; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal-pequeno { width: min(440px, calc(100vw - 2rem)); }
.modal::backdrop { background: rgba(15, 23, 32, .45); }
.modal > form, .modal > div { padding: 1.25rem 1.5rem; }
.modal-cabecera { position: relative; margin-bottom: 1rem; }
.modal-cabecera h2 { margin: 0; font-size: 1.25rem; }
.modal-cabecera .cerrar { top: -.2rem; right: -.4rem; }
.modal-pie { display: flex; gap: .6rem; align-items: center; margin-top: .5rem; }
.detalle { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0 0 1rem; }
.detalle dt { font-weight: 600; color: var(--suave); }
.detalle dd { margin: 0; }

/* ----- Autenticación ----- */
body.sin-menu .contenido { min-height: 100vh; display: grid; place-items: center; }
.auth-caja { width: min(400px, 100%); }
.auth-marca { text-align: center; margin-bottom: 1.2rem; }
.auth-marca h1 { margin-top: .6rem; }

/* ----- Calendario (FullCalendar) ----- */
.calendario-caja { padding: 1rem; }
.fc { --fc-border-color: var(--borde); --fc-today-bg-color: #f3faee; --fc-button-bg-color: #fff; --fc-button-text-color: var(--texto);
    --fc-button-border-color: var(--borde); --fc-button-hover-bg-color: #f1f3f5; --fc-button-hover-border-color: var(--borde);
    --fc-button-active-bg-color: var(--verde); --fc-button-active-border-color: var(--verde); }
.fc .fc-button { font-weight: 600; text-transform: capitalize; box-shadow: none !important; }
.fc .fc-button-active { color: #fff !important; }
.fc .fc-toolbar-title { font-size: 1.3rem; text-transform: capitalize; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--texto); text-decoration: none; text-transform: capitalize; }
.fc-event { cursor: pointer; font-size: .8rem; border-radius: 5px; }
.fc .ev-clase { opacity: .88; border-style: solid; }
.fc .ev-clase .fc-event-title { font-weight: 500; }
.fc .ev-tarea { font-weight: 600; border-width: 2px; }
.fc .ev-tarea.estado-hecho .fc-event-title { text-decoration: line-through; }
.fc .ev-tarea.estado-en_progreso { border-style: dashed; }
.fc .ev-festivo { background: repeating-linear-gradient(45deg, #f1f3f5, #f1f3f5 6px, #e9ecef 6px, #e9ecef 12px); opacity: 1; }

/* ----- Kanban ----- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.kanban-columna { background: #eceff3; border-radius: 12px; padding: .8rem; border-top: 4px solid var(--azul); }
.kanban-columna.col-en_progreso { border-top-color: var(--ambar); }
.kanban-columna.col-hecho { border-top-color: var(--verde); }
.kanban-columna header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; padding: 0 .2rem; }
.kanban-columna h2 { margin: 0; font-size: 1rem; }
.contador { background: #fff; border-radius: 20px; padding: .05rem .6rem; font-weight: 700; font-size: .85rem; }
/* Cada columna tiene su propio scroll para que las tres queden siempre a la vista al arrastrar */
.kanban-lista {
    min-height: 120px; max-height: calc(100vh - 260px); overflow-y: auto;
    display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; padding: 2px 4px 2px 2px;
}
.kt-mover { display: flex; justify-content: space-between; gap: .4rem; margin-top: .5rem; }
.kt-mover .btn { font-size: .72rem; padding: .15rem .5rem; }
.kt-mover [data-mover="1"] { margin-left: auto; }
.kt-mover [hidden] { display: none; }
.kanban-tarjeta {
    --color: #6c757d;
    background: #fff; border-radius: 8px; padding: .7rem .8rem; border-left: 4px solid var(--color);
    box-shadow: var(--sombra); cursor: grab; transition: box-shadow .15s, transform .15s;
}
.kanban-tarjeta:hover { box-shadow: 0 4px 12px rgba(16, 24, 40, .12); transform: translateY(-1px); }
.kanban-tarjeta:active { cursor: grabbing; }
.kanban-tarjeta h3 { font-size: .95rem; margin: .3rem 0 .5rem; word-break: break-word; }
.kt-cabecera { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--suave); font-weight: 600; }
.kt-prioridad { background: #fdecee; color: var(--rojo); border-radius: 4px; padding: 0 .4rem; }
.kt-pie { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; }
.kt-fecha { font-size: .78rem; color: var(--suave); font-weight: 500; }
.kanban-tarjeta.alerta-vencida { background: #fff5f5; }
.kanban-tarjeta.alerta-vencida .kt-fecha { color: var(--rojo); font-weight: 700; }
.kanban-tarjeta.alerta-proxima .kt-fecha { color: #b76e00; font-weight: 700; }
.col-hecho .kanban-tarjeta { opacity: .75; }
.col-hecho .kanban-tarjeta h3 { text-decoration: line-through; color: var(--suave); }
.kanban-fantasma { opacity: .35; }

/* ----- Responsivo ----- */
@media (max-width: 1000px) {
    .rejilla-2, .rejilla-lateral { grid-template-columns: 1fr; }
    .estadisticas { grid-template-columns: repeat(2, 1fr); }
    .kanban { grid-template-columns: 1fr; }
    .kanban-lista { max-height: 60vh; }
    .barra { flex-wrap: wrap; gap: .6rem; padding: .6rem 1rem; }
    .menu-toggle { display: block; }
    .menu, .menu-usuario { display: none; width: 100%; }
    body.menu-abierto .menu { display: flex; flex-direction: column; }
    body.menu-abierto .menu-usuario { display: block; }
    .menu-usuario-panel { position: static; box-shadow: none; }
}
@media (max-width: 640px) {
    .contenido { padding: 1rem; }
    .fc .fc-toolbar { flex-direction: column; gap: .5rem; }
    .en-linea { flex-direction: column; align-items: stretch; }
}

/* ===== Modal SweetAlert con formulario (cambiar contraseña) ===== */
.swal-form-popup { width: min(430px, 94vw) !important; max-width: 94vw !important; padding: 1.25rem 1.5rem 1.75rem; }
.swal-form-popup .swal2-html-container { margin: .5rem 0 0; overflow: visible; }
.swal-form { display: flex; flex-direction: column; gap: .85rem; text-align: left; }
.swal-form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; color: var(--texto); margin: 0; }
.swal-form label small { font-weight: 400; color: var(--suave); }
.swal-form input { width: 100%; }
.swal-form-popup .swal2-actions { margin-top: 1.25rem; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 480px) {
    .swal-form-popup { padding: 1rem 1rem 1.25rem; }
    .swal-form-popup .swal2-actions { flex-direction: column-reverse; width: 100%; }
    .swal-form-popup .swal2-actions .swal2-styled { width: 100%; margin: 0; }
}
