/* FeeMaster — CLAUDE version. Warm paper, deep teal, a thread of gold. */
:root {
  --paper: #f5efe3;
  --paper-2: #ece3d1;
  --card: #fffdf9;
  --ink: #0f2e2c;
  --ink-2: #39524f;
  --muted: #687c79;
  --line: #e4dbcb;
  --line-2: #d6ccb9;
  --teal-950: #052422;
  --teal-900: #073230;
  --teal-800: #0a403d;
  --teal-700: #0d5652;
  --teal-600: #11706a;
  --teal-50: #e3efec;
  --gold: #c9973a;
  --gold-2: #e5bf6f;
  --gold-soft: #f6e8c8;
  --ok: #1b7650;
  --ok-bg: #e0f1e7;
  --amber: #9c5c12;
  --amber-bg: #fbead0;
  --bad: #ac3b28;
  --bad-bg: #f8e0d9;
  --radius: 20px;
  --shadow-1: 0 1px 0 rgba(15, 46, 44, .04), 0 1px 3px rgba(15, 46, 44, .06);
  --shadow-2: 0 2px 4px rgba(15, 46, 44, .05), 0 12px 28px -8px rgba(15, 46, 44, .18);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", "Menlo", "Consolas", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
html.sheet-open { overflow: hidden; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font: 16px/1.45 var(--sans);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(201, 151, 58, .10), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(13, 86, 82, .07), transparent 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: .01em; }
.soft { color: var(--muted); }
.strong { font-weight: 700; }
.amber-text { color: var(--amber); }
.struck { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .65; }

.app { max-width: 560px; margin: 0 auto; padding: 0 0 calc(28px + var(--sa-bottom)); }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--sa-top)) 18px 10px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  transition: box-shadow .25s var(--ease);
}
.topbar.raised { box-shadow: 0 1px 0 var(--line), 0 8px 18px -14px rgba(15, 46, 44, .4); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--gold-2); background: linear-gradient(145deg, var(--teal-700), var(--teal-900)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), var(--shadow-1); flex: none; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand-org { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex: none; }
.chip-button { min-width: 48px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-weight: 750; font-size: 13px; letter-spacing: .06em; color: var(--teal-700); box-shadow: var(--shadow-1); }
.icon-button { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); box-shadow: var(--shadow-1); }
.icon-button svg { width: 20px; height: 20px; }
.chip-button:active, .icon-button:active { transform: scale(.96); }

.main { padding: 6px 16px 0; }
.practice-banner { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 0 12px; padding: 10px 14px; border: 1px solid #d8b56c; border-radius: 14px; color: var(--teal-950); background: linear-gradient(110deg, #f8e8bf, #f1d28d); box-shadow: var(--shadow-1); }
.practice-banner strong { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.practice-banner span { font-size: 13px; text-align: right; }

/* ---------- hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate; color: #f4efe4; border-radius: 28px; padding: 20px 22px 22px;
  background: radial-gradient(130% 120% at 0% 0%, var(--teal-700) 0%, var(--teal-800) 45%, var(--teal-950) 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 22px 40px -22px rgba(5, 36, 34, .75), var(--shadow-2);
}
.hero-pattern { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold-2); opacity: .22; z-index: -1;
  -webkit-mask-image: radial-gradient(80% 110% at 100% 0%, #000 0%, transparent 70%); mask-image: radial-gradient(80% 110% at 100% 0%, #000 0%, transparent 70%); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 40%); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hero-greet { margin: 0; font-size: 14.5px; color: rgba(244, 239, 228, .82); }
.hero-greet strong { color: #fff; font-weight: 700; }
.hero-unit { display: block; font-size: 12.5px; opacity: .8; margin-top: 1px; }
.sample-pill { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-950); background: var(--gold-2); padding: 5px 9px; border-radius: 999px; }
.hero-label { margin: 22px 0 2px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); font-weight: 700; }
.hero-amount { margin: 0; font-size: clamp(40px, 12vw, 52px); font-weight: 780; letter-spacing: -.035em; line-height: 1.04; color: #fff; transition: color .4s var(--ease); }
.hero-amount.zero { color: #cfe9dc; }
.hero-meta { margin: 8px 0 16px; font-size: 14.5px; color: rgba(244, 239, 228, .86); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-meta strong { color: #fff; font-weight: 650; }
.ok-dot { width: 9px; height: 9px; border-radius: 50%; background: #6fd3a0; box-shadow: 0 0 0 4px rgba(111, 211, 160, .2); }
.hero-progress { height: 6px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.hero-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .9s var(--ease); }

/* ---------- blocks */
.block { margin-top: 26px; }
.block-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 12px; }
.block-head h2 { margin: 0; font-size: 19px; font-weight: 760; letter-spacing: -.02em; }
.count { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 13px; font-weight: 700; display: grid; place-items: center; }

/* ---------- bills */
.bill-list { display: grid; gap: 10px; }
.bill {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 14px 14px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
  animation: rise .45s var(--ease) both;
}
.bill-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--teal-700); background: var(--teal-50); }
.bill-icon svg { width: 22px; height: 22px; }
.bill[data-status="pending"] .bill-icon { color: var(--amber); background: var(--amber-bg); }
.bill[data-status="failed"] .bill-icon { color: var(--bad); background: var(--bad-bg); }
.bill[data-status="overdue"] .bill-icon { color: var(--bad); background: var(--bad-bg); }
.bill-main { min-width: 0; }
.bill-main h3 { margin: 0; font-size: 16px; font-weight: 680; letter-spacing: -.01em; line-height: 1.25; }
.bill-sub { display: block; margin-top: 3px; font-size: 13.5px; color: var(--muted); }
.bill-sub.amber { color: var(--amber); font-weight: 600; }
.bill-sub.bad { color: var(--bad); font-weight: 600; }
.bill-sub.ok { color: var(--ok); font-weight: 600; }
.bill-main > .chip { display: inline-flex; margin-top: 5px; }
.bill-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bill-amt { font-weight: 760; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.bill-side .btn { min-height: 40px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
@media (max-width: 359px) {
  .bill { grid-template-columns: auto 1fr; }
  .bill-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}

.empty-paid { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 26px 20px 24px; border-radius: var(--radius); background: var(--card); border: 1px dashed var(--line-2); animation: rise .5s var(--ease) both; }
.empty-paid strong { font-size: 17px; margin-top: 6px; }
.empty-paid span { color: var(--muted); font-size: 14px; max-width: 30ch; }
.empty-badge { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #2a9a69, var(--ok)); box-shadow: 0 10px 22px -10px rgba(27, 118, 80, .8); animation: pop .6s var(--ease) both .1s; }
.empty-badge svg { width: 28px; height: 28px; }

/* ---------- search + history */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; margin-bottom: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-1); }
.search:focus-within { border-color: var(--teal-600); box-shadow: 0 0 0 4px rgba(17, 112, 106, .14); }
.search svg { width: 20px; height: 20px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.search input::placeholder { color: #94a19f; }
.history { display: grid; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 13px 14px; border: 0; background: transparent; border-top: 1px solid var(--line); min-height: 64px; }
.row:first-child { border-top: 0; }
.row:active { background: var(--paper); }
.row-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); color: var(--ink-2); }
.row-icon svg, .method-icon svg { width: 21px; height: 21px; }
.m-fpx { color: var(--teal-700); background: var(--teal-50); }
.m-card { color: #5b4a8a; background: #ece8f6; }
.m-transfer { color: var(--amber); background: var(--amber-bg); }
.m-cash { color: var(--ok); background: var(--ok-bg); }
.row-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.row-main strong { font-size: 15px; font-weight: 650; }
.row-main > span { font-size: 13px; color: var(--muted); }
.row-ref { font-family: var(--mono); font-size: 12px !important; color: var(--ink-2) !important; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-ref mark { background: var(--gold-soft); color: var(--ink); border-radius: 4px; padding: 0 2px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.row-amt { font-weight: 700; font-size: 15px; white-space: nowrap; }
.empty { margin: 0; padding: 22px 18px; color: var(--muted); text-align: center; font-size: 14.5px; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 720; letter-spacing: .02em; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-amber { color: var(--amber); background: var(--amber-bg); }
.chip-bad { color: var(--bad); background: var(--bad-bg); }
.chip-due { color: var(--teal-700); background: var(--teal-50); }

.foot { margin: 26px 8px 0; text-align: center; color: var(--muted); font-size: 12.5px; }
.foot p { margin: 0; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 700; font-size: 16px; letter-spacing: -.005em; transition: transform .12s var(--ease), background .2s, box-shadow .2s; }
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(.975); }
.btn-block { width: 100%; }
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--teal-600), var(--teal-700)); box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 8px 18px -10px rgba(13, 86, 82, .9); }
.btn-primary:hover { background: linear-gradient(180deg, #13807a, var(--teal-700)); }
.btn-soft { color: var(--amber); background: var(--amber-bg); }
.btn-ghost { color: var(--teal-700); background: var(--card); border-color: var(--line-2); }
.btn-danger-ghost { color: var(--bad); background: transparent; border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---------- sheets */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: min(94dvh, 900px);
  padding: 0; border: 0; border-radius: 28px 28px 0 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 -20px 50px -20px rgba(5, 36, 34, .5); overflow: auto; overscroll-behavior: contain;
  animation: sheet-in .38s var(--ease) both;
}
dialog.sheet::backdrop { background: rgba(5, 30, 28, .46); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .3s ease both; }
dialog.sheet.closing { animation: sheet-out .21s ease-in both; }
dialog.sheet.closing::backdrop { animation: fade-out .21s ease-in both; }
.sheet-body { position: relative; padding: 10px 20px calc(22px + var(--sa-bottom)); }
.grabber { width: 40px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 0 auto 14px; }
.sheet-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--paper-2); color: var(--ink-2); }
.sheet-close svg { width: 18px; height: 18px; }
.eyebrow { margin: 6px 0 2px; font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.sheet-title { margin: 0 48px 4px 0; font-size: 22px; line-height: 1.2; font-weight: 770; letter-spacing: -.02em; }
.sheet-title.center, .center { text-align: center; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }
.sheet-fine { margin: 12px 4px 0; font-size: 12.5px; color: var(--muted); text-align: center; }
@media (min-width: 640px) {
  dialog.sheet { inset: 0; margin: auto; border-radius: 28px; max-height: 88dvh; animation-name: modal-in; }
  dialog.sheet.closing { animation-name: modal-out; }
  .grabber { visibility: hidden; height: 0; margin-bottom: 18px; }
}

/* pay */
.pay-amount { margin-top: 10px; font-size: 40px; font-weight: 790; letter-spacing: -.035em; line-height: 1.05; color: var(--teal-800); }
.pay-due { margin: 4px 0 16px; color: var(--muted); font-size: 14px; }
.methods { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.methods legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 15px; }
#methodList { display: grid; gap: 8px; }
.method { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); cursor: pointer; transition: border-color .2s, box-shadow .2s, background .2s; }
.method input { position: absolute; opacity: 0; pointer-events: none; }
.method.on { border-color: var(--teal-600); box-shadow: 0 0 0 4px rgba(17, 112, 106, .12); background: #fff; }
.method:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.method-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.method-copy { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.method-copy strong { font-size: 15.5px; font-weight: 680; }
.method-copy small { font-size: 13px; color: var(--muted); }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; transition: border-color .2s; }
.method.on .radio { border-color: var(--teal-600); }
.method.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--teal-600); animation: pop .3s var(--ease); }
.ref-hint { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); color: #5d4616; font-size: 13.5px; line-height: 1.45; }
.ref-hint svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.ref-hint b { font-family: var(--mono); font-weight: 700; background: rgba(255,255,255,.6); padding: 0 4px; border-radius: 4px; }
.inline-error { margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; color: var(--bad); background: var(--bad-bg); font-weight: 600; font-size: 14px; }

.pay-processing { padding: 12px 0 8px; }
.spinner { width: 76px; height: 76px; margin: 14px auto 18px; border-radius: 50%; position: relative; background: conic-gradient(from 0deg, transparent 0 62%, var(--gold) 82%, var(--teal-600) 100%); animation: spin 1.05s linear infinite; -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); }
.steps { list-style: none; margin: 20px auto 6px; padding: 0; max-width: 320px; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; font-size: 15px; transition: color .3s; }
.steps li::before { content: ""; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); box-sizing: border-box; transition: all .3s var(--ease); }
.steps li.active { color: var(--ink); }
.steps li.active::before { border-color: var(--gold); box-shadow: 0 0 0 5px rgba(201, 151, 58, .18); animation: pulse 1.1s ease-in-out infinite; }
.steps li.done { color: var(--ok); }
.steps li.done::before { border: 0; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }

.pay-result { padding: 6px 0 2px; }
.result-mark { width: 84px; height: 84px; margin: 10px auto 14px; border-radius: 50%; display: grid; place-items: center; animation: pop .55s var(--ease) both; }
.result-mark svg { width: 64px; height: 64px; }
.result-mark svg path, .result-mark svg circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .7s var(--ease) forwards .12s; }
.result-mark svg path { animation-delay: .38s; }
.result-mark.ok { color: var(--ok); background: radial-gradient(circle, var(--ok-bg) 0 60%, transparent 61%); }
.result-mark.amber { color: var(--amber); background: radial-gradient(circle, var(--amber-bg) 0 60%, transparent 61%); }
.result-mark.bad { color: var(--bad); background: radial-gradient(circle, var(--bad-bg) 0 60%, transparent 61%); }
#resultTitle { outline: none; }
#resultNote { max-width: 34ch; margin: 6px auto 0; }
.result-ref { margin: 18px 0 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.result-ref:empty { display: none; }
.result-ref > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.result-ref > div:first-child { border-top: 0; }
.result-ref span { color: var(--muted); }
.result-ref strong { text-align: right; word-break: break-all; }
.result-actions { display: grid; gap: 10px; }

/* toggles */
.toggles { display: grid; gap: 8px; margin: 16px 0; }
.toggle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.toggle > span { display: flex; flex-direction: column; line-height: 1.3; }
.toggle strong { font-size: 15px; font-weight: 650; }
.toggle small { font-size: 13px; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--ease); }
.toggle input:checked + i { background: var(--teal-600); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 3px solid var(--gold); outline-offset: 2px; }
.demo-actions { display: grid; gap: 8px; margin-top: 8px; }

/* ---------- receipt paper */
.sheet-receipt { background: var(--paper-2) !important; }
.paper {
  position: relative; margin: 4px 0 0; background: var(--card); border-radius: 18px 18px 0 0; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 46, 44, .08), 0 18px 30px -18px rgba(15, 46, 44, .35);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat, radial-gradient(circle at 8px 0, transparent 7px, #000 7.5px) bottom left / 16px 10px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat, radial-gradient(circle at 8px 0, transparent 7px, #000 7.5px) bottom left / 16px 10px repeat-x;
  padding-bottom: 18px; animation: rise .45s var(--ease) both .05s;
}
.p-head { position: relative; padding: 18px 18px 16px; color: #f4efe4; background: linear-gradient(135deg, var(--teal-700), var(--teal-950)); isolation: isolate; }
.p-pattern { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold-2); opacity: .2; z-index: -1; }
.p-org { display: flex; gap: 12px; align-items: center; }
.p-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--gold-2); background: rgba(255,255,255,.08); border: 1px solid rgba(229, 191, 111, .35); flex: none; }
.p-mark svg { width: 24px; height: 24px; }
.p-org > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.p-org strong { font-size: 15.5px; }
.p-org small { font-size: 12.5px; color: var(--gold-2); letter-spacing: .02em; }
.p-amount-wrap { position: relative; padding: 18px 18px 6px; display: grid; justify-items: start; gap: 6px; }
.p-label { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.p-amount { margin: 0; font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.stamp { position: absolute; right: 18px; top: 22px; padding: 6px 12px; border: 3px double currentColor; border-radius: 10px; font-weight: 900; letter-spacing: .14em; font-size: 15px; transform: rotate(-9deg); opacity: .9; animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) both .3s; }
.stamp.ok { color: var(--ok); }
.stamp.bad { color: var(--bad); }
.stamp.amber { color: var(--amber); font-size: 14px; }
.p-list { margin: 8px 0 0; padding: 0 18px; }
.p-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.p-row:first-child { border-top: 0; }
.p-row dt { color: var(--muted); }
.p-row dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.p-row dd small { font-weight: 500; color: var(--muted); font-size: 12px; }
.p-bankref { margin: 2px -10px; padding: 12px 10px; border-radius: 12px; border-top: 0 !important; }
.p-bankref dd { flex-flow: row wrap; justify-content: flex-end; align-items: center; column-gap: 8px; }
.p-bankref dd small { flex-basis: 100%; text-align: right; }
.p-bankref .mono.strong { font-size: 15px; }
.p-bankref.tone-ok { background: var(--ok-bg); }
.p-bankref.tone-ok dd small { color: var(--ok); }
.p-bankref.tone-amber { background: var(--amber-bg); }
.p-bankref.tone-amber dd, .p-bankref.tone-amber dd small { color: var(--amber); }
.p-bankref.tone-muted { background: var(--paper); }
.p-bankref + .p-row { border-top: 0; }
.p-conf.tone-amber dd, .p-conf.tone-amber dd small { color: var(--amber); }
.p-conf.tone-amber dd { font-weight: 700; }
.p-conf.tone-ok dd { color: var(--ok); }
.p-conf dd small { font-weight: 400; }
.copy { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(27, 118, 80, .25); background: rgba(255,255,255,.7); color: var(--ok); display: grid; place-items: center; }
.copy svg { width: 16px; height: 16px; }
.p-tear { height: 1px; margin: 12px 18px 4px; background-image: linear-gradient(90deg, var(--line-2) 50%, transparent 50%); background-size: 10px 1px; }
.p-section { margin: 12px 18px 2px; font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.p-void { margin: 12px 18px 0; padding: 12px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-size: 13.5px; display: grid; gap: 3px; }
.p-foot { margin: 16px 18px 0; font-size: 12px; color: var(--muted); text-align: center; }
.receipt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.receipt-actions .btn[hidden] { display: none; }
.receipt-actions:has(.btn[hidden]) { grid-template-columns: 1fr; }

/* ---------- toast */
.toast { position: fixed; left: 50%; bottom: calc(22px + var(--sa-bottom)); z-index: 50; max-width: min(92vw, 440px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #f4efe4; font-size: 14.5px; font-weight: 600; box-shadow: 0 16px 30px -12px rgba(0,0,0,.45); transform: translate(-50%, 20px); opacity: 0; transition: transform .3s var(--ease), opacity .3s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- motion */
@keyframes rise { from { opacity: .35; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes stamp { 0% { transform: rotate(-9deg) scale(1.8); opacity: 0; } 100% { transform: rotate(-9deg) scale(1); opacity: .9; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(201, 151, 58, .06); } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.bill-list .bill:nth-child(2) { animation-delay: .05s; }
.bill-list .bill:nth-child(3) { animation-delay: .1s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
  .result-mark svg path, .result-mark svg circle { stroke-dashoffset: 0; }
}

/* ---------- print: only the receipt */
.print-root { display: none; }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; min-height: 0 !important; }
  html.printing .print-root .paper { break-inside: avoid; }
  html.printing body > *:not(.print-root) { display: none !important; }
  html.printing .print-root { display: block !important; max-width: 520px; margin: 0 auto; }
  .print-root .paper { -webkit-mask: none; mask: none; box-shadow: none; border: 1px solid #ccc; border-radius: 12px; animation: none; }
  .print-root .p-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-root .p-bankref, .print-root .stamp, .print-root .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; animation: none; }
  .print-root .copy { display: none; }
}

/* receipt sheet: close button sits on the dark receipt header */
.sheet-close { z-index: 3; }
.sheet-receipt .sheet-close { top: 44px; right: 30px; background: rgba(255,255,255,.14); color: #fff; }
.sheet-receipt .p-head { padding-right: 64px; }

/* long status text wraps at spaces, references may break anywhere */
.result-ref strong { word-break: normal; overflow-wrap: anywhere; }
/* sheets open focused on their content (screen readers start there; no stray focus ring on Close) */
[autofocus]:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  .bill, .empty-paid, .empty-badge, .paper, .stamp, .result-mark, dialog.sheet, dialog.sheet::backdrop { animation: none !important; }
  .spinner { animation-duration: 2.4s !important; }
}

/* Keep the action in normal document flow so it cannot cover a payment method,
   including on short landscape phones and enlarged text. The sheet itself
   provides the bounded scroll area. */
.pay-step[data-step="choose"] #payConfirm { box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 10px 22px -10px rgba(13, 86, 86, .9); }
/* references never break mid-ID: label and value stack instead */
.result-ref > div { flex-wrap: wrap; }
.result-ref strong.mono { white-space: nowrap; }
.p-row dd .mono { overflow-wrap: anywhere; }
.p-label { padding-right: 104px; }
@media (max-width: 380px) {
  .p-row { grid-template-columns: 1fr; gap: 2px; }
  .p-row dd { text-align: left; align-items: flex-start; }
  .p-bankref dd { justify-content: flex-start; }
  .p-bankref dd small { text-align: left; }
  .p-amount { font-size: 34px; }
  .stamp { top: 16px; right: 14px; font-size: 13px; }
  .p-label { padding-right: 92px; }
}

/* A bank reference is an audit handle. On narrow member cards let it wrap so the
   visible value is readable, while the receipt remains the authoritative detail. */
@media (max-width: 420px) {
  .row-ref { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
}

.svg-defs { position: absolute; }

/* ---------- sign-in (connected mode) */
html.booting .app { visibility: hidden; }
.signin { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: calc(20px + var(--sa-top)) 18px calc(20px + var(--sa-bottom)); overflow-y: auto; color: #f3ece0; background: linear-gradient(165deg, var(--teal-800), var(--teal-950) 78%); }
.signin-pattern { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold-2); opacity: .09; pointer-events: none; }
.signin-card { position: relative; width: min(400px, 100%); display: grid; gap: 8px; padding: 26px 22px 20px; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); animation: rise .3s var(--ease) both; }
.signin-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.signin-mark { width: 46px; height: 46px; color: var(--teal-700); }
.signin-mark svg { width: 100%; height: 100%; }
.chip-light { color: var(--teal-800) !important; background: var(--teal-50) !important; border-color: transparent !important; }
.signin-card h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.01em; }
.signin-note { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; }
.signin-card label { font-size: 13px; font-weight: 650; color: var(--ink-2); margin-top: 4px; }
.signin-card input { height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: #fff; padding: 0 14px; font-size: 16px; }
.signin-card input:focus { outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-50); }
.signin-card .btn { margin-top: 12px; }
.signin-card .sheet-fine { text-align: center; margin-top: 4px; }
[hidden] { display: none !important; }

.signin-confirm { display: grid; gap: 8px; }
.signin-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.link-button { border: 0; background: none; padding: 10px 0 0; color: var(--teal-700); font-weight: 650; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
