:root {
  --rose: #9a3d4f;
  --rose-deep: #6e2c3a;
  --ink: #2a2422;
  --muted: #6f655f;
  --cream: #f7f1ea;
  --paper: #fffdf8;
  --line: #e6d9ce;
  --foliage: #2c4a3e;
  --blush: #f3e4e7;
  --shadow: 0 18px 50px rgba(80, 40, 45, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
  letter-spacing: 0.01em;
}
.bg-wash {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(154, 61, 79, 0.12), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(44, 74, 62, 0.08), transparent 55%);
}
header.top, main, .drawer, .modal { position: relative; z-index: 1; }

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--cream) 86%, white);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blush); color: var(--rose);
  flex: none;
}
.eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; margin: 0; }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.1; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.balance-pill, .ghost, .cart-btn, .primary, .secondary, .link-btn {
  font: inherit; cursor: pointer; border: 0;
}
.balance-pill {
  display: flex; flex-direction: column; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 6px 12px; line-height: 1.15; box-shadow: 0 4px 14px rgba(42,36,34,.05);
}
.balance-pill span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--foliage); }
.balance-pill strong { font-size: 15px; color: var(--rose-deep); }
.ghost, .secondary {
  background: transparent; color: var(--rose-deep);
  border: 1px solid color-mix(in srgb, var(--rose) 35%, var(--line));
  border-radius: 999px; padding: 8px 14px; font-size: 13px;
}
.cart-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
}
.badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--rose); color: white; min-width: 18px; height: 18px;
  border-radius: 99px; font-size: 11px; display: grid; place-items: center; padding: 0 4px;
}
main { width: min(1120px, calc(100% - 32px)); margin: 0 auto 80px; }
.hero { padding: 28px 0 10px; max-width: 720px; }
.banner {
  display: none; margin: 0 0 14px; padding: 12px 16px;
  background: var(--blush); border-radius: 14px; color: var(--rose-deep); font-size: 14px;
}
.banner.show { display: block; }
.welcome { margin: 0; font-size: 1.15rem; color: var(--muted); font-weight: 300; line-height: 1.5; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  padding-top: 22px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 22px 40px rgba(80,40,45,.14); }
.card-art {
  height: 200px; display: grid; place-items: center;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rose) 10%, #f6ece4), #efe4da);
}
.card-art img { width: 100%; height: 200px; object-fit: cover; display: block; }
.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 1.45rem; }
.card-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; flex: 1; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.price { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.5rem; color: var(--rose-deep); }
.stock { font-size: 12px; color: var(--foliage); }
.primary, .link-btn {
  background: var(--rose); color: #fff; border-radius: 999px;
  padding: 12px 16px; font-size: 14px; font-weight: 500; text-align: center;
  text-decoration: none; display: inline-block;
}
.primary:disabled { opacity: .5; cursor: not-allowed; }
.card .primary { width: 100%; }

.drawer[hidden], .modal[hidden] { display: none; }
.drawer, .modal { position: fixed; inset: 0; z-index: 20; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(42,36,34,.38); }
.drawer-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: min(420px, 100%);
  background: var(--paper); box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding: 18px 18px 24px;
}
.drawer-panel header, .modal-card { position: relative; }
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; }
.icon-x {
  border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted);
}
.cart-lines { overflow: auto; flex: 1; margin: 12px 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.cart-foot { display: flex; flex-direction: column; gap: 10px; }
.totals p { margin: 4px 0; display: flex; justify-content: space-between; font-size: 14px; }
.gap { color: var(--rose-deep) !important; font-weight: 500; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.modal { display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: min(460px, 100%);
  background: var(--paper); border-radius: 24px; padding: 28px 22px 22px;
  box-shadow: var(--shadow); z-index: 2;
}
.modal-card.narrow { width: min(400px, 100%); }
.modal-card .icon-x { position: absolute; top: 10px; right: 12px; }
.amount-form label { display: block; font-size: 13px; color: var(--muted); }
.amount-form input {
  width: 100%; margin-top: 6px; margin-bottom: 10px; font: inherit; font-size: 18px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
}
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit;
}
.qr-wrap { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 12px; border: 1px solid var(--line); }
.qr-wrap svg, .qr-wrap img { width: min(240px, 70vw); height: auto; }
.status-line { text-align: center; font-weight: 500; color: var(--foliage); }
.status-line.pending { color: var(--muted); }
.status-line.ok { color: var(--foliage); }
.mono { font-size: 11px; word-break: break-all; color: var(--muted); background: var(--cream); padding: 8px; border-radius: 10px; }
.ledger { margin-top: 10px; font-size: 13px; }
.ledger p { margin: 6px 0; }
.empty { color: var(--muted); text-align: center; padding: 20px 8px; }

@media (max-width: 720px) {
  header.top { padding: 12px; flex-wrap: wrap; }
  .ghost { padding: 8px 10px; font-size: 12px; }
  h1 { font-size: 1.35rem; }
  .balance-pill strong { font-size: 14px; }
}
