@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --ink: #171629;
  --muted: #6f6c7d;
  --paper: #f6f5f1;
  --white: #fff;
  --violet: #6d4aff;
  --violet-dark: #5636e7;
  --lime: #c7ff5c;
  --line: #e6e3ed;
  --danger: #b4233d;
  --success: #16794b;
  --shadow: 0 20px 60px rgba(29, 21, 59, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 "DM Sans", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand, .metric-grid strong { font-family: "Manrope", sans-serif; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 4vw, 48px); line-height: 1.07; letter-spacing: -.045em; }
h2 { margin-bottom: 4px; font-size: 20px; letter-spacing: -.02em; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(23, 22, 41, .08);
  background: rgba(246, 245, 241, .9);
  backdrop-filter: blur(16px);
}

.topbar form { justify-self: end; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.025em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: white; background: var(--violet); box-shadow: 0 8px 20px rgba(109, 74, 255, .25); }

nav { display: flex; gap: 8px; padding: 5px; border-radius: 14px; background: #ebe9e4; }
nav a { padding: 8px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; }
nav a.active { color: var(--ink); background: white; box-shadow: 0 3px 10px rgba(20, 18, 31, .07); }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 90px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 20% 10%, rgba(199,255,92,.5), transparent 28%), radial-gradient(circle at 90% 90%, rgba(109,74,255,.25), transparent 30%), var(--paper); }
.auth-card { width: min(480px, 100%); padding: 48px; border: 1px solid rgba(255,255,255,.9); border-radius: 30px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.hero-brand { margin-bottom: 54px; }
.auth-card h1 { font-size: 43px; }

.eyebrow { margin-bottom: 12px; color: var(--violet); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 36px; }
.page-heading .muted { margin-bottom: 0; }

.primary-button, .secondary-button, .wallet-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
.primary-button { color: white; background: var(--violet); box-shadow: 0 10px 24px rgba(109, 74, 255, .22); }
.primary-button:hover { background: var(--violet-dark); transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; }
.secondary-button:disabled { cursor: not-allowed; opacity: .45; }
.quiet-button { padding: 8px 12px; border: 0; color: var(--muted); background: none; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-grid article { min-height: 158px; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.metric-grid article.highlight { color: white; border-color: var(--ink); background: var(--ink); }
.metric-grid span, .metric-grid small { color: var(--muted); }
.metric-grid .highlight span, .metric-grid .highlight small { color: #c7c4d2; }
.metric-grid strong { margin-top: auto; font-size: 42px; line-height: 1; letter-spacing: -.05em; }

.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 8px 30px rgba(29, 21, 59, .035); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.panel-heading p { margin: 0; color: var(--muted); }
.panel-heading > a { color: var(--violet); font-weight: 700; }

.customer-list > a { display: flex; align-items: center; gap: 15px; min-height: 76px; padding: 14px 26px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.customer-list > a:last-child { border-bottom: 0; }
.customer-list > a:hover { background: #faf9fc; }
.avatar { flex: 0 0 auto; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: var(--violet); background: #eeeaff; font-weight: 800; }
.avatar.large { width: 70px; height: 70px; border-radius: 21px; font-size: 26px; }
.customer-copy { display: flex; flex: 1; flex-direction: column; }
.customer-copy small { color: var(--muted); }
.arrow { color: var(--violet); font-size: 21px; }
.pill { padding: 5px 10px; border-radius: 999px; color: #4d3b0e; background: #efffcf; font-weight: 700; }

.search { display: flex; gap: 10px; margin-bottom: 16px; }
.search input { flex: 1; }
.search button { padding: 0 22px; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 700; cursor: pointer; }
input, select { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid #dcd8e5; border-radius: 12px; color: var(--ink); background: white; outline: 0; }
input:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109,74,255,.12); }
input[type="color"] { padding: 5px; }

.stacked-form { display: grid; gap: 17px; margin-top: 28px; }
.stacked-form label { display: grid; gap: 7px; font-weight: 700; }
.stacked-form label small { color: var(--muted); font-weight: 500; }
.stacked-form .consent { grid-template-columns: 20px 1fr; align-items: start; color: var(--muted); font-size: 13px; font-weight: 500; }
.consent input { min-height: auto; margin-top: 4px; accent-color: var(--violet); }
.form-page { width: min(660px, 100%); margin: 0 auto; }
.form-panel { margin-top: 18px; padding: 36px; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--muted); font-weight: 600; }

.customer-hero { display: flex; align-items: center; gap: 20px; margin: 6px 0 28px; }
.customer-hero h1 { margin: 0; font-size: 36px; }
.customer-hero p { margin-bottom: 3px; }
.customer-hero .secondary-button { margin-left: auto; }
.customer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 20px; }
.stamp-card, .reward-card { padding: 28px; border-radius: 24px; }
.stamp-card { border: 1px solid var(--line); background: white; }
.stamp-count strong { font: 800 52px/1 "Manrope", sans-serif; letter-spacing: -.06em; }
.stamp-count span { color: var(--muted); font-size: 20px; }
.stamp-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.stamp { display: grid; width: 38px; height: 38px; place-items: center; border: 1px dashed #c6c0d4; border-radius: 50%; color: #aaa4b6; font-size: 12px; }
.stamp.filled { border: 0; color: white; background: var(--violet); }
.earn-form { display: flex; gap: 10px; margin-top: 26px; }
.earn-form input { width: 74px; }
.earn-form button { flex: 1; }
.reward-card { display: flex; flex-direction: column; color: var(--ink); background: var(--lime); }
.reward-card > strong { margin-top: auto; font: 800 64px/1 "Manrope", sans-serif; letter-spacing: -.06em; }
.reward-card > span { margin-bottom: 26px; }
.reward-card form, .reward-card button { width: 100%; }

.timeline { padding: 6px 26px; }
.timeline > div { display: flex; align-items: center; gap: 13px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.timeline > div:last-child { border-bottom: 0; }
.event-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 5px #eeeaff; }
.timeline p { flex: 1; display: flex; flex-direction: column; margin: 0; }
.timeline small { color: var(--muted); }
.event-points { font-weight: 800; }

.empty { padding: 58px 24px; text-align: center; color: var(--muted); }
.empty h1, .empty h3 { color: var(--ink); }
.empty > span { color: var(--violet); font-size: 30px; }
.flash { margin-bottom: 22px; padding: 14px 16px; border-radius: 12px; font-weight: 600; }
.flash.success { color: var(--success); background: #ddf8eb; }
.flash.error { color: var(--danger); background: #fee8ed; }

.merchant-list > a {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1fr) 78px 78px auto 22px;
  align-items: center;
  gap: 18px;
  min-height: 88px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease, transform .15s ease;
}
.team-list > div { display: flex; align-items: center; gap: 15px; min-height: 82px; padding: 15px 24px; border-bottom: 1px solid var(--line); }
.merchant-list > a:last-child, .team-list > div:last-child { border-bottom: 0; }
.merchant-list > a:hover { background: #faf9fc; }
.merchant-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.merchant-copy strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.merchant-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.admin-meta { display: flex; min-width: 70px; flex-direction: column; text-align: right; }
.admin-meta b { font: 700 18px/1.15 "Manrope", sans-serif; }
.admin-meta small { color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.active { color: #16794b; background: #ddf8eb; }
.status.inactive { color: #8b5360; background: #f4e9ec; }
.admin-columns { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-bottom: 20px; }
.admin-columns .form-panel { width: 100%; margin: 0; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.team-panel { margin-top: 20px; }
.team-list form { margin-left: 4px; }

.public-card-wrap { width: min(500px, 100%); }
.loyalty-card { position: relative; overflow: hidden; min-height: 290px; padding: 30px; border-radius: 28px; color: white; background: linear-gradient(145deg, var(--merchant), #19152d); box-shadow: 0 30px 80px color-mix(in srgb, var(--merchant) 28%, transparent); }
.loyalty-card::after { content: ''; position: absolute; width: 220px; height: 220px; right: -60px; top: -80px; border: 45px solid rgba(255,255,255,.09); border-radius: 50%; }
.card-label { font-weight: 800; letter-spacing: .04em; }
.loyalty-card h1 { margin-top: 56px; font-size: 30px; }
.balance { display: flex; align-items: baseline; gap: 8px; }
.balance strong { font: 800 44px/1 "Manrope", sans-serif; }
.progress { overflow: hidden; height: 9px; margin: 16px 0 12px; border-radius: 999px; background: rgba(255,255,255,.18); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.wallet-actions { display: grid; gap: 10px; margin-top: 20px; }
.wallet-button { color: white; background: #080808; }
.wallet-button.google { background: #1f1f1f; }
.setup-note, .privacy-note { margin: 18px 8px 0; color: var(--muted); text-align: center; font-size: 13px; }
.privacy-note { margin-top: 12px; font-size: 11px; }

@media (max-width: 800px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 20px; }
  .topbar nav { position: fixed; z-index: 20; right: 16px; bottom: 16px; left: 16px; justify-content: center; box-shadow: var(--shadow); }
  .topbar nav a { flex: 1; text-align: center; }
  .topbar form { grid-column: 2; }
  .shell { width: min(100% - 28px, 1180px); padding-top: 34px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .customer-grid { grid-template-columns: 1fr; }
  .admin-columns { grid-template-columns: 1fr; }
  .merchant-list > a { grid-template-columns: 44px minmax(0, 1fr) 64px 64px 22px; gap: 14px; }
  .merchant-list .status { display: none; }
}

@media (max-width: 520px) {
  .brand > span:last-child { display: none; }
  .auth-card { padding: 30px 24px; border-radius: 22px; }
  .auth-card .brand > span:last-child { display: inline; }
  .auth-card h1 { font-size: 35px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .primary-button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-grid article { min-height: 130px; padding: 18px; }
  .metric-grid strong { font-size: 34px; }
  .customer-hero { align-items: flex-start; flex-wrap: wrap; }
  .customer-hero .secondary-button { width: 100%; margin-left: 0; }
  .form-panel { padding: 25px 20px; }
  .customer-list > a { padding-inline: 18px; }
  .merchant-list > a {
    grid-template-columns: 44px minmax(0, 1fr) 70px 18px;
    gap: 12px;
    padding: 16px 18px;
  }
  .merchant-list .merchant-copy { min-width: 0; }
  .merchant-list .admin-meta { grid-row: 2; min-width: 0; padding: 9px 12px; border-radius: 10px; text-align: left; background: #f7f6fa; }
  .merchant-list .admin-meta:nth-of-type(3) { grid-column: 2; }
  .merchant-list .admin-meta:nth-of-type(4) { grid-column: 3; }
  .merchant-list .arrow { grid-column: 4; grid-row: 1; }
  .team-list > div { align-items: flex-start; flex-wrap: wrap; padding-inline: 18px; }
  .team-list .merchant-copy { min-width: calc(100% - 64px); }
  .team-list .status { margin-left: 59px; }
}

