:root {
    --bg: #ffffff;
    --surface: #f7f7f8;
    --border: #e2e4e8;
    --text: #202124;
    --muted: #666b73;
    --primary: #3483fa;
    --primary-dark: #2468c9;
    --success: #178743;
    --danger: #b3261e;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(25, 30, 40, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.container {
    width: min(100% - 32px, 1100px);
    margin-inline: auto;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.header-content {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-weight: 750;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
}

nav a:hover,
nav a:focus-visible {
    color: var(--text);
}

main {
    padding-block: 40px 64px;
}

.page-heading {
    margin-bottom: 28px;
}

.page-heading h1,
.payment-result h1 {
    margin: 0 0 8px;
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    line-height: 1.15;
}

.page-heading p,
.payment-result > p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 8px !important;
    color: var(--primary) !important;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.product-card,
.panel,
.empty-state,
.payment-result {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.product-card {
    overflow: hidden;
}

.product-card img {
    width: 100%;
    height: auto;
    display: block;
    background: var(--surface);
}

.product-body {
    padding: 20px;
}

.product-body h2,
.panel h2,
.empty-state h2 {
    margin: 0 0 8px;
    font-size: 1.12rem;
}

.price {
    margin: 0 0 18px;
    font-size: 1.25rem;
    font-weight: 750;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 17px;
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.button-primary,
.button-mp {
    color: #fff;
    background: var(--primary);
}

.button-primary:hover,
.button-mp:hover {
    background: var(--primary-dark);
}

.button-secondary {
    border-color: var(--border);
    color: var(--text);
    background: #fff;
}

.button-secondary:hover {
    background: var(--surface);
}

.product-card .button,
.checkout-form .button {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: var(--surface);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.quantity-controls form {
    margin: 0;
}

.quantity-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    font-size: 1.15rem;
    cursor: pointer;
}

.text-button {
    border: 0;
    padding: 6px;
    color: var(--danger);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.cart-summary {
    width: min(100%, 380px);
    margin: 24px 0 0 auto;
}

.cart-summary > div,
.checkout-total {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 9px 0;
}

.total-row,
.checkout-total {
    margin-top: 5px;
    border-top: 1px solid var(--border);
    font-size: 1.2rem;
}

.cart-summary .button {
    width: 100%;
    margin-top: 16px;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.empty-state .button {
    margin-top: 14px;
}

.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
    gap: 24px;
    align-items: start;
}

.panel {
    padding: 22px;
}

.compact-table {
    border-radius: 8px;
}

.checkout-total {
    margin-bottom: 0;
}

.checkout-form {
    display: grid;
    gap: 10px;
}

.checkout-form label {
    margin-top: 5px;
    font-weight: 700;
}

.checkout-form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #b9bdc5;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.checkout-form input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(52, 131, 250, 0.17);
}

.checkout-form .button {
    margin-top: 12px;
}

.security-note {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    text-align: center;
}

.payment-brick {
    min-height: 320px;
    margin-top: 18px;
}

.payment-message {
    min-height: 24px;
    margin: 14px 0 0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    text-align: left;
}

.payment-message:empty {
    display: none;
}

.payment-message.is-error {
    border: 1px solid rgba(198, 40, 40, 0.25);
    color: var(--danger);
    background: #fff3f3;
}

.payment-message.is-loading {
    border: 1px solid rgba(52, 131, 250, 0.2);
    color: var(--primary-dark);
    background: #f2f7ff;
}

.available-methods {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.available-methods h3 {
    margin: 0 0 6px;
    font-size: 0.98rem;
}

.payment-methods-loading {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.payment-methods-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.payment-methods-list li {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--muted);
    background: var(--surface);
    font-size: 0.8rem;
}

.alert {
    margin-bottom: 22px;
    border: 1px solid;
    border-radius: 8px;
    padding: 13px 15px;
}

.alert-error {
    border-color: #f1b8b5;
    color: #7b211c;
    background: #fff2f1;
}

.payment-result {
    width: min(100%, 680px);
    margin-inline: auto;
    padding: clamp(28px, 6vw, 52px);
    text-align: center;
}

.status-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    border: 8px solid currentColor;
    border-radius: 50%;
}

.status-success .status-icon {
    color: var(--success);
}

.status-pending .status-icon {
    color: #b7791f;
}

.status-error .status-icon {
    color: var(--danger);
}

.order-details {
    margin: 28px 0 0;
    border-top: 1px solid var(--border);
    text-align: left;
}

.order-details div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.order-details dt {
    color: var(--muted);
}

.order-details dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.result-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

    .checkout-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 580px) {
    .container {
        width: min(100% - 24px, 1100px);
    }

    .header-content {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding-block: 14px;
    }

    main {
        padding-block: 28px 48px;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        border: 0;
        overflow: visible;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 8px;
    }

    td,
    tbody tr:last-child td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        border-bottom: 1px solid var(--border);
        padding: 10px;
        text-align: right;
    }

    td:last-child {
        border-bottom: 0;
    }

    td[data-label]::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 650;
        text-align: left;
    }

    .panel {
        padding: 16px;
    }

    .order-details div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
