/* GM Activos v2 — componentes: tarjetas, tablas, chips, modales, badges */
/* -- COMPONENTES ----------------------------------- */

/* Section header */
.sh { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.sh-title { font-family: var(--f-head); font-size: 1.3rem; font-weight: 700; color: var(--c-navy); line-height: 1.1; }
.sh-sub { font-size: .78rem; color: var(--c-text3); margin-top: .15rem; }

/* Card */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); box-shadow: var(--s-sm); padding: 1.1rem;
  transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--s-md); }
.card-p0 { padding: 0; }

/* Stat card */
.stat {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); box-shadow: var(--s-sm);
  padding: 1rem; display: flex; align-items: center; gap: .85rem;
  transition: all .2s; cursor: default; overflow: hidden; position: relative;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-accent, var(--c-blue));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.stat:hover { box-shadow: var(--s-md); transform: translateY(-1px); }
.stat-ico {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.stat-val { font-family: var(--f-head); font-size: 1.65rem; font-weight: 700; color: var(--c-navy); line-height: 1; }
.stat-lbl { font-size: .7rem; color: var(--c-text3); font-weight: 500; margin-top: .18rem; }

/* Badge estado */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--r-full); white-space: nowrap;
}
.b-asignado  { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.b-disponible{ background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }
.b-reparacion{ background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.b-baja      { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.b-extraviado{ background: #F3E8FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.b-obsoleto  { background: #F1F5F9; color: #64748B; border: 1px solid #E2E8F0; }
.b-sinfun    { background: #F8FAFC; color: #94A3B8; border: 1px dashed #CBD5E1; }

/* Rol badge */
.rol-b { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; }
.rol-Admin    { background: rgba(0,108,170,.1);  color: var(--c-blue);   border: 1px solid rgba(0,108,170,.25); }
.rol-Sistemas { background: rgba(13,158,92,.1);   color: var(--c-green);  border: 1px solid rgba(13,158,92,.25); }
.rol-CXP      { background: rgba(196,124,10,.1);  color: var(--c-amber);  border: 1px solid rgba(196,124,10,.25); }
.rol-Consulta { background: #F1F5F9; color: #64748B; border: 1px solid #E2E8F0; }

/* ID QR chip */
.qr-id {
  font-family: var(--f-mono); font-size: .73rem; font-weight: 600;
  color: var(--c-blue); letter-spacing: .04em;
  background: var(--c-blue3); padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--c-blue4);
}

/* Chips filtro */
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1.5px solid var(--c-border);
  border-radius: var(--r-full); padding: 5px 12px;
  font-size: .73rem; font-weight: 600; color: var(--c-text2);
  cursor: pointer; transition: all .18s; white-space: nowrap; flex-shrink: 0;
}
.chip:hover { border-color: var(--c-blue); color: var(--c-blue); }
.chip.on { background: var(--c-blue); color: #fff; border-color: var(--c-blue); box-shadow: 0 2px 8px rgba(0,108,170,.3); }

/* Search */
.search { position: relative; }
.search i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--c-text3); font-size: .82rem; pointer-events: none; }
.search .input { padding-left: 2.4rem; }

/* Tabla */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.tbl th { background: #F7F9FC; color: var(--c-text3); font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: .75rem 1rem; text-align: left; border-bottom: 1.5px solid var(--c-border); white-space: nowrap; }
table.tbl td { padding: .72rem 1rem; border-bottom: 1px solid var(--c-border); color: var(--c-text); vertical-align: middle; }
table.tbl tbody tr { transition: background .15s; cursor: pointer; }
table.tbl tbody tr:hover { background: #F7FBFF; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-foot { padding: .7rem 1rem; border-top: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; background: #FAFBFD; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Modal */
.overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(11,24,41,.65); backdrop-filter: blur(6px);
  display: none; align-items: flex-end;
  animation: fadeO .2s ease;
}
.overlay.show { display: flex; }
@media(min-width:600px) { .overlay { align-items: center; justify-content: center; } }
.modal {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 92vh; overflow-y: auto;
  padding: 1.4rem;
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  animation: slideO .25s cubic-bezier(.4,0,.2,1);
}
@media(min-width:600px) { .modal { border-radius: var(--r-xl); } }
.modal-handle { width: 36px; height: 4px; background: var(--c-border); border-radius: 2px; margin: 0 auto 1.2rem; }
.modal-title { font-family: var(--f-head); font-size: 1.1rem; font-weight: 700; color: var(--c-navy); margin-bottom: 1.1rem; display: flex; align-items: center; gap: .55rem; }
.modal-title i { color: var(--c-blue); font-size: .95rem; }
@keyframes fadeO { from{opacity:0} to{opacity:1} }
@keyframes slideO { from{transform:translateY(20px);opacity:0} to{transform:none;opacity:1} }

/* Divider */
.div { height: 1px; background: var(--c-border); margin: 1rem 0; }

/* Detail row */
.drow { display: flex; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--c-border); font-size: .84rem; }
.drow:last-child { border-bottom: none; }
.dkey { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text3); min-width: 100px; padding-top: 2px; }
.dval { color: var(--c-text); flex: 1; word-break: break-word; }

/* Paso firma */
.step-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.2rem; }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; transition: all .3s; }
.step-dot.active { background: var(--c-blue); color: #fff; }
.step-dot.done   { background: var(--c-green); color: #fff; }
.step-dot.idle   { background: var(--c-border); color: var(--c-text3); }
.step-line { flex: 1; height: 2px; background: var(--c-border); border-radius: 1px; overflow: hidden; }
.step-fill { height: 100%; width: 0%; background: var(--c-blue); transition: width .4s ease; }

/* Firma canvas */
.sig-canvas { width: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: var(--r-md); }

/* Firma ctx chip */
.sig-ctx { display: flex; align-items: center; gap: .65rem; padding: .65rem .9rem; border-radius: var(--r-md); margin-bottom: .85rem; }
.sig-ctx.worker { background: var(--c-blue3); border: 1px solid var(--c-blue4); }
.sig-ctx.operator { background: var(--c-green2); border: 1px solid rgba(13,158,92,.2); }

/* Plaza bar */
.pbar { display: flex; align-items: center; gap: .7rem; }
.pbar-name { font-size: .7rem; font-weight: 700; color: var(--c-text2); min-width: 64px; text-transform: uppercase; letter-spacing: .05em; }
.pbar-track { flex: 1; height: 5px; background: var(--c-bg); border-radius: 3px; overflow: hidden; border: 1px solid var(--c-border); }
.pbar-fill { height: 100%; background: linear-gradient(90deg, var(--c-blue), var(--c-blue2)); border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.pbar-val { font-size: .73rem; font-weight: 700; color: var(--c-navy); min-width: 26px; text-align: right; }

/* Historial item */
.hitem { display: flex; align-items: flex-start; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--c-border); }
.hitem:last-child { border-bottom: none; }
.hitem-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--c-blue3); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.hitem-ico i { font-size: .75rem; color: var(--c-blue); }

/* Empty state */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--c-text3); }
.empty-ico { width: 60px; height: 60px; border-radius: 14px; background: var(--c-blue3); display: flex; align-items: center; justify-content: center; margin: 0 auto .9rem; }
.empty-ico i { font-size: 1.4rem; color: var(--c-blue); }
.empty p { font-size: .85rem; }

/* Toast */
#toasts { position: fixed; bottom: calc(var(--navbar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
.toast { background: var(--c-navy2); border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-md); padding: .65rem 1.1rem; font-size: .82rem; font-weight: 500; color: #fff; box-shadow: var(--s-lg); animation: toastIn .22s ease; max-width: 300px; text-align: center; }
.toast.ok   { border-left: 3px solid var(--c-green); }
.toast.err  { border-left: 3px solid var(--c-red); }
.toast.warn { border-left: 3px solid var(--c-amber); }
@keyframes toastIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* Loader */
#loader { position: fixed; inset: 0; z-index: 600; background: rgba(11,24,41,.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; flex-direction: column; gap: .9rem; }
#loader.on { display: flex; }
.spin { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--c-blue2); border-radius: 50%; animation: spinA .7s linear infinite; }
@keyframes spinA { to{transform:rotate(360deg)} }
#loader span { font-size: .82rem; color: rgba(255,255,255,.65); font-weight: 500; }

/* Error login */
.login-err { background: rgba(196,43,43,.15); border: 1px solid rgba(196,43,43,.3); border-radius: var(--r-md); padding: .65rem .9rem; font-size: .82rem; color: #FCA5A5; display: none; margin-bottom: 1rem; }

/* Admin tabs */
.admin-tabs { display: flex; gap: .35rem; background: var(--c-bg); border-radius: var(--r-md); padding: .3rem; margin-bottom: 1.1rem; }
.admin-tab { flex: 1; padding: .55rem .5rem; border: none; border-radius: var(--r-sm); background: transparent; font-family: var(--f-body); font-size: .78rem; font-weight: 600; color: var(--c-text3); cursor: pointer; transition: all .2s; }
.admin-tab.on { background: #fff; color: var(--c-navy); box-shadow: var(--s-xs); }

/* Config item */
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--c-border); }
.cfg-row:last-child { border-bottom: none; }
.cfg-lbl { font-size: .85rem; font-weight: 600; color: var(--c-navy); }
.cfg-desc { font-size: .74rem; color: var(--c-text3); margin-top: .15rem; }

/* Dashboard costos */
.cost-card { background: linear-gradient(135deg, var(--c-navy) 0%, var(--c-navy3) 100%); border-radius: var(--r-lg); padding: 1.1rem; color: #fff; position: relative; overflow: hidden; }
.cost-card::before { content:''; position:absolute; top:-30px; right:-30px; width:120px; height:120px; border-radius:50%; background:rgba(0,108,170,.2); }
.cost-val { font-family:var(--f-head); font-size:1.8rem; font-weight:700; line-height:1; }
.cost-lbl { font-size:.7rem; color:rgba(255,255,255,.5); letter-spacing:.1em; text-transform:uppercase; margin-top:.3rem; }

/* QR Reader */
#qr-reader { border-radius: var(--r-md); overflow: hidden; }
#qr-reader video { border-radius: var(--r-md); }

/* Responsive mobile */
@media(max-width:480px) {
  .page { padding: 1rem; }
  table.tbl td, table.tbl th { padding: .6rem .75rem; }
  .stat-val { font-size: 1.45rem; }
  .login-card { padding: 1.4rem 1.25rem; }
}

/* -- Skeleton shimmer ---------------------------------- */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.card-stat{background:var(--c-card);border:1px solid var(--c-border);border-radius:var(--r-lg);padding:.85rem;display:flex;flex-direction:column;gap:.35rem;box-shadow:0 2px 8px rgba(11,24,41,.05);transition:all .2s;}
.card-stat:hover{transform:translateY(-2px);box-shadow:0 4px 16px rgba(11,24,41,.1);}
.cs-icon{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:.95rem;}
.cs-val{font-family:var(--f-head);font-size:1.5rem;font-weight:800;color:var(--c-navy);line-height:1;}
.cs-lbl{font-size:.68rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--c-text3);}
.mov-item{display:flex;align-items:center;gap:.65rem;padding:.55rem 0;border-bottom:1px solid var(--c-border);}
.mov-item:last-child{border-bottom:none;}
.mov-icon{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:.78rem;flex-shrink:0;}
.mov-info{flex:1;min-width:0;}
.mov-desc{font-size:.8rem;font-weight:600;color:var(--c-navy);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.mov-meta{font-size:.7rem;color:var(--c-text3);}
.alerta-item{display:flex;align-items:center;gap:.6rem;padding:.55rem .75rem;border-radius:var(--r-md);margin-bottom:.35rem;border:1px solid;}

/* ── Pulido visual (identidad GlobalMedia — azul institucional #006CAA) ── */
a{color:var(--blue, var(--c-blue));}
button, .btn, .input, select.input, .chip, .fmt-card, .arow, .req-card{ -webkit-tap-highlight-color: transparent; }
button:focus-visible, .btn:focus-visible, .input:focus-visible, select.input:focus-visible, [tabindex]:focus-visible{
  outline: 2px solid rgba(0,108,170,.55);
  outline-offset: 2px;
}
.btn:active{ transform: translateY(0) scale(.98); }
.b-enuso     { background: #CFFAFE; color: #0E7490; border: 1px solid #A5F3FC; }
.b-sinclas   { background: #FEF3C7; color: #92400E; border: 1px dashed #F59E0B; }
.b-prestado  { background: #E0E7FF; color: #4338CA; border: 1px solid #C7D2FE; }
.b-traslado  { background: #E0F2FE; color: #0369A1; border: 1px dashed #7DD3FC; }
