:root {
    --ink: #18211f;
    --muted: #66736f;
    --line: #dfe7e4;
    --paper: #fbfcfa;
    --panel: #ffffff;
    --accent: #147c63;
    --accent-dark: #0f5e4c;
    --warn: #b42318;
    --gold: #c99528;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--paper);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; object-fit: cover; }
button, input, textarea, select { font: inherit; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 16px clamp(18px, 5vw, 64px);
    background: rgba(251, 252, 250, .94);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.1rem; }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav form { margin: 0; }
.page { width: min(1120px, calc(100% - 32px)); margin: 28px auto 56px; }

.hero {
    min-height: 420px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
    align-items: center;
    margin-bottom: 44px;
}
.hero h1 { font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1; margin: 8px 0 18px; }
.hero p { color: var(--muted); font-size: 1.05rem; line-height: 1.7; }
.hero img { height: 390px; width: 100%; border-radius: 8px; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0; font-size: .8rem; font-weight: 700; }

.section-head, .summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 0 0 22px;
}
.section-head h1, .section-head h2 { margin: 0 0 6px; }
.section-head p { margin: 0; color: var(--muted); }

.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.product-card, .cart-item, .form-panel, .order-summary, .admin-metrics > div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.product-card { overflow: hidden; display: flex; flex-direction: column; }
.product-card img { height: 190px; width: 100%; }
.product-body { padding: 16px; display: flex; flex: 1; flex-direction: column; justify-content: space-between; gap: 18px; }
.product-body h3 { margin: 0 0 8px; }
.product-body p { margin: 0; color: var(--muted); line-height: 1.5; }
.product-foot, .price-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.product-foot span, .price-row span { color: var(--muted); }

.product-detail { display: grid; grid-template-columns: minmax(320px, .9fr) 1fr; gap: 36px; align-items: start; }
.product-gallery {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.active-image-wrap {
    position: relative;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.active-product-image {
    width: min(100%, 360px);
    height: 360px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 1.8rem;
    line-height: 1;
}
.gallery-arrow:hover { background: #f1f6f4; color: var(--ink); }
.gallery-arrow[data-gallery-prev] { left: 2px; }
.gallery-arrow[data-gallery-next] { right: 2px; }
.thumbnail-strip {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    padding: 16px 4px 2px;
    border-top: 1px solid var(--line);
    margin-top: 14px;
}
.thumbnail-button {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
}
.thumbnail-button.active { border-color: var(--gold); }
.thumbnail-button img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}
.detail-copy h1 { font-size: clamp(2rem, 4vw, 3.8rem); margin: 8px 0 18px; line-height: 1; }
.detail-copy p { color: var(--muted); line-height: 1.7; }

.button, button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 700;
}
.button:hover, button:hover { background: var(--accent-dark); }
.button.secondary {
    background: #eef4f2;
    color: var(--ink);
}
.button.secondary:hover { background: #dfe7e4; }
.button:disabled, button:disabled {
    cursor: wait;
    opacity: .7;
}
.button.is-loading {
    opacity: .75;
    pointer-events: none;
}
.button.small { padding: 8px 12px; }
.small-button { padding: 8px 12px; font-size: .9rem; }
.link-button { background: transparent; color: var(--ink); padding: 0; }
.danger { background: var(--warn); }

.inline-form, .quantity-form, .status-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}
.checkbox-label input { width: auto; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}
input:disabled, textarea:disabled {
    background: #f6f8f7;
    color: var(--ink);
}
.inline-form input, .quantity-form input { width: 96px; }

.cart-list { display: grid; gap: 12px; }
.cart-item {
    display: grid;
    grid-template-columns: 88px 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
}
.cart-item img { width: 88px; height: 72px; border-radius: 6px; }
.cart-item h3, .cart-item p { margin: 0; }
.cart-item p { color: var(--muted); }
.summary-bar { margin-top: 18px; padding: 18px; border-top: 2px solid var(--ink); font-size: 1.2rem; }

.checkout-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.form-panel { padding: 24px; display: grid; gap: 16px; }
.form-panel h1 { margin: 0; }
.form-panel p { margin: 0; color: var(--muted); }
.form-note {
    padding: 12px 14px;
    border: 1px solid #cfe5dc;
    border-radius: 8px;
    background: #eef8f4;
    line-height: 1.5;
}
.order-summary { padding: 22px; }
.summary-line, .summary-total { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-total { border-bottom: 0; font-size: 1.2rem; }

.auth-wrap { max-width: 480px; margin: 48px auto; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f1f6f4; font-size: .85rem; text-transform: uppercase; }
td span { color: var(--muted); font-size: .9rem; }

.admin-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.admin-metrics > div { padding: 20px; display: grid; gap: 8px; }
.admin-metrics span { color: var(--muted); }
.admin-metrics strong { font-size: 2rem; }
.table-product { display: flex; align-items: center; gap: 12px; }
.table-product img { width: 58px; height: 48px; border-radius: 6px; }
.table-product div { display: grid; gap: 4px; }
.product-form { max-width: 840px; }
.profile-form { max-width: 560px; }
.form-grid { display: grid; grid-template-columns: 1fr 180px 140px; gap: 16px; }
.filter-bar {
    display: grid;
    grid-template-columns: 1fr 220px auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.action-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-row form { margin: 0; }
.image-manager h2 { margin: 0 0 12px; }
.image-manager { margin-top: 18px; }
.admin-update-button { display: inline-block; width: fit-content; margin: 8px 0 4px; }
.payment-retry { margin: 0 0 18px; }
.readonly-panel { margin-bottom: 18px; }
.order-detail-panel { margin-bottom: 18px; }
.order-detail-panel p { margin: 0; }
.pagination-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
}
.pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.button.disabled {
    background: #d8e1de;
    color: var(--muted);
    cursor: not-allowed;
}
.admin-image-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.admin-image-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    display: grid;
    gap: 8px;
}
.admin-image-card img {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    object-fit: cover;
}

.alert { padding: 13px 15px; border-radius: 8px; margin-bottom: 18px; }
.alert p { margin: 0; }
.success { background: #e6f6ef; color: #116143; }
.error { background: #ffe8e5; color: #8b1d14; }
.empty-state { text-align: center; padding: 60px 20px; }

@media (max-width: 860px) {
    .site-header { align-items: flex-start; flex-direction: column; }
    .hero, .product-detail, .checkout-grid { grid-template-columns: 1fr; }
    .hero { min-height: auto; }
    .hero img { height: 320px; }
    .active-image-wrap { min-height: 300px; }
    .active-product-image { height: 300px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .cart-item { grid-template-columns: 72px 1fr; }
    .cart-item img { width: 72px; height: 62px; }
    .admin-metrics { grid-template-columns: 1fr; }
    .admin-image-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .pagination-bar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
    .product-grid { grid-template-columns: 1fr; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .nav { gap: 12px; }
    .form-grid { grid-template-columns: 1fr; }
    .admin-image-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr; }
}
