:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --text: #17201c;
  --muted: #66736d;
  --line: #e1e7e4;
  --brand: #14a37f;
  --brand-ink: #ffffff;
  --brand-soft: #dcf3ec;
  --owed: #0f8a6a;
  --owe: #e2571e;
  --owe-soft: #fde9df;
  --danger: #c93a2e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.06);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #182019;
    --surface-2: #212b26;
    --text: #e8eeeb;
    --muted: #93a29b;
    --line: #2a3530;
    --brand: #2bc29a;
    --brand-ink: #06231a;
    --brand-soft: #173a30;
    --owed: #3ad1a7;
    --owe: #ff8a57;
    --owe-soft: #3a2219;
    --danger: #ff6b5e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.owed { color: var(--owed); }
.owe { color: var(--owe); }
.hidden { display: none !important; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(96px + var(--safe-b));
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar h1 { flex: 1; font-size: 19px; font-weight: 700; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar h1 .crumb { display: block; font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.chip .x { color: var(--muted); font-weight: 700; }
.icon-btn {
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: transparent; display: grid; place-items: center;
  flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; flex: 1; }
.brand img { width: 30px; height: 30px; }
.brand span { font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }

.section { padding: 0 16px; }
.section + .section { margin-top: 20px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 4px 8px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Hero / summary */
.hero { padding: 18px; display: grid; gap: 14px; }
.hero .label { font-size: 14px; color: var(--muted); }
.hero .big { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.hero .viewing { font-size: 13px; color: var(--muted); }
.hero .viewing button { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: 13px; }
.hero-row { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 0;
  font-weight: 650; font-size: 15px;
  background: var(--surface-2); color: var(--text);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--owe); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn.danger.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--brand); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 16px; background: var(--surface-2); border-radius: 999px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  width: 100%; text-align: left; background: none; border: 0;
}
button.row:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { text-align: right; flex: none; }
.row .right .k { font-size: 12px; color: var(--muted); }
.row .right .v { font-weight: 700; }

.date-badge { width: 36px; text-align: center; flex: none; line-height: 1.1; }
.date-badge .m { font-size: 11px; text-transform: uppercase; color: var(--muted); }
.date-badge .d { font-size: 18px; font-weight: 700; }
.cat-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--surface-2); flex: none;
}
.cat-icon.payment { background: var(--brand-soft); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 20px; }

.month { padding: 14px 18px 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); }
.empty .em { font-size: 40px; margin-bottom: 8px; }
.empty p + p { margin-top: 6px; }

.search { position: relative; margin: 0 16px 12px; }
.search input[type="text"] { padding-left: 40px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 16px 4px; }
.filters select { min-height: 40px; padding: 6px 30px 6px 12px; font-size: 14px; border-radius: 999px; background-position: right 12px center; text-overflow: ellipsis; }
.filters select.active { border-color: var(--brand); background-color: var(--brand-soft); font-weight: 600; }
.filter-summary { display: flex; justify-content: space-between; align-items: center; margin: 6px 18px 0; font-size: 14px; font-weight: 600; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); }

/* Balances */
.debt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.debt .names { flex: 1; min-width: 0; font-size: 15px; }
.debt .names b { font-weight: 650; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.owe > span { background: var(--owe); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; }
.toggle-row .grow { flex: 1; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background 0.2s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.2s;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding: 10px 14px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--brand); }
.legend i.share { background: var(--owe); }
.duo { display: grid; gap: 4px; margin-top: 6px; }
.duo .bar { margin-top: 0; height: 6px; }

/* FAB */
.fab {
  position: fixed; z-index: 6;
  right: max(16px, calc(50vw - 280px + 16px));
  bottom: calc(18px + var(--safe-b));
  min-height: 54px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 45%, transparent);
}
.fab svg { width: 20px; height: 20px; }

/* Forms */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="number"], input[type="date"], input[type="url"], input[type="tel"], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
textarea { min-height: 70px; resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366736d' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
.amount-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.amount-row input { font-size: 26px; font-weight: 700; min-height: 58px; }
.amount-row select { min-height: 58px; font-weight: 700; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 13px; font-size: 14px; font-weight: 600; white-space: nowrap; flex: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }

.segment { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.segment button { border: 0; background: transparent; padding: 8px 2px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.split-list { margin-top: 8px; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.split-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; }
.split-row + .split-row { border-top: 1px solid var(--line); }
.split-row .name { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .calc { font-size: 13px; color: var(--muted); min-width: 64px; text-align: right; }
.split-row input[type="text"] { width: 96px; min-height: 38px; padding: 6px 10px; text-align: right; border-radius: 10px; flex: none; }
.split-row label.check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.split-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); flex: none; margin: 0; }
.split-summary { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 2px 0; color: var(--muted); }
.split-summary.bad { color: var(--danger); font-weight: 600; }

/* Discount & tax: two small percentage inputs side by side, then amount → discount → tax → total. */
.rate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-input { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.rate-input input:not([type]) { flex: 1; min-width: 0; min-height: 42px; padding: 8px 10px; text-align: right; }
.price-breakdown { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.price-breakdown[hidden] { display: none; }
.price-breakdown.bad { color: var(--danger); font-weight: 600; }
.price-row { display: flex; justify-content: space-between; gap: 12px; }
.price-row.total { padding-top: 4px; border-top: 1px solid var(--line); color: var(--text); font-weight: 700; }
.detail-head + .price-breakdown { margin-bottom: 16px; }

/* Receipt scan: the entry point in the expense form, then pick → reading → review in its own sheet. */
#x-receipt { margin-bottom: 14px; }
.receipt-cta {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left;
  border: 1.5px dashed var(--brand); border-radius: 14px; background: var(--brand-soft);
}
.receipt-cta .grow { flex: 1; min-width: 0; }
.receipt-on { display: grid; gap: 8px; }
.receipt-on .btn { background: var(--surface); }
.file-pick { position: relative; margin-top: 14px; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.r-busy { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 8px 0; }
.r-preview { max-width: 100%; max-height: 220px; border-radius: 12px; box-shadow: var(--shadow); object-fit: contain; }
.progress { width: 100%; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width 0.2s; }
.r-item { display: grid; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.r-item + .r-item { margin-top: 8px; }
.r-item.check { border-color: color-mix(in srgb, var(--owe) 55%, var(--line)); }
.r-item.bad { border-color: var(--danger); }
.r-item-top { display: flex; gap: 4px; align-items: center; }
.r-item-top input { flex: 1; min-width: 0; min-height: 40px; padding: 6px 10px; }
.r-item-nums { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.r-item-nums label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.r-item-nums input { flex: 1; min-width: 0; min-height: 38px; padding: 6px 10px; text-align: right; }
.r-flag { font-size: 13px; color: var(--owe); font-weight: 600; overflow-wrap: anywhere; }
.r-flag .muted { font-weight: 400; }
.r-problem { font-size: 13px; color: var(--danger); font-weight: 600; }
.r-problem:empty { display: none; }
.r-who { gap: 6px; }
.r-who .chip { padding: 5px 10px; font-size: 13px; }
.r-adj { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.r-adj .link-btn { justify-self: end; font-size: 13px; padding: 0; }
.r-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.r-row input { width: 120px; min-height: 38px; padding: 6px 10px; text-align: right; flex: none; }
.r-row.total { padding-top: 6px; border-top: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.r-warn { color: var(--owe); font-weight: 600; }
.r-skipped { margin-top: 14px; font-size: 13px; color: var(--muted); }
.r-skipped summary { cursor: pointer; font-weight: 600; }
.r-skipped ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; overflow-wrap: anywhere; }

.member-edit { display: flex; gap: 8px; align-items: center; }
.member-edit + .member-edit { margin-top: 8px; }
.member-edit input { flex: 1; }

.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.callout.warn { background: var(--owe-soft); }
.error-text { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1px; }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / 0.38);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 94dvh;
  background: var(--bg); border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column;
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88dvh; }
}
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 6px; }
.sheet-head h2 { flex: 1; font-size: 18px; padding: 0 8px; }
.sheet-body { overflow-y: auto; padding: 6px 18px 18px; overscroll-behavior: contain; }
.sheet-foot { padding: 10px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 22px 22px; }
.sheet-foot .inline > .btn { flex: 1; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.detail-head { text-align: center; padding: 6px 0 16px; }
.detail-head .cat-icon { margin: 0 auto 10px; width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
.detail-head .amt { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(86px + var(--safe-b));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
  animation: fade 0.15s;
}
#toast.error { background: var(--danger); color: #fff; }

.home-hero { padding: 8px 20px 20px; }
.home-hero h2 { font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.home-hero p { margin-top: 6px; color: var(--muted); }
.steps { display: grid; gap: 10px; padding: 14px; }
.steps div { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.steps b { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--owed); display: grid; place-items: center; flex: none; font-size: 13px; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Settle up: who pays whom and the exact amount, then the recipient's payment methods, then the record form.
   The footer keeps the amount next to the Record payment button while the details scroll. */
#s-view { margin-top: 4px; }
#s-form > .field:first-child + #s-view { margin-top: 14px; }
.settle-summary { padding: 16px 14px 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.settle-parties { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; font-size: 15px; }
.settle-party { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.settle-party b { overflow-wrap: anywhere; }
.settle-arrow { display: inline-grid; color: var(--muted); }
.settle-arrow svg { width: 18px; height: 18px; }
.settle-amount { margin-top: 8px; font-size: clamp(30px, 9vw, 38px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--owe); overflow-wrap: anywhere; }
.settle-currency { margin-top: 4px; }
.settle-currency .link-btn { font-size: 13px; padding: 6px 2px; }
.settle-methods-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 4px 8px; min-width: 0; }
.settle-methods-head .section-title { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-label { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--owed); font-size: 13px; font-weight: 650; }
.settle-callout { margin-bottom: 10px; }
.settle-note { margin-top: 10px; }
.settle-section { margin: 24px 4px 10px; }
.pay-methods { display: grid; gap: 10px; }
.pay-method { display: grid; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.pay-head { display: flex; align-items: center; gap: 10px; }
.pay-head h3 { font-size: 16px; font-weight: 700; }
.pay-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--owed); }
.pay-icon svg { width: 18px; height: 18px; }
.pay-hint { font-size: 14px; color: var(--muted); }
.pay-hint b { color: var(--text); }
.pay-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-method .pay-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.pay-method .pay-actions .btn { white-space: nowrap; }
.pay-field { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.pay-field-text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.pay-field .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.pay-field .v { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.pay-field .btn.small { flex: none; background: var(--surface); }
.pay-field .link-btn { flex: none; padding: 8px 6px; font-size: 14px; }
.pay-qr { display: grid; gap: 12px; justify-items: center; }
.pay-qr .qr-img { width: min(100%, 220px); box-shadow: 0 0 0 1px var(--line); }
.pay-qr-side { display: grid; gap: 10px; width: 100%; }
.pay-empty { justify-items: start; gap: 6px; }
.pay-empty .btn { margin-top: 4px; }
.pay-empty .btn svg { width: 16px; height: 16px; }
.settle-foot { display: flex; align-items: center; gap: 12px; }
.settle-foot-sum { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.settle-foot-sum > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-foot-sum b { font-size: 18px; }
.settle-foot .btn { flex: none; padding: 0 22px; }
/* Wide enough for the QR to sit beside its instructions, so the other methods stay closer to the top.
   Open QR shows it full size. */
@media (min-width: 360px) {
  .pay-qr { grid-template-columns: 148px 1fr; align-items: center; justify-items: stretch; }
  .pay-qr .qr-img { width: 148px; padding: 6px; }
  .pay-qr-side .pay-actions { grid-template-columns: 1fr; }
}
@media (min-width: 480px) {
  .pay-qr { grid-template-columns: 180px 1fr; }
  .pay-qr .qr-img { width: 180px; padding: 8px; }
  .pay-qr-side .pay-actions { grid-template-columns: 1fr 1fr; }
}
fieldset.field { margin-inline: 0; padding: 0; border: 0; min-width: 0; }
a.btn { text-decoration: none; }
.qr-img { display: block; width: min(100%, 300px); height: auto; margin: 0 auto; padding: 8px; border-radius: 12px; background: #fff; }
#p-qr { display: grid; gap: 10px; margin-bottom: 6px; }
.pay-btn.has { color: var(--brand); }
/* A remembered person with payment details saved in the group. */
.chip-pay { display: inline-flex; color: var(--brand); }
.chip-pay svg { width: 14px; height: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Trip retention notice (public/retention.js) */
.section + .section.retention { margin-top: 10px; }
.retention-note { margin: 8px 4px 0; line-height: 1.4; }
.retention .retention-note { margin: 0 4px; }
.retention-callout { line-height: 1.45; }
.retention-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.retention-actions .btn { background: var(--surface); }

/* Payment reminders (public/reminders.js) */
.remind-box { margin-top: 12px; }
.remind-box:empty { display: none; }
.remind-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; }
.remind-card .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.remind-card p { line-height: 1.4; }
.remind-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--brand-soft); font-size: 16px; }
.remind-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Install Tripsplit (public/install.js) */
.install-done { background: var(--brand-soft); }
.install-h { font-size: 15px; font-weight: 700; margin: 18px 0 6px; }
.install-list, .install-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.45; }
.install-here { margin-top: 8px; line-height: 1.4; }
.install-other { margin-top: 14px; font-size: 14px; }
.install-other summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 8px 0; }
.install-other h4 { margin: 10px 0 6px; font-size: 14px; }
