/* ===== attendance.css — Control de asistencia (entradas / salidas) ===== */

.attendance-view { padding: 8px 32px 32px; max-width: 1080px; }
.att-loading { padding: 48px; text-align: center; color: var(--navy-500); font-size: 14px; }

/* ---------- Tarjeta "Hoy" (marcaje del usuario) ---------- */
.att-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 22px;
  animation: fade-in 260ms ease;
}
.att-card-head { margin-bottom: 14px; }
.att-card-head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; color: var(--navy-900); }
.att-hint { font-size: 12.5px; color: var(--navy-500); line-height: 1.45; }

.att-row {
  display: grid;
  grid-template-columns: 34px 1fr auto minmax(120px, auto);
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-top: 1px solid var(--border);
}
.att-row:first-of-type { border-top: none; }
.att-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--navy-500);
}

.att-svg { width: 17px; height: 17px; display: block; }
.att-mini-svg { width: 14px; height: 14px; display: block; flex-shrink: 0; }

.att-ico-entrada { background: var(--green-bg); color: var(--green); }
.att-ico-comida_inicio,
.att-ico-comida_fin { background: var(--primary-light); color: var(--primary); }
.att-ico-salida { background: var(--red-bg); color: var(--red); }
.att-label { font-size: 14px; font-weight: 700; color: var(--navy-900); }
.att-time { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 800; color: var(--navy-700); text-align: right; }
.att-action { text-align: right; }
.att-punch { padding: 9px 18px; }
.att-punch:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45); }
.att-done {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--green);
  background: var(--green-bg); padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18);
}
.att-wait { color: var(--navy-500); font-weight: 700; }
.att-row.is-done .att-label { color: var(--navy-700); }

/* ---------- Nota del día (usuario) ---------- */
.att-notes { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.att-notes label { display: block; font-size: 13px; font-weight: 700; color: var(--navy-700); margin-bottom: 8px; }
.att-notes label span { font-weight: 500; color: var(--navy-500); font-size: 12px; }
.att-notes textarea {
  width: 100%; min-height: 64px; resize: vertical; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--paper-card); color: var(--navy-900);
  font-size: 13.5px; font-family: inherit; outline: none; transition: border-color var(--transition); margin-bottom: 10px;
}
.att-notes textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.att-note-save { padding: 8px 16px; font-size: 13px; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18); }
.att-note-save:hover { background: #e0e3ff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

/* ---------- Historial del usuario ---------- */
.att-history { margin-top: 4px; }
.att-history h4 { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--navy-700); }
.att-history-period { font-weight: 700; color: var(--navy-500); }

.att-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.att-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--navy-500); padding: 0 12px 8px; font-weight: 700; white-space: nowrap;
}
.att-table tbody td { padding: 10px 12px; border-top: 1px solid var(--border); color: var(--navy-700); font-variant-numeric: tabular-nums; }
.att-table tbody tr:first-child td { border-top: none; }
.att-table th:first-child, .att-table td:first-child { white-space: nowrap; }
.att-note-cell { font-variant-numeric: normal; font-style: italic; color: var(--navy-500); min-width: 180px; white-space: normal; }
.att-note-input {
  width: 160px; padding: 7px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--paper-card); color: var(--navy-900); font-size: 12.5px; outline: none;
  transition: border-color var(--transition);
}
.att-note-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ---------- Panel de administrador ---------- */
.att-admin {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  animation: fade-in 260ms ease;
}
.att-admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.att-admin-head h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy-900); }
.att-date { font-size: 12.5px; font-weight: 700; color: var(--navy-700); display: flex; align-items: center; gap: 8px; }

.att-date input, .att-time-input {
  padding: 7px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--paper-card); color: var(--navy-900); font-size: 13px; outline: none;
  transition: border-color var(--transition);
}
.att-date input:focus, .att-time-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.att-admin-scroll { overflow-x: auto; margin-top: 14px; }
.att-admin-table { min-width: 820px; }
.att-admin-table th, .att-admin-table td { padding: 10px 10px; }
.att-admin-table .att-admin-name { font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.att-time-input { width: 112px; }
.att-admin-save { padding: 7px 14px; font-size: 12.5px; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18); }
.att-admin-save:hover { background: #e0e3ff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

/* ---------- Barra de progreso + estados ---------- */
.att-progress { height: 10px; background: var(--paper); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.att-progress-fill { height: 100%; background: var(--yellow); border-radius: 999px; transition: width .5s ease; }
.att-progress-fill.is-ok { background: var(--green); }

.att-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 5px 11px; border-radius: 999px; }
.att-status-ok   { background: var(--green-bg); color: var(--green); box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18); }
.att-status-bad  { background: var(--red-bg);   color: var(--red);   box-shadow: 0 2px 8px rgba(239, 68, 68, 0.18); }
.att-status-none { background: var(--paper);    color: var(--navy-500); box-shadow: 0 2px 6px rgba(100, 116, 139, 0.12); }

/* ---------- Tarjeta "Mi quincena" ---------- */
.att-quincena .att-q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.att-quincena h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy-900); }
.att-q-period { font-size: 12.5px; color: var(--navy-500); font-weight: 700; }
.att-q-bignum { font-size: 30px; font-weight: 800; color: var(--navy-900); margin-bottom: 12px; line-height: 1; }
.att-q-bignum span { font-size: 16px; color: var(--navy-500); font-weight: 700; }
.att-q-foot { margin-top: 12px; }

/* ---------- Resumen de equipo (admin) ---------- */
.att-q-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.att-q-controls select, .att-year {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--paper-card); color: var(--navy-900); font-size: 12.5px; font-weight: 600; outline: none;
}
.att-q-controls select:focus, .att-year:focus { border-color: var(--primary); }
.att-year { width: 82px; }

.att-emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.att-emp { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px; }
.att-emp-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.att-emp-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.att-emp-id { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.att-emp-name { font-size: 14px; font-weight: 800; color: var(--navy-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-emp-nums { font-size: 19px; font-weight: 800; color: var(--navy-900); margin-bottom: 8px; }
.att-emp-nums span { font-size: 13px; color: var(--navy-500); font-weight: 700; }
.att-emp-extra { margin-top: 8px; }
.att-emp-hours { display: flex; align-items: center; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.att-emp-hours label { font-size: 11.5px; font-weight: 700; color: var(--navy-500); flex-shrink: 0; }
.att-hours-input {
  width: 72px; padding: 6px 9px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--paper-card); color: var(--navy-900); font-size: 13px; outline: none;
}
.att-hours-input:focus { border-color: var(--primary); }
.att-hours-save { padding: 6px 12px; font-size: 12px; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18); }
.att-hours-save:hover { background: #e0e3ff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

.att-hscroll { overflow-x: auto; }

/* ---------- Insignia de estado de la quincena (en curso / cerrada) ---------- */
.att-corte-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--green-bg); color: var(--green); margin-left: 2px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18);
}
.att-corte-badge.is-closed { background: var(--primary-light); color: var(--primary); box-shadow: 0 2px 8px rgba(79, 70, 229, 0.18); }
.att-corte-badge.is-extra { background: var(--purple-bg); color: var(--purple); box-shadow: 0 2px 8px rgba(139, 92, 246, 0.18); }

/* ---------- Hora extra (lo marcado después de las 6:00 p.m.; solo el admin la ve) ---------- */
.att-extra-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800;
  padding: 4px 11px; border-radius: 999px; background: var(--purple-bg); color: var(--purple);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.18); white-space: nowrap;
  border: none; cursor: pointer; font-family: inherit; transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.att-extra-badge:hover { background: #ede9fe; box-shadow: 0 5px 14px rgba(139, 92, 246, 0.3); transform: translateY(-1px); }
#attGenerarCorte { white-space: nowrap; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18); }
#attGenerarCorte:hover { background: #e0e3ff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

/* ---------- Popover: detalle día por día de la hora extra ---------- */
.att-extra-popover {
  position: fixed; width: 300px; max-width: 90vw;
  background: var(--paper-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  z-index: 210; overflow: hidden;
}
.att-extra-pop-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--purple-bg);
}
.att-extra-pop-head b { display: block; font-size: 13px; color: var(--navy-900); }
.att-extra-pop-head span { display: block; font-size: 11.5px; color: var(--navy-500); font-weight: 600; margin-top: 2px; }
.att-extra-pop-close {
  border: none; background: none; cursor: pointer; font-size: 12px; color: var(--navy-500);
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; transition: background var(--transition);
}
.att-extra-pop-close:hover { background: rgba(0,0,0,0.06); }
.att-extra-pop-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.att-extra-pop-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--navy-500); font-weight: 700; padding: 8px 14px 4px;
}
.att-extra-pop-table td { padding: 6px 14px; color: var(--navy-700); font-variant-numeric: tabular-nums; }
.att-extra-pop-table tbody tr:first-child td { padding-top: 2px; }
.att-extra-pop-table tbody tr:last-child td { padding-bottom: 10px; }
.att-extra-pop-h { color: var(--purple); font-weight: 800; text-align: right; }
.att-extra-pop-total {
  padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--navy-700);
  background: var(--paper);
}
.att-extra-pop-total b { color: var(--purple); }
.att-extra-pop-empty { padding: 18px 14px; margin: 0; font-size: 13px; color: var(--navy-500); text-align: center; }

/* ---------- Historial de cortes (quincenas cerradas + PDF) ---------- */
.att-cortes { margin-top: 22px; }
.att-cortes-empty { font-size: 13.5px; color: var(--navy-500); text-align: center; padding: 28px 12px; margin: 0; }
.att-corte-periodo { font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.att-cumpl-pill {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 800;
  padding: 4px 11px; border-radius: 999px; background: var(--yellow-bg); color: #b45309; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.18);
}
.att-cumpl-pill.is-full { background: var(--green-bg); color: var(--green); box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18); }
.att-cumpl-pill.is-empty { background: var(--red-bg); color: var(--red); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.18); }
.att-cortes-table th:last-child, .att-cortes-table td:last-child { text-align: right; }
.att-corte-pdf { padding: 7px 14px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18); }
.att-corte-pdf:hover { background: #e0e3ff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .attendance-view { padding: 8px 14px 24px; }
  .att-card, .att-admin { padding: 16px; }
  .att-row { grid-template-columns: 28px 1fr minmax(110px, auto); }
  .att-row .att-time { display: none; }   /* la hora se ve en el estado/registrado */
  .att-emp-grid { grid-template-columns: 1fr; }
  .att-q-controls { width: 100%; }
  .att-q-controls select { flex: 1; }
  .att-q-bignum { font-size: 26px; }
}
