:root {
  --bg: #f5efe6;
  --surface: #ffffff;
  --surface-soft: #fbf7f1;
  --ink: #1f2933;
  --muted: #697586;
  --line: #e7ded2;

  --blue: #16324f;
  --blue-soft: #e7f0f8;

  --green: #2f5d50;
  --green-soft: #e9f3ee;

  --terracotta: #b9634a;
  --terracotta-soft: #f7e8e2;

  --gold: #c89c48;
  --gold-soft: #faefd8;

  --danger: #b44949;
  --danger-soft: #fae7e7;

  --shadow: 0 16px 40px rgba(43, 35, 26, 0.12);
  --shadow-soft: 0 8px 24px rgba(43, 35, 26, 0.08);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(185, 99, 74, 0.18), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(47, 93, 80, 0.14), transparent 26rem),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px 16px 96px;
  position: relative;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--terracotta);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(2rem, 9vw, 2.65rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  color: var(--blue);
}

h2 {
  margin-bottom: 14px;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.subtle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--blue);
  box-shadow: var(--shadow-soft);
  font-size: 1.25rem;
}

.screen {
  animation: fadeIn 160ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(231, 222, 210, 0.8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.summary-card {
  padding: 22px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.summary-card::after {
  content: "";
  width: 130px;
  height: 130px;
  position: absolute;
  right: -36px;
  top: -38px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(22, 50, 79, 0.12), rgba(185, 99, 74, 0.14));
}

.summary-label {
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-amount {
  margin-bottom: 4px;
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.065em;
  color: var(--blue);
}

.summary-caption {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.people-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.person-card {
  padding: 16px;
  border-radius: var(--radius-lg);
}

.person-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
}

.avatar.alec {
  background: var(--blue-soft);
  color: var(--blue);
}

.avatar.shinwon {
  background: var(--terracotta-soft);
  color: var(--terracotta);
}

.person-name {
  margin: 0;
  font-weight: 850;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 0.9rem;
}

.stat-label {
  color: var(--muted);
}

.stat-value {
  font-weight: 850;
}

.balance-card {
  padding: 22px;
  margin-bottom: 24px;
  border-radius: var(--radius-xl);
  color: white;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(135deg, var(--green), #183d38);
  box-shadow: var(--shadow);
  text-align: center;
}

.balance-card p {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 750;
}

.balance-card strong {
  display: block;
  font-size: 2.45rem;
  line-height: 1;
  letter-spacing: -0.055em;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 12px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 800;
}

.expense-list {
  display: grid;
  gap: 10px;
}

.expense-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
}

.expense-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1.25rem;
}

.expense-title {
  margin: 0 0 3px;
  font-weight: 850;
}

.expense-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.expense-right {
  text-align: right;
}

.expense-amount {
  margin: 0 0 6px;
  font-weight: 900;
  color: var(--blue);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.chip.food {
  background: var(--terracotta-soft);
  color: var(--terracotta);
}

.chip.transport {
  background: var(--green-soft);
  color: var(--green);
}

.chip.personal {
  background: var(--gold-soft);
  color: #8b6724;
}

.chip.lodging {
  background: var(--blue-soft);
  color: var(--blue);
}

.form-card {
  padding: 18px;
  margin-bottom: 14px;
}

.amount-card {
  padding: 22px;
  margin-bottom: 14px;
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.amount-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--blue);
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.currency-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  background: var(--surface-soft);
  color: var(--blue);
  font-weight: 900;
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(22, 50, 79, 0.45);
  box-shadow: 0 0 0 4px rgba(22, 50, 79, 0.08);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.segmented,
.option-grid {
  display: grid;
  gap: 10px;
}

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

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

.choice-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.choice-button.selected {
  border-color: rgba(22, 50, 79, 0.45);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(22, 50, 79, 0.08);
}

.choice-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.form-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.danger-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  font-weight: 900;
}

.primary-button {
  background: var(--blue);
  color: white;
  box-shadow: var(--shadow-soft);
}

.secondary-button {
  background: var(--surface);
  color: var(--blue);
  border: 1px solid var(--line);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  padding: 26px 18px;
  text-align: center;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 16px;
}

.settle-breakdown {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.breakdown-row span:first-child {
  color: var(--muted);
  font-weight: 750;
}

.breakdown-row span:last-child {
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 20;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 440px);
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 750;
  animation: toastIn 180ms ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 10;
  width: min(calc(100% - 24px), 456px);
  height: 72px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr 74px 1fr;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(231, 222, 210, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.nav-item {
  height: 54px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 0.72rem;
  font-weight: 850;
}

.nav-icon {
  display: block;
  font-size: 1.1rem;
  line-height: 1;
}

.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.nav-add {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-size: 2rem;
  line-height: 1;
  font-weight: 400;
  box-shadow: 0 12px 28px rgba(22, 50, 79, 0.28);
}

.nav-add.active {
  background: var(--terracotta);
}

.utility-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.small-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--blue);
  padding: 8px 11px;
  font-size: 0.78rem;
  font-weight: 850;
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 36px;
  }

  body {
    display: grid;
    place-items: start center;
  }
}