/* Clay app styles. Every colour, font, radius and shadow comes from the
   active theme's CSS custom properties (set by boot.js / lib/theme.js).
   Avatars use white text: the theme validator guarantees #FFFFFF on avatar1..6. */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: max(env(safe-area-inset-bottom, 0px), 12px);
  --tabbar-h: 68px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --soft-shadow-primary: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-size: calc(16px * var(--font-scale, 1));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
input, textarea, select { user-select: text; -webkit-user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
img { display: block; -webkit-user-drag: none; }
svg { display: block; flex: none; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums lining-nums; }

#app { height: 100%; }
.app { position: relative; height: 100%; max-width: 560px; margin: 0 auto; overflow: hidden; }
.screen { position: absolute; inset: 0; }
.scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }
.page { padding: calc(var(--safe-top) + var(--banner-h, 0px) + 12px) 16px calc(var(--tabbar-h) + var(--safe-bot) + 96px); }

/* soft fade behind the floating button */
.has-tabs .screen::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 150px; pointer-events: none; z-index: 3;
  background: linear-gradient(color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 62%);
}

/* ---------- press feedback ---------- */
.press { transition: transform .16s var(--ease), filter .16s, background-color .2s, box-shadow .2s, opacity .2s; }
.press:active:not(:disabled):not([aria-disabled="true"]) { transform: scale(.97); filter: brightness(.94); }
.press-row { transition: background-color .18s; width: 100%; }
.press-row:active:not(:disabled) { background: var(--sunk); }

/* ---------- headings ---------- */
.page-head { padding: 18px 4px 16px; }
.page-title, .display-title {
  font: 500 calc(34px * var(--font-scale, 1))/1.05 var(--font-display);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -.01em;
}
.eyebrow { font: 600 max(11px, calc(11px * var(--font-scale, 1)))/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--primary); }

/* ---------- cards / sections ---------- */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); border: 1px solid var(--line); overflow: hidden; }
.sec { margin-top: 18px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }
.sec-h h2 { font: 500 calc(21px * var(--font-scale, 1)) var(--font-display); font-variation-settings: 'opsz' 36; }

/* ---------- buttons ---------- */
.btn {
  height: 44px; padding: 0 16px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap;
}
.btn:disabled { opacity: .45; }
.btn-block { display: flex; width: 100%; }
.btn-lg { height: 52px; border-radius: var(--radius-md); font-size: calc(16px * var(--font-scale, 1)); }
.btn-small { height: 34px; padding: 0 12px; font-size: calc(13px * var(--font-scale, 1)); border-radius: var(--radius-sm); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--on-primary) 15%, transparent), var(--soft-shadow-primary); }
.btn-primary:disabled { box-shadow: none; }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-quiet { background: var(--sunk); color: var(--ink); }
.btn-danger { background: var(--owe); color: var(--surface); }
.btn-quiet-danger { background: transparent; color: var(--owe); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.link-btn { display: block; margin: 16px auto 0; padding: 8px 12px; font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--accent); text-align: center; }
.iconbtn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); flex: none; }
.iconbtn.ghost { background: var(--surface); box-shadow: var(--shadow-1); }

.fab {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(var(--tabbar-h) + var(--safe-bot) + 14px); z-index: 5;
  height: 54px; padding: 0 24px 0 18px; border-radius: 27px;
  display: flex; align-items: center; gap: 8px;
  background: var(--primary); color: var(--on-primary); font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap;
  box-shadow: var(--shadow-2), 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent);
  animation: fab-in .5s var(--ease-out) both .08s;
}
@keyframes fab-in { from { opacity: 0; transform: translateY(24px) scale(.9); } }

/* ---------- tab bar ---------- */
.tabs {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; padding: 6px 8px var(--safe-bot);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
  view-transition-name: tabbar;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 25%; padding-top: 4px; font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); text-align: center; }
.tab .ic { height: 30px; width: 58px; border-radius: 15px; display: grid; place-items: center; transition: background-color .25s var(--ease), transform .25s var(--ease); }
.tab.on { color: var(--primary); }
.tab.on .ic { background: var(--primary-soft); color: var(--primary-deep); }
.tab-label { white-space: nowrap; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  background: var(--av, var(--avatar1)); color: #fff; font-weight: 600; font-family: var(--font-body); line-height: 1;
}
.avatar.ring { box-shadow: 0 0 0 2px var(--bg); }
.faces { display: flex; padding-left: 8px; border-radius: 20px; }
.faces .avatar { margin-left: -8px; }
.more-faces { --av: var(--ink2); width: 32px; height: 32px; font-size: max(11px, calc(11px * var(--font-scale, 1))); }

/* ---------- groups list ---------- */
.group-list { display: flex; flex-direction: column; gap: 10px; }
.group-list li { animation: rise .45s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.group-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--sunk); font: 500 calc(24px * var(--font-scale, 1))/1 var(--font-display); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.group-icon.small { width: 40px; height: 40px; border-radius: 12px; font-size: calc(20px * var(--font-scale, 1)); }
.group-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.group-name { font: 500 calc(19px * var(--font-scale, 1))/1.2 var(--font-display); font-variation-settings: 'opsz' 36; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-sub { font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-net { margin-top: 3px; font: 600 calc(14px * var(--font-scale, 1))/1.3 var(--font-body); }
.net.owe { color: var(--owe); }
.net.owed { color: var(--owed); }
.net.settled { color: var(--ink2); font-weight: 500; }

/* ---------- group screen ---------- */
.nav-bar { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.group-head { padding: 10px 4px 16px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 8px; }
.title-col { min-width: 0; }
.group-head .display-title { overflow-wrap: anywhere; }
.title-icon { margin-right: 10px; font-size: .8em; vertical-align: 2px; }
.meta { margin-top: 6px; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }

.bal { padding: 14px 16px; }

.toggle-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.seal { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.toggle-text { flex: 1; min-width: 0; }
.toggle-text b { display: block; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); }
.toggle-text span { display: block; margin-top: 2px; font: 400 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); }

.switch { position: relative; width: 48px; height: 30px; border-radius: 15px; flex: none; margin-top: 4px; background: var(--line); transition: background-color .25s var(--ease); }
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 30%, transparent);
  transition: transform .28s var(--ease-out);
}
.switch.on { background: var(--accent); }
.switch.on .knob { transform: translateX(18px); }

.pay { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); animation: fade-in .3s var(--ease) both; }
.pay:last-child { border-bottom: 0; }
.pay.mine { background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 6%, transparent), transparent); }
.pay .who { flex: 1; min-width: 0; font: 400 calc(15px * var(--font-scale, 1))/1.35 var(--font-body); overflow-wrap: anywhere; }
.pay .who b { font-weight: 600; }
.pay .v { font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
.v.owe { color: var(--owe); }
.v.owed { color: var(--owed); }
.v.neutral { color: var(--ink); }
@keyframes fade-in { from { opacity: 0; } }
.settled-box { padding: 18px 16px; display: flex; flex-direction: column; gap: 3px; }
.settled-box b { font: 500 calc(17px * var(--font-scale, 1)) var(--font-display); }
.settled-box span { font: 400 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); }

.exp { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.exp:last-child { border-bottom: 0; }
.date { width: 40px; text-align: center; flex: none; }
.date b { display: block; font: 500 calc(19px * var(--font-scale, 1))/1 var(--font-display); }
.date span { display: block; margin-top: 3px; font: 600 max(10px, calc(10px * var(--font-scale, 1))) var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); }
.exp .d { flex: 1; min-width: 0; }
.exp .d b { display: block; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp .d span { display: block; margin-top: 2px; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "{name} paid {amount}": the name shrinks first; a huge amount ends in an ellipsis, never clipped */
.exp .d .paid { display: flex; white-space: pre; }
.exp .d .paid > * { display: block; margin: 0; white-space: pre; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.exp .d .paid .name { flex-shrink: 1000; }
.exp .d .t-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.exp .d .t-row b { min-width: 0; }
.exp .r { text-align: right; flex: none; }
.exp .r small { display: block; font: 500 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.exp .r b { display: block; margin-top: 2px; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
.exp .r b.fit-s, .exp .r b.fit-xs { font-size: calc(13px * var(--font-scale, 1)); }
.exp .d .paid .amount { flex-shrink: 0; } /* the amount never loses digits; the words truncate */
.r b.owe { color: var(--owe); }
.r b.owed { color: var(--owed); }
.exp.payment .d b { font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
.exp.payment .iconbtn { color: var(--ink3); margin-right: -8px; }
.pill { font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--primary-deep); background: var(--primary-soft); padding: 3px 8px; border-radius: var(--radius-sm); margin-left: 6px; vertical-align: 1px; }

/* ---------- empty / errors / skeleton ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 24px 30px; animation: rise .5s var(--ease-out) both; }
.empty-img { width: 160px; max-width: 60%; height: auto; margin-bottom: 14px; }
.empty h3 { font: 500 calc(21px * var(--font-scale, 1)) var(--font-display); }
.empty p { margin-top: 6px; font: 400 calc(14px * var(--font-scale, 1))/1.5 var(--font-body); color: var(--ink2); max-width: 30ch; }
/* inside a card (a group's empty list) it sits side by side, so it stays above the FAB */
.card > .empty { flex-direction: row; gap: 16px; text-align: left; padding: 20px; }
.card > .empty .empty-img { width: 96px; margin: 0; flex: none; }
.card > .empty .empty-text { min-width: 0; }
.load-error { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--ink2); }
.skeleton-list { display: flex; flex-direction: column; gap: 10px; }
.skeleton { height: 76px; border-radius: var(--radius-lg); background: linear-gradient(100deg, var(--sunk) 30%, var(--surface) 50%, var(--sunk) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; border: 0; box-shadow: none; }
.skeleton.title { height: 64px; width: 60%; }
.skeleton.tall { height: 150px; }
.skeleton.row { height: 60px; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: calc(40 + var(--layer, 0) * 10); display: flex; flex-direction: column; justify-content: flex-end; max-width: 560px; margin: 0 auto; }
.scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 45%, transparent); animation: scrim-in .28s var(--ease) both; }
.sheet {
  position: relative; max-height: calc(100% - var(--safe-top) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px color-mix(in srgb, var(--ink) 18%, transparent);
  padding: 8px 18px calc(14px + var(--safe-bot));
  animation: sheet-up .42s var(--ease-out) both;
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
.closing .scrim { animation: scrim-out .24s var(--ease) both; }
.closing .sheet { animation: sheet-down .24s cubic-bezier(.4, 0, 1, 1) both; }
.closing { pointer-events: none; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes scrim-in { from { opacity: 0; } }
@keyframes scrim-out { to { opacity: 0; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sh-titles { min-width: 0; }
.sh-titles .eyebrow { margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-top h3 { font: 500 calc(23px * var(--font-scale, 1))/1.15 var(--font-display); font-variation-settings: 'opsz' 36; }
.close { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--sunk); color: var(--ink); }
.confirm-text { margin-top: 8px; font: 400 calc(15px * var(--font-scale, 1))/1.5 var(--font-body); color: var(--ink2); overflow-wrap: anywhere; }
.toast span, .form-error span, .split-status span, .settled-box, .empty, .load-error p { overflow-wrap: anywhere; min-width: 0; }

/* ---------- forms ---------- */
.field { margin-top: 14px; min-width: 0; }
.field > label { display: block; margin: 0 0 6px 2px; font: 600 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.hint { margin: 6px 2px 0; font: 400 max(11px, calc(12px * var(--font-scale, 1)))/1.4 var(--font-body); color: var(--ink2); }
.input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); outline: none;
  font: 500 calc(16px * var(--font-scale, 1)) var(--font-body); color: var(--ink);
  transition: border-color .18s, box-shadow .18s, background-color .18s;
  appearance: none; -webkit-appearance: none;
}
.input::placeholder { color: var(--ink3); opacity: 1; }
.input:focus, .money-input:focus-within, .select-chip:focus-within {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
input[type="date"].input { display: flex; align-items: center; min-height: 50px; }
.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }
.select-wrap { position: relative; }
.select-wrap .select-chev { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink3); pointer-events: none; }
.chip { display: flex; align-items: center; gap: 9px; }
.select-chip { position: relative; height: 50px; padding: 0 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); transition: border-color .18s, box-shadow .18s; }
.settle-pair .select-chip { height: auto; min-height: 50px; padding-top: 6px; padding-bottom: 6px; }
.chev { color: var(--ink3); }
.overlay-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: calc(16px * var(--font-scale, 1)); cursor: pointer; }

.money-input {
  display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.money-input .cur { color: var(--ink3); font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); }
.money-text { flex: 1; min-width: 0; width: 100%; border: 0; outline: none; background: transparent; font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); text-align: right; }
.money-text::placeholder { color: var(--ink3); }
.money-input.big .cur { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); }
.money-input.big .money-text { font: 500 calc(28px * var(--font-scale, 1))/1 var(--font-display); font-variation-settings: 'opsz' 72; text-align: left; transition: font-size .15s; }
.money-input.big.size-m .money-text { font-size: calc(21px * var(--font-scale, 1)); }
.money-input.big.size-s .money-text { font-size: calc(16px * var(--font-scale, 1)); }
.money-input.big.size-xs .money-text { font-size: calc(13px * var(--font-scale, 1)); }
.money-input.invalid { border-color: var(--owe); }

.seg { position: relative; display: flex; height: 48px; padding: 3px; border-radius: 12px; background: var(--sunk); }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px;
  background: var(--surface); box-shadow: var(--shadow-1); transition: transform .3s var(--ease-out);
}
.seg[data-mode="exact"] .seg-thumb { transform: translateX(100%); }
.seg button { position: relative; flex: 1; display: grid; place-items: center; font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); text-align: center; transition: color .2s; }
.seg button.on { color: var(--ink); background: var(--surface); border-radius: 9px; box-shadow: var(--shadow-1); } /* selected = a raised box, not just darker text */

.shares { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.share { display: flex; align-items: center; gap: 12px; padding: 9px 12px; min-height: 58px; border-bottom: 1px solid var(--line); text-align: left; }
.share:last-child { border-bottom: 0; }
.share .n { flex: 1; min-width: 0; font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); overflow-wrap: anywhere; }
label.n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* exact split: one line beside the input */
.share .n small { display: block; margin-top: 1px; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); animation: fade-in .2s both; }
.share:disabled { opacity: .55; }
.share .tick {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 2px solid var(--line); color: var(--on-primary); transition: background-color .2s, border-color .2s, transform .2s var(--ease-out);
}
.share.on .tick { background: var(--primary); border-color: var(--primary); }
.share-in { width: 132px; flex: none; }
.share-in .money-input { height: 40px; border-radius: var(--radius-sm); padding: 0 10px; }

.split-status { display: flex; align-items: center; gap: 6px; margin: 10px 2px 0; font: 500 calc(13px * var(--font-scale, 1)) var(--font-body); animation: fade-in .2s both; }
.split-status.ok { color: var(--owed); }
.split-status.warn { color: var(--ink2); }
.split-status.bad { color: var(--owe); }
.form-error { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font: 500 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--owe); background: var(--bg); border: 1px solid var(--line); animation: shake .35s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
form > .btn-lg, .sheet-body > form > .btn-primary.btn-block { margin-top: 16px; }
.btn-quiet-danger.btn-block { margin-top: 6px; }

.settle-pair { display: flex; align-items: flex-end; gap: 8px; }
.settle-pair .field { flex: 1; }
.settle-arrow { padding-bottom: 17px; color: var(--ink3); }

.member-list { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .n { flex: 1; min-width: 0; }
.member .n b { font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); overflow-wrap: anywhere; }
.member .n small { display: block; margin-top: 2px; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.member .n small.owe { color: var(--owe); }
.member .n small.owed { color: var(--owed); }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }
.inline-form .btn { height: 50px; }
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-opt { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: calc(22px * var(--font-scale, 1)); background: var(--bg); border: 1px solid var(--line); }
.icon-opt.on { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }

/* ---------- activity ---------- */
.feed li { border-bottom: 1px solid var(--line); animation: rise .4s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }
.feed li:last-child { border-bottom: 0; }
.feed-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; text-align: left; }
.feed-text { flex: 1; min-width: 0; }
.feed-sentence { display: block; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); overflow-wrap: anywhere; }
.feed-sentence b { font-weight: 600; }
.feed-time { display: block; margin-top: 3px; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink3); }
.load-more { margin-top: 14px; }

/* ---------- account ---------- */
.profile { display: flex; align-items: center; gap: 16px; padding: 16px; }
.profile-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-rows dt { font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.profile-rows dd { font: 500 calc(16px * var(--font-scale, 1)) var(--font-body); overflow-wrap: anywhere; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-align: left; }
.theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), var(--shadow-1); }
.theme-card.busy { opacity: .6; }
.theme-preview { display: block; height: 92px; border-radius: calc(var(--radius-lg) - 6px); padding: 14px 12px 0; overflow: hidden; }
.tp-card { display: flex; flex-direction: column; gap: 7px; height: 100%; border-radius: 10px 10px 0 0; padding: 12px; }
.tp-line { display: block; height: 7px; width: 70%; border-radius: 4px; opacity: .85; }
.tp-line.short { width: 45%; opacity: .4; }
.tp-btn { display: block; margin-top: auto; height: 14px; width: 55%; border-radius: 7px; }
.theme-name { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 4px; font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); }
.theme-check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.logout { margin-top: 22px; }

/* ---------- auth ---------- */
.auth { padding: calc(var(--safe-top) + var(--banner-h, 0px) + 24px) 20px calc(var(--safe-bot) + 24px); display: flex; flex-direction: column; }
.auth-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 0 22px; animation: rise .6s var(--ease-out) both; }
.auth-hero img { width: 180px; max-width: 55%; height: auto; margin-bottom: 14px; }
.auth-brand { font: 500 calc(44px * var(--font-scale, 1))/1 var(--font-display); font-variation-settings: 'opsz' 144; letter-spacing: -.02em; }
.auth-tagline { margin-top: 8px; font: 400 calc(15px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); max-width: 30ch; }
.auth-card { padding: 22px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); animation: rise .6s var(--ease-out) both .08s; }
.auth-card h1 { font: 500 calc(26px * var(--font-scale, 1))/1.15 var(--font-display); font-variation-settings: 'opsz' 48; }
.auth-sub { margin-top: 4px; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); }
.auth-card .btn-primary { margin-top: 20px; }

/* ---------- splash / toasts / offline ---------- */
.splash { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.splash-icon { width: 84px; height: 84px; border-radius: 22px; box-shadow: var(--shadow-2); animation: breathe 1.6s var(--ease) infinite alternate; }
.splash-text { font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
@keyframes breathe { from { transform: scale(.96); opacity: .8; } to { transform: scale(1); opacity: 1; } }

/* Toasts sit above the tab bar (and above the Add button where there is one, see E10). */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bot) + 14px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 11px 16px; border-radius: 14px;
  background: var(--ink); color: var(--surface); font: 500 calc(14px * var(--font-scale, 1))/1.35 var(--font-body); box-shadow: var(--shadow-2);
  animation: toast-in .35s var(--ease-out) both;
}
.toast.err { background: var(--owe); }
.toast.out { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.offline-banner {
  position: absolute; top: calc(var(--safe-top) + 6px); left: 12px; right: 12px; margin: 0 auto; width: fit-content; z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 18px; line-height: 1.35;
  background: var(--ink); color: var(--surface); font: 600 calc(13px * var(--font-scale, 1)) var(--font-body); box-shadow: var(--shadow-2);
  animation: fade-in .3s both;
}

/* ---------- screen transitions (View Transitions API) ---------- */
::view-transition-group(root) { animation-duration: .34s; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .34s; animation-timing-function: var(--ease-out); mix-blend-mode: normal; }
html[data-dir="fwd"]::view-transition-old(root) { animation-name: vt-push-old; }
html[data-dir="fwd"]::view-transition-new(root) { animation-name: vt-push-new; }
html[data-dir="back"]::view-transition-old(root) { animation-name: vt-pop-old; z-index: 2; }
html[data-dir="back"]::view-transition-new(root) { animation-name: vt-pop-new; }
html[data-dir="tab"]::view-transition-old(root) { animation: vt-fade-out .16s ease both; }
html[data-dir="tab"]::view-transition-new(root) { animation: vt-fade-in .22s ease both; }
@keyframes vt-push-old { to { transform: translateX(-28%); filter: brightness(.92); } }
@keyframes vt-push-new { from { transform: translateX(100%); box-shadow: -10px 0 30px color-mix(in srgb, var(--ink) 10%, transparent); } }
@keyframes vt-pop-old { to { transform: translateX(100%); } }
@keyframes vt-pop-new { from { transform: translateX(-28%); filter: brightness(.92); } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- trust: detail, breakdown, how, locked, leave ---------- */
.avatar.former { background: var(--surface); color: var(--ink3); border: 1.5px dashed var(--ink3); }
.left-pill { color: var(--ink2); background: var(--sunk); }
.lock-chip { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink2); font: 600 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); }
.exp .d .lock-chip { display: inline-flex; margin-top: 0; font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); overflow: visible; }
.lock-ic { color: var(--ink3); margin-right: -8px; }
.r b.muted { color: var(--ink); }
.how-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: 2px 0 -6px; font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--accent); }
.how-link svg { width: 16px; height: 16px; }
.solo-note { margin: 10px 4px 0; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); }
.bal .hint { margin-top: 10px; }
.warn-text { color: var(--owe); }
fieldset.bare { border: 0; margin: 0; padding: 0; min-width: 0; }

.note { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--sunk); font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink); }
.note svg { flex: none; margin-top: 1px; }
.note small { display: block; margin-top: 6px; font: 400 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); }
.note.lap { background: var(--accent-soft); }
.note.warn { background: color-mix(in srgb, var(--owe) 10%, var(--surface)); }

.detail-amt { margin-top: 6px; font: 500 calc(44px * var(--font-scale, 1))/1.05 var(--font-display); font-variation-settings: 'opsz' 144; letter-spacing: -.02em; white-space: nowrap; }
.detail-amt.fit-m { font-size: calc(36px * var(--font-scale, 1)); } .detail-amt.fit-s { font-size: calc(30px * var(--font-scale, 1)); } .detail-amt.fit-xs { font-size: calc(24px * var(--font-scale, 1)); }
.detail-amt + .lock-chip { margin-top: 8px; }
.detail-meta { margin-top: 8px; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); overflow-wrap: anywhere; }
.detail-meta b { color: var(--ink); font-weight: 600; }
.your-part { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 14px 16px; font: 400 calc(14px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); }
.your-part b { flex: none; font: 600 calc(17px * var(--font-scale, 1)) var(--font-body); color: var(--ink); }
.your-part + .btn { margin-top: 14px; }
.btn[aria-disabled="true"] { cursor: not-allowed; }

.how-sub { margin-top: 4px; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); }
.eq { margin-top: 14px; padding: 4px 16px 12px; }
.eq .ln { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); font: 400 calc(15px * var(--font-scale, 1)) var(--font-body); }
.eq .ln .op { display: inline-block; width: 18px; font-weight: 700; color: var(--ink2); }
.eq .ln b { font-weight: 600; white-space: nowrap; }
.eq .ln.tot { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 12px; font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); }
.eq .ln.tot b.owe { color: var(--owe); }
.eq .ln.tot b.owed { color: var(--owed); }
.eq .ln.tot small { font: 500 calc(13px * var(--font-scale, 1)) var(--font-body); }
.how-foot { margin-top: 10px; }

.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.toast-action { pointer-events: auto; min-height: 44px; margin: -11px -8px -11px 4px; padding: 0 12px; font: 700 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--surface); text-decoration: underline; text-underline-offset: 3px; }


/* =====================================================================
   PLAN3 browse screens (Unit 3). Fixed heights everywhere (SPEC §1): every
   box has the same size loading, empty and filled, so nothing shifts.
   ===================================================================== */
:root {
  --h-nav: 52px; --h-standing: 56px; --h-tabs: 44px; --h-month: round(2.5rem, 1px); --h-row: round(4rem, 1px); /* whole px: fractional rows drift in long lists */
  --h-loadrow: 48px; --h-end: 76px; --h-tabbar: 72px; --h-home-row: 72px; --h-person-row: 60px;
  --m-press: 120ms; --m-fade: 150ms; --m-morph: 240ms; --bar: #5B79A3;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { color: var(--accent); font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); min-height: 44px; display: inline-flex; align-items: center; gap: 4px; }
.link:disabled { opacity: .45; }
.sec-note { font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.sk { display: block; background: linear-gradient(90deg, var(--sunk) 0, color-mix(in srgb, var(--sunk) 40%, var(--surface)) 40%, var(--sunk) 80%) 0 0 / 300% 100%; border-radius: 6px; animation: shimmer 1.2s linear infinite; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sunk); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.page { padding-bottom: calc(var(--tabbar-h) + var(--safe-bot) + 54px + 24px + 14px); }

/* FAB: extended, collapses to a circle on scroll (clip-path, no reflow) */
.fab { animation: none; transition: clip-path var(--m-morph) var(--ease), transform .16s var(--ease); clip-path: inset(0 0 0 0 round 27px); }
.fab-label { transition: opacity var(--m-fade); }
.fab.mini { clip-path: inset(0 calc(50% - 27px) 0 calc(50% - 27px) round 27px); }
.fab-ic, .fab-mini-ic { transition: opacity var(--m-fade); }
.fab-mini-ic { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0; }
.fab.mini .fab-label, .fab.mini .fab-ic { opacity: 0; }
.fab.mini .fab-mini-ic { opacity: 1; }

/* chips */
.chip { height: 36px; padding: 0 14px; border-radius: 18px; display: inline-flex; align-items: center; gap: 6px; font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; flex: none; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-deep); }
.chip svg { width: 14px; height: 14px; }

/* ---------- Groups home ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; }
.home-head .iconbtn { width: 44px; height: 44px; }
.hero { height: 128px; padding: 14px 18px; overflow: hidden; display: flex; flex-direction: column; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 22px; }
.hero-top small { font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips-in { display: flex; gap: 4px; }
.mini-chip { height: 24px; padding: 0 8px; border-radius: 12px; font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); background: var(--sunk); color: var(--ink2); }
.mini-chip.on { background: var(--ink); color: var(--surface); }
.hero-amt { height: 48px; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); }
.hero-amt b { font: 500 calc(40px * var(--font-scale, 1))/1.15 var(--font-display); letter-spacing: -.01em; }
.hero-amt.owe b { color: var(--owe); } .hero-amt.owed b { color: var(--owed); }
.hero-sub { font: 400 calc(14px * var(--font-scale, 1))/1.35 var(--font-body); color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home .sec-h { margin-top: 22px; }
.glist { margin: 0 -16px; background: var(--surface); border-top: 1px solid var(--line); }
.grow { height: var(--h-home-row); display: flex; align-items: center; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--line); text-align: left; position: relative; }
.grow .group-icon { width: 48px; height: 48px; }
.group-icon.letter { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); }
.grow .gm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gname { font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsub { margin-top: 3px; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr { text-align: right; flex: none; }
.gr small { display: block; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.gr b { display: block; margin-top: 2px; font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
.gr b.owe { color: var(--owe); } .gr b.owed { color: var(--owed); }
.grow.newg { justify-content: center; gap: 8px; height: 56px; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); color: var(--ink); }
.grow.skel .gm { gap: 0; }
.hl { animation: hl 2s ease-out both; }
@keyframes hl { from { background: var(--primary-soft); } to { background: transparent; } }

/* ---------- Group screen ---------- */
.group-page { padding: var(--safe-top) 0 calc(var(--tabbar-h) + var(--safe-bot) + 54px + 24px + 14px); overflow-anchor: none; }
.gnav { position: sticky; top: 0; z-index: 7; height: var(--h-nav); display: flex; align-items: center; gap: 4px; padding: 0 12px; background: var(--bg); }
.gnav .iconbtn { width: 44px; height: 44px; border-radius: 14px; }
.gnav-t { flex: 1; min-width: 0; text-align: center; font: 500 calc(17px * var(--font-scale, 1)) var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity var(--m-fade) ease; }
.gnav-t.on { opacity: 1; }
.ghead { padding: 0 16px 14px; }
.gt { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; height: 74px; }
.gt-l { min-width: 0; padding-bottom: 2px; }
.gtitle { margin-top: 8px; font-size: calc(32px * var(--font-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faces { flex: none; padding-bottom: 4px; }
.stand { margin-top: 12px; height: var(--h-standing); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.stand-l { min-width: 0; }
.stand small { display: block; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.stand-amt { display: block; margin-top: 1px; font: 500 calc(22px * var(--font-scale, 1))/1.15 var(--font-display); white-space: nowrap; }
.stand-amt span { font: 500 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink); }
.stand-amt.owe { color: var(--owe); } .stand-amt.owed { color: var(--owed); }
.stand .btn { height: 40px; flex: none; }
.sk-title { height: 74px; } .sk-stand { margin-top: 12px; }
.ptabs { position: sticky; top: calc(var(--h-nav)); z-index: 6; height: var(--h-tabs); display: flex; padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.ptab { flex: 1; display: grid; place-items: center; font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); position: relative; text-align: center; }
.ptab.on { color: var(--ink); }
.ptab.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.ptab-l { position: relative; }
.ptab .cnt { position: absolute; left: 100%; top: 1px; margin-left: 6px; font: 500 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); color: var(--ink3); }
.panel.pad { padding: 16px 16px 0; }

/* list */
.ptr-wrap { position: relative; }
.ptr-slot { position: absolute; left: 0; right: 0; top: calc(-1 * var(--h-loadrow)); height: var(--h-loadrow); display: flex; align-items: center; justify-content: center; gap: 10px; font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.ptr-wrap:not(.busy) .ptr-slot .spin { animation-play-state: paused; }
.entries { --stick: 96px; position: relative; background: var(--surface); }
.month { position: sticky; top: calc(var(--h-nav) + var(--h-tabs)); z-index: 4; height: var(--h-month); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.month.overlay { z-index: 5; margin-bottom: calc(-1 * var(--h-month)); }
.month b { font: 500 calc(16px * var(--font-scale, 1)) var(--font-display); }
.month-r { position: absolute; right: 8px; top: 0; height: 100%; width: 58%; justify-content: flex-end; display: flex; align-items: center; gap: 6px; padding: 0 8px; font: 500 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.month-r svg { flex: none; }
.row { height: var(--h-row); display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); position: relative; text-align: left; width: 100%; background: var(--surface); }
.row.press-row { transition: background-color var(--m-press) ease-out; }
.row.press-row:active { background: var(--sunk); }
.row .date { width: 36px; text-align: center; flex: none; }
.row .date b { display: block; font: 500 calc(18px * var(--font-scale, 1))/1 var(--font-display); }
.row .date span { display: block; font: 600 max(10px, calc(10px * var(--font-scale, 1))) var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); margin-top: 3px; }
.date.same { visibility: hidden; }
.row .d { flex: 1; min-width: 0; }
.row .d b { display: block; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d > span { display: block; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { text-align: right; flex: none; }
.row .r small { display: block; font: 500 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); }
.row .r b { display: block; font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); margin-top: 2px; white-space: nowrap; }
.row .r b.owe { color: var(--owe); } .row .r b.owed { color: var(--owed); } .row .r b.muted { color: var(--ink); }
.row .r b.fit-s, .row .r b.fit-xs { font-size: calc(13px * var(--font-scale, 1)); }
.row.temp { background: linear-gradient(90deg, var(--primary-soft), var(--surface)); }
.row.failed { background: color-mix(in srgb, var(--owe) 9%, var(--surface)); }
.rowact { color: var(--accent); font-weight: 600; text-decoration: underline; }
.row.hl { animation: hl 2s ease-out both; }
.payic { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.lt { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 6px; border: 1px dashed var(--ink3); font: 600 max(11px, calc(11px * var(--font-scale, 1))) var(--font-body); color: var(--ink2); vertical-align: 2px; }
mark { background: none; color: inherit; text-decoration: underline 2px var(--primary); text-underline-offset: 3px; font-weight: 700; }
.row.skel .date { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.row.skel .d { display: flex; flex-direction: column; gap: 6px; }
.row.skel .r .sk { margin-left: auto; }
.loadrow { height: var(--h-loadrow); width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); border-bottom: 1px solid var(--line); background: var(--surface); }
button.loadrow { color: var(--accent); font-weight: 600; }
.errrow { gap: 10px; }
.errrow-ic { color: var(--owe); flex: none; }
.errrow-t { flex: 1; min-width: 0; font: 400 calc(13px * var(--font-scale, 1))/1.3 var(--font-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.errrow .btn { flex: none; }
.endstamp { height: var(--h-end); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--bg); }
.endstamp b { font: 500 calc(18px * var(--font-scale, 1)) var(--font-display); }
.endstamp span { font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92%; }
.empty-list { padding: 28px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-list h3 { font: 500 calc(21px * var(--font-scale, 1)) var(--font-display); }
.empty-list p { font: 400 calc(14px * var(--font-scale, 1))/1.5 var(--font-body); color: var(--ink2); max-width: 30ch; }
.empty-list .btn { margin-top: 8px; }
.filter-row { padding: 10px 16px; display: flex; gap: 8px; }
.latest-wrap { position: sticky; top: calc(var(--h-nav) + var(--h-tabs) + var(--h-month) + 8px); height: 0; z-index: 6; display: flex; justify-content: center; }
.latest { box-shadow: var(--shadow-2); }
.welcome { margin: 10px 16px; padding: 12px 14px; }
.welcome h3 { font: 500 calc(17px * var(--font-scale, 1))/1.25 var(--font-display); }
.welcome p { margin-top: 4px; font: 400 calc(13px * var(--font-scale, 1))/1.4 var(--font-body); color: var(--ink2); }
.welcome .btn-row { margin-top: 10px; justify-content: flex-end; }
.welcome .btn-row .btn { flex: none; }

/* balances */
.bal-panel .sec-h { margin-top: 4px; align-items: center; }
.bal-panel .sec-h + .card { margin-bottom: 18px; }
.bal-panel .toggle-row { align-items: center; }
.transfers .pay { display: block; padding: 0; }
.pay-main { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px; }
.pay-main .who { flex: 1; min-width: 0; font: 400 calc(16px * var(--font-scale, 1))/1.35 var(--font-body); }
.pay-main .who b.owe { color: var(--owe); } .pay-main .who b.owed { color: var(--owed); }
.why { display: flex; min-height: 32px; margin-top: 2px; font-size: calc(15px * var(--font-scale, 1)); }
.why[aria-expanded="true"] svg { transform: rotate(180deg); }
.why-body { padding: 14px 16px; background: var(--accent-soft); font: 400 calc(15px * var(--font-scale, 1))/1.5 var(--font-body); border-top: 1px solid var(--line); animation: fade-in .15s both; }
.ev-row { height: var(--h-person-row); display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.ev-row:last-child { border-bottom: 0; }
.ev-name { flex: 1; min-width: 0; font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-v { font: 600 calc(14px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
.ev-v.owe { color: var(--owe); } .ev-v.owed { color: var(--owed); } .ev-v.muted { color: var(--ink2); font-weight: 500; }
.pay.skel { height: 64px; display: flex; align-items: center; padding: 0 16px; }

/* sheets: detail, menu, jump */
.detail-tag { margin-top: 2px; }
.detail-tag .lt { margin-left: 0; }
.locked-note { background: var(--sunk); }
.shares { margin-top: 14px; }
.shares-h { padding: 12px 16px; font: 600 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); border-bottom: 1px solid var(--line); }
.share-row { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.share-row:last-child { border-bottom: 0; }
.share-n { flex: 1; min-width: 0; font: 400 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-row b { font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); white-space: nowrap; }
p.your-part { display: block; margin: 12px 2px 14px; padding: 0; background: none; border: 0; box-shadow: none; font: 400 calc(14px * var(--font-scale, 1))/1.45 var(--font-body); color: var(--ink2); }
.hint.center { text-align: center; }
.sk-detail { height: 220px; margin-top: 12px; border-radius: var(--radius-md); }
.menu-list { margin: 10px -18px 0; border-top: 1px solid var(--line); background: var(--surface); }
.menu-list.leave { margin-top: 14px; }
.mrow { min-height: 64px; width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); text-align: left; }
.mrow[aria-disabled="true"] { cursor: default; }
.mrow.on { background: var(--sunk); }
.mic { width: 40px; height: 40px; border-radius: 12px; background: var(--sunk); display: grid; place-items: center; flex: none; color: var(--ink); }
.mic .group-icon { width: 40px; height: 40px; box-shadow: none; }
.mt { flex: 1; min-width: 0; }
.mt b { display: block; font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); }
.mt small { display: block; margin-top: 2px; font: 400 calc(13px * var(--font-scale, 1))/1.35 var(--font-body); color: var(--ink2); }
.mr { font: 500 calc(15px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.menu-list.leave .mt b, .menu-list.leave .mic { color: var(--owe); }
.cur-sym { font: 600 calc(16px * var(--font-scale, 1)) var(--font-body); }
.mrow .switch { margin-top: 0; }
.icon-opt.letter { font: 500 calc(22px * var(--font-scale, 1)) var(--font-display); }
.mj-year { margin-top: 14px; }
.mj-y { font: 600 max(11px, calc(12px * var(--font-scale, 1))) var(--font-body); letter-spacing: .12em; color: var(--ink2); margin: 0 2px 8px; }
.mj-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mj-cell { height: 58px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.mj-cell b { font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); }
.mj-cell span { font: 500 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.mj-cell.off { background: transparent; border-style: dashed; color: var(--ink3); cursor: default; }
.mj-cell.off b { font-weight: 500; color: var(--ink3); }
.mj-cell.on { background: var(--primary-soft); border: 2px solid var(--primary); }

/* search */
.search { padding-top: calc(var(--safe-top) + var(--banner-h, 0px) + 10px); }
.sbar { display: flex; align-items: center; gap: 10px; height: var(--h-nav); }
.sfield { flex: 1; min-width: 0; height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px; border-radius: 14px; background: var(--surface); border: 2px solid var(--accent); }
.sinput { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: 500 calc(17px * var(--font-scale, 1)) var(--font-body); }
.sinput::-webkit-search-cancel-button { display: none; }
.sclear { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink2); }
.scancel { flex: none; font-size: calc(16px * var(--font-scale, 1)); }
.sscope { height: 20px; margin: 4px 2px 0; font: 400 calc(13px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schips { display: flex; gap: 8px; margin: 10px -16px 0; padding: 4px 16px; overflow-x: auto; scrollbar-width: none; }
.schips::-webkit-scrollbar { display: none; }
.scount { height: 34px; display: flex; align-items: center; margin: 4px 2px 6px; font: 500 calc(14px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.search .entries { margin: 0 -16px; }
.month.year { top: 0; }
.snone { padding: 28px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; font: 400 calc(15px * var(--font-scale, 1)) var(--font-body); color: var(--ink2); }
.time-list { margin: 8px -18px 0; max-height: 60vh; overflow-y: auto; }

/* activity */
.feed-item.skel { display: flex; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.feed-end { height: 40px; display: grid; place-items: center; color: var(--ink3); }
.feed li { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .sk, .spin { animation: none !important; }
}

/* persona fixes (unit B) */
/* E10: on a screen with the Add button, toasts sit above it; the page gets
   room to scroll what they would cover (new row, empty-state button) above them. */
.app:has(.fab) .toasts { bottom: calc(var(--tabbar-h) + var(--safe-bot) + 14px + 54px + 10px); }
/* An empty Expenses list has its own "Add the first expense" button: the floating one would sit on it. */
.screen:has(#panel-expenses:not([hidden]) [data-testid=expenses-empty]) .fab { display: none; }
html[data-toast] .app:has(.fab) .page { padding-bottom: calc(var(--tabbar-h) + var(--safe-bot) + 54px + 24px + 14px + 64px); }
.fab { transition: clip-path var(--m-morph) var(--ease), transform .16s var(--ease), opacity .16s var(--ease), visibility .16s; }
/* F11: Balances/Spending fade the button out while content sits under it. */
.fab.away { opacity: 0; visibility: hidden; pointer-events: none; }
.toast { min-height: 54px; }
.why-body .link { display: flex; min-height: 44px; margin-top: 2px; }
p.your-part b { font: 600 calc(15px * var(--font-scale, 1)) var(--font-body); }
.groups-empty { padding-top: 12px; }
.groups-empty .btn-stack { margin: 8px auto 0; max-width: 320px; }
/* F9: a month total / home net that includes rows still saving */
.pend-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pend-pulse 1.4s ease-in-out infinite; }
@keyframes pend-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pend-dot { animation: none; } }
.gsub .pend { color: var(--accent); }
/* v3fix: with a sheet open, a toast goes to the top (the dimmed strip
   above the sheet), never over the rows of the sheet; full-screen sheets
   (Add) keep it at the bottom. */
html:has(.sheet-wrap:not(.full):not(.closing)) .toasts { top: calc(var(--safe-top) + var(--banner-h, 0px) + 8px); bottom: auto; }
html:has(.sheet-wrap:not(.full):not(.closing)) .toast { animation-name: toast-in-top; }
@keyframes toast-in-top { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
/* v3fix: the offline banner pushes the group screen down instead of covering
   its back button. The bars stick below the scroller padding already; the
   strip above the stuck nav is painted so rows never show behind the banner. */
.group-page { padding-top: calc(var(--safe-top) + var(--banner-h, 0px)); }
.gnav { box-shadow: 0 calc(-1 * var(--banner-h, 0px)) 0 0 var(--bg); }
