/* =========================================================================
   Counter POS (/pos) on the gm design. Full screen, no ERP sidebar: top bar, sale header,
   then the product grid and the cart side by side. Only the grid and the cart lines scroll;
   the page itself never does. Controls stay touch-sized (40px) for counter screens.
   Anchored on #gm-pos (PosLayout) and #gm-pos-login (login page).
   ========================================================================= */

#gm-pos,
#gm-pos-login {
    --p-navy: #10233F;
    --p-navy-700: #284767;
    --p-muted: #6F86A5;
    --p-border: rgba(97, 139, 162, .22);
    --p-border-soft: rgba(97, 139, 162, .13);
    --p-teal-700: #0B7D95;
    --p-teal-600: #0D9F99;
    --p-teal-500: #14C9B1;
    --p-tint: rgba(20, 201, 177, .1);
    --p-grad: linear-gradient(90deg, #0C958E 0%, #15CFC0 100%);
    --p-grad-hover: linear-gradient(90deg, #0A857F 0%, #12B9AB 100%);
    --p-shadow: 0 10px 30px rgba(28, 75, 98, .07);
    --p-ring: 0 0 0 3px rgba(20, 201, 177, .18);
    --p-page: #F3F7F9;

    color: var(--p-navy);
    font-family: Inter, "Plus Jakarta Sans", Poppins, "Segoe UI", system-ui, sans-serif;
}

#gm-pos {
    height: 100dvh;
    overflow: hidden;
    background: var(--p-page);
}

#gm-pos .pos-app {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    height: 100%;
    padding: .6rem .75rem .75rem;
}

#gm-pos .pos-app > * {
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ top bar */
#gm-pos .pos-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .45rem .6rem;
    border: 1px solid var(--p-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--p-shadow);
}

#gm-pos .pos-topbar-left,
#gm-pos .pos-topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

#gm-pos .pos-topbar h1 {
    margin: 0 .2rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

#gm-pos .pos-icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--p-border);
    border-radius: 11px;
    background: #fff;
    color: var(--p-navy-700);
    font-size: 1.15rem;
}

#gm-pos .pos-icon-btn:hover {
    background: #F1F8FA;
}

#gm-pos .pos-docno {
    padding: .2rem .55rem;
    border-radius: 8px;
    background: var(--p-tint);
    color: var(--p-teal-700);
    font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
    font-size: .78rem;
    font-weight: 700;
}

#gm-pos .pos-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: rgba(181, 118, 17, .12);
    color: #8A5A0D;
    font-size: .74rem;
    font-weight: 600;
}

#gm-pos .pos-status i {
    font-size: .45rem;
}

#gm-pos .pos-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 640px;
    margin: 0 auto;
}

#gm-pos .pos-search > i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--p-muted);
    font-size: 1.1rem;
}

#gm-pos .pos-search > i:first-child { left: .85rem; }
#gm-pos .pos-search > i:last-child { right: .85rem; }

#gm-pos .pos-search input {
    width: 100%;
    height: 44px;
    padding: 0 2.6rem;
    border: 1px solid var(--p-border);
    border-radius: 12px;
    background: #F7FBFC;
    color: var(--p-navy);
    font-size: .88rem;
    outline: none;
}

#gm-pos .pos-search input:focus {
    border-color: var(--p-teal-500);
    background: #fff;
    box-shadow: var(--p-ring);
}

#gm-pos .pos-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .2rem .4rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--p-navy);
}

#gm-pos .pos-user:hover {
    background: #F1F8FA;
}

#gm-pos .pos-user-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E7F6F1;
    color: #0B8A77;
    font-weight: 700;
}

#gm-pos .pos-user-copy {
    display: grid;
    text-align: left;
    line-height: 1.2;
}

#gm-pos .pos-user-copy strong { font-size: .82rem; }
#gm-pos .pos-user-copy small { color: var(--p-muted); font-size: .7rem; }

#gm-pos .dropdown-menu {
    border: 1px solid var(--p-border);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(16, 35, 63, .14);
}

#gm-pos .dropdown-item {
    border-radius: 8px;
}

#gm-pos .dropdown-item.active,
#gm-pos .dropdown-item:active {
    background: var(--p-tint);
    color: var(--p-teal-700);
}

/* ------------------------------------------------------------------- cards */
#gm-pos .pos-card {
    border: 1px solid var(--p-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--p-shadow);
}

#gm-pos .pos-alert {
    margin: 0;
    border-radius: 12px;
}

#gm-pos .pos-loading {
    display: grid;
    place-items: center;
    align-content: center;
    gap: .6rem;
    flex: 1 1 auto;
    color: var(--p-muted);
}

#gm-pos .pos-loading .spinner-border {
    color: var(--p-teal-600);
}

/* --------------------------------------------------------------- sale header */
#gm-pos .pos-header {
    padding: .6rem .75rem;
}

#gm-pos .pos-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .55rem .65rem;
}

#gm-pos .pos-field {
    display: grid;
    gap: .22rem;
    width: 175px;
}

#gm-pos .pos-field-wide { width: 250px; }
#gm-pos .pos-field-sm { width: 130px; }

#gm-pos .pos-field > label {
    margin: 0;
    color: var(--p-navy);
    font-size: .72rem;
    font-weight: 600;
}

#gm-pos .pos-field .req {
    color: #E0475B;
}

#gm-pos .pos-input,
#gm-pos .pos-select {
    position: relative;
    display: flex;
    align-items: center;
}

#gm-pos .pos-input > i,
#gm-pos .pos-select > i {
    position: absolute;
    left: .65rem;
    z-index: 3;
    color: var(--p-muted);
    font-size: 1rem;
    pointer-events: none;
}

#gm-pos .pos-input input,
#gm-pos .pos-select .form-select {
    width: 100%;
    height: 40px;
    padding: 0 .7rem 0 2.1rem;
    border: 1px solid var(--p-border);
    border-radius: 11px;
    background-color: #fff;
    color: var(--p-navy);
    font-size: .84rem;
    outline: none;
}

#gm-pos .pos-select .form-select {
    padding-right: 2rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#gm-pos .pos-input input:focus,
#gm-pos .pos-select .form-select:focus {
    border-color: var(--p-teal-500);
    box-shadow: var(--p-ring);
}

#gm-pos .pos-seg {
    display: inline-flex;
    gap: .2rem;
    height: 40px;
    padding: .2rem;
    border: 1px solid var(--p-border);
    border-radius: 11px;
    background: #F3F8FA;
}

#gm-pos .pos-seg button {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: 1 1 0;
    justify-content: center;
    padding: 0 .7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--p-navy-700);
    font-size: .8rem;
    font-weight: 600;
}

#gm-pos .pos-seg button.active {
    background: var(--p-grad);
    color: #fff;
}

/* ------------------------------------------------------------ items + cart */
#gm-pos .pos-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: .6rem;
    flex: 1 1 auto;
    min-height: 0;
}

#gm-pos .pos-items,
#gm-pos .pos-cart {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Left column: sale details on top, items below. The cart takes the whole right side. */
#gm-pos .pos-main {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    min-width: 0;
    min-height: 0;
}

#gm-pos .pos-main > .pos-items {
    flex: 1 1 auto;
}

/* Compact sale details: every field always visible, small controls that fill each row. */
#gm-pos .pos-header {
    flex-shrink: 0;
    padding: .45rem .6rem .55rem;
}

#gm-pos .pos-header .pos-fields {
    gap: .35rem .45rem;
}

#gm-pos .pos-header .pos-field {
    flex: 1 1 110px;
    grid-template-columns: minmax(0, 1fr);
    gap: .12rem;
    width: auto;
    min-width: 0;
}

#gm-pos .pos-header .pos-field-wide {
    flex: 2 1 180px;
    width: auto;
}

#gm-pos .pos-header .pos-field-sm {
    flex: 0 1 84px;
    width: auto;
}

#gm-pos .pos-header .pos-field-seg {
    flex: 0 0 auto;
}

#gm-pos .pos-header .pos-fields-break {
    flex-basis: 100%;
    height: 0;
    margin-bottom: -.35rem; /* the break line shouldn't add a second row gap */
}

#gm-pos .pos-header .pos-field > label {
    overflow: hidden;
    color: var(--p-muted);
    font-size: .66rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#gm-pos .pos-header .pos-input > i,
#gm-pos .pos-header .pos-select > i {
    left: .55rem;
    font-size: .85rem;
}

#gm-pos .pos-header .pos-input input,
#gm-pos .pos-header .pos-select .form-select {
    height: 32px;
    padding-left: 1.75rem;
    border-radius: 8px;
    font-size: .78rem;
}

#gm-pos .pos-header .pos-select .form-select {
    padding-right: 1.7rem;
    background-position: right .5rem center;
}

#gm-pos .pos-header .pos-seg {
    height: 32px;
    padding: .15rem;
    border-radius: 8px;
}

#gm-pos .pos-header .pos-seg button {
    padding: 0 .55rem;
    border-radius: 6px;
    font-size: .74rem;
}

#gm-pos .pos-header .pos-add-btn {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: .9rem;
}

#gm-pos .pos-header .pos-select-add {
    gap: .3rem;
}

#gm-pos .pos-items-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem .5rem;
    border-bottom: 1px solid var(--p-border-soft);
}

#gm-pos .pos-items-head h2,
#gm-pos .pos-cart-head h2 {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    flex-shrink: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

#gm-pos .pos-items-head h2 small,
#gm-pos .pos-cart-head h2 small {
    color: var(--p-muted);
    font-size: .72rem;
    font-weight: 600;
}

#gm-pos .pos-chips {
    display: flex;
    gap: .35rem;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

#gm-pos .pos-chip {
    flex-shrink: 0;
    height: 34px;
    padding: 0 .85rem;
    border: 1px solid var(--p-border);
    border-radius: 999px;
    background: #fff;
    color: var(--p-navy-700);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

#gm-pos .pos-chip:hover {
    background: #F1F8FA;
}

#gm-pos .pos-chip.active {
    border-color: transparent;
    background: var(--p-grad);
    color: #fff;
}

#gm-pos .pos-grid-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: .65rem .75rem .75rem;
}

#gm-pos .pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .6rem;
}

#gm-pos .pos-tile {
    display: flex;
    gap: .6rem;
    min-width: 0;
    padding: .55rem;
    border: 1px solid var(--p-border);
    border-radius: 14px;
    background: #fff;
}

#gm-pos .pos-tile:hover {
    border-color: rgba(13, 159, 153, .45);
    box-shadow: 0 6px 18px rgba(28, 75, 98, .08);
}

#gm-pos .pos-tile.is-out {
    opacity: .6;
}

#gm-pos .pos-tile-img {
    display: grid;
    place-items: center;
    flex: 0 0 76px;
    width: 76px;
    height: 76px;
    overflow: hidden;
    border-radius: 10px;
    background: #F3F7F9;
    color: #B6C6D3;
    font-size: 1.8rem;
}

#gm-pos .pos-tile-img {
    position: relative;
}

#gm-pos .pos-tile-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #F3F7F9;
    object-fit: contain;
}

#gm-pos .pos-tile-price.no-price {
    color: var(--p-muted);
    font-size: .76rem;
    font-weight: 600;
}

#gm-pos .pos-tile-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

#gm-pos .pos-tile-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#gm-pos .pos-tile-code {
    margin-top: .1rem;
    color: var(--p-muted);
    font-size: .7rem;
}

#gm-pos .pos-tile-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .2rem .4rem;
    margin-top: auto;
}

#gm-pos .pos-tile-price {
    font-size: .92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-stock {
    padding: .05rem .4rem;
    border-radius: 999px;
    background: rgba(11, 165, 143, .12);
    color: #0B8A77;
    font-size: .64rem;
    font-weight: 600;
    white-space: nowrap;
}

#gm-pos .pos-stock.low { background: rgba(181, 118, 17, .12); color: #8A5A0D; }
#gm-pos .pos-stock.out { background: rgba(228, 98, 111, .14); color: #C0384A; }

#gm-pos .pos-load-more {
    display: block;
    margin: .75rem auto 0;
    height: 38px;
    padding: 0 1rem;
    border: 1px solid var(--p-border);
    border-radius: 11px;
    background: #fff;
    color: var(--p-teal-700);
    font-size: .8rem;
    font-weight: 600;
}

#gm-pos .pos-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: .4rem;
    min-height: 140px;
    height: 100%;
    color: var(--p-muted);
    font-size: .82rem;
    text-align: center;
}

#gm-pos .pos-empty > i {
    color: var(--p-teal-600);
    font-size: 1.8rem;
    opacity: .7;
}

/* cart */
#gm-pos .pos-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .75rem .5rem;
    border-bottom: 1px solid var(--p-border-soft);
}

#gm-pos .pos-cart-lines {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: .5rem .75rem;
}

#gm-pos .pos-totals {
    display: grid;
    gap: .3rem;
    padding: .6rem .75rem;
    border-top: 1px solid var(--p-border-soft);
}

#gm-pos .pos-totals > div {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
}

#gm-pos .pos-totals span {
    color: var(--p-muted);
}

#gm-pos .pos-totals strong {
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-totals .pos-grand {
    align-items: baseline;
    margin-top: .25rem;
    padding-top: .45rem;
    border-top: 1px solid var(--p-border);
}

#gm-pos .pos-totals .pos-grand span {
    color: var(--p-navy);
    font-size: .95rem;
    font-weight: 700;
}

#gm-pos .pos-totals .pos-grand strong {
    color: var(--p-teal-700);
    font-size: 1.45rem;
    font-weight: 800;
}

/* Pay, Hold and Cancel side by side so the totals keep the space. */
#gm-pos .pos-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px;
    gap: .4rem;
    padding: 0 .75rem .75rem;
}

#gm-pos .pos-actions .pos-btn {
    min-width: 0;
    height: 46px;
    padding: 0 .5rem;
    gap: .35rem;
    font-size: .85rem;
    white-space: nowrap;
}

#gm-pos .pos-actions .pos-btn kbd {
    margin-left: .15rem;
}

#gm-pos .pos-actions .pos-btn-cancel {
    padding: 0;
    font-size: 1.05rem;
}

#gm-pos .pos-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    height: 46px;
    border: 0;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 700;
}

#gm-pos .pos-btn:disabled {
    opacity: .5;
}

#gm-pos .pos-btn-post {
    background: linear-gradient(90deg, #1E8E4E 0%, #2DB86B 100%);
    color: #fff;
}

#gm-pos .pos-btn-post:hover:not(:disabled) {
    background: linear-gradient(90deg, #197B43 0%, #26A25E 100%);
    box-shadow: 0 6px 16px rgba(30, 142, 78, .28);
}

#gm-pos .pos-btn-draft {
    background: var(--p-grad);
    color: #fff;
}

#gm-pos .pos-btn-draft:hover:not(:disabled) {
    background: var(--p-grad-hover);
    box-shadow: 0 6px 16px rgba(13, 159, 153, .3);
}

#gm-pos .pos-btn-light {
    height: 40px;
    border: 1px solid var(--p-border);
    background: #fff;
    color: var(--p-navy-700);
}

#gm-pos .pos-btn-light:hover {
    background: #F1F8FA;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1199.98px) {
    #gm-pos .pos-actions .pos-btn kbd {
        display: none;
    }

    #gm-pos .pos-body {
        grid-template-columns: minmax(0, 1fr) 330px;
    }

    #gm-pos .pos-user-copy {
        display: none;
    }
}

@media (max-width: 899.98px) {
    #gm-pos {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    #gm-pos .pos-body {
        grid-template-columns: minmax(0, 1fr);
    }

    #gm-pos .pos-grid-scroll {
        max-height: 60vh;
    }

    #gm-pos .pos-topbar {
        flex-wrap: wrap;
    }

    #gm-pos .pos-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    #gm-pos .pos-field,
    #gm-pos .pos-field-wide,
    #gm-pos .pos-field-sm {
        width: calc(50% - .35rem);
    }

    #gm-pos .pos-header .pos-field,
    #gm-pos .pos-header .pos-field-wide,
    #gm-pos .pos-header .pos-field-sm {
        flex: 1 1 calc(50% - .3rem);
    }
}

/* ------------------------------------------------------------------ login */
#gm-pos-login.pos-login-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    align-items: center;
    gap: 3rem;
    min-height: 100dvh;
    padding: 2rem clamp(1.5rem, 8vw, 7rem);
    background: radial-gradient(circle at 15% 10%, rgba(20, 201, 177, .14), transparent 45%), var(--p-page);
}

#gm-pos-login .pos-login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-self: center;
}

#gm-pos-login .pos-login-mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--p-grad);
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 10px 24px rgba(13, 159, 153, .3);
}

#gm-pos-login .pos-login-brand strong {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

#gm-pos-login .pos-login-brand span {
    color: var(--p-muted);
}

#gm-pos-login .pos-login-panel {
    padding: 2rem;
    border: 1px solid var(--p-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(28, 75, 98, .12);
}

#gm-pos-login .pos-login-heading {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.4rem;
}

#gm-pos-login .pos-login-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--p-tint);
    color: var(--p-teal-700);
    font-size: 1.3rem;
}

#gm-pos-login .pos-login-heading h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

#gm-pos-login .pos-login-heading p {
    margin: .15rem 0 0;
    color: var(--p-muted);
    font-size: .8rem;
}

#gm-pos-login .form-label {
    font-weight: 600;
}

#gm-pos-login .text-danger {
    color: #E0475B !important;
}

#gm-pos-login .form-control {
    height: 46px;
    border-color: var(--p-border);
    border-radius: 11px;
}

#gm-pos-login .form-control:focus {
    border-color: var(--p-teal-500);
    box-shadow: var(--p-ring);
}

#gm-pos-login .pos-login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--p-grad);
    font-weight: 700;
}

#gm-pos-login .pos-login-submit:hover:not(:disabled) {
    background: var(--p-grad-hover);
    box-shadow: 0 6px 16px rgba(13, 159, 153, .3);
}

@media (max-width: 767.98px) {
    #gm-pos-login.pos-login-page {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }
}

/* ======================================================= phase 2: cart and checkout */

/* tiles add to the cart */
#gm-pos .pos-tile {
    position: relative;
    cursor: pointer;
    user-select: none;
}

#gm-pos .pos-tile:focus-visible {
    outline: none;
    box-shadow: var(--p-ring);
}

#gm-pos .pos-tile:active {
    transform: scale(.985);
}

#gm-pos .pos-tile.no-price {
    cursor: not-allowed;
}

#gm-pos .pos-tile-add {
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(13, 159, 153, .35);
    border-radius: 9px;
    background: #fff;
    color: var(--p-teal-700);
    font-size: .95rem;
}

#gm-pos .pos-tile:hover .pos-tile-add {
    border-color: transparent;
    background: var(--p-grad);
    color: #fff;
}

#gm-pos .pos-tile.no-price .pos-tile-add {
    display: none;
}

#gm-pos .pos-tile-foot {
    padding-right: 2.1rem;
}

/* cart */
#gm-pos .pos-link-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 0;
    background: transparent;
    color: var(--p-muted);
    font-size: .76rem;
    font-weight: 600;
}

#gm-pos .pos-link-btn:hover {
    color: #C0384A;
}

#gm-pos .pos-cart-lines {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

#gm-pos .pos-empty small {
    display: block;
    font-size: .72rem;
}

/* Compact line: name and total on top; price, quantity and remove underneath. Tap the name to edit. */
#gm-pos .pos-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "main total total"
        "main qty del";
    align-items: center;
    gap: .2rem .35rem;
    padding: .35rem .45rem .35rem .6rem;
    border: 1px solid var(--p-border);
    border-radius: 10px;
    background: #fff;
}

#gm-pos .pos-line.is-over {
    border-left: 3px solid #E0A33A;
}

#gm-pos .pos-line.is-new {
    animation: pos-flash 1.2s ease-out;
}

@keyframes pos-flash {
    from { background: rgba(20, 201, 177, .18); }
    to { background: #fff; }
}

#gm-pos .pos-line-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
    align-self: stretch;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

#gm-pos .pos-line-main strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--p-navy);
    font-size: .78rem;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#gm-pos .pos-line-main small {
    overflow: hidden;
    color: var(--p-muted);
    font-size: .68rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#gm-pos .pos-line-disc,
#gm-pos .pos-line-warn {
    margin-left: .3rem;
    font-style: normal;
    font-weight: 600;
}

#gm-pos .pos-line-disc {
    color: #C0384A;
}

#gm-pos .pos-line-warn {
    color: #B57611;
}

#gm-pos .pos-field-hint {
    color: var(--p-muted);
    font-size: .68rem;
    font-weight: 600;
}

#gm-pos .pos-field-hint.warn {
    color: #B57611;
}

#gm-pos .pos-qty {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--p-border);
    border-radius: 10px;
}

#gm-pos .pos-qty button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 32px;
    border: 0;
    background: #F7FBFC;
    color: var(--p-navy-700);
}

#gm-pos .pos-qty button:hover {
    background: var(--p-tint);
    color: var(--p-teal-700);
}

#gm-pos .pos-qty input {
    width: 40px;
    height: 32px;
    border: 0;
    border-inline: 1px solid var(--p-border-soft);
    color: var(--p-navy);
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
}

#gm-pos .pos-qty input::-webkit-outer-spin-button,
#gm-pos .pos-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#gm-pos .pos-qty-lg button { width: 44px; height: 40px; }
#gm-pos .pos-qty-lg input { width: 70px; height: 40px; font-size: .95rem; }

#gm-pos .pos-line-total {
    grid-area: total;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

#gm-pos .pos-line .pos-qty {
    grid-area: qty;
    border-radius: 8px;
}

#gm-pos .pos-line .pos-qty button {
    width: 26px;
    height: 26px;
    font-size: .8rem;
}

#gm-pos .pos-line .pos-qty input {
    width: 36px;
    height: 26px;
    font-size: .82rem;
}

#gm-pos .pos-line .pos-line-del {
    grid-area: del;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: transparent;
    color: #C0384A;
    font-size: .9rem;
}

#gm-pos .pos-line-del {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: #FCEBEE;
    color: #C0384A;
}

#gm-pos .pos-line-del:hover {
    background: #C0384A;
    color: #fff;
}

#gm-pos .pos-neg {
    color: #C0384A;
}

/* buttons used in dialogs */
#gm-pos .pos-btn-danger {
    background: linear-gradient(90deg, #C0384A 0%, #E4626F 100%);
    color: #fff;
}

#gm-pos .pos-btn-danger-light {
    border: 1px solid rgba(192, 56, 74, .3);
    background: #fff;
    color: #C0384A;
}

#gm-pos .pos-btn-danger-light:hover {
    background: #FCEBEE;
}

/* ------------------------------------------------------------------- dialogs */
#gm-pos .pos-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(16, 35, 63, .42);
}

#gm-pos .pos-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1055;
    display: flex;
    flex-direction: column;
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    transform: translate(-50%, -50%);
    border: 1px solid var(--p-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(16, 35, 63, .25);
}

#gm-pos .pos-modal-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .9rem 1rem .7rem;
    border-bottom: 1px solid var(--p-border-soft);
}

#gm-pos .pos-modal-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

#gm-pos .pos-modal-head p {
    margin: .1rem 0 0;
    color: var(--p-muted);
    font-size: .76rem;
}

#gm-pos .pos-modal-icon {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--p-tint);
    color: var(--p-teal-700);
    font-size: 1.2rem;
}

#gm-pos .pos-modal-icon.ok { background: rgba(30, 142, 78, .12); color: #1E8E4E; }
#gm-pos .pos-modal-icon.warn { background: rgba(228, 98, 111, .14); color: #C0384A; }

#gm-pos .pos-modal-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--p-muted);
    font-size: 1.1rem;
}

#gm-pos .pos-modal-close:hover {
    background: #F1F8FA;
}

#gm-pos .pos-modal-body {
    display: grid;
    gap: .7rem;
    padding: .9rem 1rem;
}

#gm-pos .pos-modal-foot {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: .5rem;
    padding: 0 1rem 1rem;
}

#gm-pos .pos-modal-foot .pos-btn {
    height: 46px;
}

#gm-pos .pos-note {
    display: flex;
    gap: .4rem;
    margin: 0;
    color: var(--p-muted);
    font-size: .8rem;
}

#gm-pos .pos-note i {
    color: var(--p-teal-600);
}

/* line editor */
#gm-pos .pos-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

#gm-pos .pos-edit-grid .pos-field {
    width: auto;
}

#gm-pos .pos-field-full {
    grid-column: 1 / -1;
    width: auto;
}

#gm-pos .pos-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

#gm-pos .pos-chips-row .pos-chip {
    height: 36px;
}

#gm-pos .pos-edit-sum {
    display: grid;
    gap: .25rem;
    padding: .6rem .75rem;
    border-radius: 12px;
    background: #F7FBFC;
    font-size: .8rem;
}

#gm-pos .pos-edit-sum span {
    display: flex;
    justify-content: space-between;
    color: var(--p-muted);
}

#gm-pos .pos-edit-sum em {
    color: var(--p-navy);
    font-style: normal;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-edit-sum .pos-edit-total {
    margin-top: .2rem;
    padding-top: .35rem;
    border-top: 1px solid var(--p-border);
    color: var(--p-navy);
    font-weight: 700;
}

#gm-pos .pos-edit-sum .pos-edit-total em {
    color: var(--p-teal-700);
    font-size: .95rem;
    font-weight: 800;
}

/* payment */
#gm-pos .pos-pay-due,
#gm-pos .pos-pay-change {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: .75rem .9rem;
    border-radius: 14px;
}

#gm-pos .pos-pay-due {
    background: #F7FBFC;
}

#gm-pos .pos-pay-due span,
#gm-pos .pos-pay-change span {
    font-size: .82rem;
    font-weight: 600;
}

#gm-pos .pos-pay-due strong {
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-pay-change {
    background: rgba(30, 142, 78, .1);
    color: #1E8E4E;
}

#gm-pos .pos-pay-change strong {
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-pay-change.short {
    background: rgba(228, 98, 111, .1);
    color: #C0384A;
}

#gm-pos .pos-input-lg input {
    height: 54px;
    font-size: 1.4rem;
    font-weight: 700;
}

#gm-pos .pos-input-lg > i {
    font-size: 1.3rem;
}

/* sale done */
#gm-pos .pos-modal-done {
    align-items: center;
    gap: .35rem;
    width: min(400px, calc(100vw - 2rem));
    padding: 1.6rem 1.4rem 1.3rem;
    text-align: center;
}

#gm-pos .pos-done-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: .3rem;
    border-radius: 50%;
    font-size: 2.4rem;
}

#gm-pos .pos-done-icon.ok { background: rgba(30, 142, 78, .12); color: #1E8E4E; }
#gm-pos .pos-done-icon.draft { background: var(--p-tint); color: var(--p-teal-700); }
#gm-pos .pos-done-icon.warn { background: rgba(181, 118, 17, .12); color: #B57611; }

#gm-pos .pos-modal-done h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

#gm-pos .pos-done-doc {
    margin: 0;
    color: var(--p-muted);
    font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
    font-size: .85rem;
}

#gm-pos .pos-done-error {
    margin: .3rem 0 0;
    color: #B57611;
    font-size: .8rem;
}

#gm-pos .pos-done-cash {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    width: 100%;
    margin-top: .6rem;
}

#gm-pos .pos-done-cash span {
    display: grid;
    padding: .5rem;
    border-radius: 12px;
    background: #F7FBFC;
    color: var(--p-muted);
    font-size: .72rem;
    font-weight: 600;
}

#gm-pos .pos-done-cash strong {
    color: var(--p-navy);
    font-size: 1.05rem;
}

#gm-pos .pos-done-cash .pos-done-change {
    background: rgba(30, 142, 78, .1);
}

#gm-pos .pos-done-cash .pos-done-change strong {
    color: #1E8E4E;
    font-size: 1.3rem;
}

#gm-pos .pos-done-next {
    width: 100%;
    margin-top: .9rem;
}

/* toast */
#gm-pos .pos-toast {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: min(560px, calc(100vw - 2rem));
    padding: .7rem 1rem;
    transform: translateX(-50%);
    border-radius: 12px;
    background: var(--p-navy);
    color: #fff;
    font-size: .85rem;
    box-shadow: 0 14px 34px rgba(16, 35, 63, .3);
}

#gm-pos .pos-toast.error {
    background: #A52F3F;
}

#gm-pos .pos-toast i {
    font-size: 1.1rem;
}

/* searchable dropdowns fill their field (header and line editor) */
#gm-pos .pos-select .filter-dropdown {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

#gm-pos .pos-select .filter-dropdown > .form-select {
    width: 100%;
}

/* ===================================================== phase 3: bills, printing, keys */
#gm-pos .pos-badge-btn {
    position: relative;
}

#gm-pos .pos-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    border-radius: 999px;
    background: #E4626F;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
}

#gm-pos .pos-menu {
    min-width: 250px;
}

#gm-pos .pos-menu .dropdown-header {
    color: var(--p-muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

#gm-pos .pos-keys {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .3rem .6rem;
    padding: .2rem 1rem .5rem;
    color: var(--p-navy-700);
    font-size: .74rem;
}

#gm-pos kbd {
    display: inline-block;
    min-width: 22px;
    margin-right: .25rem;
    padding: .05rem .3rem;
    border: 1px solid var(--p-border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fff;
    color: var(--p-navy-700);
    font-family: inherit;
    font-size: .66rem;
    font-weight: 700;
    text-align: center;
}

#gm-pos .pos-btn kbd {
    margin: 0 0 0 .35rem;
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

#gm-pos .pos-select-add {
    display: flex;
    gap: .35rem;
}

#gm-pos .pos-select-add .pos-select {
    flex: 1 1 auto;
    min-width: 0;
}

#gm-pos .pos-add-btn {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(13, 159, 153, .35);
    border-radius: 11px;
    background: var(--p-tint);
    color: var(--p-teal-700);
    font-size: 1.05rem;
}

#gm-pos .pos-add-btn:hover {
    border-color: transparent;
    background: var(--p-grad);
    color: #fff;
}

#gm-pos .pos-field-wide {
    width: 290px;
}

#gm-pos .pos-done-print {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    width: 100%;
    margin-top: .8rem;
}

#gm-pos .pos-done-print .pos-btn {
    height: 42px;
    font-size: .82rem;
}

#gm-pos .pos-done-next {
    margin-top: .5rem;
}

#gm-pos .pos-btn-sm {
    height: 34px;
    padding: 0 .75rem;
    font-size: .78rem;
}

#gm-pos .pos-modal-list {
    width: min(620px, calc(100vw - 2rem));
}

#gm-pos .pos-bills {
    display: grid;
    gap: .4rem;
    max-height: 60vh;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

#gm-pos .pos-bills li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .6rem;
    border: 1px solid var(--p-border);
    border-radius: 12px;
}

#gm-pos .pos-bills li:hover {
    background: #FAFDFE;
}

#gm-pos .pos-bill-main {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
}

#gm-pos .pos-bill-main strong {
    overflow: hidden;
    font-size: .84rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#gm-pos .pos-bill-main small {
    color: var(--p-muted);
    font-size: .72rem;
}

#gm-pos .pos-bill-doc {
    color: var(--p-teal-700);
    font-family: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
    font-weight: 700;
}

#gm-pos .pos-bill-total {
    flex-shrink: 0;
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-bills .pos-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

/* ======================================================== returns & refunds */
#gm-pos .pos-return-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 40px;
    padding: 0 .8rem;
    border: 1px solid rgba(192, 56, 74, .3);
    border-radius: 11px;
    background: #fff;
    color: #C0384A;
    font-size: .82rem;
    font-weight: 700;
}

#gm-pos .pos-return-btn:hover {
    background: #FCEBEE;
}

#gm-pos .pos-modal-return {
    width: min(760px, calc(100vw - 2rem));
}

#gm-pos .pos-return-find {
    display: flex;
    gap: .5rem;
}

#gm-pos .pos-return-find .pos-input {
    flex: 1 1 auto;
}

#gm-pos .pos-return-find .pos-input input {
    font-size: 1.05rem;
    font-weight: 600;
}

#gm-pos .pos-return-find .pos-btn {
    height: 54px;
    padding: 0 1.2rem;
}

#gm-pos .pos-bill-pick {
    cursor: pointer;
}

#gm-pos .pos-bill-pick > i {
    color: var(--p-muted);
}

#gm-pos .pos-return-lines {
    display: grid;
    max-height: 42vh;
    overflow: auto;
    border: 1px solid var(--p-border);
    border-radius: 12px;
}

#gm-pos .pos-return-head,
#gm-pos .pos-return-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px 84px 116px 96px;
    align-items: center;
    gap: .5rem;
    padding: .45rem .65rem;
}

#gm-pos .pos-return-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #F7FBFC;
    color: var(--p-muted);
    font-size: .68rem;
    font-weight: 600;
}

#gm-pos .pos-return-head span:nth-child(n + 2) {
    text-align: right;
}

#gm-pos .pos-return-line {
    border-top: 1px solid var(--p-border-soft);
    font-size: .8rem;
}

#gm-pos .pos-return-line.is-done {
    opacity: .5;
}

#gm-pos .pos-return-item {
    display: grid;
    min-width: 0;
}

#gm-pos .pos-return-item strong {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#gm-pos .pos-return-item small {
    color: var(--p-muted);
    font-size: .68rem;
}

#gm-pos .pos-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

#gm-pos .pos-return-line > span:nth-child(4) {
    display: flex;
    justify-content: flex-end;
}

#gm-pos .pos-return-all {
    justify-self: start;
    color: var(--p-teal-700);
}

#gm-pos .pos-return-pay {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .6rem;
}

#gm-pos .pos-return-pay .pos-field-full {
    flex-basis: 100%;
    width: auto;
}

#gm-pos .pos-return-sum {
    display: grid;
    gap: .25rem;
    padding: .65rem .8rem;
    border-radius: 12px;
    background: #F7FBFC;
    font-size: .82rem;
}

#gm-pos .pos-return-sum span {
    display: flex;
    justify-content: space-between;
    color: var(--p-muted);
}

#gm-pos .pos-return-sum em {
    color: var(--p-navy);
    font-style: normal;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#gm-pos .pos-return-sum .pos-return-total {
    margin-top: .2rem;
    padding-top: .35rem;
    border-top: 1px solid var(--p-border);
    color: var(--p-navy);
    font-weight: 700;
}

#gm-pos .pos-return-sum .pos-return-total em {
    color: #C0384A;
    font-size: 1.15rem;
    font-weight: 800;
}

#gm-pos .pos-return-done {
    display: grid;
    justify-items: center;
    gap: .5rem;
    text-align: center;
}

#gm-pos .pos-return-done .pos-return-sum,
#gm-pos .pos-return-done .pos-pay-change {
    width: 100%;
}

#gm-pos .pos-return-pay .pos-field:first-child {
    width: auto;
}

#gm-pos .pos-return-pay .pos-seg button {
    white-space: nowrap;
}
