:root {
  --rose-50: #fff7fb;
  --rose-100: #fde8f4;
  --rose-200: #f8cde7;
  --rose-300: #ef9fca;
  --plum-950: #2d1830;
  --plum-850: #402042;
  --plum-700: #6b3b67;
  --lavender: #8064be;
  --lavender-soft: #eee6ff;
  --cream: #fffdf9;
  --sage: #50765b;
  --ink: #28182c;
  --muted: #66506b;
  --line: rgba(82, 38, 82, 0.18);
  --line-strong: rgba(82, 38, 82, 0.28);
  --glass: rgba(255, 251, 254, 0.065);
  --glass-strong: rgba(255, 251, 254, 0.14);
  --glass-soft: rgba(255, 255, 255, 0.045);
  --shadow: 0 16px 42px rgba(61, 28, 62, 0.18);
  --shadow-soft: 0 8px 24px rgba(61, 28, 62, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--rose-50);
  overflow-x: hidden;
}

body {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #fff7fb;
  font-family: "Quicksand", "Avenir Next Rounded", "Nunito", ui-rounded, system-ui, sans-serif;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
}

body::before {
  z-index: -2;
  background: url("assets/calm-bills-hero.png") center top / cover no-repeat;
  opacity: 0.95;
  filter: saturate(1.26) contrast(1.08);
  transform: scale(1.02);
}

body::after {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 247, 251, 0.22) 0%, rgba(255, 253, 249, 0.06) 42%, rgba(245, 237, 255, 0.18) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 231, 244, 0.03));
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(128, 100, 190, 0.42);
  outline-offset: 2px;
}

.is-authenticating .app-shell,
.is-authenticating .records-shell,
.is-authenticating .funds-widget {
  display: none;
}

.pin-screen {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: end center;
  width: 100%;
  min-height: 100svh;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
}

.pin-screen[hidden] {
  display: none;
}

.pin-card {
  width: min(100%, 402px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 245, 252, 0.05)),
    rgba(255, 251, 254, 0.12);
  box-shadow: 0 24px 70px rgba(45, 24, 48, 0.24);
  -webkit-backdrop-filter: blur(20px) saturate(1.24);
  backdrop-filter: blur(20px) saturate(1.24);
}

.pin-card__eyebrow {
  margin: 0 0 6px;
  color: var(--lavender);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pin-card h1 {
  max-width: none;
  margin: 0 0 8px;
  color: var(--plum-950);
  font-size: 2.1rem;
}

.pin-card__copy,
.pin-card__error {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.pin-card__error {
  color: #8e264d;
}

.pin-card label {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  color: var(--plum-700);
  font-size: 0.82rem;
  font-weight: 900;
}

.pin-card input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(82, 38, 82, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.62);
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-align: center;
}

.pin-card__button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #7d5fba, #cb5f9a);
  font-weight: 950;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 390px;
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 10px calc(18px + env(safe-area-inset-bottom));
}

.hero {
  position: relative;
  min-height: 218px;
  margin: 0 -10px;
  overflow: hidden;
  background: transparent;
}

.hero__image {
  display: none;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 253, 0.04) 0%, rgba(255, 247, 251, 0.2) 62%, rgba(255, 247, 251, 0.42) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.02));
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 330px;
  padding: calc(30px + env(safe-area-inset-top)) 20px 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lavender);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--plum-950);
  font-family: "Parisienne", "Snell Roundhand", "Bradley Hand", cursive;
  font-size: 2.9rem;
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero__copy {
  max-width: 280px;
  margin: 12px 0 0;
  color: var(--plum-700);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.35;
}

.summary,
.verse-card,
.ledger-card,
.records-button,
.records-card,
.bill-card,
.empty-state,
.funds-panel,
.reset-sheet__panel,
.bill-sheet__panel {
  border: 1px solid rgba(255, 255, 255, 0.64);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.095), rgba(255, 245, 252, 0.025)),
    var(--glass);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.24);
  backdrop-filter: blur(18px) saturate(1.24);
}

.summary {
  position: relative;
  margin-top: -28px;
  padding: 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary::before,
.verse-card::before,
.ledger-card::before,
.records-card::before,
.bill-card::before,
.funds-panel::before,
.reset-sheet__panel::before,
.bill-sheet__panel::before {
  display: block;
  height: 1px;
  margin: -1px 8px 0;
  background: rgba(255, 255, 255, 0.84);
  content: "";
}

.summary__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary__top > div:first-child {
  min-width: 0;
}

.summary__label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.58);
}

.summary__amount {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 1.82rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.64);
}

.summary__grid,
.expense-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.summary__grid > div,
.expense-summary > div {
  min-width: 0;
  padding: 9px 8px;
  background: rgba(255, 253, 249, 0.055);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.summary__grid span,
.expense-summary span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.summary__grid strong,
.expense-summary strong {
  display: block;
  min-height: 1.28rem;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 0.88rem;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.56);
}

.verse-card {
  position: relative;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius);
}

.verse-card__label,
.verse-card__reference {
  margin: 0;
  color: var(--lavender);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.verse-card__label {
  color: var(--plum-700);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.02rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.1;
  text-transform: none;
}

.verse-card blockquote {
  margin: 8px 0 8px;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-family: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
  font-size: 1.18rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.22;
}

.verse-card__reference {
  color: var(--muted);
}

.ledger-card {
  position: relative;
  margin-top: 10px;
  padding: 8px;
  border-radius: var(--radius);
}

.records-button {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 26px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 74px;
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
  color: var(--plum-950);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.records-button::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0) 22%),
    radial-gradient(circle at 20% 20%, rgba(255, 213, 239, 0.22), transparent 34%);
  pointer-events: none;
  content: "";
}

.records-button::after {
  position: absolute;
  inset: auto 12px 9px 62px;
  height: 1px;
  background: linear-gradient(90deg, rgba(128, 100, 190, 0.4), rgba(203, 95, 154, 0));
  pointer-events: none;
  content: "";
}

.records-button:active {
  transform: translateY(1px);
}

.records-button:focus-visible {
  outline: 2px solid rgba(126, 92, 184, 0.5);
  outline-offset: 3px;
}

.records-button > span {
  position: relative;
  z-index: 1;
}

.records-button__text {
  min-width: 0;
}

.records-button__icon,
.records-button__arrow {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--plum-700);
}

.records-button__icon {
  width: 42px;
  background: linear-gradient(135deg, rgba(125, 95, 186, 0.26), rgba(203, 95, 154, 0.24));
  box-shadow: inset 0 0 0 1px rgba(82, 38, 82, 0.11);
}

.records-button__arrow {
  width: 26px;
  background: rgba(255, 255, 255, 0.09);
}

.records-button__icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.records-button__arrow svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.records-button small {
  display: block;
  margin-bottom: 2px;
  color: var(--lavender);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.records-button strong {
  display: block;
  overflow: hidden;
  font-family: "Parisienne", "Snell Roundhand", "Bradley Hand", cursive;
  font-size: 1.48rem;
  font-weight: 400;
  line-height: 1.08;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.58);
  white-space: nowrap;
}

.records-button__count {
  min-width: 34px;
  max-width: 62px;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid rgba(82, 38, 82, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--plum-850);
  font-size: 0.76rem;
  font-weight: 950;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 390px;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 10px calc(18px + env(safe-area-inset-bottom));
}

.records-hero {
  display: grid;
  gap: 10px;
  min-height: 186px;
  align-content: end;
  padding: 12px 8px 18px;
}

.back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: var(--plum-700);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.back-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.records-card {
  position: relative;
  padding: 12px;
  border-radius: var(--radius);
}

.records-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.records-summary > div {
  min-width: 0;
  padding: 9px 8px;
  background: rgba(255, 253, 249, 0.055);
}

.records-summary span,
.record-row span,
.record-month {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.records-summary strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 0.92rem;
  line-height: 1.08;
}

.records-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.record-month {
  margin: 8px 0 0;
  color: var(--lavender);
}

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(10px);
}

.record-row h2 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 0.94rem;
  line-height: 1.12;
}

.record-row strong {
  color: var(--plum-950);
  font-size: 0.96rem;
  white-space: nowrap;
}

.record-row__actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.record-undo-button {
  display: inline-grid;
  grid-template-columns: 15px auto;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: var(--plum-700);
  background: rgba(255, 251, 254, 0.12);
  box-shadow: 0 10px 24px rgba(45, 24, 48, 0.12);
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px) saturate(1.18);
  backdrop-filter: blur(12px) saturate(1.18);
}

.record-undo-button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.record-undo-button:active {
  transform: translateY(1px);
}

.fold {
  position: relative;
}

.fold + .fold {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(82, 38, 82, 0.1);
}

.fold__summary {
  display: grid;
  grid-template-columns: 1fr auto 18px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 4px 7px;
  color: var(--plum-950);
  cursor: pointer;
  list-style: none;
}

.fold__summary::-webkit-details-marker {
  display: none;
}

.fold__summary::after {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--plum-700);
  border-bottom: 2px solid var(--plum-700);
  content: "";
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 160ms ease;
}

.fold[open] > .fold__summary::after {
  transform: rotate(225deg);
}

.fold__summary small {
  display: block;
  margin-bottom: 2px;
  color: var(--lavender);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.fold__summary strong {
  display: block;
  font-family: "Parisienne", "Snell Roundhand", "Bradley Hand", cursive;
  font-size: 1.32rem;
  font-weight: 400;
  line-height: 1.12;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.58);
}

.fold__metric {
  min-width: 34px;
  max-width: 110px;
  overflow-wrap: anywhere;
  padding: 4px 8px;
  border: 1px solid rgba(82, 38, 82, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--plum-850);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: center;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(2, 38px);
  justify-content: end;
  gap: 7px;
  padding: 2px 0 8px;
}

.bill-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.bill-toolbar__actions {
  display: grid;
  grid-template-columns: repeat(2, 38px);
  gap: 7px;
}

.bill-range-toggle {
  max-width: 260px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.segment,
.icon-button,
.bill-action,
.preview-toggle,
.paid-toggle,
.expense-delete-button,
.add-expense-button,
.ghost-button,
.danger-button {
  cursor: pointer;
}

.segment,
.icon-button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  color: var(--plum-700);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 850;
}

.segment.is-active {
  color: #fff;
  background: linear-gradient(135deg, #7d5fba, #cb5f9a);
  box-shadow: 0 8px 18px rgba(121, 68, 132, 0.2);
}

.icon-button {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.icon-button svg,
.expense-delete-button svg,
.add-expense-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.bill-list {
  display: grid;
  gap: 8px;
  padding-bottom: 2px;
}

.bill-card {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 66px;
  padding: 10px;
  border-radius: var(--radius);
}

.bill-card.is-paid {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(238, 249, 238, 0.035)),
    rgba(248, 252, 245, 0.06);
}

.bill-card.is-late {
  border-color: rgba(155, 47, 87, 0.34);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 232, 242, 0.04)),
    rgba(255, 245, 249, 0.065);
}

.bill-card.is-previewed {
  border-color: rgba(203, 95, 154, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(238, 230, 255, 0.14)),
    rgba(255, 232, 246, 0.22);
  box-shadow:
    inset 0 0 0 2px rgba(203, 95, 154, 0.36),
    inset 5px 0 0 rgba(203, 95, 154, 0.72),
    0 0 0 2px rgba(255, 255, 255, 0.36),
    0 14px 34px rgba(78, 48, 111, 0.2);
}

.bill-card.is-previewed .bill-name,
.bill-card.is-previewed .bill-amount {
  color: #24112b;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.82);
}

.bill-card__top,
.bill-card__bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.bill-card__top {
  align-items: start;
}

.bill-card__bottom {
  align-items: center;
}

.bill-name {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.14;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.58);
}

.bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(82, 38, 82, 0.08);
  border-radius: 999px;
  background: rgba(253, 232, 244, 0.34);
  color: var(--plum-700);
  font-size: 0.69rem;
  font-weight: 850;
  line-height: 1.1;
}

.chip.is-late {
  background: rgba(255, 226, 237, 0.34);
  color: #8e264d;
}

.chip.is-soon {
  background: rgba(238, 230, 255, 0.36);
  color: #503887;
}

.chip.is-paid {
  background: rgba(231, 243, 232, 0.38);
  color: var(--sage);
}

.chip.is-previewed {
  border-color: rgba(203, 95, 154, 0.32);
  background: linear-gradient(135deg, rgba(128, 100, 190, 0.78), rgba(203, 95, 154, 0.72));
  color: #fff;
  box-shadow: 0 5px 12px rgba(78, 48, 111, 0.18);
}

.bill-amount {
  color: var(--plum-950);
  font-size: 0.98rem;
  font-weight: 950;
  white-space: nowrap;
  line-height: 1.12;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.58);
}

.bill-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.paid-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: rgba(245, 231, 244, 0.11);
  color: var(--lavender);
  box-shadow: inset 0 0 0 1px rgba(82, 38, 82, 0.14);
}

.paid-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.bill-card.is-paid .paid-toggle {
  background: rgba(223, 240, 225, 0.15);
  color: var(--sage);
}

.bill-action,
.preview-toggle,
.expense-delete-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 246, 252, 0.075);
  color: var(--plum-700);
  box-shadow: inset 0 0 0 1px rgba(82, 38, 82, 0.12);
}

.preview-toggle {
  color: #503887;
}

.preview-toggle.is-active {
  background: linear-gradient(135deg, #8064be, #cb5f9a);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 7px 16px rgba(78, 48, 111, 0.24);
}

.bill-payment-link {
  text-decoration: none;
}

.bill-action svg,
.preview-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.bill-action .pay-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.expense-summary {
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
}

.expense-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  grid-template-areas:
    "name delete"
    "amount delete";
  align-items: center;
  gap: 6px;
  min-height: 66px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(10px);
}

.expense-row input,
.bill-sheet__panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(82, 38, 82, 0.14);
  border-radius: 6px;
  color: var(--plum-950);
  background: rgba(255, 253, 249, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.expense-row input {
  min-height: 32px;
  padding: 6px 7px;
  font-size: 0.82rem;
  font-weight: 850;
}

.expense-name-input {
  grid-area: name;
  color: var(--plum-950);
}

.expense-amount-input {
  grid-area: amount;
  width: min(130px, 100%);
  text-align: left;
}

.expense-row input:focus,
.bill-sheet__panel input:focus {
  outline: 2px solid rgba(128, 100, 190, 0.34);
  outline-offset: 1px;
}

.expense-delete-button {
  grid-area: delete;
  width: 30px;
  background: rgba(255, 246, 252, 0.07);
}

.expense-delete-button svg {
  width: 15px;
  height: 15px;
}

.add-expense-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--plum-700);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.78rem;
  font-weight: 900;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(12px);
}

.add-expense-button svg {
  width: 17px;
  height: 17px;
}

.funds-widget {
  position: fixed;
  top: calc(88px + env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 9;
  display: grid;
  justify-items: end;
  width: min(274px, calc(100vw - 20px));
  pointer-events: none;
}

.funds-widget > * {
  pointer-events: auto;
}

.funds-widget.is-open {
  position: fixed;
  top: calc(88px + env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  pointer-events: auto;
}

.funds-button,
.funds-close {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: var(--plum-700);
  cursor: pointer;
}

.funds-button {
  grid-template-columns: 26px auto;
  gap: 6px;
  min-width: 46px;
  min-height: 46px;
  padding: 0 11px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 245, 252, 0.03)),
    rgba(255, 251, 254, 0.13);
  box-shadow: 0 14px 34px rgba(45, 24, 48, 0.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
}

.funds-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.funds-button span {
  max-width: 96px;
  overflow: hidden;
  color: var(--plum-950);
  font-size: 0.78rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funds-widget.is-open .funds-button {
  display: none;
}

.funds-panel {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(45, 24, 48, 0.2);
}

.funds-widget.is-collapsed .funds-panel {
  display: none;
}

.funds-panel__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: start;
  gap: 8px;
}

.funds-panel__top span,
.funds-field span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.funds-panel__top strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 1.28rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.62);
}

.funds-panel__top strong.is-negative {
  color: #8e264d;
}

.funds-close {
  width: 32px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 246, 252, 0.075);
  box-shadow: inset 0 0 0 1px rgba(82, 38, 82, 0.12);
}

.funds-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.funds-field {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.funds-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid rgba(82, 38, 82, 0.14);
  border-radius: 6px;
  color: var(--plum-950);
  background: rgba(255, 253, 249, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  font-weight: 900;
}

.empty-state {
  padding: 18px 14px;
  border-style: dashed;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100% - 28px), 390px);
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
  background: rgba(45, 24, 48, 0.9);
  color: #fff;
  font-weight: 850;
  text-align: center;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.reset-sheet,
.paid-sheet,
.payment-sheet,
.bill-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(45, 24, 48, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.reset-sheet.is-open,
.paid-sheet.is-open,
.payment-sheet.is-open,
.bill-sheet.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.reset-sheet__panel,
.bill-sheet__panel {
  width: min(100%, 402px);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(45, 24, 48, 0.24);
}

.reset-sheet__panel h2,
.bill-sheet__panel h2 {
  margin: 0 0 8px;
  color: var(--plum-950);
  font-size: 1.12rem;
}

.reset-sheet__panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.paid-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.paid-preview > div {
  min-width: 0;
  padding: 9px 7px;
  background: rgba(255, 253, 249, 0.075);
}

.paid-preview span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.paid-preview strong {
  display: block;
  min-height: 1.18rem;
  overflow-wrap: anywhere;
  color: var(--plum-950);
  font-size: 0.82rem;
  line-height: 1.08;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.56);
}

.paid-preview strong.is-negative {
  color: #8e264d;
}

.bill-sheet__panel {
  display: grid;
  gap: 11px;
}

.bill-sheet__panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.bill-sheet__panel input {
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 800;
}

.reset-sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: 6px;
  font-weight: 900;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--plum-700);
  background: rgba(255, 253, 249, 0.22);
}

.danger-button {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #7d5fba, #cb5f9a);
}

@media (min-width: 700px) {
  body {
    padding: 28px 0;
  }

  .app-shell {
    min-height: calc(100svh - 56px);
    border: 1px solid rgba(255, 255, 255, 0.56);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 247, 251, 0.05);
    box-shadow: 0 30px 80px rgba(45, 24, 48, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .hero {
    margin-inline: -10px;
  }

  .records-shell {
    min-height: calc(100svh - 56px);
    border: 1px solid rgba(255, 255, 255, 0.56);
    border-radius: 22px;
    background: rgba(255, 247, 251, 0.05);
    box-shadow: 0 30px 80px rgba(45, 24, 48, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .funds-widget {
    top: 112px;
    right: calc(50% - 195px - 72px);
    width: 260px;
  }

  .funds-widget.is-open {
    top: 112px;
    right: calc(50% - 195px - 72px);
  }
}

@media (max-width: 370px) {
  .summary__amount {
    font-size: 1.66rem;
  }

  h1 {
    font-size: 2.24rem;
  }

  .summary__grid {
    grid-template-columns: 1fr;
  }

  .funds-widget {
    top: calc(76px + env(safe-area-inset-top));
    width: min(260px, calc(100vw - 20px));
  }

  .funds-button span {
    max-width: 78px;
  }

  .segment {
    font-size: 0.76rem;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .summary,
  .verse-card,
  .ledger-card,
  .records-button,
  .records-card,
  .bill-card,
  .expense-row,
  .record-row,
  .funds-panel,
  .reset-sheet__panel,
  .bill-sheet__panel {
    background: rgba(255, 251, 254, 0.8);
  }
}
