/* ============================================================
   TopoApp — Ajustes para celular (se carga al final del panel)
   Corrige patrones que se repetían en muchas pantallas: zoom de iOS
   al tocar campos, botones de encabezado que se partían en dos líneas,
   indicadores que ocupaban un renglón cada uno y textos largos que se
   salían de su tarjeta. Gestos y botón «Panel»: assets/js/movil.js.
   ============================================================ */

@media (max-width: 767.98px) {
    /* iOS amplía la página al tocar un campo con letra menor a 16 px y la deja descuadrada */
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=submit]):not([type=button]),
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Encabezado de página: título arriba y acciones debajo, en una sola línea y del mismo alto */
    .page-header { flex-wrap: wrap; row-gap: 10px; }
    .page-header:has(> .btn, > a.btn, > .d-flex .btn, > div > .btn) > div:first-child { flex: 1 1 100%; min-width: 0; }
    .page-header > .btn,
    .page-header > a.btn { flex: 1 1 0; justify-content: center; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
    .page-header > .d-flex:not(:first-child),
    .page-header > div:not(:first-child):has(> .btn) { flex: 1 1 100%; flex-wrap: nowrap !important; gap: 8px; }
    .page-header > .d-flex:not(:first-child) > .btn,
    .page-header > div:not(:first-child) > .btn { flex: 1 1 0; justify-content: center; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
    .page-header .btn .me-1 { margin-right: 0 !important; }

    /* Indicadores de pedidos: tres compactos en una fila, no uno por renglón */
    .pedidos-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px; }
    .pedidos-toolbar-stat { min-height: 0; padding: 11px 10px 9px; border-radius: 14px; }
    .pedidos-toolbar-label { font-size: .68rem; line-height: 1.2; margin-bottom: 2px; }
    .pedidos-toolbar-value { font-size: 1rem; }
    .pedidos-toolbar-stat .badge { font-size: .6rem; padding: 2px 5px; margin: 3px 0 0 !important; align-self: flex-start; }

    /* Textos largos (correos, enlaces, números de guía) se acomodan dentro de su tarjeta */
    [class*="-meta"] > span,
    a[href^="mailto:"],
    .text-break-movil { min-width: 0; overflow-wrap: anywhere; }

    /* Punto de venta: el atajo de teclado «/» no sirve en el celular y le quitaba espacio al buscador */
    .pos-buscar kbd { display: none; }
    .pos-buscar input { padding-right: 12px !important; }

    /* Nada más ancho que la pantalla */
    img, video, iframe, canvas { max-width: 100%; }
    .page-content { overflow-wrap: break-word; }
}

/* ── Gestos de la app instalada (assets/js/movil.js) ───────── */
.topo-gesto {
    position: fixed; z-index: 2000; pointer-events: none;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff; color: #E8720C;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
    opacity: 0; transition: opacity .12s;
    font-size: 1.35rem;
}
.topo-gesto.is-listo { background: #E8720C; color: #fff; }
.topo-gesto--recargar { left: 50%; top: 0; margin-left: -22px; }
.topo-gesto--recargar.is-girando i { animation: topoGira .7s linear infinite; }
@keyframes topoGira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .topo-gesto--recargar.is-girando i { animation: none; } }

@media (max-width: 767.98px) {
    /* Categorías: cada una en su renglón con el botón de borrar alineado a la derecha */
    .fop-chips > .fop-chip { flex: 1 1 100%; }
    .fop-chips > .fop-chip > form { margin-left: auto; }
}

@media (max-width: 767.98px) {
    /* Punto de venta: botones de la barra más angostos para que el buscador respire */
    .pos-barra { gap: 6px; }
    .pos-barra .pos-btn-sec { padding: 0 11px; min-width: 44px; }
    .pos-buscar input { padding-left: 38px !important; }
    .pos-buscar > i { left: 12px; }
}

@media (max-width: 767.98px) {
    /* Filtros de pedidos: listas en dos columnas parejas, el embudo y «más antiguos» en la última fila */
    .pedidos-filtros { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pedidos-filtros > select { max-width: none !important; width: 100%; }
    .pedidos-filtros > .btn { justify-self: start; }
    .pedidos-filtros > label { grid-column: 1 / -1; }
}
