:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #fbfaf7;
  --card: #ffffff;
  --accent: #0e9f6e;
  --accent-ink: #065f46;
  --accent-soft: #e7f6ef;
  --sky: #0284c7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 5vw, 40px); }
h2 { font-size: 24px; }
h3 { font-size: 18px; font-family: Inter, sans-serif; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--sky); }
[hidden] { display: none !important; }

/* ── top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); font-weight: 800; font-size: 14px; letter-spacing: .5px;
}
.brand-name { font-weight: 700; white-space: nowrap; }
.brand-name em { font-style: normal; color: #94a3b8; font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-btn {
  background: transparent; color: #cbd5e1; border: 0; padding: 8px 12px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-btn.active { color: #fff; background: rgba(255,255,255,.14); }
.nav-btn.ghost { color: #94a3b8; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }

/* ── cards & layout ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-auth { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: start; }
@media (max-width: 820px) {
  .grid-2, .grid-auth { grid-template-columns: 1fr; }
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 46ch; }

/* ── forms ── */
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel],
input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 11px 12px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  border-radius: 10px; padding: 11px 16px; border: 1px solid transparent;
  background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #cbd5e1; }
.btn.quiet { background: transparent; color: var(--ink-2); border-color: transparent; padding: 8px 10px; }
.btn.danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn.small { font-size: 13px; padding: 7px 10px; }
.btn.block { width: 100%; }
.btn-google { background: #fff; color: var(--ink); border-color: #cbd5e1; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* switches */
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .switches { grid-template-columns: 1fr; } }
.switch {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: #fff;
}
.switch.on { border-color: var(--accent); background: var(--accent-soft); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .knob {
  flex: none; width: 40px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; margin-top: 2px;
  transition: background .15s;
}
.switch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: left .15s;
}
.switch.on .knob { background: var(--accent); }
.switch.on .knob::after { left: 19px; }
.switch b { display: block; font-size: 15px; }
.switch small { color: var(--muted); font-size: 13px; }
.switch:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f1f5f9; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button {
  position: absolute; top: 6px; right: 6px; border: 0; border-radius: 8px; padding: 3px 7px;
  background: rgba(15,23,42,.75); color: #fff; font-size: 12px; cursor: pointer;
}
.photo.add {
  display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer;
  border-style: dashed;
}
.photo.add:hover { color: var(--ink); border-color: var(--accent); }

#map { height: 280px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }

/* offers */
.offer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.offer-list { display: grid; gap: 12px; }
.offer {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 14px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
@media (max-width: 640px) { .offer { grid-template-columns: 64px 1fr; } .offer .offer-btns { grid-column: 1 / -1; } }
.offer .thumb { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: #f1f5f9; display: grid; place-items: center; font-size: 26px; }
.offer h3 { margin: 0; font-size: 16px; }
.offer .meta { font-size: 13px; color: var(--muted); }
.offer-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.badge.live { background: var(--accent-soft); color: var(--accent-ink); }
.badge.scheduled { background: #e0f2fe; color: #075985; }
.badge.expired { background: #f1f5f9; color: var(--muted); }
.badge.paused { background: var(--amber-soft); color: var(--amber); }
.badge.type { background: #f1f5f9; color: var(--ink-2); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 26px; font-family: Fraunces, serif; }
.stat span { color: var(--muted); font-size: 13px; }

.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; }
.chip:hover { border-color: var(--accent); }

/* phone preview */
.preview-wrap { position: sticky; top: 76px; }
.phone {
  width: 100%; max-width: 320px; margin: 0 auto; background: #0f172a; border-radius: 28px; padding: 14px;
  box-shadow: var(--shadow);
}
.phone-screen { background: linear-gradient(160deg, #cfe3d6, #b9d3e6); border-radius: 18px; padding: 12px; min-height: 380px; display: flex; flex-direction: column; justify-content: flex-end; }
.pv-card { background: rgba(15,23,42,.92); color: #e2e8f0; border-radius: 14px; overflow: hidden; }
.pv-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.pv-body { padding: 10px 12px 12px; }
.pv-sponsored { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: #fbbf24; font-weight: 700; }
.pv-title { font-weight: 700; color: #fff; font-size: 15px; margin: 2px 0; }
.pv-biz { font-size: 12px; color: #94a3b8; }
.pv-details { font-size: 13px; margin-top: 6px; }
.pv-code { display: inline-block; margin-top: 8px; border: 1.5px dashed #fbbf24; color: #fde68a; border-radius: 8px; padding: 3px 10px; font-weight: 700; letter-spacing: 1px; }
.pv-expiry { font-size: 12px; color: #fbbf24; margin-top: 6px; }
.pv-say { font-size: 12px; color: var(--ink-2); background: rgba(255,255,255,.7); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 2000; display: grid; place-items: start center; overflow: auto; padding: 24px 12px; }
.modal { background: var(--paper); border-radius: 18px; width: 100%; max-width: 980px; padding: 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.notice.warn { background: var(--amber-soft); color: #78350f; }
.notice.ok { background: var(--accent-soft); color: var(--accent-ink); }
.notice.err { background: var(--red-soft); color: #7f1d1d; }

.hero-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
.hero-list li { display: flex; gap: 12px; align-items: flex-start; }
.hero-list .dot { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  transition: all .2s; z-index: 3000; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin th, table.admin td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll { overflow-x: auto; }

/* ── printable sign ── */
.sign {
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 36px 28px; text-align: center;
  max-width: 640px; margin: 0 auto; box-shadow: var(--shadow);
}
.sign .sign-kicker { font-weight: 800; letter-spacing: 3px; font-size: 15px; color: var(--accent-ink); text-transform: uppercase; }
.sign h1 { font-size: clamp(34px, 7vw, 56px); margin: 10px 0 6px; }
.sign .sign-sub { font-size: 20px; color: var(--ink-2); margin: 0 0 18px; }
.sign .sign-price { font-family: Fraunces, Georgia, serif; font-size: 36px; font-weight: 700; margin: 6px 0 14px; }
.sign img.qr { width: 260px; height: 260px; image-rendering: pixelated; margin: 8px auto 6px; display: block; }
.sign .sign-cta { font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.sign .sign-small { font-size: 14px; color: var(--muted); }
.sign .sign-brand { margin-top: 18px; font-weight: 800; font-size: 18px; }
.sign .sign-brand em { font-style: normal; color: var(--accent); }
@media print {
  .topbar, .footer, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .sign { border-width: 4px; box-shadow: none; max-width: none; margin: 0; page-break-inside: avoid; }
}

/* Logo (My business page and the Offers header) */
.logo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.logo-row .photo { width: 110px; }
.photo.logo img { object-fit: contain; background: #fff; }
.brand-logo { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); }

/* Redeem (scan a customer's coupon) */
.scan-video { width: 100%; max-width: 420px; border-radius: 12px; background: #0f172a; aspect-ratio: 4 / 3; object-fit: cover; }
.redeem { text-align: center; align-items: center; }
.redeem .row { justify-content: center; }
.redeem-icon { font-size: 54px; line-height: 1; }
.redeem-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; }
.redeem.good { border: 2px solid var(--accent); }
.redeem.bad { border: 2px solid #fca5a5; }
.btn.big { font-size: 20px; padding: 16px 28px; width: 100%; max-width: 360px; }

/* Phones: brand on its own line, the menu below it in one row that scrolls sideways. */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .nav { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn { white-space: nowrap; padding: 7px 10px; }
}
.scan-video[hidden] { display: none; }
