.mobile-dashboard-label {
    display: none;
}

@media (max-width: 767px) {
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) > div.d-flex.justify-content-between {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        margin-bottom: 10px !important;
    }
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) > div.d-flex.justify-content-between > div:first-child {
        display: none !important;
    }
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) > div.d-flex.justify-content-between > div:last-child {
        width: auto !important;
        justify-content: flex-end !important;
    }
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) h1.brand-logo {
        flex: none;
        width: auto;
        margin: 0;
    }
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) .brand-logo svg {
        width: 42px;
        height: 42px;
    }
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) #pharmacyTabs .md-tab-btn {
        min-height: 40px;
    }

    #inventory, #pos {
        --mobile-line: var(--o-line, var(--win-stroke));
        --mobile-surface: var(--o-surface-raised, #fff);
        --mobile-muted: var(--o-ink-muted, #3f6b62);
    }
    body.theme-dark :is(#inventory, #pos) {
        --mobile-surface: var(--o-surface-raised, #13201d);
        --mobile-muted: var(--o-ink-muted, #9ab3ae);
        --mobile-line: var(--o-line, #24403a);
    }
    #inventory .mobile-dashboard-label,
    #pos .mobile-dashboard-label {
        display: block;
        margin: 0;
        font-size: .76rem;
        font-weight: 600;
        line-height: 1.3;
        color: var(--mobile-muted);
    }
    :is(#inventory, #pos) [data-item-actions]:focus-visible {
        outline: 2px solid var(--o-tigris, #0d9488);
        outline-offset: -2px;
    }
    :is(#inventory, #pos) [data-item-actions] .bx-sign { display: none; }

    #inventory .inv-filterbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        margin: 0 0 8px;
    }
    #inventory .inv-filterbar #tableSearch { min-height: 44px; font-size: 1rem; }
    #inventory .inv-filterbar > .d-inline-flex {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #inventory .inv-filterbar .stat-card {
        min-width: 0;
        min-height: 44px;
        justify-content: flex-start;
    }
    #inventory .inv-filterbar .inv-total { justify-content: flex-end; }
    #inventory #stockEntryCards .stock-entry-card { margin-bottom: 10px !important; }
    #inventory .stock-entry-card .card-header {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center !important;
        gap: 7px !important;
    }
    #inventory .stock-entry-card .card-header h4 {
        grid-column: 1 / 3;
        grid-row: 1;
    }
    #inventory .stock-entry-card .card-header > div.d-flex { display: contents !important; }
    #inventory .stock-entry-card .card-header .win-action-btn {
        min-width: 0;
        min-height: 42px;
        height: auto;
        justify-content: center;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }
    #inventory .stock-entry-card .card-header [data-stock-action="collapse"] {
        grid-column: 3;
        grid-row: 1;
        width: auto;
        color: var(--o-tigris-strong, var(--win-accent-hover));
    }
    #inventory .stock-entry-card .card-header [data-stock-action="collapse"] .mobile-dashboard-label { color: inherit; }
    #inventory .stock-entry-fields.win-collapsed { visibility: hidden; }
    #inventory .win-form-grid { padding: 12px; }
    #inventory .win-form-grid input:not([type="checkbox"]),
    #inventory .win-form-grid select { min-height: 44px; font-size: 1rem !important; }
    #inventory .win-form-grid .win-field:first-child,
    #inventory .win-form-grid .win-field:nth-child(2) { grid-column: 1 / -1; }
    #inventory .win-actions-cell button { min-height: 42px; }

    #inventory #inventoryTable { display: block; width: 100%; }
    #inventory #inventoryTable thead {
        display: block;
        padding: 4px 8px;
        border-bottom: 1px solid var(--mobile-line);
    }
    #inventory #inventoryTable thead tr {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 2px 6px;
    }
    #inventory #inventoryTable thead th {
        display: flex;
        align-items: center;
        min-height: 40px;
        padding: 5px 8px;
        width: auto !important;
        max-width: none !important;
        border: 0;
    }
    #inventory #inventoryTable thead th.inv-pick-cell { flex: 1 0 100%; gap: 8px; }
    #inventory #inventoryTable thead th.inv-pick-cell label { cursor: pointer; }
    #inventory #inventoryTable thead th:not(.inv-pick-cell, [tabindex]) { display: none; }
    #inventory #inventoryTable thead th[tabindex] {
        background: var(--mobile-surface);
        border: 1px solid var(--mobile-line);
        border-radius: 7px;
        white-space: nowrap;
    }
    #inventory #inventoryTable thead th[tabindex]:focus-visible {
        outline: 2px solid var(--o-tigris, var(--win-accent));
        outline-offset: 2px;
    }
    #inventory #inventoryTable tbody { display: block; width: 100%; }
    #inventory #inventoryTable tbody > tr:not(.expand-trigger, .expansion-row),
    #inventory #inventoryTable tbody > tr:not(.expand-trigger, .expansion-row) > td { display: block; }
    #inventory #inventoryTable .expand-trigger {
        display: grid;
        grid-template-columns: 24px repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 5px 7px;
        padding: 9px 10px;
        border-bottom: 1px solid var(--mobile-line);
    }
    #inventory #inventoryTable .expand-trigger > td {
        display: block;
        min-width: 0;
        max-width: none !important;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    #inventory #inventoryTable .expand-trigger .inv-pick-cell {
        grid-area: 1 / 1 / 3 / 2;
        align-self: stretch;
        display: grid;
        place-items: center;
        cursor: default;
    }
    #inventory #inventoryTable .expand-trigger > td:nth-child(2) {
        display: none;
    }
    #inventory #inventoryTable .expand-trigger > td:nth-child(3) { grid-area: 2 / 2 / 3 / 3; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(4) {
        grid-area: 1 / 2 / 2 / -1;
        font-size: .98rem;
        line-height: 1.3;
    }
    #inventory #inventoryTable .expand-trigger > td:nth-child(5) { grid-area: 4 / 2 / 5 / 3; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(6) { grid-area: 4 / 3 / 5 / 4; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(7) { grid-area: 3 / 2 / 4 / 3; font-weight: 700; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(8) { grid-area: 3 / 3 / 4 / 4; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(9) { grid-area: 2 / 3 / 3 / 4; text-align: end !important; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(10) { grid-area: 5 / 2 / 6 / -1; }
    #inventory #inventoryTable .expand-trigger > td:nth-child(10) .mobile-dashboard-label {
        display: inline;
        margin-inline-end: 5px;
    }
    #inventory #inventoryTable .expand-trigger[aria-expanded="true"] { background: var(--o-tigris-soft, rgba(13,148,136,.06)); }
    #inventory #inventoryTable .expansion-row.show,
    #inventory #inventoryTable .expansion-row > td { display: block; width: 100%; }

    #pos #pos-main-row { margin-inline: 0; }
    #pos #pos-main-row > :is(#pos-left-col, #pos-right-col) { padding-inline: 0; }
    #pos #pos-main-row .pos-window-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
    }
    #pos #pos-main-row .pos-window-tabs { min-width: 0; padding: 0; overflow-x: auto; }
    #pos #pos-main-row .pos-window-tab { min-height: 42px; padding-inline: 8px; }
    #pos #pos-main-row .pos-window-close { width: 28px; height: 40px; margin: 0; }
    #pos #pos-main-row .pos-window-add {
        position: sticky;
        inset-inline-end: 0;
        width: 34px;
        height: 40px;
    }
    #pos #pos-main-row .pos-window-bar > .pos-left-header {
        padding: 0 !important;
        justify-content: flex-end;
        overflow: visible;
        gap: 5px;
    }
    #pos #pos-main-row .pos-window-bar .pos-left-ident { display: none; }
    #pos #pos-main-row .pos-window-bar :is(#pos-patients-btn, #add-expenses-btn) {
        width: 42px;
        height: 42px;
    }
    #pos #pos-main-row .pos-window-bar #add-expenses-btn {
        justify-content: center;
        padding: 0;
    }
    #pos #pos-main-row .pos-window-bar #add-expenses-btn > span { display: none; }
    #pos #pos-main-row .pos-window-bar > .pos-search-wrap {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
        margin: 0;
    }
    #pos #pos-main-row .pos-window-bar .pos-search-input {
        min-height: 44px;
        font-size: 1rem;
    }
    #pos #pos-main-row .pos-window-bar .pos-custom-add-btn {
        width: 40px;
        height: 40px;
        inset-inline-start: auto;
        inset-inline-end: 2px;
    }
    #pos #pos-main-row .pos-window-bar .pos-search-input { padding-inline-end: 45px; }
    #pos #pos-main-row .pos-cart-header { display: none; }
    #pos #pos-main-row #cart-items-body {
        grid-template-columns: minmax(0, 1fr);
        max-height: none;
        overflow: visible;
    }
    #pos #pos-main-row #cart-items-body .pos-cart-item {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 7px 9px;
        width: 100%;
        padding: 10px 12px;
    }
    #pos #pos-main-row #cart-items-body .pos-cart-item:has(.pos-qty-sep) {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
    #pos #pos-main-row #cart-items-body .pos-cart-item > div { min-width: 0; }
    #pos #pos-main-row #cart-items-body .pos-item-main { grid-area: 1 / 1 / 2 / -1; }
    #pos #pos-main-row #cart-items-body .pos-cart-item > div:nth-child(2) { grid-area: 2 / 1 / 3 / 2; }
    #pos #pos-main-row #cart-items-body .pos-cart-item > div:nth-child(3) { grid-area: 2 / 2 / 3 / 3; }
    #pos #pos-main-row #cart-items-body .pos-cart-item > div:nth-child(4),
    #pos #pos-main-row #cart-items-body .pos-cost-eye { display: none; }
    #pos #pos-main-row #cart-items-body .pos-item-name {
        font-size: 1rem;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #pos #pos-main-row #cart-items-body .pos-item-meta {
        font-size: .77rem;
        line-height: 1.35;
        white-space: normal;
    }
    #pos #pos-main-row #cart-items-body .pos-qty-group {
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        grid-template-rows: auto auto;
        gap: 3px 5px;
    }
    #pos #pos-main-row #cart-items-body .pos-qty-sep { display: none; }
    #pos #pos-main-row #cart-items-body :is(.pos-qty-input, .pos-subtotal-input) {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        font-size: 1rem;
    }
    #pos #pos-main-row #cart-items-body .pos-subtotal-input { margin-top: 3px; }
    #pos #pos-main-row .pos-notes-row {
        position: static !important;
        height: auto !important;
    }
    #pos #pos-main-row :is(.pos-admin-note, .pos-sticky-note) {
        position: relative !important;
        inset: auto !important;
        width: auto !important;
        min-width: 0 !important;
        margin: 10px 0 0;
        transform: none;
    }
    #pos .pos-l2-actionbar {
        padding: 8px 10px max(8px, env(safe-area-inset-bottom));
        margin-block: 8px 0;
    }
    #pos .pos-l2-actionbar-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 6px;
    }
    #pos .pos-l2-actionbar .pos-cart-total-wrap {
        grid-area: 1 / 1;
        display: flex;
        flex-wrap: wrap;
        align-content: center;
        justify-content: center;
        min-width: 0;
        padding: 4px 6px;
        column-gap: 5px;
    }
    #pos .pos-l2-actionbar .pos-cart-total-label { flex: 0 0 100%; text-align: center; }
    #pos .pos-l2-actionbar .pos-cart-total-amount { font-size: 1.2rem; }
    #pos .pos-l2-actionbar .pos-checkout-btn {
        grid-area: 1 / 2;
        min-width: 0;
        min-height: 48px;
        width: 100%;
        padding: 6px;
    }
    #pos .pos-l2-actionbar .pos-action-row {
        grid-area: 2 / 1 / 3 / -1;
        display: flex;
        gap: 5px;
    }
    #pos .pos-l2-actionbar .pos-action-btn {
        flex: 1;
        min-height: 40px;
        height: auto;
        padding: 4px;
        white-space: normal;
    }
    #pos .pos-l2-actionbar :is(.pos-action-key, .pos-checkout-key) { display: none; }
}

@media (max-width: 359px) {
    .container.mt-5:has(> #pharmacyTabsContent > :is(#inventory, #pos).active) #userMenuBtn .user-role-badge {
        display: none;
    }
    #pos #pos-main-row .pos-window-tab { gap: 4px; padding-inline: 6px; }
    #pos #pos-main-row .pos-window-close { width: 24px; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    #inventory :is(.stock-entry-fields, .inv-collapse-body) { transition: none; }
}
