:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #edf2f0;
  --text: #18201f;
  --text-soft: #64706d;
  --text-faint: #8e9996;
  --border: #dde5e2;
  --brand: #59caae;
  --brand-dark: #257e69;
  --brand-soft: #dff7f0;
  --blue: #6698f0;
  --blue-soft: #e6efff;
  --coral: #ed826f;
  --coral-soft: #ffebe7;
  --violet: #9a87e8;
  --violet-soft: #eeeaff;
  --warning: #c88929;
  --danger: #c64d4d;
  --shadow-sm: 0 8px 26px rgba(30, 51, 45, .06);
  --shadow-md: 0 22px 60px rgba(29, 50, 44, .11);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 28px;
  --sidebar: #111720;
  --sidebar-text: #aeb8b8;
  --sidebar-active: #71dcc0;
  --sidebar-line: rgba(255, 255, 255, .08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131b;
  --surface: #151c25;
  --surface-2: #1a222c;
  --surface-3: #212b36;
  --text: #ecf3f1;
  --text-soft: #9ba9a7;
  --text-faint: #73817f;
  --border: #29343e;
  --brand: #6bddbd;
  --brand-dark: #8ce8cf;
  --brand-soft: #173c34;
  --blue-soft: #1c304d;
  --coral-soft: #432622;
  --violet-soft: #31294b;
  --shadow-sm: 0 8px 26px rgba(0, 0, 0, .16);
  --shadow-md: 0 24px 70px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

img,
svg {
  display: block;
}

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

.positive {
  color: var(--brand-dark) !important;
}

.negative,
.overdue {
  color: var(--coral) !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 780;
  letter-spacing: -.04em;
}

.brand__mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: #0f1820;
  background: linear-gradient(135deg, #78e6c9, #72a6f5);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(90, 208, 178, .2);
}

.brand__mark svg {
  width: 25px;
  height: 25px;
}

.brand__mark path:first-child {
  fill: none;
}

.brand__mark path:last-child {
  fill: currentColor;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  line-height: 1;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

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

.button:focus-visible,
.theme-toggle:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}

.button--primary {
  color: #10201c;
  background: linear-gradient(135deg, #77e4c7, #61cdb0);
  box-shadow: 0 10px 26px rgba(72, 188, 157, .2);
}

.button--primary:hover {
  box-shadow: 0 13px 32px rgba(72, 188, 157, .28);
}

.button--secondary,
.button--quiet {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.button--secondary:hover,
.button--quiet:hover {
  border-color: var(--brand);
}

.button--quiet {
  background: transparent;
}

.button--small {
  min-height: 38px;
  padding-inline: 15px;
}

.button--large {
  min-height: 54px;
  padding-inline: 24px;
  border-radius: 15px;
}

.button--large svg {
  width: 22px;
  height: 22px;
  padding: 3px;
  background: #fff;
  border-radius: 50%;
}

.button--full {
  width: 100%;
}

.button.is-disabled {
  opacity: .7;
}

.theme-toggle,
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.theme-toggle:hover,
.icon-button:hover {
  color: var(--text);
  border-color: var(--brand);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.eyebrow > span {
  width: 24px;
  height: 2px;
  background: var(--brand);
  border-radius: 9px;
}

.eyebrow--small {
  margin-bottom: 8px;
  font-size: 11px;
}

.notice {
  display: flex;
  max-width: 820px;
  align-items: center;
  gap: 11px;
  margin: 0 0 22px;
  padding: 13px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.notice__dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--blue);
  border-radius: 50%;
}

.notice--success .notice__dot { background: var(--brand); }
.notice--warning .notice__dot { background: var(--warning); }
.notice--error .notice__dot { background: var(--danger); }

.notice__close {
  margin-left: auto;
  padding: 2px 6px;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  font-size: 22px;
}

/* Landing */
.landing-page {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 13% 10%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 28%),
    radial-gradient(circle at 87% 48%, color-mix(in srgb, var(--blue) 11%, transparent), transparent 32%),
    var(--bg);
}

.landing {
  width: min(1400px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(22px, 5vw, 72px);
}

.landing-nav {
  display: flex;
  height: 84px;
  align-items: center;
  justify-content: space-between;
}

.landing-nav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero {
  display: grid;
  min-height: 660px;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
  grid-template-columns: minmax(0, .92fr) minmax(460px, 1.08fr);
  padding: 38px 0 60px;
}

.hero__copy {
  position: relative;
  z-index: 2;
  max-width: 610px;
}

.hero h1 {
  margin: 24px 0 24px;
  font-size: clamp(48px, 5.3vw, 80px);
  font-weight: 770;
  letter-spacing: -.065em;
  line-height: .99;
}

.hero h1 em {
  color: var(--brand-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.hero__copy > p {
  max-width: 560px;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 34px;
}

.hero__hint {
  color: var(--text-faint);
  font-size: 12px;
}

.hero__visual {
  position: relative;
  min-height: 560px;
}

.glow {
  position: absolute;
  filter: blur(1px);
  border-radius: 999px;
}

.glow--one {
  top: 3%;
  right: 4%;
  width: 82%;
  height: 82%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, transparent), color-mix(in srgb, var(--blue) 17%, transparent));
  transform: rotate(-9deg);
}

.glow--two {
  right: 22%;
  bottom: 4%;
  width: 48%;
  height: 42%;
  background: color-mix(in srgb, var(--violet) 15%, transparent);
  filter: blur(40px);
}

.preview-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, 94%);
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 28px;
  box-shadow: 0 34px 90px rgba(20, 42, 37, .19);
  transform: translate(-50%, -50%) rotate(1.7deg);
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .preview-card {
  box-shadow: 0 34px 90px rgba(0, 0, 0, .45);
}

.preview-card__top {
  display: grid;
  align-items: center;
  padding: 3px 2px 15px;
  grid-template-columns: 1fr auto 1fr;
}

.preview-card__top > span:first-child {
  display: flex;
  gap: 5px;
}

.preview-card__top i {
  width: 7px;
  height: 7px;
  background: var(--border);
  border-radius: 50%;
}

.preview-card__top strong {
  font-size: 12px;
}

.preview-avatar {
  display: grid;
  width: 27px;
  height: 27px;
  margin-left: auto;
  place-items: center;
  color: #143129;
  background: var(--brand);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.preview-balance {
  position: relative;
  overflow: hidden;
  padding: 28px;
  color: #eafff9;
  background: linear-gradient(135deg, #15262a, #1c3a3c);
  border-radius: 20px;
}

.preview-balance::after {
  position: absolute;
  top: -70px;
  right: -30px;
  width: 220px;
  height: 220px;
  content: "";
  background: radial-gradient(circle, rgba(99, 226, 191, .28), transparent 67%);
}

.preview-balance small,
.preview-balance span {
  display: block;
  color: #a8c5bd;
  font-size: 11px;
}

.preview-balance strong {
  display: block;
  margin: 4px 0 3px;
  color: #77e4c6;
  font-size: 30px;
  letter-spacing: -.04em;
}

.preview-stats {
  display: grid;
  gap: 10px;
  margin: 10px 0;
  grid-template-columns: 1fr 1fr;
}

.preview-stats > div {
  display: grid;
  align-items: center;
  gap: 1px 10px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 15px;
  grid-template-columns: auto 1fr;
}

.preview-stats .mini-icon {
  grid-row: span 2;
}

.preview-stats small,
.preview-row small {
  display: block;
  color: var(--text-faint);
  font-size: 10px;
}

.preview-stats strong {
  font-size: 15px;
}

.mini-icon {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  border-radius: 10px;
}

.mini-icon--mint { color: var(--brand-dark); background: var(--brand-soft); }
.mini-icon--coral { color: var(--coral); background: var(--coral-soft); }

.preview-list {
  padding: 14px 15px 8px;
  background: var(--surface-2);
  border-radius: 16px;
}

.preview-list__heading,
.preview-row {
  display: flex;
  align-items: center;
}

.preview-list__heading {
  justify-content: space-between;
  padding-bottom: 9px;
  font-size: 10px;
}

.preview-list__heading span {
  color: var(--brand-dark);
}

.preview-row {
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.preview-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.amount {
  margin-left: auto;
  font-weight: 800;
}

.amount--positive { color: var(--brand-dark); }
.amount--negative { color: var(--coral); }

.trust-strip {
  display: grid;
  gap: 1px;
  margin: 0 0 40px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.trust-strip > div {
  display: grid;
  align-items: center;
  gap: 1px 12px;
  padding: 22px 26px;
  background: var(--surface);
  grid-template-columns: auto 1fr;
}

.trust-strip > div > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 50%;
  grid-row: span 2;
}

.trust-strip small {
  color: var(--text-soft);
}

.landing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 32px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.landing-footer a:hover {
  color: var(--text);
}

/* Application shell */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 256px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 256px;
  flex-direction: column;
  padding: 30px 20px 22px;
  color: #f3f7f6;
  background:
    radial-gradient(circle at 20% 5%, rgba(105, 220, 188, .09), transparent 27%),
    var(--sidebar);
}

.sidebar > .brand {
  padding: 0 10px 34px;
}

.primary-nav {
  display: grid;
  gap: 5px;
}

.primary-nav a,
.export-link {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  color: var(--sidebar-text);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
  transition: .18s ease;
}

.primary-nav a:hover,
.export-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .05);
}

.primary-nav a.active {
  color: #10221d;
  background: linear-gradient(135deg, #75dfc2, #62c8ac);
  box-shadow: 0 8px 20px rgba(59, 175, 145, .18);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-size: 19px;
  font-weight: 400;
}

.sidebar__bottom {
  margin-top: auto;
}

.export-link {
  margin-bottom: 13px;
}

.profile-card {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 2px;
  border-top: 1px solid var(--sidebar-line);
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.profile-card img,
.avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.profile-card img {
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #11312a;
  background: var(--brand);
  font-weight: 800;
}

.profile-card__meta {
  min-width: 0;
}

.profile-card__meta strong,
.profile-card__meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card__meta strong {
  font-size: 12px;
}

.profile-card__meta small {
  color: #7e8d8b;
  font-size: 9px;
}

.profile-card .icon-button {
  width: 31px;
  height: 31px;
  color: #8e9a99;
  background: transparent;
  border-color: transparent;
}

.app-main {
  min-width: 0;
  grid-column: 2;
}

.content {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 42px clamp(28px, 4vw, 62px) 70px;
}

.mobile-header,
.bottom-nav {
  display: none;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(32px, 3vw, 44px);
  letter-spacing: -.05em;
  line-height: 1.08;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.page-header--compact {
  align-items: center;
  margin-bottom: 25px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.back-link:hover {
  color: var(--brand-dark);
}

.balance-hero {
  position: relative;
  display: flex;
  min-height: 190px;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  padding: 34px 42px;
  color: #e9faf5;
  background:
    radial-gradient(circle at 80% 30%, rgba(99, 222, 189, .22), transparent 25%),
    linear-gradient(125deg, #142127, #173436);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.balance-hero__label {
  display: block;
  color: #a7bdb8;
  font-size: 13px;
}

.balance-hero strong {
  display: block;
  margin: 3px 0 1px;
  color: #79e5c8 !important;
  font-size: clamp(40px, 5vw, 62px);
  letter-spacing: -.055em;
}

.balance-hero small {
  color: #94aaa5;
}

.balance-hero__orb {
  position: relative;
  width: 145px;
  height: 110px;
}

.balance-hero__orb span {
  position: absolute;
  border: 1px solid rgba(126, 230, 201, .28);
  border-radius: 50%;
}

.balance-hero__orb span:nth-child(1) { inset: 0 20px 0 15px; }
.balance-hero__orb span:nth-child(2) { inset: 15px 0 18px 40px; }
.balance-hero__orb span:nth-child(3) { inset: 32px 35px 32px 0; background: rgba(110, 220, 191, .08); }

.stat-grid {
  display: grid;
  gap: 16px;
  margin: 18px 0 42px;
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-card__icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  font-size: 20px;
}

.stat-card--mint .stat-card__icon { color: var(--brand-dark); background: var(--brand-soft); }
.stat-card--coral .stat-card__icon { color: var(--coral); background: var(--coral-soft); }
.stat-card--violet .stat-card__icon { color: var(--violet); background: var(--violet-soft); }

.stat-card span,
.stat-card small {
  display: block;
  color: var(--text-soft);
}

.stat-card span { font-size: 12px; }
.stat-card small { margin-top: 1px; font-size: 10px; }
.stat-card strong { display: block; font-size: 22px; letter-spacing: -.03em; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -.035em;
}

.section-heading--small {
  align-items: center;
  margin-bottom: 20px;
}

.section-heading--small h2 {
  font-size: 18px;
}

.section-heading--small > span:not(.status) {
  color: var(--text-soft);
  font-size: 12px;
}

.text-link {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.debt-cards {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.debt-card {
  display: grid;
  min-height: 78px;
  align-items: center;
  gap: 13px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  transition: background .16s ease;
}

.debt-card:last-child {
  border-bottom: 0;
}

.debt-card:hover {
  background: var(--surface-2);
}

.person {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 800;
}

.person--blue { color: #416da9; background: var(--blue-soft); }
.person--violet { color: #7661bf; background: var(--violet-soft); }
.person--orange { color: #bb604e; background: var(--coral-soft); }

.debt-card__main strong,
.debt-card__main small,
.debt-card__meta strong,
.debt-card__meta small {
  display: block;
}

.debt-card__main small,
.debt-card__meta small {
  color: var(--text-soft);
  font-size: 11px;
}

.debt-card__meta {
  text-align: right;
}

.debt-card__meta strong {
  font-size: 15px;
}

.chevron {
  color: var(--text-faint);
  font-size: 24px;
}

.empty-state,
.error-state {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 38px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state__icon,
.error-state > span {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 20px;
  font-size: 25px;
}

.empty-state h3,
.error-state h1 {
  margin: 18px 0 5px;
  font-size: 23px;
}

.empty-state p,
.error-state p {
  max-width: 470px;
  margin: 0 0 22px;
  color: var(--text-soft);
}

/* List and filters */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar select,
.action-card select {
  min-height: 44px;
  padding: 0 36px 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.search-field {
  display: flex;
  min-width: 230px;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.search-field span {
  color: var(--text-soft);
  font-size: 21px;
}

.search-field input {
  width: 100%;
  min-height: 42px;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.filter-reset {
  padding: 0 7px;
  color: var(--text-soft);
  font-size: 12px;
}

.list-summary {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 12px;
}

.records-table {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.records-table__head,
.records-table__row {
  display: grid;
  align-items: center;
  gap: 18px;
  grid-template-columns: minmax(240px, 1.5fr) .7fr .65fr .8fr 20px;
}

.records-table__head {
  min-height: 46px;
  padding: 0 19px;
  color: var(--text-faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.records-table__row {
  min-height: 78px;
  padding: 10px 19px;
  border-bottom: 1px solid var(--border);
  transition: background .16s ease;
}

.records-table__row:last-child {
  border-bottom: 0;
}

.records-table__row:hover {
  background: var(--surface-2);
}

.record-person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.record-person strong,
.record-person small,
.record-amount small {
  display: block;
}

.record-person small,
.record-amount small {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-amount {
  font-weight: 750;
  text-align: right;
}

.status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.status--open { color: #9c6b1f; background: #fff2d8; }
.status--partial { color: #5d5ca8; background: var(--violet-soft); }
.status--paid { color: var(--brand-dark); background: var(--brand-soft); }
.status--cancelled { color: var(--text-soft); background: var(--surface-3); }

:root[data-theme="dark"] .status--open {
  color: #e4b96c;
  background: #3c2f19;
}

/* Forms */
.form-card {
  max-width: 940px;
  padding: clamp(22px, 4vw, 38px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.form-card fieldset {
  margin: 0;
  padding: 0 0 32px;
  border: 0;
}

.form-card fieldset + fieldset {
  padding-top: 29px;
  border-top: 1px solid var(--border);
}

.form-card legend {
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 760;
}

.direction-picker {
  display: grid;
  gap: 13px;
  grid-template-columns: 1fr 1fr;
}

.direction-picker label {
  cursor: pointer;
}

.direction-picker input {
  position: absolute;
  opacity: 0;
}

.direction-option {
  display: grid;
  min-height: 104px;
  align-content: center;
  gap: 1px 14px;
  padding: 18px;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 15px;
  grid-template-columns: auto 1fr;
  transition: .18s ease;
}

.direction-option i {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 13px;
  font-style: normal;
  font-size: 20px;
  grid-row: span 2;
}

.direction-option small {
  color: var(--text-soft);
  font-size: 12px;
}

.direction-option--mint i { color: var(--brand-dark); background: var(--brand-soft); }
.direction-option--coral i { color: var(--coral); background: var(--coral-soft); }

.direction-picker input:checked + .direction-option--mint {
  background: color-mix(in srgb, var(--brand-soft) 42%, var(--surface));
  border-color: var(--brand);
}

.direction-picker input:checked + .direction-option--coral {
  background: color-mix(in srgb, var(--coral-soft) 42%, var(--surface));
  border-color: var(--coral);
}

.field-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.field-grid--three {
  grid-template-columns: repeat(3, 1fr);
}

.field--wide {
  grid-column: 1 / -1;
}

.field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 680;
}

.field em {
  color: var(--coral);
  font-style: normal;
}

.field small {
  color: var(--text-faint);
  font-weight: 500;
}

.field input,
.field textarea,
.money-input,
.action-card select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.field input {
  min-height: 45px;
  padding: 0 13px;
}

.field textarea {
  min-height: 105px;
  padding: 12px 13px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.filter-bar select:focus,
.action-card select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
  outline: 0;
}

.money-input {
  display: flex;
  align-items: center;
}

.money-input input {
  background: transparent;
  border: 0;
  box-shadow: none !important;
}

.money-input i {
  padding-right: 13px;
  color: var(--text-soft);
  font-style: normal;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 25px;
  border-top: 1px solid var(--border);
}

/* Detail */
.detail-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--text-soft);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  align-items: start;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.detail-main,
.detail-side {
  display: grid;
  gap: 18px;
}

.amount-panel {
  display: flex;
  min-height: 175px;
  align-items: center;
  justify-content: space-between;
  padding: 30px 34px;
  border-radius: var(--radius-lg);
}

.amount-panel--mint {
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--blue-soft) 55%, var(--surface)));
}

.amount-panel--coral {
  background: linear-gradient(135deg, var(--coral-soft), color-mix(in srgb, var(--violet-soft) 45%, var(--surface)));
}

.amount-panel > div:first-child span,
.amount-panel > div:first-child small {
  display: block;
  color: var(--text-soft);
}

.amount-panel > div:first-child strong {
  display: block;
  margin: 2px 0;
  font-size: clamp(38px, 5vw, 55px);
  letter-spacing: -.05em;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  place-items: center;
}

.progress-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 4;
}

.progress-ring__track {
  stroke: color-mix(in srgb, var(--text) 10%, transparent);
}

.progress-ring__value {
  stroke: var(--brand);
  stroke-linecap: round;
}

.amount-panel--coral .progress-ring__value {
  stroke: var(--coral);
}

.progress-ring > span {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.progress-ring small {
  display: block;
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 500;
}

.info-card,
.action-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
  grid-template-columns: 1fr 1fr;
}

.detail-list > div {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.detail-list > div:nth-child(odd) {
  padding-right: 18px;
}

.detail-list__wide {
  grid-column: 1 / -1;
}

.detail-list dt {
  color: var(--text-soft);
  font-size: 10px;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 3px 0 0;
  font-weight: 660;
  white-space: pre-wrap;
}

.payment-list > div {
  display: grid;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.payment-list__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 11px;
}

.payment-list strong,
.payment-list small {
  display: block;
}

.payment-list small,
.payment-list time {
  color: var(--text-soft);
  font-size: 11px;
}

.inline-empty {
  padding: 25px;
  color: var(--text-soft);
  text-align: center;
  background: var(--surface-2);
  border-radius: 12px;
}

.action-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 15px;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 14px;
  font-weight: 800;
}

.action-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.action-card > p {
  margin: 0 0 20px;
  color: var(--text-soft);
  font-size: 12px;
}

.action-card .field {
  display: block;
  margin-bottom: 13px;
}

.action-card--subtle form {
  display: grid;
  gap: 10px;
}

.danger-zone {
  text-align: center;
}

.danger-zone button {
  color: var(--danger);
  background: transparent;
  border: 0;
  font-size: 12px;
}

/* Legal and errors */
.legal-shell {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
}

.legal-content {
  margin: 45px 0 80px;
  padding: clamp(26px, 5vw, 55px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.legal-content h1 {
  margin: 0;
  font-size: 45px;
  letter-spacing: -.05em;
}

.legal-content .lead {
  color: var(--text-soft);
  font-size: 18px;
}

.legal-content h2 {
  margin: 32px 0 6px;
  font-size: 18px;
}

.legal-content p {
  color: var(--text-soft);
}

.error-state--public {
  width: min(680px, calc(100% - 40px));
  min-height: 500px;
  margin: 8vh auto;
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(400px, .9fr);
  }

  .hero h1 {
    font-size: clamp(44px, 5.5vw, 66px);
  }

  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    width: 220px;
  }

  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 285px;
  }

  .records-table__head,
  .records-table__row {
    grid-template-columns: minmax(190px, 1.4fr) .65fr .65fr .8fr 16px;
    gap: 12px;
  }
}

@media (max-width: 840px) {
  .landing {
    padding-inline: 24px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 70px;
    text-align: center;
  }

  .hero__copy {
    max-width: 700px;
    margin: 0 auto;
  }

  .hero__copy > p {
    margin-inline: auto;
  }

  .hero__actions,
  .hero .eyebrow {
    justify-content: center;
  }

  .hero__visual {
    min-height: 520px;
  }

  .trust-strip {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .app-main {
    display: block;
  }

  .mobile-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    height: 68px;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
  }

  .brand--compact {
    font-size: 18px;
  }

  .brand--compact .brand__mark {
    width: 31px;
    height: 31px;
  }

  .mobile-header .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .bottom-nav {
    position: fixed;
    z-index: 40;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 14px;
    display: grid;
    height: 64px;
    padding: 5px;
    background: color-mix(in srgb, var(--sidebar) 94%, transparent);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 20px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .25);
    grid-template-columns: repeat(3, 1fr);
    backdrop-filter: blur(18px);
  }

  .bottom-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #82908e;
    border-radius: 15px;
  }

  .bottom-nav a.active {
    color: var(--sidebar-active);
    background: rgba(255, 255, 255, .06);
  }

  .bottom-nav span {
    font-size: 20px;
    line-height: 1;
  }

  .bottom-nav small {
    margin-top: 3px;
    font-size: 9px;
  }

  .content {
    padding: 28px 22px 110px;
  }

  .desktop-only {
    display: none;
  }

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

  .detail-side {
    grid-template-columns: 1fr 1fr;
  }

  .danger-zone {
    grid-column: 1 / -1;
  }

  .records-table__head {
    display: none;
  }

  .records-table__row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    padding: 15px;
  }

  .records-table__row > span:nth-child(2),
  .records-table__row > span:nth-child(3) {
    display: none;
  }

  .record-person {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .record-amount {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .records-table__row > .chevron {
    display: none;
  }
}

@media (max-width: 620px) {
  .landing-nav {
    height: 72px;
  }

  .landing-nav .button {
    display: none;
  }

  .hero {
    gap: 24px;
    padding: 48px 0 20px;
  }

  .hero h1 {
    margin-block: 20px;
    font-size: clamp(40px, 12.5vw, 58px);
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero__visual {
    min-height: 410px;
  }

  .preview-card {
    width: 106%;
    padding: 12px;
    transform: translate(-50%, -50%) rotate(0);
  }

  .preview-balance {
    padding: 20px;
  }

  .preview-stats {
    grid-template-columns: 1fr 1fr;
  }

  .preview-row:last-child {
    display: none;
  }

  .trust-strip {
    margin-top: 30px;
  }

  .landing-footer {
    gap: 10px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .page-header__actions,
  .page-header__actions .button {
    width: 100%;
  }

  .page-header h1 {
    font-size: 34px;
  }

  .balance-hero {
    min-height: 170px;
    padding: 25px;
  }

  .balance-hero__orb {
    position: absolute;
    right: -25px;
    opacity: .6;
  }

  .balance-hero strong {
    position: relative;
    z-index: 1;
    font-size: 42px;
  }

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

  .stat-card {
    padding: 16px;
  }

  .debt-card {
    gap: 10px;
    padding: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .debt-card__meta small {
    display: none;
  }

  .debt-card > .chevron {
    display: none;
  }

  .person {
    width: 38px;
    height: 38px;
  }

  .filter-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-field {
    min-width: 100%;
  }

  .filter-bar label:not(.search-field) {
    min-width: calc(50% - 5px);
    flex: 1;
  }

  .filter-bar select {
    width: 100%;
  }

  .filter-bar .button {
    width: 100%;
  }

  .direction-picker,
  .field-grid,
  .field-grid--three {
    grid-template-columns: 1fr;
  }

  .amount-panel {
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
  }

  .progress-ring {
    width: 82px;
    height: 82px;
  }

  .progress-ring > span {
    font-size: 16px;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .detail-list > div:nth-child(odd) {
    padding-right: 0;
  }

  .detail-side {
    grid-template-columns: 1fr;
  }

  .danger-zone {
    grid-column: auto;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
