/* ============================================
   VRLG REFORMAS — portal.css
   ============================================ */

/* ---- TOPBAR DEL PORTAL ---- */
.portal-topbar {
  background: var(--azul-mid);
  border-bottom: 3px solid var(--naranja);
  padding: 0.9rem 0;
}

.portal-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.portal-topbar-left h2 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--blanco);
}

.portal-topbar-left p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1px;
}

/* ---- CHIP TRABAJADOR ---- */
.worker-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 7px 14px;
}

.worker-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--naranja);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  color: var(--blanco);
  flex-shrink: 0;
}

.worker-info .worker-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--blanco);
  display: block;
}

.worker-info .worker-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  display: block;
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.65);
  padding: 7px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-logout:hover {
  border-color: var(--naranja);
  color: var(--naranja);
}

/* ---- LAYOUT PRINCIPAL ---- */
.portal-main {
  background: var(--gris-claro);
  min-height: calc(100vh - 66px - 57px);
  padding: 2rem 0 3rem;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

/* ---- TARJETAS ESTADÍSTICAS ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--blanco);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  border-left: 4px solid var(--naranja);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  color: var(--gris-texto);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  color: var(--azul);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--gris-texto);
  margin-top: 5px;
  line-height: 1.5;
}

.stat-card.azul {
  border-left-color: var(--azul);
}

.stat-card.verde {
  border-left-color: var(--success);
}

/* ---- PANEL FICHAJE ---- */
.fichar-panel {
  background: var(--blanco);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.panel-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--gris-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--blanco);
}

.panel-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--azul);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  background: var(--gris-claro);
  color: var(--gris-texto);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--gris-mid);
}

.status-pill.activo {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}

.status-pill.pausa {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fde68a;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-dot.pulsando {
  animation: dotPulse 1.4s infinite;
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.fichar-body {
  padding: 1.4rem;
}

.clock-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.clock-display {
  font-family: var(--font-head);
  font-size: 52px;
  font-weight: 800;
  color: var(--azul);
  letter-spacing: 2px;
  line-height: 1;
  word-break: break-word;
}

.date-display {
  font-size: 13px;
  color: var(--gris-texto);
  padding-bottom: 8px;
  line-height: 1.4;
}

.fichar-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.btn-fichaje {
  padding: 11px 22px;
  min-height: 42px;
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1.5px solid transparent;
}

.btn-fichaje:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

.btn-entrada {
  background: var(--azul);
  color: var(--blanco);
  border-color: var(--azul);
}

.btn-entrada:hover:not(:disabled) {
  background: var(--naranja);
  border-color: var(--naranja);
}

.btn-pausa {
  background: var(--gris-claro);
  color: var(--azul);
  border-color: var(--gris-borde);
}

.btn-pausa:hover:not(:disabled) {
  background: var(--naranja-light);
  border-color: var(--naranja);
  color: var(--naranja-dark);
}

.btn-salida {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-salida:hover:not(:disabled) {
  background: var(--danger);
  color: var(--blanco);
  border-color: var(--danger);
}

/* ---- NOTIFICACIONES ---- */
.notif {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
  line-height: 1.5;
}

.notif.ok {
  background: var(--success-bg);
  border: 1px solid #86efac;
  color: var(--success);
}

.notif.warn {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  color: var(--warning);
}

/* ---- REGISTRO SEMANAL ---- */
.registro-panel {
  background: var(--blanco);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.registro-header {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--gris-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.registro-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--azul);
}

.semana-tag {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  background: var(--azul-light);
  color: var(--azul);
  padding: 4px 12px;
  border-radius: 20px;
}

.tabla-registro-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabla-registro {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.tabla-registro th {
  padding: 10px 16px;
  text-align: left;
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  color: var(--gris-texto);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--gris-claro);
  border-bottom: 1px solid var(--gris-mid);
}

.tabla-registro td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gris-claro);
  color: var(--gris-oscuro);
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tabla-registro th:last-child,
.tabla-registro td:last-child {
  padding-right: 16px;
}

.tabla-registro tr:last-child td {
  border-bottom: none;
}

.tabla-registro tbody tr:hover td {
  background: rgba(245, 130, 32, 0.025);
}

.tabla-registro .dia-cel {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--azul);
  white-space: nowrap;
}

.tabla-registro .obra-cel {
  color: var(--gris-texto);
  font-size: 12px;
  max-width: 160px;
}

.horas-cel {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--azul);
  white-space: nowrap;
}

.tabla-empty {
  padding: 20px;
  text-align: center;
  color: var(--gris-texto);
}

.pausa-info {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--gris-texto);
  line-height: 1.4;
}

.estado-celda {
  text-align: right;
}

.estado-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 84px;
  text-align: center;
  margin-right: 0;
}

.estado-pill.completado {
  background: #d1fae5;
  color: #065f46;
}

.estado-pill.en-curso {
  background: #fef3c7;
  color: #92400e;
}

/* ---- SIDEBAR ---- */
.sidebar-panel {
  background: var(--blanco);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.sidebar-panel-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--gris-mid);
  background: var(--azul);
}

.sidebar-panel-header h4 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--blanco);
}

.sidebar-body {
  padding: 1rem 1.2rem;
}

.sidebar-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gris-claro);
  font-size: 13px;
}

.sidebar-row:last-child {
  border-bottom: none;
}

.sidebar-row .sr-label {
  color: var(--gris-texto);
}

.sidebar-row .sr-val {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--azul);
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.sidebar-row .sr-val.naranja {
  color: var(--naranja);
}

.progreso-barra-wrap {
  padding: 1rem 1.2rem;
}

.progreso-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--gris-texto);
  margin-bottom: 8px;
}

.progreso-label strong {
  color: var(--azul);
  font-family: var(--font-head);
}

.progreso-barra {
  height: 8px;
  background: var(--gris-mid);
  border-radius: 4px;
  overflow: hidden;
}

.progreso-fill {
  height: 100%;
  background: var(--naranja);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ---- FORMULARIO CUENTA / MENSAJES ---- */
.account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-form input,
.account-form select,
.account-form textarea,
.account-form button {
  width: 100%;
  font: inherit;
}

.account-form input,
.account-form select,
.account-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-md);
  background: var(--gris-claro);
  color: var(--negro);
}

.account-form textarea {
  resize: vertical;
  min-height: 90px;
}

.account-form button {
  background: var(--azul);
  color: var(--blanco);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-weight: 700;
  border: none;
}

.account-form button:hover {
  background: var(--azul-mid);
}

.account-msg {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--gris-mid);
  background: var(--gris-claro);
  color: var(--gris-oscuro);
}

.account-msg.success {
  display: block;
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}

.account-msg.error {
  display: block;
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.account-email {
  font-size: 13px;
  color: var(--gris-texto);
  margin-bottom: 12px;
}

/* ---- FORMULARIO MANUAL DE CORRECCIÓN ---- */
input,
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px;
}

.account-form input,
.account-form select {
  min-height: 44px;
}

.account-form input:focus,
.account-form select:focus,
.account-form textarea:focus {
  outline: none;
  border-color: var(--azul);
  background: var(--blanco);
}

.manual-select {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gris-mid);
  background: var(--gris-claro);
  color: var(--negro);
}

#manualEntryWrapper {
  display: block;
  width: 100%;
}

.manual-help {
  color: var(--gris-texto);
  display: block;
  margin-top: -4px;
  line-height: 1.5;
}

#manualFecha:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  background: #eef2f7 !important;
  color: #94a3b8 !important;
  cursor: not-allowed;
  opacity: 1;
}

/* ---- ENLACES RÁPIDOS ---- */
.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--gris-claro);
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--azul);
  font-weight: 500;
  transition: background var(--transition);
}

.quick-link:hover {
  background: #e9eef5;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .portal-grid > :first-child {
    order: 1;
  }

  .portal-grid > :last-child {
    order: 2;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .portal-main {
    padding: 1rem 0 2rem;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .clock-display {
    font-size: 38px;
    letter-spacing: 1px;
  }

  .portal-topbar .container {
    gap: 0.8rem;
  }

  .fichar-buttons {
    flex-direction: column;
  }

  .btn-fichaje {
    width: 100%;
  }

  .worker-chip {
    width: 100%;
  }

  .btn-logout {
    width: 100%;
    justify-content: center;
  }

  .tabla-registro-wrap {
    overflow-x: hidden;
  }

  .tabla-registro {
    width: 100%;
    table-layout: auto;
  }

  .tabla-registro th:nth-child(2),
  .tabla-registro td:nth-child(2) {
    display: none;
  }

  .tabla-registro th,
  .tabla-registro td {
    padding: 10px 6px;
    font-size: 12px;
    overflow-wrap: normal;
    word-break: normal;
  }

  .tabla-registro th:nth-child(1),
  .tabla-registro td:nth-child(1) {
    width: 24%;
  }

  .tabla-registro th:nth-child(3),
  .tabla-registro td:nth-child(3) {
    width: 16%;
  }

  .tabla-registro th:nth-child(4),
  .tabla-registro td:nth-child(4) {
    width: 22%;
  }

  .tabla-registro th:nth-child(5),
  .tabla-registro td:nth-child(5) {
    width: 14%;
  }

  .tabla-registro th:nth-child(6),
  .tabla-registro td:nth-child(6) {
    width: 24%;
    padding-right: 12px;
  }

  .tabla-registro .dia-cel {
    white-space: normal;
    line-height: 1.3;
  }

  .tabla-registro .horas-cel {
    font-size: 13px;
  }

  .estado-celda {
    text-align: right;
    padding-right: 12px !important;
  }

  .estado-pill {
    min-width: 72px;
    padding: 5px 8px;
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .pausa-info {
    font-size: 10px;
    line-height: 1.35;
  }

  .sidebar-row .sr-val {
    max-width: 160px;
  }
}
.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-nav-item {
  display: none;
}

.sr-val-small {
  font-size: 12px;
}

.sr-val-obra {
  font-size: 12px;
  text-align: right;
  max-width: 160px;
}

.sidebar-links {
  padding: 0.8rem;
}

.admin-access-link {
  display: none;
}

.account-toggle-btn {
  width: 100%;
  background: var(--azul-light);
  color: var(--azul);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--font-head);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 10px;
}

.account-toggle-btn:hover {
  background: #dfe8f5;
}

.password-panel {
  overflow: hidden;
  transition: all 0.25s ease;
}

.password-panel.hidden {
  display: none;
}

.sr-only-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 560px) {
  .portal-topbar-right {
    width: 100%;
  }

  .sr-val-obra {
    max-width: 130px;
  }
}
