.sale-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.sale-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    min-height: var(--touch);
    max-width: 240px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.sale-tab.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.sale-tab-all {
    color: var(--muted);
}

.sale-tab-kind {
    display: grid;
    place-items: center;
    flex: none;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 0.78rem;
}

.sale-tab-wholesale {
    background: var(--warning-soft);
    color: #7a5200;
}

.sale-tab-retail {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.sale-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sale-tab-total {
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sale-start {
    display: grid;
    gap: 16px;
}

button.tile {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.sale-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.sale-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.sale-main .search-box {
    margin-bottom: 0;
}

.sale-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.segmented {
    display: flex;
    flex: none;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.segmented-item {
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.segmented-item.is-active {
    background: var(--primary);
    color: #ffffff;
}

.sale-customer {
    flex: 1 1 220px;
    justify-content: flex-start;
    min-width: 0;
}

.sale-customer.is-missing {
    border-color: var(--danger);
    color: var(--danger);
}

.sale-customer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sale-cart th,
.sale-cart td {
    padding: 10px;
    vertical-align: middle;
}

.sale-cart td:first-child {
    min-width: 150px;
}

.sale-cart .input-count {
    width: 78px;
}

.sale-price {
    color: var(--muted);
    font-size: 0.88rem;
}

.sale-line-total {
    font-weight: 700;
}

.sale-cart tr.is-flash {
    animation: sale-flash 0.9s ease-out;
}

@keyframes sale-flash {
    from {
        background: var(--primary-soft);
    }

    to {
        background: transparent;
    }
}

.sale-side {
    position: sticky;
    top: 84px;
    display: grid;
    gap: 12px;
}

.sale-totals {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0;
}

.sale-totals dt {
    color: var(--muted);
}

.sale-totals dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sale-grand {
    display: grid;
    gap: 2px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.sale-grand strong {
    font-size: 1.7rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.sale-change {
    background: var(--warning-soft);
    color: #7a5200;
}

.sale-pay {
    min-height: 68px;
    font-size: 1.2rem;
}

.pay-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px;
}

.pay-method {
    padding: 0 10px;
}

.input-pay {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pay-status {
    font-size: 1.15rem;
    text-align: right;
}

.receipt-stage {
    display: grid;
    place-items: center;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg);
    overflow-x: auto;
}

.receipt {
    padding: 16px 12px;
    background: #ffffff;
    color: #000000;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: var(--shadow);
}

.receipt-32 {
    width: calc(32ch + 24px);
}

.receipt-48 {
    width: calc(48ch + 24px);
}

.receipt-row {
    white-space: pre;
}

.receipt-center {
    text-align: center;
}

.receipt-bold {
    font-weight: 700;
}

.receipt-big {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
}

.receipt-barcode {
    margin-top: 8px;
    letter-spacing: 0.1em;
}

@media (max-width: 1000px) {
    .sale-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sale-side {
        position: static;
    }
}
