* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #2d7a3e;
    --primary-dark: #1f5629;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #dee2e6;
    --text: #333;
}
html, body { width: 100%; height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--light); color: var(--text); overflow: hidden; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.pantalla-formulario { display: flex; flex-direction: column; width: 100%; height: 100%; background: white; }
.header-simple { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 20px; text-align: center; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.header-simple h1 { font-size: 20px; font-weight: 600; margin: 0; }
.form-container { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 30px 20px; gap: 20px; }
.form-container h2 { font-size: 18px; color: var(--primary); margin-bottom: 10px; }
.input-field { width: 100%; max-width: 300px; padding: 12px 15px; border: 1px solid var(--border); border-radius: 6px; font-size: 16px; }
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45, 122, 62, 0.1); }
.btn { padding: 12px 24px; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--primary); color: white; width: 100%; max-width: 300px; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(45, 122, 62, 0.3); }
.btn-success { background: var(--success); color: white; width: 100%; max-width: 300px; }
.btn-success:hover { background: #218838; }
.btn-opcion { background: var(--info); color: white; width: 100%; max-width: 300px; padding: 15px 20px; font-size: 16px; }
.btn-opcion:hover { background: #138496; }
.pantalla-captura { display: flex; flex-direction: column; width: 100%; height: 100%; background: #000; }
.header-captura { background: rgba(45, 122, 62, 0.95); color: white; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; font-size: 14px; font-weight: 500; }
.badge { background: rgba(255, 255, 255, 0.2); padding: 4px 12px; border-radius: 12px; font-size: 12px; }
.video-principal { position: relative; flex: 1; width: 100%; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.video-principal video, .video-principal img, .video-principal canvas { width: 100%; height: 100%; object-fit: cover; }
.estado-detector { position: absolute; bottom: 20px; left: 20px; right: 20px; background: rgba(0, 0, 0, 0.7); color: #17a2b8; padding: 10px 15px; border-radius: 6px; font-size: 13px; text-align: center; font-weight: 500; }
.controles-captura { display: flex; gap: 10px; padding: 12px; background: rgba(0, 0, 0, 0.9); flex-shrink: 0; flex-wrap: wrap; justify-content: center; }
.btn-control { padding: 10px 16px; background: var(--gray); color: white; font-size: 13px; flex: 1; min-width: 90px; max-width: 120px; }
.btn-capturar { background: var(--warning); color: #333; font-weight: 700; flex: 1.5; }
.btn-capturar:active { transform: scale(0.95); }
.btn-volver { background: var(--gray); }
.btn-descartar { background: var(--danger); }
.btn-confirmar { background: var(--success); }
.btn-control:hover { opacity: 0.9; }
.galeria-container { flex: 1; overflow-y: auto; padding: 20px; }
.galeria-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.galeria-item { position: relative; aspect-ratio: 4/3; background: #f0f0f0; border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent; }
.galeria-item img { width: 100%; height: 100%; object-fit: cover; }
.galeria-item .numero { position: absolute; bottom: 4px; left: 4px; background: rgba(45, 122, 62, 0.9); color: white; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.galeria-item .btn-eliminar { position: absolute; top: 4px; right: 4px; background: rgba(220, 53, 69, 0.9); color: white; border: none; padding: 4px 8px; border-radius: 4px; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.galeria-item:hover .btn-eliminar { opacity: 1; }
.progress-container { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 20px 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); width: 0%; transition: width 0.3s; }
.mensaje { padding: 12px 15px; border-radius: 6px; font-size: 13px; text-align: center; min-height: 20px; }
.mensaje.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.mensaje.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.exito-box { text-align: center; gap: 20px; }
.exito-box p { font-size: 16px; color: var(--gray); white-space: pre-wrap; }
.error-box { text-align: center; gap: 20px; }
.error-box p { color: var(--danger); font-size: 16px; }
@media (max-width: 768px) {
    .header-simple h1 { font-size: 18px; }
    .btn-opcion { padding: 12px 16px; font-size: 15px; }
    .form-container { padding: 20px 16px; }
    .controles-captura { padding: 10px; gap: 8px; }
    .btn-control { min-width: 70px; max-width: 100%; padding: 9px 12px; font-size: 12px; }
    .header-captura { padding: 10px 12px; font-size: 13px; }
    .estado-detector { font-size: 12px; bottom: 12px; left: 12px; right: 12px; padding: 8px 12px; }
}
@media (max-height: 600px) {
    .header-simple { padding: 12px; }
    .header-simple h1 { font-size: 16px; }
    .form-container { padding: 15px; gap: 12px; }
    .input-field { padding: 10px 12px; font-size: 14px; }
    .btn { padding: 10px 16px; font-size: 13px; }
}
@media (orientation: landscape) and (max-height: 500px) {
    .header-captura { padding: 8px 10px; }
    .controles-captura { padding: 8px; gap: 6px; }
    .btn-control { padding: 8px 10px; font-size: 11px; }
}
