/* a segmented switch whose labels all share one size, lowered by app.js fitPeriodPills() when the longest doesn't fit */
.seg.fit button { font-size: var(--pill-fs, 12.5px) !important; text-overflow: clip !important; }
/* ==========================================================================
   Cozzi Finance — styled after the My Workout app: true black, layered dark
   cards, one lime accent, SF Pro (Apple system font) with tabular figures, pills and bottom sheets.
   ========================================================================== */
:root {
  --bg: #000;
  --surface: #0f0f0f;
  --card: #151515;
  --card-2: #1d1d1d;
  --card-3: #262626;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --muted: #8b8b8b;
  --dim: #5a5a5a;
  --accent: #fff;
  --on-accent: #000;
  --accent-soft: rgba(255, 255, 255, 0.13);
  --lime: #c8f03c;
  --lime-deep: #6f9a12;
  --lime-grad: linear-gradient(135deg, #e2ff7a 0%, #c8f03c 45%, #8dbb1c 100%);
  --lime-glow: rgba(200, 240, 60, 0.35);
  /* buttons and selected controls (dark mode): the sign-in screen's lime, near-black on top (light mode uses Forest green) */
  --btn: #c8f03c;
  --on-btn: #0b0b0b;
  --up: #c8f03c;
  --up-soft: rgba(200, 240, 60, 0.13);
  --down: #ff5b4a;
  --down-soft: rgba(255, 91, 74, 0.14);
  --blue: #c8f03c; /* transfers and conversions take the accent too */
  --blue-soft: rgba(200, 240, 60, 0.13);
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-guide: rgba(255, 255, 255, 0.35);
  --chart-line: #c8f03c;
  --radius: 24px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--text);
  /* SF Pro: Apple's system font on iPhone, iPad and Mac (and on any PC that has SF Pro installed).
     It can't be shipped as a web font, so other devices fall back to Inter, which is close to it. */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
  min-height: 100vh; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input, select, textarea { outline: none; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--btn); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* nothing can be text-selected or long-pressed into a copy menu; fields still work */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* ---------- shell ---------- */
.view {
  max-width: 480px; margin: 0 auto;
  padding: calc(var(--safe-top) + 30px) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 34px);
}
.view.enter { animation: viewIn 0.38s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
.stagger > * { animation: rise 0.5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 0.04s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.16s; }
.stagger > *:nth-child(n+6) { animation-delay: 0.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #3a3a3a, #161616); border: 1px solid var(--line-2);
  display: grid; place-items: center;
}
.avatar svg { height: 18px; fill: currentColor; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar { overflow: hidden; }
.avatar-btn { position: relative; overflow: visible; padding: 0; transition: transform 0.15s var(--ease); }
.avatar-btn img { border-radius: 50%; }
.avatar-btn:active { transform: scale(0.94); }
.avatar-cam {
  position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--btn); color: var(--on-btn); display: grid; place-items: center; border: 2px solid var(--bg);
}
.avatar-cam .i { width: 10px; height: 10px; }
.set-avatar { width: 40px; height: 40px; }
/* the Cozzi logo (no photo yet): black C on white */
.avatar-btn, .set-avatar, .avatar-big { background: #fff; color: #000; }
.set-avatar svg { height: 16px; }
.avatar-big {
  width: 132px; height: 132px; border-radius: 50%; margin: 18px auto 4px; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, #3a3a3a, #161616); border: 1px solid var(--line-2);
}
.avatar-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-big svg { height: 50px; fill: currentColor; }
.btn .i { width: 18px; height: 18px; }
.hello { color: var(--muted); font-size: 12.5px; }
.name { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text { min-width: 0; }
button.name { display: block; max-width: 100%; text-align: left; transition: opacity 0.15s; }
button.name:active { opacity: 0.55; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--down); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; }
.page-sub { color: var(--muted); font-size: 13px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, #1b1b1b 0%, #111 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, 0.06), transparent 60%);
}
.label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: var(--card-3); color: var(--muted);
}
.pill .i { width: 12px; height: 12px; stroke-width: 2.4; }
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.up { color: var(--up); } .down { color: var(--down); } .dimmed { color: var(--dim); }
.dec { color: var(--dim); }

.total { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 14px; }
.total .lbl { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
/* the small IDR | USD switch next to "Total cash" */
.seg.xs { padding: 2px; }
.seg.xs button { padding: 3px 9px; font-size: 11px; font-weight: 600; }
.seg.xs .thumb { top: 2px; bottom: 2px; }
.total .amt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

/* ---------- bank cards (Home hero) ---------- */
/* Each card snaps to the centre: equal space on both sides, the neighbour peeking in by the same amount. */
.cards {
  --peek: 20px; /* card edges line up with the content gutter */
  --gap: 12px;
  display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -20px; padding: 6px 0 18px; overscroll-behavior-x: contain; cursor: grab;
}
/* side space as real spacers, not padding: some iPhone Safari versions leave end padding out of the
   scroll range, so the last card could never reach the centre */
.cards::before, .cards::after { content: ""; flex: 0 0 calc(var(--peek) - var(--gap)); }
.cards::-webkit-scrollbar { display: none; }
.cards.dragging { scroll-snap-type: none; cursor: grabbing; }
.slot { flex: 0 0 calc(100% - 2 * var(--peek)); scroll-snap-align: center; perspective: 900px; }
.bank {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 30%;
  position: relative; aspect-ratio: 1.586; border-radius: 20px; padding: 18px 20px; overflow: hidden; isolation: isolate;
  display: grid; grid-template-rows: auto 1fr auto; color: #fff; width: 100%; text-align: left;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s, 1));
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), opacity 0.45s var(--ease);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.cards .slot:not(.is-active) .bank { --s: 0.94; opacity: 0.55; }
.bank.tilting { transition: transform 0.08s linear, box-shadow 0.45s var(--ease), opacity 0.45s var(--ease); }
.bank::before { /* light that follows the pointer */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 70% at var(--mx) var(--my), rgba(255, 255, 255, 0.16), transparent 60%); mix-blend-mode: soft-light;
}
.bank::after { /* brushed metal */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
}
/* One card design for every account; the owner picks the colour (--c) in Settings.
   Highlight, depth, border and glow are all mixed from that one colour. */
.bank {
  --c: #2457e8;
  background:
    radial-gradient(90% 120% at 105% -10%, color-mix(in srgb, color-mix(in srgb, var(--c) 40%, #fff) 50%, transparent), transparent 55%),
    radial-gradient(70% 90% at -10% 120%, color-mix(in srgb, color-mix(in srgb, var(--c) 35%, #000) 70%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  border: 1px solid color-mix(in srgb, color-mix(in srgb, var(--c) 40%, #fff) 30%, transparent);
}
.bank.is-light { color: #0b0b0b; }
.bank__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.bank__brand { display: flex; align-items: baseline; gap: 7px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; min-width: 0; white-space: nowrap; }
.bank__brand svg { height: 13px; fill: currentColor; transform: translateY(1px); flex: 0 0 auto; }
.bank__brand b { overflow: hidden; text-overflow: ellipsis; }
.bank__brand small { font-weight: 500; font-size: 11px; letter-spacing: 0.08em; opacity: 0.7; }
.bank__eye {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; margin: -8px -9px -8px 0;
  color: inherit; opacity: 0.85; transition: background 0.2s, opacity 0.2s, transform 0.15s var(--ease);
}
.bank__eye:hover { background: rgba(255, 255, 255, 0.14); opacity: 1; }
.bank.is-light .bank__eye:hover { background: rgba(0, 0, 0, 0.08); }
.bank__eye:active { transform: scale(0.88); }
.bank__eye .i { width: 19px; height: 19px; }
.chiprow { display: flex; align-items: center; gap: 10px; }
.contactless { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; opacity: 0.8; transform: rotate(90deg); }
.bank__mid { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-height: 0; }
.emv { width: 42px; height: 32px; border-radius: 7px; position: relative; overflow: hidden; flex: 0 0 auto;
  background: linear-gradient(135deg, #f4e3a1 0%, #d6b25e 40%, #b38b33 70%, #e9d38b 100%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.emv svg { position: absolute; inset: 0; width: 100%; height: 100%; stroke: rgba(80, 55, 10, 0.45); stroke-width: 1; fill: none; }
.bank__bal-lbl { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank__bal { font-size: clamp(22px, 7.2vw, 30px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; margin-top: 4px; white-space: nowrap; }
.bank__bal .cur { font-size: 0.55em; font-weight: 500; opacity: 0.75; margin-right: 4px; letter-spacing: 0; }
.bank__bal .dec { color: inherit; opacity: 0.45; }
.bank__bal.masked { letter-spacing: 0.08em; }
.bank__bot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-width: 0; }
.bank__bot > div { min-width: 0; }
.bank__num { font-size: 13px; letter-spacing: 0.18em; opacity: 0.85; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank__holder { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.network { width: 40px; height: 25px; flex: 0 0 auto; display: block; }
/* the crypto card names its network where the BCA card shows Mastercard */
.net-tag { width: auto; height: auto; padding: 4px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; color: inherit; border: 1px solid currentColor; opacity: 0.7; }

/* card editor (Settings) */
.card-preview { max-width: 340px; margin: 6px auto 4px; perspective: 900px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  position: relative; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; flex: 0 0 auto;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 60%, #000));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); transition: transform 0.15s var(--ease), box-shadow 0.2s;
}
.swatch:active { transform: scale(0.9); }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; border: 0; padding: 0; }
.swatch:has(input:checked), .swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--btn); outline-offset: 5px; }
.swatch.custom { background: conic-gradient(#ff3b30, #ffcc00, #34c759, #00c7be, #0040ff, #af52de, #ff3b30); }
.swatch.custom::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); pointer-events: none; }
.card-dot { width: 40px; height: 26px; border-radius: 6px; flex: 0 0 auto; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff), color-mix(in srgb, var(--c) 45%, #000)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.single-card { margin: 4px 0 18px; perspective: 900px; }

.dots { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
.dots button { width: 6px; height: 6px; border-radius: 99px; background: var(--card-3); transition: width 0.35s var(--ease), background 0.35s; }
.dots button[aria-current="true"] { width: 20px; background: var(--dot, var(--lime)); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; color: #ddd; text-align: center; }
/* rise in only when the page opens, not on every in-page update */
.view.enter .action { animation: rise 0.4s var(--ease) both; }
.view.enter .action:nth-child(2) { animation-delay: 0.04s; } .view.enter .action:nth-child(3) { animation-delay: 0.08s; } .view.enter .action:nth-child(4) { animation-delay: 0.12s; }
.action .btn-circ {
  width: 100%; height: 46px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line-2);
  display: grid; place-items: center; transition: transform 0.15s var(--ease), background 0.2s;
}
.action .btn-circ .i { width: 18px; height: 18px; stroke-width: 1.9; }
.action.primary .btn-circ { background: var(--btn); border-color: transparent; color: var(--on-btn); }
.action:active .btn-circ { transform: scale(0.92); }

/* ---------- sections ---------- */
.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 32px 2px 14px; gap: 10px; }
.sec-head h3 { margin: 0; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.sec-head .link { font-size: 14px; color: #eee; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.sec-head .link .i { width: 14px; height: 14px; stroke-width: 2; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { padding: 14px; display: grid; gap: 4px; container-type: inline-size; }
.stat .s-l { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat .s-l .i { width: 14px; height: 14px; }
/* sized to the tile so a 10-digit rupiah figure fits on one line */
.stat .s-v { font-weight: 600; font-size: clamp(13px, 11.5cqi, 18px); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s-c { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.feature { background: radial-gradient(110% 85% at 100% 0%, rgba(197, 255, 28, 0.42), transparent 62%), linear-gradient(180deg, #1c2208 0%, #101010 100%); border-color: rgba(200, 240, 60, 0.35); }

/* ---------- chart ---------- */
.chart-card { padding: 16px 0 10px; }
/* same lime glow as the Net profit card; the glow is shorter so it stays at the top of the taller card */
.chart-card { background: radial-gradient(110% 45% at 100% 0%, rgba(197, 255, 28, 0.42), transparent 62%), linear-gradient(180deg, #1c2208 0%, #101010 60%); border-color: rgba(200, 240, 60, 0.35); }
.chart-card .cc-head { padding: 0 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cc-val { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin: 10px 16px 0; }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--c); margin-right: 6px; vertical-align: 3px; }
.legend i.dash { border-top-style: dashed; }
.chart { height: 200px; margin-top: 8px; position: relative; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none;
  background: rgba(30, 30, 30, 0.7); color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); font-size: 11.5px; font-weight: 600;
  padding: 6px 9px; border-radius: 10px; white-space: nowrap; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transition: opacity 0.15s;
}
.chart .tip small { display: block; font-weight: 500; color: #aaa; font-size: 10.5px; }
.chart-path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.9s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-fill { opacity: 0; animation: fadeIn 0.6s 0.35s ease forwards; }
.chart.still .chart-path { animation: none; stroke-dashoffset: 0; }
.chart.still .chart-fill { animation: none; opacity: 1; }
@keyframes fadeIn { to { opacity: 1; } }

/* ---------- segmented control & chips ---------- */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px; position: relative; }
/* Accounts tab: BCA · PayPal · Crypto */
.acct-switch { margin: 2px 0 16px; }
.acct-seg button { padding: 9px 10px; font-size: 13.5px; font-weight: 600; }
.seg button { flex: 1; padding: 7px 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); border-radius: 99px; position: relative; z-index: 1; transition: color 0.25s; white-space: nowrap; text-align: center; }
.seg button.on { color: var(--on-btn); }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 99px; background: var(--btn); transition: left 0.42s var(--spring), width 0.42s var(--spring); }
/* after a tap the page is rebuilt, so the label colours fade here instead of through the button's transition */
.seg button.seg-in { animation: segIn 0.3s ease both; }
.seg button.seg-out { animation: segOut 0.3s ease both; }
@keyframes segIn { from { color: var(--muted); } }
@keyframes segOut { from { color: var(--on-btn); } }
.seg.sm button { padding: 5px 9px; font-size: 11.5px; }
.picker-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px; scrollbar-width: none; }
.picker-row::-webkit-scrollbar { display: none; }
.picker-row.home-periods { margin-bottom: 12px; }
.picker-row::after { content: ""; flex: 0 0 6px; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 500; white-space: nowrap;
  background: var(--card); border: 1px solid var(--line); color: #cfcfcf; transition: background 0.2s, color 0.2s, transform 0.15s;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--btn); color: var(--on-btn); border-color: transparent; }
/* the chip just tapped fills in and springs; the content it changed rises in */
.chip.pop { animation: chipPop 0.38s var(--ease); }
.chip.on.pop { animation: chipPop 0.38s var(--ease), chipFill 0.3s ease; }
@keyframes chipPop { 0% { transform: scale(0.9); } 55% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes chipFill { from { background: var(--card); color: #cfcfcf; } }
.swap-in { animation: swapIn 0.48s var(--spring) both; }
.stats.swap-in { animation-delay: 0.02s; }
@keyframes swapIn { from { opacity: 0; transform: translateY(8px); } }
.filters { display: grid; gap: 10px; margin: 18px 0 6px; }
.search { position: relative; }
.search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--dim); pointer-events: none; }
.search .field { padding-left: 40px; height: 44px; border-radius: 99px; background: var(--card); border-color: var(--line); }

/* ---------- list rows (watchlist style) ---------- */
.panel { padding: 4px 14px; }
.list { display: flex; flex-direction: column; }
.group-head { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; font-weight: 500; padding: 16px 2px 2px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 2px;
  border-bottom: 1px solid var(--line); width: 100%; text-align: left;
  transition: transform 0.15s var(--ease);
}
.list > .row:last-child, .list > :last-child .row { border-bottom: 0; }
.row:active { transform: scale(0.985); }
.r-main { flex: 1; min-width: 0; }
.r-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-sub { color: var(--dim); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-right { text-align: right; flex: 0 0 auto; }
.r-val { font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.r-chg { font-size: 11.5px; margin-top: 2px; color: var(--dim); white-space: nowrap; }
.mono {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; background: #000; border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -0.02em;
}
.mono .i { width: 18px; height: 18px; }
.mono.in { background: var(--up-soft); color: var(--up); border-color: transparent; }
.mono.out { background: var(--down-soft); color: var(--down); border-color: transparent; }
.mono.move { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.mono.accent { background: var(--btn); color: var(--on-btn); border-color: transparent; }
/* transaction and event rows: just the symbol in its tone colour (the client list keeps its initials) */
.row .mono:not(.initials) { background: none; border: 0; border-radius: 0; width: 28px; }
.row .mono:not(.initials) .i { width: 22px; height: 22px; }
.row .mono.accent:not(.initials) { color: var(--btn); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--card-3); color: var(--muted); font-weight: 500; margin-left: 6px; vertical-align: 1px; }
.empty { color: var(--muted); text-align: center; padding: 28px 16px; font-size: 13.5px; }
.empty b { color: var(--text); display: block; font-size: 15px; margin-bottom: 4px; }
.empty .btn { width: fit-content; display: flex; padding: 0 20px; margin: 16px auto 0; } /* its own line, centred under the text */

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px; }
.cal-head .m { font-weight: 600; font-size: 16px; }
.cal-head .nav { display: flex; gap: 6px; }
.cal-head .mini-btn { width: 36px; height: 36px; border-radius: 50%; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px 10px 14px; }
.cal-grid .wd { text-align: center; font-size: 11px; color: var(--dim); padding: 6px 0; }
/* changing month: the days slide in from the side you moved towards, the weekday letters stay put */
.cal-grid.slide-next .day { animation: calNext 0.46s var(--spring) both; }
.cal-grid.slide-prev .day { animation: calPrev 0.46s var(--spring) both; }
@keyframes calNext { from { opacity: 0; transform: translateX(28px); } }
@keyframes calPrev { from { opacity: 0; transform: translateX(-28px); } }
.day.pop { animation: dayPop 0.36s var(--spring); }
.cal-grid.slide-next .day.pop { animation: calNext 0.46s var(--spring) both; }
.cal-grid.slide-prev .day.pop { animation: calPrev 0.46s var(--spring) both; }
@keyframes dayPop { 40% { transform: scale(0.88); } }
.day {
  aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13.5px; position: relative; transition: background 0.2s, transform 0.15s;
}
.day:active { transform: scale(0.9); }
.day.out { color: #333; }
.day .dd { display: flex; gap: 3px; height: 5px; }
.day .dd i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.day.has { background: var(--accent-soft); font-weight: 600; }
.day.today { box-shadow: inset 0 0 0 1.5px #fff; }
.day.today:not(.sel) { animation: todayGlow 2.4s ease-in-out infinite; }
@keyframes todayGlow { 50% { box-shadow: inset 0 0 0 1.5px #fff, 0 0 18px -4px rgba(200, 240, 60, 0.55); } }
.day.sel { background: var(--btn); color: var(--on-btn); font-weight: 600; }
.day.sel .dd i { background: var(--on-btn); }
.day.today.sel { box-shadow: none; } /* the blue fill already marks it; no outline on top */
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; margin: 10px 4px 0; }
.legend-row i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--c); }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; border-radius: 99px; font-weight: 600; font-size: 15px; width: 100%;
  background: var(--btn); color: var(--on-btn); transition: transform 0.15s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--line-2); }
.btn.danger { background: var(--down-soft); color: var(--down); }
.btn.sm { height: 40px; font-size: 13.5px; }
.btn .i { width: 18px; height: 18px; stroke-width: 2; }
.mini-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); background: var(--card-2); flex: 0 0 auto; transition: transform 0.15s; }
.mini-btn .i { width: 16px; height: 16px; stroke-width: 1.9; }
.mini-btn:active { transform: scale(0.9); }

/* ---------- tab bar (phone) ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 max(12px, calc((100% - 480px) / 2 + 12px)) var(--safe-bottom);
  display: flex; align-items: center; gap: 4px; background: #000; border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1 1 0; min-width: 0; height: 44px; border-radius: 14px; position: relative;
  display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.5); transition: color 0.25s;
}
.tabbar button > span:not(.fab) { display: none; } /* icons only; names stay as aria-labels */
.tabbar .i { width: 22px; height: 22px; transition: transform 0.3s var(--ease); }
.tabbar button.active { color: #fff; }
.tabbar button.active .i { stroke: var(--btn); }
.tabbar button:active .i { transform: scale(0.88); }
.tabbar .tab-center { flex: 0 0 auto; width: 60px; }
.tabbar .fab { width: 58px; height: 40px; border-radius: 99px; display: grid; place-items: center; background: var(--btn); color: var(--on-btn); transition: transform 0.2s var(--ease); }
.tabbar .fab .i { width: 20px; height: 20px; stroke: var(--on-btn); stroke-width: 2.2; }
.tabbar .tab-center:active .fab { transform: scale(0.9); }

/* ---------- sheets ---------- */
/* a sheet is open: the page is pinned where it was (its offset is set inline as top) */
html.sheet-open, html.sheet-open body { overflow: hidden; overscroll-behavior: none; }
html.sheet-open body { position: fixed; left: 0; right: 0; width: 100%; }
.backdrop { touch-action: none; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 40; animation: fadeIn 0.25s ease forwards; opacity: 0; }
.backdrop.out { animation: fadeOut 0.22s ease forwards; }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 480px; z-index: 41;
  background: rgba(20, 20, 20, 0.7); border: 1px solid var(--line-2); border-bottom: 0;
  /* popups are 30% see-through, and so is every box inside them (fields, toggles, summaries, choices) */
  --card: rgba(21, 21, 21, 0.7); --card-2: rgba(29, 29, 29, 0.7); --card-3: rgba(38, 38, 38, 0.7);
  backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-radius: 26px 26px 0 0; padding: 10px 16px calc(var(--safe-bottom) + 18px);
  max-height: 90vh; max-height: 90dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  touch-action: pan-y; /* scrolls up and down only: it can't be dragged sideways */
  transform: translate(-50%, 100%); animation: sheetIn 0.38s var(--ease) forwards;
}
.sheet.out { animation: sheetOut 0.26s ease-in forwards; }
@keyframes sheetIn { to { transform: translate(-50%, 0); } }
@keyframes sheetOut { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 100%); } }
.grab { width: 38px; height: 4px; border-radius: 4px; background: #3a3a3a; margin: 0 auto; transition: background 0.2s, width 0.2s; }
/* a full-width strip around the handle that's easy to grab and drag down; the page doesn't scroll from it */
.grab-zone { margin: -10px -16px 4px; padding: 12px 0 10px; touch-action: none; cursor: grab; }
.grab-zone:active { cursor: grabbing; }
.grab-zone:active .grab { width: 46px; background: #5a5a5a; }
.sheet h2 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.sheet .btns { display: flex; gap: 8px; margin-top: 20px; }
.sheet .btns .btn.danger { flex: 0 0 auto; width: 52px; }
.field {
  width: 100%; height: 50px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-2);
  padding: 0 14px; font-size: 16px; transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.field { height: auto; min-height: 72px; padding: 12px 14px; resize: vertical; }
select.field { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8b8b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field:focus { border-color: #666; }
.field.err { border-color: var(--down); }
.field-label { font-size: 12px; color: var(--muted); margin: 14px 2px 6px; display: block; }
.field-err { color: var(--down); font-size: 12px; margin: 6px 2px 0; }
.field-hint { color: var(--dim); font-size: 11.5px; margin: 6px 2px 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.grid2 > * { min-width: 0; } /* a wide field can't push its column (and the sheet) wider */
/* Date fields: iPhones give them their own width and centred text, which overflowed the sheet.
   Pin them to the column like every other field. */
.field[type="date"], .field[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
/* without the iPhone's own date styling the value sits at the top of the box: a line height filling the field
   (50px minus the two 1px borders) centres it like the text in every other field */
.field[type="date"], .field[type="time"] { line-height: 48px; padding-top: 0; padding-bottom: 0; }
.field[type="date"]::-webkit-date-and-time-value, .field[type="time"]::-webkit-date-and-time-value { line-height: 48px; min-height: 48px; }
.field[type="date"]::-webkit-date-and-time-value, .field[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.6; }
.affix { position: relative; }
.affix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: 14px; pointer-events: none; }
.affix > span.post { left: auto; right: 14px; font-weight: 500; }
.affix .field { padding-left: 40px; font-weight: 600; }
.affix.wide .field { padding-left: 52px; }
.affix.wider .field { padding-left: 64px; }
.money-big .field { height: 64px; font-size: 26px; letter-spacing: -0.02em; border-radius: 18px; padding-left: 52px; }
.money-big > span { font-size: 18px; left: 18px; }
.affix.money-big.wide .field { padding-left: 66px; }
.affix.money-big.wider .field { padding-left: 82px; }
.calc { margin-top: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); padding: 12px 14px; display: grid; gap: 7px; }
.calc div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.calc b { color: var(--text); font-weight: 600; }
.calc .tot { border-top: 1px solid var(--line); padding-top: 9px; font-size: 14.5px; color: var(--text); }
.calc .tot b { font-size: 16px; }
.calc b.up { color: var(--up); } .calc b.down { color: var(--down); }
.calc p { margin: 2px 0 0; color: var(--dim); font-size: 11.5px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; width: 100%; text-align: left; margin-top: 8px; }
.check-row .box { width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid #444; display: grid; place-items: center; transition: all 0.2s var(--ease); flex: 0 0 auto; }
.check-row .box .i { width: 14px; height: 14px; stroke: var(--on-btn); stroke-width: 3; opacity: 0; transform: scale(0.5); transition: all 0.2s var(--ease); }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-row:has(input:checked) .box { background: var(--btn); border-color: transparent; }
.check-row:has(input:checked) .box .i { opacity: 1; transform: none; }
.check-row:has(input:focus-visible) .box { outline: 2px solid var(--btn); outline-offset: 2px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.choice { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); text-align: left; transition: transform 0.15s var(--ease), border-color 0.2s; }
.choice:active { transform: scale(0.97); }
.choice .mono { background: none; border: 0; border-radius: 0; width: 24px; height: 24px; } /* just the symbol, in its tone colour */
.choice .mono .i { width: 22px; height: 22px; }
.choice .mono.accent { background: none; color: var(--btn); }
.choice b { font-size: 14px; }
.choice small { color: var(--dim); font-size: 11.5px; display: block; margin-top: 2px; }
.choice-sec { color: var(--muted); font-size: 12px; margin: 16px 2px 0; }
.info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.info div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.info dt { color: var(--dim); font-size: 11.5px; }
.info dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.info a { color: var(--lime); text-decoration: none; }

/* ---------- settings ---------- */
.set-list { padding: 0 14px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.set-row:last-child { border-bottom: 0; }
.set-row .mono { background: none; border: 0; border-radius: 0; } /* settings rows: just the symbol, same footprint so titles line up */
.set-row .mono .i { width: 20px; height: 20px; }
.set-row .r-main { flex: 1; }
.set-row .chev { color: var(--dim); }
.set-row.danger .r-title { color: var(--down); }
.toggle { width: 48px; height: 28px; border-radius: 99px; background: var(--card-3); position: relative; flex: 0 0 auto; transition: background 0.25s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.3s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.toggle.on { background: var(--btn); }
.toggle.on::after { transform: translateX(20px); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.sync.pending i { background: #f5b83d; animation: pulse 1.2s ease-in-out infinite; }
.sync.offline i { background: var(--dim); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); z-index: 90;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: rgba(30, 30, 30, 0.7); color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); font-weight: 600; font-size: 13.5px; padding: 10px 16px; border-radius: 99px; /* 30% see-through, like the popups */
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  transition: transform 0.35s var(--ease), opacity 0.3s; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { color: var(--down); }

/* ---------- sign-in screen ---------- */
.no-session #shell, .no-session .tabbar { visibility: hidden; }
html.no-session, html.no-session body { overflow: hidden; }
.login {
  position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; overscroll-behavior: none; scrollbar-width: none;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
  transition: opacity 0.35s ease, transform 0.35s var(--ease);
}
.login::-webkit-scrollbar { display: none; }
.login.out { opacity: 0; transform: scale(1.03); pointer-events: none; }
.lg { width: 100%; max-width: 400px; margin: auto 0; padding: 28px 0; animation: lgIn 0.45s var(--ease) both; } /* auto margins centre it without clipping on short screens */
.lg-logo { flex: 0 0 auto; margin-top: 28px; animation: lgIn 0.45s var(--ease) both; }
.lg-logo svg { height: 20px; width: auto; fill: #fff; display: block; }
.lg-h1 { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.lg-legal { flex: 0 0 auto; max-width: 340px; text-align: center; color: #5f5f5f; font-size: 11.5px; line-height: 1.55; margin: 0; }
@keyframes lgIn { from { opacity: 0; transform: translateY(12px); } }
.lg-sub { text-align: center; color: #8b8b8b; font-size: 14px; margin: 10px 0 28px; }
.lg-label { display: block; font-size: 14px; font-weight: 600; color: #fff; margin: 0 0 8px; }
.lg-form > .lg-field, .lg-form > .pw { margin-bottom: 18px; }
.lg-field {
  width: 100%; height: 42px; border-radius: 8px; padding: 0 12px; font-size: 16px; color: #fff; /* under 16px, iPhones zoom in when a field is tapped */
  background: #1c1c1e; border: 1px solid rgba(255, 255, 255, 0.07);
}
.lg-field:focus, .lg-field:focus-visible { outline: none; box-shadow: none; border-color: rgba(255, 255, 255, 0.07); }
.pw { position: relative; }
.pw .lg-field { padding-right: 46px; }
.pw-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; color: #9a9a9a; border-radius: 8px; }
.pw-eye .i { width: 18px; height: 18px; }
.login-err { color: var(--down); font-size: 13px; margin: -6px 2px 12px; }
.login-err:empty { display: none; }
.lg-btn {
  width: 100%; height: 42px; border-radius: 8px; background: var(--btn); color: var(--on-btn); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, opacity 0.15s, transform 0.12s var(--ease);
}
.lg-btn:hover { background: #1a55ff; }
.lg-btn:active { transform: scale(0.98); }
.lg-btn:disabled { opacity: 0.6; }
.lg-btn.ghost { margin-top: 12px; background: #fff; color: #000; border: 0; }
.lg-btn.ghost:hover { background: #e8e8e8; }
.lg-btn .i { width: 18px; height: 18px; }
.shake { animation: shake 0.4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.muted { color: var(--muted); }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; }

/* ==========================================================================
   Light mode
   ========================================================================== */
html[data-theme="light"] {
  --bg: #f4f4f5; --surface: #fafafa; --card: #fff; --card-2: #f0f0f2; --card-3: #e6e6ea;
  --line: rgba(0, 0, 0, 0.08); --line-2: rgba(0, 0, 0, 0.13);
  --text: #0b0b0b; --muted: #6b6b72; --dim: #9b9ba2;
  --accent: #0b0b0b; --on-accent: #fff; --accent-soft: rgba(0, 0, 0, 0.06);
  /* a deeper lime than dark mode's, so it reads on white */
  --up: #3a7000; --up-soft: rgba(100, 160, 0, 0.16); --down: #d63a2a; --down-soft: rgba(214, 58, 42, 0.1);
  --lime: #6a9e00;
  --blue: #1f5fe0; --blue-soft: rgba(31, 95, 224, 0.1);
  --chart-grid: rgba(0, 0, 0, 0.07); --chart-guide: rgba(0, 0, 0, 0.3); --chart-line: #4f8500;
  color-scheme: light;
}
html[data-theme="light"] .card { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .card::before { display: none; }
/* buttons, pills and fields on the page use the same near-black, so everything matches */
.action:not(.primary) .btn-circ, .icon-btn:not(.conv-swap), .chip:not(.on), .seg, .search .field, .mini-btn { background: var(--panel); border-color: var(--panel-line); }
html[data-theme="light"] .stat.feature { background: radial-gradient(110% 85% at 100% 0%, rgba(140, 205, 0, 0.42), transparent 62%), #f8fcec; border-color: rgba(95, 145, 0, 0.5); }
html[data-theme="light"] .chart-card { background: radial-gradient(110% 45% at 100% 0%, rgba(140, 205, 0, 0.42), transparent 62%), #f8fcec; border-color: rgba(95, 145, 0, 0.5); }
html[data-theme="light"] .avatar, html[data-theme="light"] .avatar-big { background: linear-gradient(135deg, #ececef, #d9d9de); color: #0b0b0b; }
html[data-theme="light"] .action { color: #333; }
html[data-theme="light"] .sec-head .link { color: #222; }
html[data-theme="light"] .mono { background: #fff; }
html[data-theme="light"] .set-row .mono { background: none; }
html[data-theme="light"] .choice .mono { background: none; }
html[data-theme="light"] .chip:not(.on) { color: #333; }
html[data-theme="light"] .day.out { color: #c6c6cc; }
html[data-theme="light"] .day.today:not(.sel) { box-shadow: inset 0 0 0 1.5px #0b0b0b; }
html[data-theme="light"] .btn.ghost { color: var(--text); }
html[data-theme="light"] .check-row .box { border-color: #bbb; }
html[data-theme="light"] .grab { background: #c8c8cd; }
html[data-theme="light"] .grab-zone:active .grab { background: #a8a8ae; }
html[data-theme="light"] .backdrop { background: rgba(0, 0, 0, 0.3); }
html[data-theme="light"] .sheet { background: rgba(255, 255, 255, 0.7); --card: rgba(255, 255, 255, 0.7); --card-2: rgba(240, 240, 242, 0.7); --card-3: rgba(230, 230, 234, 0.7); }
html[data-theme="light"] .tabbar { background: #fff; }
html[data-theme="light"] .tabbar button { color: rgba(0, 0, 0, 0.42); }
html[data-theme="light"] .tabbar button.active { color: #0b0b0b; }
html[data-theme="light"] .chart .tip { background: rgba(255, 255, 255, 0.7); color: #0b0b0b; border-color: rgba(0, 0, 0, 0.1); }
html[data-theme="light"] .chart .tip small { color: #6b6b72; }
html[data-theme="light"] .toast { background: rgba(255, 255, 255, 0.7); color: #0b0b0b; border-color: rgba(0, 0, 0, 0.1); }
html[data-theme="light"] .info a { color: var(--up); }
/* the bank cards and passcode screen keep their own colours in both modes */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
html[data-theme="light"] .avatar-btn, html[data-theme="light"] .set-avatar, html[data-theme="light"] .avatar-big { background: #fff; color: #000; border-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .row .mono:not(.initials) { background: none; }
.bank__bal, .total .amt, .stat .s-v, .cc-val, .r-val { font-variant-numeric: tabular-nums; }
.unlock-pk { margin-top: 14px; height: 46px; }
/* no visible page scrollbar on any page (scrolling still works), like the calendar */
html, body { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; }
/* hiding balances: the numbers blur away and *** blurs in (and back the other way when shown) */
.hiding { filter: blur(7px); opacity: 0.2; transition: filter 0.2s ease, opacity 0.2s ease; }
.mask-in { animation: maskIn 0.42s var(--ease) both; }
@keyframes maskIn { from { filter: blur(7px); opacity: 0; transform: translateY(4px); } }
/* a summary-card label or subtitle a filter just changed: fades in place, the card itself stays still */
.text-swap { animation: textSwap 0.42s var(--spring) both; }
@keyframes textSwap { from { opacity: 0; filter: blur(3px); } }
/* pull to refresh: the page slides down and a plain spinning ring shows in the gap above it */
/* the page keeps the phone's own edge bounce; only a pull-down at the top is taken over (in app.js) */
.view.pulling { will-change: transform; }
.ptr {
  --y: 0px; --o: 0; --r: 0deg;
  position: fixed; left: 50%; top: var(--safe-top); z-index: 5; width: 26px; height: 26px; margin-left: -13px;
  pointer-events: none; opacity: var(--o); transform: translate3d(0, var(--y), 0); will-change: transform, opacity;
}
.ptr-ring {
  display: block; width: 100%; height: 100%; border-radius: 50%; box-sizing: border-box;
  border: 2.5px solid color-mix(in srgb, var(--text) 18%, transparent); border-top-color: var(--text);
  transform: rotate(var(--r));
}
.ptr.ready .ptr-ring { border-top-color: var(--text); border-right-color: var(--text); }
.ptr.spin .ptr-ring { animation: ptrSpin 0.7s linear infinite; }
/* spinning carries on from the angle the pull left it at, so it never snaps back to the top */
@keyframes ptrSpin { from { transform: rotate(var(--r)); } to { transform: rotate(calc(var(--r) + 360deg)); } }

/* ---------- quick currency converter ---------- */
.conv { display: grid; gap: 14px; margin-top: 16px; }
.conv-amt { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.conv-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.conv-pair > div { min-width: 0; }
.conv-pair select { width: 100%; }
.conv-swap { width: 44px; height: 44px; margin-bottom: 2px; flex: none; background: var(--btn); color: var(--on-btn); border-color: transparent; position: relative; z-index: 1; }
.conv-swap .i { transform: rotate(0deg); }
.conv-swap.spin .i { animation: convSpin 0.42s var(--spring); }
@keyframes convSpin { from { transform: rotate(-180deg); } to { transform: rotate(0deg); } }
.conv-out { border-radius: 16px; background: var(--card); border: 1px solid var(--line); padding: 14px; }
.conv-res { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.conv-rate { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.conv .calc { margin-top: 0; }

/* the converter keeps one size whatever it shows (result, PayPal estimate, or the country list) */
.sheet.conv-sheet { height: min(668px, 90dvh); display: flex; flex-direction: column; overflow: hidden; }
.conv-main, .conv-pickpane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conv-main[hidden], .conv-pickpane[hidden] { display: none; }
.conv-main { overflow-y: auto; overscroll-behavior: contain; }
.conv-main .btns { margin-top: auto; padding-top: 12px; }
.conv-main.slide-back { animation: convBack 0.32s var(--spring); }
.conv-pickpane.slide-in { animation: convIn 0.32s var(--spring); }
@keyframes convIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes convBack { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.conv-cur { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.conv-cur .conv-code { flex: 1; font-weight: 600; }
.conv-cur .i { width: 16px; height: 16px; color: var(--muted); flex: none; }
.conv-names { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.pick-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pick-title { font-size: 17px; font-weight: 600; }
.conv-pickpane .search { margin-bottom: 8px; }
.pick-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px 8px; }
.pick-sec { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 4px 6px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px; border-radius: 14px; }
.pick-row:active, .pick-row.on { background: var(--card-2); }
.pick-txt { flex: 1; min-width: 0; display: grid; }
.pick-txt b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-code { color: var(--muted); font-size: 12.5px; font-weight: 600; flex: none; }
.pick-row.on .pick-code { color: var(--up); }
.pick-code .i { width: 18px; height: 18px; }
.pick-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 30px 10px; }

/* converter: a newly picked currency pops in; the PayPal estimate eases in and out */
.conv-cur { position: relative; }
.conv-cur.conv-pop { animation: convPop 0.42s var(--spring); }
@keyframes convPop { 0% { transform: scale(0.94); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
.calc.pp-in { animation: ppIn 0.42s var(--spring) both; }
.calc.pp-out { animation: ppOut 0.22s ease-in both; }
@keyframes ppIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes ppOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- stat cards: tap to open full screen ---------- */
.stat[data-act="stat"] { cursor: pointer; transition: transform 0.18s var(--ease); -webkit-tap-highlight-color: transparent; }
.stat[data-act="stat"]:active { transform: scale(0.97); }
.sf { position: fixed; inset: 0; z-index: 30; will-change: clip-path; }
.sf-bg { position: absolute; inset: 0; background: linear-gradient(180deg, #1b1b1b 0%, #0b0b0b 60%, #000 100%); }
.sf-bg.feature { background: radial-gradient(120% 50% at 100% 0%, rgba(197, 255, 28, 0.32), transparent 62%), linear-gradient(180deg, #1c2208 0%, #0b0b0b 55%, #000 100%); }
html[data-theme="light"] .sf-bg { background: #f4f4f6; }
html[data-theme="light"] .sf-bg.feature { background: radial-gradient(120% 50% at 100% 0%, rgba(140, 205, 0, 0.32), transparent 62%), #f4f6ee; }
.sf-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sf-in { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 32px); }
.sf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sf-l { font-size: 15px; font-weight: 600; display: grid; gap: 2px; padding-top: 4px; }
.sf-l span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.sf-v { font-size: clamp(26px, 9vw, 40px); font-weight: 700; letter-spacing: -0.03em; margin-top: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sf-cmp { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sf-cmp span { font-weight: 600; }
.picker-row.sf-periods { margin-top: 16px; }
.sf .sec-head { margin-top: 26px; }
.sf-chart { padding: 14px 12px 8px; }
.sfc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 4px; font-size: 12.5px; color: var(--muted); }
.sfc-head b { color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sfc-head b.down { color: var(--down); } .sfc-head b.up { color: var(--up); }
.sfc { height: 180px; margin-top: 8px; touch-action: pan-y; cursor: pointer; }
.sfc svg { width: 100%; height: 100%; overflow: visible; display: block; }
.sfc .bar { fill: var(--chart-line); opacity: 0.38; transition: opacity 0.2s; transform-box: fill-box; transform-origin: 50% 100%; animation: barUp 0.62s var(--spring) both; }
.sfc .bar.neg { fill: var(--down); }
.sfc .bar.below { transform-origin: 50% 0%; }
.sfc .bar.on { opacity: 1; }
.sfc.still .bar { animation: none; }
@keyframes barUp { from { transform: scaleY(0); } }
.sf-calc { margin-top: 0; }
.sf-parts { padding: 14px; display: grid; gap: 12px; }
.sfp-t { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.sfp-t span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfp-t b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sfp-t b.down { color: var(--down); }
.sfp-bar { height: 5px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.sfp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--chart-line); transform-origin: 0 50%; animation: barGrow 0.7s var(--spring) both; }
.sfp-bar i.neg { background: var(--down); }
@keyframes barGrow { from { transform: scaleX(0); } }
.sf-more { width: 100%; margin-top: 10px; }
.sf-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 28px 10px; }

/* ==========================================================================
   Flat panels: every card and panel is one solid dark colour, the same as the
   round action buttons on Home (no see-through, no blur, no shading)
   ========================================================================== */
:root { --panel: #111111; --panel-line: rgba(255, 255, 255, 0.1); }
html[data-theme="light"] { --panel: #fff; --panel-line: rgba(0, 0, 0, 0.08); }

/* the full-screen stat card: the same solid background */
.sf-bg { background: var(--bg) !important; }
.sf-bg.feature::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 50% at 100% 0%, var(--hi-glow), transparent 62%); }

.card, html[data-theme="light"] .card { background: var(--panel); border: 1px solid var(--panel-line); box-shadow: none; }
.card::before { display: none; }
/* the highlight cards keep their glow on the same flat colour */
.stat.feature, html[data-theme="light"] .stat.feature { background: radial-gradient(110% 85% at 100% 0%, var(--hi-glow), transparent 62%), var(--panel); border-color: var(--hi-line); }
.chart-card, html[data-theme="light"] .chart-card { background: radial-gradient(110% 45% at 100% 0%, var(--hi-glow), transparent 62%), var(--panel); border-color: var(--hi-line); }

/* ==========================================================================
   The two signal colours, picked in Settings → Colours.
   --hi: highlights & money in (default lime) · --lo: expenses & losses (default coral)
   Everything green or red in the app is mixed from these two.
   ========================================================================== */
:root {
  --hi: #c8f03c; --lo: #ff5b4a;
  --up: var(--hi); --up-soft: color-mix(in srgb, var(--hi) 13%, transparent);
  --down: var(--lo); --down-soft: color-mix(in srgb, var(--lo) 14%, transparent);
  --lime: var(--hi); --chart-line: var(--hi); --lime-glow: color-mix(in srgb, var(--hi) 35%, transparent);
  --hi-glow: color-mix(in srgb, var(--hi) 30%, transparent);
  --hi-tint: color-mix(in srgb, var(--hi) 6%, transparent);
  --hi-line: color-mix(in srgb, var(--hi) 38%, transparent);
}
/* light mode has its own pair (picked for white), used exactly as chosen */
html[data-theme="light"] {
  --up: var(--hi); --up-soft: color-mix(in srgb, var(--hi) 14%, transparent);
  --down: var(--lo); --down-soft: color-mix(in srgb, var(--lo) 10%, transparent);
  --lime: var(--hi); --chart-line: var(--hi);
  --hi-glow: color-mix(in srgb, var(--hi) 32%, transparent);
  --hi-tint: color-mix(in srgb, var(--hi) 8%, transparent);
  --hi-line: color-mix(in srgb, var(--hi) 45%, transparent);
}

/* Settings → Colours */
.tone-dots { display: inline-flex; gap: 4px; margin-right: 6px; }
.tone-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.tone-prev { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 18px; padding: 10px; border-radius: 22px; background: #000; color: #fff; border: 1px solid var(--line-2); transition: background 0.3s, color 0.3s; }
.tp-card { border-radius: 18px; padding: 12px; border: 1px solid color-mix(in srgb, var(--hi) 38%, transparent);
  background: radial-gradient(110% 85% at 100% 0%, color-mix(in srgb, var(--hi) 30%, transparent), transparent 62%), #111; }
.tp-card.plain { background: #111; border-color: rgba(255, 255, 255, 0.1); }
.tp-l { color: #8b8b8b; font-size: 11.5px; }
.tp-v { font-weight: 600; font-size: 14px; margin: 3px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.tp-up { color: var(--hi); } .tp-down { color: var(--lo); }
.tp-pill-up { color: var(--hi); background: color-mix(in srgb, var(--hi) 14%, transparent); }
.tp-pill-down { color: var(--lo); background: color-mix(in srgb, var(--lo) 14%, transparent); }
.tp-rows { grid-column: 1 / -1; border-radius: 16px; background: #111; border: 1px solid rgba(255, 255, 255, 0.1); padding: 10px 12px; display: grid; gap: 6px; font-size: 13px; }
.tp-rows div { display: flex; justify-content: space-between; gap: 10px; }
.tp-rows span { color: #8b8b8b; }
.tp-rows b { font-weight: 600; }
.tone-prev.as-light { background: #f4f4f5; color: #0b0b0b; border-color: rgba(0, 0, 0, 0.1); }
.tone-prev.as-light .tp-card { background: radial-gradient(110% 85% at 100% 0%, color-mix(in srgb, var(--hi) 32%, transparent), transparent 62%), #fff; border-color: color-mix(in srgb, var(--hi) 45%, transparent); }
.tone-prev.as-light .tp-card.plain, .tone-prev.as-light .tp-rows { background: #fff; border-color: rgba(0, 0, 0, 0.08); }
.tone-prev.as-light .tp-l, .tone-prev.as-light .tp-rows span { color: #6b6b72; }
.sheet .seg + .tone-prev { margin-top: 12px; }
.tone-reset { margin-top: 16px; }
.sheet [data-f="lo"] { margin-top: 16px; }
/* the two colour rows fit on one line each on a phone, and show the exact colour */
.sheet [data-f="hi"] .swatches, .sheet [data-f="lo"] .swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.sheet [data-f="hi"] .swatch, .sheet [data-f="lo"] .swatch { width: auto; height: auto; aspect-ratio: 1; max-width: 40px; }
.sheet [data-f="hi"] .swatch:not(.custom), .sheet [data-f="lo"] .swatch:not(.custom) { background: var(--c); }

/* a popup changing in place (New entry → a form, and Back): no slide-up, the height eases over */
.sheet.morph { animation: none; transform: translate(-50%, 0); }
.sheet.resizing { overflow: hidden; }
/* Back arrow, left of the title */
.sheet-back {
  position: absolute; left: 10px; top: 30px; width: 36px; height: 36px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center; color: var(--text); background: var(--card-2); border: 1px solid var(--line-2);
  transition: transform 0.15s var(--ease);
}
.sheet-back:active { transform: scale(0.9); }
.sheet-back .i { width: 18px; height: 18px; }
.sheet.has-back h2 { padding-left: 44px; min-height: 36px; display: flex; align-items: center; }
.sheet.has-back h2 + .sub { padding-left: 44px; }
/* a popup that changed in place still slides down when it closes */
.sheet.morph.out { animation: sheetOut 0.26s ease-in forwards; }
/* days from the next/previous month that have entries sit on a grey tile: their number must still read */
.day.out.has { color: var(--muted); }
html[data-theme="light"] .day.out.has { color: #7a7a82; }

/* ---------- logging out and signing in ---------- */
/* logging out: the page shrinks back and fades, the tab bar drops away */
#view, .tabbar { transition: opacity 0.38s ease, transform 0.45s var(--spring), filter 0.38s ease; }
html.leaving #view { opacity: 0; transform: scale(0.95); filter: blur(6px); }
html.leaving .tabbar { opacity: 0; transform: translateY(24px); }
/* the sign-in screen fades in, its form rises */
.login.enter { animation: loginFade 0.45s ease both; }
@keyframes loginFade { from { opacity: 0; } }
/* signing in: the sign-in screen fades out while the app grows into place and the tab bar rises */
.login.out { transition: opacity 0.4s ease, transform 0.45s var(--spring); }
html.app-enter #view { animation: appIn 0.62s var(--spring) 0.08s both; }
html.app-enter .tabbar { animation: tabIn 0.55s var(--spring) 0.18s both; }
@keyframes appIn { from { opacity: 0; transform: scale(0.95); filter: blur(6px); } }
@keyframes tabIn { from { opacity: 0; transform: translateY(24px); } }

/* the Log out? popup */
.logout-ask { text-align: center; padding: 6px 4px 0; }
.logout-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 12px; color: var(--down); background: var(--down-soft); }
.logout-ic .i { width: 22px; height: 22px; }
.logout-ask .sub { max-width: 320px; margin: 6px auto 0; line-height: 1.45; }
.btn.warn { background: var(--down); color: #fff; border: 0; }
.btn.warn .i { width: 18px; height: 18px; }

/* sign-in screen: why you were signed out */
.lg-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px auto 20px; padding: 8px 14px; width: fit-content; max-width: 100%;
  border-radius: 99px; background: #151515; border: 1px solid rgba(255, 255, 255, 0.1); color: #bdbdbd; font-size: 12.5px; text-align: center; }
.lg-note .i { width: 15px; height: 15px; flex: none; }

/* ==========================================================================
   Wider screens. Phone (< 768px) stays exactly as it is.
   Tablet (768–1099px): pages split into two columns, bottom bar stays, popups open as centred dialogs.
   Desktop (≥ 1100px): a left sidebar replaces the bottom bar and the pages become dashboards.
   ========================================================================== */
.side-brand, .tabbar .side-only, .fab-lbl { display: none; }

@media (min-width: 768px) {
  .view { max-width: 980px; padding-left: 32px; padding-right: 32px; }
  .view[data-page="clients"], .view[data-page="settings"] { max-width: 720px; }
  /* two columns: Home (cards & figures | recent & upcoming), each account (card & figures | entries), calendar (month | day) */
  .home, .wide-2, .cal-wide { display: grid; gap: 0 28px; align-items: start; }
  .home { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .wide-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .cal-wide { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .home > .col-b > .sec-head:first-child, .cal-wide > :last-child > .sec-head:first-child { margin-top: 0; }
  .wide-2 > :last-child > .filters:first-child { margin-top: 0; }
  /* the card carousel lives inside its column: no bleed past the column edge */
  .home .cards { margin: 0; --peek: 26px; }
  .tabbar { padding-left: calc((100% - 560px) / 2 + 12px); padding-right: calc((100% - 560px) / 2 + 12px); }

  /* popups: a centred dialog that fades and grows in, instead of a sheet from the bottom */
  .sheet {
    top: 50%; bottom: auto; max-width: 520px; border-radius: 24px; border-bottom: 1px solid var(--line-2);
    padding: 22px 22px 22px; max-height: min(86vh, 860px); max-height: min(86dvh, 860px);
    transform: translate(-50%, -50%); opacity: 0; animation: dlgIn 0.34s var(--spring) forwards;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  }
  .sheet.out, .sheet.morph.out { animation: dlgOut 0.2s ease-in forwards; }
  .sheet.morph { animation: none; opacity: 1; transform: translate(-50%, -50%); }
  .grab-zone { display: none; }
  .sheet-back { top: 20px; left: 16px; }
  .sheet.has-back h2 { padding-left: 46px; }
  .sheet.has-back h2 + .sub { padding-left: 46px; }
  .sheet.conv-sheet { height: min(640px, 86dvh); }
  @keyframes dlgIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
  @keyframes dlgOut { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -49%) scale(0.97); } }

  /* a pointer: rows and tappable cards answer to hovering */
  @media (hover: hover) {
    /* hovering a row lights a rounded tile, evenly inset from the panel's edges (not a square strip cut off by the corners) */
    .row { position: relative; }
    .row::before { content: ""; position: absolute; inset: 3px -8px; border-radius: 12px; background: rgba(255, 255, 255, 0); pointer-events: none; transition: background 0.15s; }
    .row:hover::before { background: rgba(255, 255, 255, 0.05); }
    html[data-theme="light"] .row:hover::before { background: rgba(0, 0, 0, 0.04); }
    .stat[data-act="stat"]:hover { border-color: rgba(255, 255, 255, 0.2); }
    .chip:not(.on):hover, .icon-btn:hover, .mini-btn:hover { filter: brightness(1.25); }
  }
}

@media (min-width: 1100px) {
  :root { --side-w: 236px; }
  .view, .view[data-page] { max-width: none; margin: 0 0 0 var(--side-w); padding: 34px 40px 48px; }
  .view > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
  .view[data-page="clients"] > *, .view[data-page="settings"] > * { max-width: 760px; }
  .home { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 32px; }
  .wide-2 { grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.25fr); gap: 0 32px; }
  .cal-wide { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0 32px; }
  /* the bank cards keep a real card's size, with the next ones peeking in at the sides */
  .home .slot { flex-basis: 420px; }
  .home .cards::before, .home .cards::after { flex-basis: calc((100% - 420px) / 2 - var(--gap)); }
  .home .chart { height: 240px; }
  .page-title { font-size: 30px; }

  /* the bottom bar turns into a left sidebar */
  .tabbar {
    top: 0; right: auto; width: var(--side-w); height: auto; padding: 26px 14px calc(var(--safe-bottom) + 20px);
    flex-direction: column; align-items: stretch; gap: 4px; border-top: 0; border-right: 1px solid var(--line);
  }
  .side-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px 22px 10px; order: 0; }
  .side-mark svg { height: 22px; width: auto; fill: currentColor; display: block; }
  .tabbar .tab-center { order: 1; width: 100%; height: auto; margin-bottom: 14px; }
  .tabbar .fab { width: 100%; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .tabbar .fab-lbl { display: inline; font-weight: 600; font-size: 14.5px; }
  .tabbar button:not(.tab-center) {
    order: 2; flex: 0 0 auto; height: 44px; padding: 0 12px; gap: 12px; justify-content: flex-start;
    font-size: 14.5px; font-weight: 500; transition: color 0.2s, background 0.2s;
  }
  .tabbar button > span:not(.fab) { display: inline; }
  .tabbar button.active { background: #151515; }
  .tabbar button:not(.tab-center):hover { color: #fff; background: #111; }
  .tabbar .side-only { display: flex; }
  .tabbar .side-settings { order: 3; margin-top: auto; }
  html[data-theme="light"] .tabbar { border-right-color: rgba(0, 0, 0, 0.08); }
  html[data-theme="light"] .tabbar button.active { background: #f0f0f2; }
  html[data-theme="light"] .tabbar button:not(.tab-center):hover { color: #0b0b0b; background: #f4f4f5; }
  html[data-theme="light"] .side-brand { color: #0b0b0b; }
  /* Settings is in the sidebar, so the header button for it isn't needed on Home */
  .view[data-page="home"] .top-actions [data-to="settings"] { display: none; }
  .ptr { display: none; }
}

@media (min-width: 1440px) { .home .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* wide calendar: days get wider, not taller, so the month fits on screen */
@media (min-width: 1100px) { .day { aspect-ratio: auto; height: 62px; font-size: 14.5px; } }

/* ---------- desktop sidebar: collapse to a slim strip of icons ----------
   Nothing jumps: icons keep the same spot in both widths, the sidebar narrows over them and the
   labels and logo fade out as they're covered (and back in on the way out). */
@media (min-width: 1100px) {
  .tabbar { transition: width 0.42s var(--spring), padding 0.42s var(--spring); overflow: hidden; }
  .view, .view[data-page] { transition: margin-left 0.42s var(--spring); }
  .side-brand { justify-content: space-between; gap: 0; padding: 0 6px 22px; flex-wrap: nowrap; }
  /* the logo: the same 36px square as the collapse button */
  /* the name and version, where the logo was; it fades and folds away when the sidebar collapses */
  .side-mark { flex: 0 1 auto; min-width: 0; max-width: 160px; height: 36px; display: flex; flex-direction: column; justify-content: center;
    overflow: hidden; white-space: nowrap; padding-left: 4px; transition: max-width 0.42s var(--spring), opacity 0.22s ease; }
  .side-mark b { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
  .side-mark small { font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.3; }
  .tabbar button.side-toggle {
    order: 0; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border-radius: 10px; justify-content: center;
    color: var(--muted); background: transparent;
  }
  .tabbar button.side-toggle:hover { color: var(--text); background: #151515; }
  .tabbar .side-toggle .i { width: 20px; height: 20px; transition: transform 0.42s var(--spring); }
  html.side-collapsed .tabbar .side-toggle .i { transform: scaleX(-1); }
  /* New entry: the + stays put, the words fade */
  .tabbar .fab { justify-content: flex-start; padding: 0 14px; gap: 10px; overflow: hidden; }
  .tabbar button > span:not(.fab), .tabbar .fab-lbl { white-space: nowrap; transition: opacity 0.25s ease 0.08s; }

  html.side-collapsed { --side-w: 76px; }
  html.side-collapsed .side-mark { max-width: 0; padding-left: 0; opacity: 0; }
  html.side-collapsed .tabbar button > span:not(.fab), html.side-collapsed .tabbar .fab-lbl { opacity: 0; transition-delay: 0s; transition-duration: 0.16s; }
  html[data-theme="light"] .tabbar button.side-toggle:hover { background: #f0f0f2; }
}

/* ==========================================================================
   Spacing & alignment pass: one rhythm everywhere
   - small switches (IDR|USD, 6M|12M) have equal halves, so the blue thumb sits evenly in either side
   - outside labels (section titles, Total cash, legends) all sit 2px in from the card edges
   - a page's first section starts the same distance under its title on every page (22px)
   - stacked filters keep one 10px step, section title → content 14px, block → block 12px
   ========================================================================== */
.seg.xs, .seg.sm { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg.xs button, .seg.sm button { display: flex; align-items: center; justify-content: center; line-height: 1; }
.seg.xs button { min-width: 38px; height: 21px; padding: 0 9px; }
.seg.sm button { min-width: 40px; height: 26px; padding: 0 10px; }
.chip { display: inline-flex; align-items: center; justify-content: center; line-height: 1; height: 36px; padding-top: 0; padding-bottom: 0; flex: 0 0 auto; }
.legend-row { margin-left: 2px; margin-right: 2px; }
.search { display: block; }
.filters { margin-bottom: 10px; }
.picker-row.home-periods { margin-bottom: 14px; }
.view > .stagger > .sec-head:first-child, .view > div > .sec-head:first-child { margin-top: 0; }
.wide-2 > div > .filters:first-child { margin-top: 0; }
@media (max-width: 767px) { .wide-2 > div:last-child > .filters:first-child { margin-top: 18px; } }
/* side-by-side columns start on the same line */
@media (min-width: 768px) { .wide-2 .single-card { margin-top: 0; } }

/* ==========================================================================
   Icons 20% smaller everywhere (the phone & tablet bottom bar keeps its size)
   ========================================================================== */
.i { width: 16px; height: 16px; }
.avatar-cam .i { width: 8px; height: 8px; }
.btn .i { width: 14.4px; height: 14.4px; }
.pill .i { width: 9.6px; height: 9.6px; }
.bank__eye .i { width: 15.2px; height: 15.2px; }
.action .btn-circ .i { width: 14.4px; height: 14.4px; }
.sec-head .link .i { width: 11.2px; height: 11.2px; }
.stat .s-l .i { width: 11.2px; height: 11.2px; }
.search .i { width: 13.6px; height: 13.6px; }
.mono .i { width: 14.4px; height: 14.4px; }
.row .mono:not(.initials) .i { width: 17.6px; height: 17.6px; }
.btn .i { width: 14.4px; height: 14.4px; }
.mini-btn .i { width: 12.8px; height: 12.8px; }
.check-row .box .i { width: 11.2px; height: 11.2px; }
.choice .mono .i { width: 17.6px; height: 17.6px; }
.set-row .mono .i { width: 16px; height: 16px; }
.pw-eye .i { width: 14.4px; height: 14.4px; }
.lg-btn .i { width: 14.4px; height: 14.4px; }
.conv-cur .i { width: 12.8px; height: 12.8px; }
.pick-code .i { width: 14.4px; height: 14.4px; }
.sheet-back .i { width: 14.4px; height: 14.4px; }
.logout-ic .i { width: 17.6px; height: 17.6px; }
.btn.warn .i { width: 14.4px; height: 14.4px; }
.lg-note .i { width: 12px; height: 12px; }
@media (min-width: 1100px) {
  /* sidebar icons follow the same 20% step */
  .tabbar .i { width: 18px; height: 18px; }
  .tabbar .fab .i { width: 16px; height: 16px; }
  .tabbar .side-toggle .i { width: 16px; height: 16px; }
}

/* ---------- a slimmer desktop sidebar ---------- */
@media (min-width: 1100px) {
  :root { --side-w: 200px; }
  html.side-collapsed { --side-w: 64px; }
  .tabbar { padding: 22px 10px calc(var(--safe-bottom) + 18px); gap: 2px; }
  .side-brand { padding: 0 4px 18px; }
  .side-mark { height: 32px; }
  .side-mark b { font-size: 12.5px; }
  .side-mark small { font-size: 10.5px; }
  .tabbar button.side-toggle { width: 32px; height: 32px; border-radius: 9px; }
  .tabbar .tab-center { margin-bottom: 12px; }
  .tabbar .fab { height: 40px; padding: 0 14px; border-radius: 12px; gap: 9px; }
  .tabbar .fab-lbl { font-size: 13.5px; }
  .tabbar button:not(.tab-center):not(.side-toggle) { height: 40px; padding: 0 14px; gap: 11px; font-size: 13.5px; border-radius: 10px; }
}
/* the page slides with the sidebar (one transition list, so the logout fade doesn't cancel the slide) */
@media (min-width: 1100px) {
  #view { transition: opacity 0.38s ease, transform 0.45s var(--spring), filter 0.38s ease, margin-left 0.42s var(--spring); }
}

/* ==========================================================================
   Desktop dashboard (≥ 1100px): a clear hierarchy instead of a stretched phone
   ========================================================================== */
.sh-wallet, .is-hidden { display: none; }
@media (max-width: 1099px) { .table-card { display: none; } }

@media (min-width: 1100px) {
  .is-hidden { display: none !important; }

  /* ---------- Home: overview grid ----------
     1 · Total cash + period      2 · the four figures      3 · trend (2/3) + accounts (1/3)      4 · coming up (2/3) + recent (1/3) */
  .home {
    grid-template-columns: minmax(0, 2fr) minmax(330px, 1fr); column-gap: 28px;
    grid-template-areas: "total periods" "stats stats" "shchart shwallet" "chart wallet" "shcoming shrecent" "coming recent"; /* Recent sits under the cards, as on the phone */
  }
  .home > .col-a, .home > .col-b { display: contents; }
  .home .total { grid-area: total; margin: 0; align-self: center; flex-direction: column; align-items: flex-start; gap: 6px; }
  .home .total .amt { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
  .home .sh-period { display: none; }
  .home .home-periods { grid-area: periods; justify-self: end; align-self: end; margin: 0; padding: 0; }
  .home .home-periods::after { display: none; }
  .home .stats { grid-area: stats; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
  .home .stats .stat { padding: 18px; }
  .home .sh-chart { grid-area: shchart; }
  .home .sh-wallet { grid-area: shwallet; display: flex; }
  .home .chart-card { grid-area: chart; display: flex; flex-direction: column; }
  .home .chart-card .chart { flex: 1; min-height: 240px; }
  .home .wallet { grid-area: wallet; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
  .home .wallet .cards { margin: 0; --peek: 14px; padding-top: 0; }
  .home .wallet .slot { flex-basis: calc(100% - 2 * var(--peek)); }
  .home .wallet .cards::before, .home .wallet .cards::after { flex-basis: calc(var(--peek) - var(--gap)); }
  .home .wallet .actions { margin-top: 6px; }
  .home .sh-recent { grid-area: shrecent; margin-top: 32px !important; }
  .home .p-recent { grid-area: recent; }
  .home .sh-coming { grid-area: shcoming; margin-top: 32px !important; }
  .home .p-coming { grid-area: coming; }
  .home .sh-chart, .home .sh-wallet { margin-top: 32px; }

  /* ---------- Accounts: the card and its figures in one band, the entries as a table below ---------- */
  .wide-2 { grid-template-columns: minmax(0, 1fr); }
  .wide-2 > :first-child { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: stretch; }
  .wide-2 > :first-child .single-card { margin: 0; }
  .wide-2 > :first-child .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 14px; }
  .wide-2 > :first-child .stats .stat { padding: 18px; align-content: center; }
  .wide-2 > :last-child { margin-top: 28px; }
  .wide-2 .filters { grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); align-items: center; gap: 14px; margin: 0 0 12px; }
  .wide-2 .filters .seg { max-width: 420px; }
  .wide-2 > :last-child > .picker-row { margin: 0 0 14px; padding: 0; }

  /* ---------- tables (account entries, clients) ---------- */
  .table-card { padding: 4px 6px 6px; }
  .etable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; table-layout: auto; }
  .etable th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .etable th button { width: 100%; display: flex; align-items: center; gap: 6px; padding: 12px 12px; color: inherit; font: inherit; justify-content: inherit; }
  .etable th.on { color: var(--text); }
  .etable th .sort-ic { opacity: 0.45; font-size: 11px; }
  .etable th.on .sort-ic { opacity: 1; color: var(--btn); }
  .etable td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .etable tbody tr:last-child td { border-bottom: 0; }
  .etable tbody tr { cursor: pointer; }
  .etable tbody td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
  .etable tbody td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
  .etable tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }
  html[data-theme="light"] .etable tbody tr:hover td { background: rgba(0, 0, 0, 0.035); }
  .etable .c-date { color: var(--muted); white-space: nowrap; width: 1%; }
  .etable .c-who, .etable .c-note { color: var(--muted); }
  .etable .c-note { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .etable .c-amt, .etable .c-num, .etable .c-right { text-align: right; white-space: nowrap; }
  .etable th.c-amt button, .etable th.c-num button, .etable th.c-right button { justify-content: flex-end; }
  .etable .c-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
  .t-desc { display: flex; align-items: center; gap: 10px; font-weight: 500; min-width: 0; }
  .t-desc .mono { width: 26px; height: 26px; border: 0; background: none; border-radius: 0; }
  .t-desc small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
  .view[data-page="clients"] .t-desc { display: block; }

  /* ---------- Calendar: a big month grid with the day's money written in ---------- */
  .cal-wide { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }
  .cal-grid { gap: 6px; padding: 6px 14px 16px; }
  .cal-grid .wd { text-align: left; padding-left: 10px; }
  .day { height: 96px; aspect-ratio: auto; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 9px 10px; text-align: left; border-radius: 14px; }
  .day .dn { font-size: 14px; font-weight: 600; }
  .day .dd { display: none; }
  .day .dv { display: grid; gap: 2px; min-width: 0; }
  .day .dv i { font-style: normal; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .day .dv i.ev { color: var(--lime); font-weight: 500; }
  .day.sel .dv i { color: var(--on-btn); }
  .day.out .dv { opacity: 0.6; }

  /* ---------- Clients: a full table ---------- */
  .view[data-page="clients"] > * { max-width: 1100px; }

  /* ---------- Settings: two columns of groups ---------- */
  .view[data-page="settings"] > * { max-width: 1100px; }
  .view[data-page="settings"] > .stagger { columns: 2; column-gap: 28px; }
  .view[data-page="settings"] > .stagger > .sec-head { break-after: avoid; margin-top: 0; padding-top: 0; }
  .view[data-page="settings"] > .stagger > .card { break-inside: avoid; margin-bottom: 30px; }
  .view[data-page="settings"] > .stagger > * { animation: none; }
}

/* the eye beside Total cash: hide / show every amount */
.total-val { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.cash-eye { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; transition: color 0.2s, background 0.2s, transform 0.15s var(--ease); }
.cash-eye:hover { color: var(--text); background: var(--panel, #151515); }
.cash-eye:active { transform: scale(0.88); }
.cash-eye .i { width: 16px; height: 16px; }
@media (min-width: 1100px) { .cash-eye { width: 36px; height: 36px; } .cash-eye .i { width: 19px; height: 19px; } }

/* expanded cards (and every popup) scroll up and down only: no sideways scroll, no scrollbar showing */
.sf-scroll { overflow-x: hidden; touch-action: pan-y; scrollbar-width: none; }
.sf-scroll::-webkit-scrollbar, .sheet::-webkit-scrollbar, .pick-list::-webkit-scrollbar, .conv-main::-webkit-scrollbar { display: none; }
.sheet, .pick-list, .conv-main { scrollbar-width: none; overflow-x: hidden; }
.sf-in { overflow-x: hidden; }
/* inside an expanded card the period pills wrap onto lines instead of scrolling sideways */
.sf .picker-row { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.sf .picker-row::after { display: none; }
.sf { transform-origin: 50% 0; will-change: clip-path, transform; }

/* the Home chart card opens like the stat cards */
.chart-card[data-act="stat"] { cursor: pointer; transition: transform 0.18s var(--ease), border-color 0.2s; -webkit-tap-highlight-color: transparent; }
.chart-card[data-act="stat"]:active { transform: scale(0.985); }
@media (hover: hover) { .chart-card[data-act="stat"]:hover { border-color: color-mix(in srgb, var(--hi) 60%, transparent); } }
.sf-legend { margin: -4px 4px 10px; }
.sfc .bar.exp { opacity: 0.32; }
.sfc .bar.exp.on { opacity: 0.9; }
.sfc-head .sfc-sub { color: var(--muted); font-weight: 500; font-size: 12.5px; }

/* Total cash: one currency pill at the very end; tap it to pick any currency */
.cur-pill { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px 0 11px; border-radius: 99px; flex: 0 0 auto;
  background: var(--panel, #111); border: 1px solid var(--panel-line, rgba(255, 255, 255, 0.1)); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  transition: transform 0.15s var(--ease), border-color 0.2s; }
.cur-pill .i { width: 13px; height: 13px; color: var(--muted); }
.cur-pill:active { transform: scale(0.94); }
@media (hover: hover) { .cur-pill:hover { border-color: rgba(255, 255, 255, 0.24); } }
html[data-theme="light"] .cur-pill:hover { border-color: rgba(0, 0, 0, 0.2); }
/* its popup: a fixed height, the list scrolls inside */
.sheet.cur-sheet { height: min(640px, 86dvh); display: flex; flex-direction: column; overflow: hidden; }
.cur-sheet .cur-search { margin: 12px 0 8px; flex: 0 0 auto; }
.cc-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px 8px; scrollbar-width: none; }
.cc-list::-webkit-scrollbar { display: none; }
/* phone & tablet: "Total cash" with the eye and currency pill on one line, the amount large underneath */
@media (max-width: 1099px) {
  .total { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "lbl eye cur" "amt amt amt"; align-items: center; column-gap: 6px; row-gap: 2px; }
  .total .lbl { grid-area: lbl; white-space: nowrap; }
  .total .total-val { display: contents; }
  .total .amt { grid-area: amt; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; min-width: 0; flex-wrap: wrap; }
  .total .cash-eye { grid-area: eye; }
  .total .cur-pill { grid-area: cur; }
}

/* focus that can't be cut off:
   - text fields show it as a blue edge on the field itself (and keep their own rounded corners)
   - anything inside a scrolling area (popups, expanded cards, lists, rows of pills, the card carousel)
     draws its ring just inside its edge, where the scrolling area can't clip it */
.field:focus, .field:focus-visible { outline: none; border-color: var(--btn); box-shadow: inset 0 0 0 1px var(--btn); }
.sheet :focus-visible, .sf :focus-visible, .picker-row :focus-visible, .cards :focus-visible, .cc-list :focus-visible,
.pick-list :focus-visible, .conv-main :focus-visible, .list :focus-visible, .etable :focus-visible, .seg :focus-visible { outline-offset: -2px; }
.etable tr:focus-visible { outline: 2px solid var(--btn); outline-offset: -2px; }

/* ---------- a card opening like an iOS app ---------- */
.sf { overflow: hidden; transform-origin: 50% 50%; will-change: transform, opacity; clip-path: none; }
/* the small card under the opening page */
.sf-src { opacity: 0 !important; transition: opacity 0.18s ease; }
[data-act="stat"] { transition: opacity 0.22s ease, transform 0.18s var(--ease), border-color 0.2s; }
/* the page behind recedes: a little smaller, blurred and darker (and comes back when the card closes) */
#view, .tabbar { transition-property: opacity, transform, filter, margin-left, width, padding; transition-duration: 0.45s; transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
html.sf-open #view { transform: scale(0.93); filter: blur(8px) brightness(0.6); }
html.sf-open .tabbar { filter: blur(8px) brightness(0.6); }
@media (prefers-reduced-motion: reduce) { html.sf-open #view { transform: none; } }

/* ---------- a transaction row in two parts: description → receipt, amount → edit ---------- */
.row.split { padding: 0; gap: 0; align-items: stretch; }
.row.split:active { transform: none; }
.row.split > button { display: flex; align-items: center; padding: 14px 2px; transition: transform 0.15s var(--ease), opacity 0.15s; text-align: left; }
.row.split .r-left { flex: 1; min-width: 0; gap: 14px; }
.row.split .r-right { flex: 0 0 auto; flex-direction: column; justify-content: center; align-items: flex-end; text-align: right; padding-left: 12px; }
.row.split > button:active { transform: scale(0.97); opacity: 0.7; }
.etable .t-link { display: block; width: 100%; text-align: left; color: inherit; font: inherit; padding: 0; }
.etable .t-link:hover .t-desc { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.3); }

/* ---------- the receipt ---------- */
.rcpt { text-align: center; padding: 8px 2px 0; }
.rcpt-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 14px; background: var(--up-soft); color: var(--up);
  animation: rcptPop 0.5s var(--spring) both; }
.rcpt.out .rcpt-ic { background: color-mix(in srgb, var(--btn) 18%, transparent); color: var(--blue); }
.rcpt-ic .i { width: 30px; height: 30px; stroke-width: 2.6; }
@keyframes rcptPop { from { transform: scale(0.4); opacity: 0; } }
.rcpt h2 { margin: 0; }
.rcpt-amt { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.rcpt-approx { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rcpt-rows { margin-top: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); padding: 4px 14px; text-align: left; }
.rcpt-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; }
.rcpt-rows div:last-child { border-bottom: 0; }
.rcpt-rows span { color: var(--muted); flex: 0 0 auto; }
.rcpt-rows b { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.mono-txt { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: 0.02em; }
.sheet .btns .btn .i { width: 15px; height: 15px; }

/* behind every popup the page is blurred out, so nothing behind it can be read */
.backdrop { -webkit-backdrop-filter: blur(7px) saturate(140%); backdrop-filter: blur(7px) saturate(140%); background: rgba(0, 0, 0, 0.55); }
html[data-theme="light"] .backdrop { background: rgba(0, 0, 0, 0.25); }

/* ---------- the highlighted pill glides to the one you tap ---------- */
.picker-row { position: relative; }
.chip-glide {
  position: absolute; z-index: 2; pointer-events: none; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  border-radius: 99px; background: var(--btn); color: var(--on-btn); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden;
  will-change: transform, width;
}

/* ---------- charts: grid, deep gradient fills, bright-to-grey bars with a value marker ---------- */
.chart-grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .chart-end { opacity: 0; animation: fadeIn 0.3s 0.75s ease forwards; }
.chart.still .chart-end { animation: none; opacity: 1; }
.sfc .bar, .sfc .bar.on { fill: url(#sfg-hi); opacity: 1; transition: fill 0.25s, opacity 0.25s; }
.sfc .bar.neg { fill: url(#sfg-lo); }
.sfc .bar.exp, .sfc .bar.exp.on { fill: url(#sfg-lo); opacity: 0.6; }
.sfc .bar.after, .sfc .bar.exp.after { fill: var(--chart-off); opacity: 1; }
.sfc .sel-h { stroke: var(--chart-guide); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.sfc .sel-v { stroke: var(--chart-line); stroke-width: 1.5; }
.sfc .sel-t { fill: var(--chart-line); font-weight: 600; font-variant-numeric: tabular-nums; }
.sfc .sel-t.neg { fill: var(--down); }
.sfc .sel-h, .sfc .sel-v, .sfc .sel-t { transition: x 0.25s var(--spring), y1 0.25s var(--spring), y2 0.25s var(--spring), x1 0.25s var(--spring), x2 0.25s var(--spring); }
.sfp-bar i { background: linear-gradient(90deg, color-mix(in srgb, var(--chart-line) 35%, transparent), var(--chart-line)); }
.sfp-bar i.neg { background: linear-gradient(90deg, color-mix(in srgb, var(--down) 35%, transparent), var(--down)); }
:root { --chart-off: rgba(255, 255, 255, 0.11); }
html[data-theme="light"] { --chart-off: rgba(0, 0, 0, 0.09); }

/* the line chart rises from a flat line (in script) instead of drawing itself in and fading */
.chart .chart-path, .chart .chart-fill, .chart .chart-end { animation: none; opacity: 1; stroke-dasharray: none; stroke-dashoffset: 0; }
.chart .chart-fill[stroke-dasharray] { stroke-dasharray: 4 4; }

/* the looping card strip swaps a copy for the real card without any motion */
.cards.jumping .bank, .cards.jumping .slot { transition: none !important; }

/* the buttons under the cards: one row per card in a strip that slides with them */
.actions-strip { overflow: hidden; margin-top: 18px; padding: 4px 0; }
.actions-track { display: flex; will-change: transform; }
.actions-track > .actions { flex: 0 0 100%; margin-top: 0; box-sizing: border-box; }
@media (min-width: 1100px) { .home .wallet .actions-strip { margin-top: 2px; } .home .wallet .actions-strip .actions { margin-top: 0; } }

/* the stat chart's header has fixed lines: the month and figure on one, "Spent …" on a second (net & expenses),
   nothing wraps and long figures shrink to fit, so the panel never changes size as you move across the bars */
.sfc-head { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: baseline; }
.sfc-head #sfc-l, .sfc-head #sfc-v, .sfc-head #sfc-e { white-space: nowrap; overflow: hidden; min-width: 0; }
.sfc-head #sfc-l { line-height: 20px; }
.sfc-head #sfc-v { text-align: right; line-height: 20px; height: 20px; }
.sfc-head #sfc-e { grid-column: 1 / -1; text-align: right; line-height: 18px; height: 18px; }
.sf-v { white-space: nowrap; overflow: hidden; }

/* Home header photo: no ring around it and no camera badge (tapping it still changes the photo) */
.top .avatar-btn, html[data-theme="light"] .top .avatar-btn { border: 0; }

/* ---------- card styles: gradient recipes, all mixed from the card's colour (--c) ---------- */
.cs-swatch { --c: #2457e8; display: block; position: relative; overflow: hidden; isolation: isolate; aspect-ratio: 1.586; border-radius: 12px; border: 1px solid color-mix(in srgb, color-mix(in srgb, var(--c) 40%, #fff) 30%, transparent);
  background:
    radial-gradient(90% 120% at 105% -10%, color-mix(in srgb, color-mix(in srgb, var(--c) 40%, #fff) 50%, transparent), transparent 55%),
    radial-gradient(70% 90% at -10% 120%, color-mix(in srgb, color-mix(in srgb, var(--c) 35%, #000) 70%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 45%, #000) 100%); }
.cs-swatch i { position: absolute; inset: 0; pointer-events: none; }
.bank.cs-aurora, .cs-swatch.cs-aurora {
  background:
    radial-gradient(70% 90% at 0% 0%, color-mix(in srgb, color-mix(in srgb, var(--c) 45%, #7c5cff) 85%, transparent), transparent 62%),
    radial-gradient(70% 90% at 100% 100%, color-mix(in srgb, color-mix(in srgb, var(--c) 45%, #19d3c5) 80%, transparent), transparent 62%),
    radial-gradient(60% 70% at 85% 10%, color-mix(in srgb, #ff6fd8 35%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--c) 55%, #0b0b1a), color-mix(in srgb, var(--c) 30%, #000));
}
.bank.cs-sunset, .cs-swatch.cs-sunset {
  background:
    radial-gradient(80% 100% at 100% 0%, color-mix(in srgb, #ffb86b 70%, transparent), transparent 58%),
    linear-gradient(135deg, color-mix(in srgb, var(--c) 40%, #ff5f6d) 0%, color-mix(in srgb, var(--c) 55%, #c2185b) 48%, color-mix(in srgb, var(--c) 45%, #1a0b2e) 100%);
}
.bank.cs-metal, .cs-swatch.cs-metal {
  background:
    linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.22) 38%, transparent 46%, rgba(255, 255, 255, 0.12) 62%, transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #c9ced6) 0%, color-mix(in srgb, var(--c) 60%, #5b616b) 55%, color-mix(in srgb, var(--c) 55%, #22252a) 100%);
}
.bank.cs-mesh, .cs-swatch.cs-mesh {
  background:
    radial-gradient(55% 75% at 15% 20%, color-mix(in srgb, color-mix(in srgb, var(--c) 50%, #fff) 70%, transparent), transparent 70%),
    radial-gradient(55% 75% at 85% 25%, color-mix(in srgb, color-mix(in srgb, var(--c), #ff3d81 45%) 75%, transparent), transparent 70%),
    radial-gradient(60% 80% at 30% 95%, color-mix(in srgb, color-mix(in srgb, var(--c), #00c2ff 45%) 75%, transparent), transparent 70%),
    radial-gradient(60% 80% at 90% 90%, color-mix(in srgb, color-mix(in srgb, var(--c), #000 55%) 90%, transparent), transparent 70%),
    var(--c);
}
.bank.cs-holo, .cs-swatch.cs-holo {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.0) 10%, rgba(255, 255, 255, 0.18) 30%, rgba(255, 255, 255, 0) 50%),
    conic-gradient(from 210deg at 70% 40%, color-mix(in srgb, var(--c) 55%, #ff8ad8), color-mix(in srgb, var(--c) 55%, #8ab4ff), color-mix(in srgb, var(--c) 55%, #8affd5), color-mix(in srgb, var(--c) 55%, #fff38a), color-mix(in srgb, var(--c) 55%, #ff8ad8));
}
.bank.cs-matte, .cs-swatch.cs-matte {
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 92%, #fff), color-mix(in srgb, var(--c) 82%, #000));
}
.bank.cs-matte::after, .bank.cs-mesh::after, .bank.cs-holo::after { opacity: 0; } /* no brushed lines on these */
/* the picker */
.cs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0 6px; }
.cs-opt { display: grid; gap: 7px; padding: 6px; border-radius: 16px; border: 1px solid transparent; text-align: left; transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease); }
.cs-opt:active { transform: scale(0.97); }
.cs-opt[aria-checked="true"] { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.cs-name { font-size: 13px; font-weight: 600; padding: 0 2px 2px; }
.cs-mini { width: 34px; border-radius: 6px; flex: none; margin-right: 8px; }
.bank.cs-carbon, .cs-swatch.cs-carbon {
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--c) 55%, transparent), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, color-mix(in srgb, var(--c) 35%, #2a2a2a), color-mix(in srgb, var(--c) 25%, #0a0a0a));
}
.bank.cs-carbon::after { opacity: 0; }

/* the Net profit & expenses card is a plain panel like the stat cards (the line and its fill keep the colour) */
.chart-card, html[data-theme="light"] .chart-card { background: var(--panel); border-color: var(--panel-line); }
@media (hover: hover) { .chart-card[data-act="stat"]:hover { border-color: rgba(255, 255, 255, 0.2); } html[data-theme="light"] .chart-card[data-act="stat"]:hover { border-color: rgba(0, 0, 0, 0.16); } }

/* ---------- depth on cards and dark buttons: the edge is lit from above (brighter top, fading down the sides
   to a faint bottom), with a soft top-to-bottom shade inside and a hairline highlight just under the top edge.
   Blue / primary buttons, selected pills and the bank cards keep their own look. ---------- */
:root {
  --edge-top: rgba(255, 255, 255, 0.16); --edge-side: rgba(255, 255, 255, 0.085); --edge-bot: rgba(255, 255, 255, 0.04);
  --face: none; /* panels stay one flat colour; only the edge carries the depth */
  --lip: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
html[data-theme="light"] {
  --edge-top: rgba(0, 0, 0, 0.05); --edge-side: rgba(0, 0, 0, 0.085); --edge-bot: rgba(0, 0, 0, 0.14);
  --face: none; /* panels stay one flat colour; only the edge carries the depth */
  --lip: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(0, 0, 0, 0.05);
}
html:root:root :where(.card, .icon-btn:not(.conv-swap), .chip:not(.on), .seg, .btn.ghost, .mini-btn, .cur-pill), html:root:root .action:not(.primary) .btn-circ {
  border-style: solid; border-width: 1px;
  border-color: var(--edge-top) var(--edge-side) var(--edge-bot);
  background-image: var(--face);
  box-shadow: var(--lip);
}

/* ---------- text on the bank cards has a little depth: a soft shadow under each letter and a faint light
   catching its top edge; the number and name are pressed in a touch more, like the embossing on a real card ---------- */
.bank { --emb-dark: rgba(0, 0, 0, 0.38); --emb-lite: rgba(255, 255, 255, 0.14); }
.bank .bank__brand, .bank .bank__bal, .bank .bank__bal-lbl {
  text-shadow: 0 1px 1px var(--emb-dark), 0 -0.5px 0 var(--emb-lite);
}
.bank .bank__num, .bank .bank__holder {
  text-shadow: 0 1px 0 var(--emb-dark), 0 2px 3px rgba(0, 0, 0, 0.22), 0 -1px 0 var(--emb-lite);
}
.bank .bank__bal .dec { text-shadow: none; }
/* light-coloured cards: the shadow is lighter, and the light catches the bottom edge instead */
.bank.is-light { --emb-dark: rgba(255, 255, 255, 0.55); --emb-lite: rgba(0, 0, 0, 0.12); }
.bank.is-light .bank__num, .bank.is-light .bank__holder { text-shadow: 0 1px 0 var(--emb-dark), 0 -1px 0 var(--emb-lite); }

/* ---------- the same depth on the blue accents: lit from above (a bright hairline along the top, a soft shade
   toward the bottom, a darker bottom edge), drawn inside so nothing changes size ---------- */
:root {
  --blue-face: none; /* flat blue; the lit edges below carry the depth */
  --blue-lip: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}
html:root:root :where(.btn:not(.ghost):not(.danger):not(.warn), .chip.on, .chip-glide, .seg .thumb, .mono.accent, .day.sel, .tabbar .fab, .toggle.on, .conv-swap, .lg-btn, .check-row:has(input:checked) .box),
html:root:root .action.primary .btn-circ {
  background-image: var(--blue-face);
  box-shadow: var(--blue-lip);
}

/* ---------- a soft shadow beneath the bank cards: a faint glow in the card's own colour plus a little
   contact shadow, so the card lifts off the page. The card strip gets room below so it isn't clipped. ---------- */
.bank {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 28px -14px color-mix(in srgb, var(--c) 55%, transparent),
    0 8px 18px -10px rgba(0, 0, 0, 0.6);
}
html[data-theme="light"] .bank {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 28px -14px color-mix(in srgb, var(--c) 45%, transparent),
    0 8px 18px -10px rgba(0, 0, 0, 0.28);
}
.cards { padding-bottom: 28px; margin-bottom: -14px; }
.home .cards, .home .wallet .cards { margin-bottom: -14px; }

/* bank cards share the panels' lit edge: brighter along the top, fading down the sides to a faint bottom,
   the same on every card colour and style */
html:root:root .bank { border: 1px solid; border-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.045); }
.actions-track > .actions { will-change: opacity; }
/* the selected day keeps the blue edge even when it is today (an older rule cleared its outline) */
html:root:root .day.sel, html:root:root .day.today.sel { box-shadow: var(--blue-lip); background-image: var(--blue-face); }

/* grey day tiles (days with entries) get the panels' lit edge, drawn inside so the grid doesn't shift;
   today keeps its own outline */
:root { --grey-lip: inset 0 1px 0 rgba(255, 255, 255, 0.13), inset 1px 0 0 rgba(255, 255, 255, 0.05), inset -1px 0 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(255, 255, 255, 0.02); }
html[data-theme="light"] { --grey-lip: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 1px 0 0 rgba(0, 0, 0, 0.04), inset -1px 0 0 rgba(0, 0, 0, 0.04), inset 0 -1px 0 rgba(0, 0, 0, 0.1); }
html:root:root .day.has:not(.sel):not(.today) { box-shadow: var(--grey-lip); }

/* a back button beside a page title (Settings -> Home); the sidebar covers it on desktop */
.top.has-back { justify-content: flex-start; }
.top.has-back .top-main { flex: 1; min-width: 0; }
.page-back { flex: none; }
.page-back .i { width: 18px; height: 18px; }
@media (min-width: 1100px) { .page-back { display: none; } }

/* sign-in screen: the fields get the panels' lit edge (brighter top, fading to a faint bottom, a hairline
   just inside the top), the blue Login button its blue edge, and the white Passkey button a matching one */
html:root:root .lg-field, html:root:root .lg-field:focus, html:root:root .lg-field:focus-visible {
  border-color: rgba(255, 255, 255, 0.14) rgba(255, 255, 255, 0.07) rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
html:root:root .lg-btn:not(.ghost) { box-shadow: var(--blue-lip); }
html:root:root .lg-btn.ghost { box-shadow: inset 0 1px 0 #fff, inset 1px 0 0 rgba(0, 0, 0, 0.05), inset -1px 0 0 rgba(0, 0, 0, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.2); }

/* switching between dark and light fades the colours across (signing in to a light account, the toggle) */
html.theme-fade, html.theme-fade body, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition-property: background-color, color, border-color, box-shadow, fill, stroke !important;
  transition-duration: 0.6s !important; transition-timing-function: ease !important; transition-delay: 0s !important;
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.55s; animation-timing-function: ease; }

/* sign-in fields and buttons take the same corner curve as the cards and panels (--radius, 24px) */
.lg-field, .lg-btn, .lg-btn.ghost { border-radius: var(--radius); }

/* during the dark <-> light crossfade the browser blends whole pictures of the screen; every element jumps
   straight to its new colours underneath, so all text changes together */
html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }
.pick-sym { color: var(--text); font-weight: 600; margin-right: 6px; }

/* ---------- % change pills you can tap, and the small bubble that explains them ---------- */
.pct-pill { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; transition: transform 0.15s var(--ease), filter 0.15s; -webkit-tap-highlight-color: transparent; }
.pct-pill:active { transform: scale(0.94); }
@media (hover: hover) { .pct-pill:hover { filter: brightness(1.15); } }
.pct-pop {
  position: fixed; z-index: 60; max-width: min(280px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 14px;
  background: rgba(28, 28, 30, 0.92); color: #fff; font-size: 13px; line-height: 1.45; font-weight: 500;
  border: 1px solid; border-color: rgba(255, 255, 255, 0.18) rgba(255, 255, 255, 0.09) rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 30px -10px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: pctIn 0.2s var(--spring) both;
}
.pct-pop.below { transform-origin: var(--ax) 0; } .pct-pop.above { transform-origin: var(--ax) 100%; }
.pct-pop::before { content: ""; position: absolute; left: calc(var(--ax) - 6px); width: 12px; height: 12px; background: inherit; border: inherit; border-color: rgba(255, 255, 255, 0.18); transform: rotate(45deg); }
.pct-pop.below::before { top: -7px; border-right: 0; border-bottom: 0; }
.pct-pop.above::before { bottom: -7px; border-left: 0; border-top: 0; }
.pct-pop.out { animation: pctOut 0.16s ease forwards; }
@keyframes pctIn { from { opacity: 0; transform: scale(0.92) translateY(-2px); } }
@keyframes pctOut { to { opacity: 0; transform: scale(0.96); } }
html[data-theme="light"] .pct-pop { background: rgba(255, 255, 255, 0.95); color: #0b0b0b; border-color: rgba(0, 0, 0, 0.06) rgba(0, 0, 0, 0.09) rgba(0, 0, 0, 0.14); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.25); }
html[data-theme="light"] .pct-pop::before { border-color: rgba(0, 0, 0, 0.08); }
/* the chart card: the total with its pill beside it */
.cc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* stat chart header: month, pill, figure (and "Spent" on its own line) */
.sfc-head { grid-template-columns: auto auto minmax(0, 1fr); }
.sfc-head #sfc-l { grid-column: 1; } .sfc-head #sfc-p { grid-column: 2; align-self: center; display: flex; } .sfc-head #sfc-v { grid-column: 3; }
.sfc-head #sfc-p .pct-pill { font-size: 11px; padding: 2px 7px; }

/* the change pill on a stat card sits at the right end of its label row (static, no popup) */
.stat .s-l { min-width: 0; }
.stat .card-pill { margin-left: auto; flex: none; font-size: 10.5px; font-weight: 600; padding: 2px 7px; gap: 3px; }
.stat .card-pill .i { width: 10px; height: 10px; }

/* Total cash: tap the amount to see how it's split */
.cash-tap { cursor: pointer; border-radius: 8px; transition: opacity 0.15s; -webkit-tap-highlight-color: transparent; }
.cash-tap:active { opacity: 0.7; }
.pct-pop.rich { width: min(290px, calc(100vw - 24px)); padding: 12px 14px; }
.al-title { font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.al-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; background: rgba(255, 255, 255, 0.08); margin-bottom: 10px; }
.al-bar i { display: block; height: 100%; min-width: 3px; border-radius: 99px; transform-origin: 0 50%; animation: alGrow 0.5s var(--spring) both; }
@keyframes alGrow { from { transform: scaleX(0); } }
.al-row { display: grid; grid-template-columns: 10px 1fr auto; column-gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; }
.al-dot { width: 8px; height: 8px; border-radius: 50%; }
.al-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.al-amt { grid-column: 2 / -1; color: #9a9a9e; font-size: 12px; font-variant-numeric: tabular-nums; margin-top: -1px; }
.al-note { color: #8b8b8b; font-size: 11.5px; margin-top: 8px; }
html[data-theme="light"] .al-bar { background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .al-amt, html[data-theme="light"] .al-note { color: #6b6b72; }

/* ---------- Net worth panel (Home, at the bottom) ---------- */
.p-worth { padding: 16px; }
.nw-head .label { color: var(--muted); font-size: 12.5px; }
.nw-total { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.nw-bar { margin: 14px 0 8px; height: 10px; }
.nw-group { display: grid; }
.nw-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.nw-row:last-child { border-bottom: 0; }
.nw-name { min-width: 0; font-weight: 500; }
.nw-name small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nw-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nw-val small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.nw-assets { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; display: grid; }
.nw-asset { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px 10px 20px; text-align: left; border-radius: 10px; font-size: 14px; transition: background 0.15s; }
.nw-asset:active { background: var(--card-2); }
@media (hover: hover) { .nw-asset:hover { background: var(--card-2); } }
.nw-empty { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.45; }
@media (min-width: 1100px) {
  .home { grid-template-areas: "total periods" "stats stats" "shchart shwallet" "chart wallet" "shcoming shrecent" "coming recent" "shworth shworth" "worth worth"; }
  .home .sh-worth { grid-area: shworth; margin-top: 32px !important; }
  .home .p-worth { grid-area: worth; }
}
.nw-asset .nw-name { flex: 1; min-width: 0; }
.nw-asset .nw-val { flex: none; }
.nw-asset .nw-name > :first-child { overflow: hidden; text-overflow: ellipsis; }
.nw-asset { min-width: 0; width: 100%; }

/* ==========================================================================
   Cashku brand: deep green + cream, CASHKU wordmark
   (stand-in font Bricolage Grotesque ExtraBold until Deacon is licensed)
   ========================================================================== */
:root {
  --brand: #122216;
  --brand-2: #1a3020;   /* raised surface on green */
  --brand-3: #24402b;   /* hover / pressed on green */
  --cream: #f5ede7;
  --font-brand: "Deacon", "Bricolage Grotesque", -apple-system, system-ui, sans-serif;
}
.wordmark {
  font-family: var(--font-brand); font-weight: 800; font-variation-settings: "opsz" 96, "wdth" 92;
  letter-spacing: -0.035em; line-height: 0.82; color: var(--cream); display: block; white-space: nowrap;
}

/* sign-in screen on brand green */
.login { background: var(--brand); color: var(--cream); }
.lg-logo { margin-top: 36px; }
.lg-logo .wordmark { font-size: 34px; }
.lg-h1 { color: var(--cream); }
.lg-sub { color: color-mix(in srgb, var(--cream) 62%, var(--brand)); }
.lg-label { color: var(--cream); }
.lg-legal { color: color-mix(in srgb, var(--cream) 42%, var(--brand)); }
.pw-eye { color: color-mix(in srgb, var(--cream) 60%, var(--brand)); }
.pw-eye:hover { background: rgba(245, 237, 231, 0.06); }
html:root:root .lg-field, html:root:root .lg-field:focus, html:root:root .lg-field:focus-visible {
  background: var(--brand-2); color: var(--cream); caret-color: var(--cream);
  border-color: rgba(245, 237, 231, 0.16) rgba(245, 237, 231, 0.08) rgba(245, 237, 231, 0.04);
  box-shadow: inset 0 1px 0 rgba(245, 237, 231, 0.05);
  transition: border-color 0.2s, background 0.2s;
}
html:root:root .lg-field:focus { border-color: rgba(245, 237, 231, 0.38); background: #1d3524; }
.lg-field:-webkit-autofill { -webkit-text-fill-color: var(--cream); -webkit-box-shadow: 0 0 0 40px var(--brand-2) inset; }
/* primary: cream on green; passkey: outlined cream */
html:root:root .lg-btn:not(.ghost) {
  background: var(--cream); color: var(--brand); background-image: none;
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
html:root:root .lg-btn:not(.ghost):hover { background: #fffaf6; }
html:root:root .lg-btn.ghost {
  background: transparent; color: var(--cream); border: 1px solid rgba(245, 237, 231, 0.28); box-shadow: none;
}
html:root:root .lg-btn.ghost:hover { background: rgba(245, 237, 231, 0.06); }
.login-err { color: #ff8a7a; }
.lg-note { background: var(--brand-2); border-color: rgba(245, 237, 231, 0.14); color: color-mix(in srgb, var(--cream) 80%, var(--brand)); }
/* Sign in <-> Create account: the screen stays, only the form rises in again */
.login.swap .lg-logo { animation: none; }
.lg-switch { flex: 0 0 auto; margin: 0 0 14px; text-align: center; font-size: 14px; color: color-mix(in srgb, var(--cream) 62%, var(--brand)); animation: lgIn 0.45s var(--ease) 0.05s both; }
.lg-switch button { color: var(--cream); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(245, 237, 231, 0.4); transition: text-decoration-color 0.15s, opacity 0.15s; }
.lg-switch button:hover { text-decoration-color: var(--cream); }
.lg-switch button:active { opacity: 0.6; }
/* layout: a big CASHKU fills the middle of the screen, the form sits near the bottom */
.lg-logo, .login .lg-logo { flex: 1 0 auto; margin: 0; padding: 32px 0 24px; display: flex; align-items: center; justify-content: center; min-height: 120px; }
.lg-logo, .login .lg-logo { width: 100%; max-width: 400px; }
.lg-logo .wordmark { font-size: min(100px, 26vw); } /* app.js fitBrand() then sets the exact size */
.login .lg { margin: 0; padding: 0 0 26px; flex: 0 0 auto; }
.login .lg-h1 { font-size: 22px; }
.login .lg-sub { margin: 8px 0 22px; }
/* tagline under CASHKU */
.lg-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.lg-tagline { margin: 0; white-space: nowrap; font-size: 15px; line-height: 22px; /* fixed, so a language switch (a slightly different size) can't nudge CASHKU */ color: color-mix(in srgb, var(--cream) 72%, var(--brand)); }
/* a swap (language, or Sign in <-> Create account) changes the screen in place, as the app's filters do:
   nothing rises again; only the words that changed fade in where they stand (.text-swap) */
.login.swap .lg, .login.swap .lg-switch, .login.swap .lg-logo, .login.swap .lg-lang { animation: none; }
/* ENG / IN switch, top right: the app's own segmented pill (.seg) with its sliding thumb, in brand colours */
.seg.lg-lang {
  position: absolute; top: calc(var(--safe-top) + 16px); right: 16px; z-index: 1;
  --btn: var(--cream); --on-btn: var(--brand); --muted: color-mix(in srgb, var(--cream) 60%, var(--brand));
  background: var(--brand-2); border-color: rgba(245, 237, 231, 0.12); animation: lgIn 0.45s var(--ease) both;
}
.seg.lg-lang button { flex: 0 0 auto; min-width: 42px; font-weight: 700; letter-spacing: 0.04em; }
.seg.lg-lang button:not(.on):hover { color: var(--cream); }
.lg-switch { margin-bottom: 4px; }
/* Create account keeps the passkey button's space (invisible), so both forms are the same height */
.lg-btn.lg-keep { opacity: 0; pointer-events: none; }
.lg-btn.lg-keep.text-swap { animation: fadeOut 0.3s ease both; } /* the passkey button fades away rather than vanishing */
/* Sign in <-> Create account swipe sideways: pages passing the screen edge are clipped, never scroll the screen */
.login { overflow-x: hidden; } /* app.js also pins scrollLeft to 0: "hidden" still lets focus() scroll sideways */
/* sign-in buttons: Sign in is My Workout's lime as a solid colour (black text, soft lime glow);
   Sign in with passkey is white */
html:root:root .lg-btn:not(.ghost) {
  background: #c8f03c; /* solid lime */ color: #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 10px 30px -14px var(--lime-glow);
}
html:root:root .lg-btn:not(.ghost):hover { background: #c8f03c; filter: brightness(1.05); }
html:root:root .lg-btn.ghost {
  background: #fff; color: var(--brand); border: 0;
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
html:root:root .lg-btn.ghost:hover { background: #f1f1f1; }

/* ==========================================================================
   Light mode: the blue accents become Cashku's green (Forest #1F5C35, a lighter shade of the sign-in backdrop) with cream on top.
   Covers everything that used the blue: buttons, the + button, selected pills and chips, segment thumbs,
   toggles, the selected calendar day, active tab icons, focus rings, checkboxes and transfer / conversion icons.
   ========================================================================== */
html[data-theme="light"] {
  /* Forest: the sign-in green's hue, lifted so it reads as green (the backdrop #122216 looks black as a small button) */
  --brand-accent: #1f5c35;
  --btn: var(--brand-accent); --on-btn: var(--cream);
  --blue: var(--brand-accent); --blue-soft: rgba(31, 92, 53, 0.1);
}
html[data-theme="light"] .day.today:not(.sel) { animation-name: todayGlowLight; }
@keyframes todayGlowLight { 50% { box-shadow: inset 0 0 0 1.5px var(--brand-accent), 0 0 18px -4px rgba(31, 92, 53, 0.5); } }

/* ==========================================================================
   Money accounts on Home: bank cards, e-wallets, cash, and the add card
   ========================================================================== */
/* the add card: the same size and corners as a bank card, drawn as an empty dashed outline */
.bank.bank-add {
  background: transparent; color: var(--muted); border: 1.5px dashed var(--line-2); box-shadow: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.45s var(--ease), opacity 0.45s var(--ease);
}
html:root:root .bank.bank-add { border: 1.5px dashed var(--line-2); box-shadow: none; }
.bank.bank-add::before, .bank.bank-add::after { display: none; }
.bank-add b { color: var(--text); font-size: 15.5px; font-weight: 600; margin-top: 6px; }
.bank-add small { font-size: 12.5px; }
.add-plus { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--btn); color: var(--on-btn); box-shadow: var(--blue-lip); transition: transform 0.15s var(--ease); }
.add-plus .i { width: 22px; height: 22px; stroke-width: 2.2; }
.bank-add:active .add-plus { transform: scale(0.92); }
@media (hover: hover) { .bank-add:hover { border-color: color-mix(in srgb, var(--btn) 45%, transparent); background: color-mix(in srgb, var(--btn) 4%, transparent); } }
/* a lone card (a new user's add card) sits centred, with nothing to swipe */
.cards.single { cursor: default; }
/* e-wallet and cash cards: a round icon badge where a bank card has its chip */
.acct-badge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.bank.is-light .acct-badge { background: rgba(0, 0, 0, 0.08); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }
.acct-badge .i { width: 22px; height: 22px; }
.bank__num.acct-kind { letter-spacing: 0.04em; }
/* the Visa wordmark, drawn in the card's text colour */
.net-visa { width: auto; height: auto; font-weight: 900; font-style: italic; font-size: 20px; letter-spacing: 0.02em; line-height: 1; color: inherit; font-family: Arial, Helvetica, sans-serif; }
/* the buttons under a card: centred when there are fewer than four */
.actions.n1, .actions.n2, .actions.n3 { grid-template-columns: repeat(var(--n), minmax(0, 84px)); justify-content: center; }
.actions.n1 { --n: 1; } .actions.n2 { --n: 2; } .actions.n3 { --n: 3; }
/* account form: Debit/Credit and Visa/Mastercard side by side */
.seg-pair { margin: 4px 0 2px; }
/* Settings → Language: the same sliding ENG / IN pill as the sign-in screen, at the end of its row */
.set-row.set-lang { cursor: default; }
.set-lang .lang-seg { flex: 0 0 auto; margin-left: auto; }
.set-lang .lang-seg button { flex: 0 0 auto; min-width: 42px; font-weight: 700; letter-spacing: 0.04em; }
/* Under each account card: Money in and Money out, two wide buttons that together span the content width */
.actions.wide-acts { grid-template-columns: 1fr 1fr; gap: 10px; }
.wide-act {
  height: 50px; border-radius: 99px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; white-space: nowrap; transition: transform 0.15s var(--ease), filter 0.2s;
}
.wide-act .i { width: 18px; height: 18px; stroke-width: 2.1; }
.wide-act:active { transform: scale(0.97); }
.wide-act.money-in { background: var(--btn); color: var(--on-btn); box-shadow: var(--blue-lip); }
/* Dark mode: Uang masuk lime (the accent), Uang keluar white.
   Light mode: Uang masuk lime, Uang keluar Forest green with cream text. */
.wide-act.money-out { background: #fff; color: #0b0b0b; border: 0; box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(0, 0, 0, 0.18); }
html[data-theme="light"] .wide-act.money-in { background: #c8f03c; color: #0b0b0b; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.15); }
html[data-theme="light"] .wide-act.money-out { background: var(--btn); color: var(--on-btn); box-shadow: var(--blue-lip); }
@media (hover: hover) { .wide-act:hover { filter: brightness(1.06); } }
/* an account card opens its editor when tapped */
.cards .slot .bank[data-act] { cursor: pointer; }
/* the period pills (Today · This week · This month · This year · All time): five equal pills that exactly fill the
   content width, edge to edge with the cards; nothing to scroll */
.picker-row.periods {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; overflow: visible;
  margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
}
.picker-row.periods::after { display: none; }
.picker-row.periods .chip { min-width: 0; padding: 0 4px; font-size: 12.5px; letter-spacing: -0.01em; }
/* wide screens: the row sits beside Total cash at its natural width */
@media (min-width: 1100px) { .home .home-periods.periods { grid-template-columns: repeat(5, auto); } .home .home-periods.periods .chip { padding: 0 14px; font-size: 13px; } }
.picker-row.periods .chip { font-size: var(--pill-fs, 12.5px); } /* app.js fitPeriodPills() lowers it just enough for the longest label */
/* tighter gaps and inner padding, so the shared label size stays as large as possible */
.picker-row.periods { gap: 5px; }
.picker-row.periods .chip { padding: 0 3px; letter-spacing: -0.015em; }
@media (min-width: 1100px) { .home .home-periods.periods { gap: 8px; } .home .home-periods.periods .chip { padding: 0 14px; letter-spacing: 0; } }

/* ==========================================================================
   Home: what you spent the most on (a ring of the period's money out by category)
   Same card as Money in & out; app.js matchPie() makes it exactly as tall.
   ========================================================================== */
:root { --pie-1: #c8f03c; --pie-2: #ff5b4a; --pie-3: #f5a524; --pie-4: #2dd4bf; --pie-5: #a78bfa; --pie-6: #8b8b8b; }
html[data-theme="light"] { --pie-1: #1f5c35; --pie-2: #d63a2a; --pie-3: #e08a00; --pie-4: #0f8f7e; --pie-5: #7c3aed; --pie-6: #9b9ba2; }
.pie-card { display: flex; flex-direction: column; overflow: hidden; }
.pie-body { flex: 1; min-height: 0; display: flex; align-items: center; gap: 18px; padding: 10px 16px 6px; }
.pie-ring { position: relative; flex: 0 0 auto; width: 148px; height: 148px; }
.pie-svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.pie-svg circle { fill: none; }
.pie-track { stroke: var(--card-3); opacity: 0.7; }
.pie-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 30px; pointer-events: none; }
.pie-mid b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.pie-mid small { font-size: 11.5px; color: var(--muted); line-height: 1.25; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pie-legend { flex: 1; min-width: 0; display: grid; gap: 9px; }
.pie-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; }
.pie-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-val { flex: 0 0 auto; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; line-height: 1.2; }
.pie-val small { font-weight: 500; color: var(--muted); font-size: 11px; }
.pie-empty { color: var(--muted); font-size: 13px; line-height: 1.4; }
@media (min-width: 1100px) {
  .home .chart-card.pie-card { grid-area: coming; }
  .home .sh-pie { grid-area: shcoming; margin-top: 32px !important; display: flex; }
  .pie-ring { width: 180px; height: 180px; }
  .pie-body { gap: 32px; padding: 10px 28px; }
}
/* legend rows: category + share on top, the amount underneath, so names have room */
.pie-row { align-items: flex-start; gap: 7px; }
.pie-row .al-dot { margin-top: 4px; flex: 0 0 auto; }
.pie-name { display: flex; flex-direction: column; line-height: 1.25; }
.pie-name b { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-name small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-pct { flex: 0 0 auto; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pie-legend { gap: 7px; }
@media (max-width: 1099px) { .pie-ring { width: 132px; height: 132px; } .pie-body { gap: 16px; } .pie-mid b { font-size: 20px; } }

/* Accounts tab switch: one equal slot per account (named like its card on Home), plus an "Empty" slot that adds one */
.acct-seg button { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-seg.n4 button, .acct-seg.n5 button { padding-left: 4px; padding-right: 4px; font-size: 12.5px; }
.acct-seg .acct-empty {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-weight: 500;
  border: 1.5px dashed var(--line-2); border-radius: 99px; margin: 1px; transition: color 0.2s, border-color 0.2s;
}
.acct-seg .acct-empty .i { width: 13px; height: 13px; stroke-width: 2.2; flex: 0 0 auto; }
@media (hover: hover) { .acct-seg .acct-empty:hover { color: var(--text); border-color: color-mix(in srgb, var(--btn) 45%, transparent); } }
/* an account's description, under its name on the card */
.bank__id { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.bank__desc { font-size: 11.5px; font-weight: 500; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the line under an account page title: one line only (description, or the account type), so switching never moves the page */
.page-sub .acct-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-main { min-width: 0; }

/* ==========================================================================
   Library tab: categories and subcategories for every entry
   ========================================================================== */
.view[data-page="library"] { max-width: 720px; }
.lib-seg { margin: 2px 0 10px; }
.lib-seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; padding-right: 4px; font-size: 12.5px; font-weight: 600; }
.lib-hint { margin: 0 2px 16px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.lib-list { display: grid; gap: 10px; }
.lib-cat { padding: 4px 14px 14px; }
.lib-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; text-align: left; }
.lib-head .r-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lib-head .r-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-head .r-sub { font-size: 12px; color: var(--muted); }
.lib-pen { width: 16px; height: 16px; color: var(--muted); }
.lib-subs { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-subs .chip { height: 32px; padding: 0 12px; font-size: 12.5px; }
.lib-add-sub { gap: 4px; color: var(--muted) !important; background: transparent !important; border: 1.5px dashed var(--line-2) !important; box-shadow: none !important; }
.lib-add-sub .i { width: 13px; height: 13px; stroke-width: 2.2; }
.lib-add { width: 100%; margin-top: 14px; gap: 6px; }
.lib-add .i { width: 16px; height: 16px; }
/* icon picker in the category form */
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.icon-opt { position: relative; display: grid; place-items: center; cursor: pointer; }
.icon-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.icon-opt .mono { width: 42px; height: 42px; border-radius: 12px; transition: box-shadow 0.2s, transform 0.15s var(--ease); }
.icon-opt:active .mono { transform: scale(0.92); }
.icon-opt:has(input:checked) .mono { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--btn); }
.icon-opt:has(input:focus-visible) .mono { outline: 2px solid var(--btn); outline-offset: 4px; }

/* Library: the asset kind's colour, and the full name of the chosen kind under the short pills */
.mono.asset { background: color-mix(in srgb, #a78bfa 18%, transparent); color: #8b5cf6; border-color: transparent; }
.lib-kind-title { margin: 6px 2px 2px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.lib-kind-title + .lib-hint { margin-top: 2px; }

/* Net worth: what you have (accounts, assets, money owed to you) and what you owe (debts, credit cards) */
.nw-total.down { color: var(--down); }
.nw-debt-bar { margin-top: -2px; height: 6px; opacity: 0.85; }
.nw-sec { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.nw-sec b { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--text); font-variant-numeric: tabular-nums; }
.nw-sec b.down { color: var(--down); }
.nw-sec-owe { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.nw-items { display: grid; gap: 6px; margin: 4px 0 6px 20px; }
.nw-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.nw-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-item b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nw-item b.down { color: var(--down); }

/* Home: under the cards, the page dots in the middle and "+ New account" at the right */
.dots-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: -4px; min-height: 28px; }
.dots-row .dots { grid-column: 2; margin: 0; }
.dots-add {
  grid-column: 3; justify-self: end; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--muted); border: 1.5px dashed var(--line-2); transition: color 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.dots-add .i { width: 13px; height: 13px; stroke-width: 2.2; }
.dots-add:active { transform: scale(0.95); }
@media (hover: hover) { .dots-add:hover { color: var(--text); border-color: color-mix(in srgb, var(--btn) 50%, transparent); } }
/* Money in / out: one fixed row for the card on show (it no longer slides with the cards) */
#card-acts { margin-top: 16px; }

/* Settings → Card order */
.ord-list { display: grid; gap: 8px; margin: 6px 0 4px; }
.ord-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); }
.ord-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-size: 12px; font-weight: 700; background: var(--btn); color: var(--on-btn); }
.ord-row .card-dot { width: 34px; height: 22px; }
.ord-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ord-name b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-name small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-row .mini-btn { flex: 0 0 auto; }
.ord-row .mini-btn:disabled { opacity: 0.3; pointer-events: none; }

/* a category's own icon colour (Library cards and the icon picker) */
.mono.cc { background: color-mix(in srgb, var(--cc) 16%, transparent); color: var(--cc); border-color: transparent; }
/* the "default" swatch: the kind's own colour, shown as its tinted circle with a small dot */
.swatch.swatch-auto { background: var(--card-2); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.swatch.swatch-auto::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: currentColor; pointer-events: none; }
.swatch.swatch-auto.out { color: var(--down); } .swatch.swatch-auto.in { color: var(--up); } .swatch.swatch-auto.move { color: var(--blue); }
.swatch.swatch-auto.accent { color: var(--btn); } .swatch.swatch-auto.asset { color: #8b5cf6; }
.cat-swatches { gap: 8px; }
.cat-swatches .swatch { width: 34px; height: 34px; }
