/* ============ Monzo Clone — base.css (tokens + shared components) ============ */

:root {
  /* Backgrounds — navy-teal, never neutral grey or pure black */
  --color-bg:               #0A1B24;
  --color-bg-glow:          radial-gradient(120% 60% at 50% -5%, #14333d 0%, #0A1B24 55%);
  --color-surface:          #12242F;
  --color-surface-raised:   #1B3340;
  --color-surface-subtle:   #162A36;

  --color-border:           #24404E;
  --color-border-focus:     #47B7E8;

  --color-text:             #F2F7F9;
  --color-text-muted:       #8CA6B3;
  --color-text-inverse:     #FFFFFF;
  --color-text-subtle:      #5F7A88;

  --color-primary:          #2F9FD0;
  --color-primary-hover:    #3FB2E4;
  --color-primary-active:   #2789B5;
  --color-primary-fg:       #FFFFFF;
  --color-accent:           #FF4F40;
  --color-accent-deep:      #E8402F;

  --color-error:            #F0564A;
  --color-success:          #46C56E;
  --color-warning:          #F5A623;

  --color-flex-card:        #20343E;
  --color-nationwide:       #121D57;
  --color-coral-btn:        rgba(0,0,0,0.28);
  --color-nav-active-bg:    #16303C;
  --color-link:             #47A8DA;

  --cat-bills:         #2E9BC6;
  --cat-shopping:      #E86BAF;
  --cat-groceries:     #F5A623;
  --cat-transport:     #1F7F96;
  --cat-entertainment: #6FD8B2;
  --cat-eating-out:    #F0564A;
  --cat-transfers:     #8CA6B3;
  --cat-savings:       #46C56E;
  --cat-general:       #5F7A88;
  --cat-holidays:      #9B7BE8;

  --font-display: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Plus Jakarta Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, monospace;

  --text-xs: 12px;   --text-sm: 13.5px; --text-base: 15.5px; --text-lg: 17px;
  --text-xl: 20px;   --text-2xl: 24px;  --text-3xl: 34px;    --text-4xl: 44px;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 28px;
  --radius-full: 9999px;
  --radius-squircle: 34%;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
}

/* ---------- Reset & shell ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: #000;
  font-family: var(--font-body);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; }
a { color: var(--color-link); text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; }
::selection { background: rgba(47,159,208,0.4); }

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--color-bg);
  position: relative;
  overflow-x: hidden;
}

.screen {
  padding: 0 16px calc(88px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  animation: screen-in 150ms ease-out;
}
.screen--detail { padding-bottom: 32px; animation: detail-in 220ms cubic-bezier(.2,.8,.3,1); }
.screen--glow { background: var(--color-bg-glow); margin: 0 -16px; padding-left: 32px; padding-right: 32px; }

@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes detail-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-border-focus); outline-offset: 2px; }

/* ---------- Amount pattern ---------- */
.amount { font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount .cur, .amount .dec { font-size: 0.62em; vertical-align: 0.28em; font-weight: 700; }
.amount .cur { margin-right: 1px; }
.amount--pos { color: var(--color-success); }
.amount--muted { color: var(--color-text-muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
}
.card__header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--text-lg); font-weight: 700; margin-bottom: 10px;
}
.card__header-actions { display: flex; gap: 14px; color: var(--color-link); }
.card__header-actions svg { width: 22px; height: 22px; }
.card__link { display: inline-block; color: var(--color-link); font-weight: 600; font-size: var(--text-base); padding: 10px 0 2px; }

/* ---------- List rows ---------- */
.rows { display: block; }
.row {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 14px;
  align-items: center; padding: 13px 0; width: 100%; text-align: left; color: inherit;
}
.rows > * + * .row, .rows > .row + .row { border-top: 1px solid transparent; }
.rows > * + * { position: relative; }
.rows > * + *::before {
  content: ""; position: absolute; top: 0; left: 56px; right: 0; height: 1px;
  background: var(--color-border);
}
.row--noicon { grid-template-columns: 1fr auto; }
.rows--noicon > * + *::before { left: 0; }
.row__title { font-size: var(--text-base); font-weight: 600; line-height: 1.3; }
.row__sub { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: 2px; line-height: 1.3; }
.row__sub--error { color: var(--color-error); }
.row__sub--success { color: var(--color-success); }
.row__right { text-align: right; }
.row__amount { font-size: 19px; }
.row__note { display: block; font-size: 12.5px; margin-top: 2px; }
.row__note--success { color: var(--color-success); }

/* Raised sub-tile (first upcoming activity row) */
.row-tile {
  background: var(--color-surface-raised);
  border-radius: var(--radius-md);
  padding: 3px 12px;
  margin-bottom: 6px;
}
.row-tile .row { padding: 10px 0; }

/* ---------- Squircle icons ---------- */
.sq {
  width: 42px; height: 42px; border-radius: var(--radius-squircle);
  display: grid; place-items: center; font-size: 20px; position: relative;
  flex: none; overflow: visible;
}
.sq--white { background: #fff; color: #333; font-weight: 700; font-size: 11px; }
.sq--img img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.sq svg { width: 22px; height: 22px; color: #fff; }
.sq--tile { border-radius: 12px; background: var(--color-primary); }
.sq--lg { width: 64px; height: 64px; font-size: 32px; }
.sq--lg.sq--tile { border-radius: 16px; }
.sq__badge {
  position: absolute; right: -7px; bottom: -7px;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--color-accent); display: grid; place-items: center;
}
.sq__badge svg { width: 13px; height: 13px; color: #fff; }
.sq__badge--squiggle { background: transparent; }
.sq__badge--squiggle svg { width: 22px; height: 22px; color: var(--color-accent); }

/* ---------- Pills ---------- */
.pill {
  height: 44px; border-radius: var(--radius-full); padding: 0 20px;
  font-weight: 700; font-size: var(--text-base);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.pill:active { transform: scale(0.96); }
.pill svg { width: 18px; height: 18px; }
.pill--blue { background: var(--color-primary); color: var(--color-primary-fg); }
.pill--blue:hover { background: var(--color-primary-hover); }
.pill--dark { background: var(--color-surface-raised); color: var(--color-text); }
.pill--dark.pill--linktext { color: var(--color-link); }
.pill--oncoral { background: var(--color-coral-btn); color: #fff; }
.pill--lg { height: 52px; width: 100%; font-size: 16.5px; }
.pill--icon { width: 44px; padding: 0; }

/* ---------- Icon buttons (top bars) ---------- */
.iconbtn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-surface-raised);
  display: grid; place-items: center; color: var(--color-text);
  flex: none;
}
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn--ghost { background: rgba(255,255,255,0.08); }

/* ---------- Top bars ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 12px; min-height: 56px;
}
.topbar__spacer { flex: 1; }
.detailbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0 10px; min-height: 56px;
}
.detailbar__title { font-size: 22px; font-weight: 700; flex: 1; }
.detailbar__title .sub { display: block; font-size: 15px; font-weight: 500; color: var(--color-text-muted); margin-top: 1px; }

/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #0d1f28; border: 2px solid #9adcf0;
  display: grid; place-items: center;
  font-family: 'Snell Roundhand', 'Segoe Script', cursive;
  font-size: 15px; color: #fff; font-weight: 700; flex: none;
  text-transform: capitalize;
  overflow: hidden;
}

/* ---------- Segmented control ---------- */
.seg { display: flex; background: var(--color-surface); border-radius: var(--radius-full); padding: 4px; margin-bottom: 12px; }
.seg__opt {
  flex: 1; height: 42px; border-radius: var(--radius-full);
  display: grid; place-items: center; font-weight: 700; font-size: var(--text-base);
  color: var(--color-text-muted);
}
.seg__opt.active { background: var(--color-nav-active-bg); color: var(--color-text); }
.seg--light .seg__opt.active { background: #E8F1F5; color: #0A1B24; }

/* ---------- Chip tabs (Trends) ---------- */
.chips { display: flex; gap: 6px; padding: 4px 0 14px; }
.chip {
  height: 40px; padding: 0 14px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: var(--text-base); color: var(--color-text-muted);
  white-space: nowrap;
}
.chip svg { width: 17px; height: 17px; }
.chip.active { background: var(--color-surface-raised); color: var(--color-text); }
.chip--filter { background: var(--color-surface-raised); color: var(--color-link); font-weight: 600; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: calc(64px + env(safe-area-inset-bottom));
  background: rgba(7,20,27,0.92);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(4px + env(safe-area-inset-bottom));
  z-index: 50;
}
.tabbar.hidden { display: none; }
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12.5px; font-weight: 600; color: var(--color-text-muted);
}
.tabbar__pill { width: 52px; height: 34px; border-radius: 17px; display: grid; place-items: center; }
.tabbar__pill svg { width: 23px; height: 23px; }
.tabbar__item.active { color: var(--color-primary); }
.tabbar__item.active .tabbar__pill { background: var(--color-nav-active-bg); }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in 180ms ease-out;
}
.sheet {
  width: 100%; max-width: 430px;
  background: var(--color-surface-raised);
  border-radius: 24px 24px 0 0;
  padding: 14px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 260ms cubic-bezier(.2,.8,.3,1);
}
.sheet__grab { width: 44px; height: 4px; border-radius: 2px; background: var(--color-border); margin: 0 auto 16px; }
.sheet__title { font-size: var(--text-xl); font-weight: 700; margin-bottom: 14px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Inputs ---------- */
.field {
  width: 100%; height: 52px; border-radius: var(--radius-md);
  background: var(--color-surface-raised); border: 1.5px solid transparent;
  color: var(--color-text); font-size: 17px; padding: 0 16px;
  transition: border-color 120ms ease;
}
.field:focus { border-color: var(--color-border-focus); outline: none; }
.field::placeholder { color: var(--color-text-subtle); }
.field-label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); margin: 0 0 8px 2px; }

/* ---------- Misc ---------- */
.wordmark { font-weight: 800; letter-spacing: -0.03em; text-transform: lowercase; }
.link { color: var(--color-link); font-weight: 600; }
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); }
.success { color: var(--color-success); }
.error { color: var(--color-error); }
.center { text-align: center; }
.hscroll {
  display: flex; gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -18px; padding: 4px 18px 6px;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }
.progress-track { height: 4px; border-radius: 2px; background: var(--color-surface-subtle); width: 88px; overflow: hidden; }
.progress-track__fill { height: 100%; border-radius: 2px; background: var(--color-success); }
.dashed-btn {
  width: 100%; min-height: 56px; border: 1.5px dashed var(--color-primary);
  border-radius: var(--radius-md); color: var(--color-link); font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
}
.section-title { font-size: var(--text-lg); font-weight: 600; color: var(--color-text-muted); margin: 18px 2px 10px; }
