/* ═══════════════════════════════════════════════
   ObrasFoto — Módulo PERSONAL
   Estilos completamente independientes del resto
   ═══════════════════════════════════════════════ */

/* ── Botón de menú en el dashboard (hamburguesa) ── */
.menu-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.menu-btn:active { transform: scale(0.9); }
.menu-btn svg { width: 20px; height: 20px; }

/* ── Menú lateral / drawer ── */
.side-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.side-drawer-overlay.open { opacity: 1; pointer-events: all; }

.side-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 310;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  padding-bottom: 32px;
}
.side-drawer-overlay.open .side-drawer { transform: translateX(0); }

.drawer-header {
  padding: 48px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.drawer-logo {
  width: 44px; height: 44px;
  background: var(--accent); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 16px; color: #0f1923;
  flex-shrink: 0;
}
.drawer-app-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 16px;
}
.drawer-app-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }

.drawer-menu { flex: 1; padding: 16px 12px; }
.drawer-section-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text2); padding: 0 8px;
  margin: 8px 0 4px;
}
.drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
  color: var(--text2);
  font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
}
.drawer-item:active { background: var(--bg3); }
.drawer-item.active {
  background: rgba(245,166,35,.12);
  color: var(--accent);
}
.drawer-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.drawer-item .di-badge {
  margin-left: auto;
  background: var(--accent);
  color: #0f1923;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  min-width: 20px; text-align: center;
}
.drawer-item .di-badge.pending { background: var(--red); color: #fff; }

/* ── Pantalla: Lista de personal ── */
#screen-personal .topbar-title { font-family: 'Syne', sans-serif; }

.personal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.ps-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.ps-val {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 28px;
  margin-bottom: 4px;
}
.ps-val.cv-accent { color: var(--accent); }
.ps-val.cv-green  { color: var(--green); }
.ps-val.cv-red    { color: var(--red); }
.ps-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text2);
}

/* ── Lista de obreros ── */
.personal-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 90px; }

.obrero-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  position: relative;
}
.obrero-card:active { transform: scale(.98); background: var(--bg3); }

.obrero-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}
.obrero-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}

.obrero-info { flex: 1; min-width: 0; }
.obrero-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.obrero-meta {
  font-size: 12px; color: var(--text2);
  margin-top: 4px; display: flex;
  align-items: center; gap: 6px; flex-wrap: wrap;
}
.obrero-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
}
.obrero-status.pendiente {
  background: rgba(231,76,60,.12);
  color: var(--red);
  border: 1px solid rgba(231,76,60,.25);
}
.obrero-status.registrado {
  background: rgba(46,204,113,.12);
  color: var(--green);
  border: 1px solid rgba(46,204,113,.25);
}

.obrero-del {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--red);
  background: rgba(231,76,60,.1);
  border: 1px solid rgba(231,76,60,.2);
  cursor: pointer;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.obrero-del:active { transform: scale(.88); background: rgba(231,76,60,.25); }

/* ── Credenciales generadas (modal) ── */
.cred-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.cred-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.cred-row:last-child { margin-bottom: 0; }
.cred-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text2); min-width: 80px;
}
.cred-value {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px;
  color: var(--accent); flex: 1;
  letter-spacing: .05em;
}
.cred-copy {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(245,166,35,.12);
  border: 1px solid rgba(245,166,35,.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--accent);
  transition: background .15s;
}
.cred-copy:active { background: rgba(245,166,35,.3); }
.cred-copy svg { width: 16px; height: 16px; }

.cred-note {
  font-size: 12px; color: var(--text2);
  line-height: 1.6; margin-bottom: 16px;
  background: rgba(74,158,255,.08);
  border: 1px solid rgba(74,158,255,.15);
  border-radius: 10px; padding: 12px 14px;
}

/* ── Pantalla: Login obrero ── */
#screen-worker-login {
  background: var(--bg);
  justify-content: center;
  align-items: center;
  z-index: 400;
}
.worker-login-wrap {
  width: 100%; max-width: 360px;
  padding: 32px 24px;
  display: flex; flex-direction: column;
  align-items: center;
}
.worker-login-icon {
  width: 72px; height: 72px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  font-size: 32px;
}
.worker-login-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 22px;
  margin-bottom: 6px; text-align: center;
}
.worker-login-sub {
  font-size: 13px; color: var(--text2);
  margin-bottom: 32px; text-align: center;
  line-height: 1.5;
}

/* ── Pantalla: Perfil del obrero ── */
#screen-worker-profile {
  background: var(--bg);
  z-index: 400;
}
.worker-profile-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.wp-hero {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 18px 16px 14px;
  flex-shrink: 0;
}

.wp-avatar-wrap {
  display: flex; flex-direction: column;
  align-items: center; margin-bottom: 24px;
}
.wp-avatar {
  width: 96px; height: 96px;
  border-radius: 28px;
  background: var(--bg3);
  border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 32px;
  color: var(--accent);
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 10px;
  position: relative;
}
.wp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wp-avatar-edit {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px;
  background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.wp-avatar-edit svg { width: 14px; height: 14px; color: #0f1923; }
.wp-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 20px; text-align: center;
  margin-bottom: 4px;
}
.wp-user {
  font-size: 13px; color: var(--text2); text-align: center;
}

.wp-section-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text2);
  margin: 20px 0 10px;
}

.wp-field {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
}
.wp-field-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.wp-field-content { flex: 1; min-width: 0; }
.wp-field-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text2); margin-bottom: 3px;
}
.wp-field-input {
  width: 100%;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500;
}
.wp-field-input::placeholder { color: var(--text2); font-weight: 400; }
.wp-field-input:read-only { opacity: .6; }

/* ── Sección archivos del obrero ── */
.wp-files-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.wp-file-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.wp-file-card:active { background: var(--bg3); }
.wp-file-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg3);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.wp-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wp-file-name {
  font-size: 10px; color: var(--text2);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 100%;
}
.wp-file-del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(231,76,60,.85);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.wp-file-del svg { width: 12px; height: 12px; color: #fff; }

.wp-add-file {
  background: var(--bg2);
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  cursor: pointer; color: var(--text2);
  aspect-ratio: 1;
  justify-content: center;
  transition: border-color .15s;
}
.wp-add-file:active { border-color: var(--accent); }
.wp-add-file svg { width: 24px; height: 24px; }
.wp-add-file span { font-size: 11px; }

/* ── Panel admin: detalle de obrero ── */
#screen-admin-obrero {
  background: var(--bg);
}
.ao-avatar-wrap {
  display: flex; flex-direction: column;
  align-items: center; padding: 24px 16px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.ao-avatar {
  width: 80px; height: 80px;
  border-radius: 22px;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 28px;
  color: var(--accent); overflow: hidden;
  cursor: pointer;
  margin-bottom: 10px;
}
.ao-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ao-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 18px; text-align: center;
}
.ao-user-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px;
  background: rgba(245,166,35,.12);
  border: 1px solid rgba(245,166,35,.2);
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; color: var(--accent);
}

.ao-info-list { padding: 16px; display: flex; flex-direction: column; gap: 8px; padding-bottom: 90px; }
.ao-info-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; gap: 10px;
}
.ao-info-icon {
  font-size: 18px; width: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ao-info-content { flex: 1; }
.ao-info-label { font-size: 10px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.ao-info-value { font-size: 15px; font-weight: 500; }
.ao-info-value.empty { color: var(--text2); font-style: italic; font-size: 13px; }

.ao-files-wrap { padding: 0 16px 16px; }

/* ── Lightbox de foto ampliada (perfil) ── */
#worker-photo-lb {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.95);
  z-index: 600;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
#worker-photo-lb.open { opacity: 1; pointer-events: all; }
#worker-photo-lb img {
  max-width: 90vw; max-height: 80vh;
  border-radius: 16px; object-fit: contain;
}
#worker-photo-lb .wlb-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
}

/* ── Empty state personal ── */
.personal-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.personal-empty .pe-icon {
  width: 72px; height: 72px;
  background: var(--bg2);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 32px;
}
.personal-empty h3 {
  font-family: 'Syne', sans-serif;
  color: var(--text); margin-bottom: 8px; font-size: 17px;
}
.personal-empty p { font-size: 13px; line-height: 1.6; }

/* ── Fix: fondo sólido en todas las pantallas del módulo PERSONAL ──
   Sin esto, la pantalla se ve transparente y muestra el dashboard detrás */
#screen-personal,
#screen-admin-obrero,
#screen-worker-login,
#screen-worker-profile,
#screen-role-selector {
  background: var(--bg) !important;
}

/* ══════════════════════════════════════════
   MÓDULO HERRAMIENTAS
══════════════════════════════════════════ */
.herr-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:14px; }
.herr-stat-card { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:10px 6px; text-align:center; }
.herr-stat-val { font-family:'Syne',sans-serif; font-weight:800; font-size:22px; color:var(--text); }
.herr-stat-lbl { font-size:10px; color:var(--text2); font-weight:600; text-transform:uppercase; letter-spacing:.04em; margin-top:2px; }

.herr-search-wrap { display:flex; align-items:center; gap:10px; background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:10px 14px; margin-bottom:10px; }
.herr-search-input { flex:1; background:transparent; border:none; outline:none; color:var(--text); font-family:'DM Sans',sans-serif; font-size:14px; }
.herr-search-input::placeholder { color:var(--text2); }

.herr-filters { display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; margin-bottom:14px; padding-bottom:2px; }
.herr-filters::-webkit-scrollbar { display:none; }
.herr-filter-btn { flex-shrink:0; padding:7px 14px; border-radius:20px; background:var(--bg2); border:1px solid var(--border); color:var(--text2); font-size:12px; font-weight:600; cursor:pointer; white-space:nowrap; transition:background .15s,color .15s,border-color .15s; }
.herr-filter-btn.active { background:var(--accent); border-color:var(--accent); color:#0f1923; }

.herr-card { display:flex; align-items:flex-start; gap:12px; background:var(--bg2); border:1px solid var(--border); border-radius:14px; padding:14px; margin-bottom:8px; cursor:pointer; transition:background .15s; -webkit-tap-highlight-color:transparent; }
.herr-card:active { background:var(--bg3); }
.herr-card-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }
.herr-card-body { flex:1; min-width:0; }
.herr-card-name { font-family:'Syne',sans-serif; font-weight:700; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:5px; }
.herr-card-meta { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:6px; }
.herr-badge { font-size:11px; font-weight:600; padding:2px 8px; border-radius:20px; white-space:nowrap; }
.herr-chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
.herr-chip { font-size:11px; padding:3px 8px; border-radius:8px; background:var(--bg3); border:1px solid var(--border); color:var(--text2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:170px; }
.herr-card-nota { font-size:11px; color:var(--text2); margin-top:4px; }
.herr-card-right { text-align:center; flex-shrink:0; min-width:42px; }
.herr-qty { font-family:'Syne',sans-serif; font-weight:800; font-size:26px; }
.herr-qty-label { font-size:10px; color:var(--text2); font-weight:600; }

/* Filas en detalle */
.hd-loc-row { display:flex; align-items:center; gap:12px; background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:12px 14px; margin-bottom:8px; }
.hd-loc-bodega { border-color:rgba(46,204,113,.25); background:rgba(46,204,113,.06); }
.hd-loc-icon { font-size:22px; width:36px; text-align:center; flex-shrink:0; }
.hd-loc-info { flex:1; min-width:0; }
.hd-loc-tipo { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text2); margin-bottom:2px; }
.hd-loc-lugar { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hd-loc-qty { font-family:'Syne',sans-serif; font-weight:800; font-size:22px; color:var(--accent); flex-shrink:0; min-width:28px; text-align:center; }
.hd-loc-actions { display:flex; gap:6px; flex-shrink:0; }
.hd-loc-btn { width:30px; height:30px; border-radius:8px; background:var(--bg3); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:16px; font-weight:700; color:var(--text); cursor:pointer; transition:background .1s,transform .1s; -webkit-tap-highlight-color:transparent; }
.hd-loc-btn:active { transform:scale(.88); background:var(--border); }
.hd-loc-del { color:var(--red); border-color:rgba(231,76,60,.3); background:rgba(231,76,60,.08); }
.hd-loc-readonly { font-size:16px; color:var(--text2); padding:0 4px; }

/* Modal tipo/estado */
.herr-tipo-opt { background:var(--bg2); border:2px solid var(--border); border-radius:12px; padding:12px 6px; text-align:center; cursor:pointer; font-size:12px; font-weight:600; color:var(--text2); transition:border-color .15s,background .15s,color .15s; line-height:1.6; -webkit-tap-highlight-color:transparent; }
.herr-tipo-opt.active { border-color:var(--accent); background:rgba(245,166,35,.12); color:var(--accent); }
.herr-tipo-opt span { display:block; }

.herr-empty { text-align:center; padding:48px 24px; color:var(--text2); }
