:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-dark: #15803d;
  --danger: #dc2626;
  --dark: #0f172a;
  --card-bg: #ffffff;
  --bg: #f8fafc;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Encabezado */
header {
  background: var(--dark);
  color: white;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-tag {
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Contenedor principal */
main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

/* Vistas y transiciones */
.view {
  display: none;
}
.view.active {
  display: block;
}

/* Tarjetas */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Formularios */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus {
  border-color: var(--primary);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:active {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:active {
  background: var(--success-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
}

.btn-icon {
  width: auto;
  padding: 8px 12px;
}

/* Teclado numérico PIN */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 20px 0;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: transparent;
  transition: all 0.2s;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.15);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.num-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  height: 64px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.num-btn:active {
  background: #e2e8f0;
}

/* Captura de Foto con Cámara */
.camera-box {
  width: 100%;
  border: 2px dashed #93c5fd;
  background: var(--primary-light);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.camera-box:hover {
  background: #dbeafe;
}

.camera-box svg {
  stroke: var(--primary);
  margin-bottom: 6px;
}

.preview-container {
  display: none;
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}

.preview-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.btn-remove-photo {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Lista de cajas */
.box-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.box-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.badge-open {
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.badge-closed {
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

/* Lista de productos dentro de caja */
.product-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.product-row:last-child {
  border-bottom: none;
}

.thumb-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f1f5f9;
}

.product-row-info {
  flex: 1;
}

.product-row-ref {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.product-row-qty {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* Notificación flotante */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success-dark);
}

/* Barra de pestañas inferiores / acciones */
.action-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
