/* Ceeble responsive stability layer.
   Loaded after page-local styles on partner/auth pages. */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
}

svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

a,
p,
li,
h1,
h2,
h3,
h4,
h5,
h6,
.badge,
.status-badge,
.act-ref,
.act-beneficiaire,
.travaux-cell,
.detail-value,
.kpi-value,
.page-header-sub {
  overflow-wrap: anywhere;
  word-break: normal;
}

.app-main,
.account-shell,
.stats-shell,
.simulations-shell,
.detail-shell,
.page,
.main,
.sim-shell,
.auth-shell,
.auth-overview,
.auth-card,
.content-card,
.chart-card,
.account-card,
.filters-card,
.results-panel,
.param-card {
  min-width: 0;
  max-width: 100%;
}

.app-main,
.account-shell,
.stats-shell,
.simulations-shell,
.detail-shell {
  width: auto;
}

.page-header,
.page-header-actions,
.filters-actions,
.account-actions,
.result-row,
.nav-user,
.app-topbar-inner {
  min-width: 0;
  flex-wrap: wrap;
}

.page-header > *,
.page-header-actions > *,
.filters-actions > *,
.account-actions > *,
.result-row > *,
.app-topbar-inner > * {
  min-width: 0;
}

.kpi-grid,
.quick-access,
.benefits-strip,
.metric-grid,
.result-grid,
.detail-grid,
.account-grid,
.filters-fields,
.ops-grid,
.income-cards,
.cdp-cards,
.chart-grid,
.content-grid {
  min-width: 0;
}

.kpi-card,
.qa-card,
.support-card,
.benefit-card,
.metric-card,
.result-tile,
.detail-item,
.account-card,
.filters-card,
.content-card,
.chart-card,
.param-card,
.op-card,
.income-card,
.cdp-card {
  min-width: 0;
}

.table-wrap,
#activity-table,
#travaux-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.table-wrap table {
  min-width: 720px;
}

.act-table-head,
.act-table-row {
  min-width: 860px;
}

.travaux-table-head,
.travaux-row {
  min-width: 640px;
}

.status-picklist-menu,
.multi-choice-list,
.op-picker-modal {
  max-width: min(100vw - 32px, 560px);
}

.auth-preview-panel {
  width: 100%;
  max-width: 100%;
  min-height: clamp(360px, 56vw, 760px);
  height: clamp(360px, 56vw, 760px);
  max-height: 760px;
}

.auth-preview-panel img {
  max-width: none;
}

@media (min-width: 1920px) {
  .app-main,
  .account-shell,
  .stats-shell,
  .simulations-shell,
  .detail-shell {
    max-width: 1480px;
    margin-right: auto;
  }

  .auth-shell {
    max-width: 1180px;
  }
}

@media (max-width: 1280px) {
  .content-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .page-header,
  .app-topbar-inner {
    align-items: stretch;
  }

  .page-header-actions,
  .filters-actions,
  .account-actions {
    width: 100%;
  }

  .filters-fields,
  .field-group,
  .field-group-3,
  .project-eligibility-grid,
  .result-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .income-cards,
  .cdp-cards,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .app-main,
  .account-shell,
  .stats-shell,
  .simulations-shell,
  .detail-shell {
    margin-left: 0;
    padding-inline: 14px;
  }

  .app-sidebar {
    max-width: min(var(--sb-w, 250px), calc(100vw - 24px));
  }

  .mobile-topbar {
    max-width: 100%;
  }

  .kpi-grid,
  .quick-access,
  .benefits-strip,
  .filters-fields,
  .account-grid,
  .ops-grid,
  .result-grid,
  .detail-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .stepper-wrap,
  .secteur-tabs,
  .cat-tabs,
  .quick-ops-grid,
  .radio-pills,
  .region-toggle {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bottom-bar {
    width: min(100% - 24px, 560px);
  }
}

@media (max-width: 480px) {
  .app-main,
  .account-shell,
  .stats-shell,
  .simulations-shell,
  .detail-shell,
  .sim-shell {
    padding-inline: 12px;
  }

  .auth-card,
  .auth-overview,
  .filters-card,
  .account-card,
  .content-card,
  .chart-card,
  .param-card,
  .results-panel {
    border-radius: 18px;
    padding-inline: 16px;
  }

  .income-cards,
  .cdp-cards,
  .trust-row {
    grid-template-columns: 1fr;
  }

  .btn,
  button[type="submit"] {
    white-space: normal;
  }
}
