/* ZIVO · Aprobaciones de pagos · jerarquía de filtros móvil v3
   Solo móvil. Se carga después de los estilos responsive existentes. */

@media (max-width: 768px) {
  app-aprobaciones-pagos .contenedor-principal {
    background: #edf2f7 !important;
  }

  /* ===== Tarjeta principal de búsqueda ===== */
  app-aprobaciones-pagos .busqueda-container {
    gap: 0 !important;
    margin-bottom: 10px !important;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toolbar,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 7px 9px 7px 11px;
    border: 1px solid #cbd5e1;
    border-left: 3px solid #2563eb;
    border-radius: 12px 12px 0 0;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toolbar__copy,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar__copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toolbar__copy strong,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar__copy strong {
    color: #172033;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.2;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toolbar__copy small,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar__copy small {
    overflow: hidden;
    color: #64748b;
    font-size: 0.57rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toggle,
  app-aprobaciones-pagos .zivo-mobile-quick-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 7px 0 9px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font: inherit;
    font-size: 0.61rem;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toggle .material-icons,
  app-aprobaciones-pagos .zivo-mobile-quick-toggle .material-icons {
    font-size: 16px;
    transition: transform 150ms ease;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toggle[aria-expanded="true"] .material-icons,
  app-aprobaciones-pagos .zivo-mobile-quick-toggle[aria-expanded="true"] .material-icons {
    transform: rotate(180deg);
  }

  app-aprobaciones-pagos .busqueda-box {
    margin: 0 0 10px !important;
    padding: 8px !important;
    border: 1px solid #cbd5e1 !important;
    border-top: 0 !important;
    border-radius: 0 0 12px 12px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07) !important;
  }

  /* Siempre visibles: tipo+factura, proveedor y proyecto. */
  app-aprobaciones-pagos .busqueda-box > .busqueda-input:nth-child(1) {
    grid-column: 1 !important;
  }

  app-aprobaciones-pagos .busqueda-box > .busqueda-input:nth-child(2) {
    grid-column: 2 !important;
  }

  app-aprobaciones-pagos .busqueda-box > .busqueda-input:nth-child(3),
  app-aprobaciones-pagos .busqueda-box > .busqueda-input:nth-child(4) {
    grid-column: 1 / -1 !important;
  }

  /* Área, forma de pago y fechas manuales permanecen ocultas hasta pedirlas. */
  app-aprobaciones-pagos .busqueda-box > .zivo-mobile-advanced-filter {
    display: none !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .zivo-mobile-advanced-filter {
    display: block !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .busqueda-input:nth-child(5) {
    grid-column: 1 !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .busqueda-input:nth-child(6) {
    grid-column: 2 !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .busqueda-input:nth-child(7) {
    grid-column: 1 !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .busqueda-input:nth-child(8) {
    grid-column: 2 !important;
  }

  app-aprobaciones-pagos .busqueda-box.zivo-mobile-advanced-open > .zivo-mobile-advanced-filter.fecha {
    display: flex !important;
  }

  /* ===== Estado: tarjeta claramente independiente ===== */
  app-aprobaciones-pagos .busqueda-estados {
    position: relative;
    margin: 0 0 10px !important;
    padding: 7px !important;
    border: 1px solid #cbd5e1 !important;
    border-top: 3px solid #64748b !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.065) !important;
  }

  app-aprobaciones-pagos .busqueda-estados::before {
    content: "Estado de la solicitud";
    grid-column: 1 / -1;
    display: block;
    padding: 0 2px 2px;
    color: #475569;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  /* ===== Fechas rápidas: plegables; el total nunca desaparece ===== */
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar {
    border-left-color: #0f766e;
  }

  app-aprobaciones-pagos .zivo-mobile-quick-toggle {
    border-color: #99f6e4;
    background: #f0fdfa;
    color: #0f766e;
  }

  app-aprobaciones-pagos .filtros-rapidos {
    margin: 0 0 10px !important;
    padding: 7px !important;
    border: 1px solid #cbd5e1 !important;
    border-top: 0 !important;
    border-radius: 0 0 12px 12px !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.065) !important;
  }

  app-aprobaciones-pagos .filtros-rapidos:not(.zivo-mobile-quick-open) {
    grid-template-columns: 1fr !important;
  }

  app-aprobaciones-pagos .filtros-rapidos:not(.zivo-mobile-quick-open) > button {
    display: none !important;
  }

  app-aprobaciones-pagos .filtros-rapidos .suma-total {
    min-height: 34px !important;
    border-color: #86efac !important;
    background: #f0fdf4 !important;
    color: #166534 !important;
    font-size: 0.68rem !important;
    font-weight: 800 !important;
  }

  /* ===== Paginación como otra tarjeta ===== */
  app-aprobaciones-pagos .pagination {
    margin: 0 0 11px !important;
    padding: 6px !important;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.055);
  }

  /* ===== Separación inequívoca entre solicitudes ===== */
  app-aprobaciones-pagos .borde-tabla {
    padding: 8px !important;
    border: 1px solid #d1dbe7 !important;
    border-radius: 14px !important;
    background: #e5ecf4 !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.035) !important;
  }

  app-aprobaciones-pagos tbody {
    gap: 12px !important;
  }

  app-aprobaciones-pagos tbody > tr {
    border: 1px solid #c5d1df !important;
    border-left-width: 4px !important;
    border-radius: 11px !important;
    background: #ffffff !important;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.09) !important;
  }

  app-aprobaciones-pagos tbody td[data-label="Acciones"] {
    border-top: 1px solid #e2e8f0 !important;
    background: #f7f9fc !important;
  }
}

@media (max-width: 380px) {
  app-aprobaciones-pagos .zivo-mobile-filter-toolbar,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar {
    padding-right: 7px;
    padding-left: 9px;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toolbar__copy small,
  app-aprobaciones-pagos .zivo-mobile-quick-toolbar__copy small {
    max-width: 180px;
  }

  app-aprobaciones-pagos .zivo-mobile-filter-toggle,
  app-aprobaciones-pagos .zivo-mobile-quick-toggle {
    padding-right: 5px;
    padding-left: 7px;
  }
}
