:root {
    --bg: #f7f5f1;
    --surface: #ffffff;
    --surface-soft: #f0eee8;
    --text: #17202a;
    --muted: #65717d;
    --line: #ded8ce;
    --accent: #187461;
    --accent-dark: #105649;
    --warning: #d8982c;
    --shadow: 0 12px 32px rgba(23, 32, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

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

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 156px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 8px;
    background: var(--text);
    color: #ffffff;
    letter-spacing: 0;
}

.brand-text {
    font-size: 1.15rem;
}

.search {
    display: flex;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.search input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 13px 14px;
    outline: none;
}

.search button,
.filter-actions button,
.product-bottom button {
    border: 0;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.search button {
    padding: 0 22px;
}

.account-links {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    white-space: nowrap;
}

.account-links a,
.account-links button {
    padding: 8px 0;
}

.account-links form {
    margin: 0;
}

.account-links button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.cart-link {
    color: var(--text);
    font-weight: 700;
}

.shop-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 28px 32px 48px;
}

.sidebar {
    align-self: start;
    position: sticky;
    top: 92px;
}

.panel {
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.panel:first-child {
    padding-top: 0;
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--muted);
}

.category-link,
.check-row {
    display: flex;
    align-items: center;
    min-height: 36px;
    gap: 10px;
    color: var(--text);
}

.category-link {
    padding: 7px 10px;
    border-radius: 8px;
}

.category-link.is-active,
.category-link:hover {
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
}

.check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

.price-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.price-row input {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.filter-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding-top: 18px;
}

.filter-actions button {
    height: 42px;
    border-radius: 8px;
}

.filter-actions a {
    color: var(--muted);
    font-weight: 700;
}

.catalog {
    min-width: 0;
}

.catalog-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-dark);
    font-weight: 800;
    font-size: 0.84rem;
    text-transform: uppercase;
}

.catalog-head h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.05;
}

.payment-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: 430px;
}

.payment-badges span {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

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

.product-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.product-card {
    overflow: hidden;
}

.product-image {
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--surface-soft);
}

.product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 16px;
}

.product-meta {
    min-height: 20px;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.84rem;
}

.product-info h2 {
    margin: 0 0 8px;
    font-size: 1.08rem;
    line-height: 1.25;
}

.product-info > p:not(.product-meta) {
    min-height: 48px;
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.product-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
}

.price {
    display: grid;
    gap: 2px;
}

.price del {
    color: var(--muted);
    font-size: 0.85rem;
}

.price strong {
    font-size: 1.1rem;
}

.product-bottom button {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 8px;
}

.product-bottom form {
    margin: 0;
}

.empty-state {
    padding: 42px;
}

.empty-state h2 {
    margin: 0 0 8px;
}

.empty-state p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
}

.detail-layout,
.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 34px 32px 54px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 36px;
    align-items: start;
}

.detail-image {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.detail-image img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.detail-info {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.detail-info h1,
.page-head h1,
.success-box h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    line-height: 1.08;
}

.detail-copy {
    margin: 18px 0;
    color: var(--muted);
}

.detail-price {
    display: grid;
    gap: 4px;
    margin: 20px 0;
}

.detail-price del {
    color: var(--muted);
}

.detail-price strong {
    font-size: 1.7rem;
}

.buy-box {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    margin: 0 0 18px;
}

.buy-box label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.buy-box input,
.checkout-form input,
.checkout-form textarea,
.cart-row input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.buy-box input {
    min-height: 46px;
    padding: 0 10px;
}

.buy-box button,
.summary button,
.checkout-link,
.cart-items > button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
}

.trust-list {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.related {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 0 32px 56px;
}

.related > h2 {
    margin: 0 0 16px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.page-head a {
    color: var(--accent-dark);
    font-weight: 800;
}

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

.cart-items,
.checkout-form,
.summary,
.success-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.cart-items {
    display: grid;
    gap: 0;
    padding: 0;
}

.cart-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 92px 130px;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.cart-row img {
    width: 96px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface-soft);
}

.cart-row h2 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.cart-row p {
    margin: 0;
    color: var(--muted);
}

.cart-row input {
    min-height: 40px;
    padding: 0 10px;
}

.cart-items > button {
    justify-self: end;
    margin: 16px;
    padding: 0 18px;
}

.summary {
    position: sticky;
    top: 92px;
    padding: 20px;
}

.summary h2,
.checkout-form h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.summary p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0;
    color: var(--muted);
}

.summary p strong {
    color: var(--text);
    text-align: right;
}

.summary .grand {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 1.1rem;
}

.checkout-link,
.summary button {
    display: grid;
    width: 100%;
    place-items: center;
    padding: 0 16px;
    margin-top: 18px;
}

.checkout-form {
    display: grid;
    gap: 16px;
    padding: 22px;
}

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

.checkout-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.checkout-form input,
.checkout-form textarea {
    min-height: 42px;
    padding: 10px;
}

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

.payment-options label {
    min-height: 48px;
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
}

.payment-options input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.alert {
    padding: 12px 14px;
    border: 1px solid #e9b3a6;
    border-radius: 8px;
    background: #fff2ef;
    color: #8a2d1d;
    font-weight: 700;
}

.success-box {
    max-width: 620px;
    padding: 34px;
}

.payment-status {
    display: grid;
    gap: 10px;
    margin: 22px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf7;
}

.payment-status p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
}

.payment-status span {
    color: var(--muted);
}

.sandbox-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0;
}

.sandbox-actions form {
    margin: 0;
}

.sandbox-actions button,
.secondary-button {
    min-height: 44px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
}

.sandbox-actions .secondary-button {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}

.plain-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent-dark);
    font-weight: 800;
}

.account-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.account-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.account-panel h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.account-panel p {
    display: grid;
    gap: 4px;
    margin: 0 0 14px;
}

.account-panel span,
.account-panel small {
    color: var(--muted);
}

.orders-panel {
    min-width: 0;
}

.order-list {
    display: grid;
    gap: 10px;
}

.order-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf7;
}

.order-card span:first-child {
    display: grid;
    gap: 2px;
}

.small-empty {
    display: grid;
    gap: 10px;
    color: var(--muted);
}

.small-empty p {
    margin: 0;
}

.small-empty a {
    color: var(--accent-dark);
    font-weight: 800;
}

.order-detail-row {
    grid-template-columns: minmax(0, 1fr) 90px 120px 130px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-actions a,
.page-head > a {
    min-height: 40px;
    display: inline-grid;
    place-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-grid article,
.admin-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stats-grid article {
    display: grid;
    gap: 8px;
    padding: 20px;
}

.stats-grid span,
.muted {
    color: var(--muted);
}

.stats-grid strong {
    font-size: 1.6rem;
}

.admin-panel {
    padding: 20px;
}

.admin-panel h2 {
    margin: 0 0 16px;
}

.admin-split {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.admin-table {
    display: grid;
    gap: 10px;
}

.admin-table > a,
.admin-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(160px, 1fr) minmax(150px, auto) minmax(120px, auto);
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf7;
}

.admin-row {
    grid-template-columns: minmax(180px, 1fr) 90px 70px 112px;
}

.category-row {
    min-height: 72px;
}

.category-row > a {
    display: inline-grid;
    min-height: 38px;
    place-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.category-row span:nth-child(2),
.category-row > strong {
    white-space: nowrap;
}

.admin-table > a span:first-child,
.admin-row span:first-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.admin-table > a small,
.admin-row small {
    color: var(--muted);
}

.admin-form select,
.status-form select {
    min-height: 42px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.inline-check {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 10px !important;
    color: var(--text) !important;
}

.inline-check input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.status-form {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.status-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 86px);
    place-items: center;
    padding: 34px 18px;
}

.auth-panel {
    width: min(520px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    margin: 0 0 20px;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.auth-form input {
    min-height: 44px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.auth-form button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
}

.auth-switch {
    margin: 18px 0 0;
    color: var(--muted);
}

.auth-switch a {
    color: var(--accent-dark);
    font-weight: 800;
}

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

    .detail-layout,
    .cart-layout,
    .checkout-layout,
    .account-grid,
    .admin-split {
        grid-template-columns: 1fr;
    }

    .summary {
        position: static;
    }
}

@media (max-width: 840px) {
    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 18px;
    }

    .account-links {
        justify-content: space-between;
    }

    .shop-shell {
        grid-template-columns: 1fr;
        padding: 22px 18px 40px;
    }

    .detail-layout,
    .page-shell,
    .related {
        padding-left: 18px;
        padding-right: 18px;
    }

    .sidebar {
        position: static;
    }

    .catalog-head {
        display: grid;
    }

    .payment-badges {
        justify-content: start;
    }
}

@media (max-width: 560px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

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

    .product-bottom button {
        width: 100%;
    }

    .buy-box,
    .form-grid,
    .payment-options,
    .sandbox-actions,
    .cart-row,
    .order-card,
    .order-detail-row,
    .admin-table > a,
    .admin-row,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .category-row span:nth-child(2),
    .category-row > strong {
        white-space: normal;
    }

    .cart-row img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .page-head {
        display: grid;
    }
}
