:root {
  --green: #2f9e44;
  --green-dark: #237a34;
  --sun: #ffb703;
  --berry: #e63946;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #fffaf2;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 41, 51, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: 2rem; font-weight: 800; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.mt { margin-top: 1.2rem; }
.grow { flex: 1; }
.pre { white-space: pre-wrap; }
.inline { display: inline; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; }

/* Header */
.topbar { background: var(--green-dark); color: #fff; text-align: center; font-size: 0.85rem; padding: 6px; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.4rem; color: var(--ink); white-space: nowrap; }
.logo strong { color: var(--green); }
.logo:hover { text-decoration: none; }
.search-form { flex: 1; display: flex; max-width: 520px; }
.search-form input { flex: 1; padding: 10px 14px; border: 2px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; font: inherit; }
.search-form input:focus { outline: none; border-color: var(--green); }
.search-form button { padding: 0 18px; border: 0; background: var(--green); color: #fff; border-radius: 0 999px 999px 0; font: inherit; font-weight: 700; cursor: pointer; }
.header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; font-weight: 600; }
.header-link { color: var(--ink); }
.cart-link { background: var(--sun); color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 800; }
.cart-link:hover { text-decoration: none; filter: brightness(0.95); }
.cart-count { background: var(--ink); color: #fff; border-radius: 999px; padding: 0 8px; margin-left: 4px; font-size: 0.85rem; }
.category-nav { border-top: 1px solid var(--line); }
.category-nav .container { display: flex; gap: 22px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; }
.category-nav a { color: var(--ink); font-weight: 600; white-space: nowrap; }
.category-nav a.active { color: var(--green); border-bottom: 2px solid var(--green); }
.category-nav .deals-link { color: var(--berry); }

/* Buttons & forms */
.btn {
  display: inline-block; background: var(--green); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 22px; font: inherit; font-weight: 800; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--green-dark); text-decoration: none; }
.btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--green-dark); border: 2px solid var(--green); }
.btn-ghost:hover { background: #ecfdf3; }
.btn-small { padding: 7px 14px; font-size: 0.9rem; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-pay { font-size: 1.15rem; padding: 15px; }
.link-button { background: none; border: 0; padding: 0; color: var(--green-dark); font: inherit; font-weight: 600; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--berry); }

label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.95rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid #d1d5db;
  border-radius: 10px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.15); }
input[type='checkbox'] { display: inline; width: auto; margin: 0 6px 0 0; }
label.check { font-weight: 400; display: flex; align-items: center; }
.field-error { display: block; color: var(--berry); font-weight: 600; font-size: 0.85rem; margin-top: 4px; }
.hint { display: block; color: var(--muted); font-weight: 400; font-size: 0.85rem; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.flash-success { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Home */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 30px;
  background: linear-gradient(120deg, var(--hero-from, #fff1d6) 0%, var(--hero-to, #e9f9ee) 100%); border-radius: 24px; padding: 48px; margin-bottom: 40px;
}
.hero h1 { font-size: 2.8rem; }
.hero h1 span { color: var(--green); }
.hero p { font-size: 1.1rem; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.hero-art img { margin: 0 auto; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.12)); }
.section-title { font-size: 1.5rem; font-weight: 800; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
section { margin-bottom: 36px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.category-tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; color: var(--ink); border: 2px solid transparent; }
.category-tile:hover { border-color: var(--green); text-decoration: none; }
.category-tile span { color: var(--muted); font-size: 0.9rem; }
.promise { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.promise div { background: #fff; border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.promise span { color: var(--muted); font-size: 0.9rem; }

/* Products */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s; }
.product-card:hover { transform: translateY(-3px); }
.product-image { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #f3f4f6; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; }
.badge-sale { background: var(--berry); color: #fff; }
.badge-out { background: var(--ink); color: #fff; left: auto; right: 10px; }
.price-row .badge { position: static; }
.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.product-body h3 { font-size: 1rem; margin: 2px 0 6px; flex: 1; }
.product-body h3 a { color: var(--ink); }
.product-cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rating { display: inline-flex; gap: 6px; align-items: center; font-size: 0.9rem; color: var(--ink); }
.stars { color: var(--sun); letter-spacing: 1px; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 12px; }
.price { font-size: 1.2rem; font-weight: 800; }
.compare { color: var(--muted); text-decoration: line-through; }
.price-row.big .price { font-size: 2rem; }

.breadcrumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 16px; }
.listing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters label { margin: 0; font-size: 0.85rem; }
.filters input[type='number'] { width: 90px; }
.filters label:has(input[type='checkbox']) { display: flex; align-items: center; padding-bottom: 10px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 30px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.pagination .current { background: var(--green); color: #fff; }
.empty { text-align: center; padding: 60px 20px; }

.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; margin-bottom: 40px; }
.product-detail-image img { width: 100%; border-radius: 20px; aspect-ratio: 4 / 3; object-fit: cover; box-shadow: var(--shadow); }
.add-to-cart { display: flex; gap: 12px; align-items: flex-end; margin: 18px 0 12px; }
.add-to-cart label { margin: 0; }
.add-to-cart input { width: 80px; }
.stock.in { color: var(--green-dark); font-weight: 700; }
.stock.low { color: #c2410c; font-weight: 700; }
.stock.out { color: var(--berry); font-weight: 700; }
.perks { list-style: none; padding: 0; color: var(--muted); }
.share { font-size: 0.9rem; color: var(--muted); }
.reviews .review { border-bottom: 1px solid var(--line); padding: 14px 0; }
.review-form { max-width: 620px; margin-top: 24px; }

/* Cart & checkout */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.cart-table { width: 100%; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border-collapse: collapse; overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); }
.cart-table th { background: #f9fafb; font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }
.cart-item { display: flex; align-items: center; gap: 12px; }
.cart-item img { border-radius: 8px; object-fit: cover; }
.qty-form { display: flex; gap: 8px; align-items: center; }
.qty-form input { width: 70px; margin: 0; }
.summary { position: sticky; top: 140px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0 0 12px; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 800; font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: 8px; }
.mini-cart, .order-items { list-style: none; padding: 0; margin: 0 0 16px; }
.mini-cart li, .order-items li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-cart li span, .order-items li > span { flex: 1; }
.mini-cart img, .order-items img { border-radius: 6px; object-fit: cover; }
.payment label { position: relative; }
.card-brand { position: absolute; right: 12px; top: 38px; font-size: 0.8rem; font-weight: 800; color: var(--muted); }
.test-cards { background: #f9fafb; border-radius: 10px; padding: 10px 14px; }
.test-cards summary { cursor: pointer; font-weight: 700; }
.confirmation { text-align: center; margin: 10px 0 30px; }
.confirm-icon { font-size: 3rem; }

/* Auth & account */
.auth-card { max-width: 440px; margin: 20px auto; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.9rem; }
.auth-row label { margin: 0; }
.demo-mailbox { background: #fffbeb; border: 1px dashed var(--sun); border-radius: 10px; padding: 12px; word-break: break-all; margin-bottom: 14px; }
.account-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.account-nav { display: flex; flex-direction: column; gap: 4px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.account-nav a, .account-nav .link-button { padding: 8px 10px; border-radius: 8px; color: var(--ink); text-align: left; }
.account-nav a.active { background: #ecfdf3; color: var(--green-dark); font-weight: 800; }
.narrow { max-width: 520px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; margin: 0; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.stat strong { font-size: 1.8rem; }
.address-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.address-grid .card { margin: 0; }
address { font-style: normal; margin: 6px 0; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { font-size: 0.8rem; text-transform: uppercase; color: var(--muted); }
.data-table tr.inactive { opacity: 0.5; }
.status { padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: #f3f4f6; text-transform: capitalize; }
.status-paid, .status-delivered { background: #dcfce7; color: #166534; }
.status-processing, .status-shipped { background: #e0f2fe; color: #075985; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.wish-item { display: flex; gap: 16px; align-items: center; }
.wish-item img { border-radius: 8px; object-fit: cover; }
.contact-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.prose { max-width: 860px; }
.prose h2 { margin-top: 1.4em; font-size: 1.2rem; }

/* Admin */
.admin-nav { display: flex; gap: 18px; align-items: center; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius); margin-bottom: 22px; }
.admin-nav a { color: #d1d5db; font-weight: 600; }
.admin-nav a.active { color: var(--sun); }
.admin-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.admin-form { max-width: 860px; }
.form-actions { display: flex; gap: 16px; align-items: center; }
.filter-chips { display: flex; gap: 8px; margin-bottom: 14px; }
.filter-chips a { padding: 5px 14px; background: #fff; border-radius: 999px; box-shadow: var(--shadow); color: var(--ink); text-transform: capitalize; }
.filter-chips a.active { background: var(--green); color: #fff; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.inline-form label { margin: 0; flex: 1; }

/* Footer */
.site-footer { background: #1f2933; color: #d1d5db; padding-top: 40px; }
.site-footer a { color: #fff; }
.site-footer h4 { color: #fff; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 30px; padding-bottom: 30px; }
.logo-footer { color: #fff; }
.social { display: flex; gap: 14px; margin-top: 14px; }
.social a { background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 9px; display: inline-flex; }
.social a:hover { background: var(--green); }
.newsletter { display: flex; gap: 6px; }
.newsletter input { margin: 0; }
.newsletter button { background: var(--sun); border: 0; border-radius: 10px; padding: 0 14px; font: inherit; font-weight: 800; cursor: pointer; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 16px; padding-bottom: 22px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 0.85rem; }

@media (max-width: 900px) {
  .header-row { flex-wrap: wrap; }
  .search-form { order: 3; max-width: none; flex-basis: 100%; }
  .hero, .product-detail, .cart-layout, .checkout-layout, .account-layout, .contact-layout, .admin-grid { grid-template-columns: 1fr; }
  .hero { padding: 28px; }
  .hero h1 { font-size: 2rem; }
  .hero-art { display: none; }
  .promise, .footer-grid { grid-template-columns: 1fr 1fr; }
  .summary { position: static; }
  .row3 { grid-template-columns: 1fr 1fr; }
}
