.pos-sales-page {
    width: 100%;
    height: 100dvh;
    padding: 20px;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
    background: radial-gradient(circle at top left, rgba(20, 184, 166, .13), transparent 34%), radial-gradient(circle at bottom right, rgba(37, 99, 235, .08), transparent 34%), linear-gradient(135deg, #f8fafc 0%, #eef3f8 100%);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #0f172a;
}

.sale-status {
    display: inline-flex;
    width: fit-content;
    margin-top: .35rem;
    padding: .22rem .55rem;
    border-radius: 999px;
    color: #64748b;
    background: #f1f5f9;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.sale-status.fiscalized {
    color: #047857;
    background: #d1fae5;
}

.sale-status.partial {
    color: #9a3412;
    background: #ffedd5;
}

.sale-status.returned {
    color: #1d4ed8;
    background: #dbeafe;
}

.sale-status.cancelled {
    color: #b91c1c;
    background: #fee2e2;
}

.cancel-modal {
    max-width: 650px;
}

.cancel-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.cancel-warning {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #fed7aa;
    border-radius: 14px;
    color: #9a3412;
    background: #fff7ed;
}

.cancel-warning > span {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #ea580c;
    font-weight: 900;
}

.cancel-warning p {
    margin: .25rem 0 0;
    color: #7c2d12;
    line-height: 1.45;
}

.cancel-summary {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: .75rem;
    margin: 1rem 0;
}

.cancel-summary > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .3rem;
    padding: .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.cancel-summary span {
    color: #64748b;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.cancel-summary strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cancel-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-top: 1rem;
    color: #334155;
    font-weight: 650;
    cursor: pointer;
}

.cancel-confirm-check input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: #dc2626;
}

.cancel-submit {
    min-height: 44px;
    padding: .7rem 1.1rem;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: #dc2626;
    font-weight: 800;
}

.cancel-submit:hover:not(:disabled) {
    background: #b91c1c;
}

.cancel-submit:disabled {
    cursor: not-allowed;
    opacity: .45;
}

@media (max-width: 640px) {
    .cancel-summary {
        grid-template-columns: 1fr;
    }
}

.sales-header {
    min-height: 88px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid rgba(219, 229, 239, .95);
    border-radius: 24px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sales-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.sales-heading-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    font-size: 24px;
    box-shadow: inset 0 0 0 1px rgba(109, 40, 217, .08);
}

.sales-heading h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    font-weight: 950;
    letter-spacing: -.8px;
}

.sales-heading p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

    .sales-heading p strong {
        color: #0f766e;
        font-weight: 950;
    }

.sales-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-pos-btn {
    min-height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    box-shadow: 0 12px 24px rgba(15, 118, 110, .2);
    transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

    .back-pos-btn:hover {
        transform: translateY(-1px);
        filter: brightness(.98);
        box-shadow: 0 16px 28px rgba(15, 118, 110, .24);
    }

.sales-toolbar {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px 120px 120px;
    align-items: center;
    gap: 12px;
}

.sales-search-box {
    min-width: 0;
    height: 58px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #dbe5ef;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .055);
    transition: border-color .16s ease, box-shadow .16s ease;
}

    .sales-search-box:focus-within {
        border-color: #0f766e;
        box-shadow: 0 0 0 4px rgba(15, 118, 110, .1), 0 12px 26px rgba(15, 23, 42, .06);
    }

    .sales-search-box > span {
        font-size: 20px;
    }

    .sales-search-box input {
        width: 100%;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: #0f172a;
        font-size: 16px;
        font-weight: 850;
    }

        .sales-search-box input::placeholder {
            color: #94a3b8;
            opacity: 1;
        }

.clear-search-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 21px;
    line-height: 1;
    font-weight: 900;
}

    .clear-search-btn:hover {
        background: #fee2e2;
        color: #b91c1c;
    }

.sales-summary-card {
    height: 58px;
    padding: 0 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dbe5ef;
    border-radius: 18px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}

    .sales-summary-card span {
        color: #64748b;
        font-size: 10px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .6px;
    }

    .sales-summary-card strong {
        margin-top: 3px;
        color: #0f766e;
        font-size: 18px;
        line-height: 1;
        font-weight: 950;
    }

.connection-badge {
    height: 58px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .4px;
}

    .connection-badge.online {
        border: 1px solid #bbf7d0;
        background: #dcfce7;
        color: #15803d;
    }

    .connection-badge.offline {
        border: 1px solid #fed7aa;
        background: #ffedd5;
        color: #c2410c;
    }

.sales-message {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 850;
}

    .sales-message.warning {
        border: 1px solid #fde68a;
        background: #fef3c7;
        color: #92400e;
    }

.sales-content {
    min-height: 0;
    overflow: hidden;
}

.sales-card {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #dbe5ef;
    border-radius: 22px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

.sales-table-wrap {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, .38) transparent;
}

    .sales-table-wrap::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    .sales-table-wrap::-webkit-scrollbar-thumb {
        border: 2px solid transparent;
        border-radius: 999px;
        background: rgba(100, 116, 139, .35);
        background-clip: padding-box;
    }

.sales-table {
    width: 100%;
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

    .sales-table thead {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .sales-table th {
        padding: 14px 16px;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
        color: #475569;
        font-size: 11px;
        font-weight: 950;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: .55px;
    }

    .sales-table td {
        padding: 13px 16px;
        border-bottom: 1px solid #edf2f7;
        color: #0f172a;
        font-size: 13px;
        font-weight: 750;
        vertical-align: middle;
    }

    .sales-table tbody tr {
        transition: background .14s ease;
    }

        .sales-table tbody tr:hover {
            background: #f8fafc;
        }

.sale-document {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.document-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #ecfeff;
    font-size: 17px;
}

.sale-document div,
.sale-date {
    min-width: 0;
}

    .sale-document strong,
    .sale-date strong {
        display: block;
        overflow: hidden;
        color: #0f172a;
        font-size: 13px;
        font-weight: 950;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sale-document small,
    .sale-date small {
        display: block;
        margin-top: 3px;
        color: #94a3b8;
        font-size: 10px;
        font-weight: 750;
    }

.sale-customer {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.customer-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
    color: #0f766e;
    font-size: 12px;
    font-weight: 950;
}

.sale-customer strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-col {
    text-align: right !important;
}

.sale-total {
    color: #0f766e;
    font-size: 15px;
    font-weight: 950;
    white-space: nowrap;
}

.action-col {
    width: 120px;
    text-align: center !important;
}

.print-btn {
    min-height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    font-size: 12px;
    font-weight: 950;
    box-shadow: 0 8px 16px rgba(15, 118, 110, .16);
    transition: transform .14s ease, filter .14s ease;
}

    .print-btn:hover:not(:disabled) {
        transform: translateY(-1px);
        filter: brightness(.98);
    }

    .print-btn:disabled {
        cursor: not-allowed;
        opacity: .45;
        box-shadow: none;
    }

.sales-empty {
    height: 100%;
    min-height: 260px;
    padding: 30px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 9px;
    border: 1px dashed #cbd5e1;
    border-radius: 22px;
    background: rgba(255, 255, 255, .74);
    color: #64748b;
    text-align: center;
}

    .sales-empty > span:not(.loading-spinner) {
        font-size: 36px;
    }

    .sales-empty strong {
        color: #334155;
        font-size: 16px;
        font-weight: 950;
    }

    .sales-empty small {
        font-size: 13px;
        font-weight: 750;
    }

    .sales-empty button {
        min-height: 42px;
        margin-top: 5px;
        padding: 0 16px;
        border: 0;
        border-radius: 12px;
        background: #0f766e;
        color: #fff;
        font-size: 13px;
        font-weight: 900;
    }

    .sales-empty.error {
        border-color: #fecaca;
        background: rgba(254, 226, 226, .72);
    }

        .sales-empty.error strong {
            color: #991b1b;
        }

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid #dbe5ef;
    border-top-color: #0f766e;
    border-radius: 50%;
    animation: sales-spin .8s linear infinite;
}

@keyframes sales-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1200px) {
    .sales-toolbar {
        grid-template-columns: minmax(0, 1fr) 160px 110px;
    }

    .connection-badge {
        display: none;
    }
}

@media (max-width: 820px) {
    .pos-sales-page {
        height: auto;
        min-height: 100dvh;
        padding: 12px;
        grid-template-rows: auto auto auto auto;
        overflow: visible;
    }

    .sales-header {
        align-items: stretch;
        flex-direction: column;
        border-radius: 20px;
    }

    .back-pos-btn {
        width: 100%;
    }

    .sales-toolbar {
        grid-template-columns: 1fr;
    }

    .sales-summary-card,
    .connection-badge {
        display: none;
    }

    .sales-content {
        overflow: visible;
    }

    .sales-card,
    .sales-table-wrap {
        height: auto;
        overflow: visible;
    }

    .sales-table {
        min-width: 0;
        border-collapse: separate;
    }

        .sales-table thead {
            display: none;
        }

        .sales-table,
        .sales-table tbody,
        .sales-table tr,
        .sales-table td {
            display: block;
            width: 100%;
        }

            .sales-table tbody {
                display: grid;
                gap: 12px;
                padding: 0;
            }

            .sales-table tr {
                padding: 14px;
                border: 1px solid #dbe5ef;
                border-radius: 18px;
                background: #fff;
                box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
            }

            .sales-table td {
                padding: 8px 0;
                display: grid;
                grid-template-columns: 110px minmax(0, 1fr);
                align-items: center;
                gap: 12px;
                border: 0;
                text-align: left !important;
            }

                .sales-table td::before {
                    content: attr(data-label);
                    color: #64748b;
                    font-size: 11px;
                    font-weight: 950;
                    text-transform: uppercase;
                    letter-spacing: .4px;
                }

    .sale-document,
    .sale-customer {
        min-width: 0;
    }

    .action-col {
        width: auto;
    }

    .print-btn {
        width: 100%;
    }
}
.return-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .64);
    backdrop-filter: blur(4px);
}

.return-modal {
    width: min(860px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .35);
}

.return-modal-header,
.return-modal-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
}

.return-modal-header {
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}

.return-modal-header span {
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.return-modal-header h2 {
    margin: 3px 0;
    color: #0f172a;
    font-size: 24px;
}

.return-modal-header p {
    margin: 0;
    color: #64748b;
}

.return-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: #334155;
    font-size: 27px;
    cursor: pointer;
}

.return-modal-body {
    overflow-y: auto;
    padding: 20px 24px;
}

.return-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 90px;
    align-items: center;
    gap: 18px;
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    background: #fff;
}

.return-line.selected {
    border-color: #60a5fa;
    background: #eff6ff;
}

.return-line-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.return-line-info strong {
    color: #0f172a;
}

.return-line-info small,
.return-line-info span {
    color: #64748b;
}

.return-quantity {
    display: flex;
    align-items: center;
}

.return-quantity button,
.return-quantity input {
    height: 42px;
    border: 1px solid #cbd5e1;
    background: #fff;
    text-align: center;
}

.return-quantity button {
    width: 42px;
    color: #1d4ed8;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
}

.return-quantity button:first-child {
    border-radius: 10px 0 0 10px;
}

.return-quantity button:last-child {
    border-radius: 0 10px 10px 0;
}

.return-quantity input {
    width: 70px;
    border-right: 0;
    border-left: 0;
    color: #0f172a;
    font-weight: 800;
}

.return-line-total {
    color: #0f172a;
    text-align: right;
}

.return-reason {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 18px;
    color: #334155;
    font-weight: 700;
}

.return-reason textarea {
    resize: vertical;
    min-height: 82px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font: inherit;
}

.return-reason small {
    color: #64748b;
    font-weight: 400;
}

.return-error {
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 700;
}

.return-modal-footer {
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.return-total {
    display: flex;
    margin-right: auto;
    flex-direction: column;
}

.return-total span {
    color: #64748b;
    font-size: 13px;
}

.return-total strong {
    color: #0f172a;
    font-size: 24px;
}

.return-cancel,
.return-submit {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    font-weight: 800;
    cursor: pointer;
}

.return-cancel {
    background: #e2e8f0;
    color: #334155;
}

.return-submit {
    background: #2563eb;
    color: #fff;
}

.return-submit:disabled,
.return-cancel:disabled,
.return-close:disabled {
    cursor: not-allowed;
    opacity: .5;
}

@media (max-width: 700px) {
    .return-modal-backdrop {
        align-items: end;
        padding: 0;
    }

    .return-modal {
        max-height: 96vh;
        border-radius: 20px 20px 0 0;
    }

    .return-line {
        grid-template-columns: 1fr auto;
    }

    .return-quantity {
        grid-column: 1;
    }

    .return-line-total {
        grid-column: 2;
        grid-row: 2;
    }

    .return-modal-footer {
        flex-wrap: wrap;
    }

    .return-total {
        width: 100%;
    }

    .return-cancel,
    .return-submit {
        flex: 1;
    }
}
