/* nusa. — design tokens from the design handoff (turn 3 + login 2a + mobile 2c). */
:root {
  color-scheme: light;
  --page: #ffffff;
  --ink: #121418;
  --text-2: #3d424c;
  --muted: #6f7480;
  --faint: #9a9fa9;
  --line-tile: #ecedf1;
  --line-ctrl: #e3e5ea;
  --divider: #eeeff3;
  --track: #eeeff3;
  --sunken: #f1f2f5;
  --chip: #f4f5f7;
  --pink: #ff2e84;
  --pink-text: #e0176a;
  --pink-tint: #ffe3ee;
  --gradient: linear-gradient(90deg, #ff2e84, #ff9650);
  --danger: #e5533d;
  --danger-text: #c0392b;
  --danger-tint: #fdecea;
  --near: #ff9650;
  --near-text: #b45309;
  --near-tint: #fff1e6;
  --good: #1f912e;
  --good-text: #1f6b2b;
  --good-tint: #e8f7ea;
  --glass: rgba(255, 255, 255, 0.74);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --lift: 0 14px 34px rgba(16, 18, 24, 0.07);
  --grain: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22320%22%20height%3D%22320%22%3E%3Cfilter%20id%3D%22n%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%220.85%22%20numOctaves%3D%223%22%20stitchTiles%3D%22stitch%22%2F%3E%3CfeColorMatrix%20values%3D%220%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.6%200%22%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20filter%3D%22url(%23n)%22%2F%3E%3C%2Fsvg%3E");
}

/* Bundled (variable, weights 200–800) so the app needs no font CDN; licence in fonts/PlusJakartaSans-OFL.txt. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('fonts/PlusJakartaSans.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  display: flow-root; /* keeps the header's top margin inside body, so the glow starts at the very top */
  position: relative;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 500 14px/1.5 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.muted-2 { color: var(--text-2); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.ink { color: var(--ink); }
.push { margin-left: auto; }
.push-down { margin-top: auto; }
.lh { line-height: 1.5; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.is-positive { color: var(--good); }
.is-danger { color: var(--danger-text); }
.is-pink { color: var(--pink-text); }
.stack-2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; font-size: 13.5px; }
.note { margin-top: -6px; }

/* ---------- background glow ---------- */

.glow {
  position: absolute;
  inset: 0 0 auto 0;
  height: 760px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.grain {
  position: absolute;
  right: -300px;
  top: -420px;
  width: 1040px;
  height: 940px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 38%, rgba(255, 46, 132, 0.78), rgba(255, 120, 110, 0.62) 34%, rgba(255, 170, 110, 0.5) 54%, rgba(255, 170, 110, 0) 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 28%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 45%, #000 28%, transparent 70%);
  animation: drift2 30s ease-in-out infinite alternate;
}
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.7;
  mix-blend-mode: multiply;
  background-image: var(--grain);
}

/* ---------- header ---------- */

.topbar, main {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding-left: 40px;
  padding-right: 40px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
  margin-top: 22px;
  z-index: 20;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span { display: inline-block; animation: letter 0.6s var(--ease) backwards; }
.wordmark span:nth-child(2) { animation-delay: 50ms; }
.wordmark span:nth-child(3) { animation-delay: 100ms; }
.wordmark span:nth-child(4) { animation-delay: 150ms; }
.wordmark .wm-dot, .wm-dot { color: var(--pink); animation: letter 0.6s var(--ease) 0.25s backwards, dot 2.6s var(--bounce) 1.2s infinite; }

.nav { display: flex; gap: 24px; font-size: 14px; font-weight: 600; }
.nav a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; transition: color 0.2s; }
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pop-anchor { position: relative; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-ctrl);
  background: rgba(255, 255, 255, 0.8);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.2s;
}
.pill:hover { border-color: var(--ink); }
.pill-chevron { display: inline-flex; }
/* Language switch: ink track, the current language's code on one side, a white knob on the other (EN: knob right). */
.lang-switch {
  position: relative;
  flex: none;
  width: 76px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.lang-switch:hover { background: #2a2d34; }
.lang-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--pink-tint), 0 0 0 5px var(--pink); }
.lang-code {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.35s var(--ease);
}
.lang-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: translateX(38px);
  transition: transform 0.35s var(--bounce);
}
.lang-switch[data-lang="id"] .lang-code { transform: translateX(34px); }
.lang-switch[data-lang="id"] .lang-knob { transform: translateX(0); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--bounce);
}
.avatar:hover { transform: scale(1.06); }

.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-tile);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(16, 18, 24, 0.12);
  padding: 14px;
  animation: pop-in 0.25s var(--ease);
}
.period-pop { width: 320px; display: flex; flex-direction: column; gap: 12px; }
.account-pop { width: 240px; display: flex; flex-direction: column; gap: 4px; }
.pop-caption { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); padding: 4px 8px 0; }
.pop-email { font-weight: 600; padding: 0 8px 8px; overflow-wrap: anywhere; border-bottom: 1px solid var(--divider); margin-bottom: 4px; }
.menu-item { text-align: left; border: none; background: none; border-radius: 10px; padding: 9px 8px; font-size: 13.5px; font-weight: 600; }
.menu-item:hover { background: var(--chip); }

.segmented { display: flex; padding: 3px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line-tile); }
.seg { flex: 1; border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
.seg.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 18, 24, 0.08); }

.month-step { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 0 2px 8px; }
.month-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.month-cell {
  height: 38px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}
.month-cell.has-data { color: var(--ink); font-weight: 700; }
.month-cell:hover:not(:disabled) { border-color: var(--line-ctrl); background: #fff; }
.month-cell.is-active { background: var(--ink); color: #fff; }
.month-cell:disabled { color: #c9ccd3; }

.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--line-ctrl); background: #fff; }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn-sm { width: 30px; height: 30px; }

.banner {
  position: relative;
  z-index: 1;
  width: calc(100% - 80px);
  max-width: 1280px;
  margin: 10px auto -4px;
  background: var(--danger-tint);
  color: var(--danger-text);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- pages & tiles ---------- */

main { padding-top: 18px; padding-bottom: 48px; }
.page { display: flex; flex-direction: column; gap: 18px; }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: stretch; }

.tile {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-tile);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  text-align: left;
  animation: rise 0.7s var(--ease) backwards;
  animation-delay: var(--d, 0ms);
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.no-enter .tile, .no-enter .tile-dashed { animation: none; }
.is-clickable { cursor: pointer; font: inherit; color: inherit; }

.t-spent { grid-column: span 5; padding: 26px 28px; }
.t-ring { grid-column: span 3; align-items: center; justify-content: center; }
.t-heat { grid-column: span 4; }
.t-cats { grid-column: span 4; }
.t-review { grid-column: span 5; }
.t-sync { grid-column: span 3; }
.t-recent { grid-column: span 12; padding: 18px 28px 10px; gap: 0; }
.t-account { grid-column: span 5; border-radius: 22px; }
.t-stats { grid-column: span 4; border-radius: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.t-types { grid-column: span 3; border-radius: 22px; gap: 8px; }
.t-emails { grid-column: span 8; border-radius: 22px; padding: 18px 26px 12px; gap: 6px; }
.t-reread { grid-column: span 4; border-radius: 22px; align-self: start; }

.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.tile-head.wrap { flex-wrap: wrap; }
.tile-title { font-weight: 700; font-size: 15px; }
.with-dot { display: flex; align-items: center; gap: 8px; }
.caption-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.caption-row .strong { color: var(--ink); font-weight: 600; }

.hero-figure { font-size: 64px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero-msg { margin-top: auto; font-size: 14px; line-height: 1.5; color: var(--text-2); text-wrap: pretty; }

.bar { height: 4px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar-6 { height: 6px; }
.bar-5 { height: 5px; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; }
.t-spent .bar { margin-top: 6px; }

.ring-wrap { position: relative; width: 150px; height: 150px; }
.ring { width: 100%; height: 100%; border-radius: 50%; background: var(--sunken); }
.ring-hole {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-pct { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }

.heat { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.heat-day { font-size: 10.5px; font-weight: 600; color: var(--faint); text-align: center; }
.heat-cell { aspect-ratio: 1 / 1; border-radius: 6px; background: var(--chip); }
.heat-cell.is-blank { visibility: hidden; }
.heat-cell.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
.heat-cell.is-future { background: transparent; border: 1.5px dashed var(--line-ctrl); }
.heat.is-dense { gap: 4px; }
.heat.is-dense .heat-cell { aspect-ratio: auto; height: 14px; border-radius: 4px; }

.month-cols { width: 100%; height: auto; overflow: visible; }
.month-cols .col { fill: var(--ink); }
.month-cols .col.is-now { fill: var(--pink); }
.month-cols .col-label { fill: var(--faint); font-size: 10.5px; font-weight: 600; }
.month-cols .hit { fill: transparent; }

.cat-rows { display: flex; flex-direction: column; gap: 12px; }
.cat-row { display: flex; flex-direction: column; gap: 6px; border: none; background: none; padding: 0; text-align: left; }
.cat-row-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.cat-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row:hover .cat-row-name { color: var(--pink-text); }

/* review deck */
.count-pill { font-size: 12px; font-weight: 700; color: var(--pink-text); background: var(--pink-tint); border-radius: 999px; padding: 3px 9px; }
.t-review .tile-head { justify-content: flex-start; }
.deck { position: relative; height: 156px; outline: none; }
.deck:focus-visible { outline: 2px solid var(--pink); outline-offset: 4px; border-radius: 18px; }
.card {
  position: absolute;
  inset: 0;
  background: var(--chip);
  border: 1px solid #e8eaee;
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-behind { transition: transform 0.35s var(--ease); }
.behind-1 { transform: translateY(8px) scale(0.96); opacity: 0.65; }
.behind-2 { transform: translateY(16px) scale(0.92); opacity: 0.3; }
.card-top {
  z-index: 2;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 0.45s var(--ease), opacity 0.25s;
  animation: rise 0.5s var(--ease) backwards;
}
.card-top.is-dragging { transition: none; cursor: grabbing; }
.card-top.fly-right { transform: translateX(130%) rotate(12deg) !important; opacity: 0; transition: transform 0.25s ease-in, opacity 0.25s; }
.card-top.fly-left { transform: translateX(-130%) rotate(-12deg) !important; opacity: 0; transition: transform 0.25s ease-in, opacity 0.25s; }
.card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.card-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.card-title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-amount { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.suggest-pill {
  margin-top: auto;
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e8eaee;
  font-size: 13px;
  font-weight: 600;
}
.dot-pink { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); }
.swipe-badge {
  position: absolute;
  top: 14px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.badge-accept { left: 16px; color: var(--pink-text); background: var(--pink-tint); }
.badge-skip { right: 16px; color: var(--text-2); background: #e8eaee; }
.deck-empty {
  position: absolute;
  inset: 0;
  border: 1.5px dashed var(--line-ctrl);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 12px;
  animation: rise 0.5s var(--ease) backwards;
}
.deck-actions { display: flex; align-items: center; gap: 8px; }
/* Pills that don't fit wrap onto a second line, which is clipped, so none shows cut in half. */
.deck-pills { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; height: 40px; overflow: hidden; }
.deck-pills .pill-btn { flex: none; }
.round-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-ctrl);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform 0.2s var(--bounce), color 0.2s, background 0.2s;
}
.round-btn:hover:not(:disabled) { transform: scale(1.08); color: var(--ink); }
.round-solid { border: none; background: var(--ink); color: #fff; animation: pulse 2.4s infinite; }
.round-solid:hover:not(:disabled) { background: var(--pink); color: #fff; }
.round-btn:disabled { opacity: 0.35; animation: none; }
.pill-btn, .pill-select {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-ctrl);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.2s;
  flex: none;
}
.pill-select { padding-right: 12px; }
.page-actions .pill-select { height: 38px; background-color: rgba(255, 255, 255, 0.8); font-size: 13px; }
.pill-btn:hover:not(:disabled), .pill-select:hover:not(:disabled), .pill-select[aria-expanded="true"] { border-color: var(--ink); }
.pill-btn:disabled, .pill-select:disabled { opacity: 0.4; }

/* dropdown (ui.js dropdown()): a button plus a floating list in the top layer */
.dd { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; text-align: left; cursor: pointer; }
.dd-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dd > svg { flex: none; transition: transform 0.25s var(--ease); }
.dd[aria-expanded="true"] > svg { transform: rotate(180deg); }
.dd:disabled { cursor: default; }
.dd-wrap { display: flex; }
.dd-wrap > .dd { flex: 1; }
.dd-menu[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px;
  max-width: min(320px, calc(100vw - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-tile);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(16, 18, 24, 0.14);
  color: var(--ink);
}
.dd-menu:popover-open { display: flex; flex-direction: column; gap: 2px; animation: pop-in 0.2s var(--ease); }
.dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}
.dd-item:focus { outline: none; background: var(--chip); color: var(--ink); }
.dd-item.is-selected { color: var(--ink); font-weight: 700; }
.dd-item > svg { color: var(--pink); flex: none; }

/* email sync tile */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); animation: pulse 2s infinite; flex: none; }
.live-dot.is-good { background: var(--good); animation-name: pulse-good; }
.live-dot.is-error { background: var(--danger); animation: none; }
.stat-stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.big-num { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.t-stats .big-num { font-size: 36px; }
.big-num.is-pink { color: var(--pink-text); }
.big-num.is-danger { color: var(--danger-text); }
.kv-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); margin-top: auto; }
.kv-lined { margin-top: 0; padding-top: 10px; border-top: 1px solid var(--divider); font-size: 13.5px; gap: 9px; }
.kv { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
.kv b { font-weight: 600; color: var(--ink); }

/* buttons */
.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.25s, color 0.25s, transform 0.2s var(--bounce);
}
.btn:hover:not(:disabled) { background: var(--ink); color: #fff; }
.btn-solid { border: none; background: var(--ink); color: #fff; }
.btn-solid:hover:not(:disabled) { background: var(--pink); transform: scale(1.03); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; }
.btn.center { align-self: center; margin-top: 8px; }
.page-actions .btn { height: 38px; font-size: 13px; }
.link { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 0; color: var(--pink-text); font-size: 13px; font-weight: 600; }
.link:hover { gap: 9px; }

/* recent transactions */
.recent-list { display: flex; flex-direction: column; margin-top: 10px; }
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 180px 140px;
  gap: 16px;
  align-items: center;
  padding: 11px 0;
  border: none;
  border-top: 1px solid var(--divider);
  background: none;
  text-align: left;
  font-size: 14px;
  transition: background 0.2s;
}
.recent-row:hover { background: rgba(244, 245, 247, 0.7); }
.recent-row.is-hidden { opacity: 0.45; }
.recent-row > :last-child { text-align: right; }
.recent-title { display: flex; align-items: center; gap: 12px; font-weight: 600; min-width: 0; }
.cat-unknown { color: var(--pink-text); font-weight: 700; }

.cat-chip {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--chip);
  border: 1px solid var(--line-tile);
  color: var(--ink);
  font-weight: 800;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.cat-chip > svg { flex: none; }
.cat-chip.chip-sm { width: 26px; height: 26px; padding: 0; border-radius: 8px; font-size: 11px; } /* padding: 0 beats the filter chips' .chip-sm */
.cat-chip.is-unknown { background: #fff; border: 1.5px dashed #c9ccd3; color: var(--pink); }
.cat-chip.is-credit { background: var(--good-tint); border-color: transparent; color: var(--good); }

/* ---------- page headers & filters ---------- */

.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.page-meta { font-size: 13.5px; color: var(--muted); }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line-ctrl);
  color: var(--faint);
  width: 260px;
  transition: border-color 0.2s;
}
.search-pill:focus-within { border-color: var(--ink); }
.search-pill input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line-ctrl);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips-lg .chip { height: 34px; }
.chip-sm { height: 28px; font-size: 12px; padding: 0 11px; }
.filter-row { padding-top: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.t-stat { border-radius: 22px; padding: 18px 22px; gap: 6px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }

.t-list { border-radius: 22px; padding: 4px 28px 14px; gap: 0; }
.t-list:hover, .t-table:hover, .t-emails:hover, .t-rules:hover { transform: none; box-shadow: none; }
.day-head {
  display: flex;
  justify-content: space-between;
  padding: 18px 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--faint);
}
.day-head > :first-child { letter-spacing: 0.06em; text-transform: uppercase; }
.tx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 190px 140px 32px;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
  font-size: 14px;
  transition: background 0.2s;
}
.tx-list > .tx-row:first-child { border-top: none; }
.tx-row:hover { background: rgba(244, 245, 247, 0.7); }
.tx-row.is-hidden > :not(.tx-act) { opacity: 0.45; }
.tx-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tx-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; border: none; background: none; padding: 0; text-align: left; }
.tx-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-text:hover .tx-title { color: var(--pink-text); }
.tx-sub { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden-tag { margin-left: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.tx-source { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { text-align: right; font-weight: 700; white-space: nowrap; }
.tx-act { display: flex; justify-content: flex-end; }
.cat-select {
  max-width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  margin-left: -9px;
  border-radius: 10px;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.cat-select > svg { opacity: 0; transition: opacity 0.2s, transform 0.25s var(--ease); }
.cat-select:hover, .cat-select:focus-visible, .cat-select[aria-expanded="true"] { outline: none; border-color: var(--line-ctrl); background: #fff; color: var(--ink); }
.cat-select:hover > svg, .cat-select:focus-visible > svg, .cat-select[aria-expanded="true"] > svg { opacity: 1; }
.cat-select.is-unknown { color: var(--pink-text); font-weight: 700; }
.cat-select.is-unknown > svg { opacity: 1; }
.field-select {
  height: 40px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-ctrl);
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
}
.field-select:focus-visible, .field-select[aria-expanded="true"] { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--pink-tint); }

/* ---------- categories ---------- */

.t-wide { border-radius: 22px; padding: 22px 26px; }
.figure-md { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.figure-sm { font-size: 24px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.figure-lg { font-size: 36px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stack-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 3px; }
.stack-seg { height: 100%; width: 0; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.t-cat { border-radius: 22px; padding: 20px; gap: 12px; }
.cat-tile-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-tile-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.t-cat:hover .cat-tile-name { color: var(--pink-text); }
.cat-tile-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.delta { font-weight: 600; white-space: nowrap; }
.delta.is-up { color: var(--danger); }
.tile-dashed {
  border: 1.5px dashed #d9dbe0;
  border-radius: 22px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-height: 150px;
  animation: rise 0.7s var(--ease) backwards;
  animation-delay: var(--d, 0ms);
  transition: border-color 0.2s, color 0.2s;
}
.tile-dashed:hover { border-color: var(--ink); color: var(--ink); }
.plus-circle { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; }

.t-rules { gap: 4px; padding: 20px 26px; }
.t-rules .tile-head { padding-bottom: 10px; align-items: flex-start; }
.rule-list { display: flex; flex-direction: column; }
.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 260px) 24px minmax(0, 1fr) auto 32px;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
  font-size: 13.5px;
}
.mono-chip {
  font: 600 12.5px ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  background: var(--chip);
  border: 1px solid var(--line-tile);
  border-radius: 8px;
  padding: 6px 10px;
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- budgets ---------- */

.three-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.t-third { border-radius: 22px; padding: 22px 24px; gap: 12px; }
.figure-lg.is-danger { color: var(--danger-text); }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--text-2);
  white-space: nowrap;
}
.status-pill.is-good { background: var(--good-tint); color: var(--good-text); }
.status-pill.is-danger { background: var(--danger-tint); color: var(--danger-text); }
.status-pill.is-warn { background: var(--near-tint); color: var(--near-text); }

.t-table { border-radius: 22px; padding: 12px 26px 10px; gap: 0; }
.budget-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.4fr 1fr 130px;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--divider);
  font-size: 14px;
}
.budget-row > .num { text-align: right; justify-self: end; }
.budget-head { border-top: none; padding: 8px 0 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.budget-cat { display: flex; align-items: center; gap: 12px; min-width: 0; }
.budget-amount { display: flex; flex-direction: column; align-items: flex-end; }
.per-month { display: block; font-size: 11.5px; font-weight: 500; color: var(--faint); }
.ring-caption { text-align: center; }
.budget-spent { display: flex; flex-direction: column; gap: 6px; }

/* ---------- email sync ---------- */

.page-head .status-pill { align-self: center; }
.account-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.g-avatar { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--line-tile); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.email-list { display: flex; flex-direction: column; }
.email-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border: none;
  border-top: 1px solid var(--divider);
  background: none;
  text-align: left;
  transition: background 0.2s;
}
.email-row:hover { background: rgba(244, 245, 247, 0.7); }
.bca-chip { width: 34px; height: 34px; border-radius: 10px; background: var(--chip); border: 1px solid var(--line-tile); color: var(--text-2); font-weight: 800; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
.email-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; }
.email-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.email-subject { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.email-line .status-pill { font-size: 10.5px; padding: 2px 7px; flex: none; }
.email-preview { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.3; font-size: 13px; }

/* ---------- dialogs, tooltip, toast ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line-tile);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(16, 18, 24, 0.14);
}
#email-dialog { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(18, 20, 24, 0.35); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop-in 0.3s var(--ease); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dialog-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.email-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.55 ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  background: var(--chip);
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0 0;
  max-height: 60vh;
  overflow: auto;
}

.form { display: flex; flex-direction: column; gap: 14px; }
.form .dialog-head { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 0; }
.field input, .field select, .amount-input {
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line-ctrl);
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus, .amount-input:focus-within { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--pink-tint); }
.field small { font-weight: 500; }
.link-inline { border: none; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--pink-text); cursor: pointer; }
.link-inline:hover { text-decoration: underline; }
.field input.mono { font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; text-transform: uppercase; }
.amount-input { display: flex; align-items: center; gap: 6px; }
.amount-prefix { color: var(--muted); font-weight: 600; }
.amount-input input { border: none; outline: none; box-shadow: none !important; height: 100%; padding: 0; text-align: right; font-variant-numeric: tabular-nums; flex: 1; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; align-items: center; gap: 12px; }
.field-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.budget-fields { display: flex; flex-direction: column; gap: 8px; max-height: 42vh; overflow: auto; padding: 2px 4px 2px 0; }
.form-section { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.form-error { color: var(--danger-text); font-size: 13px; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.tooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.tooltip strong { display: block; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(16, 18, 24, 0.2);
  max-width: calc(100vw - 32px);
  animation: toast-in 0.35s var(--bounce);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.is-error { background: var(--danger-text); }
.toast.is-out { opacity: 0; transform: translate(-50%, 10px); }

/* ---------- login ---------- */

/* dvh: on phones 100vh includes the space under the browser's toolbars, which hid the footer below them. */
.login-page { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: 1fr auto; min-height: 100vh; min-height: 100dvh; overflow: hidden; }
.login-glow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; }
.blob-pink { left: 23%; top: 20px; width: 640px; height: 560px; background: radial-gradient(ellipse at 50% 42%, rgba(255, 36, 128, 0.95), rgba(255, 36, 128, 0.55) 40%, rgba(255, 36, 128, 0) 70%); filter: blur(46px); animation: drift1 26s ease-in-out infinite alternate; }
.blob-orange { left: 26%; top: 300px; width: 580px; height: 440px; background: radial-gradient(ellipse at 50% 50%, rgba(255, 150, 80, 0.95), rgba(255, 170, 110, 0.5) 45%, rgba(255, 170, 110, 0) 72%); filter: blur(50px); animation: drift2 30s ease-in-out infinite alternate; }
.login-grain { position: absolute; inset: 0; opacity: 0.55; mix-blend-mode: multiply; background-image: var(--grain); }
.login-hero { position: relative; z-index: 1; padding: 56px 72px 24px; display: flex; flex-direction: column; min-width: 0; }
.wordmark-xl { font-size: 128px; letter-spacing: -0.05em; line-height: 1; }
/* Wave mark beside the wordmark, centred on the letters' x-height rather than the whole line box.
   The negative side margins take off the logo file's built-in margin (4.9% each side), so the row's
   edges are the ink's edges and the tagline (sized to the row in login.js) lines up with both ends. */
.login-brand { display: flex; align-items: center; gap: 34px; width: fit-content; }
.login-logo { flex: none; position: relative; top: 16px; width: 160px; height: auto; margin: 0 -8px; animation: rise 0.8s var(--ease) 120ms backwards; }
.tagline { width: fit-content; white-space: nowrap; margin-top: 10px; font-size: 22px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.3; animation: rise 0.8s var(--ease) 260ms backwards; }
/* Page footer below the sign-in card, across both columns; its right edge lines up with the card's. */
.login-foot {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  padding: 0 72px 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: rise 0.8s var(--ease) 340ms backwards;
}
.login-foot div { border-top: 1.5px solid var(--ink); padding-top: 10px; }
.login-side { position: relative; z-index: 1; display: flex; align-items: center; padding: 40px 72px 40px 0; }
.login-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
  border: 1px solid rgba(18, 20, 24, 0.08);
  border-radius: 26px;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 24px 60px rgba(16, 18, 24, 0.07);
  animation: rise 0.8s var(--ease) 220ms backwards;
}
.login-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.read-only-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pink-tint);
  color: var(--pink-text);
  font-size: 11.5px;
  font-weight: 700;
}
.read-only-pill .dot-pink { width: 6px; height: 6px; }
.login-card h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 46px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.25s var(--bounce), background 0.25s, color 0.25s;
}
.btn-google:hover { transform: scale(1.02); background: var(--ink); color: #fff; }
.btn-google:active { transform: scale(0.98); }
.g-circle { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--line-ctrl); display: inline-flex; align-items: center; justify-content: center; }
.login-note { font-size: 11.5px; color: #8a8f99; line-height: 1.5; text-wrap: pretty; }
.login-error { color: var(--danger-text); font-size: 13px; font-weight: 600; background: var(--danger-tint); border-radius: 12px; padding: 10px 12px; }
.login-lang { position: absolute; top: 24px; right: 24px; z-index: 2; }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes letter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dot { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-0.34em) scale(1.2); } 55% { transform: translateY(0) scale(0.9); } 70% { transform: translateY(-0.1em) scale(1); } }
@keyframes drift1 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(160px, 110px) scale(1.18); } 100% { transform: translate(40px, 200px) scale(1.05); } }
@keyframes drift2 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-140px, -120px) scale(1.12); } 100% { transform: translate(-60px, 40px) scale(0.96); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 46, 132, 0.45); } 70% { box-shadow: 0 0 0 8px rgba(255, 46, 132, 0); } }
@keyframes pulse-good { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 145, 46, 0.45); } 70% { box-shadow: 0 0 0 8px rgba(31, 145, 46, 0); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- tablet ---------- */

.tabbar { display: none; }

@media (max-width: 1100px) {
  .topbar { gap: 20px; }
  .nav { gap: 16px; }
  .t-spent { grid-column: span 7; }
  .t-ring { grid-column: span 5; }
  .t-heat, .t-cats { grid-column: span 6; }
  .t-review { grid-column: span 7; }
  .t-sync { grid-column: span 5; }
  .t-account, .t-stats { grid-column: span 6; }
  .t-types { grid-column: span 5; }
  .t-emails { grid-column: span 7; }
  .t-reread { grid-column: span 5; }
  .bento { grid-auto-flow: dense; }
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recent-row { grid-template-columns: minmax(0, 1fr) 170px 150px 120px; }
  .tx-row { grid-template-columns: minmax(0, 1fr) 110px 160px 120px 32px; }
  .hero-figure { font-size: 52px; }
}

@media (max-width: 900px) {
  .topbar .nav { display: none; }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 8px 6px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--divider);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); text-decoration: none; font-size: 10.5px; font-weight: 600; min-width: 0; text-align: center; line-height: 1.15; }
  .tabbar a.is-active { color: var(--ink); }
  .tabbar a.is-active::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--pink); }
  .tab-icon { display: inline-flex; }
  main { padding-bottom: 100px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three-grid { grid-template-columns: 1fr; }
}

/* ---------- phone ---------- */

@media (max-width: 760px) {
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .banner { width: calc(100% - 32px); }
  .topbar { margin-top: 12px; height: 48px; gap: 10px; }
  .wordmark { font-size: 18px; }
  .top-actions { gap: 8px; }
  .pill { height: 34px; padding: 0 12px; font-size: 12.5px; }
  .top-actions .lang-switch { display: none; }
  .avatar { width: 34px; height: 34px; font-size: 11.5px; }
  .period-pop { position: fixed; left: 16px; right: 16px; top: 68px; width: auto; }
  main { padding-top: 12px; }
  .page { gap: 14px; }

  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .bento > .tile { grid-column: span 2; border-radius: 22px; padding: 20px; }
  .bento > .t-ring, .bento > .t-sync { grid-column: span 1; padding: 16px; }
  .t-recent { padding: 6px 18px 4px; }
  .hero-figure { font-size: 40px; }
  .ring-wrap { width: 110px; height: 110px; }
  .ring-hole { inset: 11px; }
  .ring-pct { font-size: 24px; }
  .t-ring .btn { height: 34px; font-size: 12px; padding: 0 12px; }
  .t-sync .big-num { font-size: 28px; }
  .t-sync .kv-list { font-size: 12px; }
  .t-sync .btn { height: 34px; font-size: 12.5px; }
  .heat { gap: 4px; }
  .heat-cell { aspect-ratio: auto; height: 22px; border-radius: 5px; }
  .heat.is-dense .heat-cell { height: 12px; }
  .deck-pills .pill-btn:nth-child(n + 3) { display: none; }

  .recent-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; padding: 10px 0; font-size: 13.5px; }
  .recent-row > :nth-child(2) { grid-row: 2; grid-column: 1; font-size: 11.5px; padding-left: 38px; }
  .recent-row > :nth-child(3) { display: none; }
  .recent-row > :nth-child(4) { grid-row: 1 / 3; grid-column: 2; }

  .page-head h1 { font-size: 24px; }
  .page-actions { margin-left: 0; width: 100%; }
  .search-pill { flex: 1; width: auto; min-width: 0; }
  .chips-lg { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .chips-lg::-webkit-scrollbar { display: none; }
  .stat-num { font-size: 20px; }
  .t-stat { padding: 14px 16px; }

  .t-list { padding: 2px 16px 10px; }
  .tx-row { grid-template-columns: minmax(0, 1fr) auto 30px; row-gap: 2px; column-gap: 8px; }
  .tx-source { display: none; }
  .tx-main { grid-row: 1; grid-column: 1; }
  .tx-amount { grid-row: 1; grid-column: 2; }
  .tx-act { grid-row: 1 / 3; grid-column: 3; }
  .tx-cat { grid-row: 2; grid-column: 1 / 3; padding-left: 44px; }
  .cat-select { font-size: 12.5px; padding: 2px 8px; }

  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .t-cat { padding: 16px; }
  .figure-sm { font-size: 20px; }
  .cat-tile-foot .delta { display: none; }
  .t-wide, .t-rules { padding: 18px; }
  .rule-row { grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr) 30px; gap: 8px; }
  .rule-row > :nth-child(4) { display: none; }

  .figure-lg { font-size: 30px; }
  .t-table { padding: 8px 16px; }
  .budget-head { display: none; }
  .budget-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .budget-row > :nth-child(2), .budget-row > :nth-child(4) { display: none; }
  .budget-spent { grid-column: 1 / -1; grid-row: 2; }

  .t-stats .big-num { font-size: 28px; }
  .t-emails { padding: 14px 16px 8px; }
  .email-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
  .bca-chip { width: 30px; height: 30px; font-size: 9px; }
  .email-line .status-pill { display: none; }

  .dialog { padding: 18px; border-radius: 22px; }
  .field-row { grid-template-columns: minmax(0, 1fr) 150px; }

  .login-page { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; }
  .login-hero { padding: 76px 24px 0; } /* clears the language switch above the wordmark */
  .wordmark-xl { font-size: 76px; }
  .login-brand { gap: 19px; }
  .login-logo { top: 10px; width: 95px; margin: 0 -5px; }
  .tagline { font-size: 17px; }
  .login-foot { padding: 0 24px 28px; gap: 14px; font-size: 10.5px; }
  .login-side { padding: 28px 16px 24px; }
  .login-card { padding: 22px 20px 18px; }
  .blob-pink { left: -20%; }
  .blob-orange { left: -10%; top: 260px; }
}
