/* Cosmetic layout patch, 12 October 2026. No scripts, form or API changes. */

main :is(h1, h2, h3) {
  min-width: 0;
  overflow-wrap: anywhere;
}
.success-hero > *, .supplier-drawer-heading > div {
  min-width: 0;
}
.success-copy h1, .success-confirmation > h2, .login-header h1 {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.12;
}

/* A dedicated space for Back: it no longer follows the user over the content. */
body:has(> .app-back-button) > main {
  padding-top: 72px;
}
body > .app-back-button {
  position: absolute;
  top: 12px !important;
  bottom: auto !important;
  z-index: 30;
  max-width: calc(100% - 24px);
  min-height: 46px !important;
  white-space: normal;
  line-height: 1.4;
}
.cabinet-floating-help {
  position: absolute;
  top: 12px;
  bottom: auto;
  animation: none;
}
.admin-mobile-entry ~ .app-back-button,
.admin-delivery-page ~ .app-back-button {
  left: 24px !important;
}
/* The entry form already has its own Back link in its header. */
.admin-mobile-entry:not(.admin-entry-success) ~ .app-back-button {
  display: none;
}
body:has(> .admin-mobile-entry:not(.admin-entry-success)) > main {
  padding-top: 0;
}

/* The queue is now a sibling of this action group, so :last-child is unreliable. */
.admin-entry-success > section > div:has(> a[href="/admin/suppliers"]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.admin-entry-success :is(a, button) {
  min-width: 0;
  max-width: 100%;
  height: auto;
  padding: 14px 16px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  text-align: center;
}
.admin-entry-success :is(h1, p, section > span),
.supplier-editor :is(h2, p, article > b),
.supplier-drawer :is(h2, h3, p, b),
.project-detail-content :is(h1, h2, h3, b, p),
.admin-crm-identity :is(h2, p),
.category-focus :is(h2, p) {
  overflow-wrap: anywhere;
}

/* Let controls grow with their labels instead of clipping a second line. */
.button {
  height: auto;
  min-height: 54px;
  padding-top: 12px;
  padding-bottom: 12px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}
:is(.hero-buttons, .all-categories-actions, .supplier-modal-meta,
    .supplier-modal-foot, .catalog-pagination > div) {
  flex-wrap: wrap;
}
:is(.admin-entry-finish, .supplier-editor-head > aside, .supplier-editor-note,
    .supplier-edit-form > footer, .admin-form-actions, .admin-request-actions,
    .supplier-modal-actions, .supplier-drawer-actions, .project-request-bar,
    .access-management-actions, .success-primary-actions, .checkout-header nav,
    .category-store-header nav, .catalog-access-locked, .overview-v2-offers footer)
  :is(button, a) {
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 44px;
  padding-top: 12px;
  padding-bottom: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
:is(.cabinet-workspace, .admin-workspace, .admin-suppliers-workspace,
    .admin-categories-workspace, .admin-review-workspace,
    .admin-import-workspace, .supplier-editor, .admin-entry-finish > div,
    .scan-launch > span:nth-child(2)) {
  min-width: 0;
}
.scan-page-actions button {
  min-width: 0;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.catalog-scanner :is(button, label, p, b, small) {
  overflow-wrap: anywhere;
}
.admin-entry-checks button > span,
.catalog-scanner input[type="checkbox"] {
  flex-shrink: 0;
}
.supplier-row-identity h3 {
  white-space: normal;
  overflow-wrap: anywhere;
}
.project-file-upload { position: relative; }
.project-file-upload input {
  inset: 0;
  width: 100%;
  height: 100%;
}
:is(.supplier-modal, .supplier-drawer, .admin-add-drawer,
    .admin-customer-modal, .project-create-modal, .all-categories-modal,
    .cabinet-mobile-sheet, .admin-mobile-sheet) {
  max-height: calc(100dvh - 24px);
  overscroll-behavior: contain;
}
:is(.admin-toast, .catalog-action-toast) {
  max-width: calc(100% - 24px);
  height: auto;
  padding-top: 12px;
  padding-bottom: 12px;
  overflow-wrap: anywhere;
}
:is(.admin-toast, .catalog-action-toast) > span {
  flex-shrink: 0;
}

/* The sidebar leaves less room than the viewport-based table breakpoints assumed. */
@media (min-width: 1241px) {
  .catalog-page :is(.supplier-list-head, .supplier-row) {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr)
      minmax(0, .84fr) minmax(0, .76fr) 140px 124px;
  }
}
@media (min-width: 1121px) and (max-width: 1240px) {
  .catalog-page :is(.supplier-list-head, .supplier-row) {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .72fr) 140px 124px;
  }
}
@media (min-width: 901px) and (max-width: 1120px) {
  .catalog-page :is(.supplier-list-head, .supplier-row) {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr) 140px 124px;
  }
}

@media (max-width: 1050px) {
  .admin-mobile-dock {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  /* The raised Add icon used to reach into the save bar. */
  .admin-mobile-dock > a.primary {
    transform: none;
  }
  .admin-mobile-dock > a > b,
  .admin-mobile-dock > button > b {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
    text-align: center;
  }
  body:has(> .admin-mobile-dock) > main {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }
  .admin-entry-sticky {
    bottom: calc(96px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-entry-sticky button {
    min-width: 0;
    min-height: 58px;
    padding: 10px 9px;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  .admin-entry-sticky button:disabled { opacity: .6; }
  .admin-entry-finish button:disabled { opacity: .55; }
  body:has(.admin-entry-sticky) > .admin-mobile-entry {
    padding-bottom: calc(204px + env(safe-area-inset-bottom));
  }
  .admin-toast {
    bottom: calc(100px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
  }
  .admin-mobile-sheet > div > a > div :is(b, p) {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
}

@media (max-width: 900px) {
  body > .app-back-button {
    left: 12px !important;
  }
  .cabinet-floating-help {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: auto;
    width: 46px;
    min-height: 46px;
    padding: 4px;
    animation: none;
  }
  .cabinet-floating-help > b { display: none; }
  .cabinet-floating-help > span { width: 36px; height: 36px; }
  .cabinet-topbar,
  :is(.admin-topbar, .admin-suppliers-topbar, .admin-categories-topbar,
      .admin-review-topbar, .admin-import-topbar, .admin-customers-topbar) {
    height: auto;
    gap: 12px;
    flex-wrap: wrap;
  }
  :is(.cabinet-topbar, .admin-topbar, .admin-suppliers-topbar,
      .admin-categories-topbar, .admin-review-topbar,
      .admin-import-topbar, .admin-customers-topbar) > div:first-child {
    min-width: 0;
  }
  :is(.cabinet-topbar, .admin-topbar, .admin-suppliers-topbar,
      .admin-categories-topbar, .admin-review-topbar,
      .admin-import-topbar, .admin-customers-topbar) h1 {
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
  .supplier-index-list > button {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }
  .supplier-index-list > button > span {
    width: 44px;
    height: 50px;
    grid-row: 1 / span 2;
  }
  .supplier-index-list > button > aside {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }
  .supplier-index-list > button > div :is(b, small, p) {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  .supplier-index-list > button > aside i { white-space: normal; }
  .supplier-index > nav { flex-wrap: wrap; }
  :is(.category-directory > nav, .admin-crm-directory > nav,
      .admin-review-controls nav, .category-pills) {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .catalog-hero-panel {
    grid-template-columns: minmax(0, 1fr);
  }
  .catalog-hero-panel > :is(div, label) {
    min-width: 0;
    max-width: 100%;
  }
  .catalog-hero-panel label input { width: 0; font-size: 16px; }
  .catalog-hero-panel label button { min-width: 76px; gap: 8px; }
  .catalog-page .supplier-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .catalog-page .supplier-row > * { grid-column: 1; min-width: 0; }
  .catalog-page .supplier-row-actions {
    grid-row: auto;
    width: 100%;
    justify-content: stretch;
  }
  .catalog-page .supplier-row-actions .supplier-open-trigger {
    flex: 1;
    width: auto;
  }
  .catalog-page .supplier-row-catalog { width: 100%; }
}

@media (max-width: 640px) {
  .admin-entry-success > section > div:has(> a[href="/admin/suppliers"]) {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-entry-topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .admin-entry-topbar > small { display: none; }
  .admin-entry-topbar > div b {
    white-space: normal;
    overflow: visible;
    line-height: 1.3;
  }
  .admin-entry-card > header {
    grid-template-columns: 39px minmax(0, 1fr);
    align-items: start;
  }
  .admin-entry-card > header > span { grid-row: 1 / span 2; }
  .admin-entry-card > header > i {
    grid-column: 2;
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    white-space: normal;
    overflow: visible;
    line-height: 1.3;
  }
  .admin-entry-checks button {
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 12px;
    line-height: 1.4;
  }
  .admin-entry-uploads label {
    grid-template-columns: 40px minmax(0, 1fr) 28px;
    gap: 9px;
  }
  .admin-entry-uploads label > span { width: 40px; height: 40px; }
  .admin-entry-uploads label > i { width: 28px; height: 28px; }
  .admin-entry-finish { padding-bottom: 24px; }
  .admin-entry-finish button { min-height: 56px; }
  .admin-entry-files > span {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  :is(.admin-entry-autofill, .admin-autofill-result, .supplier-attachments,
      .supplier-editor-cover, .supplier-editor-note) :is(b, p, em, small) {
    overflow-wrap: anywhere;
  }
  :is(.supplier-attachments header > div, .scan-footer, .scan-editor-tools) {
    width: 100%;
  }
  :is(.supplier-attachments header > div, .scan-footer, .scan-editor-tools)
    > :is(button, label) {
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
  .catalog-pagination > div button { flex-shrink: 0; }
  .supplier-modal-meta > span { min-width: 0; overflow-wrap: anywhere; }
  .tariff-detail-card > footer > strong {
    font-size: clamp(30px, 10vw, 44px);
    white-space: normal;
  }
  .tariff-detail-card > footer > a {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 12px;
    line-height: 1.4;
  }
  .overview-v2-offers footer {
    flex-wrap: wrap;
    gap: 16px;
  }
  .overview-v2-offers footer > a { width: 100%; }
  .overview-v2-offers article { padding: 24px 20px !important; }
  .overview-v2-offers h2 { font-size: 32px !important; }
  .success-hero { grid-template-columns: minmax(0, 1fr); }
  .success-confirmation { min-width: 0; padding: 22px 18px; }
  .success-primary-actions > a,
  .success-primary-actions > a:first-child { gap: 12px; min-width: 0; }
  .supplier-drawer-heading { grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; }
  .supplier-drawer-paths section { grid-template-columns: minmax(0, 1fr); }
  .supplier-drawer-paths button { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .project-detail-topbar .cabinet-top-actions { flex-wrap: wrap; min-width: 0; }
  /* Prevent Safari's automatic zoom from making form controls jump on focus. */
  :is(.admin-entry-fields, .supplier-index-search, .supplier-category-select,
      .supplier-edit-form, .settings-fields, .login-form, .checkout-buyer,
      .help-composer, .project-create-modal, .admin-add-drawer)
    :is(input:not([type="checkbox"]):not([type="file"]), select, textarea) {
    font-size: 16px;
    min-width: 0;
    max-width: 100%;
  }
}

/* Real supplier IDs contain a long unbroken suffix. Prevent mobile viewport expansion. */
.catalog-page :is(.supplier-row, .supplier-card) { overflow-wrap: anywhere; }
.supplier-row-identity :is(p, small) { white-space: normal; overflow-wrap: anywhere; }
.supplier-row-specialization span { max-width: 100%; flex-shrink: 1; overflow-wrap: anywhere; }
.supplier-card > header { grid-template-columns: 49px minmax(0, 1fr) auto; }
.supplier-card > header > div { min-width: 0; }

/* Keep Close above the dossier header, including long supplier IDs. */
.supplier-drawer-cover { padding-top:68px; }
.supplier-drawer .supplier-modal-close { top:16px; right:16px; }
.supplier-drawer-cover-top { gap:12px; align-items:flex-start; }
.supplier-drawer-cover-top > b { min-width:0; max-width:65%; overflow-wrap:anywhere; }
