:root {
  --bg: #f3f8ff;
  --bg2: #e6f0ff;
  --surface: #ffffff;
  --ink: #0e1a2f;
  --muted: #5b6b85;
  --line: #d9e5f7;
  --brand: #2f62e8;
  --brand-dark: #214ec4;
  --brand-soft: #e3ecff;
  --danger: #d03e3e;
  --danger-soft: #fdeaea;
  --ok: #19925f;
  --ok-soft: #e1f6ec;
  --warn-soft: #fff4d6;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(47, 98, 232, .10);
  --shadow-sm: 0 2px 10px rgba(47, 98, 232, .08);
  --serif: Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  background-image: linear-gradient(180deg, #f8fbff 0%, #eaf2ff 55%, #e3eeff 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
:focus-visible { outline: 3px solid rgba(47, 98, 232, .45); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- topo ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(248, 251, 255, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px 18px; align-items: center;
}
.logo { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; font-style: italic; letter-spacing: -.02em; }
.logo span { color: var(--brand); }
.search {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 16px; box-shadow: var(--shadow-sm);
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { border: 0; background: transparent; width: 100%; padding: 11px 10px; outline: none; min-width: 0; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 98, 232, .15); }
.actions { display: flex; align-items: center; gap: 4px; }
.ico-btn {
  position: relative; width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 50%; transition: background .15s;
}
.ico-btn:hover { background: var(--brand-soft); }
.ico-btn svg { width: 23px; height: 23px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute; top: 2px; right: 0; min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--brand); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #f8fbff;
}
.acct { position: relative; }
.acct summary { list-style: none; }
.acct summary::-webkit-details-marker { display: none; }
.acct-menu {
  position: absolute; right: 0; top: 48px; min-width: 210px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 40;
}
.acct-menu .who { padding: 8px 12px; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; word-break: break-all; }
.acct-menu a, .acct-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 10px;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--brand-soft); }

@media (max-width: 720px) {
  .top-in { grid-template-columns: 1fr auto; padding: 8px 12px 10px; }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .logo { font-size: 1.5rem; }
}

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 22px 16px 56px; outline: none; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 26px 16px calc(26px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.page-title { font-size: clamp(1.6rem, 4vw, 2.3rem); margin-bottom: 6px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 600;
  background: var(--brand); color: #fff; transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(47, 98, 232, .28); min-height: 46px;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; border-color: #f4c9c9; }
.btn.danger:hover { background: #fbd8d8; }
.btn.sm { padding: 7px 14px; min-height: 36px; font-size: .88rem; }
.btn.block { width: 100%; }

label.field { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: #26344f; }
.input, label.field input, label.field select, label.field textarea, .mp-field, #form-checkout select, #form-checkout input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff;
  font-weight: 400; min-height: 46px;
}
label.field textarea { min-height: 96px; resize: vertical; }
label.field input:focus, label.field select:focus, label.field textarea:focus, .input:focus, #form-checkout input:focus, #form-checkout select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 98, 232, .15); background: #fff;
}
.mp-field { height: 46px; padding: 0; overflow: hidden; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-size: .92rem; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; }

/* ---------- hero e categorias ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: clamp(26px, 5vw, 54px);
  background: radial-gradient(120% 140% at 100% 0%, #7fb0ff 0%, rgba(127, 176, 255, 0) 55%), linear-gradient(135deg, #2f62e8 0%, #4a86f5 100%);
  color: #fff; margin-bottom: 26px; box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); max-width: 14ch; }
.hero p { max-width: 42ch; margin: 12px 0 22px; opacity: .92; font-size: clamp(.98rem, 2vw, 1.1rem); }
.hero .btn { background: #fff; color: var(--brand-dark); box-shadow: none; position: relative; z-index: 1; }
.hero .btn:hover { background: #eef4ff; }
.pay-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; z-index: 1; }
.pay-chips span { background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; margin-bottom: 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .9rem; font-weight: 600; color: #34445f; white-space: nowrap;
}
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 16px; flex-wrap: wrap; }
.toolbar select { padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }

/* ---------- grade de produtos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; } }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-img { aspect-ratio: 4 / 5; background: var(--bg2); display: block; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-img img { transform: scale(1.04); }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: #8fa6cf; background: linear-gradient(160deg, #e7f0ff, #d6e5ff); }
.noimg svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.heart {
  position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.heart svg { width: 20px; height: 20px; fill: none; stroke: #43557a; stroke-width: 2; stroke-linejoin: round; transition: transform .15s; }
.heart:hover svg { transform: scale(1.12); }
.heart.on svg { fill: #e5484d; stroke: #e5484d; }
.card-body { padding: 12px 14px 14px; display: grid; gap: 3px; flex: 1; align-content: start; }
.cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); font-weight: 700; }
.card .title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 800; font-size: 1.12rem; margin-top: 4px; }
.by { font-size: .8rem; color: var(--muted); }
.by:hover { color: var(--brand); }
.card .manage { padding: 0 14px 14px; }
.soldout { position: absolute; left: 10px; top: 10px; background: #0e1a2fcc; color: #fff; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, #e4eefc 25%, #f1f6ff 37%, #e4eefc 63%); background-size: 400% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); aspect-ratio: 4 / 6; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- produto ---------- */
.pdp { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 820px) { .pdp { grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: start; } }
.pdp-img { border-radius: 24px; overflow: hidden; background: var(--bg2); aspect-ratio: 4 / 5; border: 1px solid var(--line); }
.pdp-img img { width: 100%; height: 100%; object-fit: cover; }
.pdp h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 6px 0 10px; }
.pdp .big { font-size: 2rem; font-weight: 800; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-width: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; text-align: center; user-select: none;
}
.pill:hover { border-color: var(--brand); }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.qty button { width: 38px; height: 38px; border: 0; background: none; font-size: 1.2rem; border-radius: 50%; }
.qty button:hover { background: var(--brand-soft); }
.qty span { min-width: 28px; text-align: center; font-weight: 700; }
.perks { display: grid; gap: 8px; margin-top: 20px; font-size: .92rem; color: #34445f; }
.perks div { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.back { display: inline-flex; gap: 6px; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.back:hover { color: var(--brand); }

/* ---------- vitrines ---------- */
.vit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.vit-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .18s, box-shadow .18s; }
.vit-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.vit-cover { aspect-ratio: 16 / 10; background: var(--bg2); }
.vit-cover img { width: 100%; height: 100%; object-fit: cover; }
.vit-card .body { padding: 14px 16px 16px; }
.vit-card h3 { font-size: 1.15rem; }
.vit-head { background: linear-gradient(135deg, #fff, #e8f1ff); border: 1px solid var(--line); border-radius: 24px; padding: clamp(18px, 4vw, 32px); margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.tag { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }

.admin-layout { display: grid; gap: 22px; }
@media (min-width: 960px) { .admin-layout { grid-template-columns: 380px 1fr; align-items: start; } .admin-layout .sticky { position: sticky; top: 130px; } }
.upload {
  display: grid; place-items: center; gap: 6px; border: 2px dashed #b8cdf0; border-radius: 14px; padding: 18px; text-align: center;
  background: #f6faff; cursor: pointer; color: var(--muted); min-height: 150px; overflow: hidden; position: relative;
}
.upload:hover { border-color: var(--brand); }
.upload img { max-height: 220px; border-radius: 10px; object-fit: contain; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- carrinho (gaveta) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(14, 26, 47, .45); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #f8fbff; z-index: 60;
  transform: translateX(100%); transition: transform .28s ease; display: flex; flex-direction: column;
  box-shadow: -10px 0 40px rgba(14, 26, 47, .18); padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.4rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; display: grid; gap: 12px; align-content: start; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--line); background: #fff; display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.line .thumb { width: 72px; height: 90px; border-radius: 10px; overflow: hidden; background: var(--bg2); }
.line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.line .t { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.line .m { font-size: .82rem; color: var(--muted); }
.line .qty { transform: scale(.88); transform-origin: left center; margin-top: 4px; }
.line .rm { border: 0; background: none; color: var(--muted); font-size: 1.3rem; align-self: start; width: 32px; height: 32px; border-radius: 50%; }
.line .rm:hover { background: var(--danger-soft); color: var(--danger); }
.total-row { display: flex; justify-content: space-between; font-size: 1.15rem; font-weight: 800; }

/* ---------- checkout / pedidos ---------- */
.checkout { display: grid; gap: 22px; }
@media (min-width: 900px) { .checkout { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--bg2); padding: 5px; border-radius: 14px; }
.tabs button { border: 0; background: transparent; padding: 12px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.sum-line { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; padding: 6px 0; }
.pix-box { text-align: center; display: grid; gap: 14px; justify-items: center; }
.pix-box img { width: min(260px, 70vw); border: 8px solid #fff; border-radius: 16px; box-shadow: var(--shadow); }
.pix-code { width: 100%; font-family: ui-monospace, monospace; font-size: .78rem; padding: 10px; border: 1px dashed #b8cdf0; border-radius: 10px; background: #f6faff; word-break: break-all; max-height: 82px; overflow: auto; text-align: left; }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.status.paid { background: var(--ok-soft); color: var(--ok); }
.status.pending { background: var(--warn-soft); color: #8a6100; }
.status.failed, .status.refunded { background: var(--danger-soft); color: var(--danger); }
.order { display: grid; gap: 10px; }
.ok-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 10px; }
.auth { max-width: 440px; margin: 20px auto; }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(47, 98, 232, .25); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); animation: up .25s ease; font-size: .95rem; }
.toast.err { background: var(--danger); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
