:root {
  color-scheme: light;
  --ink: #201713;
  --muted: #77685f;
  --paper: #f6efe3;
  --panel: #fffaf1;
  --line: rgba(70, 46, 30, 0.16);
  --copper: #b8652d;
  --copper-dark: #7b351a;
  --charcoal: #221b18;
  --cream: #fff7e8;
  --green: #31584a;
  --gold: #d6a85f;
  --shadow: 0 22px 58px rgba(45, 28, 18, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(184, 101, 45, 0.22), transparent 34%),
    linear-gradient(160deg, #2a211c 0%, #49301e 48%, #f3eadb 48%, #f3eadb 100%);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.is-hidden { display: none !important; }

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.auth-panel {
  width: min(100%, 430px);
  padding: 28px 22px 22px;
  border: 1px solid rgba(255, 247, 232, 0.44);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(246, 239, 227, 0.98));
  box-shadow: var(--shadow);
}

.brand-logo {
  display: block;
  width: min(100%, 320px);
  max-height: 210px;
  margin: 0 auto 18px;
  object-fit: contain;
}

.header-logo {
  display: block;
  width: min(230px, 62vw);
  max-height: 92px;
  margin: 0 0 10px;
  object-fit: contain;
  object-position: left center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--copper-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 9vw, 3rem);
  line-height: 0.96;
}

.auth-copy {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.tabs {
  display: grid;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.auth-tabs { grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
.app-tabs { grid-template-columns: repeat(4, 1fr); margin: 16px 0 0; }

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 850;
}

.tab.is-active {
  color: var(--cream);
  background: var(--charcoal);
  box-shadow: 0 8px 18px rgba(34, 27, 24, 0.18);
}

.auth-form, #scanForm, .checkin-panel {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--charcoal);
  font-size: 0.84rem;
  font-weight: 850;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(184, 101, 45, 0.72);
  box-shadow: 0 0 0 4px rgba(184, 101, 45, 0.12);
}

.primary-button, .activity-card button {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: var(--cream);
  background: linear-gradient(135deg, var(--copper-dark), var(--copper));
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(123, 53, 26, 0.24);
}

.activity-card button:disabled {
  background: #9d9188;
  box-shadow: none;
  cursor: default;
}

.text-button {
  min-height: 36px;
  border: 0;
  color: var(--copper-dark);
  background: transparent;
  font-weight: 900;
}

.form-message {
  min-height: 21px;
  margin: 0;
  color: var(--copper-dark);
  font-size: 0.84rem;
  font-weight: 800;
}
.form-message.is-visible {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(122, 67, 26, 0.3);
  border-radius: 8px;
  background: rgba(244, 220, 181, 0.65);
  color: var(--copper-dark);
  text-align: center;
}

.shell {
  width: min(100%, 470px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.95), rgba(246, 239, 227, 0.94));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0 4px;
}

.signed-in {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.top-actions { display: flex; gap: 8px; }

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--charcoal);
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.72rem;
  font-weight: 900;
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid rgba(214, 168, 95, 0.45);
  border-radius: 8px;
  background: rgba(214, 168, 95, 0.36);
  box-shadow: var(--shadow);
}

.hero-card > div {
  padding: 18px;
  background: linear-gradient(145deg, var(--charcoal), #3a2921);
}

.hero-card p {
  margin-bottom: 8px;
  color: rgba(255, 247, 232, 0.72);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-card strong {
  color: var(--cream);
  font-size: 2.35rem;
  line-height: 1;
}

.view { display: none; padding: 18px 0 34px; }
.view.is-active { display: block; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h2 { margin-bottom: 0; font-size: 1.12rem; }
h3 { margin-bottom: 12px; font-size: 0.96rem; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(49, 88, 74, 0.25);
  border-radius: 999px;
  color: var(--green);
  background: rgba(49, 88, 74, 0.1);
  font-size: 0.76rem;
  font-weight: 900;
}

.passport-grid, .activity-list { display: grid; gap: 11px; }

.stamp-card, .activity-card, .scan-panel, .checkin-panel, .history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  box-shadow: 0 14px 32px rgba(45, 28, 18, 0.1);
}

.stamp-card {
  position: relative;
  min-height: 132px;
  padding: 15px;
  overflow: hidden;
}

.stamp-card::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -24px;
  width: 82px;
  height: 82px;
  border: 9px double rgba(184, 101, 45, 0.18);
  border-radius: 50%;
}

.stamp-card.is-earned {
  border-color: rgba(49, 88, 74, 0.35);
  background: linear-gradient(145deg, rgba(255, 250, 241, 0.96), rgba(49, 88, 74, 0.12));
}

.stamp-type {
  color: var(--copper-dark);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.stamp-title {
  margin: 7px 0 7px;
  font-weight: 950;
  line-height: 1.12;
}

.stamp-meta, .activity-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.stamp-status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--cream);
  background: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
}

.progress {
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 14px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 23, 19, 0.1);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--copper));
}

.activity-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 15px;
}

.activity-card code {
  display: inline-block;
  margin-top: 8px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
}

.scan-panel, .checkin-panel, .history { padding: 15px; }

.scan-frame {
  display: grid;
  aspect-ratio: 1;
  width: min(100%, 250px);
  margin: 0 auto 14px;
  place-items: center;
  border: 2px solid var(--copper-dark);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--copper-dark) 18px, transparent 18px) 0 0 / 54px 54px,
    linear-gradient(var(--copper-dark) 18px, transparent 18px) 0 0 / 54px 54px,
    rgba(184, 101, 45, 0.08);
}

.scan-frame span {
  width: 55%;
  height: 55%;
  border: 1px dashed rgba(123, 53, 26, 0.38);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.76);
}

.history { margin-top: 16px; }
.history ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.history li { display: grid; gap: 2px; color: var(--muted); font-size: 0.84rem; }
.history strong { color: var(--charcoal); }

dialog {
  width: min(calc(100% - 28px), 420px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(32, 23, 19, 0.45); }

.dialog-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

@media (min-width: 760px) {
  body { padding: 24px 0; }
  .shell {
    min-height: calc(100vh - 48px);
    border: 1px solid rgba(255, 247, 232, 0.4);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
}
/* Logo and name refinements */
.brand-logo {
  width: min(100%, 390px);
  max-height: 270px;
  margin: 0 auto 20px;
}

.header-logo {
  width: min(360px, 84vw);
  max-height: 150px;
  margin: 0 auto 12px;
  object-position: center;
}

.topbar {
  position: relative;
  justify-content: center;
  text-align: center;
}

.topbar > div:first-child {
  width: 100%;
  padding: 0 54px;
}

.top-actions {
  position: absolute;
  top: 14px;
  right: 0;
}

#guestName {
  text-transform: none;
  font-variant: normal;
}

/* Camera QR scanner */
.secondary-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(123, 53, 26, 0.28);
  border-radius: 8px;
  color: var(--copper-dark);
  background: rgba(255, 250, 241, 0.82);
  font-weight: 900;
}

.scan-frame {
  position: relative;
  overflow: hidden;
}

.scan-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame.is-idle video {
  display: none;
}

.scan-target {
  position: relative;
  z-index: 1;
  display: block;
  width: 58%;
  height: 58%;
  border: 2px solid rgba(255, 247, 232, 0.92);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 0 0 999px rgba(32, 23, 19, 0.18);
}

.scan-frame.is-idle .scan-target {
  border: 1px dashed rgba(123, 53, 26, 0.38);
  background: rgba(255, 250, 241, 0.76);
  box-shadow: none;
}

/* Header logo true-centering */
.topbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.topbar > div:first-child {
  width: 100%;
  padding: 0;
}

.header-logo {
  margin-left: auto;
  margin-right: auto;
}

.top-actions {
  top: 10px;
  right: 0;
}

.signed-in {
  padding: 0 56px;
  overflow-wrap: anywhere;
}

/* Scan and logout usability */
.logout-button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--charcoal);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

#startScanButton {
  width: min(100%, 260px);
  justify-self: center;
}

/* Force center scan controls */
.scan-panel {
  justify-items: center;
}

.scan-panel > .primary-button,
#startScanButton {
  display: block;
  width: min(100%, 260px);
  margin-left: auto;
  margin-right: auto;
  justify-self: center;
}

#scanForm {
  width: 100%;
  justify-items: center;
}

#scanForm label,
#scanForm .form-message {
  width: 100%;
}

#scanForm .secondary-button {
  width: min(100%, 260px);
  justify-self: center;
}

/* Hide any old QR payload debug text if cached markup exists */
.activity-card code {
  display: none;
}

/* Earn tab is informational only */
.activity-card-readonly {
  grid-template-columns: 1fr auto;
}

.earned-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--copper-dark);
  background: rgba(184, 101, 45, 0.12);
  font-size: 0.82rem;
  font-weight: 950;
}

.earned-count.is-complete {
  color: var(--cream);
  background: var(--green);
}

/* Role-based access */
.tabs .is-hidden {
  display: none !important;
}


/* Earn category scan actions */
.earn-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.earn-actions button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: var(--cream);
  background: linear-gradient(135deg, var(--copper-dark), var(--copper));
  font-size: 0.82rem;
  font-weight: 900;
}

.earn-actions button:disabled {
  background: #9d9188;
  cursor: default;
}
/* Header action stack */
.top-actions {
  display: grid;
  justify-items: center;
  gap: 6px;
  top: 18px;
  right: 0;
  width: 64px;
}

.top-actions .icon-button {
  width: 54px;
  height: 34px;
}

.top-actions .logout-button {
  width: 64px;
  min-height: 34px;
  padding: 0 6px;
  text-align: center;
}
/* Rewards */
.app-tabs {
  grid-template-columns: repeat(5, 1fr);
}

.reward-list {
  display: grid;
  gap: 11px;
}

.reward-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  min-height: 116px;
  padding: 15px 15px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  box-shadow: 0 14px 32px rgba(45, 28, 18, 0.1);
}

.reward-card strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  color: var(--cream);
  background: var(--charcoal);
  font-size: 1rem;
}

.reward-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.reward-card.is-ready {
  border-color: rgba(49, 88, 74, 0.4);
  background: linear-gradient(145deg, rgba(255, 250, 241, 0.96), rgba(49, 88, 74, 0.12));
}

.reward-progress {
  bottom: 14px;
}
/* Dashboard reward shortcut */
.hero-card .hero-metric {
  display: block;
  width: 100%;
  min-height: 100%;
  padding: 18px;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: linear-gradient(145deg, var(--charcoal), #3a2921);
  box-shadow: none;
}

.hero-card .hero-metric:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -5px;
}
/* Server point request */
.request-point-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid rgba(49, 88, 74, 0.24);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 250, 241, 0.96), rgba(49, 88, 74, 0.1));
  box-shadow: 0 14px 32px rgba(45, 28, 18, 0.1);
}

.request-point-panel h3 {
  margin: 0 0 6px;
}

.request-point-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.38;
}

.request-point-panel .primary-button {
  width: min(100%, 240px);
  justify-self: center;
}

.request-point-panel .primary-button:disabled {
  background: #9d9188;
  box-shadow: none;
  cursor: default;
}
/* Guest/admin tab counts */
.app-tabs {
  grid-template-columns: repeat(4, 1fr);
}

.app-tabs.has-staff {
  grid-template-columns: repeat(5, 1fr);
}
/* Server message earn */
textarea {
  min-height: 110px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
  resize: vertical;
}

textarea:focus {
  border-color: rgba(184, 101, 45, 0.72);
  box-shadow: 0 0 0 4px rgba(184, 101, 45, 0.12);
  outline: none;
}
/* Admin email capture note */
.admin-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
/* Marketing consent */
.check-label {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.check-label input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--copper-dark);
}
/* Inline daily limit note */
.limit-note {
  max-width: 92px;
  color: var(--copper-dark);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
}
.approval-row {
  align-items: center;
  gap: 12px;
}

.approval-row .secondary-button {
  width: auto;
  min-width: 96px;
  justify-self: end;
}
@media (min-width: 840px) {
  .shell.admin-shell {
    width: min(100%, 1120px);
  }

  .admin-shell #staffView.is-active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .admin-shell #staffView .section-heading,
  .admin-shell #staffView .checkin-panel {
    grid-column: 1 / -1;
  }
}
