/* THE ADD-INS' LOOK (docs/claude/LOYALTY.md section 5.9). MOBILE FIRST: one column, thumb-reach buttons of at least 44 px,
   16 px text and fields (a phone never zooms), nothing under 14 px a shopper reads, filters in a bottom sheet that may use the whole
   phone, the circular one page per screen with a swipe; a wide frame (640 px and up) gets the grid, a spread of two pages and a
   centred sheet. Held in a real browser at 300 / 320 / 375 / 414 and 1280 px by Tests/Loyalty/AddInsFitEveryScreenTests.

   THE CASCADE: the design system's layer order (design/contract.json "layers"), declared first, so a workspace's design
   (cv.design - the API's design door, the runner slot's sheet), its theme (cv.theme - the brand colours), THE BRAND'S OWN
   STYLESHEET (cv.host - look.js, from the page's own origin only) and the page's style options (cv.params) all win over our
   defaults below, whatever their specificity. Nothing here is an inline style a host cannot reach: a hotspot's place and a tier
   bar's fill ride custom properties (--lo-x / --lo-y / --lo-w / --lo-h, --lo-progress) that these rules read.

   RESTYLE THE ADD-INS (docs/loyalty/Loyalty-Website-Integration-Guide.md "Restyle the add-ins"): set the TOKENS - the design
   system's --cv-* colours, fonts, radii and spacing, and the add-ins' own --lo-* sizes below - and, where a token is not enough,
   the STABLE CLASSES: .lo-card (an offer card; .lo-kind-coupon / -deal / -reward / -giftCertificate), .lo-card-pic,
   .lo-card-title, .lo-value, .lo-worth, .lo-meta, .lo-clip, .lo-btn (+ .lo-btn-primary), .lo-link, .lo-chip, .lo-input,
   .lo-head, .lo-grid, .lo-strip, .lo-bar, .lo-sheet (+ .lo-sheet-head, .lo-sheet-title, .lo-sheet-body), .lo-hero (+ .lo-hero-strip), .lo-points,
   .lo-wallet-row, .lo-code (+ .lo-code-img, .lo-code-value), .lo-item-pass (+ .lo-btn-pass), .lo-page / .lo-hot (the circular),
   .lo-item-row, .lo-points-badge,
   .lo-join (the join form), .lo-field, .lo-birthday, .lo-consent / .lo-consent-option, .lo-gift-* (gift certificates), .lo-cert-* (the
   printed certificate). An open sheet in a tall frame carries .lo-banded on its .lo-backdrop (sheetband.js). */

@layer cv.locked, cv.reset, cv.tokens, cv.base, cv.layout, cv.components, cv.skin, cv.device, cv.theme, cv.design, cv.code, cv.host, cv.params;

@layer cv.tokens {
  :root {
    --cv-color-brand: #0f6b5c;
    --cv-color-ink: #18211f;
    --cv-color-paper: #ffffff;
    --cv-font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --cv-font-display: var(--cv-font-body);
    --cv-radius-s: 8px;
    --cv-radius-m: 14px;
    --cv-radius-l: 22px;
    --cv-space-1: 4px;
    --cv-space-2: 8px;
    --cv-space-3: 12px;
    --cv-space-4: 16px;
    --cv-space-5: 24px;
    --cv-space-6: 32px;
    --cv-shadow-1: 0 1px 2px rgba(16, 24, 22, .08), 0 1px 1px rgba(16, 24, 22, .04);
    --cv-shadow-2: 0 6px 18px rgba(16, 24, 22, .10);
    --cv-shadow-3: 0 18px 48px rgba(16, 24, 22, .22);
    --cv-motion-fast: 140ms;
    --cv-motion-slow: 280ms;
    --cv-surface: var(--cv-color-paper);
    --cv-on-surface: var(--cv-color-ink);
    --cv-accent: var(--cv-color-brand);
    --cv-on-accent: #ffffff;
    --cv-muted: #5c6b67;
    --cv-danger: #b42318;
    --cv-focus: #2f6fed;
    --cv-field-font-size: 16px;
    /* THE ADD-INS' OWN SIZES - one place to set them (a host stylesheet or a design sets them on :root). */
    --lo-text: 16px;                    /* reading text */
    --lo-text-small: 14px;              /* notes, dates, fine print - never smaller */
    --lo-tap: 44px;                     /* the least a button, a chip or a field is, each way */
    --lo-page-max: 1200px;              /* the widest the add-in's page runs */
    --lo-gap: var(--cv-space-3);        /* between cards and rows */
    --lo-card-min: 220px;               /* a card's least width in a wide frame's grid */
    --lo-card-pic: 96px;                /* a card's picture on a phone (a row: picture left) */
    --lo-card-radius: var(--cv-radius-m);
    --lo-row-pic: 64px;                 /* a wallet row's or an ad item's picture */
    --lo-btn-radius: 999px;             /* buttons and chips - set 8px for squarer ones */
    --lo-sheet-max: 480px;              /* a sheet's width on a wide frame (a phone's is the whole width) */
    --lo-points-size: 56px;             /* the member's points, BIG (the points badge's panel) */
    --lo-strip-points-size: 32px;       /* the member's points in the home and wallet add-ins' strip */
    --lo-scrim: rgba(10, 16, 14, .45);  /* the dimming behind a sheet */
    --lo-demo-paper: #fff3c4;           /* the "Demo" label's paper and ink */
    --lo-demo-ink: #5c4400;
  }
  :root[data-lo-theme="dark"] {
    --cv-color-ink: #eef3f1;
    --cv-color-paper: #121816;
    --cv-muted: #a3b2ad;
  }
}

@layer cv.reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  img { max-width: 100%; display: block; }
  button, input, select { font: inherit; color: inherit; }
  h1, h2, h3, p, figure { margin: 0; }
  /* HIDDEN MEANS HIDDEN: a component's own display (.lo-btn's inline-flex) beat the attribute, so the shelf's Show more stayed on
     screen with nothing more to show. Important in this early layer outranks every later layer - a design's too. */
  [hidden] { display: none !important; }
}

@layer cv.base {
  html { -webkit-text-size-adjust: 100%; color-scheme: light; }
  body {
    background: var(--cv-surface);
    color: var(--cv-on-surface);
    font-family: var(--cv-font-body);
    font-size: var(--lo-text);
    line-height: 1.45;
    /* A long product name, an amount or a code breaks rather than pushing the page sideways on a narrow phone. */
    overflow-wrap: anywhere;
  }
  :focus-visible { outline: 3px solid var(--cv-focus); outline-offset: 2px; }
  .lo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@layer cv.layout {
  #lo-root { padding: var(--cv-space-3) var(--cv-space-3) 96px; max-width: var(--lo-page-max); margin: 0 auto; }
  .lo-head { display: flex; align-items: center; gap: var(--cv-space-2); margin-bottom: var(--cv-space-3); flex-wrap: wrap; }
  .lo-head h1 { font-family: var(--cv-font-display); font-size: 22px; line-height: 1.2; flex: 1 1 12em; min-width: 0; }
  .lo-tools { display: flex; gap: var(--cv-space-2); align-items: center; flex-wrap: wrap; }
  .lo-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lo-gap); }
  .lo-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: var(--lo-gap); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--cv-space-2); }
  .lo-strip > * { scroll-snap-align: start; min-width: 0; }
  .lo-section { margin-top: var(--cv-space-5); }
  .lo-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--cv-space-2); margin-bottom: var(--cv-space-2); flex-wrap: wrap; }
  .lo-section-head h2 { font-size: 18px; font-family: var(--cv-font-display); }
  .lo-more { display: flex; justify-content: center; margin-top: var(--cv-space-4); }
  @media (min-width: 640px) {
    #lo-root { padding: var(--cv-space-4) var(--cv-space-4) var(--cv-space-5); }
    .lo-grid { grid-template-columns: repeat(auto-fill, minmax(min(var(--lo-card-min), 100%), 1fr)); }
    .lo-strip { grid-auto-columns: minmax(var(--lo-card-min), 1fr); }
    .lo-head h1 { font-size: 26px; }
  }
}

@layer cv.components {
  /* Buttons - at least 44 px tall: a thumb, not a mouse. */
  .lo-btn {
    min-height: var(--lo-tap); min-width: var(--lo-tap); max-width: 100%; padding: 0 var(--cv-space-4); border-radius: var(--lo-btn-radius);
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 18%, transparent);
    background: var(--cv-surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
    overflow-wrap: normal; text-align: center;
  }
  .lo-btn-primary { background: var(--cv-accent); color: var(--cv-on-accent); border-color: var(--cv-accent); }
  .lo-btn:disabled { opacity: .55; cursor: default; }
  .lo-link { background: none; border: 0; color: var(--cv-accent); font-weight: 600; min-height: var(--lo-tap); min-width: var(--lo-tap); padding: 0 var(--cv-space-2); cursor: pointer; overflow-wrap: normal; }
  .lo-icon-btn { flex: 0 0 auto; width: var(--lo-tap); height: var(--lo-tap); border-radius: 50%; border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; }
  .lo-count { min-width: 20px; height: 20px; border-radius: 10px; background: var(--cv-accent); color: var(--cv-on-accent); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

  /* The search box and the chips. */
  .lo-search { position: relative; flex: 1 1 100%; }
  .lo-input {
    width: 100%; min-height: max(48px, var(--lo-tap)); padding: 0 var(--cv-space-4); border-radius: var(--cv-radius-m);
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 22%, transparent); background: var(--cv-surface);
    font-size: var(--cv-field-font-size);
  }
  .lo-chips { display: flex; gap: var(--cv-space-2); overflow-x: auto; padding: 2px 0 var(--cv-space-3); scrollbar-width: none; }
  .lo-chip {
    flex: 0 0 auto; min-height: var(--lo-tap); padding: 0 var(--cv-space-4); border-radius: var(--lo-btn-radius); cursor: pointer; white-space: nowrap;
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 18%, transparent); background: var(--cv-surface); font-weight: 600;
  }
  .lo-chip[aria-pressed="true"] { background: var(--cv-on-surface); color: var(--cv-surface); border-color: var(--cv-on-surface); }
  .lo-results { color: var(--cv-muted); font-size: var(--lo-text-small); margin-bottom: var(--cv-space-2); }

  /* An offer card - a row on a phone (picture left, value big, Clip at the thumb), a tile on a wide frame. */
  .lo-card {
    display: grid; grid-template-columns: var(--lo-card-pic) minmax(0, 1fr); grid-template-rows: auto auto; gap: 0 var(--cv-space-3); align-items: start;
    padding: var(--cv-space-3); border-radius: var(--lo-card-radius); min-width: 0; background: var(--cv-surface); box-shadow: var(--cv-shadow-1);
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 9%, transparent); cursor: pointer; position: relative;
  }
  .lo-card-pic { grid-row: 1 / span 2; width: var(--lo-card-pic); aspect-ratio: 1; border-radius: var(--cv-radius-s); overflow: hidden; background: color-mix(in srgb, var(--cv-accent) 10%, var(--cv-surface)); }
  .lo-card-img { width: 100%; height: 100%; object-fit: cover; }
  .lo-card-pic-plain { display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; border: 2px dashed color-mix(in srgb, var(--cv-accent) 45%, transparent); }
  .lo-card-badge, .lo-row-badge { color: var(--cv-accent); font-weight: 800; font-size: 15px; line-height: 1.1; }
  .lo-value { color: var(--cv-accent); font-weight: 800; font-size: 20px; line-height: 1.15; letter-spacing: -.01em; }
  .lo-value-big { font-size: 30px; }
  .lo-worth { font-size: var(--lo-text-small); color: var(--cv-muted); font-weight: 600; }
  .lo-card-title { font-size: var(--lo-text); font-weight: 600; margin-top: 2px; }
  .lo-meta { font-size: var(--lo-text-small); color: var(--cv-muted); margin-top: 4px; }
  .lo-meta-note { color: var(--cv-on-surface); }
  .lo-card-act { grid-column: 2; margin-top: var(--cv-space-2); min-width: 0; }
  .lo-card-act > * { max-width: 100%; }
  .lo-clip {
    min-height: var(--lo-tap); min-width: min(96px, 100%); max-width: 100%; padding: 0 var(--cv-space-4); border-radius: var(--lo-btn-radius); font-weight: 700; cursor: pointer;
    overflow-wrap: normal;
    border: 2px solid var(--cv-accent); background: var(--cv-surface); color: var(--cv-accent);
  }
  .lo-clip.lo-clipped { background: var(--cv-accent); color: var(--cv-on-accent); }
  .lo-clip-wide { width: 100%; margin-top: var(--cv-space-4); }
  @media (min-width: 640px) {
    .lo-card { grid-template-columns: 1fr; grid-template-rows: auto; }
    .lo-card-pic { grid-row: auto; width: 100%; aspect-ratio: 4 / 3; margin-bottom: var(--cv-space-2); }
    .lo-card-act { grid-column: 1; }
  }

  /* The sticky clip bar - the wallet count (or Sign in) at the foot of the frame on a phone. */
  .lo-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--cv-space-3);
    padding: var(--cv-space-2) var(--cv-space-3) calc(var(--cv-space-2) + env(safe-area-inset-bottom)); background: var(--cv-surface);
    border-top: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06);
  }
  .lo-bar-text { font-weight: 600; font-size: var(--lo-text-small); flex: 1 1 auto; min-width: 0; }
  .lo-bar .lo-btn { flex: 0 0 auto; white-space: nowrap; }
  @media (min-width: 640px) {
    .lo-bar { position: static; border: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); border-radius: var(--cv-radius-m); margin-bottom: var(--cv-space-3); box-shadow: none; }
  }

  /* The bottom sheet - a sheet on a phone, a centred card on a wide frame. */
  .lo-backdrop { position: fixed; inset: 0; z-index: 20; background: var(--lo-scrim); display: flex; align-items: flex-end; justify-content: center; }
  .lo-sheet {
    width: 100%; max-height: 100vh; max-height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    background: var(--cv-surface); color: var(--cv-on-surface);
    border-radius: var(--cv-radius-l) var(--cv-radius-l) 0 0; padding: var(--cv-space-2) var(--cv-space-4) calc(var(--cv-space-5) + env(safe-area-inset-bottom));
    box-shadow: var(--cv-shadow-3); animation: lo-rise var(--cv-motion-slow) ease-out;
  }
  .lo-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--cv-space-2); position: sticky; top: 0; background: var(--cv-surface); padding: var(--cv-space-2) 0; }
  .lo-sheet-title { font-size: 18px; font-family: var(--cv-font-display); min-width: 0; }
  .lo-sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--cv-space-3); }
  @media (min-width: 640px) {
    .lo-backdrop { align-items: center; padding: var(--cv-space-4); }
    .lo-sheet { max-width: var(--lo-sheet-max); max-height: min(88vh, 880px); border-radius: var(--cv-radius-l); }
  }
  /* IN A TALL FRAME (an inline add-in that grows with its content) the sheet sits in THE BAND - the part of the frame on the shopper's
     screen, which app.js reads from the browser and sets as --lo-band-top / --lo-band-height / --lo-band-bottom - never at the foot of
     the whole frame, and never taller than the band. */
  .lo-backdrop.lo-banded { padding-top: var(--lo-band-top, 0px); padding-bottom: var(--lo-band-bottom, 0px); }
  .lo-backdrop.lo-banded .lo-sheet { max-height: var(--lo-band-height, 100dvh); }
  @media (min-width: 640px) {
    .lo-backdrop.lo-banded {
      padding: calc(var(--lo-band-top, 0px) + var(--cv-space-4)) var(--cv-space-4) calc(var(--lo-band-bottom, 0px) + var(--cv-space-4));
    }
    .lo-backdrop.lo-banded .lo-sheet { max-height: min(calc(var(--lo-band-height, 100dvh) - 2 * var(--cv-space-4)), 880px); }
  }
  @keyframes lo-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .lo-sheet { animation: none; } }

  .lo-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--cv-space-2); }
  .lo-label { font-weight: 600; }
  .lo-note { color: var(--cv-muted); font-size: var(--lo-text-small); }
  .lo-demo-thread { display: grid; gap: var(--cv-space-2); justify-items: start; padding: var(--cv-space-3); border-radius: var(--cv-radius-m); background: color-mix(in srgb, var(--cv-on-surface) 6%, var(--cv-surface)); }
  .lo-demo-bubble { margin: 0; padding: var(--cv-space-2) var(--cv-space-3); border-radius: var(--cv-radius-m); background: var(--cv-surface); }
  .lo-demo-chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cv-accent); color: var(--cv-accent); font-weight: 600; }
  .lo-lead { font-size: 16px; font-weight: 600; }
  .lo-text { font-size: 15px; }
  .lo-fine { font-size: var(--lo-text-small); color: var(--cv-muted); }
  .lo-error { color: var(--cv-danger); font-size: var(--lo-text-small); min-height: 1em; }
  .lo-error:empty { display: none; }
  .lo-row { display: flex; justify-content: space-between; flex-wrap: wrap; }
  .lo-code-input { letter-spacing: .4em; font-size: 22px; text-align: center; }
  .lo-sample { border-top: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); padding-top: var(--cv-space-3); display: grid; gap: var(--cv-space-2); }
  .lo-option { display: flex; align-items: center; gap: var(--cv-space-2); min-height: var(--lo-tap); }
  .lo-option input { flex: 0 0 auto; width: 22px; height: 22px; accent-color: var(--cv-accent); }
  .lo-fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 2px; }
  .lo-fieldset legend { font-weight: 700; margin-bottom: 4px; }
  .lo-sheet-actions { display: flex; gap: var(--cv-space-2); justify-content: flex-end; position: sticky; bottom: 0; background: var(--cv-surface); padding-top: var(--cv-space-2); }

  .lo-detail-img { width: 100%; border-radius: var(--cv-radius-m); aspect-ratio: 4 / 3; object-fit: cover; }
  .lo-code { display: grid; gap: var(--cv-space-3); justify-items: center; text-align: center; }
  .lo-code-img { width: 100%; max-width: 320px; background: #fff; padding: var(--cv-space-3); border-radius: var(--cv-radius-s); image-rendering: pixelated; }
  .lo-code-text { display: grid; gap: 2px; }
  .lo-code-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--cv-muted); }
  .lo-code-value { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: .08em; }

  /* The wallet - points BIG. */
  .lo-hero { border-radius: var(--cv-radius-l); padding: var(--cv-space-5) var(--cv-space-4); background: var(--cv-accent); color: var(--cv-on-accent); display: grid; gap: var(--cv-space-2); }
  .lo-hero-hi { font-size: 18px; font-weight: 600; }
  .lo-points { font-family: var(--cv-font-display); font-size: clamp(34px, 12vw, var(--lo-points-size)); font-weight: 800; line-height: 1; letter-spacing: -.02em;
    white-space: nowrap; overflow-wrap: normal; }
  .lo-points-word { font-size: 18px; font-weight: 600; opacity: .9; }
  .lo-hero-row { display: flex; gap: var(--cv-space-4); flex-wrap: wrap; font-weight: 600; }
  .lo-progress { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .3); overflow: hidden; }
  .lo-progress > span { display: block; width: var(--lo-progress, 0%); height: 100%; background: var(--cv-on-accent); }
  .lo-punch { display: flex; flex-wrap: wrap; gap: 6px; }
  .lo-punch > span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--cv-on-accent); }
  .lo-punch > span.lo-punched { background: var(--cv-on-accent); }
  .lo-wallet-list { display: grid; gap: var(--cv-space-2); }
  .lo-wallet-row {
    display: grid; grid-template-columns: var(--lo-row-pic) minmax(0, 1fr) auto; gap: var(--cv-space-3); align-items: center; text-align: left; width: 100%;
    min-height: 72px; padding: var(--cv-space-2) var(--cv-space-3); border-radius: var(--cv-radius-m); cursor: pointer;
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 10%, transparent); background: var(--cv-surface);
  }
  .lo-row-pic { width: var(--lo-row-pic); height: var(--lo-row-pic); border-radius: var(--cv-radius-s); overflow: hidden; display: flex; align-items: center; justify-content: center; }
  .lo-row-img { width: 100%; height: 100%; object-fit: cover; }
  .lo-row-body { display: grid; gap: 2px; min-width: 0; }
  .lo-row-body .lo-value { font-size: 17px; }
  .lo-row-title { font-weight: 600; }
  .lo-row-go { font-size: 28px; color: var(--cv-muted); }
  .lo-signin-card { border-radius: var(--cv-radius-l); padding: var(--cv-space-5) var(--cv-space-4); border: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); display: grid; gap: var(--cv-space-3); }
  .lo-signin-card h2 { font-family: var(--cv-font-display); font-size: 22px; }
  .lo-actions { display: flex; flex-wrap: wrap; gap: var(--cv-space-2); }
  .lo-demo { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; background: var(--lo-demo-paper); color: var(--lo-demo-ink); }

  /* The circular - one page per screen on a phone, a spread of two on a wide frame; hotspots over the page. */
  .lo-ad-head { display: grid; gap: 4px; margin-bottom: var(--cv-space-3); }
  .lo-flip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--cv-space-2); border-radius: var(--cv-radius-m); scrollbar-width: none; }
  .lo-flip::-webkit-scrollbar { display: none; }
  .lo-page { flex: 0 0 100%; scroll-snap-align: start; position: relative; background: color-mix(in srgb, var(--cv-on-surface) 6%, var(--cv-surface)); border-radius: var(--cv-radius-m); overflow: hidden; }
  .lo-page img { width: 100%; height: auto; }
  .lo-page-plain { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--cv-muted); }
  .lo-hot { position: absolute; left: var(--lo-x, 0); top: var(--lo-y, 0); width: var(--lo-w, 0); height: var(--lo-h, 0); border: 2px solid transparent; border-radius: var(--cv-radius-s); background: transparent; cursor: pointer; padding: 0; }
  .lo-hot:hover, .lo-hot:focus-visible { border-color: var(--cv-accent); background: color-mix(in srgb, var(--cv-accent) 14%, transparent); }
  .lo-hot-dot { position: absolute; right: 6px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--cv-accent); box-shadow: 0 0 0 3px rgba(255, 255, 255, .85); }
  .lo-flip-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--cv-space-2); margin: var(--cv-space-2) 0 var(--cv-space-4); }
  .lo-flip-count { font-weight: 600; color: var(--cv-muted); }
  .lo-item-row { display: grid; grid-template-columns: var(--lo-row-pic) minmax(0, 1fr) auto; gap: var(--cv-space-3); align-items: center; padding: var(--cv-space-2) 0; border-bottom: 1px solid color-mix(in srgb, var(--cv-on-surface) 9%, transparent); }
  .lo-item-row .lo-row-pic { background: color-mix(in srgb, var(--cv-on-surface) 6%, var(--cv-surface)); }
  .lo-was { text-decoration: line-through; color: var(--cv-muted); font-size: var(--lo-text-small); margin-left: 6px; }
  .lo-item-open { text-align: left; padding: 0; justify-content: flex-start; min-width: 0; }
  .lo-item-price { font-size: var(--lo-text); }
  .lo-search-list { margin-bottom: var(--cv-space-2); }
  @media (min-width: 640px) {
    .lo-page { flex-basis: calc(50% - var(--cv-space-1)); }
  }

  .lo-problem { display: grid; gap: var(--cv-space-3); justify-items: start; padding: var(--cv-space-5) var(--cv-space-2); }
  .lo-skeleton { height: 120px; border-radius: var(--cv-radius-m); background: color-mix(in srgb, var(--cv-on-surface) 7%, var(--cv-surface)); }
  .lo-toast {
    position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; z-index: 30; pointer-events: none;
    background: var(--cv-on-surface); color: var(--cv-surface); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: var(--lo-text-small);
    transition: opacity var(--cv-motion-fast), transform var(--cv-motion-fast); max-width: calc(100% - 32px); text-align: center;
  }
  .lo-toast-on { opacity: 1; transform: translate(-50%, 0); }
}

/* 15d / 15e - the points badge, the one sign-in sheet, the pending bag, the hero's actions */
@layer cv.components {
  /* A clip waiting in the bag for a sign-in - drawn as clipped, marked as not kept yet. */
  .lo-clip.lo-pending { background: transparent; color: var(--cv-accent); border-style: dashed; }
  .lo-deal-btn { white-space: normal; }
  .lo-deal-note { margin-top: var(--cv-space-3); }
  .lo-remember { margin: var(--cv-space-2) 0; }
  .lo-hero-note { font-size: var(--lo-text-small); opacity: .92; }
  .lo-hero-actions { display: flex; flex-wrap: wrap; gap: var(--cv-space-2); align-items: center; margin-top: var(--cv-space-2); }
  .lo-btn-on-dark { background: rgba(255, 255, 255, .16); color: var(--cv-on-accent); border-color: rgba(255, 255, 255, .55); }
  .lo-link-on-dark { color: var(--cv-on-accent); text-decoration: underline; }
  .lo-demo-on-dark { background: rgba(255, 255, 255, .92); }
  /* THE MEMBER'S STRIP (Kirk, 2026-11-09: "more of a strip - not the hero"): home and wallet. Phone: who + points, then the rest;
     640 px: the meter under who / points / actions; 960 px: one row. The badge's panel keeps the card. */
  .lo-hero-strip { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--cv-space-2) var(--cv-space-3); padding: var(--cv-space-3) var(--cv-space-4); }
  .lo-hero-strip .lo-hero-who { display: grid; gap: 2px; min-width: 0; }
  .lo-hero-strip .lo-hero-hi { font-size: 16px; }
  .lo-hero-strip .lo-hero-tier { font-size: var(--lo-text-small); opacity: .92; }
  .lo-hero-strip .lo-points { font-size: var(--lo-strip-points-size); justify-self: end; }
  .lo-hero-strip .lo-points-word { font-size: 15px; }
  .lo-hero-strip .lo-hero-meter, .lo-hero-strip .lo-hero-actions, .lo-hero-strip .lo-hero-demo { grid-column: 1 / -1; }
  .lo-hero-strip .lo-hero-meter { display: grid; gap: 6px; min-width: 0; }
  .lo-hero-strip .lo-hero-perk { font-size: 15px; }
  .lo-hero-strip .lo-progress { height: 6px; }
  .lo-hero-strip .lo-hero-visits { font-size: var(--lo-text-small); font-weight: 500; gap: 2px var(--cv-space-3); opacity: .92; }
  .lo-hero-strip .lo-hero-punch { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--cv-space-2); }
  .lo-hero-strip .lo-hero-punch .lo-hero-row { font-size: var(--lo-text-small); }
  .lo-hero-strip .lo-punch > span { width: 14px; height: 14px; }
  .lo-hero-strip .lo-hero-actions { margin-top: 0; }
  .lo-hero-strip .lo-hero-demo { font-size: var(--lo-text-small); font-weight: 500; gap: var(--cv-space-2); align-items: center; }
  @media (min-width: 640px) {
    .lo-hero-strip { grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--cv-space-2) var(--cv-space-5); padding: var(--cv-space-3) var(--cv-space-5); }
    .lo-hero-strip .lo-hero-who { grid-column: 1; }
    .lo-hero-strip .lo-points { grid-column: 2; }
    .lo-hero-strip .lo-hero-actions { grid-column: 3; justify-self: end; flex-wrap: nowrap; }
    .lo-hero-strip .lo-hero-meter { grid-column: 1 / -1; grid-row: 2; }
  }
  @media (min-width: 960px) {
    .lo-hero-strip { grid-template-columns: auto auto minmax(200px, 1fr) auto; }
    .lo-hero-strip .lo-points { justify-self: start; }
    .lo-hero-strip .lo-hero-meter { grid-column: 3; grid-row: 1; }
    .lo-hero-strip .lo-hero-actions { grid-column: 4; }
  }
  /* YOUR CARD ON YOUR PHONE - the buttons, and a demo's preview of the card a member adds. */
  .lo-btn-pass { background: var(--cv-on-surface); color: var(--cv-surface); border-color: var(--cv-on-surface); }
  /* KEEP IT ON YOUR PHONE - a held item's own pass, under its code (itempass.js). */
  .lo-item-pass { justify-self: stretch; display: grid; gap: var(--cv-space-2); justify-items: center; padding-top: var(--cv-space-3);
    border-top: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); }
  .lo-item-pass-title { font-size: 16px; }
  .lo-item-pass .lo-actions { justify-content: center; }
  .lo-pass {
    display: grid; gap: 4px; max-width: 320px; margin: var(--cv-space-2) 0; padding: var(--cv-space-4); border-radius: 16px;
    background: var(--cv-accent); color: var(--cv-on-accent); box-shadow: var(--cv-shadow-2);
  }
  .lo-pass p { margin: 0; }
  .lo-pass-program { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
  .lo-pass-name { font-size: 22px; font-weight: 800; }
  .lo-pass-row { font-size: 15px; }
  .lo-pass-code {
    display: block; height: 56px; margin-top: var(--cv-space-2); border-radius: 6px; border: 8px solid #fff;
    background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 7px, #fff 7px 9px);
  }
  .lo-pass-number { font-family: ui-monospace, monospace; font-size: 13px; text-align: center; }
  /* The thread's "Put it on my phone" (?focus=phone) - the section lit once as it comes into view. */
  .lo-spot { border-radius: var(--cv-radius-m); animation: lo-spot 2.4s ease-out 1; }
  @keyframes lo-spot {
    0%, 45% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cv-accent) 60%, transparent); }
    100% { box-shadow: 0 0 0 4px transparent; }
  }
  @media (prefers-reduced-motion: reduce) { .lo-spot { animation: none; outline: 3px solid var(--cv-accent); outline-offset: 4px; } }

  /* MY POINTS - the header badge: one tap target, at least 44 px, the program's mark, the points and the tier. */
  :root[data-lo-face="points"] body { background: transparent; }
  :root[data-lo-face="points"] #lo-root { padding: 2px; max-width: none; }
  .lo-points-box { display: grid; gap: var(--cv-space-2); }
  .lo-points-badge {
    justify-self: end; display: inline-flex; align-items: center; gap: var(--cv-space-2); min-height: var(--lo-tap); max-width: 100%;
    padding: 4px 14px 4px 4px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--cv-on-surface) 14%, transparent); background: var(--cv-surface);
    color: var(--cv-on-surface); font-weight: 700; cursor: pointer; box-shadow: var(--cv-shadow-1);
  }
  .lo-points-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--cv-accent); color: var(--cv-on-accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; }
  .lo-points-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lo-points-caret { opacity: .6; font-size: 12px; }
  .lo-points-badge[aria-expanded="true"] .lo-points-caret { transform: rotate(180deg); }
  /* The panel draws its OWN edge, inset so the frame (no shadow of its own, fitted to its content) never cuts it. */
  .lo-points-sheet {
    background: var(--cv-surface); border-radius: var(--cv-radius-l); padding: var(--cv-space-3); margin: 0 12px 28px;
    border: 1px solid color-mix(in srgb, var(--cv-on-surface) 12%, transparent); box-shadow: 0 8px 22px rgba(16, 24, 22, .16);
  }
  :root[data-lo-face="points"] .lo-section { margin-top: var(--cv-space-4); }
  /* On a phone-width frame the badge and the panel take the whole width (the points stay on one line) - room below for the shadow. */
  @media (max-width: 479px) {
    .lo-points-badge { justify-self: stretch; }
    .lo-points-sheet { padding: var(--cv-space-4) var(--cv-space-3) var(--cv-space-5); margin: 0 0 24px; }
  }
  /* In the core's floating or linked panel the panel is the page (straight in #lo-root; inline it sits in the badge's holder). */
  :root[data-lo-face="points"] #lo-root > .lo-points-sheet { box-shadow: none; border: 0; margin: 0; }
}

/* GIFT CERTIFICATES (LOYALTY.md 5.9): the gifts face's head and Check a balance, and the certificate page (/loyalty/gift/) with its
   PRINT stylesheet - one certificate on Letter or A4, everything else hidden. */
@layer cv.components {
  .lo-gift-head { margin: var(--cv-space-2) 0 var(--cv-space-4); }
  .lo-gift-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--cv-space-2); margin: var(--cv-space-2) 0 0; padding: 0; list-style: none; counter-reset: lo-step; }
  .lo-gift-how li { counter-increment: lo-step; padding: var(--cv-space-3); border-radius: var(--cv-radius-m); background: color-mix(in srgb, var(--cv-accent) 8%, var(--cv-surface)); font-weight: 600; font-size: var(--lo-text-small); }
  .lo-gift-how li::before { content: counter(lo-step); display: block; font-size: 20px; font-weight: 800; color: var(--cv-accent); }
  .lo-gift-how-title { font-size: 16px; margin: var(--cv-space-3) 0 0; }
  .lo-gift-balance { display: flex; gap: var(--cv-space-2); margin-top: var(--cv-space-2); }
  .lo-gift-balance .lo-input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
  .lo-gift-balance .lo-btn { flex: 0 0 auto; white-space: nowrap; }
  /* The amounts WRAP - never a strip that scrolls sideways, where Another amount would sit off a phone's screen. */
  .lo-chips.lo-gift-amounts { margin: var(--cv-space-2) 0; flex-wrap: wrap; overflow-x: visible; }
  .lo-gift-message { font-style: italic; }
  .lo-gift-send { font-size: 16px; margin: var(--cv-space-4) 0 var(--cv-space-1); }
  .lo-cert-note { margin: var(--cv-space-6) auto; max-width: 520px; text-align: center; }
  .lo-cert-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cv-space-3); max-width: 720px; margin: var(--cv-space-4) auto; }
  .lo-cert { max-width: 720px; margin: 0 auto var(--cv-space-6); padding: var(--cv-space-6); border: 2px solid var(--cv-accent); border-radius: var(--cv-radius-l); background: var(--cv-surface); color: var(--cv-on-surface); text-align: center; }
  .lo-cert p { margin: var(--cv-space-1) 0; }
  .lo-cert-logo { display: block; max-width: 240px; max-height: 64px; margin: 0 auto var(--cv-space-2); object-fit: contain; }
  .lo-cert-brand { font-size: 20px; font-weight: 800; }
  .lo-cert-title { font-size: 13px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--cv-accent); }
  .lo-cert-img { display: block; max-width: 100%; max-height: 200px; margin: var(--cv-space-3) auto; border-radius: var(--cv-radius-m); object-fit: cover; }
  .lo-cert-headline { font-size: 18px; font-weight: 700; }
  .lo-cert-sub { color: var(--cv-muted); }
  .lo-cert-amount { margin: var(--cv-space-4) 0; }
  .lo-cert-figure { font-size: 56px; font-weight: 800; line-height: 1.05; }
  .lo-cert-spelled { font-size: 15px; color: var(--cv-muted); }
  .lo-cert-gift { margin: var(--cv-space-3) auto; max-width: 480px; }
  .lo-cert-to { font-size: 18px; font-weight: 700; }
  .lo-cert-message { font-style: italic; white-space: pre-line; }
  .lo-cert-balance { font-weight: 700; }
  .lo-cert-code { margin: var(--cv-space-4) auto; padding: var(--cv-space-3); border: 1px dashed rgba(16, 24, 22, .3); border-radius: var(--cv-radius-m); max-width: 480px; }
  .lo-cert-code-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--cv-muted); }
  .lo-cert-code-value { font: 700 22px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; }
  .lo-cert-scan { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--cv-space-4); margin: var(--cv-space-2) 0; }
  .lo-cert-barcode { height: 72px; max-width: 100%; }
  .lo-cert-qr { width: 112px; height: 112px; }
  .lo-cert-hint { font-size: 12px; color: var(--cv-muted); }
  .lo-cert-how, .lo-cert-terms { text-align: left; margin: var(--cv-space-3) auto; max-width: 560px; padding-left: 20px; }
  .lo-cert-terms { font-size: 12px; color: var(--cv-muted); }
  .lo-cert-foot { font-size: 12px; color: var(--cv-muted); margin-top: var(--cv-space-4); }
  .lo-cert-cash { font-weight: 700; color: var(--cv-on-surface); }
  @media (max-width: 479px) { .lo-cert { padding: var(--cv-space-4); } .lo-cert-figure { font-size: 44px; } .lo-gift-how { grid-template-columns: 1fr; } }
  @media print {
    @page { size: auto; margin: 12mm; }
    :root[data-lo-face="gift"] body { background: #fff; }
    :root[data-lo-face="gift"] .lo-cert-tools, :root[data-lo-face="gift"] .lo-toast { display: none !important; }
    .lo-cert { max-width: none; width: 100%; margin: 0; padding: 10mm; border-color: #000; color: #000; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
    .lo-cert-img { max-height: 45mm; }
    .lo-cert-logo { max-height: 18mm; }
    .lo-cert-figure { font-size: 40pt; }
    .lo-cert-terms, .lo-cert-foot, .lo-cert-sub, .lo-cert-spelled, .lo-cert-hint { color: #333; }
  }
}

/* ON A PHONE, IN A NARROW COLUMN AND ON A DESKTOP (Tests/Loyalty/AddInsFitEveryScreenTests): the home's ad row, the join form, the
   certificate's fine print on screen (the print stylesheet above is untouched). */
@layer cv.components {
  .lo-ad-row { grid-template-columns: var(--lo-card-pic) minmax(0, 1fr) auto; }
  .lo-ad-cover { width: var(--lo-card-pic); height: calc(var(--lo-card-pic) * 4 / 3); }
  .lo-row-link { color: var(--cv-accent); font-weight: 600; }
  .lo-join-points { color: var(--cv-accent); font-weight: 700; }
  .lo-field { display: grid; gap: 4px; }
  .lo-optional { font-weight: 400; color: var(--cv-muted); font-size: var(--lo-text-small); }
  /* The join form's birthday - a month and a day picked from lists, in the order the shopper's language says a date. */
  .lo-birthday { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--cv-space-2); }
  .lo-birthday.lo-birthday-dayfirst { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .lo-consent { display: grid; gap: 2px; justify-items: start; }
  .lo-consent .lo-option, .lo-consent-option { align-items: flex-start; padding: 10px 0; }
  .lo-consent .lo-option input, .lo-consent-option input { margin-top: 2px; }
  .lo-terms { width: 100%; }
  .lo-terms summary { display: inline-flex; align-items: center; min-height: var(--lo-tap); cursor: pointer; }
  .lo-terms-text { font-size: var(--lo-text-small); color: var(--cv-muted); white-space: pre-line; padding-bottom: var(--cv-space-2); }
  @media screen {
    .lo-cert-terms, .lo-cert-foot, .lo-cert-hint { font-size: var(--lo-text-small); }
  }
}
