/* Rebeloty, styled after Stripe Checkout / Dashboard / receipts. */
:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --ink: #1a1f36;
  --text: #30313d;
  --muted: #6a7383;
  --faint: #a3acb9;
  --line: #e3e8ee;
  --line-soft: #ebeef1;
  --brand: #635bff;
  --brand-hover: #5851ec;
  --brand-soft: #f2f1ff;
  --success: #1ea672;
  --success-soft: #d7f7c2;
  --success-ink: #05690d;
  --danger: #df1b41;
  --warn-soft: #ffde92;
  --warn-ink: #a8510c;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 0 0 1px rgba(50, 50, 93, 0.06), 0 2px 5px 0 rgba(50, 50, 93, 0.09), 0 1px 1px 0 rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Ubuntu, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--surface); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body.tinted { background: var(--bg); }
.page { max-width: 440px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
button[disabled] { opacity: 0.5; cursor: default; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); font-size: 14px; min-height: 1px; }
.stack > * + * { margin-top: 16px; }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 22px; }
.merchant { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); font-size: 15px; min-width: 0; }
.merchant .sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.logo { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.logo.lg { width: 48px; height: 48px; font-size: 20px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.lang { display: inline-flex; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.lang button { padding: 3px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.lang button.on { background: var(--ink); color: #fff; }
.lang button:not(.on):hover { color: var(--ink); }
.test-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--warn-soft); color: var(--warn-ink); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; padding: 0 16px; border-radius: var(--radius); font-weight: 600; font-size: 16px; transition: background 0.15s, box-shadow 0.15s; text-decoration: none; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(60, 66, 87, 0.08); }
.btn-primary:hover:not([disabled]) { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.btn-secondary:hover { color: var(--ink); }
.btn-link { width: 100%; padding: 10px; color: var(--muted); font-weight: 500; font-size: 14px; }
.btn-link:hover { color: var(--ink); }
.btn-inline { width: auto; height: auto; padding: 4px 6px; font-size: 14px; font-weight: 500; color: var(--brand); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; }
.label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.eyebrow { font-size: 15px; color: var(--muted); font-weight: 500; }
.big-amount { font-size: 36px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* ---------- line items (Checkout summary) ---------- */
.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.lines td { padding: 6px 0; vertical-align: top; }
.lines td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.lines .item td { padding: 14px 0 12px; color: var(--ink); font-weight: 500; font-size: 15px; }
.lines .sub td { color: var(--muted); }
.lines .rule td { border-top: 1px solid var(--line-soft); padding: 0; height: 8px; }
.lines .total td { font-weight: 600; color: var(--ink); font-size: 15px; padding-top: 8px; }
.lines .credit td { color: var(--success-ink); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 0 6px; border-radius: 4px; background: var(--line-soft); color: var(--text); line-height: 20px; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success-ink); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge { height: 20px; }
.badge svg { width: 11px; height: 11px; display: block; flex: none; }

/* ---------- segmented control ---------- */
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--line-soft); border-radius: 8px; margin-bottom: 22px; }
.segmented button { flex: 1; padding: 7px 10px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(50, 50, 93, 0.04); }
.count { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- options (tips) and chips (presets) ---------- */
.options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.option { padding: 9px 4px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line), 0 1px 1px rgba(0, 0, 0, 0.03); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.3; text-align: center; }
.option small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.option:hover { box-shadow: inset 0 0 0 1px var(--faint); }
.option.on { box-shadow: inset 0 0 0 2px var(--brand); color: var(--brand); }
.option.on small { color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 5px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 500; color: var(--text); background: var(--surface); }
.chip:hover { box-shadow: inset 0 0 0 1px var(--faint); color: var(--ink); }

/* ---------- keypad ---------- */
.amount-entry { text-align: center; padding: 10px 0 6px; }
.amount-entry .big-amount { font-size: 54px; }
.amount-entry .hint { min-height: 22px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 14px 0 12px; }
.keypad button { height: 58px; border-radius: 10px; font-size: 25px; font-weight: 500; color: var(--ink); }
.keypad button:active { background: var(--line-soft); }

/* ---------- dashboard lists ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 10px; }
.section-head:first-child { margin-top: 0; }
.list { border-radius: var(--radius-lg); box-shadow: var(--shadow); background: var(--surface); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.row-item:first-child { border-top: 0; }
.row-item .main { flex: 1; min-width: 0; }
.row-item .title { color: var(--ink); font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-item .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .side { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.row-item .amount { font-variant-numeric: tabular-nums; }
.row-item .was { font-size: 13px; }
.empty { padding: 22px 16px; color: var(--muted); font-size: 14px; text-align: center; }

/* card brand mark */
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 22px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line); font-size: 9px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; color: #1a1f71; background: #fff; flex: none; font-style: italic; }
.brand-mark.mastercard { color: #eb001b; font-style: normal; }
.brand-mark.amex { color: #fff; background: #2e77bc; box-shadow: none; font-style: normal; }
.brand-mark.discover { color: #e55c20; font-style: normal; }
.brand-mark.card { color: var(--muted); font-style: normal; }

/* ---------- QR / waiting ---------- */
.qr { width: 100%; max-width: 270px; margin: 0 auto; display: block; padding: 12px; border-radius: var(--radius-lg); box-shadow: var(--shadow); background: #fff; }
.qr img { width: 100%; display: block; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; display: inline-block; }
.btn-primary .spinner { width: 18px; height: 18px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- success ---------- */
.paid { text-align: center; padding-top: 6px; animation: rise 0.35s ease-out; }
.check { width: 56px; height: 56px; border-radius: 50%; background: var(--success); display: grid; place-items: center; margin: 0 auto 16px; animation: pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.check svg { width: 28px; height: 28px; }
.success-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.paid .big-amount { margin-top: 2px; }
.was { color: var(--muted); text-decoration: line-through; font-size: 15px; font-variant-numeric: tabular-nums; }
.paid .badges { margin-top: 10px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.kv { margin: 22px 0 0; text-align: left; border-top: 1px solid var(--line-soft); }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.kv dd.credit { color: var(--success-ink); }
.note { margin: 14px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- inputs ---------- */
.field { display: flex; gap: 8px; }
.field .btn { width: auto; flex: none; }
.input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 0; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line), 0 1px 1px rgba(0, 0, 0, 0.03); outline: none; transition: box-shadow 0.15s; }
.input::placeholder { color: var(--faint); }
.input:focus { box-shadow: 0 0 0 1px rgba(99, 91, 255, 0.6), 0 0 0 4px rgba(99, 91, 255, 0.22); }

/* ---------- value meter ---------- */
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.value-amt { font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.value-amt .muted { font-size: 14px; font-weight: 500; }
.progress { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.progress > div { height: 100%; min-width: 4px; background: var(--brand); border-radius: 999px; transition: width 0.4s; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

/* ---------- settings (Rewards) ---------- */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.setting-title { font-weight: 500; color: var(--ink); font-size: 14px; }
.input.sm { width: 92px; flex: none; height: 36px; font-size: 15px; text-align: right; }
.input.xs { width: 58px; flex: none; height: 34px; font-size: 15px; text-align: right; padding: 0 8px; }
.money-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tier { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.icon-btn { width: 30px; height: 30px; border-radius: 6px; color: var(--muted); font-size: 18px; line-height: 1; margin-left: auto; }
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.switch { position: relative; width: 36px; height: 20px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d5dbe1; border-radius: 999px; transition: background 0.15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.3); }
#preview td { padding: 8px 0; vertical-align: middle; }

/* ---------- footer ---------- */
.powered { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 30px; font-size: 12px; color: var(--faint); }
.powered b { color: var(--muted); font-weight: 600; }
.powered .sep { width: 1px; height: 12px; background: var(--line); }

/* ---------- checkout layout (pay page) ---------- */
.pay-col { margin-top: 28px; }
#payment-element { margin: 4px 0 18px; min-height: 120px; }
#express-checkout-element { margin-bottom: 4px; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 16px; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (min-width: 880px) {
  html:has(body.checkout), body.checkout { background: linear-gradient(90deg, var(--bg) 50%, var(--surface) 50%) fixed; min-height: 100vh; }
  body.checkout .page { max-width: 920px; padding-top: 64px; }
  .checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 96px; }
  .checkout-grid .pay-col { margin-top: 0; padding-top: 56px; }
  body.checkout::after { content: ""; position: fixed; top: 0; bottom: 0; left: 50%; width: 1px; box-shadow: -10px 0 28px rgba(0, 0, 0, 0.05); pointer-events: none; }
}

/* ---------- receipt ---------- */
.receipt-head { text-align: center; padding: 6px 0 22px; }
.receipt-head .logo { margin: 0 auto 14px; }
.receipt-head h1 { font-size: 22px; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 18px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.v { font-size: 14px; color: var(--ink); margin-top: 3px; font-weight: 500; }
.k-label { margin: 22px 0 8px; }
.summary-box { background: var(--bg); border-radius: 8px; padding: 6px 16px 10px; }
.summary-box .lines td { padding: 8px 0; }
.summary-box .lines .total td { padding-top: 10px; }

@media print {
  body, body.tinted { background: #fff; }
  .noprint { display: none !important; }
  .card { box-shadow: none; padding: 0; }
  .summary-box { background: #f6f9fc; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- demo guide (/demo) ---------- */
[data-only] { display: none; }
html[lang="en"] [data-only="en"], html[lang="fr"] [data-only="fr"] { display: block; }
body.guide .page { max-width: 640px; }
.guide .merchant:hover { color: var(--ink); }
.guide-hero { padding: 22px 0 4px; }
.guide-hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.025em; margin-top: 14px; }
.guide-hero .lead { font-size: 16px; color: var(--muted); margin: 12px 0 0; }
.rule-now { margin-top: 18px; padding: 10px 14px; border-radius: 8px; background: var(--brand-soft); font-size: 14px; }
.guide h2 { font-size: 19px; letter-spacing: -0.015em; margin: 40px 0 4px; }
.guide h3 { font-size: 14px; margin: 20px 0 8px; }
.guide p { margin: 8px 0; }
.guide p.muted { margin-top: 2px; }
.guide b { color: var(--ink); font-weight: 600; }
.guide .card ul, .guide ul.plain { margin: 0; padding-left: 18px; }
.guide ul li + li { margin-top: 8px; }
.guide .badge { vertical-align: 1px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 16px 0 0; }
.steps li { counter-increment: step; position: relative; padding: 2px 0 0 40px; min-height: 28px; }
.steps li + li { margin-top: 16px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.callout { margin-top: 20px; padding: 12px 14px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-soft); font-size: 14px; }
.faq { margin: 4px 0 0; }
.faq dt { font-weight: 600; color: var(--ink); margin-top: 16px; }
.faq dd { margin: 4px 0 0; }
.guide-cta { display: flex; gap: 20px; align-items: center; margin-top: 44px; }
.guide-cta img { width: 116px; height: 116px; flex: none; border-radius: 6px; }
.guide-cta .btn + .btn { margin-top: 10px; }
@media (max-width: 599px) { .desk-only { display: none !important; } }
.guide-link { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); line-height: 18px; }
.guide-link:hover { color: var(--ink); }

/* ---------- forms, partner programme (/partners, /partners/<token>, /join) ---------- */
.fld { display: block; }
.fld + .fld { margin-top: 14px; }
.fld .input { width: 100%; }
.label .opt { color: var(--faint); font-weight: 400; }
select.input { padding-right: 8px; cursor: pointer; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 18px 0 16px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.form-msg { margin-top: 10px; font-size: 14px; min-height: 1px; }
.form-msg.err { color: var(--danger); }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-size: 14px; }
.copy-row .btn { width: auto; flex: none; }
.qr-sm { width: 128px; height: 128px; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-soft); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tiles .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.guide ul.small li { font-size: 14px; }

/* "What changes, what doesn't" box (/join, /demo) */
.changes-group { margin-top: 16px; }
.changes-group > .badge { margin-bottom: 8px; }
.changes-group li + li { margin-top: 6px; }
.tiles.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 420px) { .tiles.four { grid-template-columns: repeat(2, 1fr); } }
button.guide-link { background: none; border: 0; font-family: inherit; cursor: pointer; }
.btn.btn-sm { display: inline-flex; width: auto; height: 34px; padding: 0 12px; font-size: 14px; }
.session-bar { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; }
.session-bar select.input { flex: 1; min-width: 0; height: 36px; padding-top: 0; padding-bottom: 0; }
.session-bar .spacer { flex: 1; }
.session-bar select.input:not(.hidden) + .spacer { display: none; }

/* Loyalty banner: the guest sees it just before paying (pay page, QR screen) */
.join-box { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 20px; color: var(--ink); }
.join-box .check-row { margin: 0; }
.join-box small { display: block; color: var(--muted); font-size: 13px; line-height: 18px; margin-top: 4px; }
.join-box .btn { margin-top: 12px; }
.join-box .btn-link { display: block; margin-top: 8px; padding: 0; }
.loyalty-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: linear-gradient(135deg, var(--brand-soft), rgba(255, 255, 255, 0.6)); box-shadow: inset 0 0 0 1px rgba(99, 91, 255, 0.18); text-align: left; }
.loyalty-banner .lb-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.loyalty-banner .lb-icon svg { width: 18px; height: 18px; }
.loyalty-banner .lb-title { font-weight: 600; color: var(--ink); font-size: 14px; line-height: 20px; }
.loyalty-banner .lb-text { color: var(--muted); font-size: 13px; line-height: 18px; margin-top: 2px; }

/* Demo guide: Stripe's fees */
.fee-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.fee-table th { padding: 6px 0 6px 8px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 500; line-height: 16px; text-align: right; vertical-align: bottom; }
.fee-table td { padding: 6px 0 6px 8px; color: var(--ink); text-align: right; white-space: nowrap; }
.fee-table th:first-child, .fee-table td:first-child { padding-left: 0; text-align: left; }
.fee-table td:first-child { white-space: normal; }
@media (max-width: 360px) { .fee-table td { white-space: normal; } }

/* Restaurant calculator: figures on the left, the month's bill on the right (stacked on a phone) */
body.calc-page .page { max-width: 1000px; }
.calc-page .guide-hero { max-width: 640px; }
.calc { display: grid; gap: 28px; margin-top: 8px; }
.calc form h2 { margin: 28px 0 8px; }
.calc .segmented { margin: 12px 0 0; }
.calc .segmented button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.calc .setting { cursor: text; }
.calc-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 18px; }
.calc-slider { display: block; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.calc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.calc-top output { flex: none; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.calc-slider input[type=range] { display: block; width: 100%; height: 24px; margin: 8px 0 0; accent-color: var(--brand); }
.calc .gain { color: var(--success-ink); }
.calc .loss { color: var(--danger); }
.bill { position: relative; padding: 18px 18px 14px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--bg); }
.bill::after { content: ''; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: linear-gradient(135deg, var(--bg) 50%, transparent 50%) 0 0 / 16px 8px repeat-x, linear-gradient(225deg, var(--bg) 50%, transparent 50%) 0 0 / 16px 8px repeat-x; }
.calc-page .bill h2 { margin: 0 0 10px; font-size: 16px; }
.bill .lines td:first-child { color: var(--text); }
.bill .lines td:last-child { color: var(--ink); }
.bill .lines td.gain { color: var(--success-ink); }
.bill .lines td.loss { color: var(--danger); }
.bill .lines .total td { color: var(--ink); vertical-align: baseline; }
.bill .lines .total td:last-child { font-size: 26px; letter-spacing: -0.02em; }
.bill .lines .total td.gain { color: var(--success-ink); }
.bill .lines .total td.loss { color: var(--danger); }
.calc-page p.calc-verdict { margin: 22px 0 0; color: var(--ink); font-size: 15px; }
.fee-table tr.current td { font-weight: 600; background: var(--brand-soft); }
.calc-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 18px; padding: 12px 14px; border-radius: 10px 10px 0 0; background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 -4px 12px rgba(50, 50, 93, 0.08); color: var(--text); font-size: 14px; }
.calc-bar b { font-size: 18px; font-variant-numeric: tabular-nums; }
.calc-bar:hover { color: var(--ink); }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) 420px; gap: 56px; align-items: start; }
  .calc-result { position: sticky; top: 16px; margin-top: 28px; }
  .calc-bar { display: none; }
}
.bill .lines .subtotal td { padding-top: 8px; color: var(--ink); font-weight: 600; }
.bill .lines .subtotal td.gain { color: var(--success-ink); }
.bill .lines .subtotal td.loss { color: var(--danger); }

/* The calculators' assumption from the studies, and the sources under them */
.scen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
@media (min-width: 520px) { .scen { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.scen button { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.scen button b { color: var(--ink); font-size: 13px; font-weight: 600; }
.scen button small { color: var(--muted); font-size: 12px; }
.scen button span { font-size: 15px; font-weight: 600; white-space: nowrap; }
.scen button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.scen button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.sources { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.sources summary { color: var(--brand); font-weight: 500; cursor: pointer; }
.sources p { margin: 10px 0 0; }
.sources ul { margin: 10px 0 0; padding-left: 18px; }
.sources li + li { margin-top: 8px; }
