:root { --bg: #f6f7f9; --card: #fff; --ink: #1c2330; --muted: #6b7686; --line: #e2e6ec; --accent: #2f6fed; --pos: #1a8a4a; --neg: #c0392b; }
/* dark: when the device is dark and nothing was chosen in Settings, or when dark was chosen there */
:root[data-theme="dark"] { --bg: #14171c; --card: #1d2229; --ink: #e8ecf2; --muted: #98a2b3; --line: #2b323c; --accent: #6b9bff; --pos: #4cc27f; --neg: #ff7b6b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #14171c; --card: #1d2229; --ink: #e8ecf2; --muted: #98a2b3; --line: #2b323c; --accent: #6b9bff; --pos: #4cc27f; --neg: #ff7b6b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font, system-ui, sans-serif); font-size: var(--fs, 16px); line-height: 1.45; }
header { position: sticky; top: 0; z-index: 75; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--head-bg, var(--card)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.status { font-size: .8rem; color: var(--muted); text-align: right; flex: 0 0 auto; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.offline, .status.waiting { color: var(--neg); }
.status.synced { color: var(--pos); }
/* the menu at the bottom of the screen: the page you are on is blue, the group pages are greyed out until there is a group */
/* The menu is part of the page (the last thing in it) and sticks to the bottom of the screen, instead of being position: fixed: on an iPhone a fixed bar can come loose
   and float half way up the screen (after the keyboard, or when the browser's own bars move). The body is as tall as the screen at least, so on a short page the menu is still at the bottom. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#tabbar { position: sticky; bottom: 0; flex: none; z-index: 80; display: flex; justify-content: center; background: var(--bar-bg, var(--card)); border-top: 1px solid var(--bar-line, var(--line)); padding-bottom: env(safe-area-inset-bottom); }
#tabbar a { flex: 1; max-width: 128px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--bar-ink, var(--muted)); text-decoration: none; font-size: .72rem; -webkit-tap-highlight-color: transparent; }
#tabbar a.on { color: var(--bar-on, var(--accent)); font-weight: 600; }
#tabbar a.disabled { opacity: .35; pointer-events: none; }
#tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.day { margin: 14px 0 2px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.day:first-of-type { margin-top: 0; }
button.danger { background: var(--neg); border-color: var(--neg); }
/* the list of designs on the Settings page */
.dz-list { display: grid; gap: 8px; }
.dz { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 10px 12px; }
.dz.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.dz b { font-weight: 600; }
.dz small { grid-column: 2; color: var(--muted); font-size: .8rem; }
.dz-sw { grid-row: span 2; display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.dz-sw i { display: block; width: 18px; height: 34px; }
.kv .row span:last-child { color: var(--muted); text-align: right; word-break: break-word; }
.notice { background: color-mix(in srgb, var(--neg) 10%, var(--card)); border-color: var(--neg); }
.linkbox { padding: 4px 0 10px; }
.pers .row { align-items: flex-start; }
/* an expense and its card, opened in place */
/* a row that was just added (here or by a sync): shaded in the accent colour, then fading away */
.exp.fresh > .erow { margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius-s, 8px); animation: fresh-fade 6s ease-out 1 both; }
@keyframes fresh-fade { 0%, 30% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .exp.fresh > .erow { animation: none; background: color-mix(in srgb, var(--accent) 22%, transparent); } }
/* the card of an expense, opened in place: .detail is the slot that grows from nothing, .detail-in the card */
.detail { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .24s ease, visibility 0s .24s; }
.detail.open { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .24s ease; }
.detail-in { position: relative; min-height: 0; overflow: hidden; }
.detail.open .detail-in { margin: 2px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-s, 8px); background: color-mix(in srgb, var(--bg) 60%, var(--card)); font-size: .92rem; }
.ev { padding: 4px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.detail .btn { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .detail, .detail.open { transition: none; } }
a.rowlink { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
/* the expense form: the method as three buttons, and a bar at the bottom (the summary and Save) that stays in view above the menu */
.seg { display: flex; }
.seg button { flex: 1; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 0; padding: var(--ctl-pad, 8px 6px); font-size: .9rem; }
.seg button + button { border-left: 0; }
.seg button:first-child { border-radius: var(--radius-s, 8px) 0 0 var(--radius-s, 8px); }
.seg button:last-child { border-radius: 0 var(--radius-s, 8px) var(--radius-s, 8px) 0; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); font-weight: 600; }
#method-hint { margin: 6px 0 8px; }
.formbar { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 14px; padding-top: 10px; background: var(--card); border-top: 1px solid var(--line); }
.formbar .summary { margin: 0 0 8px; font-size: .92rem; font-weight: 600; }
h2.crumb { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
#updatebar { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
#updatebar[hidden] { display: none; }
#updatebar button { background: var(--accent); color: var(--accent-ink, #fff); border: 0; border-radius: 8px; padding: 6px 14px; font-weight: 600; }
.invite { display: flex; gap: 8px; }
.invite input { flex: 1; font-size: .85rem; }
.warn { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
header a { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; font-family: var(--head-font, inherit); flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { flex: 1 0 auto; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: var(--pad, 14px); margin-bottom: 16px; box-shadow: var(--shadow, none); }
h2, h3 { margin: 0 0 10px; font-family: var(--head-font, inherit); }
label { display: block; margin: 8px 0 4px; color: var(--muted); font-size: .9rem; }
input, select, textarea, button { font: inherit; padding: var(--ctl-pad, 8px 10px); border: 1px solid var(--line); border-radius: var(--radius-s, 8px); background: var(--card); color: var(--ink); }
input, select, textarea { width: 100%; }
textarea { resize: vertical; }
button { cursor: pointer; background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
button.wide, a.btn.wide { width: 100%; margin-bottom: 16px; }
a.btn { display: block; box-sizing: border-box; text-align: center; text-decoration: none; padding: var(--ctl-pad, 8px 10px); border-radius: var(--radius-s, 8px); background: var(--accent); color: var(--accent-ink, #fff); border: 1px solid var(--accent); }
a.cancel { align-self: center; color: var(--muted); text-decoration: none; padding: 0 8px; }
[hidden] { display: none !important; }          /* hidden means hidden, whatever display a class gives the element */
button.link { background: none; color: var(--muted); border: 0; padding: 0 4px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: var(--row-pad, 6px 0); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); font-size: .9rem; }
.who { display: flex; align-items: center; gap: 8px; }
.who input[type=checkbox] { width: auto; }
.who input[type=number] { width: 90px; margin-left: auto; }
.error { color: var(--neg); margin: 8px 0; }
a.group { display: block; color: var(--ink); text-decoration: none; }

.narrow { max-width: 640px; margin: 0 auto; }
@media (min-width: 900px) {      /* a computer: a wider page in two columns, and the menu as wide as the page */
  main { max-width: 960px; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
  #tabbar { width: 100%; max-width: 960px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
  #tabbar a { max-width: 160px; padding: 10px 0 9px; font-size: .8rem; }
  #tabbar svg { width: 26px; height: 26px; }
  #updatebar { left: 50%; right: auto; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); }
}

/* photos of an expense: small squares, a tap opens the picture full size */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbwrap { position: relative; }
.thumb { width: 84px; height: 84px; padding: 0; overflow: hidden; background: color-mix(in srgb, var(--bg) 60%, var(--card)); border: 1px solid var(--line); border-radius: var(--radius-s, 8px); color: var(--muted); font-size: .75rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbwrap .rm { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; line-height: 1; }
.addphoto { color: var(--accent); padding: 8px 0; }
#lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: 12px; }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
#lightbox .lbbar { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; }

/* the crop viewer for a photo */
#cropper { position: fixed; inset: 0; z-index: 210; background: #111; color: #fff; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); gap: 10px; }
#crop-msg { margin: 0; font-size: .9rem; text-align: center; color: #ddd; }
#crop-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#crop-stage canvas { touch-action: none; display: block; }
#crop-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#crop-bar button.secondary { background: #333; border-color: #555; color: #fff; }
.thumbs { align-items: center; }
/* the + after the photos: a round button with a drawn plus, so it is centred whatever the font */
.plus { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-radius: 50%; line-height: 0; flex: none; }
.plus svg { display: block; }
.closecard { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.closecard:hover { background: var(--line); color: var(--ink); }
.qrbox { text-align: center; padding: 6px 0 4px; }
.qrbox svg { width: min(220px, 70vw); height: auto; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
button.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
/* the camera window that reads a QR code */
#scanner { position: fixed; inset: 0; z-index: 220; background: #111; color: #fff; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); gap: 10px; }
#scan-msg { margin: 0; text-align: center; font-size: .95rem; color: #ddd; }
#scan-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#scan-stage video { max-width: 100%; max-height: 100%; border-radius: 10px; }
#scan-bar { display: flex; justify-content: center; }
#scanner button.secondary { background: #333; border-color: #555; color: #fff; }
.install { border-color: var(--accent); font-size: .92rem; }
.install h3 { font-size: 1rem; margin-bottom: 4px; }
.steps { margin: 6px 0 8px; padding-left: 22px; }
.steps li { margin: 4px 0; }
.shareicon { vertical-align: -3px; color: var(--accent); }
/* the round + in the header (Expenses page): always at the top right, because the header stays at the top of the screen */
header a#add-expense { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff); line-height: 0; }
header a#add-expense svg { display: block; }

/* the Expenses page: a summary, search, and the expenses by day, each a person's circle, the name and what it was, and the amount */
.sumstrip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sumstrip:has(> div:only-child) { grid-template-columns: 1fr; }
.sumstrip > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: 10px 12px; box-shadow: var(--shadow, none); min-width: 0; }
.sumstrip small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.sumstrip b { display: block; margin-top: 2px; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.sumstrip .cur { font-size: .8rem; font-weight: 500; color: var(--muted); }
.expctl { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border-radius: 999px; padding: 5px 14px; font-size: .85rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.chips button.on { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }
.daysec { margin-bottom: 8px; }
.dayhead { position: sticky; top: var(--head-h, 58px); z-index: 20; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 4px 6px; background: var(--bg); font-size: .82rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.daycard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: 2px 12px; box-shadow: var(--shadow, none); }
.exp { position: relative; }
.exp + .exp::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 1px solid var(--line); }
.erow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; -webkit-tap-highlight-color: transparent; }
.erow:active { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.exp.open > .erow { padding-bottom: 4px; }
.etext { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.etitle { font-weight: 500; overflow-wrap: anywhere; }
.esub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; color: var(--muted); font-size: .82rem; }
.mark { display: inline-flex; align-items: center; gap: 3px; }
.mark svg { width: 13px; height: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.eamt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.eamt small { display: block; font-weight: 400; font-size: .78rem; }
.av { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-style: normal; font-weight: 600; font-size: .95rem; flex: none; }
.av2 { position: relative; display: block; width: 36px; height: 36px; }
.av2 .av { position: absolute; width: 24px; height: 24px; font-size: .72rem; box-shadow: 0 0 0 2px var(--card); }
.av2 .av:first-child { top: 0; left: 0; }
.av2 .av:last-child { right: 0; bottom: 0; }
.expempty { text-align: center; padding: 18px 0; }

/* inside the card: the sentence, my result, photos, the note, one line per person, actions, history */
.cardsum { display: flex; gap: 12px; align-items: center; padding-right: 26px; }
.cardsum p { margin: 0; line-height: 1.4; }
.youband { margin: 10px 0 4px; padding: 8px 12px; border-radius: var(--radius-s, 8px); font-weight: 600; background: color-mix(in srgb, var(--muted) 12%, transparent); }
.youband.pos { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.youband.neg { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
.youband.even, .youband.muted { font-weight: 500; color: var(--muted); }
.photostrip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 10px -12px 4px; padding: 0 12px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.photostrip::-webkit-scrollbar { display: none; }
.photostrip .thumb { flex: none; width: 116px; height: 116px; scroll-snap-align: start; }
.photostrip .plus.tile { flex: none; width: 116px; height: 116px; border-radius: var(--radius-s, 8px); background: transparent; color: var(--accent); border: 2px dashed var(--line); }
.addrow { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 10px 0 4px; padding: 9px 12px; background: transparent; color: var(--accent); border: 1px dashed var(--line); border-radius: var(--radius-s, 8px); font-size: .9rem; }
.notequote { margin: 10px 0 4px; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--ink); white-space: pre-line; background: color-mix(in srgb, var(--muted) 7%, transparent); border-radius: 0 var(--radius-s, 8px) var(--radius-s, 8px) 0; }
.people { margin: 10px 0 2px; }
.pline { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.pline:first-child { border-top: 0; }
.pline .av { width: 30px; height: 30px; font-size: .8rem; }
.pname { font-weight: 500; }
.pdid { color: var(--muted); font-size: .8rem; }
.pbar { height: 4px; margin-top: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 16%, transparent); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 2px; }
.pres { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cardactions { display: flex; gap: 8px; margin: 10px 0 8px; }
.cardactions .btn { flex: 1; }
a.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.metaline { margin: 8px 0 4px; color: var(--muted); font-size: .8rem; }
.hist { margin-top: 4px; border-top: 1px solid var(--line); }
.hist summary { display: flex; flex-direction: column; gap: 1px; padding: 8px 0 4px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); list-style: none; }
.hist summary::-webkit-details-marker { display: none; }
.hist summary > span::after { content: " ▾"; }
.hist[open] summary > span::after { content: " ▴"; }
.hist summary small { font-weight: 400; font-size: .8rem; }
.thumb.loading { background: linear-gradient(90deg, color-mix(in srgb, var(--muted) 10%, var(--card)), color-mix(in srgb, var(--muted) 22%, var(--card)), color-mix(in srgb, var(--muted) 10%, var(--card))); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .thumb.loading { animation: none; } }
#lightbox .lbnav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; padding: 0; font-size: 2rem; line-height: 1; background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 8px; }
#lightbox .lbnav.prev { left: 8px; }
#lightbox .lbnav.next { right: 8px; }
#lightbox .lbcount { align-self: center; color: #ddd; font-size: .85rem; }

/* the Groups page: the same rows as the expenses, a group is a coloured tile with its first letter */
.gtile { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-style: normal; font-weight: 700; font-size: 1.1rem; flex: none; }
.avstack { display: inline-flex; align-items: center; }
.avstack .av { width: 18px; height: 18px; font-size: .58rem; margin-left: -5px; box-shadow: 0 0 0 2px var(--card); }
.avstack .av:first-child { margin-left: 0; }
.av.more { background: color-mix(in srgb, var(--muted) 45%, var(--card)); color: var(--ink); }
.eamt.bal > span { font-size: 1.05rem; }
.eamt.bal small { white-space: nowrap; }
.sumstrip b.stack { display: flex; flex-direction: column; gap: 1px; }
.exp[hidden] { display: none; }

/* the Activity page: the actor's circle with a small badge for the kind of action */
.avwrap { position: relative; display: block; width: 40px; height: 40px; flex: none; }
.avwrap .av { position: absolute; top: 2px; left: 0; }
.bd { position: absolute; right: -2px; bottom: -1px; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; box-shadow: 0 0 0 2px var(--card); }
.bd svg { width: 11px; height: 11px; }
.bd.pos { background: var(--pos); } .bd.neg { background: var(--neg); } .bd.acc { background: var(--accent); } .bd.mut { background: var(--muted); }
.etitle.act { font-weight: 400; }
.strike { text-decoration: line-through; font-weight: 500; }
.erow .eamt small { display: block; }
.backlink { display: inline-block; margin: 0 0 8px; padding: 2px 0; color: var(--accent); font-weight: 600; font-size: .9rem; text-decoration: none; }

/* the Balances page: a bar for each person growing from the middle, and the payments with the two people they are between */
.dbar { display: flex; height: 6px; margin-top: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 12%, transparent); overflow: hidden; }
.dbar .half { flex: 1; display: flex; }
.dbar .half.l { justify-content: flex-end; border-right: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.dbar i { display: block; height: 100%; }
.dbar i.pos { background: var(--pos); border-radius: 0 3px 3px 0; }
.dbar i.neg { background: var(--neg); border-radius: 3px 0 0 3px; }
.exp.me > .erow { font-weight: 500; }
.erow.srow { grid-template-columns: auto minmax(0, 1fr) auto; }
.pair { display: inline-flex; align-items: center; gap: 3px; }
.pair .av { width: 28px; height: 28px; font-size: .75rem; }
.parrow { width: 14px; height: 14px; color: var(--muted); flex: none; }
.erow.srow .eamt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
button.small { padding: 3px 12px; font-size: .8rem; border-radius: 999px; }
button.link.small { padding: 0; }
.subhead { margin: 18px 4px 0; font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.squarecard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 12px; }
.squarecard h3 { margin: 4px 0 0; }
.squarecard p { margin: 0; }

/* Summary: a person's card, the folded payments, the link to the group's settings page */
.tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: .7rem; font-weight: 600; vertical-align: 1px; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.pline2 { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.youband + .pline2 { border-top: 0; }
.pcap { margin: 10px 0 2px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.plist { margin: 0 0 4px; padding-left: 18px; }
.plist li { padding: 2px 0; }
.pnote { margin: 8px 0 0; font-size: .85rem; }
.pact { margin: 6px 0 0; font-weight: 600; }
.pact a { color: var(--accent); text-decoration: none; }
.hist.paid { margin-top: 14px; }
.hist.paid summary { padding: 10px 4px; }
.settingslink { display: flex; flex-direction: column; gap: 2px; margin: 18px 4px 6px; font-size: .85rem; }
.settingslink a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; text-decoration: none; font-size: .95rem; }

/* Group settings: the header, the people rows, the invite sheet */
.gtile.big { width: 52px; height: 52px; border-radius: 15px; font-size: 1.4rem; }
.ghead { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.gtext { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.gname { margin: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1.25rem; font-weight: 700; text-align: left; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.gname svg { color: var(--muted); flex: none; }
.gsub { font-size: .85rem; }
.nudge { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-s, 8px); background: color-mix(in srgb, #d99a1c 16%, transparent); }
.nudge small { display: block; color: var(--muted); font-size: .82rem; }
.setrow .eamt { flex-direction: row; align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--muted); }
.dot.ok { background: var(--pos); }
.dot.wait { background: #d99a1c; }
.menuwrap { position: relative; }
.more { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 1.2rem; line-height: 1; background: none; color: var(--muted); border: 1px solid var(--line); }
.menu { position: absolute; right: 0; top: 38px; z-index: 20; min-width: 170px; display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-s, 8px); background: var(--card); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.menu button { text-align: left; padding: 9px 10px; border: 0; background: none; color: inherit; font-size: .92rem; border-radius: 6px; }
.menu button.danger { color: var(--neg); }
.addpersonbtn { width: 100%; background: none; border: 0; color: var(--accent); text-align: left; font: inherit; font-weight: 600; cursor: pointer; }
.addpersonbtn .plus { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px dashed var(--accent); font-size: 1.2rem; }
.addform { padding: 10px 0; }
.hint { margin: 10px 4px; font-size: .85rem; }
#invite-sheet { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
#invite-sheet .sheet { position: relative; width: 100%; max-width: 460px; max-height: 92dvh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--card); animation: sheet-up .22s ease; }
@media (min-width: 600px) { #invite-sheet { align-items: center; } #invite-sheet .sheet { border-radius: 18px; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #invite-sheet .sheet { animation: none; } }
.sheethead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding-right: 28px; }
.sheethead > span { display: flex; flex-direction: column; min-width: 0; }
.sheethead small { font-size: .82rem; }
.sheetbtns { display: flex; gap: 10px; margin-top: 10px; }
.sheetbtns button { flex: 1; }
#invite-sheet .qrbox { padding: 8px 0 12px; }

/* Groups, with no groups yet: a welcome with one clear action, and how it works; the Join box under it */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin: 4px 0 14px; padding: 28px 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius, 10px); box-shadow: var(--shadow, none); }
.hero h2 { margin: 6px 0 0; font-size: 1.3rem; }
.hero p { margin: 0 0 12px; max-width: 30ch; line-height: 1.45; }
.heroicon { display: inline-flex; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 20px; color: var(--accent-ink, #fff); background: var(--accent); }
button.wide { width: 100%; max-width: 320px; padding: 12px 16px; font-size: 1rem; font-weight: 600; }
.steps { padding: 4px 12px; }
.step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 0; }
.step + .step { border-top: 1px solid var(--line); }
.stepn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-style: normal; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.joincard { margin-bottom: 16px; }
.joincard > p { margin: 0 0 10px; }
.joincard input { width: 100%; }
.joincard .invite { margin-top: 10px; }
