/* Ojolali Rewards — reuses the palette, typography and card language of the main site. */

:root {
  --green: #31451f;
  --green2: #516b34;
  --cream: #f6efe4;
  --gold: #b49348;
  --brown: #3b2518;
  --text: #211a15;
  --white: #fff;
  --shadow: 0 16px 40px rgba(38, 31, 23, .14);
  --line: #e4d7c7;
  --danger: #a3311f;
  --success: #2f6b3a;
}

* { box-sizing: border-box }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100% }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #fffaf4;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block }
a { color: inherit }

/* ---------- Navigation (matches the homepage bar) ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(49, 69, 31, .96);
  backdrop-filter: blur(8px);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}

.navin {
  max-width: 1180px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
}

.brand { font-weight: 900; letter-spacing: 1.5px; font-size: 22px; display: flex; align-items: center }
.brand-logo { height: 44px; width: 44px; border-radius: 50%; display: block }
.navlinks { display: flex; gap: 18px; font-size: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end }
.navlinks a { text-decoration: none; font-weight: 700 }
.navlinks a.active { color: var(--gold) }

/* ---------- Layout ---------- */

.page { flex: 1 0 auto }

.wrap { max-width: 1180px; margin: auto; padding: 54px 22px; width: 100% }
.wrap.narrow { max-width: 720px }
.center { text-align: center }

.kicker { font-size: 13px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); font-weight: 900 }

h1.display,
h2 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  color: var(--green);
  line-height: 1.1;
  margin: 8px 0 16px;
}

h1.display { font-size: clamp(34px, 6vw, 56px); font-weight: 800 }
h2 { font-size: clamp(26px, 4vw, 38px) }

.lead { font-size: 18px; max-width: 640px; margin: 0 auto }
.muted { color: #6b5f52 }

.panel {
  background: #fff;
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.soft { background: var(--cream) }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 8px;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px;
  margin: 0 auto 26px;
  max-width: 380px;
}

.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 800;
  color: var(--green);
  cursor: pointer;
  transition: .15s;
}

.tabs button[aria-selected="true"] { background: var(--green); color: #fff }

/* ---------- Forms ---------- */

.field { margin-bottom: 18px }

.field label {
  display: block;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 7px;
  color: var(--brown);
}

.field .hint { font-weight: 400; color: #7a6c5d }

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 16px; /* keeps iOS from zooming on focus */
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.field input:focus-visible,
.tabs button:focus-visible,
.btn:focus-visible,
.linkbtn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.field input[aria-invalid="true"] { border-color: var(--danger) }

.checkline {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14.5px;
  margin-bottom: 20px;
}

.checkline input { margin-top: 3px; width: 19px; height: 19px; flex: none; accent-color: var(--green) }

.otpinput {
  letter-spacing: .55em;
  text-align: center;
  font-weight: 800;
  font-size: 24px !important;
  padding-left: .55em !important;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 14px 20px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  border: 0;
  cursor: pointer;
}

.btn.primary { background: var(--gold); color: #fff }
.btn.secondary { background: #fff; color: var(--green); border: 1px solid var(--line) }
.btn.dark { background: var(--green); color: #fff }
.btn.full { display: block; width: 100% }
.btn[disabled] { opacity: .55; cursor: not-allowed }

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 800;
  color: var(--green2);
  text-decoration: underline;
  cursor: pointer;
}

.linkbtn[disabled] { color: #8d8175; cursor: not-allowed; text-decoration: none }

/* ---------- Messages ---------- */

.msg {
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.msg[hidden] { display: none }
.msg.error { background: #fbeceb; color: var(--danger); border-color: #efc9c3 }
.msg.success { background: #ecf5ee; color: var(--success); border-color: #c6e0cd }
.msg.info { background: var(--cream); color: var(--brown); border-color: var(--line) }

.previewcode {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brown);
}

.previewcode code {
  background: #fff;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 3px 9px;
  letter-spacing: .2em;
  font-size: 15px;
}

/* ---------- Dashboard ---------- */

.dashhead {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.dashhead h1 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(28px, 5vw, 44px); color: var(--green); margin: 6px 0 0 }

.card {
  background: linear-gradient(135deg, var(--green) 0%, var(--green2) 100%);
  color: #fff;
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(180, 147, 72, .28);
}

.card .cardlabel { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; opacity: .85; font-weight: 800 }
.card .cardnumber { font-size: clamp(26px, 5vw, 36px); font-weight: 900; letter-spacing: .09em; margin: 6px 0 16px }
.card .cardrow { display: flex; flex-wrap: wrap; gap: 22px; position: relative; z-index: 1 }
.card .cardrow div { min-width: 110px }
.card .cardrow span { display: block; font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: 1px; font-weight: 700 }
.card .cardrow strong { font-size: 18px }

.statgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px;
}

.stat {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gold);
}

.stat span { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; color: #6b5f52; font-weight: 800 }
.stat strong { display: block; font-size: clamp(22px, 3vw, 30px); color: var(--green); margin-top: 6px; font-family: 'Playfair Display', Georgia, serif }

.detailgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 26px;
  margin-top: 6px;
}

.detail span { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; color: #6b5f52; font-weight: 800 }
.detail strong { font-size: 17px; color: var(--brown); font-weight: 700 }

.placeholders {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
}

.placeholder {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 22px;
}

.placeholder h3 { margin: 0 0 6px; color: var(--green); font-size: 19px }
.placeholder p { margin: 0 0 12px; font-size: 14.5px; color: #6b5f52 }

.badge {
  display: inline-block;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--brown);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.badge.on { background: #ecf5ee; border-color: #c6e0cd; color: var(--success) }
.badge.warn { background: #fdf3e3; border-color: #edd7ac; color: #8a6318 }
.badge.gold { background: #f7f1e4; border-color: #e3d4b4; color: var(--gold) }

.loading { padding: 70px 0; text-align: center; color: #6b5f52; font-weight: 700 }

/* ---------- Digital membership card (QR) ---------- */

.qrpanel {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

/* The white padding is part of the code: a scanner needs the quiet zone to be light. */
.qrcode {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  width: 190px;
  height: 190px;
}

.qrcode svg { width: 100%; height: 100% }

/* ---------- Staff dashboard ---------- */

/* A phone at the till has the tabs under the thumb; a desktop gets a pill row. */
.tabbar {
  display: flex;
  gap: 8px;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px;
  margin: 0 0 24px;
}

.tabbar button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 11px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--green);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
}

.tabbar button[aria-selected="true"] { background: var(--green); color: #fff }
.tabbar button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px }
.tabicon { font-size: 17px; line-height: 1 }

.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px }
.btnrow .btn { flex: 1 1 160px }

/* The camera preview. Square, because a QR is, and cropped rather than letterboxed. */
.scanbox {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  margin: 18px auto 0;
  border-radius: 18px;
  overflow: hidden;
  background: #221d18;
}

.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block }

.scanframe {
  position: absolute;
  inset: 14%;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(20, 16, 12, .28);
}

/* One row in the activity feed. */
.feedrow { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line) }
.feedrow:last-child { border-bottom: 0 }
.feedrow strong { display: block; color: var(--brown); font-size: 16px }
.feedrow .feedwhen { display: block; font-size: 13.5px; color: #6b5f52; margin-top: 3px }
.feedmeta { text-align: right; flex: none }
.feedmeta strong { color: var(--green); font-family: 'Playfair Display', Georgia, serif; font-size: 18px }
.feedmeta .badge { margin-top: 6px }

/* ---------- Reward catalogue ---------- */

.rewardgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.reward {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* A reward the member cannot afford yet: still readable, clearly not on offer. */
.reward.locked { background: var(--cream); border-style: dashed }
.reward.chosen { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(176, 141, 62, .25) }

.reward h3 { margin: 0; color: var(--green); font-size: 19px }
.reward p { margin: 0; font-size: 14.5px; color: #6b5f52 }
.reward .rewardcost { font-weight: 900; color: var(--brown); font-size: 15px }
.reward .rewardfoot { margin-top: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
.reward .btn { padding: 10px 18px; font-size: 14px }

/* ---------- Reward history ---------- */

.historylist { list-style: none; margin: 18px 0 0; padding: 0 }

.historyrow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.historyrow:last-child { border-bottom: 0 }
.historyrow strong { display: block; color: var(--brown); font-size: 16px }
.historyrow .historywhen { display: block; font-size: 13.5px; color: #6b5f52; margin-top: 3px }
.historymeta { text-align: right; flex: none }
.historymeta strong { color: var(--green); font-family: 'Playfair Display', Georgia, serif; font-size: 19px }
.historymeta .badge { margin-top: 6px }

/* ---------- Legal copy ---------- */

.legal h2 { font-size: 24px; margin-top: 32px }
.legal p, .legal li { font-size: 16px }
.legal ul { padding-left: 20px }

/* ---------- Staff dashboard on a phone ---------- */

@media (max-width: 720px) {
  /* Docked under the thumb. `env(safe-area-inset-bottom)` keeps it clear of the iPhone
     home indicator, which is why the page declares viewport-fit=cover. */
  .staffapp .tabbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    margin: 0;
    box-shadow: var(--shadow);
    background: #fff;
    border: 1px solid var(--line);
  }

  .staffapp .tabbar button { flex-direction: column; gap: 3px; font-size: 12px; padding: 8px 6px }
  .staffapp .tabicon { font-size: 19px }

  /* Room for the docked bar, so the last control on a long form is still reachable. */
  .staffapp #console { padding-bottom: 108px }
}

/* ---------- Footer ---------- */

footer {
  background: var(--green);
  color: #fff;
  text-align: center;
  padding: 35px 20px;
  flex: none;
}

footer a { color: #fff }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .statgrid { grid-template-columns: repeat(2, 1fr) }
  .placeholders { grid-template-columns: 1fr }
  .placeholders.two { grid-template-columns: 1fr }
  .rewardgrid { grid-template-columns: 1fr }
  .brand { font-size: 18px }
  .navlinks { gap: 12px; font-size: 13px }
}

@media (max-width: 520px) {
  .wrap { padding: 38px 16px }
  /* Stacked, so the code stays big enough for another phone's camera to read. */
  .qrpanel { grid-template-columns: 1fr; justify-items: center; text-align: center }
  .qrpanel .detail { text-align: center }
  .qrcode { width: min(240px, 72vw); height: min(240px, 72vw) }
  .panel, .card { padding: 20px; border-radius: 18px }
  .statgrid { grid-template-columns: 1fr 1fr; gap: 12px }
  .detailgrid { grid-template-columns: 1fr }
  .navin { padding: 10px 14px }
  .brand-logo { height: 38px; width: 38px }
  .dashhead { align-items: flex-start }
  .reward { padding: 18px }
  /* Stacked so a long reward name and its points never squeeze each other. */
  .historyrow { flex-direction: column }
  .historymeta { text-align: left }
  .historymeta .badge { margin: 6px 8px 0 0 }
}

/* ---------- Admin dashboard ---------- */

/* Same 16px floor as the text inputs: iOS zooms a <select> on focus below that too. */
.field select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.field select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px }

/* The outlet filter and its refresh button, side by side while there is room. */
.filterpanel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 22px;
}

.filterpanel .field { flex: 1 1 240px }
.filterpanel .btn { flex: 0 0 auto }

/* Twelve figures rather than four, so they are given more room to breathe than the till's. */
.adminapp .statgrid { grid-template-columns: repeat(4, 1fr); margin-top: 16px }

@media (max-width: 900px) {
  .adminapp .statgrid { grid-template-columns: repeat(2, 1fr) }
}

@media (max-width: 420px) {
  /* One per row at the narrowest widths: "Total Lifetime Sales Recorded" over two columns
     wraps to four lines and the figure below it stops being scannable. */
  .adminapp .statgrid { grid-template-columns: 1fr }
  .filterpanel .btn { width: 100% }
}


/* Clear navigation and full-screen membership card controls */
.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 18px;
  padding-bottom: 0;
}
.page-actions .btn { width: auto; min-width: 120px; }
.card-close {
  display: none;
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  border: 1px solid rgba(240,217,142,.75);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(10,22,8,.82);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}
.membership-card:fullscreen,
.membership-card:-webkit-full-screen {
  width: 100vw;
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.membership-card:fullscreen .card-close,
.membership-card:-webkit-full-screen .card-close { display: block; }
@media (max-width: 520px) {
  .page-actions { padding-left: 18px; padding-right: 18px; }
  .page-actions .btn { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
}


/* Staff: one QR scan opens a complete customer profile */
.customer-profile {
  margin-top: 22px;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, #f7f1e5 0%, #fff 100%);
  border: 1px solid #e2d2af;
  box-shadow: 0 22px 60px rgba(35,55,24,.14);
  scroll-margin-top: 86px;
}
.customer-profile-head { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:18px; }
.customer-profile-head h2 { margin:5px 0 4px; font-size:28px; }
.customer-profile-head p { margin:0; color:#756958; font-size:14px; }
.staff-member-card {
  position:relative;
  overflow:hidden;
  max-width:440px;
  margin:0 auto;
  padding:24px;
  color:#fff;
  border-radius:24px;
  border:1px solid rgba(232,204,119,.82);
  background:radial-gradient(circle at 90% 5%,rgba(218,190,105,.23),transparent 30%),linear-gradient(145deg,#365126 0%,#15240f 60%,#0b1508 100%);
  box-shadow:0 24px 55px rgba(17,31,11,.32);
}
.staff-card-glow { position:absolute; right:-68px; bottom:-78px; width:190px; height:190px; border:1px solid rgba(236,212,136,.25); border-radius:50%; }
.staff-card-top { display:flex; align-items:center; justify-content:space-between; gap:14px; position:relative; }
.staff-card-top img { width:58px; height:58px; border-radius:50%; }
.staff-card-top div { text-align:right; }
.staff-card-top strong { display:block; color:#f0d98e; font-family:Georgia,serif; font-size:18px; letter-spacing:.08em; }
.staff-card-top span { display:block; color:#c9c2aa; font-size:9px; font-weight:800; letter-spacing:.22em; }
.staff-card-line { height:1px; margin:18px 0; background:linear-gradient(90deg,#d8b95c,transparent); }
.staff-card-label { display:block; color:#d8cfae; font-size:10px; font-weight:800; letter-spacing:.15em; }
.staff-member-card h3 { position:relative; margin:3px 0 20px; color:#fff; font:700 30px/1.15 'Playfair Display',Georgia,serif; }
.staff-card-balance { position:relative; display:flex; justify-content:space-between; align-items:flex-end; gap:18px; }
.staff-card-balance strong { display:block; margin-top:3px; color:#f2dc98; font-size:21px; letter-spacing:.05em; }
.staff-card-balance > div:last-child { text-align:right; }
.staff-card-balance > div:last-child strong { font-size:34px; line-height:1; }
.profile-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; max-width:620px; margin:18px auto 0; }
.profile-action { min-height:112px; padding:14px 10px; border:0; border-radius:18px; color:#fff; font:inherit; cursor:pointer; box-shadow:0 12px 24px rgba(34,45,23,.14); }
.profile-action.check { background:linear-gradient(145deg,#536f38,#31451f); }
.profile-action.add { background:linear-gradient(145deg,#c7a44a,#9b7726); }
.profile-action.redeem { background:linear-gradient(145deg,#473223,#2c1c13); }
.profile-action-icon { display:block; width:32px; height:32px; margin:0 auto 7px; border-radius:50%; background:rgba(255,255,255,.18); font-size:22px; line-height:32px; }
.profile-action strong,.profile-action small { display:block; }
.profile-action strong { font-size:14px; }
.profile-action small { margin-top:3px; font-size:10px; opacity:.82; }
.profile-details { margin-top:18px; box-shadow:none; border:1px solid var(--line); }
.profile-workflow { scroll-margin-top:86px; }
.profile-focus { animation:profilePulse 1.7s ease; }
@keyframes profilePulse { 0%,100% { box-shadow:var(--shadow); } 35% { box-shadow:0 0 0 5px rgba(180,147,72,.32),var(--shadow); } }
@media (max-width:520px) {
  .customer-profile { margin-left:-8px; margin-right:-8px; padding:14px; border-radius:22px; }
  .staff-member-card { padding:20px; border-radius:21px; }
  .staff-member-card h3 { font-size:27px; }
  .profile-actions { gap:7px; }
  .profile-action { min-height:104px; padding:12px 6px; }
  .profile-action strong { font-size:12px; }
}
