:root {
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --plum: #5f2833;
  --plum-dark: #3f1a22;
  --rose: #c25b6c;
  --line: #ecd8d8;
  --line-soft: #f1e5e3;
  --blush: #f3dcd8;
  --ground: #faf6f5;
  --card: #ffffff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: Montserrat, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--plum); }
button { font-family: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-size: 15px; font-weight: 600; letter-spacing: 3px; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; gap: 14px; }
.topbar nav a, .topbar nav button { font-size: 12px; font-weight: 600; color: var(--plum); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }

.app { max-width: 480px; margin: 0 auto; padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 14px; }

/* ---- type ---- */
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--plum); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.small { font-size: 11px; color: var(--muted); }
.nudge { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.link { font-size: 11px; font-weight: 600; color: var(--plum); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.section { display: flex; flex-direction: column; gap: 10px; }

/* ---- cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card--pad { padding: 12px; }
.list > * { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.list > *:last-child { border-bottom: 0; }
.thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--blush); object-fit: contain; flex: none; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.title { font-size: 12px; font-weight: 600; line-height: 1.3; }
.price { font-size: 12px; font-weight: 600; }

/* ---- hero ---- */
.hero { background: var(--plum); color: #fff; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hero .eyebrow { color: #fff; opacity: .8; font-size: 11px; }
.hero h1 { margin: 0; font-size: 20px; font-weight: 700; }
.hero .pill { background: rgba(255,255,255,.16); border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.hero .meta { display: flex; gap: 8px; font-size: 12px; opacity: .9; flex-wrap: wrap; }
.hero .note { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border-radius: 8px; padding: 8px 10px; font-size: 11px; }
.hero--paused { background: #8a7a78; }
.hero--failed { background: #a33a3a; }

/* ---- gift grid ---- */
.gifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gift { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.gift .img { height: 120px; border-radius: 8px; background: var(--blush); object-fit: contain; width: 100%; }
.was { color: var(--muted); font-size: 11px; }
.was s { margin-right: 4px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; border: 1.5px solid var(--plum); background: var(--card); color: var(--plum); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--plum); color: #fff; border-color: var(--plum); border-radius: 999px; min-height: 52px; font-size: 15px; }
.btn--primary:hover { background: var(--plum-dark); }
.btn--ghost { border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn--danger { border-color: var(--line); color: var(--muted); font-weight: 600; }
.btn--sm { min-height: 40px; font-size: 12px; }
.btn--block { width: 100%; }

/* ---- new strip ---- */
.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.strip a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.strip .img { position: relative; height: 84px; border-radius: 8px; background: var(--blush); object-fit: contain; width: 100%; }
.badge { position: absolute; top: 6px; left: 6px; background: var(--rose); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 999px; }
.strip .t { font-size: 11px; font-weight: 600; line-height: 1.3; }

/* ---- manage tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { min-height: 64px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px; text-align: center; }
.tile svg { stroke: var(--plum); }
.tile--muted { color: var(--muted); }
.tile--muted svg { stroke: #8a7a78; }

/* ---- swap screen ---- */
.subhead { display: flex; align-items: center; gap: 10px; }
.back { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; flex: none; }
.subhead h1 { margin: 0; font-size: 15px; font-weight: 700; }
.counter { background: var(--plum); color: #fff; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--plum); background: var(--plum); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-bottom: 110px; }
.opt { position: relative; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.opt[aria-pressed="true"] { border: 2px solid var(--plum); padding: 7px; }
.opt .img { height: 118px; border-radius: 8px; background: var(--blush); object-fit: contain; width: 100%; }
.opt .tick { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--plum); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.opt .badge { top: 14px; left: 14px; }
.opt .current { font-size: 10px; font-weight: 700; color: var(--plum); text-transform: uppercase; letter-spacing: .4px; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.savebar > * { max-width: 444px; margin: 0 auto; width: 100%; }
.savebar .small { text-align: center; }

/* ---- forms & dialogs ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; }
.input { min-height: 46px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 15px; font-family: inherit; background: var(--card); color: var(--ink); width: 100%; }
.input:focus { outline: 2px solid var(--plum); outline-offset: 1px; border-color: var(--plum); }
.input--code { letter-spacing: 8px; text-align: center; font-size: 22px; font-weight: 700; }
.error { font-size: 12px; color: #a33a3a; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(92vw, 420px); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(26,26,26,.45); }
.dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0; font-size: 16px; }
.dlg p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.dlg .actions { display: flex; gap: 8px; }
.dlg .actions .btn { flex: 1; }
.radio { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; }
.radio input { accent-color: var(--plum); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 12px; font-weight: 600; z-index: 50; max-width: 90vw; text-align: center; }
.center { text-align: center; }
.login { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; }
.login h1 { margin: 0; font-size: 20px; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, #f1e5e3, #faf6f5, #f1e5e3); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ---- retention offer ---- */
.link--muted { color: var(--muted); font-size: 12px; text-align: center; flex: 1; }

/* ---- admin view-as banner ---- */
.viewbar { position: sticky; top: 49px; z-index: 9; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px; background: #fff4d6; color: #5a4300; border-bottom: 1px solid #f0d58a; font-size: 12px; }
.viewbar .link { color: #5a4300; text-decoration: underline; }

/* ---- free product not yet chosen ---- */
.gift--empty { text-decoration: none; color: var(--ink); border-style: dashed; }
.img--empty { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.gift--empty .btn { pointer-events: none; }

/* ---- savings line ---- */
.note--value { background: rgba(255,255,255,.12); }
