:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2118;
  --muted: #7a6a5a;
  --line: #e7ddd0;
  --wood: #8a5a2b;
  --wood-dark: #6b4420;
  --ok: #2f7a45;
  --danger: #b3362b;
  --xmas: #1e6b3c;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
a { color: var(--wood-dark); }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 1.05rem; margin: 28px 0 10px; }
.muted { color: var(--muted); font-size: .92rem; }
.warn { color: var(--danger); font-size: .9rem; }

.promo { background: var(--xmas); color: #fff; text-align: center; padding: 8px 16px; font-size: .95rem; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, serif; font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand img { flex: none; }
@media (max-width: 480px) { .brand { font-size: 1.1rem; } .brand img { width: 32px; height: 32px; } }
.tag { font-family: ui-sans-serif, system-ui, sans-serif; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; background: var(--ink); color: #fff; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
nav { display: flex; align-items: center; gap: 18px; }
nav a { text-decoration: none; color: var(--ink); }
nav a:hover { color: var(--wood); }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--wood); color: #fff; font-size: .8rem; text-align: center; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 18px 0; }
.flash { background: #fff4dc; border: 1px solid #f0d9a5; padding: 10px 14px; border-radius: var(--radius); }

.btn { display: inline-block; font: inherit; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--wood); }
.btn.primary { background: var(--wood); border-color: var(--wood); color: #fff; }
.btn.primary:hover { background: var(--wood-dark); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.danger { color: var(--danger); border-color: #e8c2be; }
.btn:disabled { opacity: .4; cursor: default; }
button.link { background: none; border: none; padding: 0; font: inherit; color: var(--wood-dark); text-decoration: underline; cursor: pointer; }
form.inline { display: inline; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }

/* shop grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(60, 40, 20, .08); }
.card a { text-decoration: none; color: inherit; display: block; }
.thumb { position: relative; aspect-ratio: 4 / 5; background: #efe7dc; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.soldout img { filter: grayscale(.7); opacity: .75; }
.ribbon { position: absolute; top: 12px; left: 12px; background: var(--ink); color: #fff; font-size: .8rem; padding: 3px 8px; border-radius: 4px; }
.card-body { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.name { font-weight: 600; }
.price { color: var(--wood-dark); font-weight: 600; white-space: nowrap; }
.price.big { font-size: 1.6rem; margin: 0 0 20px; }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: .9rem; }
.noimg.big { aspect-ratio: 4 / 5; background: #efe7dc; border-radius: var(--radius); }
.empty { text-align: center; padding: 60px 0; }
.back { display: inline-block; margin-bottom: 16px; text-decoration: none; }

/* product page */
.product { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; align-items: start; }
@media (max-width: 760px) { .product { grid-template-columns: 1fr; gap: 20px; } }
.buy form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.soldout-msg { font-size: 1.2rem; color: var(--muted); }
.carousel { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; border-radius: var(--radius); background: #efe7dc; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: 0 0 100%; width: 100%; aspect-ratio: 4 / 5; object-fit: contain; scroll-snap-align: center; }
.carousel .nav { position: absolute; top: calc(50% - 60px); width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255,255,255,.85); font-size: 1.8rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.carousel .prev { left: 10px; }
.carousel .next { right: 10px; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: none; opacity: .6; }
.thumbs button.on { border-color: var(--wood); opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tfoot td { border-bottom: none; font-weight: 600; }
.num { text-align: right; }
.total { font-size: 1.1rem; }
.thumbcell { width: 64px; }
.thumbcell img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }
.qty { width: 72px; }
.cart .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
@media (max-width: 640px) { th:nth-child(3), td:nth-child(3) { display: none; } }

/* admin */
.headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.headrow h1 { margin: 0; }
.stats { margin: 4px 0 16px; }
.tabs { display: flex; gap: 6px; }
.tabs a { padding: 6px 12px; border-radius: 20px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
table.orders tbody tr { cursor: pointer; }
table.orders tbody tr:hover { background: #fbf8f4; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 10px; background: #f3e9d9; color: var(--wood-dark); margin: 1px 0; }
.pill.ok { background: #e2f1e6; color: var(--ok); }
.pill.xmas { background: var(--xmas); color: #fff; }
.xmas-box { background: #e7f3ea; border: 1px solid #b9dcc3; padding: 12px 14px; border-radius: var(--radius); color: var(--xmas); }
.promo-note { color: var(--xmas); font-weight: 600; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
address.copy { white-space: pre-line; font-style: normal; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; user-select: all; }
.newprod, .editprod { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; }
.newprod h2 { width: 100%; margin: 0; }
.editprod input[name=name] { min-width: 260px; }
.stock { display: flex; gap: 6px; align-items: center; }
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.pics figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pics img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pics figcaption { display: flex; justify-content: space-between; gap: 4px; padding: 8px; }
.upload { display: flex; align-items: center; gap: 12px; }
.login { max-width: 340px; margin: 40px auto; display: flex; flex-direction: column; gap: 14px; }
