/* --------------------------------------------------------------------------
   Card Box - the whole look of the site lives in this one file.
   --brand is set per shop, so the same pages take on each shop's colour.
   -------------------------------------------------------------------------- */

:root {
  --brand: #6f4e37;
  --ink: #16181d;
  --ink-soft: #5c6470;
  --paper: #f6f4f1;
  --panel: #ffffff;
  --line: #e4e0da;
  --good: #14794a;
  --bad: #ad2b3b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.06), 0 8px 24px rgba(20, 22, 28, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--brand); }

.wrap {
  padding: 20px 16px 32px;
  margin: 0 auto;
  max-width: 720px;
}
.wrap.narrow { max-width: 460px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.optional { color: var(--ink-soft); font-weight: 400; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em; }
.lead { font-size: 17px; margin: 0 0 16px; }

.hero { padding: 32px 0; }
.hero h1 { font-size: 34px; }

/* --- panels --------------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.panel p:last-child { margin-bottom: 0; }

.shop-head { text-align: center; padding: 8px 0 18px; }
.shop-head h1 { color: var(--brand); }
.tagline { margin: 0; color: var(--ink-soft); }

.prose h2 { margin-top: 24px; }

/* --- the stamp card ------------------------------------------------------- */

.stamps {
  display: grid;
  grid-template-columns: repeat(var(--per-row, 4), 1fr);
  gap: 10px;
}
.stamp {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 15px;
  background: #fbfaf8;
}
.stamp svg { width: 46%; height: 46%; }
.stamp.on {
  background: var(--brand);
  border: 2px solid var(--brand);
  color: #fff;
}
.stamp.reward {
  border-style: solid;
  border-color: var(--brand);
  color: var(--brand);
  background: #fff;
}
.stamp.reward.on { color: #fff; }

.status { margin: 14px 0 0; text-align: center; font-weight: 600; }
.status.ready { color: var(--good); }

/* --- the QR code ---------------------------------------------------------- */

.qr-panel { text-align: center; }
.qr-panel.ready { border-color: var(--good); border-width: 2px; }
.qr-hint { margin: 0 0 12px; font-weight: 600; color: var(--ink-soft); }
.qr {
  width: 232px;
  height: 232px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.qr svg { width: 100%; height: 100%; display: block; }
.qr.big { width: 300px; height: 300px; }
.code { margin: 14px 0 0; color: var(--ink-soft); }
.code strong {
  color: var(--ink);
  letter-spacing: 3px;
  font-size: 20px;
}

/* --- buttons and forms ---------------------------------------------------- */

button, .big-link {
  font: inherit;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: translateY(1px); }

button.big, .big-link {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  padding: 16px 18px;
  font-size: 17px;
}
button.reward { background: var(--good); border-color: var(--good); }

.form label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
  font-size: 15px;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form input:not([type]) {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form button { margin-top: 18px; }
.narrow-form { max-width: 380px; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-weight: 400;
  font-size: 15px;
}
.check input { margin-top: 3px; width: 20px; height: 20px; }

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-weight: 600;
  border: 1px solid;
}
.flash.good { background: #e8f6ee; border-color: #bfe3ce; color: var(--good); }
.flash.bad  { background: #fdecee; border-color: #f4c7cd; color: var(--bad); }
.flash.info { background: #fff6e5; border-color: #f2ddb4; color: #8a5a10; }

/* --- the card list -------------------------------------------------------- */

.card-list { display: grid; gap: 12px; }
.card-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.card-link-name { font-weight: 600; }
.card-link-count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* --- the till ------------------------------------------------------------- */

.till { padding-bottom: 76px; }
.till-head {
  background: var(--brand);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.till-shop { font-weight: 700; }
.till-label { opacity: 0.8; font-size: 14px; }

.till-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.till-nav a {
  padding: 14px 2px;
  text-align: center;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
}
.till-nav a.on { color: var(--brand); }

.scan-button {
  display: grid;
  place-items: center;
  gap: 10px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 34px 18px;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}
.scan-button svg { width: 52px; height: 52px; }

.till-today { text-align: center; color: var(--ink-soft); font-weight: 600; }

.customer h2 { text-align: center; font-size: 24px; }
.stamp-buttons { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.stamp-buttons form:first-child { grid-column: 1 / -1; }
.stamp-buttons button { width: 100%; }

.found-list { display: grid; gap: 8px; margin-bottom: 12px; }
.found {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-decoration: none;
  color: var(--ink);
}

/* --- the scanner ---------------------------------------------------------- */

.scanner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
  margin-bottom: 14px;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
}
.scan-msg { text-align: center; font-weight: 600; }

/* --- numbers -------------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.tile .n {
  display: block;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}
.tile .l { display: block; color: var(--ink-soft); font-size: 14px; }

/* --- the owner's pages ---------------------------------------------------- */

.owner-head {
  background: #1f2933;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
}
.owner-brand { color: #fff; text-decoration: none; font-weight: 700; }
.owner-label { opacity: 0.7; }

.shop-rows { display: grid; gap: 10px; margin-bottom: 18px; }
.shop-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 4px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
}
.shop-row .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; }
.shop-row-name { font-weight: 600; }
.shop-row-stats { grid-column: 2; color: var(--ink-soft); font-size: 14px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
}
.swatch input:checked + span { border-color: #16181d; }

/* --- the printable sign --------------------------------------------------- */

.poster {
  max-width: 520px;
  margin: 0 auto;
  padding: 36px 24px;
  text-align: center;
}
.poster h1 { font-size: 40px; color: var(--brand); }
.poster-lead { font-size: 20px; color: var(--ink-soft); margin: 0 0 22px; }
.poster-do { font-size: 22px; font-weight: 700; margin: 18px 0 6px; }
.poster-reward { font-size: 19px; margin: 0 0 14px; }
.poster-small { color: var(--ink-soft); }
.poster-page { background: #fff; }

@media print {
  .poster-print, .foot { display: none; }
  .poster { padding-top: 0; }
  body { background: #fff; }
}

/* --- footer --------------------------------------------------------------- */

.foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 8px 16px 24px;
}

/* --- wallet buttons ------------------------------------------------------- */

.wallets { text-align: center; }
.wallet-button {
  display: block;
  text-decoration: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
  border: 1px solid #16181d;
  background: #16181d;
  color: #fff;
}
.wallet-button.google {
  background: #fff;
  color: #3c4043;
  border-color: #dadce0;
}
.wallets .small { margin: 6px 0 0; }

/* --- owner: wallet settings ----------------------------------------------- */

.form textarea {
  width: 100%;
  font: 13px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  resize: vertical;
}
.form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.ok, .todo {
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: middle;
  margin-left: 6px;
}
.ok { background: #e8f6ee; color: var(--good); }
.todo { background: #f1efec; color: var(--ink-soft); }

/* --- the shop's customer list --------------------------------------------- */

.search { margin-bottom: 10px; }
.sorts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  margin: 0 0 12px;
  font-size: 14px;
}
.sorts a { text-decoration: none; font-weight: 600; color: var(--ink-soft); }
.sorts a.on { color: var(--brand); text-decoration: underline; }

.cust-list { display: grid; gap: 8px; margin-bottom: 14px; }
.cust {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.cust.full { border-color: var(--good); background: #f6fcf8; }
.cust-who { text-decoration: none; color: var(--ink); min-width: 0; }
.cust-name { display: block; font-weight: 600; }
.cust-meta {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cust-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}
.cust-count .of { color: var(--ink-soft); font-weight: 400; }
.cust-buttons { display: flex; gap: 6px; }
.cust-buttons button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.cust-buttons button[disabled] { opacity: 0.35; }

.paging {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

/* --- logos ---------------------------------------------------------------- */

.shop-logo {
  display: block;
  max-width: 140px;
  max-height: 80px;
  margin: 0 auto 10px;
  object-fit: contain;
}
.till-logo {
  height: 22px;
  width: auto;
  vertical-align: -5px;
  margin-right: 6px;
  border-radius: 4px;
  background: #fff;
}
.card-link-logo {
  height: 22px;
  width: auto;
  vertical-align: -5px;
  margin-right: 6px;
  border-radius: 4px;
}
.poster-logo {
  display: block;
  max-width: 220px;
  max-height: 120px;
  margin: 0 auto 14px;
  object-fit: contain;
}

/* --- the front page ------------------------------------------------------- */

.doors {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 32px;
}
.door {
  display: grid;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.door-title { font-weight: 700; font-size: 18px; color: var(--brand); }
.door-sub { color: var(--ink-soft); font-size: 14px; }

.home-block { margin-bottom: 32px; }
.home-block h2 { margin-bottom: 10px; }

.shop-doors { display: grid; gap: 10px; }
.shop-door {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
}
.shop-door-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  flex: none;
}
.shop-door-dot {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--brand);
  flex: none;
}
.shop-door-name { display: block; font-weight: 600; }
.shop-door-sub { display: block; font-size: 14px; color: var(--ink-soft); }

.till-links { display: flex; flex-wrap: wrap; gap: 10px 16px; }

/* --- the shop's own look page --------------------------------------------- */

.look-preview { text-align: center; }
.preview-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  border: 1px solid var(--line);
  border-top: 5px solid var(--brand);
  border-radius: 12px;
  padding: 18px;
}
.preview-card strong { font-size: 20px; color: var(--brand); }
.form input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fbfaf8;
}
