:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #efeadf;
  --text: #1d2420;
  --muted: #5f6b64;
  --line: #ddd6c7;
  --brand: #2f5d46;
  --brand-ink: #ffffff;
  --brand-soft: #dfeadf;
  --accent: #b5652a;
  --ok: #2e7d4f;
  --ok-soft: #dcf0e2;
  --warn: #9a6200;
  --warn-soft: #fbedc9;
  --bad: #b3261e;
  --bad-soft: #f8dcd9;
  --info: #285e8e;
  --info-soft: #dbe8f5;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .04);
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111814;
    --surface: #1a231e;
    --surface-2: #232e28;
    --text: #e9eee9;
    --muted: #9fada5;
    --line: #2f3b34;
    --brand: #7fc29b;
    --brand-ink: #0d1a12;
    --brand-soft: #22382b;
    --accent: #e39a5c;
    --ok: #7fd09c;
    --ok-soft: #1e3a29;
    --warn: #f0c060;
    --warn-soft: #3a3019;
    --bad: #ff8a80;
    --bad-soft: #3d1f1d;
    --info: #8ab8e6;
    --info-soft: #1c2c3d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ── header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
/* "Rockford Bay Ranch" when it fits beside the Buy/Manage switch, otherwise "RBR". app.js sets .tight by measuring. */
.brand, .viewas { flex: none; }
.brand .short { display: none; }
.top.tight .brand .long { display: none; }
.top.tight .brand .short { display: inline; }
.viewas { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.viewas button {
  border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted);
  min-height: 34px;
}
.viewas button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 20px; margin: 28px 0 10px; letter-spacing: -.01em; }
h2 .count { color: var(--muted); font-weight: 500; }
.sub { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }

/* ── bottom tabs */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; justify-content: center; position: relative;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs .badge { position: absolute; top: 2px; left: calc(50% + 6px); }

/* ── cards & lists */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card.tight { padding: 12px 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > .item { padding: 14px 16px; border-top: 1px solid var(--line); }
.list > .item:first-child { border-top: 0; }
.item .title { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; object-fit: cover; }

/* ── stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.attn { border-color: var(--warn); background: var(--warn-soft); }

/* ── pills / badges */
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.plain { background: var(--surface-2); color: var(--muted); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ── buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; text-decoration: none; color: var(--text); cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 38px; padding: 0 12px; border-radius: 11px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 8px 0; cursor: pointer; }

/* ── products / stepper */
.product { display: flex; align-items: center; gap: 12px; }
.product .price { color: var(--muted); font-size: 15px; }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 22px; font-weight: 600; line-height: 1; cursor: pointer; touch-action: manipulation;
}
.stepper button.plus { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.stepper output { width: 32px; text-align: center; font-weight: 700; font-size: 19px; }

.checkout {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding: 10px 16px; z-index: 4;
}
.checkout .btn { max-width: 688px; margin: 0 auto; display: flex; width: 100%; box-shadow: 0 6px 20px rgb(0 0 0 / .18); min-height: 56px; font-size: 18px; }

/* ── pay screen */
.amount { font-size: 44px; font-weight: 750; letter-spacing: -.03em; margin: 4px 0; }
.refbox {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 2px dashed var(--accent); border-radius: 14px; padding: 12px 14px; margin: 12px 0;
}
.refbox .ref { font-size: 26px; font-weight: 750; }
/* Payment Memo: label + (i) on the first row, the memo + Copy on the second, the how-to opens underneath. */
.refbox.memo { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
.memo-label { font-size: 14px; font-weight: 650; color: var(--muted); }
.infobtn {
  width: 44px; height: 36px; margin: -8px -12px -4px 0; padding: 0; border: 0; background: none;
  display: grid; place-items: center; justify-self: end; cursor: pointer; border-radius: 10px;
}
.infobtn span {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; font: italic 700 14px/1 Georgia, "Times New Roman", serif;
}
.infobtn[aria-expanded="true"] span { background: var(--accent); color: var(--surface); }
.memo-info {
  display: none; grid-column: 1 / -1; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 15px;
}
.refbox.memo.open .memo-info, .infobtn:focus-visible ~ .memo-info { display: block; }
@media (hover: hover) {
  .infobtn:hover span { background: var(--accent); color: var(--surface); }
  .infobtn:hover ~ .memo-info { display: block; }
}
.memo-info ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.memo-info p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.paylist .btn { justify-content: flex-start; min-height: 60px; font-size: 18px; }
.paylist .btn .sub2 { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.dot { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: none; }
.dot.venmo { background: #008cff; }
.dot.cashapp { background: #00c244; }
.dot.applecash { background: #111; }
@media (prefers-color-scheme: dark) { .dot.applecash { background: #f2f2f2; color: #111; } }
.dot.cash { background: #6b7d3a; }
.dot.check { background: #56698f; }
.dot svg { width: 24px; height: 24px; display: block; }
.steps { padding-left: 20px; margin: 8px 0 0; }
.steps li + li { margin-top: 6px; }
.notice { border-radius: 14px; padding: 12px 14px; margin: 12px 0; background: var(--info-soft); color: var(--info); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.bigcheck { font-size: 56px; line-height: 1; }

/* ── forms */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=number], input[type=tel], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 17px;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }
.hint { font-size: 14px; color: var(--muted); margin-top: 6px; }
h1 + .seg { margin-top: 10px; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ── report bars */
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: flex; margin-top: 6px; }
.bar i { display: block; height: 100%; }
.m-venmo { background: #008cff; } .m-cashapp { background: #00c244; } .m-applecash { background: #555; }
.m-cash { background: #6b7d3a; } .m-check { background: #56698f; } .m-other { background: #999; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ── bottom sheet */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88vh;
  border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / .4); }
.sheet .inner { padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px); overflow-y: auto; max-height: 88vh; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 10px; }
.sheet h3 { margin: 0 0 12px; font-size: 20px; }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 20px; } }

/* ── toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 84px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 20; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

/* ── sign-in */
.signin { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.signin .logo { width: 160px; height: 160px; margin: 0 auto 12px; display: block; }
.signin h1 { font-size: 32px; }
.gbtn { gap: 12px; padding: 0 22px; }
.gbtn svg { width: 20px; height: 20px; }

details.more summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 6px 0; }
pre.code { background: var(--surface-2); padding: 12px; border-radius: 12px; overflow-x: auto; font-size: 12px; max-height: 280px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 15px; }
table.simple td, table.simple th { padding: 8px 4px; border-top: 1px solid var(--line); text-align: left; }
table.simple td.num, table.simple th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ── link/button rows */
a.plainlink, a.notice, a.stat { color: inherit; text-decoration: none; display: flex; }
a.notice { display: flex; }
a.stat { display: block; }
.btnless { appearance: none; border: 0; background: none; text-align: left; width: 100%; cursor: pointer; color: inherit; font: inherit; }
.list > .btnless.item { border-top: 1px solid var(--line); }
.list > .btnless.item:first-child { border-top: 0; }
.dot.sm { width: 18px; height: 18px; border-radius: 5px; font-size: 11px; }
.dot.sm svg { width: 14px; height: 14px; stroke-width: 2.3; }
#find { margin-top: 12px; }
#mp { flex-wrap: wrap; overflow: visible; }

/* ── companies: a field label with an (i), people waiting, sheet sections */
div.field { margin-bottom: 14px; }
.fieldhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.fieldhead label { font-size: 14px; font-weight: 600; color: var(--muted); }
.fieldhead .infobtn { margin: -8px -10px -8px 0; }
.infotext { display: none; font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.infotext.open, .fieldhead:has(.infobtn:focus-visible) ~ .infotext { display: block; }
@media (hover: hover) { .fieldhead:has(.infobtn:hover) ~ .infotext { display: block; } }
.waitrow { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.waitrow .row { margin-top: 8px; }
.row select { flex: 1; min-width: 0; }
.sheet h3.gap { margin-top: 26px; }
h3 .count { color: var(--muted); font-weight: 500; }
label.field.gap { margin-top: 16px; }
.sheet .btns { margin-bottom: 4px; }
.sheet .btns .btn { white-space: nowrap; }   /* two that don't fit side by side stack instead of breaking their labels */
.pill.mono { letter-spacing: .04em; }
.notice .link { color: inherit; font: inherit; font-weight: 700; text-decoration: underline; padding: 0; }
/* The seal is dark green: on a dark screen it sits on a paper-coloured disc so its ring and lettering stay readable. */
@media (prefers-color-scheme: dark) { .signin .logo { background: #f6f3ec; border-radius: 50%; padding: 5px; } }
