/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ---- CAMBIO (LabCel): paleta del logo — celeste "Lab", verde circuito "Cel", azul noche ---- */
  --primary: #0bb4e4;
  --primary-dark: #0789b3;
  --primary-light: rgba(11, 180, 228, 0.14);
  --accent: #84e03c;
  --accent-dark: #5fb82a;
  --accent-light: rgba(132, 224, 60, 0.14);

  --success: #84e03c;
  --success-light: rgba(132, 224, 60, 0.14);
  --warning: #ffb800;
  --warning-light: rgba(255, 184, 0, 0.14);
  --danger: #ff4d5e;
  --danger-light: rgba(255, 77, 94, 0.16);

  /* ---- Superficies oscuras con tinte azul noche (fondo del logo) ---- */
  --surface: #131a22;
  --surface-alt: #18212b;
  --gray-50: #161d26;
  --gray-100: #1d2630;
  --gray-200: #28323d;
  --gray-300: #36414d;
  --gray-400: #6b7785;
  --gray-500: #8a96a3;
  --gray-600: #b0bac5;
  --gray-700: #d2d9e0;
  --gray-800: #eaeff3;
  --gray-900: #ffffff;

  --sidebar-w: 230px;
  --topbar-h: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --glow-red: 0 0 16px rgba(11, 180, 228, 0.45); /* CAMBIO (LabCel): brillo celeste */
  --glow-yellow: 0 0 16px rgba(132, 224, 60, 0.4); /* CAMBIO (LabCel): brillo verde */
  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: #0b0f14; /* CAMBIO (LabCel) */
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(132, 224, 60,0.08) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(11, 180, 228,0.18) 0%, transparent 50%),
    linear-gradient(135deg, #05080b 0%, #0b1118 55%, #0d1a24 100%); /* CAMBIO (LabCel): azul noche del logo */
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--glow-red);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 130%);
  color: #0a0a0c;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: var(--glow-red);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--gray-900);
}

.login-logo p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.btn-login {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  font-family: var(--font);
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-login:hover { background: var(--primary-dark); box-shadow: var(--glow-red); }

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 16px;
}

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-100);
}

.logo-icon-sm {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 130%);
  color: #0a0a0c;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-name { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.sidebar-sub  { font-size: 11px; color: var(--gray-400); }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
  padding: 10px 18px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-400);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.12s;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-item.active {
  color: var(--accent);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar-footer {
  border-top: 1px solid var(--gray-100);
  padding: 12px 18px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--primary);
}

.user-name  { font-size: 12px; font-weight: 500; color: var(--gray-800); }
.user-role  { font-size: 11px; color: var(--gray-400); }

.btn-logout {
  width: 100%;
  padding: 6px;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.12s;
}
.btn-logout:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.topbar-sub   { font-size: 12px; color: var(--gray-400); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.select-branch {
  padding: 7px 12px;
  font-size: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--gray-700);
  font-family: var(--font);
  cursor: pointer;
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel { display: none; flex-direction: column; gap: 16px; }
.panel.active { display: flex; }

/* ===== METRICS ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.metric-card:hover { border-color: var(--primary); box-shadow: var(--glow-red); }

.metric-label { font-size: 11px; color: var(--gray-500); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 26px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.metric-value.danger { color: var(--danger); }
.metric-trend { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.metric-trend.positive { color: var(--success); }
.metric-trend.negative { color: var(--danger); }

/* ===== ALERTS ===== */
.alerts { display: flex; flex-direction: column; gap: 8px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border-left: 3px solid;
}

.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-warn { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
}

.card-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }

.btn-link {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
}
.btn-link:hover { text-decoration: underline; }

/* ===== TABLE ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead tr {
  background: var(--surface-alt);
}

.table th {
  padding: 10px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-100); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: var(--success-light); color: var(--success); }
.badge-blue   { background: var(--accent-light);   color: var(--accent); }
.badge-amber  { background: var(--warning-light);  color: var(--warning); }
.badge-red    { background: var(--danger-light);   color: var(--danger); }
.badge-purple { background: rgba(255, 89, 0, 0.16); color: #ff8a3d; }

.badge-select {
  display: inline-block;
  padding: 3px 22px 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) center, calc(100% - 8px) center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.badge-select option {
  color: #111 !important;
  background: #fff !important;
  font-weight: 500;
}
.badge-select option:checked {
  background: #e5e5e5 !important;
  font-weight: 700;
}

/* ===== Menú de estado hecho a mano (reemplaza el <select> nativo) ===== */
.status-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.status-dropdown-trigger.badge-green  { background: var(--success-light); color: var(--success); }
.status-dropdown-trigger.badge-blue   { background: var(--accent-light);  color: var(--accent); }
.status-dropdown-trigger.badge-amber  { background: var(--warning-light); color: var(--warning); }
.status-dropdown-trigger.badge-red    { background: var(--danger-light);  color: var(--danger); }

.status-dropdown-caret {
  font-size: 9px;
  opacity: 0.7;
}

.status-dropdown-menu {
  display: none;
  position: fixed; /* no depende de ningún contenedor padre — nunca se corta */
  z-index: 9999;
  min-width: 150px;
  background: #1c1c1f;
  border: 1px solid var(--gray-700, #333);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.status-dropdown-menu.is-open {
  display: block;
}

.status-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: #e5e5e5;
  cursor: pointer;
  white-space: nowrap;
}
.status-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.status-dropdown-item.is-active {
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.status-dropdown-item.badge-green { color: var(--success); }
.status-dropdown-item.badge-blue  { color: var(--accent); }
.status-dropdown-item.badge-amber { color: var(--warning); }
.status-dropdown-item.badge-red   { color: var(--danger); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.badge-green { background: var(--success); }
.status-dot.badge-blue  { background: var(--accent); }
.status-dot.badge-amber { background: var(--warning); }
.status-dot.badge-red   { background: var(--danger); }

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--glow-red); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface-alt);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--gray-100); border-color: var(--accent); }

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--surface-alt);
  color: var(--gray-600);
  cursor: pointer;
  font-family: var(--font);
}
.btn-sm:hover { background: var(--gray-100); }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--gray-800);
  font-family: var(--font);
  background: var(--surface-alt);
  transition: border-color 0.12s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 180, 228,0.16);
}

.form-group textarea { resize: none; height: 72px; }

.form-group .btn-primary,
.form-group .btn-secondary { align-self: flex-end; }

/* ===== INPUT SEARCH ===== */
.input-search {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--gray-700);
  font-family: var(--font);
  width: 220px;
  background: var(--surface-alt);
}
.input-search:focus { outline: none; border-color: var(--primary); }

/* ===== PROGRESS STEPS ===== */
.progress-bar-steps {
  display: flex;
}

.pstep {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--gray-200);
  background: var(--surface-alt);
  color: var(--gray-400);
  margin-right: -1px;
}
.pstep:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.pstep:last-child  { border-radius: 0 var(--radius) var(--radius) 0; margin-right: 0; }

.pstep.done    { background: var(--success-light); color: var(--success); border-color: var(--success); font-weight: 500; }
.pstep.current { background: var(--primary-light); color: var(--accent); border-color: var(--primary); font-weight: 600; }

/* ===== STOCK BAR ===== */
.bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-500);
}

.bar-fill {
  height: 6px;
  background: var(--primary);
  border-radius: 3px;
  flex-shrink: 0;
}

.stock-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stock-bg {
  width: 80px;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.stock-fill-inner { height: 100%; border-radius: 3px; }

/* ===== CODE TAG ===== */
.code-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--gray-100);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
}

/* ===== AVATAR ===== */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--primary);
}

.avatar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--glow-red);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-900); }

.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--gray-100); color: var(--danger); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== LOGIN USERS TABLE ===== */
.login-users-table {
  margin-top: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 12px;
}

.lut-title {
  padding: 7px 12px;
  background: var(--gray-100);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.lut-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 6px 12px;
  border-top: 1px solid var(--gray-100);
  color: var(--gray-700);
  align-items: center;
}

.lut-header {
  font-weight: 600;
  font-size: 11px;
  color: var(--gray-400);
  background: var(--surface-alt);
}

.lut-admin {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

.lut-tec {
  color: var(--warning);
  font-weight: 600;
  font-size: 11px;
}

/* ===== BTN SM PRIMARY ===== */
.btn-sm-primary {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary) !important;
}
.btn-sm-primary:hover { background: var(--primary-dark) !important; box-shadow: var(--glow-red); }

/* ===== LOGIN 3D PHONES ===== */
.login-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 70px;
  perspective: 1400px;
}

.phone-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 140px;
  flex-shrink: 0;
}
@media (max-width: 1150px) {
  .phone-scene { display: none; }
}

.phone-3d {
  position: relative;
  width: 130px;
  height: 270px;
  background: linear-gradient(160deg, #1c1c20, #0b0b0d);
  border: 3px solid var(--gray-200);
  border-radius: 22px;
  transform-style: preserve-3d;
}

.phone-broken .phone-3d {
  border-color: rgba(11, 180, 228,0.55);
  box-shadow: inset 0 0 0 2px #050506, var(--glow-red);
  animation: floatBroken 5s ease-in-out infinite;
}

.phone-fixed .phone-3d {
  border-color: rgba(132, 224, 60,0.55);
  box-shadow: inset 0 0 0 2px #050506, var(--glow-yellow);
  animation: floatFixed 5.5s ease-in-out infinite;
}

@keyframes floatBroken {
  0%, 100% { transform: rotateY(24deg) rotateX(6deg) rotateZ(-2deg) translateY(0); }
  50%      { transform: rotateY(19deg) rotateX(3deg) rotateZ(1deg)  translateY(-14px); }
}
@keyframes floatFixed {
  0%, 100% { transform: rotateY(-24deg) rotateX(6deg) translateY(0); }
  50%      { transform: rotateY(-19deg) rotateX(3deg) translateY(-14px); }
}

.phone-screen {
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  background: #0a0405;
  overflow: hidden;
}
.phone-fixed .phone-screen { background: linear-gradient(180deg, #0c0f04, #050506); }

.crack-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.crack-line {
  fill: none;
  stroke: rgba(255,255,255,0.55);
  stroke-width: 0.7;
  animation: crackFlicker 2.6s ease-in-out infinite;
}
.crack-line2 { stroke: rgba(11, 180, 228,0.65); animation-delay: .4s; }
.crack-line3 { stroke: rgba(11, 180, 228,0.45); animation-delay: .8s; }
@keyframes crackFlicker {
  0%, 100% { opacity: .55; }
  45%      { opacity: 1; }
  50%      { opacity: .15; }
  55%      { opacity: .9; }
}

.shard {
  position: absolute;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(11, 180, 228,.35));
  border: 1px solid rgba(11, 180, 228,.5);
  clip-path: polygon(0 0, 100% 20%, 60% 100%);
  animation: shardDrift 4s ease-in-out infinite alternate;
}
.shard1 { top: 6%;  left: -14px; }
.shard2 { top: 40%; right: -18px; clip-path: polygon(100% 0, 100% 100%, 0 40%); animation-delay: .6s; }
.shard3 { bottom: 18%; left: -20px; animation-delay: 1.1s; }
.shard4 { top: 64%; right: -10px; width: 16px; height: 16px; animation-delay: 1.6s; }
.shard5 { top: -14px; left: 42%; width: 14px; height: 14px; animation-delay: .3s; }

@keyframes shardDrift {
  0%   { transform: translate(0,0) rotate(0deg); opacity: .9; }
  100% { transform: translate(-10px, 12px) rotate(32deg); opacity: .5; }
}

.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(132, 224, 60,.35), transparent);
  animation: scanSweep 2.4s linear infinite;
}
@keyframes scanSweep {
  0%   { top: -30px; }
  100% { top: 100%; }
}

.check-icon {
  position: absolute;
  width: 40px;
  height: 40px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  stroke: var(--accent);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(132, 224, 60,.7));
  animation: checkPulse 2.4s ease-in-out infinite;
}
@keyframes checkPulse {
  0%, 100% { opacity: .75; transform: translate(-50%,-50%) scale(.94); }
  50%      { opacity: 1;   transform: translate(-50%,-50%) scale(1.05); }
}

.spark {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(132, 224, 60,.8);
  opacity: 0;
  animation: sparkRise 2.6s ease-in infinite;
}
.spark1 { left: 18%; bottom: 10px; animation-delay: 0s; }
.spark2 { left: 55%; bottom: 0;    animation-delay: .9s; }
.spark3 { left: 75%; bottom: 20px; animation-delay: 1.7s; }
@keyframes sparkRise {
  0%   { transform: translateY(0);     opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(-90px); opacity: 0; }
}

.phone-shadow {
  width: 90px;
  height: 14px;
  margin-top: 18px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.7), transparent 70%);
  animation: shadowPulse 5s ease-in-out infinite;
}
@keyframes shadowPulse {
  0%, 100% { transform: scale(1);   opacity: .7; }
  50%      { transform: scale(.8);  opacity: .4; }
}

/* ==========================================
   RESPONSIVE — versión móvil/tablet
   ========================================== */

/* Botón hamburguesa: oculto en escritorio */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--gray-700);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle:hover { border-color: var(--primary); color: var(--accent); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }

  /* Sidebar se vuelve un drawer que entra desde la izquierda */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(0,0,0,0.6);
  }

  /* Topbar se acomoda en varias líneas si hace falta */
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar-title { font-size: 15px; }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .select-branch { flex: 1; min-width: 140px; }

  .content { padding: 14px; gap: 12px; }

  .metrics-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .form-grid { grid-template-columns: 1fr !important; padding: 14px; }

  /* Tablas: permite scroll horizontal sin romper el layout */
  .card { overflow-x: auto; }

  /* Modales no se salen de la pantalla */
  .modal-box,
  .stock-modal-box,
  .profile-modal-box,
  .qr-modal-box {
    width: 94vw !important;
    max-width: 94vw !important;
  }

  .login-card {
    width: 90vw;
    max-width: 380px;
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr !important; }
  .topbar-actions .btn-primary,
  .topbar-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  .login-card { padding: 20px; }
  .stock-detail-panel { flex-direction: column; align-items: flex-start; }
}