/* ==========================================================================
   Cozzi Finance — styled after the My Workout app: true black, layered dark
   cards, one lime accent, Inter 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: one flat blue, white on top */
  --btn: #0040ff;
  --on-btn: #fff;
  --up: #c8f03c;
  --up-soft: rgba(200, 240, 60, 0.13);
  --down: #ff5b4a;
  --down-soft: rgba(255, 91, 74, 0.14);
  --blue: #4f8bff;
  --blue-soft: rgba(79, 139, 255, 0.15);
  --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);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "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; border-radius: 10px; }
.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; }
.hello { color: var(--muted); font-size: 12.5px; }
.name { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 500; height: 42px; margin-left: -6px; padding-right: 8px; }
.back .i { width: 22px; height: 22px; }
.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; }
.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: 34px;
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -20px; padding: 6px var(--peek) 18px; overscroll-behavior-x: contain; cursor: grab;
}
.cards::-webkit-scrollbar { display: none; }
.cards.dragging { scroll-snap-type: none; cursor: grabbing; }
.slot { flex: 0 0 100%; 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: 0 24px 48px -22px var(--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;
  --shadow: color-mix(in srgb, var(--c) 55%, 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%);
  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; }

/* 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 { max-width: calc(100% - 28px); margin: 4px auto 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; animation: rise 0.4s var(--ease) both; text-align: center; }
.action:nth-child(2) { animation-delay: 0.04s; } .action:nth-child(3) { animation-delay: 0.08s; } .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(200, 240, 60, 0.2), transparent 58%), linear-gradient(180deg, #1b1b1b 0%, #101010 100%); border-color: rgba(200, 240, 60, 0.16); }

/* ---------- chart ---------- */
.chart-card { padding: 16px 0 10px; }
.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; }
@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; }
.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.3s var(--ease), width 0.3s var(--ease); }
.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::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; }
.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; }
.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 */

/* ---------- quote of the day ---------- */
.quote { padding: 16px 16px 14px; }
.quote__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.quote__head .label { font-size: 12px; }
.quote__toggle { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); margin: -6px -6px -6px 0; }
.quote__toggle .i { width: 18px; height: 18px; transition: transform 0.3s var(--ease); }
.quote.is-collapsed .quote__toggle .i { transform: rotate(180deg); }
.quote__text { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; margin: 12px 0 14px; text-wrap: pretty; animation: quoteIn 0.5s var(--ease) both; }
.quote__text::before { content: "“"; color: var(--lime); margin-right: 2px; }
@keyframes quoteIn { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }
.quote__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.quote__days button { height: 30px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--dim); position: relative; text-align: center; transition: background 0.2s, color 0.2s, transform 0.15s; }
.quote__days button:active { transform: scale(0.9); }
.quote__days button.today { color: var(--text); }
.quote__days button.today::after { content: ""; position: absolute; left: 50%; bottom: -3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--lime); }
.quote__days button[aria-pressed="true"] { background: var(--btn); color: var(--on-btn); }

/* ---------- 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; }
.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(0, 64, 255, 0.6); } }
.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 ---------- */
.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.72); border: 1px solid var(--line-2); border-bottom: 0;
  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; overscroll-behavior: contain;
  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 14px; }
.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: 1fr 1fr; gap: 0 10px; }
.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; }
.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; }
.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 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 .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;
  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); }

/* ---------- passcode screen ---------- */
.no-session #shell, .no-session .tabbar { visibility: hidden; }
.login { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; justify-content: center; transition: opacity 0.35s ease, transform 0.35s var(--ease); }
.login.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.lg {
  width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(var(--safe-top) + 40px) 20px calc(var(--safe-bottom) + 26px);
}
.lg-mark { width: 64px; height: 64px; border-radius: 20px; background: var(--lime-grad); display: grid; place-items: center; color: #000; box-shadow: 0 16px 40px -16px var(--lime-glow); }
.lg-mark svg { height: 28px; fill: currentColor; }
.lg-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 22px 0 6px; }
.lg-sub { color: var(--muted); font-size: 14px; max-width: 30ch; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 34px 0 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #555; transition: background 0.15s, border-color 0.15s, transform 0.2s var(--ease); }
.pin-dots i.on { background: #fff; border-color: #fff; transform: scale(1.1); }
.pin-dots.ok i { background: var(--lime); border-color: var(--lime); }
.login-err { color: var(--down); font-size: 13px; min-height: 20px; margin: 8px 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 96px); gap: 6px 14px; justify-content: center; margin-top: auto; }
.key { width: 96px; height: 68px; font-size: 30px; font-weight: 400; display: grid; place-items: center; color: #fff; transition: opacity 0.12s, transform 0.12s var(--ease); }
.key:active { opacity: 0.4; transform: scale(0.9); }
.key.ghost { color: var(--muted); font-size: 15px; }
.key .i { width: 26px; height: 26px; }
.shake { animation: shake 0.4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (max-height: 680px) { .key { width: 84px; height: 58px; } .keypad { grid-template-columns: repeat(3, 84px); gap: 4px 12px; } .lg { padding-top: calc(var(--safe-top) + 20px); } }

.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);
  --up: #3f7d0a; --up-soft: rgba(110, 170, 20, 0.16); --down: #d63a2a; --down-soft: rgba(214, 58, 42, 0.1);
  --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: #5d8a0c;
  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; }
html[data-theme="light"] .stat.feature { background: radial-gradient(110% 85% at 100% 0%, rgba(200, 240, 60, 0.35), transparent 58%), #fff; border-color: rgba(120, 170, 20, 0.25); }
html[data-theme="light"] .avatar { 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"] .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"] .backdrop { background: rgba(0, 0, 0, 0.3); }
html[data-theme="light"] .sheet { background: rgba(255, 255, 255, 0.82); }
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"] .quote__text::before { color: #4d8a0c; }
html[data-theme="light"] .chart .tip { background: rgba(255, 255, 255, 0.85); 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.85); color: #0b0b0b; border-color: rgba(0, 0, 0, 0.1); }
html[data-theme="light"] .info a { color: #4d8a0c; }
/* 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; }
}
