/* Opt-in mobile workflows share the desktop DOM and all server-side controls. */
.mobile-row-tools, .mobile-cell-label, .mobile-list-sort, .mobile-review-tabs { display: none; }
.mobile-choice { display: contents; }
.mobile-choice-caption { display: none; }
.sales-editor-layout { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
.sales-editor-main, .sales-panel, .sales-editor-layout > * { min-width: 0; }
/* Keep the native Select2 field clipped inside its cell, even in wide tables. */
table[data-mobile-table] td { position: relative; }
body select.select2-hidden-accessible {
  width: 1px !important; min-width: 0 !important;
  height: 1px !important; min-height: 0 !important;
}
@media (pointer: coarse) and (max-width: 991.98px) {
  main .btn, .page-link, .nav-link, summary { min-height: 44px; }
  main .btn, .page-link { min-width: 44px; }
  main .form-control, main .form-select { min-height: 44px; font-size: 16px; }
}
@media (max-width: 1199.98px) {
  .sales-editor-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 991.98px) {
  .app-topbar .btn, .app-topbar .dropdown-item, .app-topbar .form-select { min-height: 44px; }
  .app-topbar .dropdown-menu.show {
    position: fixed !important;
    inset: auto !important;
    transform: none !important;
    left: var(--mobile-menu-left, 8px) !important;
    top: var(--mobile-menu-top, calc(var(--header-height) + 4px)) !important;
    max-width: calc(100vw - 16px);
    max-height: var(--mobile-menu-height, calc(100dvh - var(--header-height) - 12px));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .app-topbar .app-topbar__tasks-menu.show { display: flex; flex-direction: column; overflow: hidden; }
  .app-topbar__tasks-menu > .list-group { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .app-topbar__tasks-menu > :first-child, .app-topbar__tasks-menu > :last-child { flex-shrink: 0; }
  .select2-dropdown { max-width: calc(100vw - 16px); }
  .select2-results__option { white-space: normal; overflow-wrap: anywhere; min-height: 44px; }
  .select2-search__field { font-size: 16px !important; }
  .modal-dialog { margin: 8px auto; max-width: calc(100% - 16px); }
  .modal-dialog-scrollable { height: calc(var(--mobile-viewport-height, 100dvh) - 16px); }
  .modal-content { max-height: calc(var(--mobile-viewport-height, 100dvh) - 16px); }
  .modal-body { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
  .modal-header, .modal-footer { flex-shrink: 0; }
}
@media (max-width: 767.98px) {
  .mobile-list-intro { padding: 12px 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .mobile-list-intro .page-hero__meta { display: none; }
  .mobile-list-intro .page-hero__title { font-size: 26px; }
  .mobile-list-intro .page-hero__subtitle { margin-bottom: 0; }
  main .btn, .app-topbar__icon-action, .app-topbar__sidebar-toggle,
  .dropdown-item, .page-link, .nav-link, summary { min-height: 44px; }
  main .btn, .app-topbar__icon-action, .app-topbar__sidebar-toggle, .page-link { min-width: 44px; }
  main .form-control, main .form-select, main input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  body .select2-container .select2-selection { min-height: 44px; font-size: 16px; max-width: 100%; }
  body .select2-container .select2-selection__rendered { line-height: 42px; }
  body .select2-container .select2-selection__arrow { height: 42px; }
  main :is(input, select, textarea, button, a):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
  main :is(input, select, textarea) { scroll-margin-top: calc(var(--header-height) + 20px); }
  .btn-close { padding: 14px; }
  .app-topbar__actions { gap: 6px; }
  .app-topbar__logo { max-width: calc(100vw - 15rem); }
  .app-topbar__tasks-menu .text-nowrap { white-space: normal !important; }
  .quote-editor-savebar { position: static; }
  .summary { position: static; }
  .mobile-table-container { overflow: visible !important; border: 0 !important; box-shadow: none !important; }
  table.mobile-ready { display: block; width: 100% !important; min-width: 0 !important; }
  table.mobile-ready > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.mobile-ready > tbody { display: block; width: 100%; }
  table.mobile-ready > tbody > tr:not(.detail-row) {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
    border: 1px solid var(--bs-border-color); border-radius: 6px;
    padding: 12px; margin-bottom: 12px; background: var(--bs-body-bg);
  }
  table.mobile-ready > tbody > tr > td {
    display: block; width: auto !important; min-width: 0 !important; max-width: 100%;
    padding: 0 !important; border: 0; overflow-wrap: anywhere; box-shadow: none;
    text-align: left !important; background: transparent;
  }
  table.mobile-ready > tbody > tr > td.mobile-empty,
  table.mobile-ready > tbody > tr > td.drag-handle,
  table.mobile-ready > tbody > tr > td.toggle-details,
  table.mobile-ready > tbody > tr > td.mobile-secondary { display: none; }
  table.mobile-ready > tbody > tr.mobile-expanded > td.mobile-secondary { display: block; }
  table.mobile-ready > tbody > tr.detail-row { display: none !important; }
  table.mobile-ready > tbody > tr.detail-row.mobile-detail-open {
    display: block !important; padding: 12px; margin: -13px 0 12px;
    border: 1px solid var(--bs-border-color); border-top: 0; border-radius: 0 0 6px 6px;
  }
  table.mobile-ready .mobile-cell-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--bs-secondary-color); }
  table.mobile-ready td > :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select:not(.select2-hidden-accessible),textarea,.select2-container) { width: 100% !important; min-width: 0 !important; }
  .mobile-choice { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
  .mobile-choice-caption { display: inline; }
  table.mobile-ready .mobile-choice-cell > .mobile-cell-label { display: none; }
  table.mobile-ready input:is([type=checkbox],[type=radio]) { width: 22px; height: 22px; }
  table.mobile-ready .text-nowrap { white-space: normal !important; }
  table.mobile-ready textarea { min-height: 88px; }
  table.mobile-ready > tbody > tr > td.mobile-row-tools { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  table.mobile-ready .line-row[style*="display: none"] + .detail-row { display: none !important; }
  .mobile-list-sort { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
  .mobile-list-sort select { flex: 1; min-width: 0; }
  .mobile-review-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
  .mobile-review-tabs button { flex: 1; }
  .mobile-review-ready [data-review-panel]:not(.mobile-review-active) { display: none; }
  .mobile-review-ready iframe { height: calc(var(--mobile-viewport-height, 100dvh) - 220px) !important; min-height: 260px !important; }
  [data-mobile-table] .btn { white-space: normal; }
  .pagination { flex-wrap: wrap; }
}
