/* Oak House Farm Rewards — styles
   Colours taken from the Oak House Farm logo. */
:root {
  --green: #3a7a26;
  --green-dark: #2b5d1c;
  --green-deep: #1f4614;
  --green-soft: #e8f1e3;
  --cream: #f8f5ee;
  --paper: #ffffff;
  --ink: #1f2a1a;
  --muted: #5f6b58;
  --line: #dfe5d8;
  --gold: #c8962e;
  --danger: #b3261e;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(31, 70, 20, 0.10);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 800; color: var(--green-deep); margin: 0 0 .4em; line-height: 1.15; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { line-height: 1.55; margin: 0 0 .8em; }
a { color: var(--green); }
strong { font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---------- Header ---------- */
.app-header {
  background: var(--green);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 20px 16px;
  position: relative;
  overflow: hidden;
}

.header-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 14px; position: relative; z-index: 1; }
.header-logo { width: 168px; height: auto; display: block; }
@media (max-width: 360px) { .header-logo { width: 140px; } }
.header-inner .header-badge { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.brand-name { font-family: var(--serif); font-weight: 900; font-size: 1.6rem; line-height: 1; }
.brand-tag { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .9; margin-top: 6px; }
.header-badge { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); padding: 5px 10px; border-radius: 99px; white-space: nowrap; }

.demo-banner { background: #fff6dd; color: #6b4e00; border-bottom: 1px solid #f0dca0; font-size: .82rem; padding: 8px 16px; text-align: center; }
.demo-banner button { font: inherit; font-weight: 600; background: none; border: 0; color: #6b4e00; text-decoration: underline; cursor: pointer; padding: 0 4px; }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 22px 16px calc(env(safe-area-inset-bottom) + 40px); }
main.wide { max-width: 860px; }
.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px; margin-bottom: 18px; border: 1px solid var(--line);
}
.card.flat { box-shadow: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

/* ---------- Forms & buttons ---------- */
label { display: block; font-size: .85rem; font-weight: 500; margin: 12px 0 6px; color: var(--green-deep); }
input, textarea, select {
  width: 100%; font: inherit; font-weight: 400; font-size: 16px; /* 16px stops iOS zoom */
  padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(58,122,38,.15); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: 1rem; letter-spacing: .02em;
  padding: 14px 20px; border-radius: 99px; border: 2px solid var(--green);
  background: var(--green); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.block { width: 100%; }
.btn.outline { background: transparent; color: var(--green); }
.btn.outline:hover { background: var(--green-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green); padding: 10px 12px; }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: #fbeceb; }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.big { font-size: 1.15rem; padding: 18px 22px; }
.btn.small { font-size: .85rem; padding: 8px 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }
.error { color: var(--danger); font-size: .9rem; margin-top: 10px; min-height: 1em; }

.tabs { display: flex; background: var(--green-soft); border-radius: 99px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--green-deep); padding: 10px; border-radius: 99px; cursor: pointer; }
.tabs button.active { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ---------- Stamp card ---------- */
.stamp-card {
  background: var(--green); color: #fff; border-radius: 22px; padding: 18px 16px 16px;
  box-shadow: 0 12px 30px rgba(31,70,20,.25); position: relative; overflow: hidden; margin-bottom: 18px;
}

.stamp-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; position: relative; }
.stamp-card-head .hello { font-family: var(--serif); font-weight: 800; font-size: 1.4rem; line-height: 1.1; }
.stamp-card-head .count { text-align: right; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; opacity: .9; }
.stamp-card-head .count b { display: block; font-family: var(--serif); font-size: 2rem; letter-spacing: 0; font-weight: 900; opacity: 1; }
.stamps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; margin: 16px 0 12px; position: relative; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.8);
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; position: relative;
  font-family: var(--serif); font-weight: 800; font-size: 1rem; color: #fff;
}
.stamp.milestone { border: 3px solid #e6b84f; color: #ffe7b0; background: rgba(200,150,46,.18); }
.stamp .gift-badge { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; }
.stamp.filled { background: #fff; border: 2px solid #fff; color: var(--green); }
.stamp.filled img { width: 74%; height: auto; }
.stamp.pop { animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.stamp-card .expiry { position: relative; font-size: .78rem; opacity: .9; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.stamp-card .expiry .ico { width: 14px; height: 14px; }
.stamp-card .next { font-size: .92rem; background: rgba(0,0,0,.14); border-radius: 12px; padding: 10px 12px; position: relative; }

.milestones { display: grid; gap: 10px; }
.milestone-row { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--cream); border: 1px solid var(--line); }
.milestone-row .num { flex: none; width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 2px solid var(--gold); color: var(--green-deep); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 900; font-size: 1.15rem; }
.milestone-row.reached .num { background: var(--green); border-color: var(--green); color: #fff; }
.milestone-row .gift-name { font-weight: 600; }
.milestone-row .gift-desc { font-size: .85rem; color: var(--muted); }

.reward { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: #fff8e8; border: 1.5px solid #f0d9a6; margin-bottom: 10px; }
.reward .gift-badge { width: 42px; height: 42px; flex: none; }
.reward .done-badge { width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; }
.reward .done-badge .ico { width: 22px; height: 22px; }
.reward.expired { background: #f6f3ee; border-color: var(--line); opacity: .7; }
.reward .title { font-weight: 600; }
.reward.used { background: var(--cream); border-color: var(--line); opacity: .75; }
.reward .actions { margin-left: auto; }

/* ---------- QR ---------- */
.qr-box { background: #fff; border-radius: 16px; padding: 16px; display: inline-block; border: 1px solid var(--line); }
.qr-box svg, .qr-box img { display: block; width: 230px; height: 230px; }
.qr-card { display: flex; align-items: center; gap: 16px; padding: 16px; cursor: pointer; }
.qr-card .qr-mini { flex: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.qr-card .qr-mini svg { display: block; width: 132px; height: 132px; }
.qr-card .qr-text h3 { margin-bottom: .25em; }
.qr-card .member-code { font-size: 1.15rem; margin-top: 6px; }
.qr-card .tap { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--green); font-weight: 500; margin-top: 8px; }
.qr-card .tap .ico { width: 15px; height: 15px; }
.member-code { font-family: ui-monospace, Menlo, monospace; font-size: 1.5rem; letter-spacing: .14em; font-weight: 600; color: var(--green-deep); margin-top: 10px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,35,15,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 16px; animation: fade .2s ease; }
.modal-sheet { background: #fff; border-radius: 24px; padding: 26px 22px calc(env(safe-area-inset-bottom) + 22px); width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; animation: rise .25s ease; }
@media (min-width: 600px) { .modal { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); background: var(--green-deep); color: #fff; padding: 12px 18px; border-radius: 99px; font-size: .92rem; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; animation: rise .2s ease; }
.toast.err { background: var(--danger); }

/* ---------- Info list ---------- */
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.info-list li:last-child { border-bottom: 0; }
.steps { padding-left: 1.2em; margin: 0; }
.steps li { margin-bottom: 8px; line-height: 1.5; }

/* ---------- Staff ---------- */
#reader { width: 100%; border-radius: 16px; overflow: hidden; background: #000; }
#reader video { border-radius: 16px; }
.amount-wrap { position: relative; }
.amount-wrap span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; font-weight: 500; color: var(--muted); }
.amount-wrap input { font-size: 1.6rem; padding: 16px 16px 16px 40px; font-weight: 500; }
.quick-amounts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.quick-amounts button { flex: 1; min-width: 60px; }
.mini-stamps { display: flex; gap: 5px; justify-content: center; margin: 10px 0; }
.mini-stamps i { width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; border: 2px dashed var(--line); display: block; }
.mini-stamps i.on { background: var(--green); border: 2px solid var(--green); }
.mini-stamps i.ms { border-color: var(--gold); border-style: solid; }
.success-tick { width: 92px; height: 92px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 3rem; margin: 6px auto 14px; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }

/* ---------- Admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 1.9rem; color: var(--green-deep); }
.stat span { font-size: .8rem; color: var(--muted); }
.gift-editor { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--cream); }
.gift-editor h3 { display: flex; align-items: center; gap: 10px; }
.gift-editor h3 .num { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--green-deep); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; font-size: .72rem; padding: 3px 9px; border-radius: 99px; background: var(--green-soft); color: var(--green-deep); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.pill.gold { background: #fbefd4; color: #7a5a12; }

@media (max-width: 420px) {
  .brand-name { font-size: 1.4rem; }
  .brand-tag { font-size: .62rem; letter-spacing: .1em; }
  .header-badge { font-size: .62rem; padding: 4px 8px; }
}
footer.app-footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 10px 16px 30px; }
footer.app-footer a { color: var(--muted); }

.spinner { width: 34px; height: 34px; border: 3px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .no-print { display: none !important; }
}

/* ---------- Icons ---------- */
.ico { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.2em; }
.btn .ico { width: 1.35em; height: 1.35em; }
.gift-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--gold); color: #fff; box-shadow: 0 2px 6px rgba(120,80,10,.25); }
.gift-badge .ico { width: 58%; height: 58%; }
.milestone-row .num { position: relative; }
.milestone-row .num .gift-badge { position: absolute; bottom: -4px; right: -6px; width: 20px; height: 20px; }

/* ---------- Bottom tabs (customer app) ---------- */
body.has-nav main { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); }
.bottom-nav button { flex: 1; max-width: 180px; font: inherit; font-size: .74rem; font-weight: 500; border: 0; background: none; color: var(--muted); padding: 6px 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.bottom-nav button .ico { width: 24px; height: 24px; }
.bottom-nav button.active { color: var(--green); background: var(--green-soft); }
body.has-nav footer.app-footer { display: none; }

/* ---------- Checkboxes ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; font-weight: 400; color: var(--ink); margin: 14px 0 0; cursor: pointer; line-height: 1.45; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--green); padding: 0; }
.switch-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .label { font-size: .92rem; }
.switch-row .label small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; inset: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #cfd6c8; border-radius: 99px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(58,122,38,.3); }

/* ---------- Account rows ---------- */
.info-list li .edit { font: inherit; font-size: .82rem; font-weight: 500; color: var(--green); background: none; border: 0; padding: 0 0 0 10px; cursor: pointer; text-decoration: underline; }

/* ---------- Gift celebration ---------- */
.gift-hero { width: 104px; height: 104px; margin: 4px auto 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e6b84f, var(--gold) 70%);
  color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 8px #fbefd4, 0 10px 24px rgba(160,110,20,.35);
  animation: pop .6s cubic-bezier(.2,1.6,.4,1) both, wiggle 1.2s .6s ease-in-out 2; }
.gift-hero .ico { width: 56px; height: 56px; }
.gift-hero.small-hero { width: 84px; height: 84px; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.gift-hero.small-hero .ico { width: 44px; height: 44px; }
#mode-tabs button.active[data-mode=gift] { background: #fbefd4; color: #7a5a12; }
.stamp-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 4px 0 12px; }
.stamp-count b { font-weight: 600; font-size: .95rem; color: var(--green-deep); }
.stamp-count small { display: block; font-size: .76rem; color: var(--muted); margin-top: 2px; }
.stamp-count.multi { background: var(--green-soft); border-color: var(--green); }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--green); background: #fff; color: var(--green); font: inherit; font-size: 1.5rem; font-weight: 500; line-height: 1; cursor: pointer; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 40px; text-align: center; font-family: var(--serif); font-weight: 900; font-size: 1.7rem; color: var(--green-deep); }
.empty-note { background: var(--cream); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; text-align: center; color: var(--muted); font-size: .92rem; margin: 6px 0 16px; }
.how-collect { display: flex; gap: 10px; align-items: flex-start; background: #fff8e8; border: 1px solid #f0d9a6; border-radius: 12px; padding: 10px 12px; font-size: .86rem; margin: 0 0 12px; }
.how-collect .ico { color: var(--gold); width: 20px; height: 20px; margin-top: 1px; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.gift-title { color: #8a6114; }
.gift-name-big { font-family: var(--serif); font-weight: 800; font-size: 1.3rem; color: var(--green-deep); margin: 4px 0 10px; }
.success-tick .ico { width: 52px; height: 52px; stroke-width: 2.4; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: .9; } }

/* ---------- Privacy page ---------- */
.legal h2 { margin-top: 1.2em; font-size: 1.2rem; }
.legal ul { padding-left: 1.2em; line-height: 1.55; }
.legal li { margin-bottom: 6px; }
