/*
 * Token names match bridge getTheme / window.__theme (same GistedColors
 * light/dark values as apps/contacts/styles.css). Update the shell palette
 * first if it changes — do not invent a second Finance palette.
 */
:root {
  --surface: #FFFBF8;
  --surface-low: #FFF3EC;
  --ink: #2A1710;
  --muted: #8A5A1E;
  --primary: #A8412A;
  --outline: #8C756B;
  --line: #E0CFC6;
  --danger: #8C3A26;
  --danger-container: #FBE0DA;
  /* Positive/confirming green (Accept swipe action). Deliberately a distinct
     hue from --primary/--danger (both warm clay/red) so Accept reads
     unmistakably apart from Decline. Pairs with --on-primary (near-white)
     text in light mode. */
  --success: #2F6B4A;
  --on-primary: #FFFBF8;
  /* Money-state semantics (approved design): settled = green, part-paid =
     amber, unpaid = --danger. Local to finance — the shared GistedColors
     palette carries no success/warning hue, and clay (--primary) is now
     reserved for actions, not "paid". __theme does not provide these, so
     both light and dark values live here. */
  --good: #2E8B63;
  --warn: #B4740E;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --control-font: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* Topbar right padding — mini-app capsule chip sits top-right, not bottom. */
  --capsule-inset: 4.5rem;
  --tabbar-h: calc(3.75rem + var(--safe-bottom));
  /* Derived from the (JS-measured) bar so FABs sit above it and list views
     clear it — the old fixed 1rem/4.75rem values were tuned to a 3.75rem bar
     and left FABs under the real ~65px pill and content touching its top. */
  --fab-offset: calc(var(--tabbar-h) + 0.85rem);
  --fab-clearance: calc(var(--tabbar-h) + 1rem);
}

[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #17110F;
    --surface-low: #241B18;
    --ink: #F7EDE8;
    --muted: #F0C08A;
    --primary: #E8845F;
    --outline: #8E7F79;
    --line: #3A2E2A;
    --danger: #F3B5A2;
    --danger-container: #3A211C;
    /* Lighter green for dark mode, pairing with --on-primary (near-black)
       text — same role-flip as --danger above. */
    --success: #A7D9B9;
    --on-primary: #17110F;
    --good: #4FB286;
    --warn: #E0A63A;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--surface-low);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-touch-callout: none;
}

button {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: var(--control-font);
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 10px;
}

/* One focus treatment app-wide: the clay accent, never the browser's blue.
   :focus-visible so a mouse click on a button doesn't ring, but keyboard
   and text-field focus do. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app {
  position: relative;
  height: 100%;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-low);
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: calc(var(--safe-top) + 44px + 1.1rem);
  padding: calc(0.55rem + var(--safe-top)) 1rem 0.55rem;
  padding-right: calc(1rem + var(--capsule-inset) + env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  z-index: 3;
  box-sizing: border-box;
}

.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  margin: 0 0 0 -0.35rem;
  padding: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  -webkit-tap-highlight-color: transparent;
}

.back-chevron {
  display: block;
  width: 0.78rem;
  height: 1.25rem;
}

.back[hidden] {
  display: none;
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  /* Bottom clearance lives on the scrolling child, not here: this is a flex
     column with overflow, and WebKit/Chromium drop a flex scroll container's
     padding-bottom for overflow content — so a padding-bottom here vanishes at
     the scroll end and the last row tucks under the bar. See the .view rule. */
  padding: 1rem 1rem 0;
}

/* Bottom tab bar — floating pill (Home / Groups / Payments). A capsule
   inset from all three edges, blurred over the content, with the active
   tab filled in the accent. Mirrors the Contacts PWA's bar. */
.tabbar {
  flex: none;
  position: fixed;
  left: 0.8rem;
  right: 0.8rem;
  bottom: calc(var(--safe-bottom) + 0.7rem);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.4rem;
  border-radius: 1.65rem;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  backdrop-filter: saturate(1.7) blur(26px);
  -webkit-backdrop-filter: saturate(1.7) blur(26px);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent),
    0 14px 32px -14px color-mix(in srgb, var(--ink) 55%, transparent),
    0 3px 10px -6px color-mix(in srgb, var(--ink) 40%, transparent);
  transition: transform 0.24s ease, opacity 0.24s ease;
  will-change: transform;
}

/* Without backdrop-filter the glass can't frost the content behind it, so
   fall back to a near-opaque bar to keep the labels legible. */
@supports not (
  (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
  .tabbar {
    background: color-mix(in srgb, var(--surface) 93%, transparent);
  }
}

.tabbar a {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.16rem;
  min-height: 44px;
  padding: 0.35rem 0.2rem 0.3rem;
  border-radius: 1.3rem;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--outline);
  text-align: center;
  text-decoration: none;
  transition: color 0.24s ease;
}

@media (prefers-reduced-motion: reduce) {
  .tabbar a {
    transition: none;
  }
}

.tabbar .tab-icon {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  display: block;
}

.tabbar a[aria-current="page"] {
  color: var(--on-primary);
}

/* The moving highlight: one pill that glides to the active tab. JS sizes it
   to the active tab (offset box) and translates it; CSS animates the move. */
.tabbar-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 1.3rem;
  background: var(--primary);
  transform: translate(0, 0);
  pointer-events: none;
  z-index: 0;
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .tabbar-thumb {
    transition: none;
  }
}

/* Crossfade the home content when switching Home / Groups / Payments — those
   three share view-home, so there is no view-enter animation to carry it. */
.view#view-home.home-fade {
  animation: home-fade 200ms ease-out both;
}

@keyframes home-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view#view-home.home-fade {
    animation: none;
  }
}

/* Home / Groups / Payments share view-home; the active tab decides which of
   its two sections shows. Home shows both (no data-home-tab match here). */
.app[data-home-tab="groups"] #home-section-payments,
.app[data-home-tab="payments"] #home-section-groups,
.app[data-home-tab="groups"] #home-lede,
.app[data-home-tab="payments"] #home-lede,
.app[data-home-tab="groups"] #home-hero,
.app[data-home-tab="payments"] #home-hero {
  display: none;
}

/* Focused create/pay flows own the whole screen — no tab bar there. */
.app.tabbar-hidden .tabbar {
  display: none;
}

/* With no bar to clear, FABs and list padding drop back to a plain edge
   inset (--tabbar-h is stale from the last bar view, so don't derive from it
   here). */
.app.tabbar-hidden {
  --fab-offset: calc(1rem + var(--safe-bottom));
  --fab-clearance: calc(1.5rem + var(--safe-bottom));
}

/* When the bar slides away on scroll the FAB follows it down to the edge, so
   it never floats high over empty space. Only the FAB moves — the content
   spacer (--fab-clearance) stays put so the page does not reflow as you
   scroll. The FABs' own `bottom` transition (see below) glides it with the
   bar. */
.app.tabbar-collapsed {
  --fab-offset: calc(1rem + var(--safe-bottom));
}


/* Scroll-away: slide the bar out while scrolling down, back on scroll up.
   Content padding is unchanged (it tracks --tabbar-h), so nothing reflows —
   only the floating bar moves. Distinct from tabbar-hidden, which removes it
   entirely for full-screen create/pay flows. */
.app.tabbar-collapsed .tabbar {
  transform: translateY(calc(100% + var(--safe-bottom) + 1.2rem));
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .tabbar,
  .scroll-top-fab,
  .action-fab {
    transition: none;
  }
}

.main > .view:not([hidden]) {
  flex: 1 1 auto;
  min-height: 100%;
}

/* The honored bottom clearance for every scrolling view. A real spacer child,
   not padding on .main or the view: the flex scroll column drops both a
   container's padding-bottom and (for a block view under min-height) the
   view's own — a box with height is the one thing counted at the scroll end.
   --fab-clearance tracks the measured bar and collapses on full-screen flows. */
.main > .view:not([hidden])::after {
  content: '';
  display: block;
  flex: 0 0 auto;
  height: var(--fab-clearance);
}

.pull-refresh {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 44px + 0.55rem + 1px);
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.15s ease;
}

.pull-refresh.is-visible {
  opacity: 1;
}

.pull-refresh-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
}

.pull-refresh.is-loading .pull-refresh-spinner {
  animation: pull-refresh-spin 0.75s linear infinite;
}

@keyframes pull-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.view[hidden] {
  display: none;
}

.view {
  position: relative;
}

.view.view--enter-forward {
  animation: viewEnterForward 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.view.view--enter-back {
  animation: viewEnterBack 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes viewEnterForward {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes viewEnterBack {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view.view--enter-forward,
  .view.view--enter-back {
    animation: none;
  }
}

.scroll-top-fab {
  position: fixed;
  right: 1rem;
  bottom: var(--fab-offset);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--primary);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 12%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: bottom 0.24s ease;
}

.scroll-top-fab[hidden] {
  display: none;
}

.scroll-top-fab-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.action-fab {
  position: fixed;
  right: 1rem;
  bottom: var(--fab-offset);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--ink) 18%, transparent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: bottom 0.24s ease;
}

.action-fab:active {
  transform: scale(0.96);
  opacity: 0.92;
}

.action-fab[hidden] {
  display: none;
}

.action-fab-icon {
  width: 1.35rem;
  height: 1.35rem;
}

/* Confirmation toast host — pinned above the floating tabbar (bottom:
   --fab-clearance is the same tabbar-h + 1rem gap the scroll spacer already
   honors, so the toast never sits under the bar). Centered, capped width,
   stacks new-on-top-of-old via column-reverse though showToast() only ever
   keeps one at a time. pointer-events is off on the host (so it never blocks
   taps on content behind it) and on for the toast itself. */
.toast-host {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: var(--fab-clearance);
  z-index: 60;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  max-width: 26rem;
  /* Matches .action-fab's own height (3.25rem) — both float at nearly the
     same bottom offset (--fab-clearance vs --fab-offset) on the members
     screen, so a short one-line toast would otherwise leave the FAB's
     rounded top peeking out from behind its top-right corner. */
  min-height: 3.25rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--good);
  background: var(--surface-low);
  color: var(--ink);
  box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--ink) 45%, transparent);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: auto;
  animation: toast-in 0.22s ease-out both;
}

.toast.is-danger {
  border-left-color: var(--danger);
}

.toast.is-leaving {
  animation: toast-out 0.18s ease-in both;
}

.toast-icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--good);
}

.toast.is-danger .toast-icon {
  color: var(--danger);
}

.toast-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Reduced motion: appear/disappear as a plain fade, never a slide. */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: toast-fade-in 0.15s ease-out both;
  }
  .toast.is-leaving {
    animation: toast-fade-out 0.15s ease-in both;
  }
}

@keyframes toast-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.lede {
  margin: 0 0 1rem;
  color: var(--outline);
  font-size: 0.95rem;
}

.lede-inline {
  margin: 0 0 0.85rem;
  color: var(--outline);
  font-size: 0.9rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  overflow: hidden;
  margin: 0 0 0.9rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  margin: 0 0 0.9rem;
}

.panel h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

#view-setup > .panel {
  margin-bottom: 0;
}

/* Each section on the group overview is separated from the previous by a
   full-width divider — a consistent rhythm down the screen, not one
   arbitrary line. */
#view-setup > .view-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

/* Collections leads directly beneath the summary card — no divider above
   the first section. */
#view-setup > .view-section:first-of-type {
  margin-top: 1.5rem;
  padding-top: 0;
  border-top: 0;
}

/* Members overview entry — a single tappable nav row (label · count · ›)
   rather than a heading with an orphaned subtitle. Taps through to the full
   members directory. */
#view-bucket > .bucket-tabs {
  margin-top: 1.25rem;
}

#view-bucket .bucket-tab-panel .item-list,
#view-bucket .bucket-tab-panel .empty,
#view-bucket .bucket-tab-panel .empty-cta,
#view-bucket .bucket-tab-panel .board-accordion {
  margin-bottom: 0;
}

.bucket-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.bucket-tab {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  padding: 0.45rem 0.5rem;
  background: transparent;
  color: var(--outline);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bucket-tab.is-active {
  background: var(--primary);
  color: var(--on-primary);
}

/* Used by the Enrollment section's open/approval segmented toggle for a
   viewer who can't manage the group (renderSetupEnrollment in app.js) —
   the tabs otherwise used for Periods/Payouts/Receipts and the payouts
   status filter are never themselves disabled. */
.bucket-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bucket-tab-panel {
  display: none;
}

.bucket-tab-panel.is-active {
  display: block;
}

.bucket-tab-panel[hidden] {
  display: none !important;
}

.bucket-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.bucket-panel-lede {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--outline);
  line-height: 1.45;
}

.bucket-panel-head .bucket-panel-lede {
  flex: 1;
  margin-bottom: 0;
}

/* Board-header "Pay out" shortcut (#board-payout-shortcut) — same
   .bucket-panel-head flex-row idiom as the Payouts tab's own lede+action
   header just above, applied to #bucket-meta so the action is visible from
   every #/bucket/:id tab, not just Payouts. */
.bucket-panel-head.panel {
  /* This header is a card but its meta must be free to wrap onto as many
     lines as it needs — never clip it against the floating actions. */
  overflow: visible;
}

.bucket-panel-head .bucket-summary {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-setup > .view-section .item-list,
#view-setup > .view-section .empty,
#view-setup > .view-section .empty-cta,
#view-setup > .view-section .board-accordion {
  margin-bottom: 0;
}

#view-bucket > .share-card {
  margin-bottom: 0;
}

/* Section titles across the app — one consistent restrained warm label, so
   the content (money cards, rows) carries the visual weight rather than the
   headings competing with it. */
.section-heading h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.section-action {
  flex: none;
  min-height: 36px;
  border: 1px solid var(--primary);
  border-radius: 9px;
  padding: 0.4rem 0.65rem;
  background: transparent;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 650;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* "See all groups/payments →" — hands the home preview off to its full tab. */
.section-see-all {
  display: inline-flex;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.35rem 0;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 650;
  text-decoration: none;
}

.section-see-all:active {
  opacity: 0.7;
}

.section-action-icon {
  width: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.section-action-icon-glyph {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: opacity 0.15s ease, transform 0.08s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
  opacity: 0.92;
}

.btn:disabled {
  opacity: 1;
  background: var(--surface-low);
  color: var(--outline);
  border-color: var(--line);
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-text {
  background: transparent;
  color: var(--outline);
  border-color: transparent;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}

.btn-checkout {
  width: auto;
  flex: none;
  min-width: 8.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-primary);
  border-color: var(--danger);
}

/* Message line inside the reusable confirm sheet (#confirm-sheet). */
.confirm-sheet-message {
  margin: 0.15rem 0 0.25rem;
  color: var(--outline);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Rename / Archive inside the group-settings sheet — full-width stacked
   actions. */
.setup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-sm {
  min-height: 36px;
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.btn + .btn {
  margin-top: 0.5rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-row .btn {
  width: auto;
  flex: 1 1 auto;
}

.btn-row .btn + .btn {
  margin-top: 0;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  min-width: 0;
}

/* Block (not grid) so a label's inline hint stays on the label line
   ("Phone or email required") instead of dropping to its own row; the
   label→control gap moves to a margin on the control below. */
.stack-form label {
  display: block;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--outline);
  letter-spacing: 0.01em;
}

.stack-form label > input,
.stack-form label > select,
.stack-form label > textarea {
  margin-top: 0.35rem;
}

.field-label {
  display: block;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
}

.messaging-settings {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.messaging-toggle,
.messaging-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  color: var(--ink);
  font-weight: 600;
}

.messaging-toggle input,
.messaging-event input {
  appearance: auto;
  -webkit-appearance: checkbox;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--primary);
}

.messaging-billing-copy {
  margin: -0.25rem 0 0;
}

.messaging-events {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.messaging-events legend {
  margin-bottom: 0.45rem;
  color: var(--outline);
  font-size: 0.8rem;
  font-weight: 600;
}

.messaging-events > div {
  display: grid;
  gap: 0.65rem;
}

.messaging-events:disabled {
  opacity: 0.55;
}

/* Enrollment section (renderSetupEnrollment in app.js): Rotate/Revoke
   stacked the same way .setup-actions stacks Rename/Archive in the group
   settings sheet — full-width .btn rows, not a side-by-side row. */
.enrollment-link-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.field-hint {
  margin: -0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.field-hint-inline {
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.status {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.status.is-error {
  color: var(--danger);
}

/* The retry a failed list read offers, inline after its error (list_load.js). */
.status-retry {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.status-retry:disabled {
  opacity: 0.5;
  cursor: default;
}

.empty {
  margin: 0;
  color: var(--outline);
  font-size: 0.9rem;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.item-list > li {
  padding: 0;
  border-top: none;
  margin-bottom: 0.55rem;
  min-width: 0;
}

.item-list > li.list-card,
.item-list > li:has(> a) {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.item-list > li > a,
.item-list > li > button.row-link {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0.85rem 0.95rem;
}

.item-list > li.list-card {
  padding: 0.85rem 0.95rem;
}

.item-list > li:first-child {
  border-top: none;
}

.item-list > li:not(:last-child) {
  margin-bottom: 0.55rem;
}

.item-list > li + li {
  border-top: none;
}

/* Legacy flat rows (members admin list without cards) */
.item-list.item-list-flat > li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  margin-bottom: 0;
}

.item-list.item-list-flat > li:first-child {
  border-top: none;
}

.row-title {
  margin: 0;
  font-weight: 650;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.row-meta {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--outline);
  overflow-wrap: anywhere;
}

.row-reason {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.row-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  min-height: 36px;
  font-size: 0.8rem;
  font-weight: 600;
}

.row-actions button.danger {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--outline);
  vertical-align: middle;
}

.badge-role {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.badge-you {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}

/* Positive lifecycle status (Active / Verified) — green, not clay. Clay is
   reserved for actions ("tap me"); a healthy status reads as --good. */
.badge-ok {
  border-color: color-mix(in srgb, var(--good) 35%, var(--line));
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
}

.badge-paid {
  border-color: color-mix(in srgb, var(--good) 35%, var(--line));
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
}

.badge-unpaid {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
  background: var(--danger-container);
}

.badge-warn {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--line));
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.badge-period-done {
  border-color: var(--line);
  color: var(--outline);
  background: color-mix(in srgb, var(--outline) 8%, transparent);
}

.badge-period-active {
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.badge-period-upcoming {
  border-color: var(--line);
  color: var(--outline);
  background: color-mix(in srgb, var(--outline) 6%, transparent);
}

.badge-muted {
  color: var(--outline);
}

/* --- Member directory (T6-T9): tag-filter chip bar, read-only directory-row
   tag pills, payer-editor's removable tag chips, the directory-row note
   line, and enroll-sheet checkbox rows. Tokens only, no new palette.
   Idioms reused: .bucket-tab/.bucket-tab.is-active for the chip/active-chip
   pattern, .badge-role/.pay-method-badge for the primary-tinted read-only
   pill, .messaging-toggle input for the native-checkbox override. */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.chip-row:empty {
  display: none;
}

/* Quiet "Filter" label at the start of a tap-to-filter chip row (T-audit) —
   marks the row as an interactive control bar, distinct from the .chip
   buttons themselves and from the read-only .tag-pill labels in each row
   below. Same small-caps treatment as .checkout-form-label/.checkout-stage-
   label elsewhere in this file. */
.chip-row-label {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.chip {
  flex: none;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  color: var(--outline);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chip.chip-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

/* Container shared by the directory row's read-only tags and the
   payer-editor's removable tag chips. */
.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.tag-pills:empty {
  margin: 0;
}

/* Directory-row read-only tag: small + primary-tinted, non-interactive
   (distinct from the tappable filter .chip above). */
.tag-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 650;
}

/* Member directory — dense rows: name + (masked phone · note) on the left,
   tag pills right-aligned, denser than a standard card so a big roster
   scans without endless scrolling. */
.item-list > li.list-card.dir-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
}

.dir-row-main {
  min-width: 0;
}

.dir-row-name {
  margin: 0;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.dir-row-meta {
  margin: 0.1rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dir-row-tags {
  margin-left: auto;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Faint count in the "Members · N" directory header. */
.dir-count {
  color: var(--outline);
  font-weight: 400;
}

/* Payer-editor's removable tag chip: label text + an x remove control. */
.tag-pill.tag-pill-removable {
  gap: 0.3rem;
  padding: 0.15rem 0.3rem 0.15rem 0.55rem;
}

.tag-pill-label {
  overflow-wrap: anywhere;
}

.tag-pill-remove {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: color-mix(in srgb, var(--primary) 24%, transparent);
  color: var(--primary);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Directory-row note (rendered as class="row-meta member-note") — color and
   size come from .row-meta above; this adds the single-line ellipsis. */
.member-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Enroll-sheet checkbox row. ID-qualified: .enroll-member-row is itself a
   <label>, and its form has class="stack-form sheet-form", so the generic
   ".stack-form label" rule (0,1,1) would otherwise outrank a bare
   ".enroll-member-row" (0,1,0) and force display:grid over our display:flex.
   Same story for the checkbox vs. ".stack-form input". */
#enroll-members-sheet .enroll-member-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--ink);
  font-size: inherit;
  font-weight: 400;
  cursor: pointer;
}

#enroll-members-sheet .enroll-member-row input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  accent-color: var(--primary);
}

.enroll-member-text {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.1rem;
}

.panel-section {
  margin-top: 1.25rem;
}

.board-table th.is-current-cycle,
.board-table td.is-current-cycle {
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-low));
}

.board-table th.is-current-cycle {
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

/* Bucket board — cycles x members matrix, horizontally scrollable. */
.board-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1rem 0.9rem;
  padding: 0 1rem;
}

.board-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
}

.board-table th,
.board-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.85rem;
  white-space: nowrap;
}

.board-table thead th {
  color: var(--outline);
  font-weight: 650;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.board-table td.member-cell {
  font-weight: 650;
  color: var(--ink);
  white-space: normal;
}

.board-table td.member-status {
  font-weight: 500;
  color: var(--outline);
  font-size: 0.78rem;
}

.board-cell {
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.board-cell.is-settled {
  background: color-mix(in srgb, var(--good) 16%, transparent);
  color: var(--good);
}

.board-cell.is-partial {
  background: color-mix(in srgb, var(--warn) 20%, transparent);
  color: var(--warn);
}

.board-cell.is-open {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.board-cell.is-absent {
  color: var(--outline);
  opacity: 0.55;
}

.board-totals-row td {
  font-weight: 650;
  border-top: 2px solid var(--line);
}

.share-box {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.share-box .share-code {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.empty-cta {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.5rem;
}

a.btn {
  text-align: center;
}

.quote-panel {
  margin: 0.35rem 0 0.15rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-low);
}

.quote-net {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.quote-sentence {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--ink);
}

/* --- Redesign: bucket board accordion --- */

.bucket-summary {
  margin: 0 0 0.25rem;
}

.board-total {
  margin: 0 0 0.65rem;
  font-weight: 600;
}

/* Board balance summary: Collected / Available / Still due as stacked
   label · value rows in one card. Each amount gets the full row width, so a
   large ₦ figure reads in full rather than being clamped into a cramped
   3-cell grid. "Still due" is emphasized (danger) when greater than zero. */
.board-summary {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-low);
  overflow: hidden;
}

.board-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.6rem 0.85rem;
}

.board-summary-row + .board-summary-row {
  border-top: 1px solid var(--line);
}

.board-summary-k {
  flex: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.board-summary-v {
  min-width: 0;
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.board-summary-row.is-due {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-low));
  box-shadow: inset 3px 0 0 var(--danger);
}

.board-summary-row.is-due .board-summary-v {
  color: var(--danger);
}

/* Board header actions — "Pay out" + the settings gear, floating right of
   the write-up (invite link + Manage members live in the gear's sheet). */
.bucket-head-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Collection-settings sheet — even vertical rhythm for its stacked blocks
   (this sheet-form isn't a stack-form grid, so give it its own gap); the
   invite label sits tight to its input, then even gaps to the actions. */
#bucket-settings-modal .sheet-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#bucket-settings-modal .sheet-form h2 {
  margin: 0;
}

#bucket-settings-modal .field-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.share-card {
  display: grid;
  gap: 0.75rem;
}

.field-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--outline);
}

.share-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.share-url {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-low);
  font-size: 0.78rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.btn-copy {
  flex: none;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--outline) 12%, var(--surface));
  color: var(--outline);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Group overview header: the group name with its lifecycle status as a
   quiet meta line beside it — status leads the card, not orphaned at the
   bottom. */
.group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.group-head-id {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.group-head h2 {
  margin: 0;
}

/* Header settings gear — a quiet outlined icon button (actions only, no
   fill), top-right of the group identity row. Opens the settings sheet. */
.iconbtn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.iconbtn svg {
  width: 18px;
  height: 18px;
}

.group-status {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

/* Group overview summary — a two-stat glance grid: the total due across
   collections (hero, semantic stripe) and the group's distinct member
   count. So an admin reads the group's health before drilling into a
   collection. Mirrors the audit mockup's .stats/.stat proportions. */
.group-stats {
  display: grid;
  /* The money hero carries a full ₦ amount (can run to hundreds of
     thousands) while the member stat is a 1-2 digit count — give the hero
     the larger share so a big amount + its label sit on their own lines
     without crowding, and the count tile isn't left half-empty. */
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.group-stat {
  min-width: 0;
  /* Tiles sit a shade lighter than the panel that holds them, so they read
     as distinct tiles rather than borders drawn inside a flat card. */
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0.7rem 0.8rem;
}

.group-stat.is-hero {
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-low));
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.group-stat.is-hero.is-clear {
  background: color-mix(in srgb, var(--good) 6%, var(--surface-low));
  border-color: color-mix(in srgb, var(--good) 45%, var(--line));
}

/* The hero's caption picks up a softened tint of its semantic hue — tied to
   the amount without shouting. The amount itself keeps the full colour. */
.group-stat.is-hero .group-stat-k {
  color: color-mix(in srgb, var(--danger) 50%, var(--muted));
}

.group-stat.is-hero.is-clear .group-stat-k {
  color: color-mix(in srgb, var(--good) 50%, var(--muted));
}

.group-stat-v {
  margin: 0;
  font-weight: 650;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.group-stat.is-hero .group-stat-v {
  /* Shrinks on narrow phones / very large amounts so the figure never
     overflows its tile; floors above the member count so the hero stays
     the larger of the two. */
  font-size: clamp(1.2rem, 5.2vw, 1.45rem);
  color: var(--danger);
}

.group-stat.is-hero.is-clear .group-stat-v {
  color: var(--good);
}

.group-stat-k {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
}

/* The member-count tile doubles as the entry to the members directory — a
   tappable stat card with a corner chevron marking it navigable. */
.group-stat.is-link {
  position: relative;
  display: block;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.group-stat-go {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
}

/* Payer collection summary: both cells hold a ₦ amount, so equal width
   (the group overview's money-hero + member-count grid stays asymmetric). */
#me-bucket-summary {
  grid-template-columns: 1fr 1fr;
}

/* Give the payer's obligation sections room to breathe — below the summary
   and between the Unpaid / Paid groups. */
#me-obligations-host .list-section-heading {
  margin-top: 1.6rem;
}

/* Home hero — a warm clay summary card that gives the landing screen a
   "home" feel. A deliberate committed look: a fixed clay gradient with a
   soft top-right highlight and white text, so it reads as an accent panel
   on both the light and dark app grounds. */
.home-hero {
  margin: 0.25rem 0 1.2rem;
  padding: 1.3rem 1.15rem;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(130% 90% at 85% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(135deg, #a8412a 0%, #6e2a1a 100%);
  box-shadow: 0 10px 24px color-mix(in srgb, #6e2a1a 45%, transparent);
}

.home-hero-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.home-hero-amount {
  margin: 0.3rem 0 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.home-hero-sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Compact invite chip — a single row (faint label · code · Copy pushed
   right), matching the collection board's invite treatment rather than the
   old chunky input box. */
.invite-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.invite-chip-label {
  flex: none;
}

.invite-chip-code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* Invite Copy — a clay-outlined action with a copy glyph (clay = actions),
   matching the proposal rather than the old grey fill. */
.invite-copy-btn {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--primary);
  border-radius: 9px;
  background: transparent;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.invite-copy-btn svg {
  width: 0.9rem;
  height: 0.9rem;
}

.board-accordion {
  display: grid;
  gap: 0.65rem;
}

.period-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.period-card.is-current {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent);
}

.period-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 1rem;
}

.period-toggle:hover {
  background: color-mix(in srgb, var(--outline) 5%, var(--surface));
}

.period-toggle-main {
  min-width: 0;
}

.period-toggle-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.period-toggle-meta {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--outline);
}

.period-toggle-trailing {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: none;
}

.period-chevron {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--outline);
  transition: transform 0.15s ease;
}

.period-card.is-expanded .period-chevron {
  transform: rotate(180deg);
}

.board-view-all {
  margin: 0.25rem 0 0;
  text-align: center;
}

.board-view-all a {
  font-size: 0.875rem;
  font-weight: 600;
}

.period-view-all {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.period-chevron-forward {
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0.7;
}

.list-load-more-wrap {
  padding: 0.75rem 0 0.25rem;
  text-align: center;
}

.period-detail-list .period-member-line:first-child {
  padding-top: 0;
}

.period-detail {
  border-top: 1px solid var(--line);
  background: var(--surface-low);
  padding: 0.85rem 1rem;
}

.period-member-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
}

.period-member-line + .period-member-line {
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.period-member-amount {
  font-weight: 600;
  font-size: 0.84rem;
}

.period-member-amount.line-paid {
  color: var(--good);
}

.period-member-amount.line-unpaid {
  color: var(--danger);
}

.period-member-amount.line-partial {
  color: var(--warn);
}

/* --- Redesign: payer checkout --- */

.checkout-hero {
  margin: 0.25rem 0 1.25rem;
}

.checkout-hero-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--outline);
}

.checkout-hero-amount {
  margin: 0.2rem 0 0;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.dues-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.dues-list > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dues-list > li.is-current {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent);
}

.due-line-main {
  min-width: 0;
}

.due-line-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.due-line-meta {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--outline);
}

.checkout-form {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.checkout-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.checkout-form-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
}

.checkout-form-amount {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.checkout-breakdown {
  margin-top: 1.25rem;
}

.checkout-stage {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.checkout-stage-head {
  margin-bottom: 0.85rem;
}

.checkout-stage-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--outline);
}

.checkout-stage-amount {
  margin: 0.15rem 0 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.checkout-stage-lede {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--outline);
}

.pay-method-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.pay-method-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.pay-method-card.is-recommended {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 8%, transparent);
}

.pay-method-card.is-unavailable {
  opacity: 0.62;
  border-style: dashed;
}

.pay-method-card.is-unavailable .pay-method-row {
  cursor: not-allowed;
}

.pay-method-card.is-unavailable .pay-method-chevron {
  visibility: hidden;
}

.pay-method-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.9rem 0.95rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pay-method-row:active {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.pay-method-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}

.pay-method-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.pay-method-icon-bank {
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
  color: var(--ink);
}

.pay-method-icon-card {
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
  color: var(--ink);
}

.pay-method-body {
  flex: 1;
  min-width: 0;
}

.pay-method-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pay-method-title {
  font-size: 0.95rem;
  font-weight: 650;
}

.pay-method-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pay-method-subtitle {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--outline);
}

/* Fee-inclusive total per method row — shown once financeMePay has minted
   (see IntentCheckout.methodTotalCopy); the same total on every row, since
   the finance platform fee is fixed on the intent before a method is
   chosen, not split by channel. */
.pay-method-total {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.pay-method-chevron {
  flex: none;
  color: var(--outline);
  opacity: 0.65;
}

.pay-method-chevron svg {
  width: 0.65rem;
  height: 1rem;
}

.pay-method-cancel {
  width: 100%;
  margin-top: 0.85rem;
}

.checkout-stage-waiting {
  text-align: center;
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
}

.pay-waiting-spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.85rem;
  border: 2px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: pay-wait-spin 0.8s linear infinite;
}

@keyframes pay-wait-spin {
  to {
    transform: rotate(360deg);
  }
}

.pay-waiting-title {
  margin: 0;
  font-size: 1.05rem;
}

.pay-waiting-body {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
  color: var(--outline);
}

.checkout-breakdown-heading {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 650;
}

/* Collection card money-hero: the outstanding amount is the card's point,
   coloured by state (due = danger, clear = good); a left stripe lifts cards
   that need attention. Clay stays for actions, never money state. */
.bucket-money {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.bucket-amount {
  font-weight: 650;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.bucket-amount.is-due {
  color: var(--danger);
}

.bucket-amount.is-clear {
  color: var(--good);
}

.bucket-amount-label {
  font-size: 0.72rem;
  color: var(--outline);
}

.swipe-row.is-due .swipe-front {
  box-shadow: inset 3px 0 0 var(--danger);
}

/* Plain (non-swipe) card rows — e.g. the my-payments list — get their card
   look from ".item-list > li:has(> a)"; the is-due stripe goes straight on
   that li rather than on a .swipe-front, since there's no separate front
   layer here. :not(.swipe-row) keeps this from double-painting on rows
   that already get the .swipe-row.is-due treatment above. */
.item-list > li.is-due:not(.swipe-row) {
  box-shadow: inset 3px 0 0 var(--danger);
}

/* Payout OTP: show the co-signer what they're approving (amount + destination). */
.payout-otp-summary {
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}

.payout-otp-summary-k {
  margin: 0;
  font-size: 0.75rem;
  color: var(--outline);
}

.payout-otp-summary-amount {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.payout-otp-summary-dest {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--outline);
}

.list-section-heading {
  margin: 1rem 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: normal;
  text-transform: none;
  color: var(--outline);
}

.list-section-heading:first-child {
  margin-top: 0;
}

.list-section + .list-section-heading {
  margin-top: 1.25rem;
}

.bank-details {
  margin: 0 0 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.bank-details > div {
  display: grid;
  gap: 0.2rem;
}

.bank-details dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--outline);
}

.bank-details dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.bank-account-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.me-pay-bank {
  margin-top: 0.5rem;
}

/* Bank-transfer waiting state: an amber/--warn-tinted pending panel (the
   audit's ".pending" mock, rebuilt on this file's own color-mix idiom —
   see .badge-warn) so a payer knows the app is still watching for their
   transfer, not stuck. Display only; the verify poll it sits next to is
   unchanged. */
.me-pay-bank-pending {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 11px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--outline);
  font-size: 0.85rem;
  line-height: 1.4;
}

.me-pay-bank-pending-dots {
  display: inline-flex;
  flex: none;
  gap: 3px;
}

.me-pay-bank-pending-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  animation: me-pay-bank-pending-blink 1.1s infinite;
}

.me-pay-bank-pending-dots i:nth-child(2) {
  animation-delay: 0.18s;
}

.me-pay-bank-pending-dots i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes me-pay-bank-pending-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.me-thanks .me-thanks-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.me-thanks .btn-row {
  margin-top: 0.85rem;
}

/* --- Swipe list rows (members, setup overview, admins) --- */

#view-bucket:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.bucket-tab-panel.is-active {
  flex: 1 1 auto;
}

.item-list.swipe-list,
.item-list.members-list {
  display: grid;
  gap: 0.65rem;
}

.item-list.swipe-list > li,
.item-list.members-list > li {
  margin-bottom: 0;
}

.item-list.members-list > li.list-card {
  padding: 1rem;
}

.item-list.swipe-list > li.swipe-row,
.item-list.members-list > li.swipe-row {
  position: relative;
  padding: 0;
  overflow: hidden;
  touch-action: pan-y;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.item-list.swipe-list > li.swipe-row:first-child,
.item-list.swipe-list > li.swipe-row + li.swipe-row,
.item-list.members-list > li.swipe-row:first-child,
.item-list.members-list > li.swipe-row + li.swipe-row {
  border-top: 1px solid var(--line);
}

.item-list.swipe-list .swipe-actions,
.item-list.members-list .swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 0;
}

.item-list.swipe-list .swipe-action,
.item-list.members-list .swipe-action {
  border: 0;
  margin: 0;
  min-width: 4.75rem;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--on-primary, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-list.swipe-list .swipe-action-neutral,
.item-list.members-list .swipe-action-neutral {
  background: color-mix(in srgb, var(--primary) 82%, #1a1a1a);
}

.item-list.swipe-list .swipe-action-remove,
.item-list.members-list .swipe-action-remove {
  background: var(--danger);
}

.item-list.swipe-list .swipe-action-accept,
.item-list.members-list .swipe-action-accept {
  background: var(--success);
}

.item-list.swipe-list .swipe-front,
.item-list.members-list .swipe-front {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 1rem;
  background: var(--surface);
  touch-action: pan-y;
  will-change: transform;
}

.item-list.swipe-list .swipe-front-link {
  cursor: pointer;
}

/* Swipe affordance on the Pending-request rows: because Accept/Decline now
   live behind a leftward swipe, a faint left chevron at the right edge hints
   the row is swipeable rather than an inert card. Decorative only (no data),
   so a CSS glyph is fine under Ruling E. It rides on the front, sliding away
   as the row opens. */
.item-list.pending-list .swipe-front {
  padding-right: 2rem;
}

.item-list.pending-list .swipe-front::after {
  content: '‹';
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--outline);
  opacity: 0.5;
  pointer-events: none;
}

.item-list.pending-list .swipe-row.is-open .swipe-front::after,
.item-list.pending-list .swipe-row.is-dragging .swipe-front::after {
  opacity: 0;
}

.item-list .list-row-head,
.item-list.members-list .member-row-head,
.item-list.swipe-list .member-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.item-list .list-row-head .row-title,
.item-list.members-list .member-row-head .row-title {
  flex: 1 1 auto;
  min-width: 0;
}

.item-list .list-badges,
.item-list.members-list .member-badges {
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-left: auto;
}

.item-list.members-list > li.list-card .member-row-head {
  margin-bottom: 0;
}

.item-list.swipe-list .swipe-row.is-dragging .swipe-front,
.item-list.members-list .swipe-row.is-dragging .swipe-front {
  transition: none !important;
}

.item-list.swipe-list .swipe-row.is-open .swipe-front,
.item-list.swipe-list .swipe-row.is-dragging .swipe-front,
.item-list.members-list .swipe-row.is-open .swipe-front,
.item-list.members-list .swipe-row.is-dragging .swipe-front {
  box-shadow: -4px 0 12px color-mix(in srgb, var(--ink) 8%, transparent);
}

.btn-danger-text {
  color: var(--danger);
  margin-top: 0.75rem;
  padding-left: 0;
  padding-right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .item-list.swipe-list .swipe-front,
  .item-list.members-list .swipe-front {
    transition: none !important;
  }
}

/* Modal sheets (matches apps/contacts) */
.sheet {
  width: min(100% - 1.5rem, 26rem);
  max-height: min(90dvh, 40rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--ink) 28%, transparent);
}

/* A dark scrim in both themes — must NOT key off --ink, which is the light
   text colour in dark mode and would wash the backdrop lighter. */
.sheet::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.sheet-form {
  padding: 1.1rem 1rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(90dvh, 40rem);
}

.sheet-form h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.sheet-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.sheet-actions .btn + .btn {
  margin-top: 0;
}

#add-member-new-fields.is-hidden {
  display: none;
}

.view-invite {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 5rem);
}

.invite-card {
  max-width: 22rem;
  margin: 0 auto;
  text-align: center;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent);
}

.invite-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted);
}

.invite-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.invite-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.invite-lede {
  margin: 0;
  font-size: 0.9rem;
  color: var(--outline);
  line-height: 1.5;
}

.invite-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.25rem;
}
