/* styles.css */
:root {
    --bg: #f7f7f5;
    --card: #ffffff;
    --text: #1f1f1f;
    --muted: #7a7a7a;
    --line: #e9e9e4;
    --green: #78b82a;
    --green-dark: #67a11f;
    --error: #e67b7b;
    --badge: #7ac943;
}

/* Base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

img {
    max-width: 100%;
    display: block
}

a {
    color: inherit;
    text-decoration: none
}

.link-muted {
    color: var(--muted);
    font-size: 14px
}

.page-header {
    padding: 20px 16px 8px
}

.page-title {
    text-align: center;
    font-weight: 800;
    font-size: 28px;
    letter-spacing: .2px;
}

/* Layout */
.container {
    padding: 0 16px 48px;
    max-width: 1160px;
    margin: 0 auto
}

.checkout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px
}

.checkout-aside {
    order: 0
}

.checkout-main {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 16px
}

/* Card */
.card {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 2px 12px rgba(0, 0, 0, .03);
    border: 1px solid var(--line);
}

.order-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line)
}

.step-badge {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--badge);
    color: #fff;
    font-weight: 700;
    font-size: 14px
}

.step-title {
    font-weight: 700
}

/* Order item row */
.order-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px
}

.order-thumb {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    background: #ddd url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><rect width="80" height="80" fill="%23cfcfcf"/></svg>') center/cover no-repeat
}

.order-info {
    min-width: 0
}

.order-name {
    font-weight: 600;
    display: block
}

.order-meta {
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px
}

.order-qty {
    color: var(--muted);
    font-size: 14px
}

.order-price {
    text-align: right
}

.price-current {
    font-weight: 800
}

.price-old {
    color: var(--muted);
    text-decoration: line-through;
    font-size: 12px
}

.price-old.small {
    font-size: 11px
}

/* Form */
.form {
    padding: 14px 16px 18px
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px
}

.label {
    font-weight: 600
}

.label.required::after {
    content: " *";
    color: var(--error)
}

.input,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 12px 12px;
    font-size: 16px;
    outline: none;
    transition: border-color .2s, box-shadow .2s
}

.input:focus,
.textarea:focus {
    border-color: #bfc5b7;
    box-shadow: 0 0 0 3px rgba(122, 201, 67, .15)
}

.field-msg {
    background: #fdeeee;
    border: 1px solid #f2c1c1;
    color: #8a2f2f;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    display: none;
}

.show {
    display: block;
}

.is-error .input {
    border-color: #f2c1c1;
    background: #fffafa
}

.is-error-red {
    color: red;
    font-weight: 600;
}

.textarea {
    resize: vertical
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: .2px;
    transition: transform .05s ease, background .2s ease, opacity .2s ease;
}

.btn:active {
    transform: translateY(1px)
}

.btn-secondary {
    background: #ebede6;
    color: #2c2c2c;
    padding: 10px 18px
}

.btn-primary {
    background: var(--green);
    color: #fff;
    padding: 12px 20px
}

.btn-primary:hover {
    background: var(--green-dark)
}

.btn-lg {
    padding: 14px 22px
}

.btn-block {
    width: 100%
}

/* Payment */
.payment-placeholder {
    padding: 14px 16px 18px;
    color: var(--muted)
}

/* Agree + submit */
.agree-submit {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    margin-top: -4px
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px
}

.check input {
    width: 16px;
    height: 16px
}

/* Aside totals */
.aside-totals {
    padding: 14px 16px 16px
}

.totals {
    margin: 0
}

.totals-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0
}

.totals .save {
    background: #e9f6d9;
    color: #2c5f00;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700
}

.totals-row--total dt {
    font-weight: 800
}

.total {
    font-weight: 800;
    font-size: 18px
}

.sep {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 8px 0
}



/* Desktop ≥ 1024px */
@media (min-width:1024px) {
    .checkout {
        grid-template-columns: 1fr 320px;
        gap: 24px;
        align-items: start;
    }

    .checkout-aside {
        order: 1;
        position: sticky;
        top: 16px
    }

    .checkout-main {
        order: 0;
        gap: 18px
    }

    .order-item {
        grid-template-columns: 64px 1fr auto auto;
        gap: 14px
    }

    .order-thumb {
        width: 64px;
        height: 64px
    }

    .page-title {
        font-size: 34px
    }
}