/* ===========================================================================
   Atlas Core — Fase 1 v2 (Scanner · Ficha · Timeline · Activos)
   =========================================================================== */

/* ───────── Scanner overlay ───────── */
.scanner-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,.92);
  display: flex; align-items: flex-end; justify-content: center;
  animation: scanner-fade .2s ease;
}
@keyframes scanner-fade { from{opacity:0} to{opacity:1} }
.scanner-sheet {
  width: 100%; max-width: 520px;
  background: var(--bg2); border-radius: 18px 18px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; max-height: 92vh;
}
.scanner-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.scanner-title { font-family: var(--atl-font-display); font-weight: 700; font-size: 1rem; }
.scanner-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.07); color: var(--text); font-size: 14px;
}
.scanner-video-wrap {
  position: relative; aspect-ratio: 1/1; width: 100%;
  background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 14px;
}
.scanner-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; inset: 20%;
  border: 2px solid rgba(249,115,22,.8); border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none;
}
.scanner-status {
  position: absolute; left: 0; right: 0; bottom: 12px;
  text-align: center; font-size: 12px; color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,.9); padding: 0 16px;
}
.scanner-manual { display: flex; flex-direction: column; gap: 10px; }
.scanner-help { font-size: 11px; color: var(--text3); margin: 0; }
.scanner-input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--atl-font-mono); font-size: 14px;
}
.scanner-input:focus { outline: none; border-color: var(--orange); }
.scanner-submit {
  height: 46px; background: var(--orange); color: white;
  border-radius: 8px; font-weight: 600;
}

/* ───────── Ficha activo ───────── */
.ficha-activo { display: flex; flex-direction: column; gap: 12px; }
.ficha-header {
  display: flex; align-items: flex-start; gap: 14px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.ficha-icono {
  width: 54px; height: 54px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0; color: white;
}
.ficha-meta { flex: 1; min-width: 0; }
.ficha-codigo {
  font-family: var(--atl-font-mono); font-size: 11px;
  color: var(--text3); margin-bottom: 3px;
}
.ficha-nombre {
  font-family: var(--atl-font-display); font-size: 1.2rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ficha-ref { font-size: 12px; color: var(--text2); margin-top: 2px; }
.ficha-estado-wrap { margin-top: 6px; }

.ficha-section {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text3); margin: 8px 0 6px; padding-left: 2px;
}
.ficha-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid rgba(42,54,84,.4);
}
.ficha-row:last-child { border-bottom: none; }
.ficha-row-label { font-size: 12px; color: var(--text2); }
.ficha-row-value { font-size: 12px; font-weight: 600; text-align: right; }

.ficha-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.ficha-action {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 12px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 13px;
  min-height: var(--atl-touch-min); transition: all .15s;
}
.ficha-action:active { transform: scale(.97); }
.ficha-action:hover { border-color: var(--border); background: var(--bg4); }
.ficha-action.danger { color: var(--red); border-color: rgba(239,68,68,.25); }
.ficha-action.danger:hover { background: rgba(239,68,68,.08); }
.ficha-action.primary {
  background: var(--orange); color: white; border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(249,115,22,.25);
}

/* ───────── Timeline ───────── */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  position: relative; padding: 10px 0 10px 24px;
  border-left: 2px solid var(--border); margin-left: 8px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -7px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--orange); border: 2px solid var(--bg2);
}
.timeline-item.t-creado::before    { background: var(--green); }
.timeline-item.t-inspeccionado::before { background: var(--yellow); }
.timeline-item.t-bloqueado::before { background: var(--red); }
.timeline-item.t-danado::before    { background: var(--red); }
.timeline-tipo {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text); margin-bottom: 2px;
}
.timeline-fecha { font-size: 10px; color: var(--text3); margin-bottom: 4px; }
.timeline-payload { font-size: 11px; color: var(--text2); line-height: 1.4; }
.timeline-user {
  display: inline-block; margin-top: 3px; font-size: 10px;
  padding: 1px 7px; background: rgba(255,255,255,.05); border-radius: 99px;
}

/* ───────── Lista de activos ───────── */
.activos-list { display: flex; flex-direction: column; gap: 8px; }
.activo-card {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px;
  min-height: 70px; cursor: pointer; transition: border-color .15s;
}
.activo-card:hover { border-color: rgba(249,115,22,.3); }
.activo-card:active { transform: scale(.99); }
.activo-icono {
  width: 42px; height: 42px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; flex-shrink: 0; color: white;
}
.activo-info { flex: 1; min-width: 0; }
.activo-codigo { font-family: var(--atl-font-mono); font-size: 10px; color: var(--text3); margin-bottom: 2px; }
.activo-nombre { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.activo-meta { display: flex; gap: 7px; font-size: 10px; }
.activo-estado {
  padding: 1px 7px; border-radius: 99px;
  font-weight: 600; text-transform: capitalize; font-size: 10px;
}

/* Búsqueda */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-input {
  flex: 1; height: 42px; padding: 0 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--orange); }
.btn-scan {
  width: 42px; height: 42px; background: var(--orange);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; color: white; font-size: 18px;
  box-shadow: 0 2px 8px rgba(249,115,22,.3);
}

/* QR display */
.qr-display {
  background: white; padding: 14px;
  border-radius: 10px; text-align: center; margin: 14px 0;
}
.qr-display svg { max-width: 220px; height: auto; display: block; margin: 0 auto; }
.qr-url { margin-top: 8px; font-family: var(--atl-font-mono); font-size: 10px; color: #555; word-break: break-all; }
