:root {
  color-scheme: light;
  --blue: #1769e0;
  --blue-dark: #0d4fac;
  --blue-soft: #eaf2ff;
  --ink: #172033;
  --muted: #687386;
  --line: #e5eaf1;
  --surface: #ffffff;
  --bg: #f5f7fb;
  --green: #16875d;
  --amber: #b66a00;
  --red: #c43d4d;
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
#app { max-width: 600px; min-height: 100vh; margin: 0 auto; padding-bottom: 92px; }
.center-card { min-height: 85vh; display: grid; place-content: center; text-align: center; padding: 24px; }
.logo {
  width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px;
  display: grid; place-content: center; background: var(--blue); color: white;
  font-size: 32px; font-weight: 800; box-shadow: 0 12px 30px #1769e044;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 26px; margin-bottom: 4px; }
h2 { font-size: 20px; margin-bottom: 14px; }
h3 { font-size: 16px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.topbar {
  position: sticky; top: 0; z-index: 5; padding: 16px 18px 12px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px);
}
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { font-size: 12px; padding: 6px 9px; border-radius: 999px; background: #e8f7f1; color: var(--green); }
.content { padding: 6px 16px 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: 0 5px 20px rgba(31, 45, 70, .04);
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 10px; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-content: center; background: var(--blue-soft); color: var(--blue); font-weight: 750;
}
.person-meta { min-width: 0; }
.person-meta strong, .person-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-weight: 760; white-space: nowrap; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.field { display: grid; gap: 6px; }
label { color: var(--muted); font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%; border: 1px solid #dbe1ea; border-radius: 13px; background: white;
  padding: 12px 13px; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #1769e01a; }
.btn {
  border: 0; border-radius: 14px; min-height: 46px; padding: 11px 15px;
  font-weight: 720; background: var(--blue); color: white;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { color: var(--blue); background: var(--blue-soft); }
.btn.ghost { color: var(--ink); background: #f0f3f7; }
.btn.danger { color: var(--red); background: #fff0f2; }
.btn.small-btn { min-height: 36px; padding: 8px 11px; font-size: 13px; }
.btn.full { width: 100%; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.primary-dock {
  position: sticky; bottom: 78px; z-index: 4; padding: 8px 16px;
  background: linear-gradient(transparent, var(--bg) 36%);
}
.nav {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: 0;
  width: min(600px, 100%); height: 74px; padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr); background: white; border-top: 1px solid var(--line);
}
.nav button { border: 0; background: transparent; color: var(--muted); font-size: 11px; display: grid; gap: 3px; place-content: center; }
.nav button span { font-size: 20px; line-height: 1; }
.nav button.active { color: var(--blue); font-weight: 700; }
.pill { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }
.pill.pending { color: var(--amber); background: #fff4df; }
.pill.sender_marked { color: var(--blue); background: var(--blue-soft); }
.pill.confirmed { color: var(--green); background: #e8f7f1; }
.transfer-arrow { color: var(--muted); padding: 0 4px; }
.summary-total { font-size: 34px; font-weight: 820; letter-spacing: -1px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.invite-preview {
  position: relative; min-height: 190px; overflow: hidden; border-radius: 18px; padding: 18px;
  display: flex; align-items: end; color: white; background: linear-gradient(145deg, #1769e0, #0d3e87);
  background-size: cover; background-position: center;
}
.invite-preview::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 20, 42, .06), rgba(8, 20, 42, .86));
}
.invite-preview-content { position: relative; z-index: 1; width: 100%; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.invite-preview h2 { margin: 0 0 6px; font-size: 24px; }
.invite-details { display: grid; gap: 4px; font-size: 14px; }
.image-picker {
  display: grid; place-items: center; min-height: 120px; padding: 14px; text-align: center;
  border: 1px dashed #b8c6da; border-radius: 16px; background: #f7f9fc; color: var(--muted);
}
.image-picker input { padding: 8px; background: transparent; border: 0; }
.modal-backdrop {
  position: fixed; z-index: 30; inset: 0; background: rgba(20, 29, 45, .42);
  display: grid; align-items: end; padding: 12px;
}
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow: auto; margin: 0 auto;
  background: white; border-radius: 24px; padding: 18px;
}
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); background: #172033; color: white; padding: 11px 15px;
  border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.join-list { display: grid; gap: 9px; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
@media (min-width: 700px) {
  body { padding: 28px 0; }
  #app { min-height: calc(100vh - 56px); border-radius: 28px; overflow: hidden; box-shadow: 0 20px 80px #26334a24; }
  .nav { bottom: 28px; border-radius: 0 0 28px 28px; }
}
