:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --line: #e9e9eb;
  --text: #2f3040;
  --muted: #7f838c;
  --green: #17b890;
  --green-dark: #0f8d72;
  --orange: #ee6e00;
  --purple: #7e3fc2;
  --navy: #102437;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f5f7;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.mobile-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.phone-screen {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--surface);
  position: relative;
  padding-bottom: 98px;
}

.flash {
  margin: 0 auto;
  max-width: 430px;
  padding: 10px 18px;
  font-size: 14px;
}

.flash.notice { background: #dbf5ec; }
.flash.alert { background: #ffe0e0; }

.mobile-topbar,
.detail-topbar,
.expense-entry-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.detail-topbar h1,
.expense-entry-topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.detail-topbar-actions {
  display: flex;
  gap: 12px;
}

.icon-button,
.circle-button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.circle-button.white {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.icon-button.compact {
  width: 34px;
  height: 34px;
}

.top-action-link,
.save-link {
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 700;
  background: none;
  border: 0;
}

.settled-summary {
  padding: 62px 20px 12px;
}

.settled-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settled-heading-row h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 750;
}

.section-kicker {
  margin: 104px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.accent-link {
  color: var(--green-dark);
}

.muted-dot {
  color: #a6abb3;
}

.groups-mobile-list {
  padding: 14px 20px 0;
}

.group-list-item-mobile {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.group-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  position: relative;
  overflow: hidden;
}

.group-avatar::before,
.group-avatar::after {
  content: "";
  position: absolute;
  inset: auto;
  opacity: 0.28;
}

.group-avatar::before {
  width: 58px;
  height: 24px;
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(-24deg);
  top: 10px;
  right: -6px;
}

.group-avatar::after {
  width: 80px;
  height: 28px;
  background: rgba(0, 0, 0, 0.18);
  transform: rotate(28deg);
  bottom: 2px;
  left: -18px;
}

.group-avatar-mark {
  position: relative;
  z-index: 1;
}

.color-0 { background: linear-gradient(160deg, #a40040, #db6ca6); }
.color-1 { background: linear-gradient(160deg, #94082d, #b91d5d); }
.color-2 { background: linear-gradient(160deg, #1cc8a0, #bcefe4); }
.color-3 { background: linear-gradient(160deg, #0e9f7d, #baf4e6); }
.color-4 { background: linear-gradient(160deg, #f76500, #ff9200); }
.color-5 { background: linear-gradient(160deg, #138a71, #8bf0d0); }

.group-list-copy h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.settled-pill-text {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.cta-stack {
  padding: 22px 20px 0;
}

.outline-cta {
  height: 64px;
  border: 2px solid #33a58d;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 700;
}

.floating-cta {
  position: fixed;
  right: max(20px, calc((100vw - 430px) / 2 + 20px));
  bottom: 88px;
  min-width: 174px;
  height: 72px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 14px 32px rgba(23, 184, 144, 0.28);
  font-size: 22px;
  font-weight: 700;
}

.floating-cta.attached-bottom {
  bottom: 88px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  width: min(430px, 100%);
  background: #fff;
  border-top: 1px solid #dbdde2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px 10px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: #535866;
  position: relative;
}

.bottom-nav-item.active {
  color: var(--green-dark);
}

.bottom-nav-item.active::before {
  content: "";
  position: absolute;
  top: -9px;
  width: 64px;
  height: 5px;
  border-radius: 999px;
  background: var(--green-dark);
}

.group-hero {
  min-height: 286px;
  color: #fff;
  padding: 24px 20px 42px;
  position: relative;
  overflow: hidden;
}

.group-hero::before,
.group-hero::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(18deg);
}

.group-hero::before {
  width: 240px;
  height: 120px;
  top: 10px;
  right: -40px;
}

.group-hero::after {
  width: 190px;
  height: 96px;
  top: 84px;
  left: 120px;
}

.group-hero-actions {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.group-hero h1 {
  position: relative;
  z-index: 1;
  margin: 38px 0 18px;
  font-size: 64px;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.member-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 20px;
  background: rgba(40, 18, 28, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 18px;
  font-weight: 650;
}

.group-summary-card {
  background: #fff;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  margin-top: -8px;
  padding: 24px 0 0;
}

.celebrate-line {
  margin: 0;
  padding: 0 20px;
  font-size: 24px;
  font-weight: 650;
}

.pill-tabs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 22px 20px 12px;
}

.pill-tab {
  flex: 0 0 auto;
  min-width: 110px;
  height: 54px;
  padding: 0 18px;
  border: 2px solid #d9d9dd;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.timeline-section {
  padding: 18px 20px 10px;
}

.month-label {
  margin: 14px 0 20px;
  font-size: 18px;
  font-weight: 800;
}

.expense-row-mobile {
  display: grid;
  grid-template-columns: 54px 54px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 10px 0 18px;
}

.date-stack {
  color: #7c8088;
  font-size: 17px;
  line-height: 1.05;
  text-align: center;
}

.date-stack strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  font-weight: 500;
}

.expense-icon-box,
.square-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #e2e4e9;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  background: #fff;
  display: grid;
  place-items: center;
}

.expense-main-copy h3 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.expense-main-copy p {
  margin: 0;
  font-size: 18px;
  color: #7d838d;
}

.expense-amount-side {
  text-align: right;
  font-weight: 700;
  line-height: 1.1;
}

.expense-amount-side span {
  display: block;
  font-size: 14px;
  text-transform: lowercase;
}

.expense-amount-side strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.expense-amount-side.positive {
  color: var(--green-dark);
}

.expense-amount-side.negative {
  color: var(--orange);
}

.expense-form-screen {
  background: #fff;
}

.with-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.group-chip-large {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  border: 1px solid #dddfe4;
  border-radius: 999px;
  color: #2f3040;
  background: #fff;
  font-size: 18px;
}

.expense-native-form {
  min-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.expense-entry-core {
  padding: 92px 32px 0;
}

.entry-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 34px;
}

.money-row {
  margin-bottom: 42px;
}

.square-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.currency-box span {
  font-size: 28px;
  font-weight: 700;
}

.line-input-block {
  border-bottom: 3px solid var(--green);
  padding-bottom: 8px;
}

.money-row .line-input-block {
  border-bottom-color: #44454f;
}

.line-input {
  width: 100%;
  border: 0;
  outline: none;
  font-size: 30px;
  color: #cbd4e0;
  background: transparent;
}

.amount-input {
  font-size: 44px;
  letter-spacing: -0.03em;
}

.paid-split-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 18px;
  font-weight: 700;
}

.inline-select-box {
  min-width: 88px;
  height: 52px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #dddfe4;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 18px;
  color: #44454f;
}

.inline-native-select {
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  outline: none;
}

.expense-entry-footer {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.footer-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.footer-icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: inherit;
}

.footer-icon-button.purple { color: #a466d5; }
.footer-icon-button.teal { color: var(--green); }

.detail-topbar {
  padding-top: 18px;
}

.expense-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 14px;
  padding: 18px 20px 26px;
  border-bottom: 1px solid var(--line);
}

.expense-detail-main {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 18px;
}

.expense-detail-icon {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  border: 1px solid #e1e3e7;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
}

.expense-detail-copy h2 {
  margin: 6px 0 14px;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.expense-detail-copy p,
.expense-label {
  margin: 0 0 6px;
  font-size: 18px;
  color: #777e88;
}

.expense-label {
  font-size: 28px;
  color: var(--text);
}

.receipt-placeholder {
  border: 2px dashed #c9ccd3;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #a8aab0;
  min-height: 126px;
}

.split-breakdown,
.chart-card,
.comments-panel {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.payer-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
}

.avatar-circle {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(145deg, #163d59, #0b1722 60%, #2f78a5);
}

.avatar-circle.small {
  width: 34px;
  height: 34px;
}

.avatar-circle.alt-0 {
  background: linear-gradient(145deg, #ff2f00, #ffcdbb);
}

.avatar-circle.alt-1 {
  background: linear-gradient(145deg, #163d59, #0b1722 60%, #2f78a5);
}

.payer-copy h3 {
  margin: 0 0 18px;
  font-size: 22px;
}

.owes-stack {
  position: relative;
  margin-left: 8px;
  padding-left: 24px;
}

.owes-stack::before {
  content: "";
  position: absolute;
  left: 0;
  top: -22px;
  bottom: 20px;
  width: 2px;
  background: #e2e3e7;
}

.share-person-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.share-person-row p {
  margin: 0;
  font-size: 18px;
  color: #6d7380;
}

.chart-card h3,
.comments-panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.chart-placeholder {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.chart-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: #757b86;
}

.bar {
  height: 28px;
  background: #ececf2;
  border: 1px solid #d8d9df;
}

.bar.filled {
  width: 100%;
}

.bar.empty {
  width: 4px;
}

.bar.empty.tiny {
  width: 2px;
}

.chart-button {
  margin: 0 auto;
  height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #60259f, #8a44d2);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(57, 24, 94, 0.55);
}

.notes-box {
  border: 1px solid #dfe1e5;
  border-radius: 12px;
  min-height: 180px;
  padding: 14px;
  font-size: 18px;
  line-height: 1.5;
}

.comment-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  margin-top: 18px;
}

.comment-input-row input {
  height: 58px;
  border-radius: 28px;
  border: 2px solid #d8dbe2;
  padding: 0 18px;
  font-size: 18px;
}

.send-button {
  border: 0;
  background: transparent;
  color: #b7bbc4;
  font-size: 30px;
}

.mini-icon,
.bottom-icon,
.footer-icon,
.icon-search,
.icon-sliders,
.icon-chevron-left,
.icon-gear,
.icon-trash,
.icon-pencil,
.icon-camera,
.icon-close,
.gem-icon {
  display: inline-block;
  position: relative;
}

.mini-icon.receipt,
.mini-icon.people,
.bottom-icon.groups,
.footer-icon.people-orange {
  width: 24px;
  height: 24px;
}

.mini-icon.receipt::before,
.mini-icon.receipt::after {
  content: "";
  position: absolute;
}

.mini-icon.receipt::before {
  inset: 2px 5px 3px;
  border: 3px solid currentColor;
  border-bottom-width: 2px;
  border-radius: 2px;
}

.mini-icon.receipt::after {
  left: 9px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.mini-icon.people::before,
.mini-icon.people::after,
.bottom-icon.groups::before,
.bottom-icon.groups::after,
.footer-icon.people-orange::before,
.footer-icon.people-orange::after {
  content: "";
  position: absolute;
  border: 3px solid currentColor;
  border-radius: 999px;
}

.mini-icon.people::before,
.bottom-icon.groups::before,
.footer-icon.people-orange::before {
  width: 8px;
  height: 8px;
  top: 1px;
  left: 3px;
}

.mini-icon.people::after,
.bottom-icon.groups::after,
.footer-icon.people-orange::after {
  width: 10px;
  height: 10px;
  top: 8px;
  left: 9px;
  border-top-color: transparent;
}

.mini-icon.inverted,
.mini-icon.white {
  color: #fff;
}

.mini-icon.dark,
.icon-search,
.icon-sliders,
.icon-chevron-left,
.icon-gear,
.icon-trash,
.icon-pencil,
.icon-close {
  color: #3e404c;
}

.bottom-icon.person,
.bottom-icon.activity,
.bottom-icon.account,
.footer-icon.calendar {
  width: 24px;
  height: 24px;
}

.bottom-icon.person::before {
  content: "";
  position: absolute;
  inset: 2px 7px 11px;
  border: 3px solid currentColor;
  border-radius: 999px;
}

.bottom-icon.person::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  height: 9px;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 10px 10px 12px 12px;
}

.bottom-icon.activity::before,
.bottom-icon.activity::after {
  content: "";
  position: absolute;
}

.bottom-icon.activity::before {
  inset: 2px;
  border: 3px solid currentColor;
  border-radius: 4px;
}

.bottom-icon.activity::after {
  left: 6px;
  right: 6px;
  top: 11px;
  height: 0;
  border-top: 3px solid currentColor;
  transform: skewX(-24deg);
}

.bottom-icon.account {
  border-radius: 999px;
  background: linear-gradient(145deg, #153a56, #0b1722 60%, #2f7aa6);
}

.footer-icon.calendar::before,
.footer-icon.calendar::after {
  content: "";
  position: absolute;
}

.footer-icon.calendar::before {
  inset: 4px 2px 2px;
  border: 2px solid #2f6f8d;
  border-radius: 3px;
}

.footer-icon.calendar::after {
  left: 5px;
  right: 5px;
  top: 8px;
  border-top: 2px solid #2f6f8d;
}

.footer-icon.people-orange {
  color: #ff7e3d;
}

.icon-search {
  width: 30px;
  height: 30px;
}

.icon-search::before,
.icon-search::after {
  content: "";
  position: absolute;
}

.icon-search::before {
  width: 16px;
  height: 16px;
  border: 3px solid currentColor;
  border-radius: 999px;
  left: 2px;
  top: 2px;
}

.icon-search::after {
  width: 12px;
  height: 3px;
  background: currentColor;
  transform: rotate(45deg);
  right: 1px;
  bottom: 4px;
}

.icon-sliders {
  width: 28px;
  height: 28px;
}

.icon-sliders::before,
.icon-sliders::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  top: 6px;
  box-shadow: 0 8px 0 currentColor, 0 16px 0 currentColor;
}

.icon-sliders::after {
  width: 8px;
  height: 8px;
  background: #fff;
  border: 3px solid currentColor;
  border-radius: 999px;
  top: 1px;
  left: 15px;
  box-shadow: -11px 8px 0 -1px #fff, -11px 8px 0 2px currentColor, 4px 16px 0 -1px #fff, 4px 16px 0 2px currentColor;
}

.icon-chevron-left,
.icon-close {
  width: 22px;
  height: 22px;
}

.icon-chevron-left::before,
.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
}

.icon-chevron-left::before {
  inset: 4px 7px 4px 4px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  transform: rotate(45deg);
}

.icon-close::before,
.icon-close::after {
  left: 10px;
  top: 2px;
  bottom: 2px;
  width: 4px;
  background: currentColor;
  border-radius: 4px;
}

.icon-close::before { transform: rotate(45deg); }
.icon-close::after { transform: rotate(-45deg); }

.icon-gear,
.icon-trash,
.icon-pencil,
.icon-camera {
  width: 24px;
  height: 24px;
}

.icon-gear::before {
  content: "⚙";
  position: absolute;
  inset: 0;
  font-size: 24px;
  line-height: 1;
}

.icon-trash::before {
  content: "🗑";
  position: absolute;
  inset: 0;
  font-size: 24px;
  line-height: 1;
}

.icon-pencil::before {
  content: "✎";
  position: absolute;
  inset: 0;
  font-size: 24px;
  line-height: 1;
}

.icon-camera::before {
  content: "📷";
  position: absolute;
  inset: 0;
  font-size: 24px;
  line-height: 1;
}

.gem-icon {
  width: 22px;
  height: 22px;
  background: linear-gradient(145deg, #e5ccff, #8e51db);
  clip-path: polygon(50% 0%, 100% 28%, 78% 100%, 22% 100%, 0% 28%);
}

@media (min-width: 431px) {
  .bottom-nav,
  .floating-cta {
    right: calc((100vw - 430px) / 2 + 20px);
  }
}
