:root {
    --green: #1f7a4d;
    --green-dark: #155c39;
    --cream: #fff8ee;
    --text: #2b2b2b;
    --muted: #6b6b6b;
    --border: #e6e0d4;
    --error: #b3261e;
    --success: #1f7a4d;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--cream);
    line-height: 1.5;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--green-dark); }

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}
.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--green-dark);
    text-decoration: none;
}
.main-nav a {
    margin-left: 20px;
    text-decoration: none;
    font-weight: 600;
    color: var(--text);
}
.cart-link { position: relative; }
.cart-badge {
    background: var(--green);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    padding: 1px 7px;
    margin-left: 4px;
}

/* Flash messages */
.flashes { margin-top: 16px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 14px;
}
.flash-success { background: #e6f4ec; color: var(--green-dark); }
.flash-error { background: #fbeaea; color: var(--error); }
.flash ul { margin: 0; padding-left: 18px; }

/* Main */
.main-content { padding: 30px 20px 60px; }

.hero { text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 32px; margin-bottom: 6px; }
.hero p { color: var(--muted); }

.category-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 26px;
}
.category-filter a {
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    background: #fff;
}
.category-filter a.active,
.category-filter a:hover {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

/* Item grid */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}
.item-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.item-card-link { text-decoration: none; color: inherit; padding: 14px 14px 0; display: block; }
.item-image { aspect-ratio: 4/3; background: #f2ede1; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.item-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-image-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.item-image-placeholder.large { font-size: 80px; }
.item-card h3 { margin: 0 0 4px; font-size: 17px; }
.item-category {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--green-dark);
    background: #e6f4ec;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.item-desc { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.item-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.item-price { font-weight: 700; }
.item-price.large { font-size: 22px; margin: 6px 0 16px; }

/* Buttons */
.btn {
    display: inline-block;
    background: var(--green);
    color: #fff !important;
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: var(--green-dark); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-large { padding: 14px 26px; font-size: 16px; }
.btn-outline { background: #fff; color: var(--green-dark) !important; border: 1px solid var(--green); }
.btn-link { background: none; border: none; color: var(--error); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }

.empty-state { color: var(--muted); text-align: center; padding: 40px 0; }

/* Item detail */
.item-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.item-detail-image { aspect-ratio: 1; background: #f2ede1; border-radius: var(--radius); overflow: hidden; }
.item-detail-image img { width: 100%; height: 100%; object-fit: cover; }
.meta-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.meta-table th, .meta-table td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.meta-table th { width: 40%; color: var(--muted); font-weight: 600; }
.add-to-cart-form { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.add-to-cart-form input[type=number] { width: 70px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }

@media (max-width: 760px) {
    .item-detail { grid-template-columns: 1fr; }
}

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; margin: 20px 0; background: #fff; }
.cart-table th, .cart-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.qty-input { width: 60px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.cart-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.cart-total { font-size: 16px; }
.cart-checkout-cta { text-align: right; margin-top: 20px; }
.hidden-form { display: none; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: start; }
.checkout-form { display: flex; flex-direction: column; gap: 4px; background: #fff; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); }
.checkout-form label { font-size: 13px; font-weight: 600; margin-top: 10px; }
.checkout-form input, .checkout-form textarea {
    padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.checkout-form button { margin-top: 18px; }
.order-summary { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.summary-list { list-style: none; padding: 0; margin: 0 0 14px; }
.summary-list li { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.summary-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; }

@media (max-width: 760px) {
    .checkout-layout { grid-template-columns: 1fr; }
}

.payment-result { text-align: center; padding: 40px 20px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.payment-result.success h1 { color: var(--green-dark); }
.payment-result.failed h1 { color: var(--error); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------- Admin ---------------- */
.admin-body { background: #f4f6f5; }
.admin-header {
    background: var(--green-dark);
    color: #fff;
    padding: 14px 0;
}
.admin-header .wrap { display: flex; justify-content: space-between; align-items: center; }
.admin-header a { color: #fff; text-decoration: none; margin-left: 16px; font-size: 14px; }
.admin-header .brand { font-weight: 700; font-size: 18px; }
.admin-content { padding: 30px 20px 60px; max-width: 1100px; margin: 0 auto; }
.admin-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: middle; }
.admin-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active, .badge-paid, .badge-completed { background: #e6f4ec; color: var(--green-dark); }
.badge-inactive, .badge-failed, .badge-cancelled { background: #fbeaea; color: var(--error); }
.badge-pending, .badge-processing { background: #fff4e0; color: #9a6300; }

.admin-form { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.admin-form label { font-weight: 600; font-size: 13px; margin-top: 12px; }
.admin-form input, .admin-form select, .admin-form textarea {
    padding: 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.admin-form .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.meta-rows { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.meta-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
.meta-row input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.meta-row button { background: #fbeaea; color: var(--error); border: none; border-radius: 6px; cursor: pointer; padding: 0 10px; }

.login-box { max-width: 360px; margin: 80px auto; background: #fff; padding: 30px; border-radius: var(--radius); border: 1px solid var(--border); }
.login-box h1 { text-align: center; font-size: 22px; }

.action-links a, .action-links button { margin-right: 10px; font-size: 13px; }

.order-line-items { width: 100%; border-collapse: collapse; margin-top: 10px; }
.order-line-items th, .order-line-items td { padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
