/* Adaptation fluide des espaces Trésorerie et Recouvrement, chargée en dernier. */

@media screen {
  .app-shell.is-embedded,
  .collections-shell.is-embedded,
  .app-shell.is-embedded > .main,
  .collections-shell.is-embedded > .collections-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .app-shell.is-embedded > .main,
  .collections-shell.is-embedded > .collections-main {
    padding-inline: clamp(12px, 1.55vw, 30px);
  }

  .app-shell.is-embedded .topbar,
  .collections-shell.is-embedded .collections-topbar {
    max-width: none;
    margin-inline: clamp(-30px, -1.55vw, -12px);
    padding-inline: clamp(12px, 1.55vw, 30px);
  }

  .main,
  .collections-main,
  .dashboard-grid,
  .treasury-pilot,
  .smart-plan-card,
  .smart-supplier-plan,
  .collection-reporting,
  .collection-worklist-card,
  .enterprise-ar,
  .collections-workspace,
  .collection-list-card,
  .collection-detail {
    min-width: 0;
    max-width: 100%;
  }

  .schedule-card,
  .planning-table-wrap,
  .report-table,
  .history-table,
  .account-transfer-history-table,
  .approval-table,
  .settlements-table,
  .bank-directory,
  .smart-supplier-table,
  .supplier-policy-page-table,
  .aging-bucket-detail,
  .workflow-rules,
  .enterprise-task-card,
  .enterprise-risk-card {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .topbar,
  .collections-topbar,
  .top-actions,
  .collections-top-actions,
  .card-head,
  .smart-supplier-plan > header,
  .smart-supplier-plan > footer,
  .enterprise-ar-head,
  .collection-worklist-card > header,
  .collection-reporting > header {
    min-width: 0;
    max-width: 100%;
  }

  .title-wrap,
  .collections-topbar > div,
  .card-head > div,
  .enterprise-ar-head > div {
    min-width: 0;
  }

  .title-wrap h1,
  .collections-topbar h1,
  .card-head h2,
  .enterprise-ar-head h2 {
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 1180px) {
  .topbar,
  .collections-topbar,
  .card-head,
  .smart-supplier-plan > header,
  .smart-supplier-plan > footer,
  .enterprise-ar-head,
  .collection-worklist-card > header,
  .collection-reporting > header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-actions,
  .collections-top-actions,
  .smart-supplier-header-actions {
    flex-wrap: wrap;
  }

  .dashboard-grid,
  .reporting-grid,
  .enterprise-grid,
  .collections-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .metrics,
  .collection-kpis,
  .enterprise-kpis,
  .reporting-metrics,
  .smart-supplier-kpis,
  .executed-transfer-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 760px) {
  .app-shell.is-embedded > .main,
  .collections-shell.is-embedded > .collections-main {
    padding-inline: 10px;
  }

  .app-shell.is-embedded .topbar,
  .collections-shell.is-embedded .collections-topbar {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .topbar,
  .collections-topbar,
  .card-head,
  .enterprise-ar-head,
  .collection-worklist-card > header,
  .collection-reporting > header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .collections-top-actions,
  .smart-supplier-header-actions {
    width: 100%;
    align-items: stretch;
  }

  .top-actions > *,
  .collections-top-actions > *,
  .smart-supplier-header-actions > * {
    flex: 1 1 145px;
  }

  .company-filter,
  .collections-top-actions label,
  .collections-top-actions select {
    width: 100%;
    min-width: 0;
  }

  .metrics,
  .collection-kpis,
  .enterprise-kpis,
  .reporting-metrics,
  .reporting-metrics-six,
  .smart-supplier-kpis,
  .executed-transfer-kpis,
  .collectible-summary,
  .history-kpis,
  .reserve-kpis,
  .approval-kpis,
  .settlements-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawer-backdrop,
  .statement-backdrop,
  .aging-detail-backdrop,
  .enterprise-modal,
  .email-settings-backdrop {
    padding: 0;
  }

  .drawer,
  .drawer.drawer-wide,
  .drawer.drawer-full,
  .collection-detail,
  .email-settings-modal,
  .enterprise-modal form {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
  }
}

@media screen and (max-width: 520px) {
  .metrics,
  .collection-kpis,
  .enterprise-kpis,
  .reporting-metrics,
  .reporting-metrics-six,
  .smart-supplier-kpis,
  .executed-transfer-kpis,
  .collectible-summary,
  .history-kpis,
  .reserve-kpis,
  .approval-kpis,
  .settlements-kpis {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-actions > *,
  .collections-top-actions > *,
  .smart-supplier-header-actions > * {
    flex-basis: 100%;
  }
}
