/*
 * sb-pos-mobile.css - responsive fixes for the logged-in SmartBiashara POS admin (Stockifly, Ant Design Vue 4).
 * Link it from resources/views/welcome.blade.php AFTER the app's own CSS.
 *
 * Scope rules:
 *  - Every selector starts with html:not(.sbab-on), so nothing here can match the sign-in / sign-up pages
 *    (the shared auth skin adds html.sbab-on there).
 *  - Admin pages: #components-layout-demo-responsive is the admin layout root (Admin.vue).
 *  - Drawers/modals are portalled to <body>, so they are scoped with
 *    body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, ...pos-left-wrapper, ...pos1-left-wrapper).
 *    Those :has() arguments are child-only chains on purpose: a descendant :has() on <body> or on the layout root makes
 *    Chrome restyle the whole page on every DOM change (measured: cart/table updates 14x slower). Keep it that way.
 *  - The full-screen POS page has no admin layout; it is scoped by its own .pos-left-wrapper (tablet/desktop),
 *    .pos1-left-wrapper (phones) and .right-pos-sidebar.
 *  - Nothing applies at >= 1280px, so desktop looks exactly as before.
 *
 * Issue numbers refer to pos-issues.json (device sweep, 2026-11-14).
 */

/* ---------- Phones and tablets (< 1280px): containment that is invisible when content fits ---------- */
@media (max-width: 1279.98px) {
  /* #4 Tables scroll inside their own box instead of widening the page */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-table-content,
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer .ant-table-content,
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-modal .ant-table-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* #4 (and Company Settings at 1024) "select + [+] button" rows: let the select shrink so the button stays inside */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-form-item-control-input-content > span[style*="flex"] > .ant-select,
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer .ant-form-item-control-input-content > span[style*="flex"] > .ant-select {
    flex: 1 1 0%;
    min-width: 0;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-form-item-control-input-content > span[style*="flex"] > :not(.ant-select),
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer .ant-form-item-control-input-content > span[style*="flex"] > :not(.ant-select) {
    flex: 0 0 auto;
  }

  /* #7 The floating "+" opens the same quick-add menu as the "+" in the top bar (AffixButton.vue,
     company setting "Add Menu Placement" = both). Below 1280px it only covers table values and the
     pagination, so hide it whenever the top-bar "+" is there. With placement "bottom" (no top-bar "+")
     the floating button stays, and the content gets room to scroll clear of it. */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header:has(.ant-dropdown-trigger > .anticon-plus-circle) ~ div div[style*="position: fixed"]:has(> .ant-btn-circle.ant-dropdown-trigger) {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header:not(:has(.ant-dropdown-trigger > .anticon-plus-circle)) ~ div main.ant-layout-content {
    padding-bottom: 96px;
  }

  /* #2 (768-1279) List toolbars: buttons and filters each get a full row, so the search box no longer
     sits on top of the Export / "... List" button */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-row:has(> .ant-col > .ant-space-horizontal):has(> .ant-col .ant-input-search) > .ant-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-col > .ant-space-horizontal,
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-col > .ant-space-horizontal > .ant-space-item > .ant-space-horizontal {
    flex-wrap: wrap;
    row-gap: 8px;
    max-width: 100%;
  }

  /* #11 Sidebar logo keeps its proportions */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-sider-children > div > img {
    object-fit: contain;
    object-position: left center;
  }
}

/* ---------- Touch targets: phones, and touch tablets below 1280px ---------- */
@media (max-width: 767.98px), (pointer: coarse) and (max-width: 1279.98px) {
  /* #13 Buttons at least 40px tall (link/text/small/large buttons, round icon buttons and the
     search button fused to its input are left alone) */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-btn:not(.ant-btn-link):not(.ant-btn-text):not(.ant-btn-sm):not(.ant-btn-lg):not(.ant-btn-circle):not(.ant-input-search-button),
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) :is(.ant-drawer, .ant-modal) .ant-btn:not(.ant-btn-link):not(.ant-btn-text):not(.ant-btn-sm):not(.ant-btn-lg):not(.ant-btn-circle):not(.ant-input-search-button),
  html:not(.sbab-on) #app :is(.pos-left-wrapper, .pos1-left-wrapper, .right-pos-sidebar) .ant-btn:not(.ant-btn-link):not(.ant-btn-text):not(.ant-btn-sm):not(.ant-btn-lg):not(.ant-btn-circle):not(.ant-input-search-button) {
    height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-btn-icon-only:not(.ant-btn-link):not(.ant-btn-text):not(.ant-btn-sm):not(.ant-btn-circle):not(.ant-input-search-button),
  html:not(.sbab-on) #app :is(.pos-left-wrapper, .pos1-left-wrapper, .right-pos-sidebar) .ant-btn-icon-only:not(.ant-btn-link):not(.ant-btn-text):not(.ant-btn-sm):not(.ant-btn-circle) {
    min-width: 40px;
  }
  /* Drawer / modal close "X" was a 28x19 target: 40x40, same spot */
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) :is(.ant-drawer-close, .ant-modal-close) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
  }
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer-close {
    margin-inline: -10px 2px;
    margin-block: -10px;
  }
}

/* ---------- Phones (< 768px) ---------- */
@media (max-width: 767.98px) {
  /* #1 Top bar: keep every item on one 64px row so the trial banner no longer covers the switcher and avatar */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header {
    padding-left: 12px;
    padding-right: 12px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header .ant-space-item:has(> .ant-divider-vertical) {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header .ant-dropdown-link {
    display: inline-block;
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-header .ant-space {
    max-width: 100%;
  }

  /* Trial banner: let the text use the full width, "Change Plan" goes on its own line */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-alert-with-description {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-alert-with-description > .ant-alert-content {
    flex: 1 1 0%;
    min-width: 0;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-alert-with-description > .ant-alert-close-icon {
    flex: 1 1 100%;
    margin: 8px 0 0;
    text-align: left;
    overflow: visible;
  }

  /* #2 List toolbars (Add / Import / Export) wrap instead of running off the screen */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-col > .ant-space-horizontal,
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-col > .ant-space-horizontal > .ant-space-item > .ant-space-horizontal {
    flex-wrap: wrap;
    row-gap: 8px;
    max-width: 100%;
  }
  /* (Suppliers/Categories nest a second a-space inside the first one) */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content .ant-col > .ant-space-horizontal > .ant-space-item {
    max-width: 100%;
    min-width: 0;
  }

  /* #3 Drawers (Add/Edit Product etc.) use the full phone width */
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) :is(.ant-drawer-right, .ant-drawer-left) > .ant-drawer-content-wrapper {
    width: 100% !important;
    max-width: 100vw;
  }
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper, > #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer-footer > .ant-btn {
    margin-right: 0 !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* #5 Card header tabs (Recent Stock History) move under the title and fit the card */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-head-wrapper:has(> .ant-card-extra > .ant-tabs) {
    flex-wrap: wrap;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-head-wrapper:has(> .ant-card-extra > .ant-tabs) > .ant-card-head-title {
    flex: 1 1 100%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-head-wrapper > .ant-card-extra:has(> .ant-tabs) {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    margin-inline-start: 0;
    padding-top: 0;
  }
  /* #5 ...and wrap onto a second line instead of hiding "Sales Return" behind a sideways swipe.
     The sliding ink bar cannot follow a wrapped tab, so the active tab is underlined itself. */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-nav-wrap {
    overflow: visible;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-nav-wrap::before,
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-nav-wrap::after,
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-ink-bar,
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-nav-operations {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-nav-list {
    flex-wrap: wrap;
    column-gap: 24px;
    transform: none !important;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-tab {
    margin: 0;
    padding: 0;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-tab > .ant-tabs-tab-btn {
    padding: 10px 0;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-extra > .ant-tabs .ant-tabs-tab-active > .ant-tabs-tab-btn {
    box-shadow: inset 0 -2px 0 currentColor;
  }

  /* List page tabs (Products: Single / Variant / Service Type Product) wrap instead of hiding the last tab
     behind a "..." menu; same treatment as the card tabs above (active tab underlined itself) */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-nav-wrap {
    overflow: visible;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-nav-wrap::before,
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-nav-wrap::after,
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-ink-bar,
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-nav-operations {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-nav-list {
    flex-wrap: wrap;
    column-gap: 24px;
    transform: none !important;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-tab {
    margin: 0;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col > .ant-tabs-top > .ant-tabs-nav .ant-tabs-tab-active {
    box-shadow: inset 0 -2px 0 currentColor;
  }

  /* Date-range picker (dashboard, reports): the two month panels stack instead of running 560px wide */
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive) .ant-picker-dropdown-range .ant-picker-panels {
    flex-direction: column;
  }

  /* #7 Floating "+" button sits closer to the corner */
  html:not(.sbab-on) #components-layout-demo-responsive div[style*="position: fixed"]:has(> .ant-btn-circle.ant-dropdown-trigger) {
    right: 16px !important;
    bottom: 16px !important;
  }

  /* #9 Page title gets its own line when the header has action buttons */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-page-header-heading:has(> .ant-page-header-heading-extra) {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-page-header-heading:has(> .ant-page-header-heading-extra) > .ant-page-header-heading-left {
    flex: 1 1 100%;
    max-width: 100%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-page-header-heading-extra {
    margin-inline-start: 0;
    max-width: 100%;
    white-space: normal;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-page-header-heading-extra .ant-space {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  /* ---------- POS screen on phones (the app's one-column "pos1" layout, Pos.vue, innerWidth < 768) ---------- */
  /* Totals bar (Total, Pay Now, Reset) stays on screen at the bottom, so the cashier never scrolls to pay.
     Total gets its own line (a long amount used to run under Pay Now); Pay Now takes the rest of the second line. */
  html:not(.sbab-on) #app .pos1-left-wrapper {
    padding-bottom: 116px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto !important;
    z-index: 20 !important;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border-top: 1px solid #e3e9e6;
    box-shadow: 0 -4px 14px rgba(13, 31, 27, 0.10);
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row {
    row-gap: 8px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:first-child,
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:last-child {
    flex: 0 0 100%;
    max-width: 100%;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:first-child > .ant-row {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    margin: 0 !important;
    padding: 4px 12px !important;
    border-radius: 6px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:first-child > .ant-row > .ant-col {
    flex: 0 1 auto;
    max-width: none;
    min-width: 0;
    padding: 0 !important;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:first-child > .ant-row > .ant-col .pos-grand-total {
    white-space: nowrap;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:last-child > .ant-space {
    display: flex;
    width: 100%;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:last-child > .ant-space > .ant-space-item:first-child {
    flex: 1 1 auto;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:last-child > .ant-space > .ant-space-item:first-child > .ant-btn {
    width: 100%;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper > .pos-left-footer > div:last-child > .ant-row > .ant-col:last-child > .ant-space > .ant-space-item:last-child > .ant-btn {
    min-width: 96px;
  }
  /* Cart fits the card: no hidden Action column behind a sideways swipe, names on 1-2 lines instead of 4-5.
     The row number (#) column is dropped here, cells are tighter, edit / delete stack in a narrow column.
     The cart grows with its items (the page scrolls) instead of being a second small scroll box inside the page. */
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table {
    height: auto;
    min-height: calc(100vh - 500px);
    overflow: visible;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table > .ant-card-body {
    padding-left: 8px;
    padding-right: 8px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-thead > tr > th:first-child,
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:first-child {
    display: none;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-thead > tr > th,
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td {
    padding: 8px 4px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-thead > tr > th:nth-child(2),
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:nth-child(2) {
    padding-left: 8px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-thead > tr > th:last-child,
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:last-child {
    width: 44px;
    padding-right: 4px;
    text-align: center;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-thead > tr > th:last-child {
    font-size: 0;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:last-child > .ant-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px !important;
    height: 36px;
    padding: 0;
    margin: 0 auto !important;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:last-child > .ant-btn + .ant-btn {
    margin-top: 6px !important;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody .ant-input-number {
    width: 60px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody > tr > td:nth-child(4) {
    white-space: nowrap;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .left-pos1-middle-table .ant-table-tbody small code {
    font-size: 11px;
    margin: 0;
  }
  /* Payment drawer > Add New Payment form: the "Add" button sat ~25px below the screen. It stays pinned to the bottom
     of the drawer while the form scrolls (it only moves up within the form, so nothing else changes position). */
  html:not(.sbab-on) body:has(> #app > .theme-container > div > form > .ant-row > .ant-col > .pos1-left-wrapper) .ant-drawer .ant-drawer-body form.ant-form-vertical > .ant-row:last-child:has(> .ant-col > .ant-btn-primary.ant-btn-block:only-child) {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 8px;
    padding-bottom: 12px;
    background: #fff;
    /* the second shadow paints the drawer's 24px bottom padding white, so the form never shows through below the button */
    box-shadow: 0 -6px 10px -6px rgba(13, 31, 27, 0.18), 0 24px 0 0 #fff;
  }
  /* Customer select + "+" + Select Product row: the 40px touch rule made "+" 40x40 next to a 32px search and pushed it
     4px into the search box. All three controls are 40px tall, the customer select shrinks so "+" fits in its column. */
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters > .ant-row > .ant-col > span[style*="flex"] {
    align-items: center;
    min-width: 0;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters > .ant-row > .ant-col > span[style*="flex"] > .ant-select {
    flex: 1 1 0%;
    min-width: 0;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters > .ant-row > .ant-col > span[style*="flex"] > :not(.ant-select) {
    flex: 0 0 auto;
    display: flex;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters > .ant-row > .ant-col > span[style*="flex"] > :not(.ant-select) > .ant-btn-icon-only {
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin-left: 6px;
    padding: 0;
    border-radius: 6px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters .ant-select-single:not(.ant-select-customize-input) > .ant-select-selector {
    height: 40px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters .ant-select-single:not(.ant-select-customize-input) > .ant-select-selector .ant-select-selection-search-input {
    height: 38px;
  }
  html:not(.sbab-on) #app .pos1-left-wrapper .bill-filters .ant-select-single:not(.ant-select-customize-input) > .ant-select-selector :is(.ant-select-selection-item, .ant-select-selection-placeholder) {
    line-height: 38px;
  }
}

/* ---------- Phones and portrait tablets (< 992px, where the sidebar overlays the page) ---------- */
@media (max-width: 991.98px) {
  /* The page wrapper keeps a 2px left margin here (the sidebar overlays it), which showed as a 2px strip left of
     the trial banner and the top bar only. Flush with the screen edge on both sides. */
  html:not(.sbab-on) #components-layout-demo-responsive > .ant-layout-has-sider > aside.ant-layout-sider + .ant-layout > div:only-child {
    margin-left: 0;
  }
  /* #10 Settings / Subscription sub-menu: no desktop-height blank block above the form */
  html:not(.sbab-on) #components-layout-demo-responsive .setting-sidebar,
  html:not(.sbab-on) #components-layout-demo-responsive .setting-sidebar > .ps {
    height: auto !important;
    min-height: 0 !important;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .bg-setting-sidebar {
    margin-bottom: 8px;
  }
  /* #10 Plan feature lists: compact bullets */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-hoverable .ant-col > ul {
    margin: 0 0 2px;
    padding-left: 20px;
  }

  /* Dashboard quick-date buttons (Today ... This Year): the two empty half-width columns pushed them into the right
     half of a second row, where "This Year" wrapped alone. They now sit on one line under the date picker. */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-md-12:empty {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-md-12:empty ~ .ant-col-md-12:has(.ant-btn) {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* #12 Open mobile menu: start below the top bar (so the menu button can close it) and dim + shield the page */
  html:not(.sbab-on) #components-layout-demo-responsive aside.ant-layout-sider:not(.ant-layout-sider-collapsed) {
    top: 64px !important;
    bottom: 0;
    height: auto !important;
  }
  html:not(.sbab-on) #components-layout-demo-responsive aside.ant-layout-sider:not(.ant-layout-sider-collapsed)::after {
    content: "";
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    left: 240px;
    background: rgba(0, 0, 0, 0.45);
  }
  /* #12 The floating "+" (when it is shown) must not sit above the dimmed page while the menu is open */
  html:not(.sbab-on) #components-layout-demo-responsive aside.ant-layout-sider:not(.ant-layout-sider-collapsed) ~ .ant-layout div[style*="position: fixed"]:has(> .ant-btn-circle.ant-dropdown-trigger) {
    visibility: hidden;
  }
}

/* ---------- POS screen, iPad portrait (768-991px): cart and products side by side ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
  html:not(.sbab-on) #app form > .ant-row > .ant-col:has(> .pos-left-wrapper) {
    flex: 0 0 57%;
    max-width: 57%;
  }
  html:not(.sbab-on) #app form > .ant-row > .ant-col.right-pos-sidebar {
    flex: 0 0 43%;
    max-width: 43%;
  }
  /* Order Tax on its own row, Discount and Shipping share the next one, so no field is squeezed */
  html:not(.sbab-on) #app .pos-left-footer .bill-footer > .ant-row > .ant-col:first-child {
    flex: 0 0 100%;
    max-width: 100%;
  }
  html:not(.sbab-on) #app .pos-left-footer .bill-footer > .ant-row > .ant-col:nth-child(n+2) {
    flex: 0 0 50%;
    max-width: 50%;
  }
  /* The footer above is taller here (Order Tax gets its own row), so the cart list gives back that height:
     the app sizes it calc(100vh - 420px) (Pos.vue), which pushed Pay Now / Reset below the screen.
     576px keeps both buttons 12px above the bottom edge, as on desktop. */
  html:not(.sbab-on) #app .left-pos-middle-table {
    height: calc(100vh - 576px) !important;
    height: calc(100dvh - 576px) !important; /* the visible height when a tablet browser shows its URL bar */
    min-height: 200px;
  }

  /* Form fields with a "select + [+]" pair in a quarter-width column (Product drawer "Tax",
     Company Settings "Language") get half the row so the select keeps its placeholder */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-row > .ant-col-md-6:has(> .ant-form-item .ant-form-item-control-input-content > span[style*="flex"] > .ant-select),
  html:not(.sbab-on) body:has(> #app > .theme-container > div > div > #components-layout-demo-responsive) .ant-drawer .ant-row > .ant-col-md-6:has(> .ant-form-item .ant-form-item-control-input-content > span[style*="flex"] > .ant-select) {
    flex: 0 0 50%;
    max-width: 50%;
  }
  /* ...and in a form row that mixes half and quarter columns (Company Settings: Layout | Add Menu
     Placement | Language; Auto Detect Timezone | Default Timezone) every field gets half the row,
     so the form stays a clean two-column grid without stray empty quarters */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content form .ant-row:has(> .ant-col-md-12) > .ant-col-md-6:has(> .ant-form-item),
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content form .ant-row > .ant-col-md-4:has(> .ant-form-item):has(+ .ant-col-md-8),
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content form .ant-row > .ant-col-md-4:has(> .ant-form-item) + .ant-col-md-8 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  /* ...and when that leaves the last field alone on its line (Company Settings "Language"), it takes the whole line */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-layout-content form .ant-row:has(> .ant-col-md-12) > .ant-col-md-6:has(> .ant-form-item):last-child:nth-child(odd) {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ---------- POS screen, tablets and small laptops (768-1279px) ---------- */
@media (min-width: 768px) and (max-width: 1279.98px) {
  /* Product list column: the app sizes it calc(100vh - 90px) under a 94px header, so the page was 4px taller than
     the screen and wobbled; it now ends exactly at the bottom edge (and at the visible edge on tablets with a URL bar) */
  html:not(.sbab-on) #app .right-pos-sidebar .ps {
    height: calc(100vh - 94px);
    height: calc(100dvh - 94px);
  }
  /* #8 Totals bar: Grand Total on its own row, buttons stay inside the column */
  html:not(.sbab-on) #app .pos-left-footer > div:last-child > .ant-row > .ant-col:nth-child(1) {
    flex: 0 0 100%;
    max-width: 100%;
  }
  html:not(.sbab-on) #app .pos-left-footer > div:last-child > .ant-row > .ant-col:nth-child(2) {
    flex: 1 1 0%;
    max-width: none;
    text-align: left;
  }
  html:not(.sbab-on) #app .pos-left-footer > div:last-child > .ant-row > .ant-col:nth-child(3) {
    flex: 0 0 auto;
    max-width: none;
  }
  /* #8 Discount "% / fixed" picker (a select inside .ant-input-group-compact, inline width 30%) keeps
     room for its label and arrow; the number input takes the rest */
  html:not(.sbab-on) #app .pos-left-footer .ant-input-group-compact > .ant-select:first-child {
    width: 60px !important;
  }
  html:not(.sbab-on) #app .pos-left-footer .ant-input-group-compact > .ant-select:first-child + .ant-input-number {
    width: calc(100% - 60px) !important;
  }
  /* Cart rows stay compact so at least three lines show above the totals: tighter cells, the
     edit / delete buttons side by side instead of stacked, a narrower quantity box and the
     "Avl. qty" note on one line (in the app's narrow Name column rows were 134px tall) */
  html:not(.sbab-on) #app .left-pos-middle-table > .ant-card-body {
    padding: 12px;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-thead > tr > th,
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td {
    padding: 8px 4px;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td:first-child,
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-thead > tr > th:first-child {
    padding-left: 8px;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td:last-child {
    white-space: nowrap;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td:last-child > .ant-btn {
    margin: 0 !important;
    width: 34px;
    min-width: 34px !important;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td:last-child > .ant-btn + .ant-btn {
    margin-left: 4px !important;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody .ant-input-number {
    width: 56px;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody small code {
    white-space: nowrap;
    margin: 0;
    font-size: 11px;
  }
  html:not(.sbab-on) #app .left-pos-middle-table .ant-table-tbody > tr > td:nth-child(4) {
    white-space: nowrap;
  }
  /* Order Payment drawer (half the screen here): "Add New Payment" and "Complete Order >" were cut off in
     their 10/24 columns; each now takes the width its label needs and they wrap when the row is too narrow */
  html:not(.sbab-on) body:has(> #app > .theme-container > div > form > .ant-row > .ant-col > .pos-left-wrapper) .ant-drawer .ant-row:has(> .ant-col-md-10 > .ant-btn-block) > .ant-col-md-10 {
    flex: 1 1 auto;
    max-width: 100%;
  }
  /* #8 Product prices fit the card */
  html:not(.sbab-on) #app .right-pos-sidebar .product-pos-bottom {
    padding-left: 8px;
    padding-right: 8px;
  }
  html:not(.sbab-on) #app .right-pos-sidebar .product-price {
    font-size: 15px;
    white-space: nowrap;
  }
}

/* ---------- Small laptops / iPad landscape (992-1279px) ---------- */
@media (min-width: 992px) and (max-width: 1279.98px) {
  /* Settings / Subscription side menu: 4/24 of the content was ~130px and cut every item ("Current...", "Transc...");
     it gets a fixed 188px and the page beside it takes the rest */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-row > .ant-col.bg-setting-sidebar {
    flex: 0 0 188px;
    max-width: 188px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-row > .ant-col.bg-setting-sidebar + .ant-col {
    flex: 1 1 0%;
    max-width: calc(100% - 188px);
    min-width: 0;
  }
  /* Change Plan cards: name | features | price | button were 8/8/4/4 of a narrow card, so prices broke over three
     lines and "Subscribe >>" ran out of its button onto the white card. Two columns per row instead. */
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-hoverable:has(.anticon-double-right) > .ant-card-body > .ant-row {
    row-gap: 16px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-hoverable:has(.anticon-double-right) > .ant-card-body > .ant-row > :is(.ant-col-lg-8, .ant-col-lg-4) {
    flex: 0 0 50%;
    max-width: 50%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .ant-card-hoverable:has(.anticon-double-right) > .ant-card-body > .ant-row > .ant-col-lg-4 h3 {
    white-space: nowrap;
  }
  /* #8 POS footer: the Discount field (fixed-width % picker + number) gets a little more of the row */
  html:not(.sbab-on) #app .pos-left-footer .bill-footer > .ant-row > .ant-col:nth-child(odd) {
    flex: 0 0 31%;
    max-width: 31%;
  }
  html:not(.sbab-on) #app .pos-left-footer .bill-footer > .ant-row > .ant-col:nth-child(2) {
    flex: 0 0 38%;
    max-width: 38%;
  }
  /* Grand Total gets its own row here too (#8), so the cart list is 50px shorter than the app's
     calc(100vh - 420px); Pay Now / Reset stay 12px above the bottom edge, as on desktop */
  html:not(.sbab-on) #app .left-pos-middle-table {
    height: calc(100vh - 474px) !important;
    height: calc(100dvh - 474px) !important;
    min-height: 200px;
  }
  /* #6 Dashboard KPI tiles: three per row so values and labels are not cut off */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container .ant-col-lg-4:has(.custom-card-widget) {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
  }
  /* Dashboard "Top Selling Product" card was a quarter of the row (~170px): title and legend were cut off.
     It gets 40% and "Sales & Purchases" the other 60%. */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-lg-6:has(+ .ant-col-lg-18) {
    flex: 0 0 40%;
    max-width: 40%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-lg-6 + .ant-col-lg-18 {
    flex: 0 0 60%;
    max-width: 60%;
  }
  /* #6 Date-range picker gets enough width to show both dates */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-lg-6:has(> .ant-picker-range) {
    flex: 0 0 40%;
    max-width: 40%;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-lg-6:empty {
    display: none;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container > .ant-row > .ant-col-lg-6:has(.ant-input-group-compact) {
    flex: 1 1 0%;
    max-width: none;
  }
}

/* ---------- Phones (<576px): dashboard quick-date buttons ---------- */
@media (max-width: 575.98px) {
  /* Today / Last 7Days / This Month / This Year: at 360-390px they wrapped 3+1 ("This Year" alone on a second line).
     One row that fits the width: tighter padding, a 4px gap instead of the inline 4px left margins. */
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container .ant-input-group-compact:has(> .ant-btn + .ant-btn) {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
  }
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container .ant-input-group-compact:has(> .ant-btn + .ant-btn) > .ant-btn {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0 !important;
    padding-left: 6px;
    padding-right: 6px;
  }
}
@media (max-width: 359.98px) {
  html:not(.sbab-on) #components-layout-demo-responsive .dashboard-page-content-container .ant-input-group-compact:has(> .ant-btn + .ant-btn) > .ant-btn {
    padding-left: 3px;
    padding-right: 3px;
    font-size: 13px;
  }
}
