/* =========================================================
   Andika List · public site
   Mobile-first, themeable, light on data. No icon fonts, no emoji.
   ========================================================= */

/* ---------- Reset ---------- */

  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { margin: 0; }
  img, svg { display: block; }
  button, input, select, textarea { font: inherit; color: inherit; }
  h1, h2, h3, p { margin: 0; }
  ul, ol { margin: 0; padding: 0; }


/* ---------- Theme tokens ---------- */

  :root {
    --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "Roboto Mono", "Droid Sans Mono", monospace;
    --f-hand: var(--f-mono);
    --f-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --r-s: 10px; --r-m: 14px; --r-l: 20px; --r-xl: 26px;
    --gap: 16px;
    --tap: 48px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --shadow-paper: 6px 8px 0 var(--bg-2);
    --shadow-soft: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .08);
  }

  [data-theme="krismasi"] {
    --bg: #0B5D3B; --bg-2: #08442B; --bg-3: #1D6B4A;
    --on-bg: #F3F7F4; --on-bg-2: #CFE3D7; --on-bg-3: #A9C7B6;
    --accent: #F2C14E; --on-accent: #1F1604;
    --page: #F3F6F4; --surface: #FFFFFF; --surface-ink: #12241A; --surface-ink-2: #3E5246; --surface-line: #DCE5DF; --surface-tint: #E3F3EA;
    --paper: #FFFFFF; --paper-2: #F7F9FE; --ink: #1B2440; --ink-2: #4A5370; --rule: #C9D6EE; --margin: #EDB0B0;
    --brand: #0B5D3B; --ok: #7BD3A4; --wa: #1E8E54;
    --danger: #8E2116; --danger-bg: #FBE7E4;
  }
  [data-theme="usiku"] {
    --bg: #101A2E; --bg-2: #0A1222; --bg-3: #23314F;
    --on-bg: #F5F1E8; --on-bg-2: #C9CEDA; --on-bg-3: #A3ABBE;
    --accent: #F0B544; --on-accent: #1C1405;
    --page: #F2F1EC; --surface: #FFFFFF; --surface-ink: #141A28; --surface-ink-2: #454C5E; --surface-line: #E0DED6; --surface-tint: #FBF1DC;
    --paper: #FFFDF7; --paper-2: #F7F4EA; --ink: #1B2033; --ink-2: #505872; --rule: #D9D3C2; --margin: #E8A9A0;
    --brand: #101A2E; --ok: #F0B544; --wa: #1E8E54;
    --danger: #8E2116; --danger-bg: #FBE7E4;
  }
  [data-theme="nairobi"] {
    --bg: #8F1A1A; --bg-2: #6B1111; --bg-3: #A83434;
    --on-bg: #FFF6EC; --on-bg-2: #F3D9C9; --on-bg-3: #E5BFAE;
    --accent: #F2C14E; --on-accent: #2A1A05;
    --page: #FBF5F0; --surface: #FFFFFF; --surface-ink: #2A1410; --surface-ink-2: #5B4540; --surface-line: #EAD9D0; --surface-tint: #FBEADF;
    --paper: #FFFFFF; --paper-2: #FBF6F1; --ink: #2A1A33; --ink-2: #5E4E63; --rule: #E6D3D8; --margin: #E9A3A3;
    --brand: #8F1A1A; --ok: #F2C14E; --wa: #1E8E54;
    --danger: #8E2116; --danger-bg: #FBE7E4;
  }
  [data-theme="safi"] {
    --bg: #F4F7F5; --bg-2: #E4ECE7; --bg-3: #D2E0D7;
    --on-bg: #13231A; --on-bg-2: #3E5246; --on-bg-3: #5A6E62;
    --accent: #0B7A4B; --on-accent: #FFFFFF;
    --page: #F4F7F5; --surface: #FFFFFF; --surface-ink: #13231A; --surface-ink-2: #3E5246; --surface-line: #DCE5DF; --surface-tint: #E3F3EA;
    --paper: #FFFFFF; --paper-2: #F7F9FE; --ink: #1B2440; --ink-2: #4A5370; --rule: #C9D6EE; --margin: #EDB0B0;
    --brand: #0B7A4B; --ok: #0B7A4B; --wa: #1E8E54;
    --danger: #8E2116; --danger-bg: #FBE7E4;
    --shadow-paper: 0 2px 0 var(--bg-3), var(--shadow-soft);
  }


/* ---------- Base ---------- */

  body {
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--on-bg);
    min-height: 100vh; min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
  }
  body.light { background: var(--page); color: var(--surface-ink); }
  a { color: var(--accent); text-underline-offset: 3px; }
  :where(body.light) a { color: var(--brand); }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
  body.light :focus-visible { outline-color: var(--brand); }
  .skip { position: absolute; left: -999px; top: 8px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
  .skip:focus { left: 8px; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ic { flex: none; }
  [hidden] { display: none !important; }
  ::selection { background: var(--accent); color: var(--on-accent); }


/* ---------- Layout ---------- */

  .wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
  .narrow { max-width: 520px; }
  .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
  .bar { background: var(--brand); color: #fff; }
  [data-theme="safi"] .bar { color: #fff; }
  .bar .top { padding-block: 8px; }
  .bar a { color: inherit; }

  .home-grid { display: grid; gap: 28px; padding-bottom: 40px; }
  @media (min-width: 900px) {
    .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); align-items: start; gap: 56px; padding-top: 24px; }
    .home-grid .hero { position: sticky; top: 24px; padding-top: 24px; }
  }
  .stack { display: flex; flex-direction: column; gap: var(--gap); }
  .main { flex: 1; }
  .foot { padding: 28px 20px 40px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--on-bg-3); }
  body.light .foot { color: var(--surface-ink-2); }
  .foot a { color: inherit; }


/* ---------- Components ---------- */

  .strip {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 36px; padding: 6px 16px; text-align: center;
    background: var(--accent); color: var(--on-accent);
    font-size: 13px; font-weight: 700; letter-spacing: .01em;
  }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; position: relative; }
  .strip .dot { background: #B3261E; }
  .strip .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #B3261E; opacity: 0; animation: ping 2s var(--ease) infinite; }

  .brand { font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--on-bg); text-decoration: none; }
  .brand span { color: var(--accent); }
  .bar .brand, body.light .brand { color: inherit; }
  .bar .brand span { color: var(--accent); }
  [data-theme="safi"] .bar .brand span { color: #CFF2DE; }

  .link-quiet { color: var(--on-bg-2); text-decoration: none; font-size: 14px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }

  /* Buttons */
  .btn {
    --b-bg: var(--accent); --b-fg: var(--on-accent);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px; padding: 0 22px; border: 0; border-radius: var(--r-m);
    background: var(--b-bg); color: var(--b-fg);
    font-weight: 800; font-size: 17px; letter-spacing: -.005em; text-decoration: none; cursor: pointer;
    transition: transform .15s var(--ease), filter .15s, box-shadow .2s;
    box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 6px 18px -8px rgba(0, 0, 0, .12); box-shadow: 0 1px 0 rgb(255 255 255 / .25) inset, 0 6px 18px -8px color-mix(in srgb, var(--b-bg) 70%, black);
    -webkit-tap-highlight-color: transparent;
  }
  .btn:hover { filter: brightness(1.04); }
  .btn:active { transform: translateY(1px) scale(.99); }
  .btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }
  .btn.block { width: 100%; }
  .btn.brand-btn { --b-bg: var(--brand); --b-fg: #fff; }
  .btn.ink { --b-bg: var(--ink); --b-fg: #fff; min-height: 50px; font-size: 15px; }
  .btn.wa { --b-bg: var(--wa); --b-fg: #fff; }
  .btn.ghost { --b-bg: transparent; --b-fg: currentColor; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .12); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, currentColor 35%, transparent); }
  .btn.small { min-height: 44px; font-size: 14px; padding: 0 16px; }

  /* Pills / steps */
  .steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
  .steps li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--bg-2); font-size: 13px; font-weight: 600; }
  .steps b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; }
  [data-theme="safi"] .steps li { background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-line); }

  /* Hero */
  .hero h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(42px, 11vw, 76px); line-height: .94; letter-spacing: -.045em; text-wrap: balance; }
  .hero h1 em { font-style: normal; color: var(--accent); display: block; }
  .hero p.lead { font-size: 17px; color: var(--on-bg-2); max-width: 46ch; text-wrap: pretty; }
  .hero .stack { gap: 18px; }

  /* Notebook */
  .book-wrap { position: relative; padding-left: 6px; container-type: inline-size; }
  .holes { position: absolute; left: -2px; top: 28px; bottom: 28px; display: flex; flex-direction: column; justify-content: space-between; z-index: 2; pointer-events: none; }
  .holes span { width: 16px; height: 16px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 2px 0 rgb(0 0 0 / .28); }
  .book {
    position: relative; border-radius: 10px 20px 20px 10px; background: var(--paper); color: var(--ink);
    box-shadow: var(--shadow-paper); overflow: hidden;
  }
  .book::before { content: ""; position: absolute; left: 44px; top: 0; bottom: 0; width: 2px; background: var(--margin); z-index: 1; pointer-events: none; }
  .book-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 22px 16px 12px 58px; border-bottom: 2px solid var(--rule); }
  .book-title { font-family: var(--f-hand); font-size: 36px; font-weight: 700; line-height: 1; }
  .book-date { font-family: var(--f-hand); font-size: 20px; color: var(--ink-2); }
  .book-count { font-family: var(--f-hand); font-size: 23px; font-weight: 700; color: #B3261E; rotate: -6deg; white-space: nowrap; }

  .items { list-style: none; }
  .item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-height: 60px; padding: 6px 8px 6px 58px; border-bottom: 1px solid var(--rule); }
  .item-name { font-family: var(--f-hand); font-size: 25px; font-weight: 600; line-height: 1.05; overflow-wrap: anywhere; }
  .item-sub { display: block; font-family: var(--f-body); font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
  .item-line { width: 84px; text-align: right; font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .qty { display: inline-flex; align-items: center; border: 1.5px solid var(--rule); border-radius: 999px; background: var(--paper); }
  .qty button { width: 38px; height: 40px; border: 0; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
  .qty button:hover { background: var(--paper-2); }
  .qty output { min-width: 18px; text-align: center; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .empty { padding: 26px 16px 26px 58px; font-family: var(--f-hand); font-size: 24px; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
  @container (max-width: 420px) {
    .item { grid-template-columns: minmax(0, 1fr) auto; }
    .item-line { display: none; }
  }

  /* Add + suggestions */
  .add { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 14px 16px 58px; background: var(--paper-2); border-bottom: 1px solid var(--rule); }
  .add label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
  .search { position: relative; }
  .search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
  .input, .select, .textarea {
    width: 100%; min-height: 52px; padding: 0 14px; border-radius: 12px;
    border: 1.5px solid var(--rule); background: #fff; color: var(--ink); font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
  }
  .textarea { padding: 12px 14px; min-height: 120px; resize: vertical; }
  .search .input { padding-left: 42px; border: 2px solid var(--ink); }
  .input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(242, 193, 78, .45); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
  body.light .input, body.light .select, body.light .textarea { border-color: rgba(0, 0, 0, .12); border-color: color-mix(in srgb, var(--surface-ink) 25%, transparent); color: var(--surface-ink); }
  body.light .input:focus, body.light .select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(11, 93, 59, .18); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }

  .suggest { list-style: none; padding: 4px; border-radius: 12px; background: #fff; border: 1.5px solid var(--rule); box-shadow: var(--shadow-soft); }
  .suggest button {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    min-height: 52px; padding: 6px 10px; border: 0; border-radius: 9px; background: none; text-align: left; color: var(--ink); cursor: pointer;
  }
  .suggest button:hover, .suggest [aria-selected="true"] button { background: var(--paper-2); }
  .suggest .s-name { font-size: 15px; font-weight: 600; display: block; }
  .suggest .s-name mark { background: none; color: inherit; font-weight: 800; }
  .suggest .s-note { font-size: 12px; color: var(--ink-2); }
  .price-pill { flex: none; padding: 6px 10px; border-radius: 999px; background: #E3F3EA; background: color-mix(in srgb, var(--brand) 12%, white); color: var(--brand); font-size: 13px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
  [data-theme="usiku"] .price-pill { background: #FBF1DC; color: #6A4A06; }
  [data-theme="nairobi"] .price-pill { background: #FBEADF; color: #7A1616; }

  .bands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .unknown { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: #fff; border: 1.5px dashed var(--rule); }
  .unknown p { font-size: 13px; font-weight: 600; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px;
    border-radius: 999px; border: 1.5px solid var(--rule); background: #fff; color: var(--ink);
    font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
  }
  .chip:hover { border-color: var(--ink-2); }
  .chip:active { transform: scale(.97); }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .popular { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 18px 58px; }
  .popular h3 { font-size: 12px; font-weight: 700; color: var(--ink-2); }
  .fine { font-size: 11.5px; color: var(--ink-2); line-height: 1.45; }

  .msg { padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: 13px; font-weight: 600; line-height: 1.4; }

  /* Total */
  .total { display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: var(--r-l); background: var(--bg-2); }
  [data-theme="safi"] .total { background: var(--surface); box-shadow: var(--shadow-soft); }
  .total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .total-row .lbl { font-size: 14px; font-weight: 600; color: var(--on-bg-2); }
  .total-amt { font-family: var(--f-display); font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .meter { height: 14px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
  .meter > span { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: var(--ok); transition: width .5s var(--ease), background .3s; }
  .meter.full > span { background: var(--accent); }
  .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--on-bg-2); font-variant-numeric: tabular-nums; }
  .nudge { padding: 10px 12px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; }
  .center-note { font-size: 12px; text-align: center; color: var(--on-bg-3); }

  /* Info cards on dark */
  .info { display: grid; gap: 12px; }
  .info-card { display: flex; gap: 14px; padding: 16px; border-radius: 16px; background: var(--bg-2); }
  [data-theme="safi"] .info-card { background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-line); }
  .info-card .ic { color: var(--accent); margin-top: 2px; }
  .info-card p { font-size: 14px; line-height: 1.5; color: var(--on-bg-2); }
  .info-card strong { color: var(--on-bg); }
  h2.sec { font-family: var(--f-display); font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

  /* Light pages: cards and fields */
  .card { padding: 22px 20px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--surface-line); color: var(--surface-ink); }
  .card h2 { font-family: var(--f-display); font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
  .card.brand-card { background: var(--brand); color: #fff; border: 0; }
  .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
  .field .hint { font-weight: 500; color: var(--surface-ink-2); }
  .field-error { color: var(--danger); font-weight: 600; font-size: 13px; }
  .check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--surface-ink-2); }
  .check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }

  .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: #E6EEE9; background: color-mix(in srgb, var(--brand) 10%, var(--page)); }
  .seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s, color .2s; }
  .seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
  .seg label.is-on { background: var(--brand); color: #fff; box-shadow: var(--shadow-soft); }
  .seg label:has(input:checked) { background: var(--brand); color: #fff; box-shadow: var(--shadow-soft); }
  .seg label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

  .recap { list-style: none; }
  .recap li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--surface-line); }
  .recap .h { font-family: var(--f-hand); font-size: 23px; font-weight: 600; color: var(--ink); line-height: 1.1; }
  .recap .p { font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
  .sum-row.big { padding-top: 12px; border-top: 1px solid rgb(255 255 255 / .2); align-items: baseline; font-size: 15px; font-weight: 700; }
  .sum-row.big b { font-family: var(--f-display); font-size: 32px; color: var(--accent); }
  [data-theme="safi"] .card.brand-card .sum-row.big b { color: #CFF2DE; }
  .tip { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--page); font-size: 13px; line-height: 1.45; color: var(--surface-ink-2); }
  .tip .ic { color: var(--brand); }

  /* Progress header */
  .progress { height: 4px; background: rgb(0 0 0 / .2); }
  .progress span { display: block; height: 100%; width: var(--p); background: var(--accent); }

  /* Waiting */
  .ring { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin-inline: auto; color: var(--brand); }
  .ring svg.track { position: absolute; inset: 0; rotate: -90deg; }
  .ring circle { fill: none; stroke-width: 8; }
  .ring .bg { stroke: #DCEBE2; stroke: color-mix(in srgb, var(--brand) 14%, white); }
  .ring .fg { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: var(--off, 0); transition: stroke-dashoffset 1s linear; }
  .ring.ok .fg { stroke: #1E8E54; }
  .ring.bad .fg { stroke: var(--danger); }
  .wait-title { font-family: var(--f-display); font-size: 32px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; text-align: center; }
  .kv { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--page); font-size: 14px; }
  .kv div { display: flex; justify-content: space-between; gap: 12px; }
  .kv dt { color: var(--surface-ink-2); }
  .kv dd { margin: 0; font-weight: 700; text-align: right; }
  .divider { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--surface-ink-2); }
  .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--surface-line); }
  .paybill { list-style: none; display: grid; gap: 8px; counter-reset: s; }
  .paybill li { counter-increment: s; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--page); font-size: 14px; }
  .paybill li::before { content: counter(s) "."; font-weight: 800; color: var(--brand); margin-right: 6px; }
  .paybill li span { flex: 1; color: var(--surface-ink-2); }
  .paybill b { font-family: var(--f-display); font-size: 19px; font-variant-numeric: tabular-nums; }
  .bullets { padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.45; color: var(--surface-ink-2); }

  /* Done */
  .badge-ok { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); margin-inline: auto; box-shadow: 0 0 0 10px rgba(242, 193, 78, .22); box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 22%, transparent); }
  .done-title { font-family: var(--f-display); font-size: clamp(38px, 10vw, 54px); line-height: 1; font-weight: 800; letter-spacing: -.035em; text-align: center; }
  .pass { border-radius: 22px; background: var(--paper); color: var(--ink); overflow: hidden; box-shadow: var(--shadow-soft); }
  .pass-top { padding: 20px; display: grid; gap: 4px; }
  .pass-tag { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
  .pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; background: #E3F3EA; background: color-mix(in srgb, var(--brand) 12%, white); color: var(--brand); }
  .pill.wait { background: #FFF4D6; color: #7A5600; }
  .pass-name { font-family: var(--f-hand); font-size: 34px; font-weight: 700; line-height: 1.05; }
  .pass-meta { font-size: 14px; color: var(--ink-2); }
  .pass-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 2px dashed var(--rule); }
  .pass-grid div { padding: 14px 20px; display: grid; gap: 2px; }
  .pass-grid div + div { border-left: 1px solid var(--rule); }
  .pass-grid small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
  .pass-grid b { font-family: var(--f-display); font-size: 19px; }

  .earn { display: grid; gap: 14px; padding: 22px; border-radius: 24px; background: var(--bg-2); }
  [data-theme="safi"] .earn { background: var(--surface); box-shadow: var(--shadow-soft); }
  .earn-tag { justify-self: start; padding: 6px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
  .earn h2 { font-family: var(--f-display); font-size: 31px; line-height: 1.02; font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
  .earn h2 span { color: var(--accent); }
  .earn p { font-size: 14px; color: var(--on-bg-2); }
  .tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 14px 6px; border-radius: 14px; background: var(--bg); text-align: center; display: grid; gap: 2px; }
  [data-theme="safi"] .tile { background: var(--page); }
  .tile b { font-family: var(--f-display); font-size: 23px; font-variant-numeric: tabular-nums; }
  .tile b.gold { color: var(--accent); }
  .tile small { font-size: 11px; color: var(--on-bg-2); }
  .payout { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--bg); }
  [data-theme="safi"] .payout { background: var(--page); }
  .payout .meter { height: 10px; }
  .payout .meter > span { background: var(--accent); }
  .linkbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: #fff; color: var(--ink); }
  .linkbox input { flex: 1; min-width: 0; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--ink); }
  .linkbox input:focus { outline: none; }
  .share-card { justify-self: center; width: min(250px, 80%); padding: 16px; border-radius: 14px; background: var(--paper); color: var(--ink); rotate: -2deg; display: grid; gap: 6px; box-shadow: 4px 6px 0 rgb(0 0 0 / .22); }
  .share-card .t { font-family: var(--f-hand); font-size: 25px; font-weight: 700; line-height: 1; }
  .share-card .l { font-family: var(--f-hand); font-size: 19px; color: var(--ink-2); line-height: 1.1; }
  .share-card .c { margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; text-align: center; }
  .row-link { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 18px; border-radius: 14px; background: var(--bg-2); color: var(--on-bg); text-decoration: none; font-weight: 700; }
  [data-theme="safi"] .row-link { background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-line); }
  .row-link .ic { color: var(--accent); }
  .warn-card { display: flex; gap: 12px; padding: 16px; border-radius: 14px; border: 1.5px solid var(--bg-3); font-size: 13px; line-height: 1.5; color: var(--on-bg-2); }
  .warn-card .ic { color: var(--accent); }

  .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); font-size: 14px; font-weight: 600; }

  .toast {
    position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 30;
    padding: 12px 18px; border-radius: 999px; background: #13231A; color: #fff; font-size: 14px; font-weight: 700;
    box-shadow: var(--shadow-soft); transition: opacity .25s, translate .25s var(--ease);
  }
  .toast[hidden] { display: block !important; opacity: 0; translate: -50% 12px; pointer-events: none; }


/* ---------- Motion ---------- */

  @keyframes ping { 0% { opacity: .9; scale: .6; } 80%, 100% { opacity: 0; scale: 1.8; } }
  @keyframes rise { from { opacity: 0; translate: 0 8px; } }
  @keyframes pop { 0% { scale: .6; opacity: 0; } 60% { scale: 1.08; opacity: 1; } 100% { scale: 1; } }

  .item { animation: rise .35s var(--ease) both; }
  .badge-ok { animation: pop .6s var(--ease) both; }
  .suggest { animation: rise .18s var(--ease) both; }
  .reveal { animation: rise .5s var(--ease) both; }
  .reveal:nth-child(2) { animation-delay: .06s; }
  .reveal:nth-child(3) { animation-delay: .12s; }
  .reveal:nth-child(4) { animation-delay: .18s; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
  }


/* Handwritten list title inside light cards */
 .card .book-title { font-family: var(--f-hand); font-weight: 700; } 

/* =========================================================
   Compact layout: less scrolling, docked actions, small phones
   ========================================================= */

  .muted { color: var(--surface-ink-2); font-size: 14px; }
  .muted-on { color: var(--on-bg-3); }
  .brand-text { color: var(--brand); }
  .show-s { display: none; }
  .tight-stack { gap: 10px; }
  .page-tight { padding-top: 16px; padding-bottom: 24px; gap: 12px; }

  /* Header bar on light pages */
  .bar-back { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; color: #fff; border-radius: 12px; }
  .bar-title { flex: 1; min-width: 0; font-family: var(--f-display); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bar-step { font-size: 12px; font-weight: 700; opacity: .8; white-space: nowrap; }

  /* Pay: collapsible recap */
  .recap-box { padding: 0; }
  .recap-box > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 56px; }
  .recap-box > summary::-webkit-details-marker { display: none; }
  .recap-sum { display: flex; flex-direction: column; line-height: 1.15; font-size: 14px; color: var(--surface-ink-2); }
  .recap-sum .book-title { font-size: 26px; color: var(--ink); }
  .recap-sum b { color: var(--surface-ink); }
  .recap-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--brand); }
  .recap-more .ic { transition: rotate .2s var(--ease); }
  .recap-box[open] .recap-more .ic { rotate: 90deg; }
  .recap-box .recap { padding: 0 16px; border-top: 1px solid var(--surface-line); }
  .recap-edit { display: inline-flex; align-items: center; gap: 6px; padding: 12px 16px 14px; font-size: 14px; font-weight: 700; }

  /* Pay: cost strip */
  .cost { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: var(--r-l); background: var(--brand); color: #fff; overflow: hidden; }
  .cost div { padding: 12px 12px; display: grid; gap: 2px; }
  .cost div + div { border-left: 1px solid rgb(255 255 255 / .16); }
  .cost small { font-size: 11px; line-height: 1.25; opacity: .8; }
  .cost b { font-family: var(--f-display); font-size: 18px; line-height: 1.1; white-space: nowrap; }
  .cost b.ok { color: var(--ok); }
  .cost div:first-child b { color: var(--accent); font-size: 20px; }
  [data-theme="safi"] .cost div:first-child b, [data-theme="safi"] .cost b.ok { color: #CFF2DE; }

  .details-form { gap: 14px; }
  fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

  /* Wait */
  .wait-card { align-items: center; text-align: center; gap: 12px; }
  .wait-card .kv { width: 100%; text-align: left; margin: 0; }
  .help { padding: 0; }
  .help > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; min-height: 56px; cursor: pointer; }
  .help > summary::-webkit-details-marker { display: none; }
  .help > summary h2 { font-size: 18px; }
  .help > summary .ic { transition: rotate .2s var(--ease); color: var(--surface-ink-2); }
  .help[open] > summary .ic { rotate: 90deg; }
  .help-body { padding: 0 18px 18px; gap: 12px; }

  /* Done */
  .done-page { padding-top: 22px; padding-bottom: 8px; gap: 14px; }
  .done-hero { display: flex; align-items: center; gap: 14px; }
  .done-hero .badge-ok { flex: none; width: 58px; height: 58px; margin: 0; box-shadow: 0 0 0 7px rgba(242, 193, 78, .22); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); }
  .done-hero .badge-ok.wait { background: var(--bg-2); color: var(--accent); }
  .done-hero .done-title { text-align: left; font-size: clamp(28px, 8vw, 40px); }
  .done-hero p { font-size: 14px; color: var(--on-bg-2); margin-top: 4px; }
  .earn { gap: 12px; padding: 18px; grid-template-columns: minmax(0, 1fr); }
  .earn > *, .pass > *, .stack > * { min-width: 0; }

  /* How picks work */
  .how { padding-top: 8px; padding-bottom: 8px; }

  /* ---------- Phones ---------- */
  @media (max-width: 899px) {
    .strip { min-height: 30px; padding: 4px 12px; font-size: 12px; }
    .top { padding-block: 10px; }
    .brand { font-size: 20px; }
    .home-grid { gap: 16px; padding-bottom: 0; }
    .hero .stack { gap: 12px; }
    .hero h1 { font-size: clamp(32px, 9.4vw, 44px); line-height: .95; }
    .hero p.lead { font-size: 15px; line-height: 1.45; }
    .steps { flex-wrap: nowrap; gap: 6px; }
    .steps li { padding: 5px 10px 5px 5px; font-size: 12px; white-space: nowrap; gap: 6px; }
    .steps b { width: 20px; height: 20px; font-size: 11px; }

    /* Notebook */
    .book::before { left: 38px; }
    .holes { top: 22px; bottom: 22px; }
    .holes span { width: 13px; height: 13px; }
    .book-head { padding: 14px 12px 8px 50px; }
    .book-title { font-size: 29px; }
    .book-date { font-size: 17px; }
    .book-count { font-size: 20px; }
    .item { min-height: 50px; padding: 5px 6px 5px 50px; gap: 6px; }
    .item-sub { font-weight: 700; color: var(--ink); opacity: .75; }
    .item-name { font-size: 22px; }
    .item-sub { font-size: 11.5px; }
    .item-line { width: 74px; font-size: 13px; }
    .qty button { width: 34px; height: 36px; }
    .empty { padding: 14px 12px 14px 50px; font-size: 21px; }
    .add { padding: 12px 10px 12px 50px; gap: 6px; }
    .input, .select { min-height: 48px; }
    .suggest button { min-height: 48px; padding: 4px 8px; }
    .popular { padding: 10px 0 12px 50px; gap: 6px; }
    .popular h3, .popular .fine { padding-right: 12px; }
    .popular .chips { flex-wrap: nowrap; overflow-x: auto; padding: 2px 12px 4px 0; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
    .popular .chips::-webkit-scrollbar { display: none; }
    .chip { flex: none; min-height: 40px; }

    /* Docked total + submit */
    .total.dock {
      position: sticky; bottom: 0; z-index: 20;
      margin: 0 -20px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
      border-radius: 18px 18px 0 0; gap: 8px;
      background: var(--bg-2); background: color-mix(in srgb, var(--bg-2) 94%, transparent);
      -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
      box-shadow: 0 -10px 30px -12px rgb(0 0 0 / .45);
    }
    [data-theme="safi"] .total.dock { background: #fff; background: color-mix(in srgb, #fff 94%, transparent); }
    .total.dock .total-row .lbl { font-size: 13px; }
    .total.dock .total-row small { font-weight: 600; color: var(--on-bg-3); }
    .total.dock .total-amt { font-size: 24px; }
    .total.dock .meter { height: 6px; }
    .total.dock .nudge { padding: 6px 10px; font-size: 12px; }
    .total.dock .btn { min-height: 52px; font-size: 16px; }
    .hide-s { display: none; }
    .show-s { display: inline; }

    .how { gap: 10px; padding-top: 22px; }
    h2.sec { font-size: 22px; }
    .info { gap: 8px; }
    .info-card { padding: 12px 14px; gap: 12px; border-radius: 14px; }
    .info-card p { font-size: 13px; line-height: 1.45; }
    .foot { padding: 18px 16px 24px; font-size: 11.5px; }

    /* Light pages */
    .bar .top { padding-block: 4px; }
    .card { padding: 16px; border-radius: 18px; }
    .card h2 { font-size: 20px; }
    .card.recap-box, .card.help { padding: 0; }
    .field { gap: 4px; }
    .seg label { min-height: 44px; }
    .tip { padding: 10px 12px; font-size: 12.5px; gap: 10px; }
    .check { font-size: 13px; gap: 10px; }
    .dock-btn {
      position: sticky; bottom: 0; z-index: 5;
      margin: 0 -16px -16px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
      background: linear-gradient(180deg, rgb(255 255 255 / 0), var(--surface) 30%);
      border-radius: 0 0 18px 18px;
    }
    .dock-btn .btn { min-height: 54px; }

    .ring { width: 100px; height: 100px; }
    .ring svg.track { width: 100px; height: 100px; }
    .ring [data-ring-icon] .ic { width: 34px; height: 34px; }
    .wait-title { font-size: 26px; }
    .kv { padding: 10px 12px; gap: 6px; }
    .paybill li { padding: 10px 12px; }
    .paybill b { font-size: 17px; }

    /* Done */
    .pass-top { padding: 14px 16px; }
    .pass-name { font-size: 28px; }
    .pass-grid div { padding: 10px 16px; }
    .pass-grid b { font-size: 16px; }
    .earn { padding: 16px; border-radius: 20px; gap: 10px; }
    .earn h2 { font-size: 24px; }
    .earn p { font-size: 13px; }
    .tile { padding: 10px 4px; }
    .tile b { font-size: 18px; }
    .payout { padding: 10px 12px; gap: 6px; }
    .share-card { width: min(210px, 70%); padding: 12px; }
    .share-card .t { font-size: 21px; }
    .share-card .l { font-size: 16px; }
    .row-link { min-height: 50px; }
    .warn-card { padding: 12px 14px; }
  }

  /* Very small phones (320 to 359px) */
  @media (max-width: 359px) {
    .wrap { padding-inline: 14px; }
    .total.dock { margin: 0 -14px; }
    .hero h1 { font-size: 30px; }
    .steps li { font-size: 11px; padding-right: 8px; }
    .cost b { font-size: 15px; }
    .cost div:first-child b { font-size: 17px; }
    .tiles { gap: 6px; }
    .tile b { font-size: 16px; }
  }

  /* Short screens: keep the docked bar small */
  @media (max-height: 640px) and (max-width: 899px) {
    .total.dock .meter, .total.dock .nudge { display: none; }
  }


/* Fallback for browsers without container queries */
@media (max-width: 480px) {
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item-line { display: none; }
}

/* =========================================================
   Receipt list (Risiti): printer, paper, keypad
   ========================================================= */
.receipt { display: flex; flex-direction: column; color: #1B1F1D; font-family: var(--f-mono); }
.printer {
  position: relative; z-index: 2; height: 48px; margin: 0 2px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  border-radius: 16px 16px 6px 6px;
  background: #2A3530; background: linear-gradient(#38453F, #26302B);
  box-shadow: 0 8px 16px -8px rgba(0, 0, 0, .6);
}
.printer::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: -3px; height: 6px; border-radius: 3px; background: #0B0F0D; }
.printer-label { font-size: 10.5px; font-weight: 700; letter-spacing: .18em; color: #9DB0A6; }
.led { width: 9px; height: 9px; border-radius: 50%; background: #3E4A44; }
.printer.busy { animation: buzz .12s linear 4; }
.printer.busy .led { animation: ledOn .9s ease; }

.paper-clip { position: relative; margin: 0 18px; overflow: hidden; padding-bottom: 12px; }
.paper {
  position: relative; background: #FBFAF6; color: #1B1F1D;
  padding: 18px 16px 4px; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .55);
}
.paper::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: linear-gradient(-45deg, transparent 6px, #FBFAF6 0) 0 0 / 12px 10px repeat-x, linear-gradient(45deg, transparent 6px, #FBFAF6 0) 0 0 / 12px 10px repeat-x;
}
.paper.feed { animation: feed .55s cubic-bezier(.2, .8, .2, 1); }
.r-head { margin: 0; text-align: center; font-family: var(--f-mono); font-size: 13px; font-weight: 800; letter-spacing: .2em; }
.r-sub { text-align: center; font-size: 10.5px; color: #5E645F; margin-top: 4px; letter-spacing: .06em; }
.r-draft { display: inline-block; padding: 1px 6px; border: 1.5px solid #B3261E; border-radius: 4px; color: #B3261E; font-weight: 800; transform: rotate(-3deg); }
.r-dash { border-top: 1.5px dashed #B9BCB5; margin: 12px 0 6px; }
.r-items { list-style: none; margin: 0; padding: 0; }
.r-row { padding: 7px 0 6px; border-bottom: 1px dotted #E1E2DC; }
.r-row:last-child { border-bottom: 0; }
.r-row.print { animation: printIn .7s cubic-bezier(.2, .8, .2, 1) both; }
.r-line, .r-ghost { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.r-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.r-lead { flex: 1; min-width: 12px; border-bottom: 1.5px dotted #B9BCB5; transform: translateY(-3px); }
.r-amt { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-line2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.r-each { font-size: 11px; color: #5E645F; }
.receipt .qty { border: 1.5px solid #D6D8D2; background: #fff; }
.receipt .qty button { width: 36px; height: 32px; color: #1B1F1D; }
.receipt .qty button:hover { background: #F1F1EC; }
.receipt .qty output { font-family: var(--f-mono); font-size: 13px; }
.r-empty { padding: 10px 0 8px; font-size: 11.5px; line-height: 1.5; color: #5E645F; text-align: center; }
.r-ghost { padding: 8px 0 4px; color: #6B716D; }
.r-gname { color: #1B1F1D; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62%; }
.r-gprice { font-style: italic; white-space: nowrap; }
.caret { display: inline-block; width: 8px; height: 14px; margin-left: 2px; background: #1B1F1D; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.r-total { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 8px 0 2px; }
.r-total span { display: flex; flex-direction: column; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.r-total small { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; color: #B3261E; margin-top: 2px; }
.r-total b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: #5E645F; padding-bottom: 10px; }
.barcode { height: 30px; margin: 2px 12px 0; opacity: .78; background: repeating-linear-gradient(90deg, #1B1F1D 0 2px, transparent 2px 4px, #1B1F1D 4px 5px, transparent 5px 8px, #1B1F1D 8px 11px, transparent 11px 12px, #1B1F1D 12px 13px, transparent 13px 16px); }
.r-foot { margin: 0; padding: 8px 0 10px; text-align: center; font-size: 9.5px; letter-spacing: .24em; color: #5E645F; }

/* Keypad under the printer */
.keypad { margin-top: 2px; padding: 14px 14px 14px; border: 0; border-radius: 18px; background: var(--bg-2); color: var(--on-bg); display: flex; flex-direction: column; gap: 8px; font-family: var(--f-body); }
[data-theme="safi"] .keypad { background: #fff; box-shadow: var(--shadow-soft); }
.keypad > label { font-size: 12px; font-weight: 700; color: var(--on-bg-2); }
.keypad .search { position: relative; }
.keypad .prompt { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-weight: 800; color: #1B1F1D; pointer-events: none; }
.keypad .search .input { padding-left: 34px; font-family: var(--f-mono); font-size: 15px; background: #FBFAF6; border: 2px solid #FBFAF6; color: #1B1F1D; }
.keypad .search .input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(242, 193, 78, .35); }
.keypad .suggest { border: 0; }
.keypad .suggest .s-name { font-family: var(--f-mono); font-size: 13.5px; text-transform: uppercase; }
.keypad .unknown { background: #FBFAF6; border-color: #D6D8D2; color: #1B1F1D; }
.keypad .msg { margin: 0; }
.keypad .popular { padding: 4px 0 0; }
.keypad .popular h3 { color: var(--on-bg-2); font-size: 12px; margin: 0; }
.keypad .popular .fine { color: var(--on-bg-3); padding: 0; margin: 0; }
.keypad .chip { background: transparent; border: 1.5px dashed rgba(255, 255, 255, .35); border: 1.5px dashed color-mix(in srgb, var(--on-bg) 35%, transparent); color: var(--on-bg); font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; }
.keypad .chip:hover { border-style: solid; }
.keypad .unknown .chip { color: #1B1F1D; border: 1.5px solid #D6D8D2; background: #fff; font-family: var(--f-body); text-transform: none; }

@keyframes printIn { 0% { clip-path: inset(0 0 100% 0); transform: translateY(-6px); } 55% { clip-path: inset(0 0 0 0); transform: translateY(1px); } 70% { transform: translateY(-1px); } 100% { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes feed { 0% { transform: translateY(-24px); } 60% { transform: translateY(2px); } 100% { transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes buzz { 0%, 100% { transform: none; } 25% { transform: translateX(-1px); } 75% { transform: translateX(1px); } }
@keyframes ledOn { 0%, 100% { background: #3E4A44; } 20%, 60% { background: #7BD3A4; box-shadow: 0 0 10px #7BD3A4; } }

/* Receipt-style text elsewhere (pay recap, entry pass, share card) */
.recap-sum .book-title, .card .book-title { font-family: var(--f-mono); font-size: 14px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #1B1F1D; }
.recap .h { font-family: var(--f-mono); font-size: 13px; font-weight: 700; text-transform: uppercase; color: #1B1F1D; line-height: 1.3; }
.recap .p { font-family: var(--f-mono); font-size: 13px; }
.pass-name { font-family: var(--f-mono); font-size: 20px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.share-card .t { font-family: var(--f-mono); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.share-card .l { font-family: var(--f-mono); font-size: 11.5px; text-transform: uppercase; }

@media (max-width: 899px) {
  .printer { height: 42px; }
  .paper-clip { margin: 0 12px; }
  .paper { padding: 14px 12px 2px; }
  .r-line { font-size: 12.5px; }
  .r-total b { font-size: 22px; }
  .keypad { padding: 12px; border-radius: 16px; }
  .keypad .popular .chips { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .pass-name { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}

/* Never let the chip row widen the page */
.home-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); } }
.receipt, .receipt > *, .keypad > *, .popular, .popular .chips { min-width: 0; max-width: 100%; }

/* Typing box sits above the printer */
.receipt > .keypad { margin: 0 0 14px; }
.receipt .qty button { height: 30px; }
.r-row { padding: 6px 0 5px; }
@media (max-width: 899px) {
  body.is-typing .total.dock { display: none; }
  .receipt > .keypad { margin-bottom: 12px; }
}

/* Delivery address on the pay screen */
.addr { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--page); border: 1px solid var(--surface-line); }
.addr legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-size: 14px; font-weight: 800; color: var(--surface-ink); }
.addr legend + * { clear: both; }
.addr-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.addr .input, .addr .select { background: #fff; }
.pin { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1.5px dashed var(--brand); background: #fff; color: var(--surface-ink); text-align: left; cursor: pointer; font: inherit; }
.pin .ic { color: var(--brand); flex: none; }
.pin span { display: flex; flex-direction: column; gap: 1px; }
.pin b { font-size: 14px; }
.pin small { font-size: 12px; color: var(--surface-ink-2); line-height: 1.35; }
.pin.is-set { border-style: solid; background: #E3F3EA; }
.pin.is-busy .ic { animation: blink 1s steps(1) infinite; }
@media (max-width: 359px) { .addr-row { grid-template-columns: minmax(0, 1fr); } }
fieldset.plain.addr { padding: 14px; border: 1px solid var(--surface-line); min-width: 0; }
@media (max-width: 899px) { fieldset.plain.addr { padding: 12px; margin: 0 -4px; } }

/* Write another list */
.again { display: grid; gap: 12px; padding: 16px; border-radius: 20px; }
.again b { display: block; font-family: var(--f-display); font-size: 20px; letter-spacing: -.01em; }
.again small { display: block; margin-top: 2px; font-size: 13px; color: var(--on-bg-2); line-height: 1.45; }

/* =========================================================
   Glass: soft festive glows behind frosted panels.
   Phones that cannot blur keep the solid colours above.
   ========================================================= */
:root { --glow-a: rgba(242, 193, 78, .20); --glow-b: rgba(226, 72, 63, .16); --glow-c: rgba(76, 195, 255, .12); }
[data-theme="usiku"] { --glow-a: rgba(240, 181, 68, .20); --glow-b: rgba(120, 90, 255, .16); --glow-c: rgba(76, 195, 255, .14); }
[data-theme="nairobi"] { --glow-a: rgba(242, 193, 78, .22); --glow-b: rgba(255, 120, 90, .18); --glow-c: rgba(30, 142, 84, .14); }
[data-theme="safi"] { --glow-a: rgba(11, 122, 75, .14); --glow-b: rgba(242, 193, 78, .20); --glow-c: rgba(76, 195, 255, .14); }
body.light { --glow-a: rgba(11, 93, 59, .12); --glow-b: rgba(242, 193, 78, .18); --glow-c: rgba(76, 195, 255, .12); }

body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 8% 6%, var(--glow-a), transparent 62%),
    radial-gradient(46vmax 46vmax at 96% 34%, var(--glow-b), transparent 62%),
    radial-gradient(50vmax 50vmax at 40% 104%, var(--glow-c), transparent 62%);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .keypad, .info-card, .earn, .again, .steps li, .tile, .payout, .row-link, .warn-card {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 12px 32px -16px rgba(0, 0, 0, .55);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
  }
  .tile, .payout { background: rgba(255, 255, 255, .06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
  .again { background: linear-gradient(135deg, rgba(242, 193, 78, .16), rgba(255, 255, 255, .06)); }

  .total.dock {
    background: rgba(10, 16, 14, .55);
    border-top: 1px solid rgba(255, 255, 255, .16);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
  }

  .printer { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 16px -8px rgba(0, 0, 0, .6); }
  .printer::before { content: ""; position: absolute; inset: 0 0 50% 0; border-radius: inherit; background: linear-gradient(rgba(255, 255, 255, .10), transparent); pointer-events: none; }

  /* Light pages: frosted white cards */
  body.light .card { background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 10px 30px -18px rgba(16, 36, 26, .35); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
  body.light .card.brand-card, body.light .cost { -webkit-backdrop-filter: none; backdrop-filter: none; }
  body.light .addr { background: rgba(243, 246, 244, .7); }
  .bar { background: rgba(11, 93, 59, .88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 15; }
  [data-theme="usiku"] .bar { background: rgba(16, 26, 46, .88); }
  [data-theme="nairobi"] .bar { background: rgba(143, 26, 26, .88); }
  [data-theme="safi"] .bar { background: rgba(11, 122, 75, .9); }

  /* Safi (light theme) panels on the light home page */
  [data-theme="safi"] .keypad, [data-theme="safi"] .info-card, [data-theme="safi"] .earn, [data-theme="safi"] .again,
  [data-theme="safi"] .steps li, [data-theme="safi"] .tile, [data-theme="safi"] .payout, [data-theme="safi"] .row-link, [data-theme="safi"] .warn-card {
    background: rgba(255, 255, 255, .62); border-color: rgba(255, 255, 255, .9); box-shadow: 0 10px 30px -18px rgba(16, 36, 26, .3);
  }
  [data-theme="safi"] .total.dock { background: rgba(255, 255, 255, .7); border-top-color: rgba(16, 36, 26, .08); }
}

@media (prefers-reduced-transparency: reduce) {
  body::before { display: none; }
  .keypad, .info-card, .earn, .again, .steps li, .tile, .payout, .row-link, .warn-card, .total.dock, body.light .card, .bar { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
.again .btn { white-space: nowrap; gap: 10px; }
.again .btn .btn-sub { font-size: .8em; font-weight: 700; opacity: .7; padding-left: 10px; border-left: 1px solid rgba(0, 0, 0, .2); }

/* Receipt on top, typing box underneath: people watch each line print as they type. */
.receipt > .keypad { margin: 14px 0 0; position: relative; }
.receipt > .keypad::before { content: ""; position: absolute; left: 50%; top: -14px; width: 2px; height: 14px; background: rgba(255, 255, 255, .25); }
.keypad .suggest { max-height: 228px; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 699px) {
  .receipt > .keypad { margin-top: 12px; }
  /* Keyboard open: tighten the receipt so the newest line sits right above the typing box. */
  body.is-typing .r-meta, body.is-typing .barcode, body.is-typing .r-foot,
  body.is-typing .keypad .popular, body.is-typing .keypad > label { display: none; }
  body.is-typing .paper-clip { padding-bottom: 6px; }
  body.is-typing .keypad .suggest { max-height: 150px; }
  body.is-typing .receipt > .keypad { margin-top: 8px; padding: 10px; }
}

/* =========================================================
   Print sequence (build 8): calm, paced, like a real thermal printer.
   ========================================================= */
.printer.busy { animation: none; }
.led { transition: background-color .4s ease, box-shadow .4s ease; }
.printer.busy .led { animation: ledBreathe 1.6s ease-in-out infinite; background: #7BD3A4; }
.printer .head { position: absolute; left: 20px; right: 20px; bottom: -3px; height: 6px; border-radius: 3px; overflow: hidden; z-index: 1; pointer-events: none; }
.printer .head::after {
  content: ""; position: absolute; top: 1px; bottom: 1px; left: 0; width: 22%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(123, 211, 164, .95), transparent);
  opacity: 0; transform: translateX(-100%); transition: opacity .35s ease;
}
.printer.busy .head::after { opacity: 1; animation: headSweep 1.15s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.printer-label { transition: color .4s ease; }
.printer.busy .printer-label { color: #CFE3D8; }

.r-row { transform-origin: top center; }
.r-name.typing::after { content: ""; display: inline-block; width: .55em; height: 1.05em; margin-left: 1px; vertical-align: -.15em; background: #1B1F1D; animation: blink .8s steps(1) infinite; }
.r-lead { will-change: clip-path; }
.r-total b { transition: color .5s ease; }
.r-total b.counting { color: #0B5D3B; }
.paper.feed { animation: none; }

@keyframes headSweep { from { transform: translateX(-100%); } to { transform: translateX(455%); } }
@keyframes ledBreathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(123, 211, 164, 0); } 50% { box-shadow: 0 0 10px 2px rgba(123, 211, 164, .65); } }

@media (prefers-reduced-motion: reduce) {
  .printer.busy .led, .printer.busy .head::after, .r-name.typing::after { animation: none; }
}
.total .meter > span { transition: width 1.1s cubic-bezier(.22,.61,.36,1), background .5s ease; }

/* =========================================================
   Checkout in two steps: pay first, delivery details after.
   ========================================================= */
.form-lead { margin: -6px 0 2px; font-size: 14px; line-height: 1.45; color: var(--surface-ink-2, #4A5550); }
.field .opt { margin-left: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--surface-ink-2, #6B716D); }
.paid-strip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #E6F4EC; border: 1px solid #BFE3CD; color: #0B3D27; font-size: 14px; line-height: 1.4; }
.paid-dot { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #0B7A4B; color: #fff; }
.paid-strip, .details-form { animation: rise .5s cubic-bezier(.22, .61, .36, 1) both; }
.details-form { animation-delay: .08s; }

.addr-cta, .addr-line { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; text-decoration: none; color: inherit; }
.addr-cta { background: var(--accent); color: #1B1F1D; box-shadow: 0 12px 28px -14px rgba(242, 193, 78, .8); }
.addr-cta-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(0, 0, 0, .1); }
.addr-cta > span:nth-child(2), .addr-line > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.addr-cta b { font-size: 16px; }
.addr-cta small { font-size: 13px; opacity: .8; line-height: 1.35; }
.addr-line { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); color: var(--on-bg); }
.addr-line small { font-size: 11.5px; color: var(--on-bg-2); }
.addr-line small:first-child { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.addr-line b { font-size: 14.5px; overflow-wrap: anywhere; }
.addr-line em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--accent); }
[data-theme="safi"] .addr-line { background: rgba(255, 255, 255, .62); border-color: rgba(16, 36, 26, .08); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .addr-line { -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); }
}

/* =========================================================
   Toasts: slide in at the top, auto-close, tap or swipe up to close.
   ========================================================= */
.toasts { position: fixed; z-index: 60; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-card {
  position: relative; overflow: hidden; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 13px; border-radius: 16px;
  background: #13231A; background: rgba(16, 30, 22, .92); color: #fff;
  font-family: var(--f-body); font-size: 14.5px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: toastIn .5s cubic-bezier(.22, 1, .36, 1) both;
}
.toast-card.out { animation: toastOut .3s cubic-bezier(.55, 0, .45, 1) both; }
.t-ic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #2E8B57; color: #fff; }
.t-bad .t-ic { background: #C2412E; }
.t-info .t-ic { background: #F2C14E; color: #1B1F1D; }
.t-msg { flex: 1; min-width: 0; }
.t-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255, 255, 255, .35); transform-origin: left; animation: toastLife var(--life, 3400ms) linear both; }
.t-ok .t-bar { background: #7BD3A4; } .t-bad .t-bar { background: #F08A78; } .t-info .t-bar { background: #F2C14E; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .toast-card { background: rgba(16, 30, 22, .78); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-120%) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-70%) scale(.97); } }
@keyframes toastLife { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast-card, .toast-card.out { animation-duration: .01s; } .t-bar { animation: none; } }

/* =========================================================
   Pay page: minimal, fits one phone screen.
   ========================================================= */
.pay-min { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; padding-bottom: 18px; }
.mini-recap { border-radius: 14px; background: var(--surface, #fff); border: 1px solid var(--surface-line, #E0E5E1); }
.mini-recap > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; }
.mini-recap > summary::-webkit-details-marker { display: none; }
.mr-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-tint, #E3F3EA); color: var(--brand, #0B5D3B); }
.mr-txt { flex: 1; font-size: 14px; color: var(--surface-ink-2, #3E5246); }
.mr-txt b { margin-left: 6px; color: var(--surface-ink, #12241A); font-size: 15px; }
.mr-more { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--brand, #0B5D3B); }
.mini-recap[open] .mr-more svg { transform: rotate(90deg); }
.mini-recap .recap { margin: 0; padding: 0 14px 6px; }
.mini-recap .recap-edit { display: inline-flex; margin: 0 14px 12px; }
.pay-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.pay-card .field { gap: 6px; }
.pay-go { margin-top: 2px; min-height: 54px; font-size: 17px; }
.pay-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: -2px; }
.link-btn { padding: 6px 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--brand, #0B5D3B); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pay-zero { font-size: 13px; color: var(--surface-ink-2, #3E5246); }
.pay-zero b { color: #0B7A4B; }
.fine-print { margin: 0; font-size: 12px; line-height: 1.45; color: var(--surface-ink-2, #5E645F); }
.fine-print a { color: inherit; }
.pay-foot { flex-wrap: nowrap; } .pay-zero { white-space: nowrap; }
