/* Add expense, settle, friends, people, join, profile (Unit 4).
   Fixed boxes everywhere: nothing changes height between loading, empty and filled. */

/* ---------- Add expense: full screen, two size classes (SPEC 3.1) ---------- */
.sheet[data-testid="expense-form"] {
  --a-top: 56px; --a-amt: 96px; --a-fig: 60px; --a-note: 52px; --a-slot: 46px; --a-def: 52px; --a-pv: 36px; --a-key: 52px; --a-save: 52px; --a-gap: 8px;
  position: absolute; inset: 0; max-height: none; border-radius: 0; padding: 0; overflow: hidden; background: var(--bg); box-shadow: none;
}
@media (max-height: 759px) {
  .sheet[data-testid="expense-form"] { --a-top: 48px; --a-amt: 64px; --a-fig: 46px; --a-note: 48px; --a-slot: 42px; --a-def: 44px; --a-pv: 28px; --a-key: 42px; --a-save: 48px; --a-gap: 6px; }
}
.sheet[data-testid="expense-form"] > .grab { display: none; }
/* The sheet's own close button sits in the form's top row (one sheet-close); the title stays for screen readers only. */
.sheet[data-testid="expense-form"] > .sh-top { position: absolute; z-index: 2; left: 16px; top: calc(var(--safe-top) + 4px + (var(--a-top) - 44px) / 2); margin: 0; }
.sheet[data-testid="expense-form"] > .sh-top .sh-titles { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sheet[data-testid="expense-form"] > .sh-top .close { width: 44px; height: 44px; }
.sheet[data-testid="expense-form"] > .sheet-body { position: absolute; inset: 0; }
.add { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 4px) 16px 0; }
.add-top { flex: none; height: var(--a-top); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.add-top .close { width: 44px; height: 44px; }
.add-top-pad { width: 44px; flex: none; }
.group-chip {
  min-width: 0; height: calc(var(--a-top) - 10px); display: inline-flex; align-items: center; gap: 10px; padding: 0 14px 0 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 calc(16px * var(--font-scale, 1)) var(--font-body);
}
.group-chip.pick { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.group-chip.static { border-color: transparent; background: transparent; }
.gc-why { flex: none; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.group-chip b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 600; }
.g-tile { flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--sunk); color: var(--ink2); font-family: var(--font-display); }
.add-amount {
  flex: none; height: var(--a-amt); width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 var(--a-fig)/1 var(--font-display); color: var(--ink); text-align: center; white-space: nowrap; overflow: hidden;
}
.add-amount.m { font-size: calc(var(--a-fig) * .8); }
.add-amount.s { font-size: calc(var(--a-fig) * .64); }
.add-amount.xs { font-size: calc(var(--a-fig) * .5); }
.add-amount .cur { font-size: .5em; color: var(--ink2); align-self: center; }
.caret { width: 3px; height: .9em; background: var(--primary); border-radius: 2px; animation: caret 1s steps(1) infinite; }
.caret.off { visibility: hidden; animation: none; }
@keyframes caret { 50% { opacity: 0; } }
.add-note {
  flex: none; width: 100%; height: var(--a-note); padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); outline: none; font: 500 calc(17px * var(--font-scale, 1)) var(--font-body); color: var(--ink);
}
.add-note::placeholder { color: var(--ink3); opacity: 1; }
.add-note:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.add-slot { flex: none; height: var(--a-slot); margin-top: var(--a-gap); overflow: hidden; }
.note-chips { display: flex; gap: 8px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.note-chips::-webkit-scrollbar, .add-defaults::-webkit-scrollbar { display: none; }
.note-chip { flex: none; height: 100%; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
.add-strip {
  height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 12px; border-radius: 14px; background: var(--sunk);
  font: 400 calc(13px * var(--font-scale, 1))/1.3 var(--font-body); color: var(--ink);
}
.add-strip > span { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.add-strip.info { background: var(--accent-soft); }
.add-strip.warn { background: var(--primary-soft); }
.strip-btn { flex: none; height: calc(100% - 10px); max-height: 36px; padding: 0 14px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 8%, transparent); font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); }
.add-defaults { flex: none; height: var(--a-def); margin-top: var(--a-gap); display: flex; gap: 8px; }
/* E12: Paid by, Split and Date always fit one row; hints live in the row under the preview.
   Every chip keeps a readable minimum (avatar or label + chevron); long payer
   or split labels shrink with an ellipsis instead of squeezing a neighbour away. */
.dchip.payer, .dchip.split { overflow: hidden; }
.dchip.payer b, .dchip.split b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .add-defaults .dchip { padding: 0 10px; gap: 4px; }
  .dchip.split .dchip-k { display: none; }
}
.add-defaults .dchip:has(.avatar) { padding-left: 5px; }
.add-info { flex: none; height: var(--a-slot); margin-top: var(--a-gap); overflow: hidden; }
.add-wait { margin: 0; padding: 0 4px; font: 400 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); text-align: center; }
.add-hints { height: 100%; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.add-hints::-webkit-scrollbar { display: none; }
.add-slot .seg { height: 100%; }
.dchip {
  flex: none; height: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap;
}
.dchip:has(.avatar) { padding-left: 5px; }
.dchip b { font-weight: 600; }
.dchip-k { font-size: calc(13px * var(--font-scale, 1)); color: var(--ink2); }
.dchip.same { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.date-wrap { position: relative; flex: none; height: 100%; }
.date-input { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; }
.add-preview { flex: none; height: var(--a-pv); line-height: var(--a-pv); text-align: center; font: 400 calc(14px * var(--font-scale, 1))/var(--a-pv) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(8px + var(--safe-bot)); background: var(--sunk);
  transition: transform .12s ease-out;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.key { height: var(--a-key); border-radius: 10px; background: var(--surface); font: 500 calc(26px * var(--font-scale, 1)) var(--font-body); display: grid; place-items: center; color: var(--ink); }
.key.flat { background: transparent; }
.key:disabled { color: var(--ink3); }
.save-bar { margin-top: 8px; }
.save-btn { height: var(--a-save); border-radius: 14px; font-size: calc(17px * var(--font-scale, 1)); gap: 10px; }
.save-btn:disabled { opacity: 1; background: color-mix(in srgb, var(--ink) 12%, var(--sunk)); color: var(--ink2); }
.save-btn span { overflow: hidden; text-overflow: ellipsis; }
.add.kb .add-bottom { background: transparent; pointer-events: none; }
.add.kb .keypad { visibility: hidden; }
.add.kb .save-bar { pointer-events: auto; }
.add-skel { width: 60%; height: 50%; border-radius: 12px; }
.add-skel-chip { display: block; width: 120px; height: 20px; border-radius: 8px; }
.add-empty { padding: 24px; text-align: center; color: var(--ink2); }
.add-empty .btn { margin-top: 12px; }

/* pickers and split sheet (stacked over the form) */
.pick-list { margin-top: 8px; }
.pick-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); font: 500 calc(16px * var(--font-scale, 1)) var(--font-body); }
.pick-row:last-child { border-bottom: 0; }
.pick-row.on { color: var(--primary); }
.pick-name { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.presets .dchip { height: 40px; }
.split-people { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 14px; }
.split-person { width: 68px; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); opacity: .5; }
.split-person > span:last-child { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-person { position: relative; }
.split-person.on { opacity: 1; font-weight: 600; }
/* Selected people: a primary ring plus a tick badge, so "who's in" reads without the sentence below. */
.split-person.on .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.split-person.on::after { content: '\2713'; position: absolute; top: -2px; left: calc(50% + 10px); width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); border: 2px solid var(--surface); font: 700 12px/16px var(--font-body); text-align: center; }
.split-person:not(.on) .avatar { filter: grayscale(1); }
/* Selected chip: filled box + tick, never just bolder text. */
.dchip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); box-shadow: inset 0 0 0 1px var(--primary); }
.split-line { margin-top: 12px; text-align: center; color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); }
.split-rows { margin-top: 10px; }
.split-row { display: flex; align-items: center; gap: 10px; min-height: 54px; border-bottom: 1px solid var(--line); }
.split-in { width: 128px; height: 44px; text-align: right; }
.split-in.invalid { border-color: var(--owe); }
.split-done { margin-top: 12px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper b { min-width: 24px; text-align: center; }
.stepper .iconbtn { background: var(--sunk); font-size: calc(20px * var(--font-scale, 1)); }

/* ---------- Settle ---------- */
.settle-options { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.settle-option {
  width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); font: 400 calc(16px * var(--font-scale, 1)) var(--font-body);
}
.settle-option.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.settle-option .radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink2); }
.settle-option.on .radio { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 5px var(--surface); }
.so-text { flex: 1; min-width: 0; text-align: left; }
.settle-option b, .leg b { font: 600 calc(17px * var(--font-scale, 1)) var(--font-body); }
b.owe, .num.owe { color: var(--owe); }
b.owed, .num.owed { color: var(--owed); }
.num.muted { color: var(--ink2); }
.settle-pair { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0 6px; color: var(--ink2); }
.settle-big { text-align: center; font: 500 calc(50px * var(--font-scale, 1))/1.1 var(--font-display); height: 60px; }
.settle-amount { height: 60px; text-align: center; font: 500 calc(28px * var(--font-scale, 1)) var(--font-display); }
.settle-partial { margin-top: 4px; }
.settle-sub { text-align: center; color: var(--ink2); font-size: calc(15px * var(--font-scale, 1)); margin: 6px 0 14px; }
.settle-warn { min-height: 40px; display: flex; flex-direction: column; justify-content: center; gap: 4px; font: 400 calc(13px * var(--font-scale, 1))/1.35 var(--font-body); color: var(--owe); }
.settle-warn span { display: flex; gap: 6px; align-items: flex-start; }
.settle-foot { margin-top: 12px; text-align: center; font: 400 calc(13px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); }
.legs { padding: 0; overflow: hidden; }
.legs-h { padding: 12px 16px; font: 600 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); border-bottom: 1px solid var(--line); }
.leg { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.leg:last-child { border-bottom: 0; }
.leg-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.leg-t b { font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); }
.leg-t small { font-size: calc(13px * var(--font-scale, 1)); color: var(--ink2); }
.settle-skel { height: 240px; border-radius: 16px; margin-top: 12px; }

/* ---------- Friends ---------- */
.page-head:has(.iconbtn) { display: flex; align-items: center; justify-content: space-between; }
.totals { padding: 18px; min-height: 186px; }
.totals.skel { background: var(--sunk); }
.totals-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.totals-label { color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); }
.totals-net { margin: 4px 0 14px; font: 500 calc(16px * var(--font-scale, 1)) var(--font-body); }
.num.big, .big { font: 500 calc(40px * var(--font-scale, 1))/1.1 var(--font-display); margin-right: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile small { color: var(--ink2); font-size: calc(13px * var(--font-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b { font: 600 calc(20px * var(--font-scale, 1)) var(--font-body); }
.cur-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cur-chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font: 600 calc(13px * var(--font-scale, 1)) var(--font-body); }
.cur-chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.friends-note { margin: 12px 4px; color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); line-height: 1.4; }
.list-h { display: flex; align-items: baseline; justify-content: space-between; margin-top: 20px; }
.list-h small { color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); }
.list-h .link-btn { margin: 0; padding: 8px 4px; }
.person-list, .entry-list { margin: 8px -16px 0; background: var(--surface); border-top: 1px solid var(--line); }
.person-row, .entry-row {
  width: 100%; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); text-align: left;
}
.entry-row { height: 64px; }
.pr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pr-main b, .pr-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-main b { font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); }
.pr-main small { font-size: calc(13px * var(--font-scale, 1)); color: var(--ink2); }
.pr-vals { display: flex; gap: 12px; flex: none; }
.pr-val { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.pr-val small { font-size: max(11px, calc(12px * var(--font-scale, 1))); color: var(--ink2); }
.pr-val b { font: 600 calc(17px * var(--font-scale, 1)) var(--font-body); }
.person-row.skel .av { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.skel .line { height: 14px; width: 50%; border-radius: 6px; display: block; }
.sentinel { height: 1px; }
.friend-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; min-height: 72px; }
.friend-head .av-big { width: 64px; height: 64px; border-radius: 50%; }
.fh-text { min-width: 0; }
.fh-text p { color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); margin-top: 2px; }
.friend-card { padding: 18px; margin-bottom: 12px; }
.fc-eyebrow { color: var(--ink2); font-size: calc(13px * var(--font-scale, 1)); }
.fc-line { margin: 4px 0 0; font-size: calc(16px * var(--font-scale, 1)); }
.fc-line .big { font-size: calc(36px * var(--font-scale, 1)); }

/* ---------- Members, invite, add people ---------- */
/* Add people types into a filter: top-anchored at full height from the first frame (SPEC 5.1). */
.sheet[data-testid="add-people-sheet"] { position: absolute; top: calc(var(--safe-top) + 44px); left: 0; right: 0; bottom: 0; max-height: none; }
.invite-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 64px; margin-top: 10px; padding: 10px 10px 10px 14px; border-radius: 16px; background: var(--primary-soft); }
.ic-ico { color: var(--primary); }
.ic-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ic-text b { color: var(--primary-deep); font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); }
.ic-text small { color: var(--ink2); font-size: calc(13px * var(--font-scale, 1)); }
.invite-card .btn-small { height: 40px; padding: 0 18px; font-size: calc(15px * var(--font-scale, 1)); }
.ic-more { flex-basis: 100%; display: flex; gap: 8px; }
.ic-more .link-btn { margin: 0; padding: 6px 4px; display: inline-flex; gap: 6px; align-items: center; }
.link-btn.danger { color: var(--owe); }
.label-slot { height: 26px; line-height: 26px; margin-top: 4px; font: 600 max(11px, calc(12px * var(--font-scale, 1)))/26px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-testid="members-add-people"] { margin-bottom: 4px; }
.people-filter { position: relative; display: block; margin-top: 12px; }
.people-filter svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink2); }
.people-filter .input { height: 44px; padding-left: 42px; }
.people-row { display: flex; align-items: center; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.people-row.in .avatar, .people-row.in .pr-main { opacity: .6; }
.people-row .pill { margin: 0; padding: 6px 10px; background: var(--sunk); color: var(--ink2); font-size: max(11px, calc(12px * var(--font-scale, 1))); }
.people-row .btn-small { height: 36px; min-width: 64px; }
.people-block { padding: 14px 0; color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); }
.people-block b { color: var(--ink); font-size: calc(16px * var(--font-scale, 1)); display: block; margin-bottom: 4px; }
.people-privacy { margin: 16px 0 8px; color: var(--ink3); font-size: max(11px, calc(12px * var(--font-scale, 1))); }

/* ---------- Join ---------- */
.join { padding-top: calc(var(--safe-top) + 32px); }
.join-eyebrow { color: var(--primary); }
.join-title { margin: 10px 0 20px; }
.join-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.jc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jc-text b { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); }
.jc-text small { font-size: calc(14px * var(--font-scale, 1)); color: var(--ink2); }
.join-form { margin-top: 10px; }
.join-form .btn-lg, .join .btn-lg { margin-top: 18px; }
.join-alt, .join-as { text-align: center; color: var(--ink2); margin-top: 14px; font-size: calc(15px * var(--font-scale, 1)); }
.join-alt .link-btn { display: inline; margin: 0; padding: 4px; }
.join-invalid { padding: 20px; margin-top: 16px; }
.join-invalid h2 { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); margin-bottom: 6px; }
.join-invalid p { color: var(--ink2); }
.join-skel { height: 220px; border-radius: 20px; margin-top: 20px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 18px; }
.ph-text { min-width: 0; }
.ph-text p { color: var(--ink2); font-size: calc(14px * var(--font-scale, 1)); margin-top: 2px; }
.ph-text .link-btn { display: inline; margin: 0; padding: 4px 2px; font-weight: 500; color: var(--ink2); }
.profile-chart { padding: 18px; min-height: 300px; }
.pc-head h2 { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); margin-bottom: 10px; }
.profile-chart .cur-chips { margin-bottom: 10px; }
.pc-note { margin-top: 10px; color: var(--ink2); font-size: calc(13px * var(--font-scale, 1)); line-height: 1.4; }
.pc-skel { height: 240px; border-radius: 14px; }
.pc-empty { padding: 24px 0; color: var(--ink2); }
.pc-empty b { color: var(--ink); display: block; }
.settings-list { margin-top: 14px; padding: 0; overflow: hidden; }
.set-row { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); font: 500 calc(16px * var(--font-scale, 1)) var(--font-body); text-align: left; }
.set-row:last-child { border-bottom: 0; }
.set-row.col { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 12px 18px; }
.set-row small { color: var(--ink2); font-size: calc(13px * var(--font-scale, 1)); font-weight: 400; }
.set-row.danger { color: var(--owe); }
.theme-pills { display: flex; gap: 6px; }
.theme-pill { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font: 600 calc(13px * var(--font-scale, 1)) var(--font-body); }
.theme-pill.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .add-bottom { transition: none; }
}

/* settle date + changed amount */
.settle-date { display: flex; justify-content: center; height: 40px; margin-top: 6px; }
.settle-date .date-wrap { height: 40px; }
.settle-warn.info { color: var(--ink); }

/* friend page: payments received read neutral/positive (D7) */
.entry-row .pr-val b.num.paid { color: var(--owed); }

/* invite step after creating a group (D8) */
.invite-step { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.invite-step .is-lead { color: var(--ink2); font-size: calc(15px * var(--font-scale, 1)); margin: 0; }
.invite-step-people { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.add-slot .seg button.on { background: var(--surface); border-radius: 9px; box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent); }
.entry-row[data-testid="friend-adjust"] .pr-main b, .entry-row[data-testid="friend-adjust"] .pr-main small { white-space: normal; }

/* F4: an amount a note filled in reads as selected: the first key press replaces it */
.add-amount .num.filled { background: var(--accent-soft); border-radius: 10px; padding: 0 .12em; }
.add-amount .num.filled + .caret { visibility: hidden; animation: none; }
/* F3: no group yet: ask first */
.add-ask { overflow-y: auto; }
.add-ask-h { font: 600 1.15rem/1.3 var(--font-body); margin: 20px 16px 8px; }

/* Fixed-height sheets (UX5): every sheet but the full-screen ones keeps one
   height from open to close, whatever its content does. Title and controls
   stay put; lists scroll in their own region (.sh-scroll, .pick-list,
   .split-scroll); text that comes and goes has a reserved slot; the primary
   action (.sh-pin) sits at the bottom and never moves. */
.sheet-wrap.fixed .sheet { display: flex; flex-direction: column; overflow: hidden;
  height: min(var(--sh, 60dvh), calc(100dvh - var(--safe-top) - 24px)); }
.sheet-wrap.fixed .sheet > *, .sheet-wrap.fixed .sheet-body > *, .sheet-wrap.fixed .sheet-body > form > * { flex: none; }
.sheet-wrap.fixed .sheet > .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sheet-wrap.fixed .sheet-body > form { flex: 1 0 auto; display: flex; flex-direction: column; }
.sheet-wrap.fixed .sheet-body > .invite-step { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.sheet-wrap.fixed .invite-step > * { flex: none; }
.sheet-wrap.fixed :is(.sh-scroll, .pick-list, .split-scroll, .invite-step-people) { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sheet-wrap.fixed :is(.pick-list, .split-scroll, .invite-step-people) { flex: 1 1 0; }
.sheet-wrap.fixed .sheet-body .sh-pin { margin-top: auto; }
.sheet-wrap.fixed .sh-scroll ~ .sh-pin { padding-top: 10px; }

/* heights per sheet: the largest content it shows, capped by the screen */
.sheet[data-testid="confirm"] { --sh: 280px; }
.sheet:is([data-testid="payer-sheet"], [data-testid="group-picker"]) { --sh: min(calc(var(--rows, 4) * 60px + 128px + var(--safe-bot)), 70dvh); }
.sheet[data-testid="split-sheet"] { --sh: min(85dvh, 700px); }
.sheet[data-testid="settle-sheet"] { --sh: 800px; }
.sheet[data-testid="settle-all-sheet"] { --sh: 720px; }
.sheet[data-testid="expense-detail"] { --sh: 660px; }
.sheet[data-testid="payment-detail"] { --sh: 380px; }
.sheet[data-testid="how-sheet"] { --sh: 500px; }
.sheet[data-testid="group-menu"] { --sh: 540px; }
.sheet[data-testid="group-edit-sheet"] { --sh: 620px; }
.sheet[data-testid="new-group-sheet"] { --sh: 660px; }
.sheet:is([data-testid="leave-dialog"], [data-testid="leave-blocked"]) { --sh: 320px; }
.sheet[data-testid="month-jump"] { --sh: 560px; }
.sheet[data-testid="join-link-sheet"] { --sh: 430px; }
.sheet[data-testid="name-sheet"] { --sh: 400px; }
.sheet[data-testid="members-sheet"] { --sh: 720px; }
.sheet[data-testid="adjust-sheet"] { --sh: 460px; }
.sheet[data-testid="search-time-sheet"] { --sh: min(600px, 75dvh); }
.sheet-wrap.fixed .time-list { max-height: none; margin: 8px 0 0; }

/* settle: the amount area is one box whether it shows the figure or the input */
.settle-amt { height: 104px; display: flex; flex-direction: column; align-items: center; }
.settle-amt .settle-amount { width: 100%; }
.settle-options.sh-scroll { padding: 3px; margin: 7px -3px 0; }
.sh-pin .settle-foot { height: calc(4 * 1.45em); overflow-y: auto; }

/* split sheet: presets on one row, a reserved "Paid by" line, "Who's in?" over the people */
.presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 0; }
.presets::-webkit-scrollbar { display: none; }
.presets .dchip { flex: 0 1 auto; min-width: 0; }
.presets .dchip[data-preset="me"] { flex: none; }
.presets .dchip svg { flex: none; }
.presets .pl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.split-payer { height: 22px; margin: 4px 2px 0; font: 600 calc(13px * var(--font-scale, 1))/22px var(--font-body); color: var(--primary-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-who { height: 20px; margin: 8px 2px 0; font: 600 max(11px, calc(12px * var(--font-scale, 1)))/20px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.split-who + .split-people { margin-top: 6px; }
/* two reserved lines: status text coming and going never moves Done */
.split-sheet-status { height: calc(2 * 1.4em); line-height: 1.4; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 8px; }

/* ---------- one selected language (UX5): tint + primary border + tick ---------- */
.seg button.on, .add-slot .seg button.on, .sc .seg-opt.on {
  background: var(--primary-soft); color: var(--primary-deep); border-radius: 9px; box-shadow: inset 0 0 0 1.5px var(--primary);
}
.pick-row { padding: 6px 12px; border-radius: 12px; }
.pick-row.on { color: var(--primary-deep); background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); border-bottom-color: transparent; }
.sel-tick { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; visibility: hidden; background: var(--primary); color: var(--on-primary); }
.sel-tick svg { width: 14px; height: 14px; }
.sel-tick.on { visibility: visible; }
.time-list .mrow { gap: 12px; border-radius: 12px; }
.time-list .mrow.on { background: var(--primary-soft); color: var(--primary-deep); box-shadow: inset 0 0 0 2px var(--primary); border-bottom-color: transparent; }
.settle-option.on { background: var(--primary-soft); }
.cur-chip.on, .theme-pill.on, .chip.on, .mini-chip.on { background: var(--primary-soft); color: var(--primary-deep); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.mj-cell, .icon-opt { position: relative; }
.mj-cell.on::after, .icon-opt.on::after { content: '\2713'; position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); border: 2px solid var(--surface); font: 700 11px/16px var(--font-body); text-align: center; }
.mj-cell.on::after { top: 3px; right: 3px; width: 18px; height: 18px; font-size: 10px; line-height: 14px; }
.icon-opt.on { box-shadow: none; }

/* ---------- add screen: settings chips vs note suggestions (S6, M1) ---------- */
/* settings: pills with a chevron, always. suggestions: flat sunk tags with a "+" */
.note-chip { border: 0; background: var(--sunk); border-radius: 10px; color: var(--ink); }
.note-chip:not(.undo)::before { content: '+'; margin-right: 6px; color: var(--ink2); font-weight: 600; }
.add-defaults .dchip > svg { flex: none; }
.dchip.payer { flex: 0 1 auto; min-width: 0; }
.dchip.split { flex: 0 100 auto; min-width: 116px; }
.dchip.payer .dchip-k { flex: none; }
/* fitPayer (add.js): 1 = no "Paid by", 2 = no name either (avatar + chevron) */
.add-defaults:is([data-tight="1"], [data-tight="2"]) .dchip.payer .dchip-k, .add-defaults[data-tight="2"] .dchip.payer b { display: none; }

/* button labels: the name part ellipsizes, verb + amount stay */
.btn-text { display: flex; min-width: 0; overflow: hidden; white-space: pre; }
.btn-text .bt-name { min-width: 3em; overflow: hidden; text-overflow: ellipsis; }

/* Friends summary: figures, not buttons */
.tile { background: none; border-radius: 0; padding: 2px 0; }
.tile + .tile { border-left: 1px solid var(--line); padding-left: 14px; }
.tile b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile b.fit-m { font-size: calc(17px * var(--font-scale, 1)); } .tile b.fit-s { font-size: calc(15px * var(--font-scale, 1)); } .tile b.fit-xs { font-size: calc(13px * var(--font-scale, 1)); }
/* the simplify row's on/off sentence differs in length: two reserved lines */
.mrow[data-testid="menu-simplify"] .mt small { height: calc(2 * 1.35em); overflow: hidden; }
