:root {
  --bg: #fbf6ef; --card: #fff; --ink: #3b2a1e; --muted: #7a6656; --line: #eadfd2;
  --brand: #7a4b2a; --brand-dark: #5e3820; --accent: #d98e3f; --soft: #f3e9dc;
  --ok: #2f7d4f; --warn: #b5651d; --bad: #b3261e; --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); }
h1, h2, h3, .logo { font-family: var(--serif); line-height: 1.2; color: var(--brand-dark); }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .4em 0 .5em; }
h2 { font-size: 1.5rem; margin: 1.4em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1em 0 .4em; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { min-height: 60vh; padding-bottom: 48px; }
.narrow { max-width: 720px; margin: 0 auto; }
.narrow-sm { max-width: 440px; margin: 0 auto; }
.narrow-form { max-width: 680px; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.dim { opacity: .5; }
.inline { display: inline; }
.danger { color: var(--bad) !important; }

/* Header */
.announce { background: var(--brand-dark); color: #fff; text-align: center; padding: 6px 12px; font-size: .9rem; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.logo { font-size: 1.5rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav-links a { text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--ink); }
.nav-links a:hover, .nav-links a.active { background: var(--soft); }
.cart-link { background: var(--brand); color: #fff !important; }
.cart-link:hover { background: var(--brand-dark) !important; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .8rem; margin-left: 2px; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--ink); }
.cutoff { background: var(--soft); text-align: center; font-size: .9rem; padding: 7px 12px; color: var(--brand-dark); }
.cutoff.closed { background: #fde7e4; color: var(--bad); }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--card); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; border-bottom: 1px solid var(--line); }
  .nav-links.open { display: flex; }
}

/* Buttons & forms */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: 600 1rem var(--sans); cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-ghost:hover { background: var(--soft); }
.link { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px 0; }
label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check.inline { display: inline-flex; margin-right: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: 400 1rem var(--sans); background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #d98e3f33; }
input[type=checkbox], input[type=radio] { width: auto; display: inline-block; margin: 0; accent-color: var(--brand); }
input:disabled { background: var(--soft); }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; }
.row2, .row3 { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 640px) { .row2, .row3 { grid-template-columns: 1fr; } }
.inline-form { display: flex; gap: 8px; margin: 8px 0; }
.inline-form input { margin: 0; }
.code-input { font-size: 1.8rem; letter-spacing: .4em; text-align: center; font-family: ui-monospace, monospace; }
.actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.filters input, .filters select { width: auto; margin: 0; }
.filters .check { margin: 0; }

/* Flash & notices */
.flash { padding: 12px 16px; border-radius: 10px; margin: 16px 0; }
.flash-success { background: #e3f3e8; color: var(--ok); }
.flash-error { background: #fde7e4; color: var(--bad); }
.flash-info { background: var(--soft); color: var(--brand-dark); }
.notice { background: #fff6e8; border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; }

/* Hero */
.hero { padding: 56px 0 24px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin-top: 0; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }

/* Cards & grid */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px #3b2a1e14, 0 6px 20px #3b2a1e0a; padding: 20px; margin-bottom: 16px; color: inherit; }
a.card { text-decoration: none; display: block; transition: transform .15s, box-shadow .15s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 4px 10px #3b2a1e1c, 0 12px 30px #3b2a1e14; }
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.product-card, .grid > a.card { padding: 0; overflow: hidden; margin: 0; }
.card-img { position: relative; aspect-ratio: 1; background: var(--soft); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 16px 16px; }
.card-body h3 { margin: 0 0 4px; }
.card-body p { margin: 0 0 8px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.price { font-weight: 700; color: var(--brand-dark); }
.price-lg { font-size: 1.6rem; margin: 4px 0 12px; }
.tag { position: absolute; top: 10px; left: 10px; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; }
.tag-sold { background: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.stars { color: var(--accent); letter-spacing: 1px; }
.quote { margin: 0; }
.quote p { font-family: var(--serif); font-size: 1.1rem; }

/* Product page */
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 800px) { .product { grid-template-columns: 1fr; gap: 16px; } }
.gallery-main { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--soft); }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumb { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; width: 72px; height: 72px; background: none; }
.thumb:hover, .thumb:focus { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.buy-box { background: var(--card); padding: 18px; border-radius: var(--radius); box-shadow: 0 1px 3px #3b2a1e14; margin: 16px 0; }
.allergens { background: var(--soft); padding: 8px 12px; border-radius: 8px; }
.prose { font-size: 1.05rem; }
.prose img { border-radius: 10px; margin: 16px 0; }
.cover { width: 100%; border-radius: var(--radius); margin: 16px 0; max-height: 480px; object-fit: cover; }
.reviews { margin-top: 40px; }
.review .reply { background: var(--soft); padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.verified { color: var(--ok); }
.review-form { max-width: 640px; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input legend { width: 100%; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 2rem; color: var(--line); cursor: pointer; margin: 0; font-weight: 400; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--accent); }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: var(--soft); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table td.right, .table th.right { text-align: right; }
.card .table { box-shadow: none; }
.table-scroll { overflow-x: auto; }
@media (max-width: 640px) { .table { font-size: .9rem; } .table th, .table td { padding: 8px 6px; } }

/* Cart & checkout */
.date-pick select { max-width: 360px; }
.cart-item { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; font-weight: 600; }
.cart-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.qty { width: 72px; margin: 0; }
.has-problem td { background: #fff6f4; }
.problem { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.totals { max-width: 340px; margin-left: auto; }
.totals > div, .sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.grand { font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px !important; }
.checkout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.summary { position: sticky; top: 84px; }
@media (max-width: 860px) { .checkout { grid-template-columns: 1fr; } .summary { position: static; } }
.pay-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 400; cursor: pointer; }
.pay-option:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.pay-option input { margin-top: 5px; }

/* Account */
.order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .order-grid { grid-template-columns: 1fr; } }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--soft); color: var(--brand-dark); white-space: nowrap; }
.status-paid, .status-confirmed { background: #e3f3e8; color: var(--ok); }
.status-baking { background: #fff1dc; color: var(--warn); }
.status-out_for_delivery { background: #e4eefb; color: #2056a8; }
.status-delivered { background: #e3f3e8; color: var(--ok); }
.status-cancelled, .status-expired, .status-refunded { background: #eee; color: #777; }
.status-pending_payment { background: #fff6e8; color: var(--warn); }
.progress { display: flex; list-style: none; padding: 0; margin: 20px 0; counter-reset: step; }
.progress li { flex: 1; text-align: center; font-size: .85rem; color: var(--muted); position: relative; padding-top: 30px; }
.progress li::before { content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--line); z-index: 1; }
.progress li::after { content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.progress li:first-child::after { display: none; }
.progress li.done { color: var(--brand-dark); font-weight: 600; }
.progress li.done::before, .progress li.done::after { background: var(--brand); }
.timeline { list-style: none; padding: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.facts li { margin-bottom: 8px; }

/* Blog */
.post-list { display: grid; gap: 16px; }
.post-row { display: grid !important; grid-template-columns: 200px 1fr; padding: 0 !important; overflow: hidden; }
.post-row img { width: 100%; height: 100%; object-fit: cover; }
.post-row h2 { margin: 0 0 4px; }
@media (max-width: 600px) { .post-row { grid-template-columns: 1fr; } .post-row img { height: 200px; } }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); padding: 36px 0 20px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1.2fr .8fr; gap: 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.copyright { margin-top: 20px; }

/* Admin */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 14px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.admin-nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--ink); font-size: .92rem; }
.admin-nav a.active, .admin-nav a:hover { background: var(--brand); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px #3b2a1e14; color: var(--muted); text-decoration: none; font-size: .9rem; }
.stat span { display: block; font: 700 1.7rem var(--serif); color: var(--brand-dark); }
.stat.warn span { color: var(--bad); }
.setup { border-left: 4px solid var(--accent); }
.setup ul { list-style: none; padding: 0; }
.mini { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.mini-lg { width: 160px; border-radius: 8px; }
.admin-form h3 { border-top: 1px solid var(--line); padding-top: 16px; }
.img-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.img-edit-item { background: var(--soft); padding: 10px; border-radius: 10px; }
.img-edit-item img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; margin-bottom: 8px; width: 100%; }
.inv td, .inv th { text-align: center; min-width: 74px; }
.inv td:first-child, .inv th:first-child { text-align: left; min-width: 160px; }
.inv-input { width: 64px; margin: 0 auto; padding: 6px; text-align: center; }
.delivery-card { display: grid; grid-template-columns: auto 1fr 220px; gap: 16px; align-items: start; padding: 14px 18px; }
@media (max-width: 700px) { .delivery-card { grid-template-columns: auto 1fr; } .delivery-card > :last-child { grid-column: 2; } }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.review-actions label { flex: 1 1 260px; margin: 0; }
.pick-list { columns: 2; margin-bottom: 14px; }
.print-only { display: none; }

@media print {
  .site-header, .site-footer, .admin-nav, .no-print, .announce, .cutoff, .flash { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
