:root {
    --bg: #f4f6f8;
    --text: #1b1f23;
    --muted: #5f6c7b;
    --brand: #1b8f6b;
    --brand-dark: #12674c;
    --card: #ffffff;
    --line: #d8dde3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #eef3f8, #f8fafc 35%);
    color: var(--text);
}

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

.container {
    width: 1180px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #ffffffde;
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    white-space: nowrap;
}

.nav-links a {
    color: #1f2933;
}

.welcome {
    color: var(--muted);
}

.hero {
    margin-top: -18px;
    padding: 70px 0 44px;
    background: radial-gradient(circle at top right, #d5f7ec, #e8edf8 55%, #f8fbff);
    border-bottom: 1px solid var(--line);
}

.hero h1 {
    margin: 0;
    font-size: 2.1rem;
}

.hero p {
    margin: 10px 0 0;
    color: var(--muted);
}

.main-content {
    padding: 28px 0 40px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.product-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(34, 49, 63, 0.06);
}

.product-image {
    width: 100%;
    height: 140px;
    object-fit: fill;
}

.card-body {
    padding: 14px;
}

.card-body h3 {
    margin: 0;
    font-size: 1.05rem;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.price {
    margin: 8px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.product-card:nth-child(3n) .price {
    font-size: 0.88rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.94rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

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

.btn-secondary {
    background: #ebf1f8;
    color: #263443;
}

.btn-link {
    background: transparent;
    color: #af2b2b;
    text-decoration: underline;
    padding: 0;
}

.btn-add {
    margin-left: 22px;
}

.flash {
    margin-top: 14px;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 0.94rem;
}

.flash-success {
    background: #dff8ec;
    border: 1px solid #a4e8c8;
}

.error-box {
    background: #fdecec;
    border: 1px solid #f2b3b3;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.product-detail-image {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.big {
    font-size: 2rem;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-top: 14px;
}

.inline-form input {
    width: 80px;
    padding: 8px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.cart-table th,
.cart-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #eef1f4;
}

.qty-input {
    width: 72px;
    padding: 7px;
}

.cart-summary {
    margin-top: 14px;
}

.cart-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.checkout-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.checkout-form,
.checkout-summary,
.auth-card,
.success-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}

.checkout-form .field {
    margin-bottom: -4px;
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    border: 1px solid #cbd5df;
    border-radius: 8px;
    padding: 9px;
    font-size: 0.95rem;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    padding-top: 40px;
}

.auth-card {
    width: 420px;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
}

.site-footer p {
    margin: 0;
    padding: 16px 0;
    color: #6c7c8c;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

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

    .cart-actions .btn {
        width: 320px;
    }

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

    .checkout-form {
        width: 560px;
    }
}
