/* Money — mobile-first stylesheet.
 *
 * Two rules run through the whole file:
 *
 * 1. Direction-aware properties only. `margin-inline-start`, `inset-inline-end`,
 *    `padding-block` — never `margin-left` or `right`. The Arabic interface then
 *    mirrors correctly from the `dir` attribute alone, with no second stylesheet and
 *    no per-component overrides.
 *
 * 2. Phone first, desktop as a centred column. A spending log has no use for a
 *    1400px-wide table, and constraining the width keeps one layout to reason about.
 */

/* ---------------------------------------------------------------- design tokens */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e6e8ec;
  --text: #16181d;
  --text-muted: #767c86;
  --text-faint: #9aa0a8;
  --accent: #111418;
  --accent-text: #ffffff;
  --income: #16a34a;
  --danger: #dc2626;
  --warn: #f59e0b;
  --ok: #16a34a;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --pad: 16px;
  --gap: 12px;

  --shadow: 0 1px 2px rgba(16, 18, 22, .05), 0 8px 24px rgba(16, 18, 22, .06);
  --shadow-lift: 0 -6px 28px rgba(16, 18, 22, .14);

  --tap: 44px;                       /* minimum touch target */
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.2, .7, .3, 1);
  --dur: .18s;

  /* Dropdown chevron. A real SVG rather than the two-triangle gradient trick, which
   * renders inconsistently and breaks the moment any rule uses the `background`
   * shorthand. `currentColor` cannot cross into a data URI, so the stroke colour is
   * baked in and the whole URL is swapped per theme below. */
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767c86' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9.5l6 6 6-6'/></svg>");
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b0d10;
    --surface: #14171c;
    --surface-2: #1a1e24;
    --border: #272c34;
    --text: #eef1f4;
    --text-muted: #9aa2ad;
    --text-faint: #6f7783;
    --accent: #eef1f4;
    --accent-text: #0b0d10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 -6px 28px rgba(0, 0, 0, .5);
    --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa2ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9.5l6 6 6-6'/></svg>");
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e24;
  --border: #272c34;
  --text: #eef1f4;
  --text-muted: #9aa2ad;
  --text-faint: #6f7783;
  --accent: #eef1f4;
  --accent-text: #0b0d10;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lift: 0 -6px 28px rgba(0, 0, 0, .5);
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa2ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9.5l6 6 6-6'/></svg>");
}

/* ------------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               "Noto Sans Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Stops the whole page rubber-banding when a sheet is open. */
  overscroll-behavior-y: none;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
svg { width: 100%; height: 100%; }

/* Numbers must not shuffle sideways as they change — every figure uses tabular
 * digits so a total updating from 990 to 1,010 does not shift the layout. */
.hero__value, .amount__value, .txrow__amount, .fact__value, .catlist__value,
.budget__figure, .sub__amount, .strong { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------- app shell */

.app {
  max-width: 480px;
  margin-inline: auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: var(--pad);
  padding-block-end: calc(var(--tabbar-h) + var(--safe-b) + 28px);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

body.is-centered .app { justify-content: center; }
body.is-centered .content { padding-block-end: var(--pad); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px var(--pad);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-block-end: 1px solid transparent;
}

.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }
.inline { display: inline-flex; }

/* -------------------------------------------------------------------- primitives */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card__title { font-size: 14px; font-weight: 650; color: var(--text-muted); }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.strong { font-weight: 650; }
.danger { color: var(--danger); }
.is-warn { color: var(--warn); }
.rule { border: 0; border-block-start: 1px solid var(--border); margin: 4px 0; }
.hint { color: var(--text-muted); font-size: 13px; padding: 2px 4px; }
.link { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: scale(.975); }
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--quiet { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn--wide { width: 100%; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  padding: 11px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn--quiet { width: 34px; height: 34px; padding: 8px; }
.icon-btn.is-disabled { pointer-events: none; opacity: 0; }

.chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip--ghost { background: transparent; }

.alert { padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; }
.alert--error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ------------------------------------------------------------------------- forms */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.field--narrow { max-width: 116px; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="color"], select {
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* background-color, never the `background` shorthand — the shorthand resets
     background-image, which is where every select's chevron lives. */
  background-color: var(--surface);
  color: var(--text);
  /* 16px minimum: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[type="color"] { padding: 4px; }
select {
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-size: 15px 15px;
  background-position: right 11px center;
  padding-inline-end: 34px;
  cursor: pointer;
}
/* The chevron moves to the other side in Arabic; nothing else needs to change,
   because the arrow is symmetrical. */
:root[dir="rtl"] select {
  background-position: left 11px center;
}
select:disabled { opacity: .55; cursor: default; }

.switch { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch span { font-size: 15px; }

.more > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 0;
  list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+ "; }
.more[open] > summary::before { content: "− "; }

/* -------------------------------------------------------------------------- hero */

.hero { padding: 16px 4px 4px; }
.hero__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.hero__value {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 1.15;
  margin-block-start: 2px;
}
.hero__currency { font-size: 15px; font-weight: 600; color: var(--text-faint); letter-spacing: 0; }
.hero__sub { font-size: 14px; color: var(--text-muted); margin-block-start: 4px; }
.hero__sub--in { color: var(--income); }
.hero__sub.is-up { color: var(--danger); }
.hero__sub.is-down { color: var(--income); }

/* ------------------------------------------------------------------ progress bar */

.bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--ok);
  transition: width .35s var(--ease);
}
.bar--warn .bar__fill { background: var(--warn); }
.bar--over .bar__fill { background: var(--danger); }

/* -------------------------------------------------------------- transaction list */

.list { display: flex; flex-direction: column; gap: 2px; }
.list__heading {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 4px 6px;
}

.txrow { position: relative; border-radius: var(--radius-sm); overflow: hidden; }

.txrow__surface {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform var(--dur) var(--ease);
  touch-action: pan-y;
}
.txrow.is-open .txrow__surface { transform: translateX(calc(var(--swipe-dir, -1) * 76px)); }

.txrow__main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  background: none;
  border: 0;
  text-align: start;
  cursor: pointer;
  min-height: 58px;
}

.txrow__icon {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  font-size: 17px;
}
.txrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.txrow__name { font-size: 15px; font-weight: 600; }
.txrow__note {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txrow__amount { font-size: 16px; font-weight: 650; text-align: end; white-space: nowrap; }
.txrow__amount.is-income { color: var(--income); }
.txrow__fx { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); }

.txrow__delete {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 76px;
  display: grid;
  place-items: center;
  background: var(--danger);
  border-radius: var(--radius-sm);
}
.txrow__delete button {
  width: 24px; height: 24px;
  background: none; border: 0; color: #fff; cursor: pointer; padding: 0;
}

/* ------------------------------------------------------------------ empty states */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 36px 24px;
  color: var(--text-muted);
}
.empty__mark { width: 40px; height: 40px; color: var(--text-faint); margin-block-end: 4px; }
.empty__title { font-size: 16px; font-weight: 650; color: var(--text); }
.empty__body { font-size: 14px; max-width: 26ch; }

/* ---------------------------------------------------------------------- stats UI */

.monthnav { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.monthnav__label { font-size: 15px; font-weight: 650; }

.donut-wrap { position: relative; display: grid; place-items: center; padding: 6px 0 2px; }
.donut { width: 176px; height: 176px; }
.donut__track { stroke: var(--surface-2); }
.donut__center { position: absolute; display: grid; place-items: center; text-align: center; }
.donut__big { font-size: 26px; font-weight: 700; }
.donut__small { font-size: 11px; color: var(--text-faint); }

.catlist { display: flex; flex-direction: column; gap: 9px; margin-block-start: 6px; }
.catlist__item {
  display: grid;
  grid-template-columns: 9px 1fr auto auto;
  grid-template-areas: "dot name value pct" "dot bar bar bar";
  align-items: center;
  gap: 3px 9px;
  font-size: 14px;
}
.catlist__dot { grid-area: dot; width: 9px; height: 9px; border-radius: var(--radius-pill); }
.catlist__name { grid-area: name; font-weight: 600; }
.catlist__value { grid-area: value; font-weight: 650; }
.catlist__pct { grid-area: pct; color: var(--text-faint); font-size: 12px; min-width: 34px; text-align: end; }
.catlist__bar { grid-area: bar; height: 5px; border-radius: var(--radius-pill); background: var(--surface-2); }
.catlist__bar i { display: block; height: 100%; border-radius: var(--radius-pill); }

.bars { display: flex; align-items: flex-end; gap: 7px; height: 132px; padding-block-start: 8px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars__bar {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.bars__col.is-current .bars__bar { background: var(--accent); border-color: var(--accent); }
.bars__label { font-size: 11px; color: var(--text-faint); }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fact__label { font-size: 12px; color: var(--text-muted); }
.fact__value { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.fact__value.is-income { color: var(--income); }
.fact__value.is-danger { color: var(--danger); }

/* -------------------------------------------------------- budgets, subscriptions */

.budget__name { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.budget__icon { font-size: 17px; }
.budget__figure { display: flex; align-items: baseline; gap: 7px; }
.budget__figure strong { font-size: 23px; letter-spacing: -.4px; }

.candidate__q { font-size: 15px; line-height: 1.5; }
.candidate__actions { display: flex; gap: 8px; }
.candidate__actions form { flex: 1; }
.candidate__actions .btn { width: 100%; }

.sub__name { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.sub__icon { font-size: 17px; }
.sub__amount { font-weight: 700; }
.sub__amount small { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.sub__actions { display: flex; gap: 8px; }
.sub.is-cancelled { opacity: .5; }

.catmanage { display: flex; flex-direction: column; }
.catmanage__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-block-end: 1px solid var(--border);
}
.catmanage__item:last-child { border-block-end: 0; }
.catmanage__icon { font-size: 18px; width: 24px; text-align: center; }
.catmanage__name { flex: 1; font-size: 14px; font-weight: 600; display: flex; flex-direction: column; }
.catmanage__name small { font-weight: 400; font-size: 11px; }
.catmanage__item.is-archived { opacity: .45; }

/* -------------------------------------------------------------------------- auth */

.auth { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.auth__brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.auth__mark { width: 46px; height: 46px; color: var(--text); }
.auth__brand h1 { font-size: 25px; font-weight: 700; letter-spacing: -.5px; }
.auth__form { gap: 14px; }
.auth__lang { text-align: center; }

/* ----------------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  max-width: 480px;
  margin-inline: auto;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-block-end: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-block-start: 1px solid var(--border);

  /* Pin it to the bottom reliably on mobile.
   *
   * A `position: fixed` element carrying a `backdrop-filter` is repainted late by
   * iOS Safari and Chrome Android while their address bar collapses or expands,
   * which shows up as the bar sitting a few pixels above the bottom edge for a
   * moment. Promoting it to its own compositor layer means the browser moves the
   * existing layer instead of repainting it, so it tracks the viewport exactly. */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* Belt and braces for the same problem: paint the bar's background well past its
 * own bottom edge. Whatever the viewport does during a toolbar transition, there is
 * never bare page visible underneath — and because it is a child of the bar it moves
 * with it, so it costs nothing at rest. */
.tabbar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 100%;
  height: 120px;
  background: inherit;
  backdrop-filter: inherit;
  pointer-events: none;
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-faint);
  transition: color var(--dur) var(--ease);
}
.tabbar__item.is-active { color: var(--text); }
.tabbar__icon { width: 22px; height: 22px; }
.tabbar__label { font-size: 10.5px; font-weight: 600; }

.tabbar__add {
  justify-self: center;
  width: 52px;
  height: 52px;
  padding: 13px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--dur) var(--ease);
}
.tabbar__add:active { transform: scale(.92); }

/* ------------------------------------------------------------------------ sheets */

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(8, 10, 13, .45); animation: fade var(--dur) var(--ease); }

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-start-start-radius: 20px;
  border-start-end-radius: 20px;
  box-shadow: var(--shadow-lift);
  padding: 8px var(--pad) calc(var(--pad) + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise .24s var(--ease);
}

@keyframes rise { from { transform: translateY(16px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.sheet__head { display: flex; align-items: center; justify-content: space-between; }
.sheet__head h2 { font-size: 16px; font-weight: 650; }
.sheet__spacer { width: var(--tap); }
.sheet__actions { display: flex; gap: 8px; }
.sheet__error { font-size: 13px; color: var(--danger); }

.sheet__kinds { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-pill); }
.seg {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.amount { display: flex; align-items: baseline; justify-content: center; gap: 9px; padding: 6px 0 2px; }
.amount__value { font-size: 46px; font-weight: 700; letter-spacing: -1.4px; line-height: 1.1; }
.amount__currency {
  width: auto;
  min-height: 30px;
  /* Logical padding so the chevron gutter lands on the correct side in Arabic. */
  padding-inline: 11px 27px;
  border: 0;
  border-radius: var(--radius-pill);
  background-color: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background-size: 13px 13px;
  background-position: right 8px center;
}
:root[dir="rtl"] .amount__currency { background-position: left 8px center; }

.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; max-height: 188px; overflow-y: auto; }
.cats[hidden] { display: none; }
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 66px;
  padding: 6px 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.cat:active { transform: scale(.95); }
.cat.is-active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent); }
.cat__icon { font-size: 19px; }
.cat__name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cat.is-active .cat__name { color: var(--text); }

.note { width: 100%; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.key {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 21px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s var(--ease), background var(--dur) var(--ease);
  user-select: none;
}
.key:active { transform: scale(.94); background: var(--border); }
.key--del { padding: 14px 17px; }

/* ------------------------------------------------------------------------ toasts */

.toast-host {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 420px);
  padding: 11px 15px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in .22s var(--ease);
}
.toast.is-leaving { animation: toast-out .18s var(--ease) forwards; }
.toast button {
  background: none;
  border: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
}

@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(6px); opacity: 0; } }

/* ------------------------------------------------------------------ preferences */

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

@media (min-width: 560px) {
  .content { padding: 20px; }
  .tabbar { border-radius: 18px 18px 0 0; }
}
