* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background: #f3f4f6; min-height: 100vh; display: flex; justify-content: center; padding: 12px; }
#app { max-width: 420px; width: 100%; background: white; border-radius: 24px; padding: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.screen { display: none; }
.screen.active { display: block; }
.opcion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.opcion-card { background: #f8fafc; border-radius: 16px; padding: 24px 12px; text-align: center; cursor: pointer; transition: all 0.3s; border: 2px solid transparent; }
.opcion-card:hover { border-color: #3b82f6; background: #f0f9ff; }
.opcion-card .icono { font-size: 48px; margin-bottom: 12px; }
.opcion-card h3 { font-size: 18px; color: #1f2937; margin-bottom: 4px; }
.opcion-card p { font-size: 14px; color: #6b7280; }
.input-group { margin-bottom: 16px; text-align: left; }
.input-group label { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; font-size: 14px; }
.input-group input, .input-group select { width: 100%; padding: 14px 16px; border: 1.5px solid #e5e7eb; border-radius: 12px; font-size: 16px; background: #f9fafb; }
.input-group input:focus, .input-group select:focus { outline: none; border-color: #3b82f6; background: white; }
.btn { width: 100%; padding: 14px; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; margin-bottom: 10px; }
.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { background: #ef4444; color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-secondary { background: transparent; color: #3b82f6; border: 1.5px solid #3b82f6; }
.btn-small { padding: 8px 12px; font-size: 14px; width: auto; margin: 0; }
.btn-volver-inicio { background: #6b7280; color: white; border: none; padding: 8px 16px; border-radius: 20px; font-size: 14px; cursor: pointer; margin-bottom: 16px; }
.btn-scanner { background: #3b82f6; color: white; border: none; border-radius: 12px; width: 48px; height: 48px; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.header h2 { font-size: 18px; color: #1f2937; }
.header-right { display: flex; gap: 6px; align-items: center; }
.user-email { color: #6b7280; font-size: 12px; background: #f3f4f6; padding: 5px 10px; border-radius: 20px; }
.btn-logout { background: #ef4444; color: white; border: none; padding: 6px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid #e5e7eb; padding-bottom: 6px; overflow-x: auto; }
.tab { flex: 1; padding: 8px 6px; text-align: center; background: none; border: none; font-size: 13px; font-weight: 500; color: #6b7280; cursor: pointer; border-radius: 8px; white-space: nowrap; }
.tab.active { background: #3b82f6; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.lista-clientes { max-height: 450px; overflow-y: auto; }
.cliente-item { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; margin-bottom: 10px; cursor: pointer; }
.cliente-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cliente-nombre { font-weight: 600; font-size: 15px; color: #1f2937; }
.cliente-estado { font-size: 11px; padding: 3px 7px; border-radius: 10px; background: #10b981; color: white; }
.cliente-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; font-size: 12px; color: #6b7280; }
.cliente-card { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.tipo-prestamo { font-size: 11px; padding: 3px 7px; border-radius: 10px; background: #f59e0b; color: white; margin-left: 6px; }
.tipo-prestamo.diario { background: #3b82f6; }
.cliente-monto { font-weight: 700; color: #059669; }
.cliente-info { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #6b7280; margin-top: 6px; }
.btn-pagar { background: #3b82f6; color: white; border: none; padding: 7px 14px; border-radius: 8px; font-weight: 500; cursor: pointer; font-size: 13px; }
.resumen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 20px; }
.resumen-card { background: #f8fafc; padding: 10px; border-radius: 10px; text-align: center; }
.resumen-card .label { font-size: 11px; color: #64748b; margin-bottom: 3px; }
.resumen-card .value { font-size: 16px; font-weight: 700; color: #0f172a; }
.buscador { position: relative; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }
.buscador input { flex: 1; padding: 12px 14px; border: 1.5px solid #e5e7eb; border-radius: 12px; font-size: 15px; background: #f9fafb; }
.resultados-busqueda { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #e5e7eb; border-radius: 12px; margin-top: 4px; max-height: 250px; overflow-y: auto; display: none; z-index: 10; }
.resultado-item { padding: 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.resultado-item:hover { background: #f9fafb; }
.resultado-item .nombre { font-weight: 600; color: #1f2937; font-size: 14px; }
.resultado-item .detalle { font-size: 12px; color: #6b7280; margin-top: 2px; }
.acciones-rapidas { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.btn-accion { flex: 1; padding: 12px; border: none; border-radius: 12px; font-weight: 600; font-size: 13px; cursor: pointer; min-width: 100px; }
.btn-verde { background: #10b981; color: white; }
.btn-azul { background: #3b82f6; color: white; }
.btn-naranja { background: #f59e0b; color: white; }
.formulario { display: none; }
.formulario.active { display: block; }
.form-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.btn-volver { background: none; border: none; font-size: 22px; cursor: pointer; color: #6b7280; }
.form-titulo { font-size: 18px; font-weight: 600; color: #1f2937; }
.seccion-prestamo { background: #f8fafc; border-radius: 12px; padding: 14px; margin: 16px 0; border: 1px solid #e5e7eb; }
.seccion-prestamo h4 { margin-bottom: 12px; color: #1f2937; font-size: 15px; }
.perfil-cliente { display: none; }
.perfil-cliente.active { display: block; }
.info-cliente { background: #f8fafc; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.info-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.btn-qr { background: #3b82f6; color: white; border: none; border-radius: 8px; padding: 7px 11px; font-size: 13px; cursor: pointer; }
.switch-container { display: flex; align-items: center; gap: 6px; background: #f3f4f6; padding: 6px 10px; border-radius: 30px; }
.switch-label { font-size: 13px; color: #4b5563; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked+.slider { background-color: #f59e0b; }
input:checked+.slider:before { transform: translateX(22px); }
.info-row { display: flex; margin-bottom: 6px; font-size: 13px; }
.info-label { width: 75px; color: #6b7280; font-size: 13px; }
.info-value { color: #1f2937; font-weight: 500; font-size: 13px; }
.consulta-container { padding: 12px 0; }
.consulta-header { text-align: center; margin-bottom: 20px; }
.consulta-header h2 { font-size: 22px; color: #1f2937; margin-bottom: 6px; }
.qr-cliente { background: #f8fafc; border-radius: 16px; padding: 16px; text-align: center; margin-bottom: 16px; }
.qr-cliente canvas { margin: 8px auto; width: 180px; height: 180px; }
.qr-acciones { display: flex; gap: 6px; margin-top: 10px; }
.qr-acciones button { flex: 1; padding: 10px; border: none; border-radius: 8px; font-weight: 500; cursor: pointer; font-size: 13px; }
.btn-whatsapp { background: #25D366; color: white; }
.progreso-container { background: #f8fafc; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.progreso-item { display: flex; justify-content: space-between; margin-bottom: 10px; padding: 6px 0; border-bottom: 1px solid #e5e7eb; font-size: 13px; }
.progreso-label { color: #6b7280; font-size: 13px; }
.progreso-value { font-weight: 600; color: #1f2937; }
.progreso-barra { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 10px 0; }
.progreso-lleno { height: 100%; background: #10b981; width: 0%; }
.historial-lista { list-style: none; max-height: 180px; overflow-y: auto; }
.historial-item { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.prestamo-card { background: #f8fafc; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.progreso-prestamo { margin: 12px 0; }
.barra-progreso { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 6px 0; }
.progreso { height: 100%; background: #10b981; width: 0%; }
.historial-pagos { list-style: none; }
.acciones-cliente { display: flex; gap: 6px; margin-top: 12px; }
.config-section { background: #f8fafc; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.config-section h4 { margin-bottom: 10px; color: #1f2937; font-size: 15px; }
.config-option { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 6px 0; border-bottom: 1px solid #e5e7eb; font-size: 13px; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #1f2937; color: white; padding: 16px 24px; border-radius: 16px; font-size: 16px; font-weight: 600; display: none; z-index: 1000; box-shadow: 0 10px 25px rgba(0,0,0,0.3); min-width: 280px; text-align: center; border: 2px solid #3b82f6; }
.toast.show { display: block; animation: slideUp 0.3s ease; }
.toast.success { background: #10b981; border-color: #059669; }
.toast.error { background: #ef4444; border-color: #dc2626; }
.toast.info { background: #3b82f6; border-color: #2563eb; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.total-general { background: #3b82f6; color: white; padding: 14px; border-radius: 12px; margin-bottom: 16px; text-align: center; }
.backup-info { font-size: 11px; color: #6b7280; margin-top: 6px; text-align: center; }
.resumen-profesional { background: white; border-radius: 14px; padding: 16px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.resumen-header { text-align: center; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px solid #e5e7eb; }
.resumen-header h3 { font-size: 20px; color: #1f2937; margin-bottom: 6px; }
.resumen-header .fecha { color: #6b7280; font-size: 13px; }
.resumen-tabla { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 12px; }
.resumen-tabla th { background: #f3f4f6; padding: 10px; text-align: left; font-size: 12px; color: #374151; }
.resumen-tabla td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; font-size: 12px; }
.resumen-footer { margin-top: 16px; padding-top: 14px; border-top: 2px solid #e5e7eb; text-align: right; font-size: 13px; }
.resumen-footer .gran-total { font-size: 16px; font-weight: 700; color: #059669; }
.modal-qr { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; z-index: 2000; }
.modal-qr.active { display: flex; }
.modal-contenido { background: white; border-radius: 24px; padding: 22px; width: 280px; text-align: center; }
.modal-contenido h3 { margin-bottom: 14px; color: #1f2937; }
#qrCanvas { margin: 12px auto; width: 180px; height: 180px; }
.modal-botones { display: flex; gap: 6px; margin-top: 12px; }
.modal-botones button { flex: 1; padding: 10px; border: none; border-radius: 8px; font-weight: 500; cursor: pointer; font-size: 13px; }
.btn-cerrar { background: #6b7280; color: white; }
.scanner-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: black; z-index: 4000; flex-direction: column; align-items: center; justify-content: center; }
.scanner-modal.active { display: flex; }
.scanner-video { width: 100%; max-width: 420px; height: auto; border-radius: 12px; }
.scanner-canvas { display: none; }
.btn-cerrar-scanner { position: absolute; top: 16px; right: 16px; background: #ef4444; color: white; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 24px; cursor: pointer; z-index: 4001; display: flex; align-items: center; justify-content: center; }
.offline-message { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #ef4444; color: white; padding: 24px; border-radius: 16px; text-align: center; font-weight: 600; font-size: 18px; z-index: 3000; box-shadow: 0 10px 25px rgba(0,0,0,0.3); display: none; }
.offline-message.show { display: block; }
.scan-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 220px; height: 220px; border: 3px solid #10b981; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); z-index: 4001; display: none; }
.scan-animation { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.8); color: white; padding: 18px; border-radius: 40px; font-size: 20px; z-index: 4002; display: none; align-items: center; gap: 10px; }
.scan-animation.show { display: flex; }
.spinner { width: 26px; height: 26px; border: 3px solid #f3f3f3; border-top: 3px solid #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.validation-error { border-color: #ef4444 !important; background-color: #fef2f2 !important; }
.error-message { color: #ef4444; font-size: 11px; margin-top: 3px; display: none; }
.error-message.show { display: block; }
.pdf-spinner { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 18px; border-radius: 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); z-index: 5000; align-items: center; gap: 10px; }
.pdf-spinner.show { display: flex; }
.pago-alerta { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #10b981; color: white; padding: 30px 40px; border-radius: 24px; text-align: center; z-index: 5000; font-size: 18px; font-weight: 700; box-shadow: 0 20px 40px rgba(0,0,0,0.4); display: none; }
.pago-alerta.show { display: block; animation: popIn 0.4s ease; }
.pago-alerta .monto { font-size: 36px; margin: 10px 0; }
.pago-alerta .cliente { font-size: 16px; opacity: 0.9; }
.pago-alerta .hora { font-size: 13px; opacity: 0.7; margin-top: 6px; }
@keyframes popIn { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 70% { transform: translate(-50%, -50%) scale(1.1); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.buscador-inicio { position: relative; max-width: 320px; margin: 0 auto 16px; }
.buscador-inicio input { width: 100%; padding: 15px 18px; border: 2px solid #e5e7eb; border-radius: 14px; font-size: 15px; background: #f9fafb; text-align: center; }
.buscador-inicio input:focus { outline: none; border-color: #3b82f6; background: white; }
.resultados-busqueda-inicio { background: white; border: 1px solid #e5e7eb; border-radius: 14px; margin-top: 6px; max-height: 260px; overflow-y: auto; display: none; text-align: left; }