/* Base limpio */
#taq-asistencia { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color:#111; }
#taq-asistencia * { box-sizing: border-box; }

/* Guía */
#taq-asistencia .steps { border:1px solid #e8e8e8; border-radius:10px; padding:12px 14px; margin: 8px 0 14px; background:#fafcff; }
#taq-asistencia .steps h3 { margin:0 0 6px; font-size:16px; }
#taq-asistencia .steps ol { margin:0; padding-left:18px; }
#taq-asistencia .steps li { margin:4px 0; }

/* Controles EN UNA LÍNEA, forzado */
#taq-asistencia .row.controls {
  display:flex !important;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap !important;
}
/* Fijar Admin + Fecha en una sola línea, evitando estilos del theme */
#taq-asistencia .row.controls{
  display:grid !important;
  grid-template-columns: auto minmax(260px, 420px) auto 180px auto;
  align-items:center;
  gap:12px;
  margin: 6px 0 12px;
}
#taq-asistencia .row.controls label { margin:0; white-space:nowrap; }
#taq-asistencia .row.controls .ctl { width:100%; }


/* Cards (cabecera oscura de cada bloque) */
.taq-card { border:1px solid #e8e8e8; border-radius:10px; padding:12px; margin: 14px 0; background:#fff; }
.taq-card summary {
  background:#0f3d66; color:#fff; padding:10px 12px; margin:-12px -12px 10px; border-radius:10px 10px 0 0;
  font-weight:700; font-size:15px; cursor:pointer; list-style:none;
}
.taq-card summary small { font-weight:400; color:#dfe8f2; }
.taq-card[open] summary { border-bottom-left-radius:0; border-bottom-right-radius:0; }
/* mejora del "triángulo" */
.taq-card summary::-webkit-details-marker { filter: invert(1); }

/* Tablas */
.taq-grid { width:100%; border-collapse:separate; border-spacing:0; table-layout:auto; }
.taq-grid th, .taq-grid td { border:1px solid #ececec; padding:8px; vertical-align:middle; background:#fff; }
.taq-grid th { background:#f2f7ff; color:#27364a; font-weight:700; font-size:13px; }
.taq-grid .actions { text-align:center; width:1%; min-width:40px; }
.taq-grid .actions .icon { border:1px solid #bbb; border-radius:6px; padding:.35rem .55rem; background:#fff; cursor:pointer; }
.taq-grid .add-row td { background:#fff; border-top:0; }
.taq-grid .add-row .btn { font-size:13px; background:#fff; color:#111; border:1px solid #bbb; }

/* Inputs de celda */
.taq-grid input[type="text"],
.taq-grid input[type="number"],
.taq-grid input[type="date"],
.taq-grid textarea,
.taq-grid select { width:100%; }
.coment-wrap{ display:flex; flex-direction:column; gap:6px; }
.coment-wrap .coment-obs{ display:none; }
.coment-wrap.show-custom .coment-obs{ display:block; }
.coment-wrap textarea[readonly]{ background:#f8fafc; color:#475569; cursor:not-allowed; }
#taq-asistencia.pdf-export .coment-wrap select{ display:none !important; }
#taq-asistencia.pdf-export .coment-wrap .coment-obs{ display:block !important; }

.taq-grid textarea { min-height:40px; resize:vertical; }

/* Celda especial instalación: input + vista completa */
.inst-cell { display:flex; flex-direction:column; gap:4px; }
.inst-full { display:none; font-size:12px; color:#444; word-break:break-word; white-space:normal; }
/* Mostrar siempre el nombre completo en Inasistencias (Centro de Costo) */
#asist-ausencias .inst-full { display:block; margin-top:4px; }

/* Moneda a la derecha */
.currency { text-align:right; }

/* Anchos sugeridos */
.col-w-22 { width:22%; }
.col-w-18 { width:18%; }
.col-w-16 { width:16%; }
.col-w-15 { width:15%; }
.col-w-12 { width:12%; }
.col-w-10 { width:10%; }

/* Ancho mínimo para que todas las columnas sigan visibles en pantallas pequeñas/zoom.
   Scroll horizontal solo dentro del bloque si no alcanza el espacio. */
#taq-asistencia .taq-card{ overflow-x:auto; }
#asist-resumen .table-resumen,
#asist-ausencias .table-resumen,
#asist-extra .table-resumen{
  width:100%;
  min-width:900px;
}
#asist-ausencias .table-resumen th:nth-child(1),
#asist-ausencias .table-resumen td:nth-child(1){ width:16%; min-width:160px; }
#asist-ausencias .table-resumen th:nth-child(6),
#asist-ausencias .table-resumen td:nth-child(6){ width:9%; min-width:90px; }
#asist-ausencias .table-resumen th:nth-child(7),
#asist-ausencias .table-resumen td:nth-child(7){ width:10%; min-width:100px; text-align:left; }
#asist-ausencias .table-resumen th:nth-child(3),
#asist-ausencias .table-resumen td:nth-child(3){ width:14%; min-width:130px; }
#asist-ausencias .table-resumen th:nth-child(4),
#asist-ausencias .table-resumen td:nth-child(4){ width:13%; min-width:120px; }
#asist-ausencias .table-resumen th:nth-child(5),
#asist-ausencias .table-resumen td:nth-child(5){ width:13%; min-width:120px; }
#asist-ausencias .table-resumen th.actions,
#asist-ausencias .table-resumen td.actions{ width:1%; min-width:40px; }

/* (Opcional) Si alguna pantalla es muy pequeña, puedes permitir wrap:
@media (max-width: 820px){
  #taq-asistencia .row.controls { flex-wrap:wrap; }
}
*/

/* ===== MODO PDF / EXPORT ===== */
#taq-asistencia.pdf-export { font-family: Arial, Helvetica, sans-serif; }

/* Ocultar todo lo interactivo cuando exportamos */
#taq-asistencia.pdf-export .controls,
#taq-asistencia.pdf-export .btn,
#taq-asistencia.pdf-export .no-print,
#taq-asistencia.pdf-export .add-row,
#taq-asistencia.pdf-export .add-install,
#taq-asistencia.pdf-export button { display: none !important; }

/* Encabezados y tablas */
#taq-asistencia.pdf-export table { border-collapse: collapse; width: 100%; table-layout: auto; }
#taq-asistencia.pdf-export .table-resumen th,
#taq-asistencia.pdf-export .table-resumen td {
  font-size: 12px; padding: 8px 10px; border: 1px solid #c8d2e1; vertical-align: middle;
}
#taq-asistencia.pdf-export .table-resumen thead th {
  background: #0f3d66; color: #fff; text-align: center;
}

/* Alineación general */
#taq-asistencia.pdf-export .table-resumen th,
#taq-asistencia.pdf-export .table-resumen td { text-align: center; }

/* En PDF, asegurar legibilidad del contenido editable */
#taq-asistencia.pdf-export .table-resumen td {
  white-space: normal; word-break: break-word; vertical-align: middle;
}
#taq-asistencia.pdf-export .table-resumen td input,
#taq-asistencia.pdf-export .table-resumen td textarea,
#taq-asistencia.pdf-export .table-resumen td select {
  width: 100% !important; height: auto !important; border: none !important;
  background: transparent !important; box-shadow: none !important; text-align: center;
}

/* Primera columna: texto largo a la izquierda y con wrap */


/* Anchos recomendados (ajústalos si quieres) */

#taq-asistencia.pdf-export .table-resumen th:nth-child(2),
#taq-asistencia.pdf-export .table-resumen td:nth-child(2) { width: 10%; }



#taq-asistencia.pdf-export .table-resumen th:nth-child(6),
#taq-asistencia.pdf-export .table-resumen td:nth-child(6) { width: 20%; }
#taq-asistencia.pdf-export .table-resumen th:nth-child(7),
#taq-asistencia.pdf-export .table-resumen td:nth-child(7) { width: 20%; }

/* Columna Acción (suele ser la 7) oculta en export */
#taq-asistencia.pdf-export .table-resumen th.actions,
#taq-asistencia.pdf-export .table-resumen td.actions { display:none !important; }

/* Inputs/Select/Textareas render como texto plano para evitar recortes */
#taq-asistencia.pdf-export input,
#taq-asistencia.pdf-export select,
#taq-asistencia.pdf-export textarea {
  border: none !important; background: transparent !important; box-shadow: none !important;
  outline: none !important; padding: 0 !important; margin: 0 !important; width: 100% !important;
  height: auto !important; appearance: none !important; -webkit-appearance: none !important;
  -moz-appearance: none !important; color: #111 !important; text-align: center; font: inherit;
}
#taq-asistencia.pdf-export td:nth-child(1) input { text-align: left !important; white-space: normal !important; }
#taq-asistencia.pdf-export td:nth-child(2) input { display:inline-block; width:auto !important; min-width:80px; text-align:center !important; }

/* Mensajes de vacío */
#taq-asistencia .empty-note {
  padding:10px 12px; border:1px dashed #c8d2e1; background:#f7faff; text-align:center; color:#123; border-radius:6px;
}

/* Logger fijo mientras sube */
#asist-debug.sticky { position: sticky; bottom: 0; z-index: 50; background:#fff; }

/* ===== MODO VISTA LUEGO DE SUBIR (solo lectura) ===== */
#taq-asistencia.submitted details button,
#taq-asistencia.submitted details .btn,
#taq-asistencia.submitted details .icon,
#taq-asistencia.submitted details .add-row,
#taq-asistencia.submitted details .add-install { display:none !important; }

#taq-asistencia.submitted .taq-grid th.actions,
#taq-asistencia.submitted .taq-grid td.actions { display:none !important; }

#taq-asistencia.submitted details input,
#taq-asistencia.submitted details select,
#taq-asistencia.submitted details textarea {
  pointer-events: none;
  background: #fff;
  color: #111;
}


/* Afinar columnas genéricas (pantalla) */
#taq-asistencia .table-resumen th:nth-child(2),#taq-asistencia .table-resumen td:nth-child(2){ width:10%; }
#taq-asistencia .table-resumen th:nth-child(6),#taq-asistencia .table-resumen td:nth-child(6){ min-width:auto; width:auto; }
#taq-asistencia .table-resumen th:nth-child(7),#taq-asistencia .table-resumen td:nth-child(7){ min-width:auto; width:auto; }
.req-star{ color:#b00020; font-weight:700; margin-left:2px; }
.taq-grid .invalid{ outline:2px solid #b00020 !important; background:#ffecec !important; }

/* Priorizar Comentario por seccion y reducir Fecha */
/* Resumen: Comentarios es la 5ta columna; dale más espacio */
#asist-resumen .table-resumen th:nth-child(5),
#asist-resumen .table-resumen td:nth-child(5){ width:30%; min-width:30%; }
/* Resumen: Columna Acción (6ta) lo más angosta posible */
#asist-resumen .table-resumen th.actions,
#asist-resumen .table-resumen td.actions{
  width:1% !important;
  min-width:40px !important;
  text-align:center;
  white-space:nowrap;
}

#asist-ausencias .table-resumen th:nth-child(8),
#asist-ausencias .table-resumen td:nth-child(8){ width:12%; min-width:140px; }
#asist-ausencias .table-resumen th:nth-child(4),
#asist-ausencias .table-resumen td:nth-child(4),
#asist-ausencias .table-resumen th:nth-child(5),
#asist-ausencias .table-resumen td:nth-child(5){
  width:18%; min-width:180px;
}
#asist-ausencias .table-resumen th:nth-child(3),
#asist-ausencias .table-resumen td:nth-child(3){
  width:18%; min-width:180px;
}
#asist-ausencias .table-resumen th:nth-child(7),
#asist-ausencias .table-resumen td:nth-child(7){
  width:auto; min-width:180px; text-align:left;
  white-space:normal; word-break:normal; overflow-wrap:break-word;
}
#asist-ausencias .table-resumen td:nth-child(7) input{ width:100%; white-space:normal; }
#asist-ausencias .table-resumen th:nth-child(2),
#asist-ausencias .table-resumen td:nth-child(2){ width:10%; }

/* Ajustes de ancho: dar más espacio a Medida y reducir Valor */
#asist-ausencias .table-resumen th:nth-child(6),
#asist-ausencias .table-resumen td:nth-child(6){ width:12%; min-width:120px; }

#asist-extra .table-resumen th:nth-child(6),
#asist-extra .table-resumen td:nth-child(6),
#asist-extra .table-resumen th:nth-child(7),
#asist-extra .table-resumen td:nth-child(7){
  width:13%;
  min-width:140px;
}
#asist-extra .table-resumen th:nth-child(3),
#asist-extra .table-resumen td:nth-child(3){ width:18%; min-width:180px; }
#asist-extra .table-resumen th:nth-child(2),
#asist-extra .table-resumen td:nth-child(2){ width:10%; }
#asist-extra .table-resumen th.col-trabajador,
#asist-extra .table-resumen td.col-trabajador{ display:table-cell !important; }

/* Comentarios como textarea en pantalla */
#taq-asistencia .table-resumen td textarea[data-k=comentario]{ min-height:48px; resize:vertical; width:100%; }
/* Evitar barras de scroll internas en textarea comentario (que crezca con JS) */
#taq-asistencia .table-resumen td textarea[data-k=comentario]{ overflow:hidden; }

/* PDF refinado por seccion */
/* PDF: en Resumen, Comentarios es 5ta columna */
#taq-asistencia.pdf-export #asist-resumen .table-resumen th:nth-child(5),
#taq-asistencia.pdf-export #asist-resumen .table-resumen td:nth-child(5){ width:32%; }
/* PDF: Acción (6ta) mínimo y oculta via hideActionColumn, pero aseguramos angosto */
#taq-asistencia.pdf-export #asist-resumen .table-resumen th.actions,
#taq-asistencia.pdf-export #asist-resumen .table-resumen td.actions{ width:1% !important; }

#taq-asistencia.pdf-export #asist-ausencias .table-resumen th:nth-child(8),
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(8){ width:28%; }
#taq-asistencia.pdf-export #asist-ausencias .table-resumen th:nth-child(7),
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(7){ width:22%; text-align:left; white-space:normal; word-break:normal; overflow-wrap:break-word; }
#taq-asistencia.pdf-export #asist-ausencias .table-resumen th:nth-child(2),
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(2){
  width:1% !important; /* lo más angosto posible */
  white-space:nowrap; padding-left:4px; padding-right:4px;
}

#taq-asistencia.pdf-export #asist-extra .table-resumen th:nth-child(7),
#taq-asistencia.pdf-export #asist-extra .table-resumen td:nth-child(7){ width:28%; }
#taq-asistencia.pdf-export #asist-extra .table-resumen th:nth-child(2),
#taq-asistencia.pdf-export #asist-extra .table-resumen td:nth-child(2){
  width:1% !important; /* lo más angosto posible */
  white-space:nowrap; padding-left:4px; padding-right:4px;
}

/* Inputs dentro de la celda de Fecha en PDF: que no fuercen ancho */
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(2) input,
#taq-asistencia.pdf-export #asist-extra     .table-resumen td:nth-child(2) input{
  width:auto !important; min-width:0 !important; display:inline-block;
}

/* Asegurar visibilidad de los iconos en pills del calendario */
.taq-review .pill{
  display:flex !important;
  align-items:center !important;
  gap:6px !important;
  flex-wrap:wrap !important;         /* permite pasar a 2ª línea si el texto es largo */
}

.taq-review .pill .plabel{
  flex:1 1 auto !important;
  min-width:0 !important;            /* evita que empuje a los iconos fuera */
  overflow:hidden;                   /* opcional: recorta si es larguísimo */
  text-overflow:ellipsis;            /* opcional */
  white-space:nowrap;                /* opcional */
}

.taq-review .pill .act{
  margin-left:auto !important;
  display:inline-flex !important;
  gap:4px !important;
  flex:0 0 auto !important;
  order:3;                           /* acciones antes que la nota si esta aparece */
}

.taq-review .pill-note{ order:4; }   /* nota al final */
.taq-review .pill .turn{ order:1; }
.taq-review .pill .plabel{ order:2; }
.taq-review .pill .ed,
.taq-review .pill .x{ flex:0 0 auto !important; }


/* mensaje superior */
.msg{
  margin-left:8px;
  font-size:13px;
  color:#334155;
}

/* variante: alerta sutil en naranjo */
.msg.warn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:10px;
  background:#fff7ed;     /* naranja muy claro */
  border:1px solid #fed7aa;/* borde naranjo suave */
  color:#92400e;          /* texto naranjo oscuro */
}

.msg .ic{
  font-size:14px;         /* tamaño del ícono */
  line-height:1;
}
/* Overrides: inasistencias column widths */
#asist-ausencias .table-resumen th:nth-child(6),
#asist-ausencias .table-resumen td:nth-child(6){ width:12%; min-width:120px; }
#asist-ausencias .table-resumen th:nth-child(3),
#asist-ausencias .table-resumen td:nth-child(3){ width:18%; min-width:180px; }
#taq-asistencia.pdf-export #asist-ausencias .table-resumen th:nth-child(6),
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(6){ width:12%; min-width:120px; }
#taq-asistencia.pdf-export #asist-ausencias .table-resumen th:nth-child(3),
#taq-asistencia.pdf-export #asist-ausencias .table-resumen td:nth-child(3){ width:18%; min-width:180px; }
