:root {
  --ink: #0D0B14;
  --muted: #5B5668;
  --line: #E6E3EC;
  --bg: #FFFFFF;
  --pink: #FF3D8B;
  --pink-ink: #D6006A;
  --gold: #F2C14E;
  --gold-ink: #8F6400;
  --gold-bg: #FFF6DC;
  --cyan: #3FD0FF;
  --cyan-ink: #007FA8;
  --cyan-dot: #0091BE;
  --danger: #C4002B;
  --display: Unbounded, system-ui, sans-serif;
  --text: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

#app {
  position: relative;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}

.screen {
  position: relative;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.spacer { flex: 1 1 auto; }

.stripes { position: absolute; top: 0; left: 0; width: 100%; height: 260px; pointer-events: none; }

.topbar { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.brand { font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: .18em; color: var(--pink-ink); }
.icon-btn {
  width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 22px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 0;
}

.card { position: relative; background: var(--bg); border: 2px solid var(--ink); border-radius: 24px; }
.total-card { padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 10px; margin-top: 40px; }
.pill {
  position: relative; align-self: flex-start; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--pink-ink);
  border: 1.5px solid var(--pink); background: transparent; border-radius: 999px; padding: 10px 16px; min-height: 44px;
  display: flex; align-items: center; gap: 6px;
}
.pill input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.big { font-family: var(--display); font-size: 50px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; }
.bar { display: flex; height: 4px; gap: 3px; }
.bar > div { border-radius: 2px; min-width: 6px; }
.sub { font-size: 14px; color: var(--muted); }

.rows { padding: 6px 20px; display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; font-size: 15px; gap: 12px; }
.row + .row { border-top: 1px solid var(--line); }
.row .name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.row .note { font-size: 12px; color: var(--muted); font-weight: 400; }
.dia { width: 12px; height: 12px; transform: rotate(45deg); flex: none; }

.sync { position: relative; display: flex; flex-direction: column; gap: 8px; }
.sync-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.warn {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--gold-ink);
  border: 1px solid var(--gold); background: var(--gold-bg); border-radius: 14px; padding: 10px 12px;
}
.warn .dot { background: var(--gold); margin-top: 5px; }

.cta {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--pink); color: var(--ink); border: 0; text-decoration: none;
  font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: .1em; border-radius: 18px; min-height: 60px;
}
.cta:disabled { background: #FFC2DA; color: var(--muted); cursor: default; }
.cta:active:not(:disabled) { transform: translateY(1px); }

/* Add cash */
.head3 { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px; }
.head3 .title { font-family: var(--display); font-size: 13px; font-weight: 800; letter-spacing: .16em; color: var(--pink-ink); }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; font-size: 15px; justify-self: start; }
.amount-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 2px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.amount { font-family: var(--display); font-size: 58px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.amount .caret { color: var(--pink-ink); font-weight: 400; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.amount-wrap .bar { width: 120px; }

.fields { border-radius: 18px; display: flex; flex-direction: column; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 52px; font-size: 15px; }
.field + .field { border-top: 1px solid var(--line); }
.field span { color: var(--muted); }
.field input { border: 0; text-align: right; background: transparent; width: 190px; min-height: 44px; font-size: 16px; }
.field input:focus { outline: none; }
.field:focus-within { box-shadow: inset 3px 0 0 var(--cyan); }

.recent { display: flex; flex-direction: column; gap: 2px; }
.recent .label { font-size: 11px; padding: 4px 4px 2px; }
.recent-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 4px; min-height: 36px; gap: 8px; }
.recent-row .left { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row .right { display: flex; align-items: center; gap: 12px; flex: none; }
.who { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--cyan-ink); border: 1px solid var(--cyan); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.edit-btn { font-size: 13px; color: var(--cyan-ink); border: 0; background: transparent; min-height: 36px; min-width: 36px; padding: 0; }
.empty { font-size: 13px; color: var(--muted); padding: 4px; }

.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key {
  font-family: var(--display); font-size: 22px; font-weight: 600; background: var(--bg); border-radius: 14px; min-height: 52px;
  display: flex; align-items: center; justify-content: center; border: 2px solid;
}
.key:active { transform: translateY(1px); }
.k1 { border-color: var(--pink); color: var(--pink-ink); }
.k2 { border-color: var(--cyan); color: var(--cyan-ink); }
.k3 { border-color: var(--gold); color: var(--gold-ink); }

.danger-btn { background: none; border: 2px solid var(--danger); color: var(--danger); border-radius: 18px; min-height: 48px; font-weight: 600; }
.danger-btn.armed { background: var(--danger); color: #fff; }

/* Login */
.login-form { position: relative; display: flex; flex-direction: column; gap: 16px; margin-top: 120px; }
.login-form h1 { font-family: var(--display); font-size: 28px; font-weight: 800; margin: 0; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

/* Menu sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(13, 11, 20, .35); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 430px; background: var(--bg); border-top: 2px solid var(--ink); border-radius: 24px 24px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 12px; }
.sheet .who-line { color: var(--muted); font-size: 14px; }
.sheet button { min-height: 52px; border-radius: 16px; border: 2px solid var(--ink); background: var(--bg); font-weight: 600; font-size: 15px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 20;
  box-shadow: 0 6px 20px rgba(13, 11, 20, .25);
}

.loading { padding: 40px 20px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .amount .caret { animation: none; } }
@media (min-width: 700px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
