/* P12.1 · Historial desktop: búsqueda + filtros plegables desde cabecera */
.history-tools-desktop-toggle {
  display: none;
}

@media (min-width: 980px) {
  #fullHistoryModal .modal-header {
    grid-template-columns: minmax(210px, 1fr) minmax(206px, 232px) auto 38px !important;
  }

  #fullHistoryModal #fullHistoryModalTitle {
    grid-column: 1 !important;
  }

  #fullHistoryModal .history-tools-desktop-toggle {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 8px;
    min-width: 206px;
    min-height: 44px;
    padding: 5px 8px 5px 6px;
    border: 1px solid rgba(110, 231, 183, 0.48);
    border-radius: 14px;
    background:
      radial-gradient(
        circle at 12% 15%,
        rgba(52, 211, 153, 0.34),
        transparent 44%
      ),
      linear-gradient(135deg, rgba(6, 78, 59, 0.98), rgba(15, 23, 42, 0.98));
    color: #ecfdf5;
    box-shadow:
      0 8px 22px rgba(2, 6, 23, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition:
      transform 150ms ease,
      border-color 150ms ease,
      box-shadow 150ms ease,
      filter 150ms ease;
  }

  #fullHistoryModal .history-tools-desktop-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 243, 208, 0.85);
    filter: brightness(1.08);
    box-shadow:
      0 10px 28px rgba(2, 6, 23, 0.42),
      0 0 0 3px rgba(52, 211, 153, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }

  #fullHistoryModal .history-tools-desktop-toggle:active {
    transform: translateY(0);
  }

  #fullHistoryModal .history-tools-desktop-toggle:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.72);
    outline-offset: 3px;
  }

  #fullHistoryModal .history-tools-desktop-toggle__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 22px;
    line-height: 1;
  }

  #fullHistoryModal .history-tools-desktop-toggle__text {
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.08;
    letter-spacing: 0.015em;
    text-align: left;
  }

  #fullHistoryModal .history-tools-desktop-toggle__state {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #d1fae5;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1;
  }

  #fullHistoryModal .history-tools-desktop-toggle.is-collapsed {
    border-color: rgba(96, 165, 250, 0.58);
    background:
      radial-gradient(
        circle at 12% 15%,
        rgba(96, 165, 250, 0.32),
        transparent 44%
      ),
      linear-gradient(135deg, rgba(30, 64, 175, 0.96), rgba(15, 23, 42, 0.98));
  }

  #fullHistoryModal
    .history-tools-desktop-toggle.is-collapsed
    .history-tools-desktop-toggle__state {
    color: #dbeafe;
  }

  #fullHistoryModal .history-header-actions {
    grid-column: 3 !important;
  }

  #fullHistoryModal #closeFullHistoryBtn.buttonclear {
    grid-column: 4 !important;
  }

  #fullHistoryModal.history-tools-collapsed #historySearchPanel {
    display: none !important;
  }
}

#statsHistoryModal .stats-filtros-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

#statsHistoryModal .stats-filtros-titulo,
#statsHistoryModal .stats-filtros-resumen {
  margin: 0;
}

#statsHistoryModal .stats-filtros-resumen {
  flex: 1 1 36px;
}

#statsHistoryModal .stats-filtros-body[hidden] {
  display: none !important;
}

#statsHistoryModal .stats-filtros-toggle {
  display: none;
}

@media (max-width: 768px) {
  #statsHistoryModal .stats-filtros {
    gap: 0.55rem;
  }

  #statsHistoryModal .stats-filtros-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  #statsHistoryModal .stats-filtros-resumen {
    grid-column: 1 / -1;
    font-size: 0.84rem;
  }

  #statsHistoryModal .stats-filtros-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0.35rem 0.7rem;
    white-space: nowrap;
    border: 1px solid rgba(96, 165, 250, 0.46) !important;
    background: rgba(15, 23, 42, 0.96) !important;
    color: #dbeafe !important;
  }

  #statsHistoryModal .stats-filtros-body {
    min-width: 0;
  }
}

/* REMATE UX P2 (2026-10-31) · Selects de filtros del Informe de gestión.
   Causa raíz: solo había color propio en <=768px (dist/app.css) y en >=980px
   con ratón (css/97-desktop.css). Entre 769 y 979px, y en tabletas táctiles
   >=980px, mandaba la regla global de inputs (dist/app.css): texto
   #000000eb sobre --input-bg rgba(255,255,255,.05), es decir, negro sobre el
   fondo oscuro del modal. Se acota a estos selects con la misma paleta oscura
   del móvil; la regla global de inputs NO se toca. La altura táctil de 44px
   sigue siendo de css/export-modal-desktop-workspace.css.
   P2b (01/11): `(width > 768px)` cubre anchos fraccionarios entre 768 y 769
   (Android con densidad 2,625/2,75, zoom): ahí no aplica ni max-width:768px
   ni min-width:769px. Se mantiene la forma clásica para navegadores antiguos. */
@media (min-width: 769px) and (max-width: 979.98px),
  (width > 768px) and (width < 980px),
  (min-width: 980px) and (hover: none),
  (min-width: 980px) and (pointer: coarse) {
  #statsHistoryModal select.stats-filtro-select {
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    border-radius: 11px !important;
    background: rgba(18, 28, 43, 0.96) !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    color-scheme: dark;
  }

  #statsHistoryModal
    .stats-filtro-item[for="statsFiltroTipo"]
    select.stats-filtro-select {
    border-color: rgba(134, 239, 172, 0.46) !important;
    color: #dcfce7 !important;
    -webkit-text-fill-color: #dcfce7 !important;
  }

  #statsHistoryModal select.stats-filtro-select option {
    background: #0f172a !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
  }

  #statsHistoryModal select.stats-filtro-select:focus {
    outline: none !important;
    border-color: rgba(96, 165, 250, 0.88) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
  }
}

#exportModal #exportModalTitle {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.42rem !important;
}

#exportModal .export-modal-title-text {
  min-width: 0;
}

#exportModal .export-modal-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.045em;
  white-space: normal;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

#exportModal .export-modal-mode-badge[data-mode="budget"] {
  background: rgba(20, 83, 45, 0.96);
  color: #dcfce7;
  border-color: rgba(74, 222, 128, 0.62);
}

#exportModal .export-modal-mode-badge[data-mode="invoice"] {
  background: rgba(30, 64, 175, 0.96);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.68);
}

#exportModal .export-modal-mode-badge[data-mode="draft"] {
  background: rgba(91, 33, 182, 0.96);
  color: #ede9fe;
  border-color: rgba(196, 181, 253, 0.7);
}

#exportModal[data-document-mode="budget"] .modalexportar > .modal-body {
  background:
    radial-gradient(circle at 8% 4%, rgba(34, 197, 94, 0.2), transparent 30%),
    radial-gradient(
      circle at 94% 2%,
      rgba(13, 148, 136, 0.18),
      transparent 32%
    ),
    linear-gradient(135deg, #14251f 0%, #263c38 52%, #50625f 100%) !important;
}

#exportModal[data-document-mode="invoice"] .modalexportar > .modal-body {
  background:
    radial-gradient(circle at 8% 4%, rgba(59, 130, 246, 0.2), transparent 30%),
    radial-gradient(
      circle at 94% 2%,
      rgba(14, 165, 233, 0.15),
      transparent 32%
    ),
    linear-gradient(135deg, #111d33 0%, #273a57 52%, #59697d 100%) !important;
}

#exportModal[data-document-mode="draft"] .modalexportar > .modal-body {
  background:
    radial-gradient(circle at 8% 4%, rgba(139, 92, 246, 0.23), transparent 30%),
    radial-gradient(circle at 94% 2%, rgba(99, 102, 241, 0.2), transparent 32%),
    linear-gradient(135deg, #211736 0%, #393251 52%, #69647c 100%) !important;
}

@media (max-width: 600px) {
  #exportModal #exportModalTitle {
    display: flex !important;
  }

  #exportModal .export-modal-title-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  #exportModal .export-modal-mode-badge {
    font-size: 0.68rem;
    padding: 0.24rem 0.52rem;
  }
}

/* P13 · Gestoría: acciones principales fuera de ajustes */
#gestoriaExportModal .gestoria-actions--footer {
  width: 100%;
  box-sizing: border-box;
  margin: 12px 0 0;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.18);
}

#gestoriaExportModal .gestoria-actions--footer .btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#gestoriaExportModal .gestoria-note--footer {
  margin: 7px 2px 0;
}

@media (max-width: 900px) {
  #gestoriaExportModal .gestoria-actions.gestoria-actions--footer {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.55rem !important;
    padding: 0.58rem !important;
  }

  #gestoriaExportModal .gestoria-actions--footer .btn {
    min-height: 46px !important;
    padding-inline: 0.55rem !important;
    font-size: 0.9rem !important;
  }
}
/* P17.13 · El valor heredado `opacity: 0, 8` es CSS inválido y el navegador
   lo descarta. Se corrige desde la capa modular sin alterar dist/app.css. */
.rgpd-textarea::placeholder {
  opacity: 0.8;
}
