/* Manrope (SIL Open Font License, fonts/OFL-manrope.txt), served from the app itself:
   works offline and needs no outside host in the CSP. Latin + Baltic letters + Cyrillic for later. */
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(fonts/manrope-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(fonts/manrope-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(fonts/manrope-cyrillic-wght-normal.woff2) format('woff2');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

:root {
  --ink: #1d1b22;
  --head: #36314d;   /* headings: deep plum-grey, softer than the black logo */
  --muted: #625c6e;
  --hint: #a29db0;
  --accent: #3b2fb5;
  --accent-ink: #2f2596;
  --accent-soft: #e7e4f8;
  --glass: rgba(255, 255, 255, .95);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-line: rgba(255, 255, 255, .95);
  --edge: rgba(40, 30, 100, .09);
  --shadow: 0 12px 28px rgba(40, 30, 100, .13), 0 2px 6px rgba(40, 30, 100, .07);
  --radius: 26px;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #f9f8fc;
  padding: env(safe-area-inset-top) 18px calc(110px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
}

/* Soft colour blobs behind everything: glass needs something to blur. */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
/* A soft white glow in the upper middle; the colour stays at the edges */
.bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 50% at 50% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55) 45%, rgba(255, 255, 255, 0) 75%); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .38; }
.b1 { width: 340px; height: 340px; background: #dcd3ff; top: -90px; left: -80px; }
.b2 { width: 300px; height: 300px; background: #ffe0eb; top: 260px; right: -120px; }
.b3 { width: 320px; height: 320px; background: #d5f4e9; bottom: -80px; left: -60px; }

/* Liquid glass */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  backdrop-filter: blur(22px) saturate(125%);
  border: 1px solid var(--glass-line);
  box-shadow: 0 0 0 1px var(--edge), var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.top[hidden] { display: none; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 10px; }
.wordmark { display: block; height: 22px; width: auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--ink); }
.icon-btn svg, .tab svg, .tile-icon svg, .lock svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Hero: month total */
.hero { border-radius: var(--radius); padding: 18px 22px 20px; text-align: center; position: relative; overflow: hidden; }
.orb {
  /* Placeholder for the 3D pearl object Ni will make. */
  width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff 0 12%, transparent 30%),
    radial-gradient(circle at 70% 75%, rgba(143, 124, 247, .55), transparent 55%),
    radial-gradient(circle at 25% 80%, rgba(255, 190, 215, .7), transparent 50%),
    radial-gradient(circle at 80% 25%, rgba(160, 235, 215, .7), transparent 50%),
    #efeaf8;
  box-shadow: inset -6px -10px 18px rgba(124, 102, 240, .25), inset 6px 8px 14px rgba(255, 255, 255, .9), 0 14px 28px rgba(124, 102, 240, .22);
}
/* Pearl coins: made in ChatGPT by Ni, recoloured to the Summa palette */
.coins { display: block; width: auto; height: 84px; margin: 2px auto 8px; filter: drop-shadow(0 10px 16px rgba(124, 102, 240, .25)); }
.label { margin: 0; font-size: 15px; color: var(--muted); font-weight: 500; }
.big { margin: 2px 0 0; font-size: 46px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.cents { font-size: 30px; color: var(--muted); font-weight: 700; }
.sub { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
/* Overdue and still due side by side; overdue gets the tinted panel and red figure. */
.totals.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.split .stat { padding: 8px 6px 4px; }
.split .label { font-size: 14px; }
.lbl-short, .split .lbl-full { display: none; }
.split .lbl-short { display: inline; }
.split .big { font-size: 34px; }
.split .cents { font-size: 22px; }
.split.long .big { font-size: 27px; }
.split.long .cents { font-size: 18px; }
.split .sub { margin-top: 4px; font-size: 14px; }
/* A thin divider instead of a tinted panel; the red figure carries the emphasis. */
.split .stat + .stat { border-left: 1px solid rgba(40, 30, 100, .1); }
.late .label { color: #b52c38; font-weight: 700; }
.late .big, .late .cents { color: #b52c38; }
.late .cents { opacity: .75; }
.late .sub { color: #902d36; }

/* Dark main card (3 Dec): solid deep brand ink, two columns, text left and coins right */
.hero.glass { background: #241c70; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; box-shadow: 0 14px 34px rgba(36, 28, 112, .28); }
.hero { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; text-align: left; padding: 28px 22px 28px 24px; margin-top: 8px; }
.hero .coins { grid-column: 2; grid-row: 1; height: 86px; margin: 0; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .25)); }
.hero:has(.totals.split) .coins { align-self: start; }   /* with overdue the card is taller: coins stay level with the sum */
.hero .totals, .hero .totals.split { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 0; margin: 0; min-width: 0; }
.hero .totals .stat { padding: 0; border: 0; order: 0; }
.hero .totals .label { font-size: 15px; }
.hero .totals .big { font-size: 40px; }
.hero .totals .cents { font-size: 26px; }
.hero .totals .sub { margin-top: 6px; font-size: 15px; }
.hero .split .lbl-full { display: inline; }
.hero .split .lbl-short { display: none; }
.hero .label, .hero .sub, .hero .late .label { color: rgba(255, 255, 255, .78); }
.hero .big { color: #fff; }
.hero .cents { color: rgba(255, 255, 255, .72); }
/* Overdue: one line under the month total, after a thin divider */
.hero .totals .stat.late { order: 1; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .18);
  display: flex; align-items: baseline; gap: 10px; }
.hero .totals .late .label { font-size: 14px; }
.hero .totals .late .big { margin: 0; font-size: 26px; }
.hero .totals .late .cents { font-size: 18px; }
.hero .totals .late .sub { display: none; }
.hero .late .big, .hero .late .cents { color: #ffb3b8; }

/* Pup + speech bubble */
.pet-row { display: flex; align-items: center; gap: 6px; margin: 21px 0 0; }
.pet { width: 138px; flex: none; }
.pet-hello svg { animation: hop 1.6s ease-in-out 3; transform-origin: 50% 100%; }
/* Head tilt: the head group turns around the neck (13 px rows x 6 = 84 user units down). */
.pet-head { transform-box: view-box; transform-origin: 78px 84px; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }
.pet-tilt .pet-head { transform: rotate(-10deg); }
@keyframes hop {
  0%, 60%, 100% { transform: translateY(0) scale(1, 1); }
  68% { transform: translateY(0) scale(1.06, .94); }
  78% { transform: translateY(-10px) scale(.97, 1.03); }
  88% { transform: translateY(0) scale(1.04, .96); }
}
.pet svg { width: 100%; height: auto; display: block; }
/* Breathing: the chest rises a little, all the time. Slower and deeper while asleep. */
.pet-breath { transform-box: view-box; transform-origin: 50% 100%; animation: breathe 3.4s ease-in-out infinite; }
.pet-sleeping .pet-breath { animation-duration: 5s; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 45% { transform: scale(1.012, 1.028); } }
@media (prefers-reduced-motion: reduce) { .pet-breath { animation: none; } }
.bubble {
  /* Speech bubble: solid, not glass, with a soft retro offset shadow. It belongs to the pup. */
  position: relative; background: #fff; border: 2px solid #c9c2ea; border-radius: 20px;
  box-shadow: 4px 4px 0 #dcd7f3; padding: 12px 14px;   /* centred on the pup, tail in the middle */
}
.bubble::before, .bubble::after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; }
.bubble::before { left: -13px; top: 50%; margin-top: -7px; border-width: 7px 13px 7px 0; border-color: transparent #c9c2ea transparent transparent; }
.bubble::after { left: -9px; top: 50%; margin-top: -5px; border-width: 5px 10px 5px 0; border-color: transparent #fff transparent transparent; }
.bubble p { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 600; }
.bubble .muted { margin-top: 3px; font-weight: 400; color: var(--muted); }

/* Add tiles */
/* Proximity: big gap between sections (34px), small gap from a heading to its own content (10px). */
/* Rhythm: 40 between sections, 8 from a heading to its content, 24 between groups */
.section-h { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 40px 2px 10px; color: var(--head); }
.add-grid { display: grid; gap: 10px; }
.add-tile {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 14px;
  align-items: center; text-align: left; width: 100%;
  border-radius: 22px; padding: 14px 16px; font: inherit; color: var(--ink); cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}
.add-tile::after {
  /* The plus is drawn with two bars, not a text glyph, so it sits exactly in the centre. */
  content: ""; grid-column: 3; grid-row: 1 / 3;
  width: 32px; height: 32px; border-radius: 50%;
  background-color: var(--accent);
  background-image: linear-gradient(#fff, #fff), linear-gradient(#fff, #fff);
  background-size: 14px 2.5px, 2.5px 14px;
  background-position: center; background-repeat: no-repeat;
  box-shadow: 0 4px 12px rgba(59, 47, 181, .35);
}
.add-tile:active { transform: scale(.98); background: var(--glass-strong); }
.add-tile:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .link:focus-visible { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 2px; }
.tile-icon { grid-row: 1 / 3; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; }
.tile-icon { background: var(--accent-soft); color: var(--accent); }
.tile-title { font-size: 17px; font-weight: 650; }
.tile-hint { font-size: 14px; color: var(--muted); grid-column: 2; }

/* Compact sync banner, sits under the add buttons */
.sync { display: flex; gap: 14px; align-items: center; border-radius: 20px; padding: 14px 16px; margin-top: 34px; }
/* Same soft square as the payment icons, centred on the text block. */
.lock { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lock svg { width: 20px; height: 20px; }
.sync h2 { font-size: 15px; margin: 0 0 3px; font-weight: 650; }
.sync p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.4; }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.foot { text-align: center; font-size: 12px; color: var(--muted); margin: 26px 0 0; }

/* Floating tab bar */
/* Dock: the tab bar and the pearl add button sit side by side */
/* Centred with left/right instead of transform: on iPhone a transformed fixed box with a blurred
   child drifts with the page while scrolling. The empty sides let taps through. */
.dock { position: fixed; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: center; align-items: center; gap: 10px; z-index: 5; pointer-events: none; }
.dock > * { pointer-events: auto; }
/* A soft shade at the bottom of the screen, so the white tab bar stands out from what scrolls under it */
.dock::before {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: -1; pointer-events: none;
  height: calc(150px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(36, 28, 84, .16), rgba(36, 28, 84, .07) 45%, rgba(36, 28, 84, 0));
}
.tabbar {
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; background: var(--glass-strong);
}
/* The tab bar keeps its earlier glass: richer blur */
.tabbar.glass { -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
/* Lighter than the cards and slightly raised: pure white top, a soft lift underneath */
.tabbar.glass {
  background: #fff;
  box-shadow: 0 0 0 1px rgba(40, 30, 100, .06), 0 14px 32px rgba(40, 25, 106, .16), 0 3px 8px rgba(40, 25, 106, .08),
    inset 0 1px 0 #fff, inset 0 -2px 5px rgba(59, 47, 181, .035);
}
.tab { width: 52px; height: 46px; border: 0; border-radius: 999px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.tab.on { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(59, 47, 181, .4); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--glass-strong); transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

/* Tab views */
.view-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 12px; }
.view-h { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.015em; color: var(--head); }
.add-small {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 47, 181, .3);
}
.add-small svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.add-small:focus-visible { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 2px; }
.summary { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; }
.mid { margin: 2px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.per { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.summary .sub { margin-top: 4px; font-size: 14px; }
.empty { border-radius: var(--radius); padding: 22px 20px; text-align: center; }
.empty-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--head); }
.empty .sub { margin: 6px 0 0; }
.empty .primary { width: 100%; margin-top: 18px; }

/* Coming up */
.group-h { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 24px 4px 8px; }
.section-h + div > .group-h:first-child, .section-row + div > .group-h:first-child { margin-top: 0; }
.pay-list { list-style: none; margin: 0; padding: 4px 14px; border-radius: 20px; }
.pay {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0;
  width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.pay-list li + li { border-top: 1px solid rgba(40, 30, 100, .08); }
.pay:active { opacity: .6; }
.pay:focus-visible { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 2px; border-radius: 12px; }
.pay-text { display: flex; flex-direction: column; min-width: 0; }
.tile-icon.small { width: 38px; height: 38px; border-radius: 12px; }
.tile-icon.small svg { width: 19px; height: 19px; }
.pay-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.pay-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.pay-amt { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.empty-note { color: var(--muted); font-size: 15px; margin: 0 4px; }

/* Bottom sheet with the form */
.sheet:focus, .sheet:focus-visible { outline: none; }
.sheet {
  width: 100%; max-width: 520px; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 28px 28px 0 0; background: #fbfaff; color: var(--ink);
  box-shadow: 0 -10px 40px rgba(40, 30, 100, .18);
  max-height: 92vh; overflow: auto;
}
.sheet::backdrop { background: rgba(22, 18, 50, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet form { padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--head); }
.close { background: #efedf7; border: 0; }
/* Proximity: 22px between field groups, 8px between a label and its own field. */
.field { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 22px 2px 8px; padding: 0; line-height: 1.3; }
.sheet-head + .field { margin-top: 10px; }
.sheet input[type="text"], .sheet input[type="date"], .money {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid #dcd8ea; border-radius: 14px; padding: 13px 14px;
  -webkit-appearance: none; appearance: none; min-height: 50px;
}
.money { display: flex; align-items: center; gap: 6px; padding: 0 14px; }
.money span { color: var(--muted); font-weight: 600; }
.money input { border: 0 !important; padding: 13px 0 !important; min-height: 0 !important; outline: none; }
.sheet input:focus, .money:focus-within { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59, 47, 181, .14); }
.money input:focus { box-shadow: none; }
.sheet input[aria-invalid="true"], .money:has(input[aria-invalid="true"]) { border-color: #c4314b; }
.err { color: #b52c38; font-size: 13px; line-height: 1.4; margin: 6px 2px 0; }
.err:empty { display: none; }
.seg-wrap { border: 0; margin: 22px 0 0; padding: 0; min-width: 0; }
.seg-wrap legend.field { margin: 0 2px 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #efedf7; padding: 4px; border-radius: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 11px 0; border-radius: 11px; font-size: 16px; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(40, 30, 100, .12); }
.seg input:focus-visible + span { outline: 3px solid rgba(59, 47, 181, .45); }
.primary {
  margin-top: 26px; min-height: 54px; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(59, 47, 181, .35);
}
.primary:active { transform: scale(.99); }
.danger {
  margin-top: 10px; min-height: 48px; border: 0; border-radius: 999px; background: none; color: #b52c38;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.danger.armed { background: #b52c38; color: #fff; }
.danger:focus-visible { outline: 3px solid rgba(181, 44, 56, .4); }

@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  .add-tile, .toast { transition: none; }
  .pet-hello svg { animation: none; }
  .pet-head { transition: none; }
}
.sheet input::placeholder { color: var(--hint); }

/* Loans */
.preview { margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: #f0eefb; font-size: 14px; line-height: 1.55; color: var(--accent-ink); font-weight: 500; }
.preview:empty { display: none; }
.pay-list.done .pay { opacity: .6; }

/* Pay, overdue, history */
.pay-row { display: flex; align-items: center; gap: 16px; }
.pay-row .pay { flex: 1; min-width: 0; }
.pay.static { cursor: default; }
.pay.static:active { opacity: 1; }
.pay-btn, .undo-btn {
  flex: none; height: 36px; padding: 0 16px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.pay-btn { border: 0; background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(59, 47, 181, .28); }
.pay-btn:active { transform: scale(.96); }
.undo-btn { border: 1.5px solid #d9d4ee; background: #fff; color: var(--accent-ink); }
.undo-btn.armed { background: #b52c38; border-color: #b52c38; color: #fff; }
.pay-btn:focus-visible, .undo-btn:focus-visible { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 2px; }
.auto-tag { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); background: #efedf7; border-radius: 999px; padding: 5px 10px; }
.group-h.late { color: #b52c38; }
.pay-row.late .pay-meta { color: #b52c38; }
.pay-row.late .tile-icon { background: #b52c38; color: #fff; }
.month-h { display: flex; justify-content: space-between; }
.month-total { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.done-icon { opacity: .75; }

/* Switch */
.field-hint { margin: -4px 2px 10px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 12px 14px; background: #fff; border: 1.5px solid #dcd8ea; border-radius: 16px; cursor: pointer; }
.switch-text { flex: 1; display: flex; flex-direction: column; }
.switch-title { font-size: 16px; font-weight: 600; }
.switch-hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 50px; height: 30px; border-radius: 999px; background: #d6d2e6; position: relative; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 2px; }

/* Toast with Undo */
.toast { display: flex; align-items: center; gap: 12px; pointer-events: none; }
.toast.show { pointer-events: auto; }
.toast-undo { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 14px; font-weight: 800; color: var(--accent-ink); cursor: pointer; }

/* Five tabs */
.tab { width: 54px; }

/* Sleeping Zs */
.pet-z { opacity: 0; animation: zfloat 2.7s ease-in-out infinite; }
.pet-z2 { animation-delay: .9s; }
.pet-z3 { animation-delay: 1.8s; }
@keyframes zfloat {
  0% { opacity: 0; transform: translate(0, 6px); }
  25%, 60% { opacity: 1; }
  100% { opacity: 0; transform: translate(4px, -8px); }
}
@media (prefers-reduced-motion: reduce) {
  .pet-z { animation: none; opacity: 1; }
}

/* Little moves */
.pet-hop svg { animation: hop1 .6s ease-in-out 1; transform-origin: 50% 100%; }
@keyframes hop1 {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  15% { transform: translateY(0) scale(1.06, .94); }
  45% { transform: translateY(-10px) scale(.97, 1.03); }
  75% { transform: translateY(0) scale(1.04, .96); }
}
.pet-tongue-long { display: none; }
.pet-tongue-in .pet-tongue { display: none; }
.pet-tongue-out .pet-tongue-long { display: inline; }

/* Paid ahead: the button pays the next period, so it looks secondary */
.pay-btn.next { background: #fff; color: var(--accent-ink); border: 1.5px solid #cfc8ee; box-shadow: none; padding: 0 13px; }
.pay-row.ahead .pay-meta { color: #2f7a5b; }

/* The pup is a button: tap to make it hop */
button.pet { display: block; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.pet:focus-visible { outline: 3px solid rgba(59, 47, 181, .45); outline-offset: 4px; border-radius: 12px; }

/* Settings: a light glass circle, smaller than its 44px tap area so it doesn't crowd the screen corner */
.settings-btn {
  position: relative; width: 44px; height: 44px; margin-right: -4px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; color: var(--head);
}
.settings-btn::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, .38);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 2px 8px rgba(40, 30, 100, .06);
}
.settings-btn svg { position: relative; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.settings-btn:active::before { background: rgba(255, 255, 255, .6); }
.settings-btn:focus-visible { outline: none; }
.settings-btn:focus-visible::before { box-shadow: 0 0 0 3px rgba(59, 47, 181, .45); }

/* Tips: same voice as the pup's bubble (white, lavender edge, flat offset shadow) */
.tip { position: relative; margin-top: 16px; padding: 14px 16px; background: #f8f6ff;   /* a faint tint, so the tip reads lighter than the payment card */ border: 2px solid #c9c2ea; border-radius: 20px; box-shadow: 4px 4px 0 #dcd7f3; }
.tip::before, .tip::after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; }
.tip::before { right: 30px; top: -14px; border-width: 0 11px 14px; border-color: transparent transparent #c9c2ea; }
.tip::after { right: 33px; top: -9px; border-width: 0 8px 10px; border-color: transparent transparent #f8f6ff; }
.tip h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--head); }
.tip p { margin: 0; font-size: 14px; line-height: 1.45; }
.tip-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.tip-btn { min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }

/* Permanent note under the Paid automatically switch */
.note { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0; padding: 12px 14px; border-radius: 16px; background: rgba(231, 228, 248, .75); font-size: 14px; line-height: 1.45; }
.note svg { flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }

/* Two-line toast */
.toast-body { display: flex; flex-direction: column; min-width: 0; }
/* Long names wrap inside the screen instead of pushing the toast past its edges */
.toast { white-space: normal; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; }
#toast-text { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast-undo { flex: none; }
#toast-sub { font-size: 13px; font-weight: 500; color: var(--muted); }
.toast.two { border-radius: 20px; }

/* Guide card on home and the guide screen */
.ghost { display: block; width: 100%; min-height: 46px; margin-top: 14px; border: 1.5px solid #cfc8ee; border-radius: 999px; background: #fff; color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.guide-card { border-radius: 22px; padding: 18px; margin-top: 34px; }
.guide-top { display: flex; gap: 14px; align-items: center; }
.guide-top .tile-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; }
.guide-top h2 { margin: 0 0 3px; font-size: 16px; font-weight: 700; color: var(--head); }
.guide-top p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 10px 0 0; padding: 8px 4px; min-height: 44px; border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guide-h { margin: 12px 2px 0; }
.guide-lead { margin: 10px 2px 0; font-size: 16px; line-height: 1.45; color: var(--muted); }
.guide-sec { border-radius: 22px; padding: 16px; margin-top: 14px; }
.guide-lead + .guide-sec { margin-top: 34px; }
.guide-sec h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--head); }
.guide-sec ul { list-style: none; margin: 0; padding: 0; }
.guide-sec li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; }
.guide-sec li + li { border-top: 1px solid rgba(40, 30, 100, .08); }
.guide-sec b { font-size: 15px; font-weight: 600; }
.guide-sec li span { font-size: 14px; color: var(--muted); line-height: 1.4; }
#guide .ghost { margin-top: 34px; }
.tip.no-arrow::before, .tip.no-arrow::after { display: none; }
.tip-actions { gap: 8px; }
.tip-btn.quiet { background: none; color: var(--accent-ink); }

/* Good to know: a flat panel, no glass or shadow, so it reads as info, not actions */
/* Flat and lavender, so it reads as info next to the white cards; a hairline keeps it off the background */
.info-panel { padding: 4px 16px; border-radius: 22px; background: #e9e5f7; box-shadow: inset 0 0 0 1px rgba(59, 47, 181, .08); }
.info-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.info-row + .info-row { border-top: 1px solid rgba(40, 30, 100, .08); }
.info-icon { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #fff; color: var(--muted); }
.info-icon svg, .info-row .chev { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.info-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.info-title { font-size: 15px; font-weight: 600; color: var(--head); }
.info-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.info-link { font-size: 13px; font-weight: 600; color: var(--accent-ink); margin-top: 2px; }
.info-row .chev { flex: none; color: var(--muted); stroke-width: 2; }

/* Guide card: solid violet, the one bright spot at the bottom of home */
.pearl-card {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 10px; padding: 16px 16px 16px 18px;
  border: 0; border-radius: 22px; font: inherit; text-align: left; cursor: pointer;
  background: var(--accent); box-shadow: 0 10px 24px rgba(59, 47, 181, .22);
}
.pearl-card:active { transform: scale(.99); }
.pearl-card .info-icon { width: 40px; height: 40px; border-radius: 12px; background: #fff; color: var(--accent); }
.pearl-card .info-title { font-size: 16px; font-weight: 700; color: #fff; }
.pearl-card .info-sub { font-size: 14px; color: #d9d4ff; }
.pearl-card .chev { flex: none; width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Push test (temporary) */
.push-test h2 { margin-bottom: 6px; }
.push-p { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.push-sub { width: 100%; margin-top: 12px; padding: 10px 12px; border: 1.5px solid #dcd8ea; border-radius: 14px; font: 12px/1.4 ui-monospace, Menlo, monospace; color: var(--ink); background: #fff; resize: none; }
.push-diag { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); line-height: 1.6; }
.push-diag b { color: var(--ink); font-weight: 600; }

/* Add: a dark blue pill next to Coming up; once it scrolls away, a round copy joins the tab bar */
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 37px 2px 8px; }
.section-row .section-h { margin: 0; }
.head-add {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px 0 12px;
  border: 0; border-radius: 999px; background: #dcd6f7; color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  /* Soft, not solid: solid violet means Pay, an outline means Pay ahead */
}
.head-add svg { width: 16px; height: 16px; fill: currentColor; }
.head-add:active { transform: scale(.97); background: #d0c9f3; }
.fab {
  flex: none; width: 58px; height: 58px; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  box-shadow: 0 10px 22px rgba(59, 47, 181, .38);
  animation: fab-in .22s ease-out;
}
.fab[hidden] { display: none; }
@keyframes fab-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
/* The plus keeps the logo's square-ended strokes */
.fab svg { width: 24px; height: 24px; fill: currentColor; }
.fab:active { transform: scale(.95); }

/* Add picker */
.sheet-body { padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.pick { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 14px 14px 16px; border: 1px solid #e6e2f3; border-radius: 20px; background: #fff; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pick .tile-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; }
.pick-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.pick-title { font-size: 17px; font-weight: 700; }
.pick-sub { font-size: 14px; color: var(--muted); }
.pick .chev { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Bank statement import */
.import-banner { position: relative; display: flex; gap: 16px; align-items: center; margin-top: 40px; padding: 18px 18px 18px 16px; border-radius: 24px; }
.import-art { flex: none; width: 84px; height: auto; }
.import-banner h2, .guide-import h2 { margin: 0 0 4px; padding-right: 22px; font-size: 17px; font-weight: 700; color: var(--head); }
.import-banner p, .guide-import p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.import-btn { margin-top: 12px; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.import-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.import-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.guide-import { display: flex; gap: 16px; align-items: center; margin-top: 34px; padding: 18px 16px; border-radius: 22px; }
.guide-import + .guide-sec { margin-top: 14px; }
.import-lead { margin: 0 0 6px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.import-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.import-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; padding: 12px 2px; }
.import-row + .import-row { border-top: 1px solid rgba(40, 30, 100, .08); }
.import-row input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.import-main { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.import-top { display: flex; justify-content: space-between; gap: 10px; }
.import-name { font-weight: 600; overflow-wrap: anywhere; }
.import-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.import-meta { font-size: 13px; color: var(--muted); }
.import-count { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.import-count label { font-size: 13px; font-weight: 600; color: var(--head); }
.import-count input { width: 90px; height: 40px; padding: 0 12px; border: 1.5px solid #dcd8ea; border-radius: 12px; font: inherit; background: #fff; }
.import-count .err { width: 100%; margin: 0; }
#sheet-import .primary { margin-top: 14px; }

/* Payment rows aligned to one top edge (3 Dec): the icon, the name, the amount and the Pay button
   start on the same line; the meta text goes below the name. */
.pay-row { align-items: flex-start; }
.pay { align-items: start; }
.pay-name { line-height: 22px; }
.pay-amt { line-height: 22px; }
.pay-row .pay-btn, .pay-row .undo-btn, .pay-row .auto-tag { margin-top: 10px; }   /* = the row's top padding */
.pay .tile-icon { margin-top: 0; }

/* ---- First-open intro (3 Dec): three swipeable screens -------------------- */
.intro[hidden] { display: none; }
.intro { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #f9f8fc;
  padding: env(safe-area-inset-top) 0 calc(18px + env(safe-area-inset-bottom)); }
.intro::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 75% 45% at 50% 30%, #fff 0%, rgba(255,255,255,0) 70%),
              radial-gradient(circle at 15% 85%, rgba(220,211,255,.45), transparent 40%),
              radial-gradient(circle at 90% 10%, rgba(255,224,235,.4), transparent 40%); }
.intro-skip { align-self: flex-end; min-height: 44px; margin: 8px 12px 0; padding: 0 12px; border: 0; background: none;
  color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.intro-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.intro-track::-webkit-scrollbar { display: none; }
.intro-slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; justify-content: center; padding: 0 28px; text-align: center; }
.intro-slide h2 { margin: 36px 0 10px; font-size: 26px; font-weight: 700; letter-spacing: -.015em; color: var(--head); }
.intro-slide > p { margin: 0 auto; min-height: 4.5em; max-width: 320px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.intro-art { height: 300px; display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: left; }
.intro-foot { padding: 0 28px; }
.intro-dots { display: flex; justify-content: center; gap: 8px; }
.intro-dots span { width: 7px; height: 7px; border-radius: 999px; background: #d6d1ec; transition: width .25s, background .25s; }
.intro-dots span.on { width: 22px; background: var(--accent); }
.intro-next { display: block; width: 100%; margin-top: 22px; }

/* Mini pieces of the app inside the intro pictures */
.o-hero { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 18px 20px 20px; border-radius: 24px;
  background: #241c70; box-shadow: 0 14px 34px rgba(36, 28, 112, .28); }
.o-hero img { width: 96px; height: auto; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }
.o-lbl { margin: 0; font-size: 13px; color: rgba(255,255,255,.78); }
.o-big { margin: 2px 0 4px; font-size: 32px; font-weight: 800; letter-spacing: -.02em; color: #fff; }
.o-big span { font-size: 20px; font-weight: 700; color: rgba(255,255,255,.72); }
.o-rows { padding: 4px 14px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.o-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.o-row + .o-row { border-top: 1px solid #ece9f4; }
.o-ic { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.o-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.o-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.o-name small { display: block; margin-top: 1px; font-size: 13px; font-weight: 400; color: var(--muted); }
.o-row b { font-size: 15px; font-weight: 700; color: var(--ink); }
.o-single .o-row { padding: 14px 0; }
.o-pay { flex: none; padding: 8px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(59, 47, 181, .28); animation: o-tap 2.4s ease-in-out infinite; }
.o-toast { align-self: center; display: flex; gap: 14px; padding: 12px 18px; border-radius: 999px; background: #241c70; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 24px rgba(36, 28, 112, .25); animation: o-toast 2.4s ease-in-out infinite; }
.o-toast span { color: #c9c2ff; }
@keyframes o-tap { 0%, 30%, 100% { transform: scale(1); } 38% { transform: scale(.92); } 46% { transform: scale(1); } }
@keyframes o-toast { 0%, 40% { opacity: 0; transform: translateY(8px); } 50%, 90% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.o-pupart { align-items: center; gap: 4px; }
.o-bubble { margin: 0 0 14px; }
.o-bubble::before { left: 50%; top: 100%; margin: 0 0 0 -8px; border-width: 13px 8px 0 8px; border-color: #c9c2ea transparent transparent transparent; }
.o-bubble::after { left: 50%; top: 100%; margin: -1px 0 0 -6px; border-width: 10px 6px 0 6px; border-color: #fff transparent transparent transparent; }
.o-pup { width: 150px; height: 150px; }
.o-pup svg { width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) { .o-pay, .o-toast { animation: none; } }
/* On a wide screen the intro keeps the app's column width instead of stretching */
.intro-track, .intro-foot { align-self: center; width: 100%; max-width: 520px; }
.intro-skip { margin-right: max(12px, calc((100vw - 520px) / 2 + 12px)); }
/* One right-hand column width, so amounts line up whether the row ends in Pay, Auto or Undo */
.pay-row .pay-btn, .pay-row .undo-btn, .pay-row .auto-tag { min-width: 58px; box-sizing: border-box; text-align: center; justify-content: center; }
.pay-row .auto-tag { display: inline-flex; }
