    :root {
      --primary: #2563eb;
      --primary-dark: #1d4ed8;
      --success: #16a34a;
      --success-dark: #15803d;
      --danger: #dc2626;
      --bg: #f1f5f9;
      --surface: #ffffff;
      --text: #1e293b;
      --text-muted: #64748b;
      --border: #e2e8f0;
      --radius: 12px;
      --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      justify-content: center;
    }

    .app-container {
      width: 100%;
      max-width: 420px;
      min-height: 100vh;
      background: var(--surface);
      position: relative;
      box-shadow: var(--shadow);
    }

    /* Ocultar pantallas: display:none por defecto.
       La clase "activa" las muestra con display:flex. */
    .vista {
      display: none;
      flex-direction: column;
      min-height: 100vh;
    }

    .vista.activa { display: flex; }

    .login-header {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: white;
      padding: 48px 24px 40px;
      text-align: center;
      border-radius: 0 0 32px 32px;
    }

    .login-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
    .login-header p { font-size: 0.9rem; opacity: 0.85; }

    .login-form {
      padding: 32px 24px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .btn-texto {
      background: none;
      border: none;
      color: var(--primary);
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      padding: 4px 0;
    }

    #registro-turnstile {
      margin: 16px 0;
    }

    .campo-trampa {
      position: absolute;
      left: -10000px;
      width: 1px;
      height: 1px;
      overflow: hidden;
    }

    .campo label {
      display: block;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .campo select,
    .campo input {
      width: 100%;
      padding: 14px 16px;
      border: 2px solid var(--border);
      border-radius: var(--radius);
      font-size: 1rem;
      background: var(--bg);
    }

    .campo select:focus,
    .campo input:focus {
      outline: none;
      border-color: var(--primary);
    }

    .btn-principal {
      width: 100%;
      padding: 16px;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
    }

    .mensaje-error {
      color: var(--danger);
      font-size: 0.85rem;
      text-align: center;
      display: none;
    }

    .mensaje-error.visible { display: block; }

    .top-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 10;
    }

    .top-bar h2 { font-size: 1.1rem; font-weight: 700; }

    .btn-logout {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      padding: 8px 14px;
      border-radius: 8px;
      font-size: 0.8rem;
      cursor: pointer;
    }

    .vendedor-contenido {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 16px 20px 100px;
    }

    .btn-escanear {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      width: 100%;
      padding: 16px;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      margin-bottom: 20px;
    }

    .btn-escanear svg { width: 22px; height: 22px; }

    .btn-escanear.escaneando { background: var(--danger); }

    /* Contenedor de camara: oculto hasta activar el escaneo */
    #lector-camara {
      display: none;
      width: 100%;
      min-height: 200px;
      border-radius: var(--radius);
      overflow: hidden;
      margin-bottom: 8px;
      border: 2px solid var(--border);
      background: #0f172a;
    }

    #lector-camara.activo { display: block; }

    #lector-camara-admin {
      display: none;
      width: 100%;
      min-height: 200px;
      border-radius: var(--radius);
      overflow: hidden;
      margin-bottom: 8px;
      border: 2px solid var(--border);
      background: #0f172a;
    }

    #lector-camara-admin.activo { display: block; }

    #camara-ayuda-admin { display: none; }
    #camara-ayuda-admin.activo { display: block; }

    #lector-camara video {
      width: 100% !important;
      border-radius: var(--radius);
      object-fit: cover;
    }

    #lector-camara img { display: none !important; }

    #lector-camara #qr-shaded-region {
      border-color: rgba(37, 99, 235, 0.6) !important;
    }

    .camara-ayuda {
      display: none;
      text-align: center;
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-bottom: 16px;
    }

    .camara-ayuda.activo { display: block; }

    /* Entrada manual de codigo de barras */
    .busqueda-manual {
      display: flex;
      gap: 8px;
      margin-bottom: 16px;
    }

    .busqueda-manual input {
      flex: 1;
      padding: 12px 14px;
      border: 2px solid var(--border);
      border-radius: var(--radius);
      font-size: 0.95rem;
      background: var(--bg);
    }

    .busqueda-manual input:focus {
      outline: none;
      border-color: var(--primary);
    }

    .btn-buscar {
      padding: 12px 16px;
      background: var(--bg);
      border: 2px solid var(--border);
      border-radius: var(--radius);
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      color: var(--text);
    }

    .carrito-titulo {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 12px;
    }

    .carrito-lista { list-style: none; flex: 1; }

    .carrito-vacio {
      text-align: center;
      color: var(--text-muted);
      padding: 40px 0;
      font-size: 0.9rem;
    }

    .carrito-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
    }

    .carrito-item-info h4 { font-size: 0.95rem; margin-bottom: 2px; }
    .carrito-item-info span { font-size: 0.8rem; color: var(--text-muted); }
    .carrito-item-precio { font-weight: 700; color: var(--primary); }

    .btn-quitar {
      background: none;
      border: none;
      color: var(--danger);
      font-size: 1.2rem;
      cursor: pointer;
      padding: 4px 8px;
      margin-left: 8px;
    }

    .barra-venta {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 420px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      padding: 16px 20px;
      display: flex;
      align-items: center;
      gap: 12px;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    }

    .total-label { font-size: 0.8rem; color: var(--text-muted); }
    .total-monto { font-size: 1.3rem; font-weight: 700; }

    .btn-completar {
      flex: 1;
      padding: 16px;
      background: var(--success);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
    }

    .btn-completar:disabled { opacity: 0.5; cursor: not-allowed; }

    .admin-contenido {
      flex: 1;
      padding: 16px 20px 32px;
      overflow-y: auto;
    }

    .seccion { margin-bottom: 28px; }

    .seccion-titulo {
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 14px;
    }

    .form-producto {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .form-producto input {
      width: 100%;
      padding: 12px 14px;
      border: 2px solid var(--border);
      border-radius: var(--radius);
      font-size: 0.95rem;
      background: var(--bg);
    }

    .btn-agregar {
      padding: 14px;
      background: var(--primary);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
    }

    .reporte-card {
      background: linear-gradient(135deg, #059669, #047857);
      color: white;
      border-radius: var(--radius);
      padding: 24px;
    }

    .reporte-card .reporte-label { font-size: 0.85rem; opacity: 0.85; margin-bottom: 4px; }
    .reporte-card .reporte-monto { font-size: 2rem; font-weight: 700; margin-bottom: 16px; }
    .reporte-stats { display: flex; gap: 16px; }

    .reporte-stat {
      flex: 1;
      background: rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 12px;
      text-align: center;
    }

    .reporte-stat .stat-valor { font-size: 1.2rem; font-weight: 700; }
    .reporte-stat .stat-label { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }

    .productos-lista { list-style: none; }

    .producto-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.9rem;
    }

    .producto-item .prod-stock { color: var(--text-muted); font-size: 0.8rem; }

    .toast {
      position: fixed;
      bottom: 90px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      background: var(--text);
      color: white;
      padding: 12px 24px;
      border-radius: 8px;
      font-size: 0.9rem;
      opacity: 0;
      transition: opacity 0.3s, transform 0.3s;
      z-index: 100;
      pointer-events: none;
    }

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

    /* Modal de venta exitosa */
    .modal-exito {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.55);
      z-index: 200;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    .modal-exito.visible {
      display: flex;
    }

    .modal-contenido {
      background: var(--surface);
      border-radius: 16px;
      padding: 32px 24px;
      text-align: center;
      max-width: 320px;
      width: 100%;
      box-shadow: var(--shadow);
    }

    .modal-icono {
      width: 64px;
      height: 64px;
      margin: 0 auto 16px;
      background: #dcfce7;
      color: var(--success);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2rem;
      font-weight: 700;
    }

    .modal-contenido h3 {
      font-size: 1.2rem;
      margin-bottom: 8px;
      color: var(--text);
    }

    .modal-contenido p {
      font-size: 0.9rem;
      color: var(--text-muted);
      margin-bottom: 20px;
    }

    .btn-modal {
      width: 100%;
      padding: 14px;
      background: var(--success);
      color: white;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
    }

    .btn-completar.cargando {
      opacity: 0.7;
      pointer-events: none;
    }

/* ============================================================
   SECCIONES DEL PANEL DE ADMINISTRADOR
   ============================================================ */

.admin-contenido .seccion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.admin-contenido .seccion-titulo {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.mensaje-producto {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.mensaje-producto.exito {
  background: #e8f5e9;
  color: #2e7d32;
}

.mensaje-producto.aviso {
  background: #fff8e1;
  color: #8a6d1d;
}

.mensaje-producto.error {
  background: #ffebee;
  color: #c62828;
}