:root {
    --so-bg: var(--brand-surface-soft, #fff9f8);
    --so-card: #ffffff;
    --so-text: #182338;
    --so-muted: #607089;
    --so-border: #d9dfeb;
    --so-primary: var(--brand-primary, #ff6565);
    --so-primary-deep: var(--brand-primary-hover, #e85353);
    --so-success: #0f8d57;
    --so-warning: #f59e0b;
    --so-danger: #d64545;
    --so-shadow: 0 12px 40px rgba(20, 30, 55, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    background: radial-gradient(1200px 500px at 20% -10%, var(--brand-primary-soft, #fff0ef) 0%, rgba(255, 240, 239, 0) 60%), var(--so-bg);
    color: var(--so-text);
}

.hidden {
    display: none !important;
}

.so-shell {
    max-width: 980px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px 16px 32px;
}

.so-header {
    background: linear-gradient(120deg, var(--so-primary), #ff7c7c 58%, #ffa7a7);
    color: #fff;
    border-radius: 22px;
    padding: 18px 18px;
    box-shadow: var(--so-shadow);
}

.so-brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.so-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.18);
}

.so-brand h1 {
    margin: 0;
    font-size: 1.22rem;
    letter-spacing: 0.2px;
}

.so-brand p {
    margin: 2px 0 0;
    font-size: 0.86rem;
    opacity: 0.92;
}

.so-metrics {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.so-metric {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    padding: 8px 10px;
    border-radius: 12px;
    min-width: 110px;
}

.so-metric .label {
    display: block;
    font-size: 0.7rem;
    opacity: 0.85;
}

.so-metric strong {
    font-size: 0.95rem;
}

.so-main {
    margin-top: 14px;
}

.so-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.so-step {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 9px;
    border-radius: 12px;
    border: 1px solid var(--so-border);
    background: #fff;
    color: var(--so-muted);
    font-size: 0.78rem;
}

.so-step .num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-primary-soft, #fff0ef);
    color: var(--so-primary);
    font-weight: 800;
}

.so-step.active,
.so-step.done {
    border-color: var(--brand-primary-border, #ffc9c6);
}

.so-step.active .num {
    background: var(--so-primary);
    color: #fff;
}

.so-step.done .num {
    background: #1bb874;
    color: #fff;
}

.so-panel {
    background: var(--so-card);
    border: 1px solid var(--so-border);
    border-radius: 20px;
    box-shadow: var(--so-shadow);
    padding: 14px;
}

.so-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.so-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--so-border);
    border-radius: 999px;
    padding: 9px 12px;
    flex: 1;
    background: #fff;
}

.so-search input {
    border: 0;
    outline: none;
    width: 100%;
    font: inherit;
}

.so-warehouse {
    border: 1px solid var(--so-border);
    border-radius: 12px;
    padding: 8px 10px;
    min-width: 130px;
    text-align: right;
}

.so-warehouse span {
    display: block;
    color: var(--so-muted);
    font-size: 0.72rem;
}

.so-warehouse strong {
    font-size: 0.78rem;
}

.so-category {
    border: 1px solid var(--so-border);
    border-radius: 12px;
    padding: 6px 9px;
    background: #fff;
    min-width: 180px;
}

.so-category label {
    display: block;
    font-size: 0.7rem;
    color: var(--so-muted);
    margin-bottom: 2px;
    font-weight: 700;
}

.so-category select {
    width: 100%;
    border: 0;
    outline: none;
    font: inherit;
    background: transparent;
    color: var(--so-text);
    padding: 0;
}

.so-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--so-muted);
    border: 1px dashed var(--so-border);
    border-radius: 16px;
    background: #fbfcff;
}

.so-empty i {
    font-size: 1.7rem;
    margin-bottom: 7px;
}

.so-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.so-product {
    border: 1px solid var(--so-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.so-product .thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f1f4fb;
}

.so-product .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.so-product .stock {
    position: absolute;
    top: 7px;
    right: 7px;
    background: rgba(24, 35, 56, 0.82);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
}

.so-product .body {
    padding: 9px;
}

.so-product .name {
    font-weight: 700;
    font-size: 0.87rem;
    line-height: 1.28;
    min-height: 2.25em;
}

.so-product .sku {
    color: var(--so-muted);
    font-size: 0.73rem;
    margin-top: 2px;
}

.so-product .foot {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.so-product .price {
    color: var(--so-success);
    font-size: 0.86rem;
    font-weight: 800;
}

.add-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.so-cart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.so-cart-item {
    border: 1px solid var(--so-border);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.so-cart-item .name {
    font-weight: 700;
}

.so-cart-item .meta {
    margin-top: 2px;
    color: var(--so-muted);
    font-size: 0.78rem;
}

.qty-box {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-box button,
.qty-box input {
    height: 32px;
}

.qty-box button {
    width: 32px;
    border: 1px solid var(--so-border);
    border-radius: 8px;
    background: #fff;
}

.qty-box input {
    width: 54px;
    border: 1px solid var(--so-border);
    border-radius: 8px;
    text-align: center;
    font: inherit;
}

.so-summary {
    margin-top: 10px;
    border: 1px solid var(--so-border);
    background: #fafcff;
    border-radius: 14px;
    padding: 10px;
}

.so-summary .row,
.so-review-card .row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
    padding: 4px 0;
}

.so-summary .total,
.so-review-card .total {
    border-top: 1px dashed var(--so-border);
    margin-top: 4px;
    padding-top: 8px;
    font-weight: 800;
}

.so-form-wrap h2,
.so-review h2 {
    margin: 0;
    font-size: 1.14rem;
}

.hint {
    margin: 5px 0 12px;
    color: var(--so-muted);
    font-size: 0.84rem;
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.82rem;
    color: #2b3a56;
    font-weight: 700;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--so-border);
    border-radius: 12px;
    padding: 10px 11px;
    font: inherit;
}

.field textarea {
    resize: vertical;
}

.pay-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pay-card {
    border: 1px solid var(--so-border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 9px;
    align-items: flex-start;
    cursor: pointer;
}

.pay-card input {
    display: none;
}

.pay-card i {
    margin-top: 2px;
    color: var(--so-primary);
}

.pay-card p {
    margin: 2px 0 0;
    color: var(--so-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.pay-card.active {
    border-color: var(--brand-primary-border, #ffc9c6);
    background: var(--brand-primary-soft, #fff0ef);
}

.so-review-card {
    border: 1px solid var(--so-border);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
}

.so-review-card h3 {
    margin: 0 0 8px;
    font-size: 0.88rem;
}

.review-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    padding: 4px 0;
}

.so-qris-preview {
    border: 1px dashed var(--brand-primary-border, #ffc9c6);
    border-radius: 14px;
    background: var(--brand-primary-soft, #fff0ef);
    padding: 14px;
    display: grid;
    place-items: center;
}

.so-qris-preview img {
    width: min(270px, 100%);
    border-radius: 10px;
    border: 1px solid var(--so-border);
}

.so-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.so-actions.dual {
    justify-content: space-between;
    gap: 8px;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-height: 42px;
}

.btn-primary {
    background: var(--so-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--so-primary-deep);
}

.btn-success {
    background: var(--so-success);
    color: #fff;
}

.btn-ghost {
    border: 1px solid var(--so-border);
    background: #fff;
    color: var(--so-text);
}

.so-success {
    text-align: center;
    padding: 16px 10px;
}

.so-success .icon {
    color: var(--so-success);
    font-size: 3rem;
}

.so-success h2 {
    margin: 8px 0;
}

.so-success p {
    margin: 4px 0;
}

#successEta {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--brand-primary-soft, #fff0ef);
    border: 1px solid var(--brand-primary-border, #ffc9c6);
    color: var(--so-primary-deep);
    font-weight: 700;
    font-size: 0.82rem;
}

.pay-info {
    margin: 14px auto 16px;
    max-width: 640px;
    text-align: left;
    border: 1px solid var(--so-border);
    border-radius: 14px;
    background: #fafcff;
    padding: 12px;
}

.so-flash {
    padding: 9px 11px;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.so-flash.info {
    background: var(--brand-primary-soft, #fff0ef);
    border: 1px solid var(--brand-primary-border, #ffc9c6);
    color: var(--so-primary-deep);
}

.so-flash.warn {
    background: #fff7eb;
    border: 1px solid #f5d9ad;
    color: #8f5b15;
}

.so-flash.error {
    background: #fff0f0;
    border: 1px solid #f2b5b5;
    color: #8f2525;
}

@media (max-width: 900px) {
    .so-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .so-shell {
        padding: 12px 10px calc(26px + env(safe-area-inset-bottom));
    }

    .so-header {
        border-radius: 16px;
        padding: 14px;
    }

    .so-brand h1 {
        font-size: 1.12rem;
    }

    .so-brand p {
        font-size: 0.8rem;
    }

    .so-metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 10px;
    }

    .so-metric {
        min-width: 0;
        padding: 8px;
    }

    .so-stepper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .so-step {
        min-width: 0;
        padding: 9px 8px;
        font-size: 0.75rem;
    }

    .so-step .txt {
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .so-panel {
        border-radius: 14px;
        padding: 10px;
    }

    .pay-options {
        grid-template-columns: 1fr;
    }

    .so-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .so-search {
        grid-column: 1 / -1;
        min-width: 0;
        padding: 10px 12px;
    }

    .so-category,
    .so-warehouse {
        min-width: 0;
        width: 100%;
    }

    .so-warehouse {
        text-align: left;
    }

    .so-warehouse strong {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .so-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .so-product .body {
        padding: 8px;
    }

    .so-product .name {
        font-size: 0.92rem;
        min-height: 2.55em;
    }

    .so-product .sku {
        font-size: 0.72rem;
    }

    .so-product .foot {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .so-product .price {
        font-size: 1rem;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
        min-height: 40px;
        padding: 8px 10px;
    }

    .so-cart-item {
        grid-template-columns: 1fr;
    }

    .qty-box {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
    }

    .qty-box button {
        width: 36px;
    }

    .qty-box button,
    .qty-box input {
        height: 36px;
    }

    .qty-box input {
        width: 64px;
    }

    .so-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        padding-top: 10px;
        padding-bottom: calc(4px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 38%);
    }

    .so-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .so-actions.dual {
        flex-direction: column;
        gap: 8px;
    }

    .so-actions.dual .btn {
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .so-shell {
        padding: 10px 8px calc(22px + env(safe-area-inset-bottom));
    }

    .so-brand {
        gap: 10px;
    }

    .so-brand-mark {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .so-step .num {
        width: 20px;
        height: 20px;
        font-size: 0.72rem;
    }

    .so-search input,
    .so-category select,
    .field input,
    .field textarea {
        font-size: 16px;
    }

    .so-product .name {
        font-size: 0.88rem;
    }

    .add-btn {
        font-size: 0.84rem;
    }
}
