/* t52u — Horarios por día (RH/Administración), corrección de marcas, justificaciones con pruebas y exportación. */

/* ---------- 1. Horario semanal (tarjeta) ---------- */
.schedule-week { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.schedule-week li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; border: 1px solid transparent; }
.schedule-week li.on { background: var(--v4-nested, rgba(24, 26, 44, .03)); border-color: var(--t51-card-border); }
.schedule-week li.off { color: var(--t47-muted); }
.schedule-week li.today { border-color: var(--t47-accent, #6d5efc); box-shadow: inset 3px 0 0 var(--t47-accent, #6d5efc); }
.schedule-week .schedule-day-name { font-weight: 700; }
.schedule-week strong { font-variant-numeric: tabular-nums; font-size: 13px; }
.schedule-week em { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.schedule-week li.shift-manana em, .horarios-table td.shift-manana b { color: #b45309; }
.schedule-week li.shift-manana em { background: rgba(245, 158, 11, .14); }
.schedule-week li.shift-tarde em { background: rgba(99, 102, 241, .14); color: #4f46e5; }
.schedule-week li.shift-noche em { background: rgba(15, 23, 42, .12); color: #334155; }
body[data-theme="dark"] .schedule-week li.shift-manana em { color: #fbbf24; }
body[data-theme="dark"] .schedule-week li.shift-tarde em { color: #a5b4fc; }
body[data-theme="dark"] .schedule-week li.shift-noche em { color: #cbd5e1; background: rgba(148, 163, 184, .16); }
.schedule-window.single { grid-template-columns: minmax(0, 1fr); }

/* ---------- 2. Historial: acciones, corregido, justificación, faltas ---------- */
.attendance-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.attendance-period-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.attendance-table td.attendance-actions { text-align: right; width: 1%; padding-left: 4px; }
.attendance-table td.attendance-actions .mini-action { display: block; width: 100%; margin: 2px 0; padding: 4px 10px; font-size: 12px; min-height: 0; white-space: nowrap; }
.attendance-table td:nth-child(4) { white-space: nowrap; }
.attendance-table tr.is-absent td { background: rgba(239, 68, 68, .045); }
body[data-theme="dark"] .attendance-table tr.is-absent td { background: rgba(239, 68, 68, .08); }
.attendance-corrected { cursor: help; white-space: nowrap; }
.justification-badge { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 3. Modales de asistencia (scroll interno, claro y oscuro) ---------- */
.attendance-modal-backdrop { align-items: center; }
html body[data-theme] .modal.attendance-modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; padding: 0 !important; overflow: hidden; }
html body[data-theme] .modal.attendance-modal.wide { width: min(760px, calc(100vw - 32px)); }
body:not([data-theme="dark"]) .modal.attendance-modal { background: #fbfbfd; }
body[data-theme="dark"] .modal.attendance-modal { background: #171824; }
.attendance-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--t51-card-border); flex: 0 0 auto; }
.attendance-modal-head h3 { margin: 0; font-size: 17px; }
.attendance-modal-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--t47-muted); }
.attendance-modal-head .icon-button { font-size: 22px; line-height: 1; padding: 2px 10px; min-height: 0; }
.attendance-modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 22px 0; display: grid; gap: 14px; flex: 1 1 auto; min-height: 0; }
.attendance-modal-body .modal-sticky-footer { position: sticky; bottom: 0; margin: 4px -22px 0; padding: 12px 22px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: inherit; border-top: 1px solid var(--t51-card-border); z-index: 2; }
body:not([data-theme="dark"]) .attendance-modal-body .modal-sticky-footer { background: #fbfbfd; }
body[data-theme="dark"] .attendance-modal-body .modal-sticky-footer { background: #171824; }
.attendance-modal-body form { display: grid; gap: 12px; }

/* Editor de horario */
.schedule-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.schedule-presets .mini-action { font-size: 12px; padding: 5px 10px; min-height: 0; }
.schedule-editor-rows { display: grid; gap: 6px; }
.schedule-editor-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr) 76px; align-items: end; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--t51-card-border); background: var(--v4-surface-solid, #fff); }
body[data-theme="dark"] .schedule-editor-row { background: #1d1e2b; }
.schedule-editor-row.is-off { opacity: .62; }
.schedule-editor-row .field { display: grid; gap: 3px; margin: 0; font-size: 11px; font-weight: 700; color: var(--t47-muted); }
.schedule-editor-row input[type="time"] { min-width: 0; width: 100%; }
.schedule-works { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; padding-bottom: 8px; cursor: pointer; }
.schedule-shift { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--t47-muted); padding-bottom: 10px; text-align: right; }

/* Corrección */
.correction-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.correction-before { margin: 0; font-size: 12.5px; color: var(--t47-muted); }
.correction-trail, .justification-history { font-size: 12.5px; }
.correction-trail ul, .justification-history ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 8px; }
.correction-trail summary, .justification-history summary { cursor: pointer; font-weight: 700; }

/* Justificación */
.justification-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-comment { margin: 0; font-size: 12.5px; padding: 8px 10px; border-radius: 10px; background: var(--v4-nested, rgba(24, 26, 44, .04)); }
.field-helper-inline { font-weight: 500; color: var(--t47-muted); font-size: 11.5px; margin-left: 6px; }
.justification-files { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.justification-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--t51-card-border); font-size: 12.5px; }
.justification-files .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.justification-files small { color: var(--t47-muted); font-variant-numeric: tabular-nums; }
.justification-files .icon-button { padding: 0 8px; min-height: 0; font-size: 16px; }
.upload-progress { width: 70px; height: 6px; border-radius: 999px; background: var(--v4-nested-hover, rgba(24, 26, 44, .08)); overflow: hidden; }
.upload-progress i { display: block; height: 100%; background: var(--t47-accent, #6d5efc); transition: width .2s ease; }
.justification-files li:not(.pending) .upload-progress { display: none; }
.file-drop { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--t51-card-border); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--t47-accent, #6d5efc); }
.file-drop:hover { background: var(--v4-nested, rgba(24, 26, 44, .03)); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.justification-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 8px; }
.justification-meter > span { height: 6px; border-radius: 999px; background: var(--v4-nested-hover, rgba(24, 26, 44, .08)); overflow: hidden; }
.justification-meter > span i { display: block; height: 100%; background: #10b981; }
.justification-meter.over > span i { background: #ef4444; }
.justification-meter small { font-size: 11.5px; color: var(--t47-muted); font-variant-numeric: tabular-nums; }
.justification-comment { margin: 0; padding: 10px 14px; border-left: 3px solid var(--t47-accent, #6d5efc); background: var(--v4-nested, rgba(24, 26, 44, .03)); border-radius: 0 10px 10px 0; white-space: pre-wrap; font-size: 13.5px; }
.justification-review { display: grid; gap: 12px; }
.justification-review h4 { margin: 0; font-size: 13px; }
.justification-attachments { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.justification-attachments li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--t51-card-border); }
.justification-attachments li div { display: grid; min-width: 0; }
.justification-attachments li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.justification-attachments li small { color: var(--t47-muted); font-size: 11.5px; }
.attachment-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.file-icon { width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--v4-nested-hover, rgba(24, 26, 44, .07)); color: var(--t47-muted); }

/* ---------- 4. Horarios y asistencia (Gestión/RH) ---------- */
.horarios-route { display: grid; gap: 16px; }
.horarios-filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 14px 16px !important; background: var(--v4-surface-solid, #fff); border: 1px solid var(--t51-card-border); box-shadow: var(--t51-card-shadow); }
body[data-theme="dark"] .horarios-filters, body[data-theme="dark"] .horarios-table-wrap, body[data-theme="dark"] .horarios-justifications { background: #191a25; }
.horarios-filters .field { display: grid; gap: 4px; margin: 0; font-size: 11.5px; font-weight: 700; color: var(--t47-muted); }
.horarios-filters input[type="search"] { min-width: 220px; }
.horarios-export { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.count-pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10.5px; margin-left: 4px; }
.horarios-table-wrap { padding: 0 !important; overflow: auto; max-height: calc(100vh - 300px); background: var(--v4-surface-solid, #fff); border: 1px solid var(--t51-card-border); box-shadow: var(--t51-card-shadow); }
.horarios-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.horarios-table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--t47-muted); padding: 10px 10px; background: var(--v4-surface-solid, #fff); border-bottom: 1px solid var(--t51-card-border); }
body[data-theme="dark"] .horarios-table th { background: #1f2030; }
.horarios-table td { padding: 8px 10px; border-bottom: 1px solid var(--t51-card-border); vertical-align: middle; }
.horarios-table td.slot { text-align: center; min-width: 64px; font-variant-numeric: tabular-nums; }
.horarios-table td.slot b { display: block; font-size: 12.5px; }
.horarios-table td.slot small { color: var(--t47-muted); font-size: 11px; }
.horarios-table td.slot.on { background: rgba(245, 158, 11, .06); }
.horarios-table td.slot.shift-tarde { background: rgba(99, 102, 241, .07); }
.horarios-table td.shift-tarde b { color: #4f46e5; }
body[data-theme="dark"] .horarios-table td.shift-tarde b { color: #a5b4fc; }
body[data-theme="dark"] .horarios-table td.shift-manana b { color: #fbbf24; }
.horarios-table td.slot.off, .horarios-table td.slot.none { color: var(--t47-muted); font-size: 11.5px; }
.horarios-person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.horarios-person > div { display: grid; min-width: 0; }
.horarios-person small { color: var(--t47-muted); font-size: 11.5px; }
.horarios-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; --av: 32px; }
.horarios-justifications { display: grid; gap: 14px; padding: 16px !important; background: var(--v4-surface-solid, #fff); border: 1px solid var(--t51-card-border); box-shadow: var(--t51-card-shadow); }
.horarios-justifications > .attendance-filter { justify-self: start; }
.justification-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.justification-card { display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--t51-card-border); background: var(--v4-nested, rgba(24, 26, 44, .02)); }
.justification-card header { display: flex; align-items: center; gap: 10px; }
.justification-card header > div { display: grid; min-width: 0; flex: 1 1 auto; }
.justification-card header small { color: var(--t47-muted); font-size: 11.5px; text-transform: capitalize; }
.justification-card p { margin: 0; font-size: 13px; }
.justification-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.justification-card footer small { color: var(--t47-muted); font-size: 11.5px; }

@media (max-width: 720px) {
  .schedule-editor-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .schedule-shift { text-align: left; padding: 0; }
  .horarios-export { margin-left: 0; }
}
