/* ==========================================================================
   HomeHub — design system
   Light, quiet surfaces. Colour used for meaning, never for decoration.
   Mobile only: one column, thumb-reachable, 430px cap.
   ========================================================================== */

:root {
  /* neutrals */
  --bg:       #F4F5F7;
  --surface:  #FFFFFF;
  --sunken:   #F7F8FA;
  --chip:     #F1F2F5;
  --track:    #EDEFF3;
  --line:     rgba(16, 24, 40, .07);
  --line-2:   rgba(16, 24, 40, .12);

  --ink:      #101828;
  --ink-2:    #5A6478;
  --ink-3:    #98A0B0;

  /* accents */
  --red:      #E8465C;
  --red-soft: #FDEEF0;
  --blue:     #3D63F5;
  --blue-soft:#ECF0FE;
  --green:    #12B36A;
  --green-soft:#E8F8F0;
  --amber:    #E9A413;
  --amber-soft:#FDF3E0;
  --violet:   #6D5AF0;
  --teal:     #08A5A0;
  --orange:   #F2792B;
  --pink:     #EC4899;
  --sky:      #1899E0;

  --brand:    var(--blue);

  /* elevation */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 2px 8px rgba(16, 24, 40, .06);
  --sh-3: 0 12px 32px rgba(16, 24, 40, .12);
  --sh-4: 0 -6px 28px rgba(16, 24, 40, .10);

  /* shape */
  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  --gap: 12px;
  --pad: 18px;
  --nav-h: 62px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
          'Segoe UI', Roboto, system-ui, sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -.011em;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

.app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 34px);
  min-height: 100%;
}

.hide { display: none !important; }

/* one interaction language: everything tappable dips slightly */
.press { transition: transform .14s var(--ease), opacity .14s var(--ease), background-color .14s var(--ease); }
.press:active { transform: scale(.975); opacity: .88; }

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

/* ==========================================================================
   Header
   ========================================================================== */

.top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top) + 18px) 0 16px;
}

.month { flex: 1; min-width: 0; display: flex; align-items: center; }

.month-name {
  font-size: 22px;
  font-weight: 640;
  letter-spacing: -.028em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--sh-1);
}
.round svg { width: 17px; height: 17px; }
.round.sm { width: 34px; height: 34px; flex-basis: 34px; }
.round.sm svg { width: 16px; height: 16px; }

.avatar {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 6px;
}

/* ==========================================================================
   Balance card
   ========================================================================== */

.money {
  display: block;
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  padding: 20px;
  margin-bottom: 18px;
}

.money-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.money-left .k,
.money-right .k {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: -.005em;
  margin-bottom: 3px;
}
.money-left .v {
  font-size: 34px;
  font-weight: 640;
  letter-spacing: -.035em;
  line-height: 1.08;
}
.money-right { text-align: right; }
.money-right .v { font-size: 16px; font-weight: 580; letter-spacing: -.02em; }

/* coloured hero variant (health, savings) */
.money.hero {
  background: linear-gradient(140deg, var(--hero), color-mix(in srgb, var(--hero) 76%, #000 24%));
  color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hero) 30%, transparent);
}
.money.hero .k { color: rgba(255, 255, 255, .78); }
.money.hero .money-right svg { width: 26px; height: 26px; opacity: .55; }

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .money.hero { background: var(--hero); }
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  margin-top: 16px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width .6s var(--ease);
}
.bar.warn > i { background: var(--amber); }
.bar.over > i { background: var(--red); }

/* ==========================================================================
   Health alert
   ========================================================================== */

.alert {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: var(--red-soft);
  color: var(--red);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.alert .ring {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
}
.alert .ring svg { width: 19px; height: 19px; }
.alert b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.alert span {
  font-size: 13px;
  font-weight: 450;
  color: color-mix(in srgb, var(--red) 78%, #000 22%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alert > svg { width: 18px; height: 18px; opacity: .55; flex: 0 0 18px; }

/* ==========================================================================
   Tiles
   ========================================================================== */

.board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin-bottom: 4px;
}

.tile {
  --c: var(--blue);
  --tint: var(--blue-soft);
  position: relative;
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 15px;
  min-height: 118px;
}

.tile .ic {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--tint);
  color: var(--c);
  border-radius: 11px;
}
.tile .ic svg { width: 17px; height: 17px; }

.tile .nm {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: -.005em;
  margin-bottom: 1px;
}
.tile .amt {
  display: block;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -.03em;
  line-height: 1.15;
}
.tile .sub { display: none; }

.tile .mini {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  margin-top: 9px;
}
.tile .mini > i { display: block; height: 100%; background: var(--c); border-radius: 99px; }

.tile.spent-out .amt { color: var(--red); }
.tile.spent-out .sub {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--red);
  margin-top: 2px;
}
.tile.spent-out .mini > i { background: var(--red); }

.tile.lg { min-height: 132px; }
.tile.md { min-height: 122px; }
.tile.sm { min-height: 112px; }

/* the medical block: the one place colour takes over */
.tile.xl {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  min-height: 0;
  padding: 18px 20px;
  background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 74%, #000 26%));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 28%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .tile.xl { background: var(--c); }
}
.tile.xl .ic {
  width: 46px; height: 46px; flex: 0 0 46px;
  background: rgba(255, 255, 255, .17);
  color: #fff;
  border-radius: 15px;
}
.tile.xl .ic svg { width: 23px; height: 23px; }
.tile.xl .xl-body { flex: 1; min-width: 0; }
.tile.xl .nm { color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 500; }
.tile.xl .amt { color: #fff; font-size: 27px; letter-spacing: -.035em; }
.tile.xl .sub { display: block; color: rgba(255, 255, 255, .78); font-size: 12.5px; font-weight: 450; margin-top: 2px; }
.tile.xl .mini { background: rgba(255, 255, 255, .24); height: 4px; margin-top: 11px; }
.tile.xl .mini > i { background: #fff; }

.tile .flag {
  position: absolute;
  top: 14px; right: 14px;
  padding: 3px 8px;
  background: var(--chip);
  color: var(--ink-2);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0;
}
.tile.xl .flag { top: 16px; right: 18px; background: rgba(255, 255, 255, .2); color: #fff; }

/* ==========================================================================
   Sections, cards, rows
   ========================================================================== */

.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 26px 2px 11px;
}
.head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.head .more { font-size: 13.5px; font-weight: 520; color: var(--brand); }

.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 6px 16px;
  margin-bottom: 14px;
}
.card.flat { box-shadow: var(--sh-1); padding: 4px 16px; }

.empty {
  text-align: center;
  padding: 34px 16px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 450;
}
.empty svg { width: 26px; height: 26px; opacity: .4; display: block; margin: 0 auto 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }

.row .dot {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}
.row .dot svg { width: 17px; height: 17px; }
.row .txt { flex: 1; min-width: 0; }
.row .txt b {
  display: block;
  font-size: 14.5px;
  font-weight: 540;
  letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .txt span {
  display: block;
  font-size: 12.5px;
  font-weight: 450;
  color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .num { font-size: 14.5px; font-weight: 580; letter-spacing: -.02em; white-space: nowrap; }
.row .num.neg { color: var(--red); }
.row .num.pos { color: var(--green); }
.row > svg:last-child { width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 16px; }

/* ==========================================================================
   Chips
   ========================================================================== */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 16px 2px 0;
  margin-right: -16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips.scroll::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  background: var(--chip);
  color: var(--ink-2);
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 520;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; }
.chip .bub {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: -5px;
}
.chip .bub svg { width: 12px; height: 12px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ==========================================================================
   Bottom bar
   ========================================================================== */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  max-width: 430px;
  margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

.nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 520;
  letter-spacing: -.005em;
  transition: color .16s var(--ease);
}
.nav button svg { width: 21px; height: 21px; }
.nav button[aria-current="page"] { color: var(--brand); }
.nav .spacer { pointer-events: none; }

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) - 22px);
  transform: translateX(-50%);
  z-index: 41;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .28);
  transition: transform .14s var(--ease);
}
.fab svg { width: 23px; height: 23px; stroke-width: 2.4; }
.fab:active { transform: translateX(-50%) scale(.93); }

/* ==========================================================================
   Sheet
   ========================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 24, 40, .38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  width: 100%;
  max-width: 430px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--sh-4);
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px);
  animation: rise .34s var(--ease);
}
@keyframes rise { from { transform: translateY(100%); } }

.grab {
  width: 36px; height: 4px;
  background: var(--line-2);
  border-radius: 99px;
  margin: 4px auto 8px;
  flex: 0 0 auto;
}

.sheet-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 14px;
  flex: 0 0 auto;
}
.sheet-top h3 {
  flex: 1;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -.024em;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-top .round { background: var(--chip); box-shadow: none; }

.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.sheet-body > .head:first-child { margin-top: 6px; }

/* ==========================================================================
   Amount + keypad
   ========================================================================== */

.amount-box {
  text-align: center;
  padding: 10px 0 20px;
}
.amount-box .cur {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.amount-box .big {
  font-size: 42px;
  font-weight: 640;
  letter-spacing: -.04em;
  line-height: 1.1;
  word-break: break-all;
}
.amount-box .big.zero { color: #C9CEDA; }

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pad button {
  height: 54px;
  display: grid; place-items: center;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--ink);
  background: transparent;
  border-radius: var(--r-md);
  transition: background-color .12s var(--ease);
}
.pad button:active { background: var(--chip); }
.pad button svg { width: 21px; height: 21px; color: var(--ink-2); }
.pad button.del { color: var(--ink-2); }
.pad button.go { background: var(--green); color: #fff; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 520;
  color: var(--ink-3);
  margin-bottom: 7px;
  letter-spacing: -.005em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 450;
  color: var(--ink);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; background-image: none; }

.two { display: flex; gap: 10px; }
.two > * { flex: 1; min-width: 0; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  font-size: 15.5px;
  font-weight: 560;
  letter-spacing: -.015em;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-md);
}
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.blue { background: var(--brand); }
.btn.sm { min-height: 44px; font-size: 14px; padding: 10px 14px; }

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 520;
  text-align: left;
}
.switch .knob {
  width: 46px; height: 28px;
  flex: 0 0 46px;
  background: var(--track);
  border-radius: 99px;
  position: relative;
  transition: background-color .2s var(--ease);
}
.switch .knob::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 24px; height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .2);
  transition: transform .2s var(--ease);
}
.switch[aria-pressed="true"] .knob { background: var(--green); }
.switch[aria-pressed="true"] .knob::after { transform: translateX(18px); }

/* ==========================================================================
   People
   ========================================================================== */

.person {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 15px 16px;
  margin-bottom: 10px;
}
.person .face {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 14px;
}
.person .face svg { width: 20px; height: 20px; }
.person .info { flex: 1; min-width: 0; }
.person .info b { display: block; font-size: 15.5px; font-weight: 580; letter-spacing: -.02em; }
.person .info span { font-size: 12.5px; font-weight: 450; color: var(--ink-3); }
.person > svg:last-child { width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 16px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 540;
  letter-spacing: -.005em;
  white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; }
.pill.ok      { background: var(--green-soft); color: var(--green); }
.pill.soon    { background: var(--amber-soft); color: #A9760A; }
.pill.overdue { background: var(--red-soft);   color: var(--red); }

/* ==========================================================================
   Report
   ========================================================================== */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); margin-bottom: 14px; }
.stat {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 15px 16px;
}
.stat .k { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 3px; }
.stat .v { font-size: 21px; font-weight: 620; letter-spacing: -.03em; }

.brow { display: block; padding: 13px 0; border-bottom: 1px solid var(--line); }
.brow:last-child { border-bottom: 0; }
.brow .t { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.brow .t .dot {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0;
}
.brow .t .dot svg { width: 15px; height: 15px; }
.brow .t b { flex: 1; font-size: 14.5px; font-weight: 540; letter-spacing: -.015em; }
.brow .t .n { font-size: 14.5px; font-weight: 580; letter-spacing: -.02em; }
.brow .track { display: block; height: 5px; border-radius: 99px; background: var(--track); overflow: hidden; }
.brow .track > i { display: block; height: 100%; border-radius: 99px; }
.brow .cap { display: block; font-size: 12px; font-weight: 450; color: var(--ink-3); margin-top: 7px; }

.trend { display: flex; align-items: flex-end; gap: 10px; height: 152px; padding-top: 4px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.trend .stick { width: 100%; max-width: 30px; border-radius: 6px; background: var(--track); min-height: 4px; transition: height .5s var(--ease); }
.trend .col.now .stick { background: var(--brand); }
.trend .lb { font-size: 11px; font-weight: 500; color: var(--ink-3); }

/* ==========================================================================
   Charts
   ========================================================================== */

.money-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  font-size: 12.5px;
  font-weight: 450;
}
.money.hero .money-foot { color: rgba(255, 255, 255, .8); }

.money .pct {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: -.01em;
}

.charts { display: grid; gap: var(--gap); margin-top: 26px; }

.card.chart { padding: 18px 18px 16px; margin-bottom: 0; }

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.chart-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.chart-head span { font-size: 12px; font-weight: 450; color: var(--ink-3); }

/* --- donut --- */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.donut { position: relative; width: 168px; flex: 0 0 auto; }
.donut svg { display: block; width: 100%; height: auto; }
.donut circle { transition: stroke-dasharray .6s var(--ease); }
.donut-mid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
}
.donut-mid b { font-size: 18px; font-weight: 640; letter-spacing: -.03em; }
.donut-mid span { font-size: 11.5px; font-weight: 450; color: var(--ink-3); }

.legend { list-style: none; margin: 0; padding: 0; width: 100%; }
.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  font-size: 13px;
}
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend .ln {
  flex: 1; min-width: 0;
  font-weight: 450;
  color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.legend .lv { font-weight: 540; letter-spacing: -.015em; }
.legend .lp {
  width: 40px;
  text-align: right;
  font-weight: 450;
  color: var(--ink-3);
  font-size: 12.5px;
}

/* --- bars --- */
.trend .val { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.trend .stick { max-height: calc(100% - 42px); }
.trend .col.now .val { color: var(--brand); font-weight: 560; }

/* --- running total --- */
.spark { display: block; width: 100%; height: 86px; overflow: visible; }
.spark-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 450;
  color: var(--ink-3);
}

/* ==========================================================================
   Sign in
   ========================================================================== */

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: 430px;
  margin: 0 auto;
  padding: 24px 22px calc(env(safe-area-inset-bottom) + 26px);
}
.gate h1 { font-size: 27px; font-weight: 660; letter-spacing: -.035em; margin: 0 0 4px; }
.gate p { margin: 0 0 26px; font-size: 14.5px; font-weight: 450; color: var(--ink-3); }
.gate .card { margin-bottom: 0; padding: 18px; }
.gate .card b { font-size: 15.5px; font-weight: 600; }
.gate .card p { margin: 6px 0 0; }
.gate code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--chip); padding: 2px 6px; border-radius: 6px; }

.who { display: flex; gap: 10px; margin-bottom: 26px; }
.who button {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  font-size: 14.5px;
  font-weight: 540;
  letter-spacing: -.015em;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.who button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.dots { display: flex; justify-content: center; gap: 14px; margin: 0 0 24px; }
.dots i {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--line-2);
  transition: background-color .16s var(--ease), transform .16s var(--ease);
}
.dots i.on { background: var(--ink); transform: scale(1.1); }
.dots.bad i { background: var(--red); animation: shake .4s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* ==========================================================================
   Toast, offline, loading
   ========================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: rgba(16, 24, 40, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.015em;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .24);
  animation: pop-in .28s var(--ease);
}
.toast svg { width: 17px; height: 17px; flex: 0 0 17px; }
.toast .undo { color: #7FB0FF; font-weight: 560; white-space: nowrap; }
.toast.bad { background: rgba(232, 70, 92, .96); }
@keyframes pop-in { from { transform: translateX(-50%) translateY(12px); opacity: 0; } }

.offline {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 70;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  background: var(--amber-soft);
  color: #8A6008;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
}

.skeleton {
  background: linear-gradient(90deg, #ECEEF2 25%, #F5F6F8 50%, #ECEEF2 75%);
  background-size: 220% 100%;
  animation: sweep 1.3s linear infinite;
  border-radius: var(--r-xl);
}
@keyframes sweep { to { background-position: -220% 0; } }

.stagger > * { animation: lift .38s var(--ease) backwards; }
@keyframes lift { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Desktop and tablet
   Same app, room to breathe: nav moves to a rail, the board widens,
   sheets become centred dialogs.
   ========================================================================== */

@media (min-width: 760px) {

  body { padding-left: 240px; }

  .app {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 40px 64px;
  }

  /* --- left rail --------------------------------------------------- */
  .nav {
    top: 0; bottom: 0; right: auto;
    width: 240px;
    max-width: none;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: stretch;
    padding: 26px 16px 104px;
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .nav::before {
    content: 'HomeHub';
    display: block;
    padding: 0 12px;
    margin-bottom: 22px;
    font-size: 17px;
    font-weight: 640;
    letter-spacing: -.03em;
    color: var(--ink);
  }
  .nav .spacer { display: none; }
  .nav button {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 520;
    letter-spacing: -.015em;
    color: var(--ink-2);
  }
  .nav button svg { width: 19px; height: 19px; flex: 0 0 19px; }
  .nav button[aria-current="page"] { background: var(--blue-soft); color: var(--brand); }

  /* --- add button sits in the rail --------------------------------- */
  .fab {
    left: 16px;
    bottom: 26px;
    transform: none;
    width: 208px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 12px;
    box-shadow: var(--sh-2);
  }
  .fab::after {
    content: 'Add spending';
    font-size: 14.5px;
    font-weight: 560;
    letter-spacing: -.015em;
  }
  .fab svg { width: 18px; height: 18px; }
  .fab:active { transform: scale(.98); }

  /* --- wider board -------------------------------------------------- */
  .board { grid-template-columns: repeat(3, 1fr); gap: 14px; }

  .charts { grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
  .card.chart:first-child { grid-column: 1 / -1; }
  .card.chart { padding: 22px; }
  .donut-wrap { flex-direction: row; align-items: center; gap: 34px; }
  .donut { width: 196px; }
  .legend { flex: 1; }
  .legend li { padding: 7px 0; font-size: 13.5px; }
  .spark { height: 120px; }
  .tile.xl { grid-column: span 3; }
  .tile.lg, .tile.md, .tile.sm { min-height: 130px; }

  .top { padding: 34px 0 22px; }
  .month-name { font-size: 26px; }
  .money { padding: 24px; }
  .money-left .v { font-size: 38px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .trend { height: 186px; }
  .head { margin: 32px 2px 13px; }

  /* rows get a hover target */
  .card { padding: 6px 10px; }
  .row { padding: 13px 8px; border-radius: 10px; }
  .brow { padding: 14px 8px; }
  .chips.scroll { flex-wrap: wrap; overflow: visible; margin-right: 0; padding-right: 0; }

  /* --- sheets become dialogs --------------------------------------- */
  .scrim { align-items: center; padding: 32px; }
  .sheet {
    max-width: 480px;
    max-height: 84vh;
    border-radius: 20px;
    padding: 12px 22px 22px;
    box-shadow: 0 32px 64px rgba(16, 24, 40, .22);
    animation: zoom .24s var(--ease);
  }
  .sheet .grab { display: none; }
  .sheet-top { padding-top: 8px; }
  @keyframes zoom { from { transform: translateY(10px) scale(.975); opacity: 0; } }

  .toast { left: calc(50% + 120px); bottom: 28px; }
  .offline { max-width: none; margin: 0; padding-left: 264px; }
  .pad button { height: 50px; }
  .amount-box { padding: 6px 0 22px; }
}

@media (min-width: 1140px) {
  body { padding-left: 256px; }
  .app { max-width: 940px; }
  .board { grid-template-columns: repeat(4, 1fr); }
  .tile.xl { grid-column: span 4; }
  .nav { width: 256px; }
  .fab { width: 224px; }
  .offline { padding-left: 256px; }
}

/* a mouse gets hover feedback; a finger never sees it */
@media (hover: hover) and (pointer: fine) {
  .tile:hover      { box-shadow: var(--sh-2); transform: translateY(-1px); }
  .tile.xl:hover   { transform: translateY(-1px); }
  .money:hover,
  .person:hover    { box-shadow: var(--sh-2); }
  button.row:hover { background: var(--sunken); }
  .nav button:hover { color: var(--ink); }
  .nav button[aria-current="page"]:hover { color: var(--brand); }
  .chip:hover      { background: var(--track); }
  .chip[aria-pressed="true"]:hover { background: var(--ink); }
  .round:hover     { background: var(--chip); }
  .btn:hover       { opacity: .9; }
  .head .more:hover { text-decoration: underline; }
  .press:active    { transform: scale(.985); }
  .tile { transition: transform .16s var(--ease), box-shadow .16s var(--ease), opacity .14s var(--ease); }
}

@media print {
  .nav, .fab, .top .round, .scrim, .toast { display: none !important; }
  body { background: #fff; }
  .card, .stat, .person, .money { box-shadow: none; border: 1px solid var(--line); }
}
