/* Keep only tiny overrides; theme CSS drives the UI */
html, body {
    font-family: "Poppins", sans-serif;
}

/* Tablet sales workspace */
.tablet-sales-page {
    max-width: 1180px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.tablet-sales-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tablet-sales-heading h1 {
    margin: .2rem 0 .35rem;
    font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.tablet-sales-heading p {
    color: var(--vz-secondary-color);
    margin: 0;
}

.tablet-sales-eyebrow {
    color: var(--vz-primary);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.tablet-touch-button {
    min-height: 48px;
    min-width: 120px;
}

.tablet-icon-button {
    display: inline-grid;
    flex: 0 0 48px;
    height: 48px;
    place-items: center;
    font-size: 1.2rem;
}

.tablet-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.tablet-module-card {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 190px;
    padding: 1.5rem;
    overflow: hidden;
    color: var(--vz-body-color);
    text-align: left;
    background: var(--vz-card-bg);
    border: 1px solid var(--vz-border-color);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 34, 58, .08);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.tablet-module-card:hover,
.tablet-module-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--vz-primary);
    box-shadow: 0 12px 30px rgba(15, 34, 58, .13);
}

.tablet-module-icon {
    display: grid;
    flex: 0 0 72px;
    height: 72px;
    margin-right: 1.25rem;
    place-items: center;
    border-radius: 18px;
    font-size: 2rem;
}

.tablet-module-card-orders .tablet-module-icon {
    color: #ca6510;
    background: rgba(245, 158, 11, .16);
}

.tablet-module-card-invoices .tablet-module-icon {
    color: var(--vz-primary);
    background: rgba(64, 81, 137, .13);
}

.tablet-module-copy {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
}

.tablet-module-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.tablet-module-subtitle {
    margin-top: .2rem;
    color: var(--vz-secondary-color);
}

.tablet-module-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1rem;
    margin-top: 1.1rem;
    color: var(--vz-secondary-color);
    font-size: .86rem;
}

.tablet-module-stats strong {
    color: var(--vz-body-color);
}

.tablet-module-arrow {
    margin-left: .75rem;
    color: var(--vz-primary);
    font-size: 1.5rem;
}

.tablet-filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: .85rem;
    padding: 1rem;
    background: var(--vz-card-bg);
    border: 1px solid var(--vz-border-color);
    border-radius: 14px;
}

.tablet-search-box {
    position: relative;
}

.tablet-search-box > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 1rem;
    color: var(--vz-secondary-color);
    transform: translateY(-50%);
}

.tablet-search-box .form-control {
    min-height: 50px;
    padding-left: 2.8rem;
    font-size: 1rem;
}

.tablet-status-filter {
    min-height: 50px;
    font-size: 1rem;
}

.tablet-result-summary {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    color: var(--vz-secondary-color);
}

.tablet-result-summary .btn-link {
    min-height: 44px;
}

.tablet-document-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.tablet-document-card {
    padding: 1.15rem;
    background: var(--vz-card-bg);
    border: 1px solid var(--vz-border-color);
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(15, 34, 58, .06);
}

.tablet-document-topline,
.tablet-document-total {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.tablet-document-number {
    color: var(--vz-primary);
    font-size: 1.05rem;
    font-weight: 700;
}

.tablet-document-date,
.tablet-document-meta {
    color: var(--vz-secondary-color);
    font-size: .85rem;
}

.tablet-document-customer {
    margin-top: 1rem;
    overflow: hidden;
    font-size: 1.05rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tablet-document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-top: .6rem;
}

.tablet-document-meta span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.tablet-document-total {
    align-items: baseline;
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px dashed var(--vz-border-color);
}

.tablet-document-total span {
    color: var(--vz-secondary-color);
}

.tablet-document-total strong {
    font-size: 1.08rem;
}

.tablet-loading,
.tablet-empty-state {
    display: flex;
    min-height: 240px;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    color: var(--vz-secondary-color);
    background: var(--vz-card-bg);
    border: 1px dashed var(--vz-border-color);
    border-radius: 14px;
}

.tablet-empty-state {
    flex-direction: column;
    text-align: center;
}

.tablet-empty-state > i {
    color: var(--vz-primary);
    font-size: 2.8rem;
}

.tablet-empty-state h3,
.tablet-empty-state p {
    margin: 0;
}

@media (max-width: 767.98px) {
    .tablet-sales-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .tablet-list-heading > .d-flex {
        align-items: flex-start !important;
    }

    .tablet-module-grid,
    .tablet-document-list,
    .tablet-filter-bar {
        grid-template-columns: 1fr;
    }

    .tablet-module-card {
        min-height: 160px;
        padding: 1.15rem;
    }

    .tablet-module-icon {
        flex-basis: 58px;
        height: 58px;
        margin-right: .9rem;
        font-size: 1.65rem;
    }
}

/* Tablet Sales portal: full-screen, sidebar-free POS workspace */
.tablet-portal-shell {
    min-height: 100dvh;
    background: #f6f8fc;
    color: #111827;
}

.tablet-portal-topbar {
    position: relative;
    z-index: 1040;
    display: flex;
    height: 68px;
    align-items: center;
    gap: 1.25rem;
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5eaf2;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}

.tablet-portal-brand {
    display: inline-flex;
    min-width: 170px;
    align-items: center;
    gap: .7rem;
    color: #111827;
}

.tablet-portal-brand:hover { color: #111827; }

.tablet-portal-brand-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #2563eb;
    background: #eef4ff;
    border-radius: 11px;
    font-size: 1.25rem;
}

.tablet-portal-brand strong,
.tablet-portal-brand small,
.tablet-user-copy strong,
.tablet-user-copy small {
    display: block;
}

.tablet-portal-brand strong { font-size: 1rem; }
.tablet-portal-brand small,
.tablet-user-copy small { color: #64748b; font-size: .7rem; }

.tablet-portal-nav {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.tablet-portal-nav-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: .45rem;
    padding: .55rem .8rem;
    color: #64748b;
    border-radius: 10px;
    font-weight: 500;
}

.tablet-portal-nav-link:hover,
.tablet-portal-nav-link.active {
    color: #2563eb;
    background: #eef4ff;
}

.tablet-portal-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-left: auto;
}

.tablet-portal-exit { min-height: 40px; border-radius: 10px; }

.tablet-user-button {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: .65rem;
    padding: .25rem .4rem;
    color: #111827;
    background: transparent;
    border: 0;
}

.tablet-user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #1d4ed8;
    background: #e8efff;
    border-radius: 50%;
    font-weight: 700;
}

.tablet-user-copy { min-width: 88px; text-align: left; }
.tablet-user-copy strong { font-size: .78rem; }

.tablet-portal-content {
    height: calc(100dvh - 68px);
    overflow: auto;
    padding: 14px 16px;
}

.tablet-portal-content .tablet-sales-page {
    width: 100%;
    max-width: none;
}

.portal-route-loading {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    background: #f6f8fc;
}

.tablet-pos-heading {
    min-height: 52px;
    margin: 0;
}

.tablet-pos-title,
.tablet-pos-search {
    display: flex;
    align-items: center;
}

.tablet-pos-title { gap: .75rem; min-width: 360px; }

.tablet-pos-title h1 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    white-space: nowrap;
}

.tablet-pos-docno {
    color: #334155;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.tablet-pos-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .55rem;
    color: #315fd5;
    background: #edf3ff;
    border-radius: 7px;
    font-size: .72rem;
    white-space: nowrap;
}

.tablet-pos-status i { font-size: .48rem; }
.tablet-pos-status.is-locked { color: #047857; background: #ecfdf5; }

.tablet-pos-search {
    position: relative;
    width: min(500px, 42vw);
    margin-right: auto;
}

.tablet-pos-search > i {
    position: absolute;
    z-index: 2;
    color: #64748b;
    font-size: 1.15rem;
}

.tablet-pos-search > i:first-child { left: 1rem; }
.tablet-pos-search > i:last-child { right: 1rem; }

/* Typeahead under the POS search box */
.tablet-pos-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1090;
    max-height: min(52vh, 380px);
    overflow: auto;
    background: #fff;
    border: 1px solid #d8dfeb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
    padding: .3rem;
}

.tablet-pos-suggestion {
    display: grid;
    grid-template-columns: minmax(84px, auto) 1fr auto;
    gap: .25rem .75rem;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: .5rem .75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    color: #1e293b;
}

.tablet-pos-suggestion:hover,
.tablet-pos-suggestion.active {
    background: #eef2ff;
}

.tablet-pos-suggestion-code { font-weight: 600; white-space: nowrap; }
.tablet-pos-suggestion-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tablet-pos-suggestion-barcode { font-size: .75rem; color: #64748b; white-space: nowrap; }

.tablet-pos-search .form-control {
    min-height: 46px;
    padding: .65rem 3rem;
    border-color: #d8dfeb;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content:has(.tablet-entry-page) { overflow: hidden; }

    .tablet-entry-page {
        display: grid;
        height: 100%;
        grid-template-columns: minmax(0, 1fr) 280px;
        grid-template-rows: 52px auto minmax(0, 1fr) 146px;
        gap: 10px 12px;
        padding: 0;
    }

    .tablet-entry-page > .tablet-pos-heading {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .tablet-entry-page > .alert {
        position: fixed;
        z-index: 1080;
        top: 76px;
        right: 18px;
        max-width: 520px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    }

    .tablet-entry-page > .tablet-details-section {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .tablet-entry-page > .tablet-items-section {
        grid-column: 1;
        grid-row: 3;
        display: flex;
        min-height: 0;
        flex-direction: column;
        overflow: hidden;
    }

    .tablet-entry-page > .tablet-notes-section {
        grid-column: 1;
        grid-row: 4;
        min-height: 0;
    }

    .tablet-entry-page > .tablet-summary-panel {
        grid-column: 2;
        grid-row: 3 / 5;
    }

    .tablet-entry-section {
        min-width: 0;
        margin: 0;
        padding: .8rem .9rem;
        background: #fff;
        border-color: #e1e7ef;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
    }

    .tablet-entry-section-title,
    .tablet-entry-lines-heading {
        margin-bottom: .6rem;
    }

    .tablet-entry-section-title h2 { font-size: .88rem; }
    .tablet-entry-section-title p,
    .tablet-entry-step { display: none; }

    .tablet-entry-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: .55rem .75rem;
    }

    .tablet-entry-grid .form-label,
    .tablet-line-grid .form-label,
    .tablet-notes-grid .form-label {
        margin-bottom: .22rem;
        color: #334155;
        font-size: .7rem;
        font-weight: 500;
    }

    .tablet-entry-control,
    .tablet-entry-grid .form-control,
    .tablet-entry-grid .form-select {
        min-height: 42px;
        font-size: .78rem;
        border-color: #dce3ed;
        border-radius: 8px;
    }

    .tablet-document-tax {
        position: absolute;
        top: .7rem;
        right: 8.2rem;
        display: flex;
        width: 245px;
        max-width: none;
        align-items: center;
        gap: .55rem;
        margin: 0;
    }

    .tablet-document-tax .form-label { margin: 0; white-space: nowrap; }
    .tablet-document-tax .filter-dropdown { flex: 1; }
    .tablet-items-section { position: relative; }

    .tablet-line-list {
        min-height: 0;
        flex: 1;
        gap: .45rem;
        overflow: auto;
        padding-right: .2rem;
    }

    .tablet-line-card {
        padding: .48rem .55rem;
        background: #fbfcfe;
        border-color: #e3e8f0;
        border-radius: 8px;
    }

    .tablet-line-card-heading {
        float: left;
        width: 42px;
        min-height: 42px;
        justify-content: center;
        margin: 1.05rem .35rem 0 0;
    }

    .tablet-line-card-heading strong { font-size: 0; }
    .tablet-line-card-heading strong::after { content: '#'; color: #64748b; font-size: .72rem; }
    .tablet-line-card-heading .tablet-line-remove { display: none; }

    .tablet-line-grid {
        display: grid;
        grid-template-columns: minmax(135px, 2.2fr) minmax(80px, 1fr) 58px 70px 64px minmax(78px, 1fr);
        gap: .45rem;
    }

    .tablet-line-notes { display: none; }

    .tablet-line-summary {
        display: grid;
        grid-template-columns: 1fr auto auto auto;
        gap: .8rem;
        margin: .4rem 0 0 46px;
        padding-top: .4rem;
        font-size: .7rem;
    }

    .tablet-line-summary::before { content: ''; }

    .tablet-line-remove {
        width: 38px;
        height: 38px;
    }

    .tablet-entry-empty {
        flex: 1;
        min-height: 0;
        background: #fff;
        border: 0;
    }

    .tablet-entry-empty > i { color: #aeb8c8; font-size: 2.4rem; }

    .tablet-notes-section .tablet-entry-section-title { display: none; }
    .tablet-notes-grid { height: 100%; gap: .8rem; }
    .tablet-notes-grid > div { display: flex; min-height: 0; flex-direction: column; }
    .tablet-notes-grid textarea { flex: 1; min-height: 74px; resize: none; border-color: #dce3ed; }

    .tablet-summary-panel {
        position: static;
        display: flex;
        min-height: 0;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        margin: 0;
        padding: 1rem;
        background: #fff;
        border-color: #e1e7ef;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
        backdrop-filter: none;
    }

    .tablet-summary-panel::before {
        content: 'Summary';
        margin-bottom: .9rem;
        color: #111827;
        font-size: 1rem;
        font-weight: 700;
    }

    .tablet-entry-totals {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .tablet-entry-totals span {
        display: flex;
        min-height: 36px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        color: #111827;
    }

    .tablet-entry-totals small { color: #64748b; font-size: .78rem; }

    .tablet-entry-grand {
        min-height: 58px !important;
        margin-top: .55rem;
        padding-top: .7rem;
        border-top: 1px solid #dce3ed;
    }

    .tablet-entry-grand small { color: #111827; font-size: .92rem; font-weight: 600; }
    .tablet-entry-grand strong { color: #2563eb; font-size: 1.45rem; }

    .tablet-entry-actions {
        display: flex;
        flex-direction: column;
        gap: .55rem;
        margin-top: auto;
    }

    .tablet-entry-actions .btn { width: 100%; min-height: 46px; border-radius: 8px; }
    .tablet-entry-actions .btn-success { order: 1; background: #11b95c; border-color: #11b95c; }
    .tablet-entry-actions .btn-primary { order: 2; color: #2563eb; background: #fff; border-color: #2563eb; }
    .tablet-entry-actions .btn-light { order: 3; background: #f1f4f8; border-color: #f1f4f8; }
}

@media (max-width: 767.98px), (orientation: portrait) {
    .tablet-portal-content { height: auto; min-height: calc(100dvh - 68px); }
    .tablet-entry-page { padding-bottom: 1rem; }
    .tablet-pos-heading { flex-wrap: wrap; }
    .tablet-pos-search { width: min(100%, 520px); }
}

@media (max-width: 767.98px) {
    .tablet-portal-topbar { height: 60px; gap: .5rem; padding: 0 .75rem; }
    .tablet-portal-content { min-height: calc(100dvh - 60px); padding: 10px; }
    .tablet-portal-brand { min-width: 0; }
    .tablet-portal-brand > span:last-child,
    .tablet-user-copy,
    .tablet-portal-exit,
    .tablet-portal-nav-link span { display: none; }
    .tablet-portal-nav { margin-left: auto; }
    .tablet-portal-user { margin-left: 0; }
    .tablet-pos-title { min-width: 0; flex-wrap: wrap; }
    .tablet-pos-search { width: 100%; }
}

.search-box {
    min-width: 280px;
}

/* Global font scale override (base 12px) */
html[data-theme] {
    --tb-font-3xs: 0.5625rem;   /* 9px */
    --tb-font-2xs: 0.625rem;    /* 10px */
    --tb-font-xs: 0.6875rem;    /* 11px */
    --tb-font-sm: 0.75rem;      /* 12px */
    --tb-font-md: 0.8125rem;    /* 13px */
    --tb-font-base: 0.75rem;    /* 12px */
    --tb-font-lg: 0.875rem;     /* 14px */
    --tb-font-xl: 0.9375rem;    /* 15px */
    --tb-font-2xl: 1rem;        /* 16px */
    --tb-font-3xl: 1.0625rem;   /* 17px */
    --tb-font-4xl: 1.1875rem;   /* 19px */
    --tb-font-5xl: 1.3125rem;   /* 21px */

    --tb-body-font-size: var(--tb-font-base);
    --tb-vertical-menu-item-font-size: var(--tb-font-base);
    --tb-vertical-menu-sub-item-font-size: var(--tb-font-base);
}

/* Stock line-entry grids: keep rows clean even with one line */
/* Entry-line tables grow with their rows; the page scrolls, not an inner box. Keeping every
   ancestor overflow:visible lets the searchable dropdowns escape the table and flip upward
   near the bottom of the viewport instead of being clipped. Narrow screens keep a horizontal
   scroller so wide tables stay usable. */
.stock-line-table-wrap {
    overflow: visible;
}

@media (max-width: 991.98px) {
    .stock-line-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
    }
}

.stock-entry-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 170px);
}

.stock-entry-main {
    flex: 1 1 auto;
    min-height: 0;
}

.stock-entry-lines-scroll {
    min-height: 190px;
    position: relative;
    border: 1px solid var(--tb-border-color);
    border-radius: 0.45rem;
}

.stock-entry-lines-scroll .stock-line-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--tb-light);
}

.stock-entry-footer {
    position: sticky;
    bottom: 0;
    z-index: 6;
    background: var(--tb-secondary-bg);
    border-top: 1px solid var(--tb-border-color);
    padding-top: 0.75rem;
}

.stock-line-table {
    table-layout: fixed;
    margin-bottom: 0;
}

.stock-line-table th,
.stock-line-table td {
    vertical-align: middle;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.stock-line-table .dropdown,
.stock-line-table .filter-dropdown {
    width: 100%;
    position: relative;
}

.stock-line-table .form-control-sm,
.stock-line-table .form-select-sm {
    min-height: 2rem;
}

.stock-line-table .line-action-cell {
    text-align: center;
    white-space: nowrap;
}

/* Purchase document entry forms */
.purchase-entry-card {
    border-radius: 1rem;
}

.purchase-entry-card .card-body {
    padding-top: 0.85rem;
}

.purchase-entry-form {
    row-gap: 0.45rem;
}

.purchase-entry-form .form-label {
    margin-bottom: 0.18rem;
    color: var(--tb-body-color);
    font-weight: 500;
}

.purchase-entry-form .form-control,
.purchase-entry-form .form-select {
    min-height: 2.08rem;
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
}

.account-entry-switch {
    min-height: 2.08rem;
    padding-top: 0.38rem;
    margin-top: 1.35rem;
}

@media (min-width: 1200px) {
    .purchase-bill-settlement-col {
        flex: 0 0 12.5%;
        max-width: 12.5%;
    }

    .purchase-bill-cashbank-col {
        flex: 0 0 20.833333%;
        max-width: 20.833333%;
    }
}

.purchase-line-heading {
    font-size: 1rem;
    font-weight: 600;
}

.document-line-toolbar,
.document-line-actions,
.document-tax-control {
    display: flex;
    align-items: center;
}

.document-line-toolbar {
    justify-content: space-between;
    gap: 1rem;
}

.document-line-actions {
    justify-content: flex-end;
    gap: 0.75rem;
}

.document-tax-control {
    gap: 0.5rem;
}

.document-tax-control .form-label {
    margin: 0;
    white-space: nowrap;
}

.document-tax-control .filter-dropdown {
    width: 15rem;
}

.purchase-line-table {
    min-width: 1080px;
}

.purchase-line-table thead th {
    background: var(--tb-light);
    color: var(--tb-body-color);
    font-weight: 600;
    border-bottom: 1px solid var(--tb-border-color);
}

.purchase-line-table th,
.purchase-line-table td {
    padding-top: 0.28rem;
    padding-bottom: 0.28rem;
}

.purchase-line-table .purchase-item-picker {
    min-width: 1.85rem;
    max-width: 1.85rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    color: transparent;
}

.purchase-line-table .purchase-item-picker::before {
    content: "\F52A";
    font-family: "remixicon";
    color: var(--tb-body-color);
}

.purchase-line-table .purchase-item-code-picker {
    min-width: 100%;
    font-size: var(--tb-font-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.purchase-line-text {
    display: block;
    min-height: 1.75rem;
    padding-top: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.purchase-entry-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    flex-wrap: nowrap;
    position: sticky;
    bottom: 0;
    z-index: 6;
    background: var(--tb-secondary-bg);
    border-top: 1px solid var(--tb-border-color);
    padding: 0.45rem 0 0;
}

.purchase-footer-right {
    display: contents;
}

.purchase-footer-actions-start,
.purchase-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.purchase-footer-actions-start {
    order: 1;
}

.purchase-footer-actions {
    order: 2;
}

.purchase-footer-totals {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 0.8rem;
    justify-content: flex-end;
    margin-left: auto;
    order: 3;
}

.purchase-total-item {
    min-width: 5.25rem;
    text-align: right;
}

.purchase-total-item span {
    display: block;
    color: var(--tb-body-color);
    font-size: var(--tb-font-xs);
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.purchase-total-item strong {
    display: block;
    font-size: var(--tb-font-lg);
    font-weight: 600;
}

.purchase-total-discount strong {
    color: var(--tb-danger);
}

.purchase-total-grand strong {
    color: var(--tb-primary);
}

.purchase-footer-pill {
    min-width: 6.25rem;
    border-radius: 999px;
    font-weight: 600;
}

.document-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.document-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.document-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.2rem 0.8rem;
    border: 1px solid var(--tb-border-color);
    border-radius: 999px;
    background: var(--tb-light);
    font-weight: 600;
}

.document-tab-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem;
    border: 1px solid var(--tb-border-color);
    border-radius: 999px;
    background: var(--tb-tertiary-bg);
}

.document-tab-button {
    border: 0;
    background: transparent;
    color: var(--tb-body-color);
    min-height: 2rem;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    font-weight: 600;
}

.document-tab-button.active {
    background: var(--tb-primary);
    color: #fff;
}

.journal-trace-card {
    border: 1px solid var(--tb-border-color);
    border-radius: 0.75rem;
    padding: 0.9rem;
    background: var(--tb-secondary-bg);
}

.journal-trace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.85rem;
}

.journal-trace-scroll {
    min-height: 220px;
    max-height: clamp(220px, 44vh, 540px);
}

.journal-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 1px dashed var(--tb-border-color);
    border-radius: 0.6rem;
    color: var(--tb-secondary-color);
    background: var(--tb-tertiary-bg);
    text-align: center;
    padding: 1rem;
}

.journal-detail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.34);
    z-index: 1050;
}

.journal-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.journal-detail-card {
    width: min(1120px, 100%);
    max-height: calc(100vh - 3rem);
    overflow: hidden;
    border-radius: 0.9rem;
    border: 1px solid var(--tb-border-color);
    background: var(--tb-secondary-bg);
    box-shadow: var(--tb-box-shadow-lg);
    display: flex;
    flex-direction: column;
}

.journal-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--tb-border-color);
}

.journal-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.9rem 1rem;
}

.journal-detail-summary span {
    display: block;
    font-size: var(--tb-font-xs);
    text-transform: uppercase;
    color: var(--tb-secondary-color);
    margin-bottom: 0.2rem;
}

.journal-detail-summary strong {
    display: block;
    font-size: var(--tb-font-base);
}

.journal-detail-scroll {
    min-height: 260px;
    margin: 0 1rem 1rem;
}

@media (max-width: 991.98px) {
    .document-line-toolbar,
    .document-line-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .document-tax-control .filter-dropdown {
        width: min(100%, 20rem);
    }

    .purchase-entry-footer,
    .purchase-footer-right,
    .purchase-footer-totals,
    .purchase-footer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .purchase-entry-footer {
        flex-wrap: wrap;
    }

    .purchase-footer-right {
        display: flex;
        width: 100%;
    }

    .purchase-footer-totals {
        margin-left: 0;
        width: 100%;
    }

    .purchase-total-item {
        min-width: 0;
        text-align: left;
    }

    .document-toolbar,
    .document-toolbar-actions,
    .journal-trace-header {
        align-items: stretch;
        flex-direction: column;
    }

    .document-tab-switch {
        display: flex;
    }

    .journal-detail-summary {
        grid-template-columns: 1fr;
    }
}

/* Shared searchable dropdown. The menu normally matches its button; when the dropdown sits in a
   scrolling container (tablet line lists, .table-responsive, list scrollers) it is positioned
   fixed by ui-helpers.js so it can escape the clip, and its width is set inline at open time. */
.filter-dropdown-menu {
    z-index: 1085;
    width: 100%;
    min-width: 0;
}

.filter-dropdown-options {
    max-height: 220px;
    overflow: auto;
}

.filter-dropdown-options .dropdown-item {
    white-space: normal;
}

.filter-dropdown-subtext {
    display: block;
    color: var(--tb-secondary-color, #878a99);
    font-size: 0.72rem;
    line-height: 1.1;
}

/* Stock balances report table */
.stock-balance-card {
    border-radius: 1rem;
}

.stock-balance-table-scroll,
.stock-movement-table-scroll,
.stock-list-table-scroll,
.erp-list-table-scroll {
    max-height: clamp(320px, 52vh, 620px);
    overflow: auto;
    border-bottom: 1px solid var(--tb-border-color);
}

.stock-balance-table,
.stock-movement-table,
.stock-list-table,
.erp-list-table {
    min-width: 980px;
}

.stock-movement-table {
    min-width: 1120px;
}

.stock-balance-table thead th,
.stock-movement-table thead th,
.stock-list-table thead th,
.erp-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--tb-light);
    color: var(--tb-body-color);
    font-weight: 600;
    border-bottom: 1px solid var(--tb-border-color);
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.stock-balance-table tbody td,
.stock-movement-table tbody td,
.stock-list-table tbody td,
.erp-list-table tbody td {
    border-bottom: 1px solid var(--tb-border-color);
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
}

.stock-balance-total-row,
.stock-movement-total-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(145px, 1fr));
    gap: 1rem;
    padding: 1rem 0 0.25rem;
    min-width: 980px;
}

@media (max-width: 991.98px) {
    .stock-balance-total-row,
    .stock-movement-total-row {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
}

@media (max-width: 991.98px) {
    .stock-entry-shell {
        min-height: auto;
    }

}

.tablet-module-cell {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .75rem;
}

.tablet-dashboard-create {
    min-height: 48px;
}

.tablet-document-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .9rem;
}

.tablet-entry-page {
    padding-bottom: 7rem;
}

.tablet-entry-section {
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: var(--vz-card-bg);
    border: 1px solid var(--vz-border-color);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 34, 58, .05);
}

.tablet-entry-section-title,
.tablet-entry-lines-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.tablet-entry-section-title > div:first-of-type:not(.d-flex),
.tablet-entry-lines-heading > .d-flex {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.tablet-entry-section-title h2 {
    margin: 0;
    font-size: 1.1rem;
}

.tablet-entry-section-title p {
    margin: .2rem 0 0;
    color: var(--vz-secondary-color);
    font-size: .85rem;
}

.tablet-entry-step {
    display: grid;
    flex: 0 0 38px;
    height: 38px;
    place-items: center;
    color: var(--vz-primary);
    font-weight: 700;
    background: rgba(64, 81, 137, .12);
    border-radius: 12px;
}

.tablet-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.tablet-entry-control {
    min-height: 48px;
    font-size: .95rem;
}

.tablet-document-tax {
    max-width: 420px;
    margin-bottom: 1rem;
}

.tablet-line-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tablet-line-card {
    padding: 1rem;
    background: rgba(var(--vz-light-rgb), .38);
    border: 1px solid var(--vz-border-color);
    border-radius: 14px;
}

.tablet-line-card-heading {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .65rem;
}

.tablet-line-remove {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
}

.tablet-line-grid {
    display: grid;
    grid-template-columns: 2fr repeat(5, minmax(110px, 1fr));
    gap: .85rem;
}

.tablet-line-notes {
    grid-column: 1 / -1;
}

.tablet-line-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .7rem 1.25rem;
    margin-top: .9rem;
    padding-top: .8rem;
    color: var(--vz-secondary-color);
    border-top: 1px dashed var(--vz-border-color);
}

.tablet-line-summary strong {
    color: var(--vz-body-color);
}

.tablet-entry-empty {
    min-height: 190px;
}

.tablet-notes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.tablet-notes-grid textarea {
    min-height: 100px;
}

.tablet-entry-footer {
    position: sticky;
    z-index: 20;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(var(--vz-body-bg-rgb), .96);
    border: 1px solid var(--vz-border-color);
    border-radius: 16px;
    box-shadow: 0 -5px 22px rgba(15, 34, 58, .09);
    backdrop-filter: blur(8px);
}

.tablet-entry-totals {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem 1.25rem;
}

.tablet-entry-totals span {
    display: flex;
    flex-direction: column;
}

.tablet-entry-totals small {
    color: var(--vz-secondary-color);
}

.tablet-entry-grand strong {
    color: var(--vz-primary);
    font-size: 1.15rem;
}

.tablet-entry-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .6rem;
}

@media (max-width: 1199.98px) {
    .tablet-line-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tablet-line-item-picker {
        grid-column: span 2;
    }
}

@media (max-width: 767.98px) {
    .tablet-entry-grid,
    .tablet-line-grid,
    .tablet-notes-grid {
        grid-template-columns: 1fr;
    }

    .tablet-line-item-picker,
    .tablet-line-notes {
        grid-column: auto;
    }

    .tablet-entry-lines-heading,
    .tablet-entry-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .tablet-entry-actions,
    .tablet-entry-actions .btn {
        width: 100%;
    }

    .tablet-entry-totals {
        justify-content: space-between;
    }
}

/* Tablet sales order and invoice listings */
.tablet-list-page {
    min-height: 100%;
    padding: 2rem 1.5rem;
}

.tablet-list-hero {
    align-items: flex-end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.tablet-list-hero h1 {
    color: #0b1533;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.15;
    margin: .5rem 0 .35rem;
}

.tablet-list-hero p {
    color: #61708f;
    margin: 0;
}

.tablet-list-hero-actions {
    display: flex;
    flex: 0 0 auto;
    gap: .7rem;
}

.tablet-list-hero-actions .btn {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    gap: .5rem;
    justify-content: center;
}

.tablet-list-metrics {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.tablet-list-metric {
    align-items: center;
    background: #fff;
    border: 1px solid #e3e9f3;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    min-height: 104px;
    padding: 1rem 1.15rem;
}

.tablet-list-metric > i {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    flex: 0 0 54px;
    font-size: 1.7rem;
    height: 54px;
    justify-content: center;
}

.tablet-list-metric span,
.tablet-list-metric small,
.tablet-list-metric strong {
    display: block;
}

.tablet-list-metric small {
    color: #61708f;
    font-size: .76rem;
    line-height: 1.25;
}

.tablet-list-metric strong {
    color: #0b1533;
    font-size: 1.7rem;
    line-height: 1.15;
    margin-top: .25rem;
}

.tablet-list-metric.metric-blue > i { background: #eaf1ff; color: #2563eb; }
.tablet-list-metric.metric-amber > i { background: #fff3df; color: #ef8500; }
.tablet-list-metric.metric-green > i { background: #e4f8f1; color: #00a878; }
.tablet-list-metric.metric-neutral > i { background: #f1edff; color: #7146e8; }

.tablet-list-filters {
    align-items: end;
    background: #fff;
    border: 1px solid #e3e9f3;
    border-radius: 8px;
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(230px, 1.6fr) minmax(135px, .65fr) minmax(160px, .9fr) minmax(145px, .7fr) minmax(145px, .7fr) auto;
    margin-bottom: 1rem;
    padding: .75rem;
}

.tablet-list-filters .form-control,
.tablet-list-filters .form-select {
    border-color: #dbe3ef;
    border-radius: 6px;
    font-size: .82rem;
    min-height: 44px;
}

.tablet-date-filter {
    margin: 0;
    position: relative;
}

.tablet-date-filter > span {
    background: #fff;
    color: #697791;
    font-size: .62rem;
    left: .7rem;
    line-height: 1;
    padding: 0 .2rem;
    position: absolute;
    top: -.27rem;
    z-index: 1;
}

.tablet-clear-filter {
    border-radius: 6px;
    height: 44px;
    padding: 0;
    width: 44px;
}

.tablet-list-panel {
    background: #fff;
    border: 1px solid #e3e9f3;
    border-radius: 8px;
    overflow: hidden;
}

.tablet-list-panel-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 76px;
    padding: .9rem 1rem;
}

.tablet-list-panel-heading > div {
    align-items: center;
    display: flex;
    gap: .8rem;
    min-width: 0;
}

.tablet-list-panel-heading strong,
.tablet-list-panel-heading small {
    display: block;
}

.tablet-list-panel-heading strong {
    color: #0b1533;
    font-size: 1rem;
}

.tablet-list-panel-heading small {
    color: #61708f;
    font-size: .72rem;
    margin-top: .12rem;
}

.tablet-list-panel-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    flex: 0 0 42px;
    font-size: 1.25rem;
    height: 42px;
    justify-content: center;
}

.tablet-list-panel-icon.order-icon { background: #fff3e7; color: #ef7800; }
.tablet-list-panel-icon.invoice-icon { background: #eaf1ff; color: #2563eb; }

.tablet-list-count {
    background: #f1f5fb;
    border-radius: 999px;
    color: #50617f;
    font-size: .7rem;
    padding: .4rem .8rem;
    white-space: nowrap;
}

.tablet-table-wrap {
    overflow-x: auto;
}

.tablet-list-table {
    border-collapse: collapse;
    color: #263654;
    font-size: .76rem;
    table-layout: auto;
    width: 100%;
}

.tablet-list-table th {
    background: #f3f6fb;
    color: #40506d;
    font-size: .69rem;
    font-weight: 600;
    padding: .7rem .8rem;
    white-space: nowrap;
}

.tablet-list-table td {
    border-bottom: 1px solid #e7ecf4;
    padding: .68rem .8rem;
    vertical-align: middle;
}

.tablet-list-table tbody tr:hover {
    background: #fafcff;
}

.tablet-doc-link {
    color: #1d5fe9;
    white-space: nowrap;
}

.tablet-cell-subtitle {
    color: #8490a6;
    display: block;
    font-size: .63rem;
    margin-top: .16rem;
}

.tablet-list-table .badge {
    font-size: .64rem;
    font-weight: 600;
    padding: .38rem .52rem;
    white-space: nowrap;
}

.tablet-row-actions {
    align-items: center;
    display: flex;
    gap: .3rem;
    justify-content: flex-end;
    min-height: 32px;
}

.tablet-row-action {
    align-items: center;
    border-radius: 5px;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    padding: 0;
    width: 32px;
}

.tablet-list-pagination {
    align-items: center;
    color: #6c7890;
    display: flex;
    font-size: .7rem;
    justify-content: space-between;
    min-height: 62px;
    padding: .75rem 1rem;
}

.tablet-list-pagination > div {
    align-items: center;
    display: flex;
    gap: .6rem;
}

.tablet-list-pagination .btn {
    align-items: center;
    border-radius: 5px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    padding: 0;
    width: 34px;
}

@media (max-width: 1199.98px) {
    .tablet-list-page { padding: 1.5rem 1rem; }
    .tablet-list-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tablet-list-filters { grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(140px, 1fr)); }
    .tablet-clear-filter { width: 100%; }
}

@media (max-width: 767.98px) {
    .tablet-list-page { padding: 1.25rem 0; }
    .tablet-list-hero { align-items: stretch; flex-direction: column; }
    .tablet-list-hero h1 { font-size: 1.65rem; }
    .tablet-list-hero p { font-size: .82rem; }
    .tablet-list-hero-actions { width: 100%; }
    .tablet-list-hero-actions .btn { flex: 1 1 0; min-width: 0; }
    .tablet-list-metrics { gap: .6rem; }
    .tablet-list-metric { gap: .65rem; min-height: 84px; padding: .75rem; }
    .tablet-list-metric > i { flex-basis: 40px; font-size: 1.25rem; height: 40px; }
    .tablet-list-metric strong { font-size: 1.25rem; }
    .tablet-list-metric small { font-size: .66rem; }
    .tablet-list-filters { grid-template-columns: 1fr 1fr; }
    .tablet-list-filters .tablet-search-box,
    .tablet-list-filters .tablet-customer-filter { grid-column: 1 / -1; }
    .tablet-clear-filter { grid-column: 1 / -1; }
    .tablet-table-wrap { overflow: visible; padding: 0 .75rem; }
    .tablet-list-table,
    .tablet-list-table tbody { display: block; width: 100%; }
    .tablet-list-table thead { display: none; }
    .tablet-list-table tr {
        border: 1px solid #e3e9f3;
        border-radius: 7px;
        display: grid;
        gap: .15rem;
        grid-template-columns: 1fr 1fr;
        margin-bottom: .75rem;
        overflow: hidden;
        padding: .55rem;
    }
    .tablet-list-table td {
        border: 0;
        display: flex;
        flex-direction: column;
        min-width: 0;
        padding: .4rem .5rem;
        text-align: left !important;
    }
    .tablet-list-table td::before {
        color: #8490a6;
        content: attr(data-label);
        font-size: .6rem;
        margin-bottom: .15rem;
        text-transform: uppercase;
    }
    .tablet-list-table td[data-label="Customer"],
    .tablet-list-table td[data-label="Actions"] { grid-column: 1 / -1; }
    .tablet-row-actions { justify-content: flex-start; }
    .tablet-list-pagination { gap: .75rem; }
}

@media (max-width: 399.98px) {
    .tablet-list-metrics { grid-template-columns: 1fr; }
    .tablet-list-filters { grid-template-columns: 1fr; }
    .tablet-list-filters .tablet-search-box,
    .tablet-list-filters .tablet-customer-filter,
    .tablet-clear-filter { grid-column: auto; }
    .tablet-list-panel-heading small { display: none; }
    .tablet-list-pagination { align-items: stretch; flex-direction: column; }
    .tablet-list-pagination > div { justify-content: space-between; }
}

/* Keep the landscape POS overrides last so legacy tablet form rules cannot win the cascade. */
@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content .tablet-entry-page { padding: 0; }
    .tablet-portal-content .tablet-entry-section { margin: 0; padding: .8rem .9rem; border-radius: 12px; }
    .tablet-portal-content .tablet-entry-section-title,
    .tablet-portal-content .tablet-entry-lines-heading { margin-bottom: .6rem; }
    .tablet-portal-content .tablet-entry-step,
    .tablet-portal-content .tablet-entry-section-title p { display: none; }
    .tablet-portal-content .tablet-entry-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .55rem .75rem; }
    .tablet-portal-content .tablet-entry-control { min-height: 42px; font-size: .78rem; }
    .tablet-portal-content .tablet-document-tax { width: 245px; max-width: none; margin: 0; }
    .tablet-portal-content .tablet-line-list { gap: .45rem; }
    .tablet-portal-content .tablet-line-card { position: relative; padding: .48rem 3.35rem .48rem .55rem; border-radius: 8px; }
    .tablet-portal-content .tablet-line-card-heading {
        position: absolute;
        top: 1.5rem;
        right: .5rem;
        float: none;
        width: 38px;
        min-height: 38px;
        margin: 0;
    }
    .tablet-portal-content .tablet-line-card-heading strong { display: none; }
    .tablet-portal-content .tablet-line-card-heading .tablet-line-remove { display: grid; }
    .tablet-portal-content .tablet-line-grid { grid-template-columns: minmax(135px, 2.2fr) minmax(80px, 1fr) 58px 70px 64px minmax(78px, 1fr); gap: .35rem; }
    .tablet-portal-content .tablet-line-summary { display: grid; margin: .4rem 0 0; padding-top: .4rem; }
    .tablet-portal-content .tablet-entry-empty { min-height: 0; }
    .tablet-portal-content .tablet-notes-grid textarea { min-height: 74px; }
    .tablet-portal-content .tablet-summary-panel {
        position: static;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 1rem;
        margin: 0;
        padding: 1rem;
    }
    .tablet-portal-content .tablet-entry-totals { flex-direction: column; flex-wrap: nowrap; gap: 0; }
    .tablet-portal-content .tablet-entry-totals span { flex-direction: row; }
    .tablet-portal-content .tablet-entry-actions { flex-direction: column; flex-wrap: nowrap; margin-top: auto; }
}

/* Tablet POS entry workspace v2 */
.tablet-portal-shell:has(.tablet-entry-page) > .tablet-portal-topbar {
    display: none;
}

.tablet-portal-shell:has(.tablet-entry-page) > .tablet-portal-content {
    height: 100dvh;
    min-height: 100dvh;
    padding: 12px 16px;
}

.tablet-pos-utilities {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: .85rem;
}

.tablet-pos-more {
    align-items: center;
    border: 1px solid #dce3ee;
    border-radius: 6px;
    display: inline-flex;
    gap: .35rem;
    height: 44px;
    justify-content: center;
    min-width: 86px;
}

.tablet-pos-user {
    align-items: center;
    display: flex;
    gap: .55rem;
    min-width: 132px;
}

.tablet-pos-user > span {
    align-items: center;
    background: #eaf1ff;
    border-radius: 50%;
    color: #1d4ed8;
    display: inline-flex;
    flex: 0 0 42px;
    font-weight: 700;
    height: 42px;
    justify-content: center;
}

.tablet-pos-user strong,
.tablet-pos-user small {
    display: block;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tablet-pos-user strong {
    color: #0b1533;
    font-size: 12px;
}

.tablet-pos-user small {
    color: #75819a;
    font-size: 10px;
}

.tablet-line-table-head {
    display: none;
}

.tablet-entry-page .filter-dropdown {
    min-width: 0;
}

.tablet-entry-page .filter-dropdown > .tablet-entry-control {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content .tablet-entry-page {
        display: grid;
        gap: 10px 12px;
        grid-template-columns: minmax(0, 1fr) 320px;
        grid-template-rows: 64px auto minmax(170px, 1fr) 108px;
        height: 100%;
        padding: 0;
    }

    .tablet-entry-page > .tablet-pos-heading {
        align-items: center;
        background: #fff;
        border: 1px solid #e1e7ef;
        border-radius: 8px;
        display: grid;
        gap: 1rem;
        grid-column: 1 / -1;
        grid-row: 1;
        grid-template-columns: minmax(310px, .8fr) minmax(330px, 1.25fr) auto;
        margin: 0;
        padding: .55rem .75rem;
    }

    .tablet-pos-title {
        gap: .65rem;
        min-width: 0;
    }

    .tablet-pos-title h1 {
        color: #0b1533;
        font-size: 18px;
    }

    .tablet-pos-title .tablet-icon-button {
        background: transparent;
        flex-basis: 40px;
        height: 40px;
    }

    .tablet-pos-docno {
        color: #334155;
        font-size: 11px;
    }

    .tablet-pos-search {
        margin: 0;
        width: 100%;
    }

    .tablet-pos-search .form-control {
        border-radius: 6px;
        font-size: 12px;
        min-height: 44px;
    }

    .tablet-entry-page > .alert {
        position: fixed;
        right: 18px;
        top: 12px;
        z-index: 1080;
    }

    .tablet-entry-page > .tablet-details-section {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .tablet-entry-page > .tablet-items-section {
        display: flex;
        grid-column: 1;
        grid-row: 3;
        min-height: 0;
        overflow: hidden;
    }

    .tablet-entry-page > .tablet-notes-section {
        grid-column: 1;
        grid-row: 4;
        min-height: 0;
    }

    .tablet-entry-page > .tablet-summary-panel {
        grid-column: 2;
        grid-row: 3 / 5;
    }

    .tablet-portal-content .tablet-entry-section {
        border-radius: 8px;
        margin: 0;
        padding: .85rem 1rem;
    }

    .tablet-details-section > .tablet-entry-section-title,
    .tablet-notes-section > .tablet-entry-section-title {
        display: none;
    }

    .tablet-portal-content .tablet-entry-grid {
        gap: .7rem .9rem;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .tablet-portal-content .tablet-entry-grid .form-label,
    .tablet-portal-content .tablet-line-grid .form-label,
    .tablet-portal-content .tablet-notes-grid .form-label {
        color: #42506a;
        font-size: 11px;
        font-weight: 500;
        margin-bottom: .3rem;
    }

    .tablet-portal-content .tablet-entry-control,
    .tablet-portal-content .tablet-entry-grid .form-control,
    .tablet-portal-content .tablet-entry-grid .form-select {
        border-radius: 6px;
        font-size: 12px;
        min-height: 42px;
    }

    .tablet-portal-content .tablet-document-tax {
        display: block;
        margin: 0;
        max-width: none;
        position: static;
        width: auto;
    }

    .tablet-details-section > .alert {
        display: none;
    }

    .tablet-entry-lines-heading {
        min-height: 42px;
    }

    .tablet-entry-lines-heading h2 {
        color: #0b1533;
        font-size: 15px;
    }

    .tablet-entry-lines-heading .tablet-touch-button {
        border-radius: 6px;
        font-size: 12px;
        min-height: 40px;
        min-width: 105px;
    }

    .tablet-line-table-head {
        align-items: center;
        background: #f3f6fb;
        color: #40506d;
        display: grid;
        font-size: 10px;
        font-weight: 600;
        grid-template-columns: 28px minmax(0, 1fr) 100px 38px;
        min-height: 38px;
        padding: 0 .4rem;
    }

    .tablet-line-table-head > div {
        display: grid;
        gap: .45rem;
        grid-template-columns: minmax(145px, 2.2fr) minmax(88px, 1fr) 64px 78px 68px minmax(90px, 1fr);
    }

    .tablet-portal-content .tablet-line-list {
        border: 1px solid #e3e8f0;
        border-top: 0;
        flex: 1;
        gap: 0;
        overflow: auto;
        padding: 0;
    }

    .tablet-portal-content .tablet-line-card {
        align-items: center;
        background: #fff;
        border: 0;
        border-bottom: 1px solid #e7ecf3;
        border-radius: 0;
        display: grid;
        gap: .45rem;
        grid-template-columns: 28px minmax(0, 1fr) 100px 38px;
        padding: .5rem .4rem;
        position: relative;
    }

    .tablet-portal-content .tablet-line-card-heading {
        display: contents;
        float: none;
        margin: 0;
        min-height: 0;
        position: static;
        width: auto;
    }

    .tablet-portal-content .tablet-line-card-heading strong {
        display: block;
        font-size: 0;
        grid-column: 1;
        grid-row: 1;
        text-align: center;
    }

    .tablet-portal-content .tablet-line-card-heading strong::after {
        content: counter(tablet-line);
        font-size: 11px;
    }

    .tablet-line-list {
        counter-reset: tablet-line;
    }

    .tablet-line-card {
        counter-increment: tablet-line;
    }

    .tablet-portal-content .tablet-line-card-heading .tablet-line-remove {
        display: grid;
        grid-column: 4;
        grid-row: 1;
        height: 34px;
        width: 34px;
    }

    .tablet-portal-content .tablet-line-grid {
        display: grid;
        gap: .45rem;
        grid-column: 2;
        grid-row: 1;
        grid-template-columns: minmax(145px, 2.2fr) minmax(88px, 1fr) 64px 78px 68px minmax(90px, 1fr);
    }

    .tablet-portal-content .tablet-line-grid .tablet-line-item-picker {
        grid-column: auto;
    }

    .tablet-portal-content .tablet-line-grid .form-label {
        display: none;
    }

    .tablet-portal-content .tablet-line-grid .tablet-entry-control {
        font-size: 11px;
        min-height: 38px;
    }

    .tablet-portal-content .tablet-line-notes {
        display: none;
    }

    .tablet-portal-content .tablet-line-summary {
        border: 0;
        display: block;
        grid-column: 3;
        grid-row: 1;
        margin: 0;
        padding: 0;
        text-align: right;
    }

    .tablet-portal-content .tablet-line-summary span:not(:last-child) {
        display: none;
    }

    .tablet-portal-content .tablet-line-summary span:last-child {
        font-size: 0;
    }

    .tablet-portal-content .tablet-line-summary span:last-child strong {
        font-size: 11px;
        white-space: nowrap;
    }

    .tablet-portal-content .tablet-entry-empty {
        border: 1px solid #e3e8f0;
        border-top: 0;
        flex: 1;
        min-height: 0;
    }

    .tablet-portal-content .tablet-notes-grid {
        gap: 1rem;
        height: 100%;
    }

    .tablet-portal-content .tablet-notes-grid textarea {
        font-size: 12px;
        min-height: 56px;
        resize: none;
    }

    .tablet-portal-content .tablet-summary-panel {
        border-radius: 8px;
        padding: 1.1rem;
    }

    .tablet-portal-content .tablet-summary-panel::before {
        font-size: 16px;
    }

    .tablet-portal-content .tablet-entry-totals small {
        font-size: 12px;
    }

    .tablet-portal-content .tablet-entry-totals strong {
        font-size: 12px;
    }

    .tablet-portal-content .tablet-entry-grand strong {
        font-size: 22px;
    }

    .tablet-portal-content .tablet-entry-actions .btn {
        border-radius: 6px;
        font-size: 12px;
        min-height: 48px;
    }
}

@media (max-width: 767.98px), (orientation: portrait) {
    .tablet-portal-shell:has(.tablet-entry-page) > .tablet-portal-content {
        height: 100dvh;
        min-height: 100dvh;
        overflow: auto;
        padding: 10px;
    }

    .tablet-entry-page .tablet-pos-heading {
        align-items: stretch;
        background: #fff;
        border: 1px solid #e1e7ef;
        border-radius: 8px;
        display: flex;
        flex-direction: row;
        gap: .75rem;
        padding: .65rem;
    }

    .tablet-entry-page .tablet-pos-title {
        flex: 1 1 auto;
    }

    .tablet-entry-page .tablet-pos-search {
        flex: 1 0 100%;
        order: 3;
    }

    .tablet-pos-utilities {
        margin-left: auto;
    }

    .tablet-entry-page .tablet-entry-section {
        border-radius: 8px;
    }
}

@media (min-width: 576px) and (max-width: 899.98px) and (orientation: portrait) {
    .tablet-entry-page .tablet-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .tablet-pos-more span,
    .tablet-pos-user div,
    .tablet-pos-docno {
        display: none;
    }

    .tablet-pos-more {
        min-width: 42px;
        width: 42px;
    }

    .tablet-pos-user {
        min-width: 38px;
    }

    .tablet-pos-user > span {
        flex-basis: 38px;
        height: 38px;
    }
}

@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content .tablet-order-details-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .tablet-portal-content .tablet-order-details-grid .tablet-tax-wide {
        grid-column: span 2;
    }

    .tablet-portal-content .tablet-invoice-details-grid {
        grid-template-columns: 1.15fr 1.15fr 1fr .72fr 1.25fr .82fr;
    }

    .tablet-entry-page .tablet-entry-step,
    .tablet-entry-page .tablet-entry-section-title p {
        display: none;
    }

    .tablet-entry-page .tablet-entry-lines-heading > .d-flex {
        min-width: 0;
    }

    .tablet-entry-page .tablet-entry-lines-heading h2 {
        margin: 0;
        white-space: nowrap;
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) and (orientation: landscape) {
    .tablet-portal-content .tablet-entry-page {
        gap: 8px;
        grid-template-columns: minmax(0, 1fr) 252px;
    }

    .tablet-entry-page > .tablet-pos-heading {
        gap: .65rem;
        grid-template-columns: minmax(210px, .8fr) minmax(230px, 1.15fr) auto;
    }

    .tablet-pos-utilities {
        gap: .45rem;
    }

    .tablet-pos-more {
        min-width: 70px;
    }

    .tablet-pos-user {
        min-width: 104px;
    }

    .tablet-pos-user strong,
    .tablet-pos-user small {
        max-width: 66px;
    }

    .tablet-portal-content .tablet-entry-section {
        padding: .7rem .75rem;
    }

    .tablet-entry-page .tablet-entry-lines-heading {
        gap: .5rem;
        min-height: 36px;
    }

    .tablet-entry-page .tablet-entry-lines-heading .tablet-touch-button {
        min-height: 36px;
        min-width: 92px;
        padding-inline: .65rem;
    }

    .tablet-entry-page .tablet-line-table-head,
    .tablet-portal-content .tablet-line-card {
        gap: .3rem;
        grid-template-columns: 24px minmax(0, 1fr) 74px 32px;
    }

    .tablet-entry-page .tablet-line-table-head > div,
    .tablet-portal-content .tablet-line-grid {
        gap: .3rem;
        grid-template-columns: minmax(110px, 2fr) minmax(65px, .9fr) 46px 60px 50px minmax(64px, .9fr);
    }

    .tablet-portal-content .tablet-line-card-heading .tablet-line-remove {
        height: 30px;
        width: 30px;
    }

    .tablet-portal-content .tablet-line-grid .tablet-entry-control {
        font-size: 10px;
        min-height: 34px;
        padding-inline: .4rem;
    }

    .tablet-portal-content .tablet-line-summary span:last-child strong {
        font-size: 10px;
    }

    .tablet-portal-content .tablet-summary-panel {
        min-height: 0;
        overflow-y: auto;
        padding: .85rem;
    }

    .tablet-portal-content .tablet-summary-panel::before {
        margin-bottom: .55rem;
    }

    .tablet-portal-content .tablet-entry-actions .btn {
        min-height: 42px;
    }
}

@media (min-width: 768px) and (max-width: 899.98px) and (orientation: landscape) {
    .tablet-portal-content .tablet-entry-page {
        grid-template-columns: minmax(0, 1fr) 228px;
    }

    .tablet-entry-page > .tablet-pos-heading {
        grid-template-columns: minmax(190px, .8fr) minmax(210px, 1.15fr) auto;
    }

    .tablet-pos-user div {
        display: none;
    }

    .tablet-pos-user {
        min-width: 42px;
    }

    .tablet-entry-page .tablet-line-table-head,
    .tablet-portal-content .tablet-line-card {
        grid-template-columns: 20px minmax(0, 1fr) 60px 30px;
    }

    .tablet-entry-page .tablet-line-table-head > div,
    .tablet-portal-content .tablet-line-grid {
        gap: .25rem;
        grid-template-columns: minmax(90px, 2fr) minmax(50px, .9fr) 38px 48px 42px minmax(56px, .9fr);
    }

    .tablet-portal-content .tablet-line-grid .tablet-entry-control {
        font-size: 9px;
        padding-inline: .25rem;
    }
}

@media (min-width: 768px) and (orientation: landscape) and (max-height: 650px) {
    .tablet-portal-shell:has(.tablet-entry-page) > .tablet-portal-content {
        padding: 6px 8px;
    }

    .tablet-portal-content .tablet-entry-page {
        gap: 6px 8px;
        grid-template-rows: 48px auto minmax(112px, 1fr) 70px;
    }

    .tablet-entry-page > .tablet-pos-heading {
        min-height: 48px;
        padding: .3rem .5rem;
    }

    .tablet-pos-title {
        gap: .35rem;
    }

    .tablet-pos-title h1 {
        font-size: 15px;
    }

    .tablet-pos-title .tablet-icon-button,
    .tablet-pos-user > span {
        flex-basis: 34px;
        height: 34px;
    }

    .tablet-pos-search .form-control,
    .tablet-pos-more {
        height: 36px;
        min-height: 36px;
    }

    .tablet-pos-search .form-control {
        font-size: 10px;
        padding-block: .35rem;
    }

    .tablet-portal-content .tablet-entry-section {
        padding: .45rem .55rem;
    }

    .tablet-portal-content .tablet-entry-grid {
        gap: .3rem .55rem;
    }

    .tablet-portal-content .tablet-entry-grid .form-label {
        font-size: 9px;
        margin-bottom: .1rem;
    }

    .tablet-portal-content .tablet-entry-control,
    .tablet-portal-content .tablet-entry-grid .form-control,
    .tablet-portal-content .tablet-entry-grid .form-select {
        font-size: 10px;
        min-height: 32px;
    }

    .tablet-entry-page .tablet-entry-lines-heading {
        margin-bottom: .3rem;
        min-height: 30px;
    }

    .tablet-entry-page .tablet-entry-lines-heading h2 {
        font-size: 13px;
    }

    .tablet-entry-page .tablet-entry-lines-heading .tablet-touch-button {
        font-size: 10px;
        min-height: 32px;
        min-width: 82px;
        padding: .3rem .55rem;
    }

    .tablet-entry-page .tablet-line-table-head {
        font-size: 9px;
        min-height: 28px;
    }

    .tablet-portal-content .tablet-line-card {
        padding-block: .3rem;
    }

    .tablet-portal-content .tablet-line-grid .tablet-entry-control {
        font-size: 9px;
        min-height: 30px;
    }

    .tablet-portal-content .tablet-line-card-heading .tablet-line-remove {
        height: 28px;
        width: 28px;
    }

    .tablet-portal-content .tablet-notes-grid {
        gap: .5rem;
    }

    .tablet-portal-content .tablet-notes-grid .form-label {
        font-size: 9px;
        margin-bottom: .1rem;
    }

    .tablet-portal-content .tablet-notes-grid textarea {
        font-size: 10px;
        min-height: 38px;
        padding: .3rem .45rem;
    }

    .tablet-portal-content .tablet-summary-panel {
        gap: .3rem;
        padding: .45rem .55rem;
    }

    .tablet-portal-content .tablet-summary-panel::before {
        display: none;
    }

    .tablet-portal-content .tablet-entry-totals span {
        min-height: 20px;
    }

    .tablet-portal-content .tablet-entry-totals small,
    .tablet-portal-content .tablet-entry-totals strong {
        font-size: 9px;
    }

    .tablet-portal-content .tablet-entry-grand {
        min-height: 34px !important;
        margin-top: .2rem;
        padding-top: .3rem;
    }

    .tablet-portal-content .tablet-entry-grand strong {
        font-size: 17px;
    }

    .tablet-portal-content .tablet-entry-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .3rem;
        margin-top: auto;
    }

    .tablet-portal-content .tablet-entry-actions .btn {
        font-size: 9px;
        min-height: 32px;
        padding: .25rem .35rem;
    }

    .tablet-portal-content .tablet-entry-actions .btn-light {
        grid-column: 1 / -1;
    }
}

/* =========================================================================
   Tablet POS list workspace (Orders / Invoices lists)
   Mirrors the landscape entry-page treatment: the page becomes a fixed-height
   column that fits the viewport; only the table scrolls. Rules are scoped to
   .tablet-list-page so the entry page and its .tablet-pos-* rules are untouched.
   ========================================================================= */
@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content:has(.tablet-list-page) {
        overflow: hidden;
        padding: 12px 16px;
    }

    .tablet-portal-content .tablet-list-page {
        display: flex;
        flex-direction: column;
        gap: 10px;
        height: 100%;
        min-height: 0;
        padding: 0;
    }

    /* Hero -> compact heading strip */
    .tablet-portal-content .tablet-list-hero {
        align-items: center;
        background: #fff;
        border: 1px solid #e1e7ef;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
        flex: 0 0 auto;
        gap: 1rem;
        margin: 0;
        min-height: 60px;
        padding: .55rem .9rem;
    }

    .tablet-portal-content .tablet-list-hero > div:first-child {
        align-items: baseline;
        display: flex;
        flex-wrap: wrap;
        gap: .2rem .75rem;
        min-width: 0;
    }

    .tablet-portal-content .tablet-list-hero .tablet-sales-eyebrow { display: none; }

    .tablet-portal-content .tablet-list-hero h1 {
        font-size: 18px;
        margin: 0;
        white-space: nowrap;
    }

    .tablet-portal-content .tablet-list-hero p {
        font-size: .74rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tablet-portal-content .tablet-list-hero-actions { gap: .55rem; }

    .tablet-portal-content .tablet-list-hero-actions .btn {
        border-radius: 8px;
        font-size: .8rem;
        min-height: 42px;
        min-width: 0;
        padding: .45rem .9rem;
    }

    /* Metrics -> single compact strip */
    .tablet-portal-content .tablet-list-metrics {
        flex: 0 0 auto;
        gap: 10px;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin: 0;
    }

    .tablet-portal-content .tablet-list-metric {
        border-color: #e1e7ef;
        border-radius: 12px;
        gap: .7rem;
        min-height: 60px;
        padding: .5rem .8rem;
    }

    .tablet-portal-content .tablet-list-metric > i {
        border-radius: 8px;
        flex-basis: 38px;
        font-size: 1.2rem;
        height: 38px;
    }

    .tablet-portal-content .tablet-list-metric span {
        align-items: baseline;
        display: flex;
        flex-direction: row-reverse;
        gap: .45rem;
        justify-content: flex-end;
        min-width: 0;
    }

    .tablet-portal-content .tablet-list-metric small {
        font-size: .7rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tablet-portal-content .tablet-list-metric strong {
        font-size: 1.25rem;
        margin: 0;
    }

    /* Filters -> single row */
    .tablet-portal-content .tablet-list-filters {
        border-color: #e1e7ef;
        border-radius: 12px;
        flex: 0 0 auto;
        gap: .55rem;
        grid-template-columns: minmax(190px, 1.6fr) minmax(115px, .7fr) minmax(140px, 1fr) minmax(128px, .8fr) minmax(128px, .8fr) auto;
        margin: 0;
        padding: .55rem;
    }

    .tablet-portal-content .tablet-list-filters .form-control,
    .tablet-portal-content .tablet-list-filters .form-select {
        border-color: #dce3ed;
        border-radius: 8px;
        font-size: .78rem;
        min-height: 42px;
    }

    .tablet-portal-content .tablet-list-filters .tablet-search-box .form-control { padding-left: 2.4rem; }
    .tablet-portal-content .tablet-list-filters .tablet-search-box > i { left: .85rem; font-size: 1rem; }
    .tablet-portal-content .tablet-list-filters .tablet-search-box,
    .tablet-portal-content .tablet-list-filters .tablet-customer-filter,
    .tablet-portal-content .tablet-clear-filter { grid-column: auto; }

    .tablet-portal-content .tablet-clear-filter {
        border-radius: 8px;
        height: 42px;
        width: 42px;
    }

    /* Alerts must not steal the table's height */
    .tablet-portal-content .tablet-list-page > .alert {
        flex: 0 0 auto;
        margin: 0;
        padding: .5rem .8rem;
        font-size: .8rem;
    }

    /* Listing panel -> fills the rest, table scrolls inside */
    .tablet-portal-content .tablet-list-panel {
        border-color: #e1e7ef;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
    }

    .tablet-portal-content .tablet-list-panel-heading {
        border-bottom: 1px solid #e7ecf4;
        flex: 0 0 auto;
        min-height: 50px;
        padding: .45rem .9rem;
    }

    .tablet-portal-content .tablet-list-panel-icon {
        flex-basis: 34px;
        font-size: 1.05rem;
        height: 34px;
    }

    .tablet-portal-content .tablet-list-panel-heading strong { font-size: .88rem; }
    .tablet-portal-content .tablet-list-panel-heading small { display: none; }

    .tablet-portal-content .tablet-table-wrap {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
    }

    .tablet-portal-content .tablet-list-table th {
        position: sticky;
        top: 0;
        z-index: 1;
        box-shadow: inset 0 -1px 0 #e7ecf4;
    }

    .tablet-portal-content .tablet-list-table td { padding: .55rem .8rem; }

    .tablet-portal-content .tablet-row-action {
        height: 36px;
        width: 36px;
    }

    .tablet-portal-content .tablet-list-pagination {
        border-top: 1px solid #e7ecf4;
        flex: 0 0 auto;
        min-height: 50px;
        padding: .45rem .9rem;
    }

    .tablet-portal-content .tablet-list-pagination .btn {
        height: 36px;
        width: 36px;
    }

    /* Loading / empty states fill the panel area instead of a fixed 240px box */
    .tablet-portal-content .tablet-list-page > .tablet-loading,
    .tablet-portal-content .tablet-list-page > .tablet-empty-state {
        background: #fff;
        border: 1px solid #e1e7ef;
        border-radius: 12px;
        flex: 1 1 auto;
        min-height: 0;
    }

    .tablet-portal-content .tablet-list-page > .tablet-empty-state > i { color: #aeb8c8; font-size: 2.4rem; }
    .tablet-portal-content .tablet-list-page > .tablet-empty-state h3 { font-size: 1.05rem; }
    .tablet-portal-content .tablet-list-page > .tablet-empty-state p { font-size: .82rem; }
}

/* Narrow landscape tablets (768-899px): let the clear button drop below
   rather than squeezing six controls into one row. */
@media (min-width: 768px) and (max-width: 899.98px) and (orientation: landscape) {
    .tablet-portal-content .tablet-list-filters {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, .95fr) minmax(0, 1fr) minmax(0, .85fr) minmax(0, .85fr);
    }

    .tablet-portal-content .tablet-clear-filter { width: 100%; }
    .tablet-portal-content .tablet-list-hero p { display: none; }
    .tablet-portal-content .tablet-list-metric small { font-size: .64rem; }
    .tablet-portal-content .tablet-list-table { font-size: .72rem; }
}

/* Short landscape tablets: same idea as the entry page's short-height mode. */
@media (min-width: 768px) and (orientation: landscape) and (max-height: 650px) {
    .tablet-portal-content:has(.tablet-list-page) { padding: 6px 8px; }
    .tablet-portal-content .tablet-list-page { gap: 6px; }

    .tablet-portal-content .tablet-list-hero {
        min-height: 46px;
        padding: .3rem .6rem;
    }

    .tablet-portal-content .tablet-list-hero h1 { font-size: 15px; }
    .tablet-portal-content .tablet-list-hero p { display: none; }
    .tablet-portal-content .tablet-list-hero-actions .btn {
        font-size: .72rem;
        min-height: 34px;
        padding: .3rem .7rem;
    }

    .tablet-portal-content .tablet-list-metrics { gap: 6px; }
    .tablet-portal-content .tablet-list-metric {
        gap: .5rem;
        min-height: 44px;
        padding: .3rem .6rem;
    }
    .tablet-portal-content .tablet-list-metric > i { flex-basis: 28px; font-size: .95rem; height: 28px; }
    .tablet-portal-content .tablet-list-metric strong { font-size: 1rem; }
    .tablet-portal-content .tablet-list-metric small { font-size: .62rem; }

    .tablet-portal-content .tablet-list-filters { gap: .4rem; padding: .4rem; }
    .tablet-portal-content .tablet-list-filters .form-control,
    .tablet-portal-content .tablet-list-filters .form-select {
        font-size: .7rem;
        min-height: 34px;
    }
    .tablet-portal-content .tablet-clear-filter { height: 34px; }
    .tablet-portal-content .tablet-date-filter > span { font-size: .56rem; }

    .tablet-portal-content .tablet-list-panel-heading { min-height: 40px; padding: .3rem .6rem; }
    .tablet-portal-content .tablet-list-panel-icon { flex-basis: 28px; font-size: .9rem; height: 28px; }
    .tablet-portal-content .tablet-list-panel-heading strong { font-size: .8rem; }
    .tablet-portal-content .tablet-list-table { font-size: .7rem; }
    .tablet-portal-content .tablet-list-table th { font-size: .62rem; padding: .45rem .6rem; }
    .tablet-portal-content .tablet-list-table td { padding: .38rem .6rem; }
    .tablet-portal-content .tablet-row-action { height: 30px; width: 30px; }
    .tablet-portal-content .tablet-list-pagination { min-height: 40px; padding: .3rem .6rem; }
    .tablet-portal-content .tablet-list-pagination .btn { height: 30px; width: 30px; }
}

/* Portrait tablets: keep the flowing layout but align control sizing and
   spacing with the entry page so the portal feels consistent. */
@media (min-width: 768px) and (orientation: portrait) {
    .tablet-portal-content .tablet-list-page { padding: .5rem .25rem 1.5rem; }
    .tablet-portal-content .tablet-list-hero { margin-bottom: 1rem; }
    .tablet-portal-content .tablet-list-hero h1 { font-size: 1.6rem; margin: .25rem 0 .2rem; }
    .tablet-portal-content .tablet-list-hero p { font-size: .82rem; }
    .tablet-portal-content .tablet-list-hero-actions .btn { border-radius: 8px; min-height: 44px; }
    .tablet-portal-content .tablet-list-metrics { gap: .75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: .75rem; }
    .tablet-portal-content .tablet-list-metric { border-radius: 12px; gap: .6rem; min-height: 76px; padding: .65rem .75rem; }
    .tablet-portal-content .tablet-list-metric > i { flex-basis: 38px; font-size: 1.2rem; height: 38px; }
    .tablet-portal-content .tablet-list-metric strong { font-size: 1.25rem; }
    .tablet-portal-content .tablet-list-metric small { font-size: .66rem; }
    .tablet-portal-content .tablet-list-filters { border-radius: 12px; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, 1fr); margin-bottom: .75rem; padding: .55rem; }
    .tablet-portal-content .tablet-list-filters .form-control,
    .tablet-portal-content .tablet-list-filters .form-select { border-radius: 8px; font-size: .8rem; min-height: 42px; }
    .tablet-portal-content .tablet-clear-filter { height: 42px; width: 100%; }
    .tablet-portal-content .tablet-list-panel { border-radius: 12px; }
    .tablet-portal-content .tablet-list-panel-heading { min-height: 56px; }
    .tablet-portal-content .tablet-list-table th { position: sticky; top: 0; z-index: 1; }
}

/* Tablet dashboard: layout-level hook (page rules live in TabletSales.razor.css). */
@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content:has(.tablet-dashboard-page) {
        overflow: hidden;
        padding: 12px 16px;
    }
}

@media (min-width: 768px) and (orientation: landscape) and (max-height: 650px) {
    .tablet-portal-content:has(.tablet-dashboard-page) { padding: 6px 8px; }
}

/* =========================================================================
   Tablet portal: Customers and Receipts
   ========================================================================= */
.tablet-list-panel-icon.customer-icon { background: #f1edff; color: #7146e8; }
.tablet-list-panel-icon.receipt-icon { background: #e4f8f1; color: #00a878; }
.tablet-module-card-receipts .tablet-module-icon { background: #e4f8f1; color: #00a878; }
.tablet-module-card-customers .tablet-module-icon { background: #f1edff; color: #7146e8; }

/* Touch-friendly modal used by the tablet customer form */
.tablet-modal .modal-content { border-radius: 14px; }
.tablet-modal .modal-header { align-items: center; padding: 1rem 1.25rem; }
.tablet-modal .modal-body { padding: 1.25rem; }
.tablet-modal .modal-footer { gap: .5rem; padding: .85rem 1.25rem; }
.tablet-modal .modal-footer .btn { margin: 0; }

.tablet-modal-title {
    align-items: center;
    display: flex;
    gap: .75rem;
    min-width: 0;
}

.tablet-modal-title h5 { font-size: 1.05rem; margin: 0; }
.tablet-modal-title small { color: #64748b; display: block; font-size: .76rem; margin-top: .1rem; }

.tablet-modal-grid {
    display: grid;
    gap: .85rem 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tablet-modal-grid .form-label { font-size: .8rem; margin-bottom: .3rem; }
.tablet-modal-span-2 { grid-column: 1 / -1; }

.tablet-modal-switch {
    align-items: center;
    display: flex;
    min-height: 48px;
}

.tablet-modal-switch .form-check-input { height: 1.45em; width: 2.7em; }
.tablet-modal-switch .form-check-label { padding-left: .35rem; }

/* Receipt allocation rows */
.tablet-alloc-head { display: none; }

.tablet-alloc-tools {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.tablet-alloc-row {
    align-items: center;
    background: rgba(var(--vz-light-rgb), .38);
    border: 1px solid var(--vz-border-color);
    border-radius: 14px;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(150px, 2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(130px, 1.1fr) 96px;
    padding: .85rem 1rem;
}

.tablet-alloc-row.is-allocated {
    background: #f0fdf4;
    border-color: #a7f3d0;
}

.tablet-alloc-doc { min-width: 0; }
.tablet-alloc-doc strong { display: block; }
.tablet-alloc-doc small { color: #64748b; display: block; font-size: .74rem; margin-top: .1rem; }
.tablet-alloc-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tablet-alloc-button {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    gap: .3rem;
    justify-content: center;
    min-height: 44px;
    width: 100%;
}

.tablet-amount-input { font-weight: 600; }

@media (max-width: 767.98px) {
    .tablet-modal-grid { grid-template-columns: 1fr; }

    .tablet-alloc-row {
        gap: .5rem .75rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: .75rem;
    }

    .tablet-alloc-doc { grid-column: 1 / -1; }
    .tablet-alloc-amount::before,
    .tablet-alloc-due::before {
        color: #8490a6;
        display: block;
        font-size: .6rem;
        text-transform: uppercase;
    }
    .tablet-alloc-due::before { content: 'Due'; }
    .tablet-alloc-amount:nth-of-type(3)::before { content: 'Invoice total'; }
    .tablet-alloc-amount:nth-of-type(4)::before { content: 'Outstanding'; }
    .tablet-alloc-row .text-end { text-align: left !important; }
    .tablet-alloc-input { grid-column: 1; }
    .tablet-alloc-action { grid-column: 2; }
}

/* Landscape POS mode: reuse the entry-page grid, minus the notes row the
   invoice page has, and make allocation rows read like a table. */
@media (min-width: 768px) and (orientation: landscape) {
    .tablet-portal-content .tablet-entry-page.tablet-receipt-page {
        grid-template-rows: 64px auto minmax(170px, 1fr);
    }

    .tablet-entry-page.tablet-receipt-page > .tablet-summary-panel { grid-row: 3 / 4; }
    .tablet-portal-content .tablet-receipt-details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .tablet-alloc-tools .tablet-touch-button {
        font-size: .78rem;
        min-height: 38px;
        min-width: 0;
        padding: .35rem .8rem;
    }

    .tablet-alloc-head {
        color: #40506d;
        display: grid;
        font-size: .68rem;
        font-weight: 600;
        gap: .5rem;
        grid-template-columns: minmax(150px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1fr) 76px;
        padding: 0 .55rem .35rem;
        text-transform: uppercase;
    }

    .tablet-alloc-row {
        border-radius: 8px;
        gap: .5rem;
        grid-template-columns: minmax(150px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1fr) 76px;
        padding: .45rem .55rem;
    }

    .tablet-alloc-row,
    .tablet-alloc-due { font-size: .78rem; }
    .tablet-alloc-doc small { font-size: .66rem; }
    .tablet-alloc-input .tablet-entry-control { min-height: 38px; }
    .tablet-alloc-button { font-size: .74rem; min-height: 38px; }

    .tablet-portal-content .tablet-list-filters.tablet-filters-3 {
        grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    }
}

@media (min-width: 768px) and (orientation: landscape) and (max-height: 650px) {
    .tablet-portal-content .tablet-entry-page.tablet-receipt-page {
        grid-template-rows: 48px auto minmax(112px, 1fr);
    }

    .tablet-alloc-tools .tablet-touch-button { font-size: .7rem; min-height: 32px; }
    .tablet-alloc-head { font-size: .6rem; }
    .tablet-alloc-row { font-size: .7rem; gap: .35rem; padding: .3rem .45rem; }
    .tablet-alloc-input .tablet-entry-control { font-size: .7rem; min-height: 32px; }
    .tablet-alloc-button { font-size: .66rem; min-height: 32px; }
}
