/* Geist and Geist Mono (SIL Open Font License, see fonts/OFL-*.txt), served from this site so the app
   never contacts another website. Other scripts, like Arabic or Armenian, use the phone's own fonts. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/geist-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Base reset and safe-area padding for phones with a notch. */
:root {
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html {
  overflow-x: clip;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
body {
  margin: 0;
  padding: 0;
}
img {
  max-width: 100%;
}
[hidden]:not([hidden='until-found' i]) {
  display: none !important;
}

/* Layout: one narrow column (max 520px); sticky header, fixed bottom tab bar + add button; entry happens in bottom sheets */
:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --fg: #14201b;
  --muted: #5b6964;
  --line: #dce3e0;
  --accent: #1d6a50;
  --accent-ink: #ffffff;
  --accent-soft: #e0eee8;
  /* The logo's coins. The two greens follow a chosen accent (see palette in theme.js); the gold never changes. */
  --coin-1: #2f6b4f;
  --coin-2: #3e8562;
  --coin-3: #c9a227;
  --warn: #a86d12;
  --bad: #b23f37;
  --bad-soft: #f7e3e1;
  --scrim: rgba(10, 20, 16, 0.38);
  --f-body: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-num: 'Geist Mono', ui-monospace, 'SF Mono', 'Roboto Mono', Menlo, monospace;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1311;
    --surface: #161d1a;
    --fg: #e5ede9;
    --muted: #8fa099;
    --line: #25302b;
    --accent: #55b892;
    --accent-ink: #06140f;
    --accent-soft: #16332a;
    --coin-1: #5fa882;
    --coin-2: #7fb59a;
    --coin-3: #d9b23a;
    --warn: #e2a94b;
    --bad: #e57f76;
    --bad-soft: #3a1f1c;
    --scrim: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1311;
  --surface: #161d1a;
  --fg: #e5ede9;
  --muted: #8fa099;
  --line: #25302b;
  --accent: #55b892;
  --accent-ink: #06140f;
  --accent-soft: #16332a;
  --coin-1: #5fa882;
  --coin-2: #7fb59a;
  --coin-3: #d9b23a;
  --warn: #e2a94b;
  --bad: #e57f76;
  --bad-soft: #3a1f1c;
  --scrim: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  /* Every page is at least as tall as the screen (less the notch and home bar the root pads for), so a
     short page fills it like a long one, and nothing depends on the page being scrollable. */
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.num,
.amt {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
}
.label {
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}
.muted {
  color: var(--muted);
}
h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* header */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--bg);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
/* The logo: three coins getting smaller, like change. Fixed brand colours, not the accent. */
.coins {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-right: 2px;
  flex: none;
}
.coins i {
  display: block;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--coin-1);
}
.coins i:nth-child(2) {
  width: 11px;
  height: 11px;
  background: var(--coin-2);
}
.coins i:nth-child(3) {
  width: 7px;
  height: 7px;
  background: var(--coin-3);
}
/* Geist has no Arabic letters, so the phone's own Arabic font is used. */
.brand-ar {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 2px;
}
.top-sub {
  font-size: 13px;
  color: var(--muted);
}
.top-sub {
  white-space: nowrap;
}
.top-end {
  display: flex;
  align-items: center;
  /* The last icon's drawing ends flush with the page's right edge, like the cards below; the buttons'
     own padding (9px each side of an icon) is pulled out. */
  margin-right: -9.7px;
}
.top-end .icon-btn {
  width: 34px;
}
.top-end .icon-btn svg {
  width: 22px;
  height: 22px;
}
/* The date and the two icons sit evenly: the same 18px from drawing to drawing. */
.top-end .top-sub {
  margin-right: 9.7px;
}

main {
  flex: 1;
}
/* A page following a sideways swipe must not make the screen scroll sideways. The browser is also told
   up front that pages only scroll up and down (pinch-zoom stays), so a sideways swipe goes straight to
   the tab swipe in js/ui/swipe.js instead of the browser first trying to handle it. */
main {
  overflow-x: clip;
  touch-action: pan-y pinch-zoom;
}
main .wrap {
  position: relative;
  padding-block: 6px calc(130px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.view {
  display: flex;
  flex-direction: column;
  gap: 26px;
}
/* The tab coming in next to the current one during a swipe (js/ui/swipe.js). */
.view.paging {
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
}
.sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 30px;
}

/* banner */
.banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-soft);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 14px;
}
.banner p {
  margin: 0;
}
.banner.bad {
  background: var(--bad-soft);
}
#alerts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* balance */
.balance {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.balance-total {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.balance-total small {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 6px;
}
.balance-split {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.balance-split span {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.balance-split em {
  font-style: normal;
  font-family: var(--f-body);
  font-size: 12px;
  color: var(--muted);
}
/* Home sections fold down to their header and a tiny summary of what's inside (js/views/home.js). */
.fold-title {
  flex: 1;
  min-width: 0;
}
.fold-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
}
.fold-head > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
  transition: transform 0.15s;
}
.fold-head[aria-expanded='true'] > svg {
  transform: rotate(90deg);
}
.fold-sum {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.fold-sum .glyph {
  width: 20px;
  height: 20px;
  font-size: 11px;
}
.mini-stats {
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.mini-stats .in {
  color: var(--accent);
}
.ring {
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}
.ring .fill {
  stroke: var(--accent);
  stroke-linecap: round;
}
.ring.warn .fill {
  stroke: var(--warn);
}
.ring.over .fill {
  stroke: var(--bad);
}
/* Accounts besides the main one, folded into one row on Home until opened. */
.accs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.accs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 4px 0;
  text-align: left;
  color: inherit;
}
/* Quiet, like the label beside it: the tiles carry the amounts. */
.accs-total {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.accs-head svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s;
}
.accs-head[aria-expanded='true'] svg {
  transform: rotate(90deg);
}
.acc-name .label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.acc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
}
.acc .amt {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acc .amt.sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}
.acc-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.acc-name svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.acc-open {
  background: none;
  border: 0;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.acc-open svg {
  width: 14px;
  height: 14px;
}
.balance-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -8px 0 -6px;
}
/* "Hide amounts": balances blurred, for showing the app to someone. */
.priv {
  transition: filter 0.15s;
}
.hide-amounts .priv {
  filter: blur(9px);
  user-select: none;
}
/* Settings → Accounts: a name to edit, a savings switch and Remove on each line. */
.acct-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.acct-row .input {
  flex: 1;
  min-width: 0;
}
.acct-save {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  color: var(--muted);
}
.acct-save input {
  accent-color: var(--accent);
}
.acct-main {
  font-size: 13.5px;
  padding: 0 6px;
}
/* Which account an entry is paid from or lands in. */
.acct-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
}
.acct-pick .seg {
  flex: 1;
}
/* History showing one account. */
.acct-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.acct-name {
  flex: 1;
  min-width: 0;
}
.acct-name h2 {
  margin: 0;
  font-size: 20px;
}
.acct-name p {
  margin: 2px 0 0;
  color: var(--muted);
}

/* segmented */
.seg {
  display: inline-flex;
  background: var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
}
.seg button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.seg.wide {
  display: flex;
}
.seg.wide button {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The narrowest phones: four tabs such as Expense / Income / Transfer / Exchange still read in full. */
@media (max-width: 359px) {
  .seg.wide button {
    font-size: 12.5px;
    padding-inline: 2px;
  }
}

/* lists */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.row:first-child {
  border-top: 0;
}
button.row,
.row > button.row-btn {
  width: 100%;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  text-align: left;
  color: inherit;
}
button.row:first-child {
  border-top: 0;
}
.row > button.row-btn {
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.glyph {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 14px;
  flex: none;
}
.glyph.tr {
  background: var(--line);
  color: var(--muted);
}
.glyph.in {
  background: var(--accent);
  color: var(--accent-ink);
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.row-title {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.amt {
  white-space: nowrap;
  text-align: right;
}
.amt.in {
  color: var(--accent);
}
.amt.tr {
  color: var(--muted);
}
.count {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--f-num);
}
.icon-btn {
  border: 0;
  background: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.icon-btn:hover {
  background: var(--line);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.day-head {
  display: flex;
  justify-content: space-between;
  padding: 14px 2px 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat .amt {
  text-align: left;
  font-size: 16px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* budgets */
.budget {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  width: 100%;
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
}
.budget:first-child {
  border-top: 0;
}
.b-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.b-name {
  font-weight: 550;
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.b-name span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  flex: none;
}
.pill.warn {
  color: var(--warn);
  border-color: currentColor;
}
.pill.over {
  color: var(--bad);
  border-color: currentColor;
}
.b-nums {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  white-space: nowrap;
}
.bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  max-width: 100%;
}
.bar.warn > i {
  background: var(--warn);
}
.bar.over > i {
  background: var(--bad);
}
.b-foot {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* month switch */
.month-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.month-switch strong {
  font-size: 17px;
  font-weight: 600;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.search {
  flex: 1;
  min-width: 140px;
}

/* buttons, fields */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 550;
  font-size: 14.5px;
}
/* Links that look like buttons, such as the feedback links. */
a.btn {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.ghost {
  background: none;
}
.btn.danger {
  color: var(--bad);
  border-color: var(--bad-soft);
}
.btn.danger.armed {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn.sm {
  padding: 6px 12px;
  font-size: 13.5px;
  border-radius: 9px;
}
.link {
  border: 0;
  background: none;
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  padding: 4px 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > span {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  min-width: 0;
}
.field input[type='date'] {
  /* Safari gives a date field a width of its own, wider than a half-width column; this lets it fit. */
  -webkit-appearance: none;
  appearance: none;
  display: block;
  max-width: 100%;
  min-height: 44px;
  text-align: left;
}
.field input[type='date']::-webkit-date-and-time-value {
  text-align: left;
}
.field textarea {
  font-family: var(--f-num);
  font-size: 16px;
  min-height: 120px;
  resize: vertical;
}
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card p {
  margin: 0;
}
.set-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.set-row .field {
  flex: 1;
}
.cat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cat-row input {
  flex: 1;
}
.cat-row input.emoji {
  flex: 0 0 44px;
  width: 44px;
  text-align: center;
  padding: 9px 0;
  font-size: 18px;
}
.cat-row .icon-btn {
  width: 32px;
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.icon-btn.armed {
  color: var(--bad);
}
.amt.has-chg {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}
.amt .chg {
  font-size: 12px;
  color: var(--muted);
}
.cur-tag {
  flex: none;
  width: 52px;
  text-align: center;
  font-family: var(--f-num);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 0;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: -10px;
}
.lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sub-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.moves {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.moves .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.moves .btn b {
  font-family: var(--f-num);
  font-weight: 600;
  color: var(--accent);
}
.rate-in {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rate-in input {
  flex: 1;
  min-width: 0;
}
.rate-in span {
  font-size: 13px;
  color: var(--muted);
  flex: none;
}
.chip.sm {
  font-size: 13px;
  padding: 6px 11px;
  align-self: flex-start;
}
.sub-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.note {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.row > .btn.sm {
  flex: none;
}
.news {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.news ul {
  margin: 6px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  align-items: center;
  justify-items: center;
}
.swatch {
  width: 100%;
  max-width: 36px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  color: #fff;
}
.swatch[aria-pressed='true'] {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--c);
}
.swatch svg {
  width: 18px;
  height: 18px;
}
.swatch.custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#e5484d, #f5a524, #46a758, #0090ff, #8e4ec6, #e5484d);
}
.swatch.custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}

/* add button + nav */
.fab {
  position: fixed;
  z-index: 25;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  right: max(calc(16px + env(safe-area-inset-right, 0px)), calc((100vw - 520px) / 2 + 16px));
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(20, 60, 45, 0.28);
}
.fab svg {
  width: 26px;
  height: 26px;
}
/* The tab bar is pinned to the bottom of the screen on every page. Its own layer keeps Safari from
   moving it when the page is short or the browser's bars change. */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateZ(0);
  z-index: 24;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs .wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.tabs button {
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.tabs button svg {
  width: 22px;
  height: 22px;
}
.tabs button[aria-current='page'] {
  color: var(--accent);
}

/* sheet */
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 40;
  /* Dragging the dimmed page behind a sheet moves nothing. */
  touch-action: none;
}
.sheet {
  position: fixed;
  z-index: 41;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  /* Up and down only: the sheet never moves sideways, however wide a field is in Safari. */
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: up 0.18s ease-out;
  /* Pulling the sheet down mustn't scroll the page behind it or trigger pull-to-refresh. */
  overscroll-behavior: contain;
}
@keyframes up {
  from {
    transform: translate(-50%, 24px);
    opacity: 0.6;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: none;
  }
}
.grab {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 2px auto 0;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.amount-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.amount-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  border-bottom: 2px solid var(--line);
  cursor: text;
  font-family: var(--f-num);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.amount-field:focus-within {
  border-color: var(--accent);
}
.amount-field.sm {
  font-size: 20px;
}
.amount-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  font: inherit;
  letter-spacing: inherit;
  border: 0;
  background: none;
  padding: 6px 2px;
  border-radius: 0;
}
.amount-input:focus {
  outline: none;
}
/* LL fields are sized to their text (js/ui/amount.js) so the fixed ",000" follows the number. */
.thousands input {
  flex: 0 0 auto;
  max-width: calc(100% - 4ch);
  padding-right: 0;
}
.k-suffix {
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
}
.k-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 0 12px 0 0;
  cursor: text;
  font-family: var(--f-num);
}
.k-box:focus-within {
  border-color: var(--accent);
}
.field .k-box input {
  border: 0;
  background: none;
  padding-right: 0;
  font-family: var(--f-num);
}
.field .k-box input:focus {
  outline: none;
}
.k-box .k-suffix {
  font-size: 16px;
}
.adj-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.adj-row .sub-label {
  flex: none;
  min-width: 92px;
}
.hint {
  margin: -6px 0 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  font-family: var(--f-num);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14px;
}
.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.form-error {
  margin: 0;
  color: var(--bad);
  font-size: 13.5px;
}
.sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.sheet-actions .primary {
  flex: 1;
}

/* toast */
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  width: calc(100% - 32px);
  max-width: 488px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 12px;
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast button {
  border: 0;
  background: none;
  color: var(--accent-soft);
  font-weight: 700;
  padding: 2px 4px;
}
:root[data-theme='dark'] .toast button {
  color: var(--accent-ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .toast button {
    color: var(--accent-ink);
  }
}

@media (max-width: 380px) {
  .balance-total {
    font-size: 32px;
  }
  .stats .amt {
    font-size: 14px;
  }
}

/* Price-first demo (js/sheets/demo.js): three steps appear one after another, about two seconds in all. */
.banner.tip .icon-btn,
.banner .btn {
  flex: none;
  white-space: nowrap;
}
.demo {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.demo-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: demo-in 0.4s ease-out both;
}
.demo-step:nth-child(2) {
  animation-delay: 0.7s;
}
.demo-step:nth-child(3) {
  animation-delay: 1.4s;
  border-color: var(--accent);
}
.demo-value {
  font-family: var(--f-num);
  font-size: 24px;
  font-weight: 600;
}
@keyframes demo-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .demo-step {
    animation: none;
  }
}
