/* The admin page (/admin). Loads after guest.css, which styles the web card
   preview exactly as guests see it. */
.admin-body { background: #f4f1ec; }
.admin-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.admin-bar form { margin: 0; }
main.admin {
  max-width: 1240px; margin: 0 auto; padding: 20px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start;
}
.admin h2 { font-size: 20px; margin: 0 0 14px; }
.admin h3 { font-size: 15px; margin: 0 0 10px; }

.abtn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: 600 15px/1 inherit; font-family: inherit; padding: 11px 16px; border-radius: 10px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.abtn { white-space: nowrap; }
.abtn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.abtn.small { font-size: 13px; padding: 7px 10px; border-radius: 8px; }
.abtn.link { background: transparent; border-color: transparent; color: var(--muted); }
.abtn:disabled { opacity: .5; cursor: default; }

.shops { position: sticky; top: 16px; }
.shops .abtn { width: 100%; }
.shops ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.shops li button {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 10px;
}
.shops li button:hover { background: #fff; }
.shops li button.on { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.shops li b { display: block; font-size: 14px; }
.shops li small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.shops .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.shops .empty { color: var(--muted); font-size: 14px; padding: 8px 10px; }

.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
#shop-form, .preview, .links { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
#shop-form label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 14px; }
#shop-form input:not([type=color]):not([type=file]):not([type=range]) {
  display: block; width: 100%; margin-top: 6px; font: 400 16px/1.2 inherit; font-family: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
#shop-form input:disabled { background: #f6f3ee; color: var(--muted); }
#shop-form input.bad { border-color: #c0392b; box-shadow: 0 0 0 2px rgba(192,57,43,.15); }
#shop-form small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.35; }
#shop-form fieldset { border: 0; padding: 0; margin: 0 0 14px; }
#shop-form legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.slug { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 400; color: var(--muted); font-size: 14px; }
.slug > span { white-space: nowrap; }
#shop-form .slug input { margin-top: 0; }
#shop-form .colors label.color { display: grid; grid-template-columns: 1fr 44px 96px; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 400; }
.colors input[type=color] { width: 44px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
#shop-form .colors input[data-hex] { margin-top: 0; width: 96px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; padding: 8px; }
.logo-row { display: flex; gap: 12px; align-items: center; }
.logo-box { width: 200px; height: 64px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-box em { color: rgba(255,255,255,.6); font-size: 13px; mix-blend-mode: difference; }
.logo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.logo-actions label.abtn { margin: 0 !important; font-weight: 600 !important; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.form-actions small { margin: 0 !important; }
.err { color: #c0392b; font-size: 14px; margin: 8px 0 0; }
.warn { color: #9a6700 !important; }
p.warn { font-size: 13px; margin: 4px 0 0; }
.ok { font-weight: 600; color: #1e7b45; margin: 0 0 12px; }

.links { margin-bottom: 20px; }
.links.fresh { border-color: #9ad4b0; box-shadow: 0 0 0 3px rgba(30,123,69,.08); }
.link-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.link-row:first-of-type { border-top: 0; }
.link-row .lbl { font-weight: 600; font-size: 14px; }
.link-row .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.link-row a { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.link-row code { font-size: 16px; letter-spacing: .1em; }
.link-actions { margin-top: 10px; }

.preview { position: sticky; top: 16px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-head h3 { margin: 0; }
.stamps-slider { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pv-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.pv-pair > figure > div { max-width: 340px; }
#pv-web .count { flex: none; }
.pv-pair figure { margin: 0; }
.pv-pair figcaption { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
#pv-web .card { padding: 14px 14px 12px; }
#pv-web .stamps { gap: 8px; margin: 14px 0 12px; }
#pv-web .venue { font-size: 15px; min-width: 0; }
#pv-web .venue .logo { height: 24px; max-width: 80px; }
#pv-web .stamps { grid-template-columns: repeat(var(--cols, 5), minmax(0, 40px)); }
#pv-web .reward { font-size: 14px; }
#pv-web .status { font-size: 13px; }

/* A model of the Wallet store card: Apple draws the real one, so this follows
   its layout (logo and name, header field, strip, fields, barcode). */
.wpass { background: var(--bg); color: var(--fg); border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; }
.w-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; min-height: 44px; gap: 8px; }
.w-logo { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; min-width: 0; }
.w-logo img { height: 22px; max-width: 90px; object-fit: contain; }
.w-logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-head { text-align: right; }
.w-head b { display: block; font-size: 16px; font-weight: 500; }
.w-label { display: block; color: var(--label); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; }
.w-strip { display: block; width: 100%; aspect-ratio: 375 / 144; background: var(--bg); }
.w-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px 4px; }
.w-fields span:not(.w-label) { display: block; font-size: 13px; line-height: 1.25; }
.w-qr { display: flex; flex-direction: column; align-items: center; padding: 10px 0 14px; }
.w-qr span { width: 84px; height: 84px; background: #fff; border-radius: 6px;
  background-image: repeating-linear-gradient(90deg, #111 0 6px, transparent 6px 12px), repeating-linear-gradient(0deg, #111 0 6px, transparent 6px 12px);
  background-blend-mode: multiply; border: 8px solid #fff; }
.w-qr small { font-size: 10px; margin-top: 4px; opacity: .8; }

.admin-login { max-width: 360px; margin: 12vh auto; }
.admin-login form { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 12px; }
.admin-login label { font-weight: 600; font-size: 14px; }
.admin-login input { display: block; width: 100%; margin-top: 6px; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }

@media (max-width: 1100px) {
  .edit-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 720px) {
  main.admin { grid-template-columns: 1fr; padding: 12px; }
  .shops { position: static; }
  .pv-pair { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr auto; }
  .link-row .lbl { grid-column: 1 / -1; }
}

/* Self-serve owners: /start, /owner/login, /owner/forgot, /owner/reset and
   /owner (the same editor as /admin, one shop, no shop list). */
.owner-auth { max-width: 440px; margin: 8vh auto; padding: 0 16px; }
.owner-auth .brand { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.owner-auth .brand b { color: var(--ink); }
.owner-auth h1 { font-size: 26px; margin: 0 0 10px; }
.owner-auth .lead { color: var(--muted); line-height: 1.45; margin: 0 0 18px; }
.owner-auth small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.owner-auth .alt { font-size: 14px; color: var(--muted); margin-top: 16px; }
.owner-auth a { color: var(--ink); }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 8px 0 0; }
.fine code { font-size: 12px; overflow-wrap: anywhere; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.admin-bar .who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
main.admin.owner { grid-template-columns: minmax(0, 1fr); }
.tag.off { font-style: normal; font-size: 11px; font-weight: 600; color: #fff; background: #8a2b20; border-radius: 6px; padding: 1px 6px; }
.shops li small.owner-tag { color: #6b4f9a; }
.banner { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; font-size: 14px; }
.banner.off { background: #fbeae7; color: #8a2b20; border: 1px solid #f0c4bd; }
.steps { margin: 12px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.steps li { margin-bottom: 6px; }
.links.welcome p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.code-step { border: 1px solid #9ad4b0; background: #f1faf4; border-radius: 12px; padding: 14px; margin-top: 14px; }
.code-step p { margin: 0 0 10px; font-size: 14px; }
.code-row { display: flex; gap: 8px; }
#shop-form .code-row input { margin-top: 0; font-size: 22px; letter-spacing: .2em; max-width: 180px; }
.code-input { font-size: 24px !important; letter-spacing: .25em; }
.linkbtn { all: unset; cursor: pointer; text-decoration: underline; color: var(--ink); }
form.inline { display: contents; }

/* Owner setup steps (a new card on /owner). */
.wizard #shop-form { padding: 24px; }
.wstep h2 { font-size: 22px; margin: 2px 0 6px; }
.wstep-n { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wstep-hint { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.4; }
#shop-form .wstep input[name=name], #shop-form .wstep input[name=rewardText] { font-size: 18px; padding: 12px 14px; }
#shop-form input.pin-big { font-size: 28px !important; letter-spacing: .3em; max-width: 220px; font-family: ui-monospace, Menlo, monospace !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { appearance: none; border: 1px solid var(--line); background: #faf8f5; color: var(--ink); font: 500 13px/1 inherit; font-family: inherit; padding: 8px 11px; border-radius: 999px; cursor: pointer; }
.chip:hover { background: #fff; border-color: #cbbfae; }
.slug-more { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.slug-more summary { cursor: pointer; list-style: none; overflow-wrap: anywhere; }
.slug-more summary::-webkit-details-marker { display: none; }
.slug-more[open] summary { margin-bottom: 10px; }
.palettes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.palette { appearance: none; border: 2px solid transparent; border-radius: 12px; padding: 18px 6px 8px; font: 600 12px/1.1 inherit; font-family: inherit; cursor: pointer; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.palette span { position: absolute; top: 7px; left: 8px; width: 18px; height: 5px; border-radius: 3px; }
.palette.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.custom-colors { margin: 0 0 16px; font-size: 14px; }
.custom-colors summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }
.wizard .form-actions .abtn { min-width: 110px; }
.wizard .stamps-slider { display: none; }
.abtn[hidden] { display: none; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (max-width: 720px) {
  .wizard .pv-pair figure:last-child { display: none; }
  .wizard .preview { padding: 14px; }
  .wizard .preview-head { display: none; }
  .wizard .pv-pair > figure > div { max-width: 240px; margin: 0 auto; }
  .wizard .pv-pair figcaption { text-align: center; }
  .palettes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .admin-bar .who > :first-child, .admin-bar .who { font-size: 0; }
  .admin-bar .who form button { font-size: 14px; }
}

/* Messages to guests */
.messages .lead-in { margin: -4px 0 14px; font-size: 14px; line-height: 1.45; }
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.msg-write textarea {
  display: block; width: 100%; resize: vertical; font: 400 16px/1.4 inherit; font-family: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
}
.msg-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 12px; }
.msg-row small { color: var(--muted); }
.msg-row small.warn { color: #c0392b; }
.msg-write .fine { margin-top: 10px; }
.msg-write .ok { margin: 8px 0 0; }
.lock { margin: 0; padding: 18px 12px 10px; border-radius: 18px; background: linear-gradient(160deg, #3d4a5c, #1b2230); }
.lock figcaption { color: rgba(255,255,255,.7); font-size: 12px; text-align: center; margin-top: 10px; }
.lock-note {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  background: rgba(245,245,247,.92); border-radius: 16px; padding: 10px 12px; color: #111;
}
.lock-icon { width: 34px; height: 34px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.lock-body { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.lock-body b { display: block; font-size: 14px; }
.lock-note small { color: #666; font-size: 12px; }
.messages h4 { font-size: 14px; margin: 18px 0 8px; }
.msg-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.msg-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.msg-list p { margin: 0 0 4px; font-size: 15px; }
.msg-list small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 720px) {
  .msg-grid { grid-template-columns: 1fr; }
}
