/* =============================================================
   WFM — Horarios (tabla WFM, modales de edición)
   ============================================================= */

.modal-wfm {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 35000;
  backdrop-filter: blur(10px);
  background: rgba(0, 0, 0, 0.4);
  padding: 20px;
  box-sizing: border-box;
  align-items: center;
}
#wfm-modal-card {
  background: #FFFFFF;
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
}
.wfm-header {
  padding: 20px 24px;
  background: rgba(255,255,255,0.9);
  border-bottom: 1px solid #E5E5EA;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
  z-index: 20;
}
.wfm-modal-card__h2-1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #1C1C1E;
  letter-spacing: -0.5px;
}
.wfm-modal-card__div-1 {
  font-size: 11px;
  color: #86868B;
  font-weight: 500;
}
#wfm-content { flex: 1; overflow: auto; padding: 16px; background: #f6f8fc; }

/* Tabla */
.wfm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1050px;
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.wfm-table .col-employee { min-width:190px; width:190px; }
.wfm-balance-input { width:48px; border:1px solid #dbe3ef; border-radius:6px; font-size:10px; text-align:center; padding:2px; }
.wfm-balance-readonly { font-size:10px; color:#8E8E93; }
.wfm-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #86868B;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 8px;
  border-bottom: 1px solid #D1D1D6;
  z-index: 10;
  backdrop-filter: blur(5px);
}
.wfm-table tbody th, .col-employee {
  position: sticky;
  left: 0;
  background: #FFFFFF;
  z-index: 5;
  border-right: 1px solid #E5E5EA;
  box-shadow: 4px 0 8px rgba(0,0,0,0.02);
}
.wfm-table thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 20;
  background: #F5F5F7;
  border-right: 1px solid #D1D1D6;
}
.wfm-table td {
  padding: 6px;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid transparent;
  background: white;
}

/* Shift pills */
.shift-box {
  background: #fbfcfe;
  border: 1px solid #e7ecf3;
  border-radius: 10px;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.shift-box:hover { background: #f2f7ff; border-color: #60a5fa; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37,99,235,.10); }
.shift-box.off { background: #F9FAFB; border-style: dashed; border-color: #D1D1D6; opacity: 0.7; }
.shift-box.vac { background: #ECFDF5; border-color: #A7F3D0; }
.shift-box.modified { background: #EFF6FF; border-color: #BFDBFE; border-left: 3px solid #007AFF; }
.shift-time { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 12px; color: #172033; letter-spacing: -0.3px; }
.shift-old { font-size: 9px; color: #8E8E93; text-decoration: line-through; margin-bottom: 1px; }
.shift-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 4px; }
.mini-tag { font-size: 8px; line-height: 1.2; font-weight: 800; padding: 3px 5px; border-radius: 5px; text-transform: uppercase; white-space: nowrap; }
.tag-extra { background: #DCFCE7; color: #166534; }
.tag-late  { background: #FEF2F2; color: #991B1B; }
.tag-rh    { background: #DBEAFE; color: #1D4ED8; }
.tag-sh    { background: #FEE2E2; color: #991B1B; }
.tag-rd    { background: #EDE9FE; color: #6D28D9; }
.tag-sd    { background: #FFF7ED; color: #C2410C; }

/* Cobertura: el detalle se ve siempre; no depende de hover ni de un botón. */
.wfm-coverage-row td { background: #f8fafc; border-top: 2px solid #e5edf8; }
.wfm-coverage-label { padding: 12px 16px !important; vertical-align: middle; }
.wfm-coverage-label span { display: block; color: #334155; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.wfm-coverage-label small { display: block; margin-top: 4px; color: #94a3b8; font-size: 10px; line-height: 1.25; }
.wfm-coverage-cell { min-width:115px; vertical-align:top; }
.coverage-status { min-height: 66px; padding: 7px; border: 1px solid; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.coverage-status--ok { background: #f0fdf4; border-color: #bbf7d0; }
.coverage-status--warning { background: #fffbeb; border-color: #fde68a; }
.coverage-status--critical { background: #fef2f2; border-color: #fecaca; }
.coverage-status__icon { font-size: 13px; line-height: 1; }
.coverage-ok { color: #15803d; font-size: 10px; font-weight: 800; }
.coverage-alert-list { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.coverage-alert { display: block; border-radius: 5px; padding: 3px 2px; font-size: 8px; line-height: 1.25; font-weight: 700; }
.coverage-alert b { font-size: 9px; }
.coverage-alert--critical { color: #991b1b; background: rgba(255,255,255,.72); }
.coverage-alert--medium { color:#9a3412; background:#fff7ed; border:1px solid #fed7aa; }
.coverage-alert--low { color:#854d0e; background:#fefce8; border:1px solid #fde68a; }

@media (max-width: 700px) {
  .modal-wfm { padding: 8px; }
  #wfm-modal-card { height: 96vh; border-radius: 18px; }
  .wfm-header { padding: 14px; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  #wfm-content { padding: 10px; }
}

/* Edit modal */
.wfm-edit-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  z-index: 50000 !important;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.3);
}
.ios-card {
  background: #FFFFFF;
  width: min(500px, calc(100vw - 32px));
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  padding: 24px;
  transform: scale(1);
  animation: modalPop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.ios-title { font-size: 19px; font-weight: 700; color: #1C1C1E; margin: 0 0 4px 0; letter-spacing: -0.5px; }
.ios-subtitle { font-size: 13px; color: #8E8E93; margin-bottom: 20px; font-weight: 500; }
.ios-label { font-size: 11px; font-weight: 700; color: #8E8E93; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: block; }
.ios-input {
  width: 100%;
  background: #F2F2F7;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
  color: #1C1C1E;
  font-weight: 500;
  box-sizing: border-box;
  transition: background 0.2s;
}
.ios-input:focus { background: #E5E5EA; outline: none; }
.ios-toggle-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: #F2F2F7;
  padding: 4px;
  border-radius: 12px;
}
.ios-checkbox-wrapper {
  flex: 1;
  position: relative;
}
.ios-checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 100%;
  width: 100%;
  z-index: 2;
}
.ios-checkbox-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: #8E8E93;
  background: transparent;
  transition: all 0.2s;
}
.ios-checkbox-wrapper input:checked + .ios-checkbox-btn {
  background: #FFFFFF;
  color: #007AFF;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ios-section {
  border-top: 1px solid #E5E5EA;
  margin-top: 20px;
  padding-top: 15px;
}
.ios-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}
.ios-btn-primary {
  flex: 1;
  background: #007AFF;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.ios-btn-primary:active { opacity: 0.7; }
.ios-btn-cancel {
  background: transparent;
  color: #007AFF;
  border: none;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  padding: 0 10px;
}

/* Botones WFM */
.wfm-download-image {
  background: #F2F2F7;
  color: #007AFF;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.wfm-clear-schedule {
  background: #FEF2F2;
  color: #EF4444;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.close-modal-wfm {
  background: #1C1C1E;
  color: white;
  border: none;
  padding: 0 20px;
  height: 36px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wfm-time-inputs__div-1 { display: flex; gap: 12px; margin-bottom: 15px; }
.wfm-time-inputs__div-2 { flex: 1; }
.wfm-time-inputs__div-3 { margin-bottom: 15px; }
.wfm-reason { font-size: 14px; }
.wfm-edit-modal__div-1 { display: flex; justify-content: space-between; align-items: center; }
.wfm-edit-modal__div-2 { font-size: 14px; font-weight: 600; color: #1C1C1E; }
.wfm-edit-modal__div-3 { font-size: 11px; color: #8E8E93; }
.wfm-edit-modal__div-4 { display: flex; align-items: center; gap: 5px; }
.wfm-edit-modal__span-1 { font-size: 14px; color: #1C1C1E; font-weight: 600; }
.wfm-reset-exception {
  width: 100%;
  background: #FFF0F0;
  color: #FF3B30;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}
.wfm-edit-actions { display:grid; grid-template-columns:1fr 1.4fr; align-items:stretch; }
.wfm-edit-actions .ios-btn-cancel { border:1px solid #dbe3ef; border-radius:14px; padding:14px; }
.wfm-edit-actions .ios-btn-primary { min-height:48px; }
.wfm-edit-field { margin-bottom:15px; }
.wfm-meal-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.wfm-meal-help { font-size:10px; color:#8E8E93; margin-top:8px; line-height:1.4; }
.wfm-reset-day { width:100%; margin-top:10px; background:#fff5f5; color:#dc2626; border:1px solid #fecaca; padding:12px; border-radius:12px; font-size:13px; font-weight:700; cursor:pointer; }
