/* CRM da telefono: bersagli da toccare di almeno 44px, testi non sotto 12px, bottoni che vanno a capo invece di uscire dal riquadro.
   Caricato dopo il bundle base; vale solo fino a 768px, il desktop non cambia. */
@media (max-width: 768px) {
  /* barra azioni in basso e bottoni generici */
  .crm-create-toolbar-action { min-height: 44px; padding-inline: 14px; }
  .ui-btn { max-width: 100%; white-space: normal; text-align: center; }
  /* il bundle base imponeva flex: 0 0 auto !important ai bottoni nei contenitori flex-wrap: un testo lungo non andava a capo e usciva dal riquadro */
  .flex.flex-wrap.gap-2 > .ui-btn, .flex.flex-wrap.gap-3 > .ui-btn { flex: 0 1 auto !important; }

  /* link e pulsanti-testo dentro elenchi e schede */
  a.dash-attention-link, button.crm-req-link, button.crm-lead-status-help, button.crm-help-toolbar-btn, button.crm-help-copy-link,
  a.crm-settings-logout, a.asst-install, a.crm-pagination-link {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  }
  a.ui-link.text-xs, a.ui-link.text-sm, a#geoOpenOsm { display: inline-flex; align-items: center; min-height: 44px; }

  /* testi piccoli: etichette e didascalie portati a 12px (le classi Tailwind arbitrarie text-[10px]/[11px] non si leggono da telefono) */
  [class*="text-[10px]"], [class*="text-[11px]"], .dash-kpi-label, .crm-settings-card-badge, .crm-settings-kicker,
  .crm-property-kpi-label, .crm-req-filters__label, .crm-req-filter__count, .pipeline-card-value-label, .getrix-kicker {
    font-size: 12px !important;
  }

  /* Quick start: il titolo «Commercializzazione» usciva dalla scheda */
  .qs-hub-card { gap: 16px; padding: 20px 18px; min-height: 0; }
  .qs-hub-card .qs-hub-title { font-size: 20px; overflow-wrap: anywhere; }
  .qs-hub-card .qs-hub-desc { font-size: 14px; }

  /* Elenco immobili: titolo e «Mancano: ...» vanno a capo invece di finire in «...»; chip e pulsanti leggibili e toccabili */
  .crm-property-row .crm-property-title { white-space: normal; overflow: visible; text-overflow: clip; font-size: 15px; line-height: 1.25; }
  .crm-property-row .crm-property-next-action-text { white-space: normal; font-size: 12px; }
  .crm-property-row .crm-property-deal, .crm-property-row .crm-property-code, .crm-property-row .crm-accesso-atti-badge,
  .crm-property-row .crm-property-next-action-badge { font-size: 12px; min-height: 28px; height: auto; }
  .crm-property-row .crm-property-chip, .crm-property-row .crm-property-state-pill { font-size: 12px; min-height: 32px; height: auto; padding-block: 4px; }
  .crm-property-row .crm-mini-btn { min-height: 40px; min-width: 64px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

  /* Catasto: testi minimi 12px, bottoni 44px, controlli mappa da toccare */
  .catasto-app :is(.catasto-brand-badge, .catasto-panel-kicker, .catasto-search-block-desc, .catasto-search-block-desc *, .catasto-field-label,
    .catasto-opt, .catasto-label, .catasto-hint, .catasto-status-label, .catasto-status-item) { font-size: 12px !important; }
  .catasto-app .catasto-chip, .catasto-app [data-catasto-basemap] { min-height: 44px; }
  .catasto-app .leaflet-control-zoom a, .catasto-app .catasto-map-locate { width: 40px !important; height: 40px !important; line-height: 40px !important; }
  .catasto-app .catasto-ade-opacity-range { min-height: 32px; }

  /* il pulsante flottante dell'assistente non deve coprire i pulsanti in fondo alla pagina */
  main { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important; }

  input[type="number"], .crm-chipfield__input { min-height: 44px; }

  /* finestre rapide: il titolo non passa sotto la X di chiusura, che diventa da 44px */
  .crm-quickview-modal__close { width: 44px; height: 44px; top: .4rem; right: .4rem; }
  .crm-quickview-modal__box #crm-quickview-modal-body, .crm-quickview-modal__box > div:not(.crm-quickview-modal__close) { padding-right: 36px; }
  .crm-quickview-modal__box { max-height: 85vh; max-height: 85dvh; }
}

/* Tabelle che su telefono diventano schede: .crm-stack-table + data-label su ogni <td> (prima le colonne a destra restavano tagliate) */
@media (max-width: 640px) {
  .crm-stack-table, .crm-stack-table tbody, .crm-stack-table tr, .crm-stack-table td { display: block; width: 100%; min-width: 0 !important; box-sizing: border-box; }
  .crm-stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .crm-stack-table tr { padding: 10px 0; }
  .crm-stack-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 16px !important; text-align: right; overflow-wrap: anywhere; }
  .crm-stack-table td::before { content: attr(data-label); flex: none; color: var(--crm-text-2, #94a3b8); font-size: 12px; text-align: left; }
  .crm-stack-table td:first-child { display: block; text-align: left; font-size: 15px; }
  .crm-stack-table td:first-child::before { content: none; }
  .crm-stack-table td.crm-stack-table__actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding-top: 8px !important; }
  .crm-stack-table td.crm-stack-table__actions::before { content: none; }
  .crm-stack-table td.crm-stack-table__actions .ui-btn { min-height: 44px; width: auto; }
}
.crm-quickview-cover { max-height: 60vh; object-fit: cover; }
.crm-quickview-dl { grid-template-columns: auto 1fr; column-gap: 12px; }
