@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --teal: #0F6E56;
  --teal-light: #E4F3EC;
  --teal-mid: #1D9E75;
  --coral: #E2603A;
  --coral-light: #FBEAE3;
  --sand: #FAF6EF;
  --ink: #1C2620;
  --slate: #5B6B63;
  --line: #E4E0D6;
  --white: #FFFFFF;
  --danger: #C0392B;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--sand);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#app {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--white);
  box-shadow: 0 0 40px rgba(28, 38, 32, 0.06);
  display: flex;
  flex-direction: column;
}

#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(250, 246, 239, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#loading-overlay[hidden] { display: none; }
.spinner {
  width: 38px; height: 38px;
  border: 4px solid var(--teal-light);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spinner-spin 0.7s linear infinite;
}
@keyframes spinner-spin { to { transform: rotate(360deg); } }

/* iPad / tablet portrait: the card gets room to breathe instead of
   sitting like a stranded phone screen in the middle of the page */
@media (min-width: 700px) {
  #app { max-width: 600px; }
  .bottom-nav { max-width: 600px; }
  .view { padding: 4px 40px 100px; }
  .topbar { padding: 24px 40px 14px; }
  .actions-row { gap: 16px; margin-bottom: 28px; }
  .action-btn .icon { width: 52px; height: 52px; font-size: 22px; }
  .balance-card { padding: 30px 32px; }
  .balance-card .amount { font-size: 40px; }
  .auth-mascot { width: 108px; height: 108px; }
}

/* iPad landscape / larger tablets */
@media (min-width: 1024px) {
  #app { max-width: 680px; }
  .bottom-nav { max-width: 680px; }
}

/* header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}
.brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: url('mascot.svg') center / cover no-repeat;
  display: inline-block;
  flex-shrink: 0;
}

.auth-topbar {
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
.auth-topbar .brand::before { display: none; }
.auth-mascot {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(15, 110, 86, 0.28);
}
.user-switcher select {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--white);
  color: var(--ink);
}

/* views */
.view { padding: 4px 20px 100px; flex: 1; }
.view[hidden] { display: none; }

/* balance card -- the one place we allow a gradient: a soft horizon
   where teal meets a warmer undertone, echoing "paradise" without
   tipping into kitsch */
.balance-card {
  background: linear-gradient(135deg, var(--teal) 0%, #0B5645 100%);
  color: var(--white);
  border-radius: 20px;
  padding: 24px 22px;
  margin: 8px 0 20px;
}
.balance-card .label { font-size: 13px; opacity: 0.85; margin: 0; }
.balance-card .amount { font-size: 34px; margin: 8px 0 10px; }
.balance-card .trend {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
}

/* quick actions */
.actions-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.action-btn {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
}
.action-btn .icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.action-btn span { font-size: 11px; color: var(--slate); }

/* section headers */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 10px;
}

/* transaction rows */
.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tx-left { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: var(--teal-light); color: var(--teal);
  flex-shrink: 0;
}
.tx-name { font-size: 14px; margin: 0; }
.tx-sub { font-size: 12px; color: var(--slate); margin: 0; }
.tx-amount { font-size: 14px; font-weight: 500; }
.tx-amount.in { color: var(--teal); }
.tx-amount.out { color: var(--danger); }

/* favorites row */
.favorites-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding-bottom: 4px;
}
.favorite {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; flex-shrink: 0; background: none; border: none;
  font-family: 'Inter', sans-serif;
}
.favorite .avatar { width: 52px; height: 52px; font-size: 14px; }
.favorite span { font-size: 11px; color: var(--ink); }
.favorite.add .avatar {
  background: none; border: 1.5px dashed var(--line); color: var(--slate);
}

/* forms */
label { font-size: 13px; color: var(--slate); display: block; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=email], input[type=password], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 16px;
  background: var(--white);
}
input:focus, select:focus { outline: none; border-color: var(--teal); }

.amount-display {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.amount-display .to { font-size: 13px; color: var(--slate); margin: 0 0 6px; }
.amount-display .value { font-size: 36px; }

.fee-line {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--slate); margin-bottom: 6px;
}
.fee-line.total {
  font-weight: 600; color: var(--ink);
  padding-top: 8px; border-top: 1px solid var(--line); margin-bottom: 20px;
}

.btn-primary {
  width: 100%;
  background: var(--teal);
  color: var(--white);
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.coral { background: var(--coral); }
.btn-secondary {
  width: 100%;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 10px;
}

#stripe-card-element {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
  background: var(--white);
}

.banner {
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.banner.warn { background: var(--coral-light); color: #8A3A20; }
.banner.info { background: var(--teal-light); color: var(--teal); }

.status-msg { font-size: 13px; text-align: center; margin-top: 12px; color: var(--slate); }
.status-msg.error { color: var(--danger); }
.status-msg.success { color: var(--teal); }

/* bottom nav */
.bottom-nav {
  position: sticky;
  bottom: 0;
  max-width: 420px;
  background: var(--white);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 12px 0 16px;
}
.nav-btn {
  border: none; background: none; cursor: pointer;
  font-size: 20px; color: var(--slate);
  padding: 4px 16px;
}
.nav-btn.active { color: var(--teal); }

.back-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 8px;
  cursor: pointer;
}
.back-row span { font-size: 16px; font-weight: 500; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--slate); font-size: 14px; }
