/* Colors come from themes.css. These names are the ones styles.css already uses. */
:root {
  --r-card: 22px;
  --r-btn: 16px;
  --radius: var(--r-card);
  --r-chip: 999px;
  --r-icon: 40px;
  --on-acc: #141413; /* text on a bright accent fill; not a theme surface */
  --ink: var(--tx);
  --muted: var(--mu);
  --accent: var(--acc);
  --accent-2: var(--acc);
  --on-accent: var(--on-acc);
  --bg2: var(--s1);
  --surface: var(--s1);
  --surface-solid: var(--s1);
  --danger: var(--orange-ink);
  --ok: var(--green-ink);
  --green: var(--green-ink);
  --red: var(--orange-ink);
  --font: "Onest", "Segoe UI", sans-serif;
  --display: "Unbounded", "Onest", sans-serif;
  --max: 1080px;
  /* iPhone notch / home bar. Tests override these two to fake an iPhone. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --tabbar-gap: max(10px, calc(var(--safe-bottom) - 8px));
  color-scheme: dark;
}
html[data-theme="white"],
html[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }
html {
  background: var(--bg);
  /* no pinch and no double-tap zoom anywhere in the app (task Z1); scrolling still works */
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  overflow-x: clip;
  letter-spacing: 0;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  width: 100%;
  /* reach under the notch and the home bar too: no bare strips at the edges */
  top: calc(-1 * var(--safe-top));
  bottom: calc(-1 * var(--safe-bottom));
  height: auto;
  min-height: calc(100lvh + var(--safe-top) + var(--safe-bottom));
  background: transparent;
  transform: translateZ(0);
}

.bg.is-live {
  background: transparent;
}

.bg.is-static,
.bg:not(.is-live) {
  background: linear-gradient(
    180deg,
    var(--bg) 0%,
    var(--bg) 48%,
    var(--bg) 100%
  );
}

/* Light theme: keep static page color — no WebGL rays */
/* page color is --bg from the active theme */

.bg canvas,
.bg .light-rays-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

button, input, select { font: inherit; color: inherit; }

.onboarding,
.backup-banner {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  display: grid;
  gap: 0.45rem;
}
.onboarding[hidden],
.backup-banner[hidden] { display: none; }
.backup-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-banner button { min-height: 44px; }
.backup-banner.is-warn { border-color: var(--danger, #c4554a); }
.data-card { margin: 0 0 12px; padding: 14px 16px; border-radius: 16px; background: var(--s1); display: grid; gap: 6px; overflow-wrap: anywhere; }
.data-card p, .data-hint { margin: 0; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.copy-row span { display: grid; min-width: 0; }
.copy-row small { color: var(--mu); }
.copy-warn { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--mu); }
.copy-row button { min-height: 44px; min-width: 44px; border: 0; border-radius: 999px; padding: 0 14px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; }
.onboard-step {
  appearance: none;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  color: inherit;
  min-height: 44px;
  cursor: pointer;
}
.onboard-sheet {
  display: grid;
  gap: 0.45rem;
}
.onboard-sheet[hidden] { display: none !important; }
.onboard-step.is-done::before { content: "✓ "; color: var(--acc-ink); }
.chat-confirm-actions { display: flex; gap: 0.4rem; margin-top: 0.55rem; flex-wrap: wrap; }
.chat-confirm-actions button, .chat-bubble button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  min-height: 44px;
}
.progress-block.is-empty .progress-track { display: none; }

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  min-width: max-content;
  min-height: 44px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 0;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: none;
  box-shadow: none;
}

.about-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.onboarding > .brand-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
}
.logo-light { display: none; }
html.light .logo-dark,
html.dark .logo-light { display: none; }
html.light .logo-light {
  display: block;
  box-shadow: 0 0 0 1px rgba(11, 16, 32, 0.08);
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

/* Legacy flat nav styles — GooeyNav owns active look */
.nav-link {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 44px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 6%, transparent);
  gap: 2px;
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.lang-btn:hover { color: var(--ink); }
.lang-btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.theme-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--foreground) 6%, transparent);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
.theme-btn:hover { border-color: var(--accent); color: var(--acc-ink); }

.btn-chat,
.btn-primary {
  appearance: none;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-chat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.chat-icon { display: none; flex-shrink: 0; }

.btn-chat:hover { border-color: var(--accent); color: var(--acc-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary.sm { padding: 0.5rem 0.85rem; min-width: 2.75rem; }

/* ——— Main ——— */
.site {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem clamp(1rem, 3vw, 1.5rem) 4rem;
  min-height: calc(100dvh - 140px);
}

.panel[hidden] { display: none !important; }
.panel.is-active { animation: rise 0.28s ease both; }

.page-hero {
  margin-bottom: 2rem;
  max-width: 36rem;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc-ink);
  margin-bottom: 0.65rem;
}

.page-hero h1,
.page-head h1,
#tasksTitle {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.lede {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
}

.lede.tight {
  margin-top: 0.35rem;
  font-size: 0.98rem;
}

.page-head {
  margin-bottom: 1.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.section-head h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head.page-head {
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.text-link {
  appearance: none;
  border: none;
  background: none;
  color: var(--acc-ink);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0;
}

.back-link { margin-bottom: 1rem; display: inline-block; }

/* Progress */
.progress-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 720px) {
  .progress-board { grid-template-columns: 1fr; }
}

.progress-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
}

.progress-block.as-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.progress-block.as-btn:hover { border-color: color-mix(in oklab, var(--accent) 35%, transparent); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.progress-meta strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-ink), var(--acc));
  border-radius: inherit;
  transition: width 0.35s ease;
}

.progress-track.accent > span {
  background: linear-gradient(90deg, var(--acc), var(--acc-soft));
}

.split-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tile {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tile:hover {
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  transform: translateY(-2px);
}

.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
}

.tile-icon.spend { background: rgba(255, 107, 90, 0.12); }
.tile-icon.folder { background: color-mix(in oklab, var(--accent-2) 12%, transparent); }
.tile-icon.invest { background: color-mix(in oklab, var(--accent) 16%, transparent); }

.tile-title {
  font-weight: 700;
  font-size: 1rem;
}

.tile-sub {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.tile-sub.pos { color: var(--ok); }
.tile-sub.neg { color: var(--danger); }

/* Finance */
.balance-banner {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--accent) 10%, transparent), transparent 55%),
    var(--surface);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.6rem 1.4rem;
  margin-bottom: 1.25rem;
}

.balance-banner-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.money-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.btn-money {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-money.in {
  border-color: color-mix(in oklab, var(--accent) 45%, transparent);
  color: var(--ok);
}

.btn-money.out {
  border-color: rgba(255, 107, 90, 0.45);
  color: var(--danger);
}

.btn-money:hover { border-color: var(--accent); }

.wallet-groups,
.wallet-group,
.wallet-grid,
.wallet-card {
  min-width: 0;
  max-width: 100%;
}

.wallet-groups {
  display: grid;
  gap: 1rem;
}

.wallet-group-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.wallet-group-head strong { min-width: 0; }

.wallet-group-sums {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.15rem 0.55rem;
  min-width: 0;
  max-width: 100%;
}

.wallet-group-sums b {
  font-weight: 600;
  white-space: nowrap;
}

.wallet-group-head strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
}

.wallet-card {
  border: 1px solid var(--line);
  background: var(--s1);
  border-radius: var(--r-card);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wallet-card.is-primary {
  border-color: var(--line);
}

.wallet-card-top {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.wallet-emoji {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--wallet-color, var(--accent));
  font-size: 1.1rem;
  flex-shrink: 0;
}

.wallet-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.wallet-name em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.08rem 0.4rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.wallet-amount {
  margin-top: 0.2rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow: visible;
  white-space: nowrap;
}

.wallet-amount .mc-currency {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  max-width: 100%;
}

.wallet-action {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 12px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.wallet-action:hover { border-color: var(--accent); color: var(--acc-ink); }
.wallet-action.danger:hover { border-color: var(--danger); color: var(--danger); }

.wallet-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.wallet-preset {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.wallet-preset:hover {
  border-color: var(--accent);
}

.wallet-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.wallet-form-hint {
  color: var(--muted);
  font-size: 0.88rem;
  grid-column: 1 / -1;
}

.balance-banner-top .btn-primary.sm {
  font-size: 0.88rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.balance-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.balance-value {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.balance-value.mc-root,
.balance-value .mc-root {
  font-family: var(--display);
}

.balance-sub {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 1.1rem;
  max-width: 100%;
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.add-sheet {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.add-sheet[hidden] { display: none !important; }

.add-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.add-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.add-fields input,
.add-fields select,
.inline-add input {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  outline: none;
}

.add-fields input:focus,
.add-fields select:focus,
.inline-add input:focus {
  border-color: var(--accent);
}

.list-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border: none;
  background: transparent;
  overflow: visible;
}

.report-period {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.report-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 9.5rem;
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.report-field input {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-weight: 500;
  color-scheme: inherit;
}

.report-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.tx-list, .folder-list, .check-list { list-style: none; }

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tx-item, .folder-item, .check-item, .menu-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--line);
  width: 100%;
  max-width: 100%;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  box-sizing: border-box;
}

.tx-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  row-gap: 0;
  align-items: center;
}

.folder-item {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tx-item:last-child,
.check-item:last-child { border-bottom: none; }

.folder-item:last-child,
.menu-panel .menu-row {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
}

.menu-panel .menu-row:last-child {
  border-bottom: 1px solid var(--line);
}

.folder-item:hover,
.menu-row:hover,
.tx-item:hover { background: rgba(255, 255, 255, 0.03); }

.tx-icon, .folder-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  font-size: 1rem;
}

.tx-item > .tx-icon { grid-column: 1; grid-row: 1 / span 2; }

.tx-body, .folder-body, .check-body { flex: 1; min-width: 0; }
.tx-item > .tx-body { grid-column: 2; grid-row: 1 / span 2; }

.tx-title, .folder-title, .check-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.check-title.done {
  color: var(--muted);
  text-decoration: line-through;
}

.tx-meta, .folder-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.tx-meta {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.tx-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.tx-amount.pos { color: var(--ok); }
.tx-amount.neg { color: var(--danger); }

.tx-del, .check-del {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
}

.tx-item > .tx-del {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  width: 44px;
  height: 44px;
  padding: 0;
}

.tx-del:hover, .check-del:hover { color: var(--danger); }

.folder-chev, .chev { color: var(--muted); margin-left: auto; }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.check-toggle {
  appearance: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
}

.check-toggle.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.check-toggle.is-on::after {
  content: "✓";
  font-size: 12px;
  font-weight: 600;
}

.inline-add {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.inline-add input { flex: 1; }

.spend-board {
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: color-mix(in oklab, var(--card) 88%, transparent);
}

.report-board {
  margin-bottom: 1.25rem;
  padding: 1.2rem 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: color-mix(in oklab, var(--card) 92%, transparent);
}

.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.report-head h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.report-viz {
  display: grid;
  place-items: center;
  min-height: 260px;
  margin: 0.35rem 0 0.75rem;
}

.report-donut {
  width: min(100%, 300px);
}

.report-donut .donut-center-value {
  font-size: 22px;
}

.month-trend {
  margin: 0.25rem 0 1rem;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 72px;
  padding: 0.35rem 0.15rem;
}

.trend-col {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  min-width: 0;
  padding: 0;
}

.trend-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  background: color-mix(in oklab, var(--muted) 35%, transparent);
}

.trend-col.is-active .trend-bar {
  background: var(--accent);
}

.trend-col.is-active .trend-label {
  color: var(--ink);
}

.trend-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
}

.bubble-field {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.5rem 0.25rem 0.75rem;
  min-height: 260px;
}

.bubble {
  width: var(--bubble, 96px);
  height: var(--bubble, 96px);
  border-radius: 999px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--on-acc);
  padding: 0.55rem;
  box-shadow: 0 10px 28px hsl(0 0% 0% / 0.28);
  line-height: 1.15;
}

.bubble strong {
  font-size: clamp(0.65rem, 2.2vw, 0.82rem);
  font-weight: 600;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: center;
}

.bubble span {
  font-size: clamp(0.62rem, 2vw, 0.78rem);
  font-weight: 700;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.report-cats {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
}

.report-cat {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  column-gap: 0.45rem;
  row-gap: 0.1rem;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 0.65rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.report-cat:hover {
  border-color: var(--line);
  background: color-mix(in oklab, var(--foreground) 3%, transparent);
}

.cat-ring {
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
}

.cat-ring text {
  fill: var(--ink);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font);
}

.report-cat-name {
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-cat-hint {
  grid-column: 2 / -1;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.money-nowrap { white-space: nowrap; }

.report-cat-amt {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.flow-board {
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: color-mix(in oklab, var(--card) 88%, transparent);
}

.flow-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
}

.flow-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--foreground) 3%, var(--card));
  padding: 0.9rem 1rem;
}

.flow-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 0.75rem;
}

.flow-card-copy { min-width: 0; }

.flow-card-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-card-value {
  margin-top: 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}
.flow-card-value.pos { color: var(--ok); }
.flow-card-value.neg { color: var(--danger); }

.flow-card-delta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.flow-spark {
  width: 120px;
  height: 44px;
  display: block;
  justify-self: end;
}

.flow-chart-wrap {
  width: 100%;
  min-height: 200px;
  display: grid;
  place-items: center;
}

.flow-line {
  width: 100%;
  height: auto;
  max-height: 240px;
}

.flow-path {
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.flow-path.income { stroke: var(--accent); }
.flow-path.expense { stroke: color-mix(in oklab, var(--muted) 75%, var(--foreground)); }

.flow-dot.income { fill: var(--accent); }
.flow-dot.expense { fill: color-mix(in oklab, var(--muted) 55%, var(--foreground)); }

.flow-x {
  fill: var(--muted);
  font-size: 10px;
  font-family: var(--font);
}

.flow-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.flow-leg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.flow-leg i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.flow-leg.income i { background: var(--accent); }
.flow-leg.expense i { background: color-mix(in oklab, var(--muted) 55%, var(--foreground)); }

@media (max-width: 640px) {
  .flow-cards { grid-template-columns: 1fr; }
  .flow-card-top { grid-template-columns: minmax(0, 1fr) 108px; }
  .flow-spark { width: 108px; }
}

.spend-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.spend-board-head h2 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.spend-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.chart-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.chart-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chart-toggle-btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.month-strip {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}

.month-chip {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.month-chip.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.spend-chart-wrap {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin-bottom: 0.5rem;
}

.spend-donut {
  width: min(100%, 280px);
  aspect-ratio: 1;
}

.spend-donut text {
  fill: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 11px;
  pointer-events: none;
}

.spend-donut .donut-center-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.spend-donut .donut-center-value {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
}

.spend-bars {
  width: 100%;
  display: grid;
  gap: 0.65rem;
  padding: 0.25rem 0.15rem 0.5rem;
}

.spend-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 28%) 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.88rem;
}

.spend-bar-row .name {
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spend-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.spend-bar-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 2px;
}

.spend-bar-row .pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.4rem;
  text-align: right;
}

.spend-cats {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.spend-cat {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.55rem;
  border-radius: 12px;
  border: 1px solid transparent;
}

.spend-cat:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.spend-cat .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.spend-cat .meta {
  min-width: 0;
}

.spend-cat .cat-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.spend-cat .cat-pct {
  color: var(--muted);
  font-size: 0.82rem;
}

.spend-cat .cat-amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.spend-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.time-scale {
  display: flex;
  gap: 0.35rem;
  margin: -0.35rem 0 0.85rem;
}

.scale-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 44px;
}

.scale-btn.is-active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.time-bars {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.5rem 0.15rem 0;
  overflow-x: auto;
}

.time-bar-col {
  flex: 1;
  min-width: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.time-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.time-bar-col span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.plan-board {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.15rem;
  margin-bottom: 1.25rem;
}

.plan-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.plan-board-head h2 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
}

.budget-head { display: flex; align-items: center; justify-content: space-between; }
.budget-head .icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--acc); color: #111; font-size: 1.6rem; }
.budget-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.budget-tabs button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); }
.budget-tabs button.is-on { background: var(--acc); color: #111; }
.budget-summary, .budget-card, .goal-card { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); border-radius: 22px; padding: 16px; margin-bottom: 12px; }
.budget-summary p, .budget-summary span, .budget-copy em, .goal-card em { color: var(--muted); font-style: normal; }
.budget-summary strong { display: block; font-size: 2rem; margin: 6px 0; }
.budget-summary .alloc-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 8px; }
.budget-card { display: grid; grid-template-columns: 44px 1fr; gap: 8px 12px; width: 100%; text-align: left; color: inherit; border: 0; }
.budget-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--acc) 18%, transparent); }
.budget-copy { display: flex; flex-direction: column; gap: 2px; }
.budget-copy strong { font-size: 1rem; }
.budget-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.budget-track i, .budget-track span { display: block; height: 100%; border-radius: 99px; background: var(--acc); }
.budget-card.is-warn .budget-track i, .budget-card.is-over .budget-track i { background: #e39b3b; }
.goal-card-top { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; color: inherit; text-align: left; min-height: 44px; }
.goal-card-top b { margin-left: auto; }
.goal-card.is-done { outline: 1px solid var(--acc); }
.goal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#bgBody { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
#bgBody .qa-modes { display: flex; flex-wrap: wrap; gap: 8px; }
#bgCats {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
}
#bgSheet .qa-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}
#bgName, #bgDeadline, #bgWallet, #bgFrom {
  flex: 0 0 auto;
  width: 100%;
  height: 44px;
  min-height: 44px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--tx);
  padding: 0 12px;
  box-sizing: border-box;
}

.budget-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 0.65rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.budget-row.total {
  border-top: none;
  padding-top: 0;
}

.budget-row .budget-track {
  grid-column: 1 / -1;
}

.budget-row .wallet-action {
  grid-row: 1;
  grid-column: 2;
}

.budget-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.budget-meta span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.budget-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.budget-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-ink), var(--acc));
}

.budget-row.is-over .budget-track > span {
  background: linear-gradient(90deg, var(--orange-ink), var(--danger));
}

.plan-chips { display: flex; gap: 8px; overflow: auto; margin-bottom: 12px; }
.plan-chips button { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 0; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.plan-chips button.is-on { background: var(--acc); color: #111; }
.plan-row { display: flex; gap: 8px; align-items: flex-start; min-height: 44px; width: 100%; max-width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: 8px 0; min-width: 0; }
.plan-row > span { flex: 1 1 auto; min-width: 0; }
.plan-row strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.plan-row > b { margin-left: auto; white-space: nowrap; font-weight: 700; }
.plan-row em { display: block; color: var(--muted); font-style: normal; font-size: 0.8rem; }
.plan-row i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); margin-left: auto; flex: 0 0 auto; }
.plan-row i.is-on { background: var(--acc); border-color: var(--acc); }
.plan-actions { display: flex; gap: 8px; }
.plan-actions button { min-height: 44px; padding: 0 10px; border-radius: 12px; border: 0; background: var(--acc); color: #111; }
.invest-kicker, .invest-note { color: var(--muted); font-size: 0.85rem; }
.invest-total { font-size: 2rem; font-weight: 700; margin: 0; }
.invest-pl.pos { color: #3dd68c; }
.invest-pl.neg { color: #e07a7a; }
html.light .invest-pl.pos { color: var(--ok); }
html.light .invest-pl.neg { color: var(--danger); }
.invest-chart { width: 100%; height: 120px; color: var(--acc-ink); background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 16px; }
.invest-empty { margin: 8px 0 16px; color: var(--muted); }
.asset-row { grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; }
.asset-row b { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; text-align: right; font-size: 13px; line-height: 1.25; }
.asset-row .budget-copy { min-width: 0; }
.asset-row .budget-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row .budget-copy em { display: block; white-space: normal; overflow: visible; }
.budget-ico { overflow: hidden; font-weight: 700; }
.alloc-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.invest-note { margin-top: 18px; }
.plan-total { color: var(--muted); margin: 0 0 12px; }
.goal-grid[hidden], .folder-list[hidden], #plansRoot[hidden] { display: none !important; }
#budgetList[hidden] { display: none !important; }
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.goal-card {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 14px;
  padding: 0.95rem;
  display: grid;
  gap: 0.65rem;
}

.goal-card-top {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.goal-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.stat-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.stat-card .value {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card .rows {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.stat-card .rows span {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.menu-row { text-decoration: none; position: relative; }
.menu-row input[type="file"] { display: none; }

.footnote {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem) 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid transparent;
}

/* Chat */
.chat {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: end center;
  padding: 1rem;
}

.chat[hidden] { display: none !important; }

.chat-panel {
  width: min(100%, 420px);
  height: min(70vh, 520px);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rise 0.2s ease both;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.chat-head-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-head-text strong { font-family: var(--display); }
.chat-head-text span { font-size: 0.8rem; color: var(--muted); }

.chat-close {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-bubble {
  max-width: 90%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border-left: 2px solid var(--accent);
}

.chat-bubble--user {
  align-self: flex-end;
  background: color-mix(in oklab, var(--accent) 18%, transparent);
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid var(--line);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  outline: none;
}

.chat-form input:focus { border-color: var(--accent); }

.chat-form button,
.chat-confirm button,
.add-sheet input,
.add-sheet select,
.add-sheet button,
.onboard-sheet input,
.onboard-sheet button {
  min-height: 44px;
  min-width: 44px;
}

.undo-bar {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--s2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.app-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}
.app-sheet[hidden] { display: none; }
.app-sheet-card {
  width: min(100%, 420px);
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--s2);
  border: 1px solid var(--line);
}
.app-sheet-card input {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0.6rem 0.8rem;
}
.currency-field, [data-currency-filter] { min-height: 44px; }

.undo-bar button {
  min-height: 44px;
  min-width: 44px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  padding: 0 0.9rem;
  cursor: pointer;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding-top: var(--safe-top);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--s0);
  }
  .site {
    padding-top: calc(var(--header-h, 10.5rem) + 0.85rem);
  }
  .gooey-nav-container.site-nav,
  .site-nav {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }
  .gooey-nav-container nav ul { flex-wrap: nowrap; justify-content: flex-start; }
  .header-actions { margin-left: auto; flex-wrap: wrap; }
  .progress-board,
  .split-sections { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .balance-banner { padding: 1.45rem 1.1rem 1.15rem; }
  .balance-label { margin-bottom: 0.55rem; }
  .balance-banner-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
  }
  .balance-banner-top .btn-primary.sm {
    justify-self: start;
    max-width: 100%;
  }
  .balance-value { font-size: 2.15rem; }
  .balance-sub { overflow-wrap: anywhere; }
  .money-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .btn-money {
    min-width: 0;
    padding: 0.55rem 0.2rem;
    font-size: 0.78rem;
    text-align: center;
  }
  .wallet-grid { grid-template-columns: minmax(0, 1fr); }
  .wallet-card { width: 100%; min-width: 0; }
  .wallet-card-text { min-width: 0; flex: 1; }
  .wallet-amount { white-space: nowrap; }
  .wallet-actions { justify-content: flex-start; }
  .section-head.page-head { flex-wrap: wrap; align-items: flex-start; }
  .seg {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    gap: 0.2rem;
    padding: 0.28rem;
    border-radius: 16px;
  }
  .seg-btn {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
    text-align: center;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .tile-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 1.05rem; }
  .site-header-inner { gap: 0.65rem; }
  .header-actions { width: auto; margin-left: auto; gap: 0.4rem; justify-content: flex-end; }
  .chat-icon { display: block; }
  .btn-chat { width: 2.45rem; height: 2.45rem; padding: 0; justify-content: center; }
  .btn-chat-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* ——— Mobile app shell (?app=1 / PWA standalone) ——— */
html.is-app,
html.is-app body {
  height: 100%;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
}

html.is-app body {
  padding-bottom: 0;
}

html.is-app .site-header {
  position: sticky;
  top: 0;
  padding-top: var(--safe-top);
  /* backdrop-filter would trap the fixed tab bar inside the header */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg);
}

html.is-app .site-header-inner {
  flex-wrap: nowrap;
  padding: 0.65rem 0.9rem;
  gap: 0.55rem 0.6rem;
}

html.is-app .brand { min-width: 0; }
html.is-app .brand-name { font-size: 1.05rem; }

html.is-app .chat-icon { display: none; }
html.is-app .btn-chat { width: auto; height: auto; padding: 0.45rem 0.75rem; }
html.is-app .btn-chat-label {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

html.is-app .header-actions {
  flex: 1 0 100%;
  width: 100%;
  margin-left: 0;
  gap: 0.4rem;
  justify-content: flex-end;
}

html.is-app .gooey-nav-container.site-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  order: initial;
  flex: none;
  width: auto;
  min-width: 0;
  justify-content: center;
  overflow: hidden;
  padding: 0.45rem 0.5rem calc(0.45rem + var(--safe-bottom));
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}

html.is-app .gooey-nav-container nav ul {
  width: 100%;
  flex-wrap: nowrap;
  justify-content: space-around;
  gap: 0.1em;
  padding: 0;
}

html.is-app .gooey-nav-container .effect { display: none; }

html.is-app .gooey-nav-container nav ul li .nav-link {
  font-size: 0.68rem;
  padding: 0.5rem 0.28rem;
  line-height: 1.15;
  white-space: nowrap;
}

html.is-app .site-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  order: initial;
  width: auto;
  justify-content: space-around;
  gap: 0;
  padding: 0.4rem 0.35rem calc(0.4rem + var(--safe-bottom));
  background: rgba(10, 16, 14, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}

html.is-app .nav-link {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.55rem 0.2rem;
  border-radius: 12px;
  line-height: 1.15;
}

html.is-app .header-actions {
  margin-left: auto;
  width: auto;
  flex-shrink: 0;
}

html.is-app .lang-switch { transform: scale(0.92); transform-origin: right center; }

html.is-app .site {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding: 1rem 0.9rem calc(var(--tabbar-h) + var(--tabbar-gap) + 24px);
}

html.is-app .panel,
html.is-app .balance-banner,
html.is-app .report-board,
html.is-app .spend-board,
.report-cats {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 768px) {
  html.is-app .site-header,
  html.is-app .site {
    width: min(560px, calc(100% - 24px));
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
  html.is-app nav.tabbar {
    left: 50% !important;
    right: auto !important;
    width: min(560px, calc(100% - 24px)) !important;
    transform: translateX(-50%);
  }
}

html.is-app .page-hero h1 {
  font-size: clamp(1.75rem, 8vw, 2.35rem);
}

html.is-app .site-footer {
  display: none;
}

html.is-app .chat-panel {
  width: min(100%, 100vw);
  max-height: min(88dvh, 720px);
  border-radius: 18px 18px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .panel.is-active, .chat-panel, .tile, .progress-track > span {
    animation: none !important;
    transition: none !important;
  }
}

/* ——— Category picker sheet ——— */
.cat-picker-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.cat-picker-btn:hover {
  border-color: var(--accent);
}

.cat-picker-ico {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  background: color-mix(in oklab, var(--accent) 18%, transparent);
}

.cat-picker-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-picker-label.is-ph {
  color: var(--muted);
  font-weight: 500;
}

.cat-picker-chev {
  color: var(--muted);
  font-size: 0.85rem;
}

.cat-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.cat-sheet[hidden] {
  display: none !important;
}

.cat-sheet-backdrop {
  appearance: none;
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.cat-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(88dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid, var(--card));
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 0.85rem 0.85rem calc(0.85rem + var(--safe-bottom));
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.4);
}

html[data-theme="white"] .cat-sheet-panel { background: var(--s1); }
html[data-theme="aurora"] .qa-panel,
html[data-theme="light"] .qa-panel,
html[data-theme="aurora"] .app-sheet-card,
html[data-theme="light"] .app-sheet-card,
html[data-theme="aurora"] .cat-sheet-panel,
html[data-theme="light"] .cat-sheet-panel {
  background: var(--sheet);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.cat-sheet-head {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cat-sheet-head strong {
  text-align: center;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.cat-round-btn,
.cat-tool-btn {
  appearance: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--foreground) 6%, transparent);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.cat-head-tools {
  display: flex;
  gap: 0.35rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 4%, transparent);
}

.cat-tool-btn {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  background: transparent;
  font-weight: 600;
}

.cat-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: color-mix(in oklab, var(--foreground) 5%, transparent);
  margin-bottom: 0.35rem;
}

.cat-search-ico {
  color: var(--muted);
  font-size: 1rem;
}

.cat-search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  font: inherit;
  min-width: 0;
}

.cat-list {
  list-style: none;
  overflow: auto;
  margin: 0.25rem 0 0;
  padding: 0;
  flex: 1;
  min-height: 0;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 0.35rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.cat-item:last-child {
  border-bottom: 0;
}

.cat-item-ico {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.cat-item-name {
  flex: 1;
}

.cat-item-check {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1.5px solid color-mix(in oklab, var(--accent) 55%, transparent);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.cat-item.is-selected .cat-item-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.cat-add-form {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.cat-add-form[hidden] {
  display: none !important;
}

.cat-add-form input {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  color: var(--ink);
  font: inherit;
  outline: none;
}

html[data-theme="white"] .cat-add-form input,
html[data-theme="light"] .cat-add-form input,
html[data-theme="white"] .cat-picker-btn,
html[data-theme="light"] .cat-picker-btn {
  background: var(--muted-token, oklch(0.97 0 0));
}

@media (min-width: 720px) {
  .cat-sheet {
    align-items: center;
  }
  .cat-sheet-panel {
    border-radius: 22px;
    max-height: min(80vh, 620px);
  }
}


.tx-list, .folder-list, .check-list, .goal-grid { font-variant-numeric: tabular-nums; }
/* Live themes must not draw a plate around the top menu. */
[data-theme="aurora"] nav:not(.tabbar),
[data-theme="glass"] nav:not(.tabbar),
[data-theme="clear"] nav:not(.tabbar) {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  height: auto !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
}

html[data-theme="aurora"] .site-header,
html[data-theme="glass"] .site-header,
html[data-theme="clear"] .site-header {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.appearance { margin: 0 0 1.2rem; display: grid; gap: 0.7rem; }
.appearance-themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.appearance-card, .appearance-dot {
  min-height: 44px;
  min-width: 44px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--tx);
}
.appearance-card.is-on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.appearance-accents { display: flex; gap: 0.6rem; }
.appearance-dot { width: 44px; height: 44px; border-radius: var(--r-chip); padding: 0; }
/* Accent swatches show the accent color itself, so the hex stays here. */
.appearance-dot.accent-yellow { background: #F2D24B; }
.appearance-dot.accent-mint { background: #63E6BE; }
.appearance-dot.accent-blue { background: #74A7FF; }
.appearance-dot.accent-coral { background: #FF8E72; }
.appearance-dot.accent-lilac { background: #B197FC; }
.appearance-dot.is-on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--tx); }

.site-header,
html[data-theme] .site-header,
html.is-app .site-header {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.site-header.is-scrolled,
html[data-theme] .site-header.is-scrolled,
html[data-theme="glass"] .site-header.is-scrolled,
html[data-theme="aurora"] .site-header.is-scrolled,
html[data-theme="clear"] .site-header.is-scrolled,
html.is-app .site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 55%, transparent) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent);
}
.app-top { display: flex; align-items: center; gap: 0.45rem; width: 100%; flex-wrap: nowrap; }
.app-top .top-search { flex: 1 1 auto; min-width: 0; }
.header-float {
  position: fixed;
  z-index: 45;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: var(--max, 480px);
  margin: 0 auto;
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
  padding-top: calc(0.85rem + var(--safe-top));
  pointer-events: none;
  color: #fff;
}
html.is-app .header-float {
  padding: 0.65rem 0.9rem;
  padding-top: calc(0.65rem + var(--safe-top));
}
.header-float > * { pointer-events: auto; }
.float-gap { flex: 1; pointer-events: none; min-width: 8px; }
html[data-live-logo="1"] .header-float { mix-blend-mode: difference; color: #fff; }
html[data-live-logo="1"] .header-float .brand,
html[data-live-logo="1"] .header-float .brand-name,
html[data-live-logo="1"] .header-float .icon-btn { color: #fff; }
html[data-live-logo="0"] .header-float { mix-blend-mode: normal; color: var(--ink); }
html[data-live-logo="0"] .header-float .brand,
html[data-live-logo="0"] .header-float .brand-name,
html[data-live-logo="0"] .header-float .icon-btn { color: var(--ink); }
.avatar-reserve { width: 44px; height: 44px; flex: 0 0 44px; }
#headerAvatar {
  position: fixed;
  z-index: 46;
  top: calc(0.85rem + var(--safe-top));
  right: max(clamp(1rem, 3vw, 1.5rem), calc((100vw - var(--max, 480px)) / 2 + clamp(1rem, 3vw, 1.5rem)));
}
html.is-app #headerAvatar {
  top: calc(0.65rem + var(--safe-top));
  right: max(0.9rem, calc((100vw - var(--max, 480px)) / 2 + 0.9rem));
}
.brand-reserve { width: 118px; flex: 0 0 118px; height: 44px; }
.icon-reserve { width: 104px; flex: 0 0 104px; height: 44px; }
html.is-app .brand-reserve { width: 108px; flex-basis: 108px; }
button.search-open,
button.search-close { display: none; }
@media (max-width: 399px) {
  button.search-open { display: grid; }
  .top-search { display: none; }
  .app-top.is-searching .brand,
  .app-top.is-searching button.search-open,
  .app-top.is-searching [data-go="stats"],
  .app-top.is-searching [data-go="more"] { display: none; }
  .app-top.is-searching .top-search { display: block; flex: 1; }
  .app-top.is-searching button.search-close { display: grid; }
}
.top-search input {
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  color: var(--ink);
  padding: 0 0.9rem;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.header-float .brand-name,
.header-float .icon-btn { color: inherit; }
.brand-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.04em; }
.home-balance { text-align: center; padding: 0.4rem 0 0.8rem; }
.balance-kicker { color: var(--muted); margin: 0; }
.balance-hero { font-family: var(--display); font-size: clamp(1.35rem, 7.2vw, 2.4rem); margin: 0.2rem 0; white-space: nowrap; }
.balance-hero .is-frac { font-size: 0.62em; color: var(--muted); }
.month-chip {
  display: inline-flex;
  margin: 0;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok, #3dd68c) 18%, transparent);
  color: var(--ok, #3dd68c);
}
.month-chip.is-down { background: color-mix(in srgb, #ff8e72 18%, transparent); color: #ff8e72; }
html.light .month-chip.is-down { color: var(--danger); }
.home-empty { color: var(--muted); }
.wallet-scroller { display: flex; gap: 0.6rem; overflow-x: auto; padding-bottom: 0.4rem; }
.wallet-pill {
  flex: 0 0 auto;
  min-width: 132px;
  min-height: 84px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--ink);
  text-align: left;
  padding: 0.75rem;
  display: grid;
  gap: 0.25rem;
}
.wallet-pill strong { white-space: nowrap; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin: 0.8rem 0; }
.qa { background: none; border: 0; color: var(--ink); display: grid; justify-items: center; gap: 0.3rem; min-height: 44px; font-size: 0.78rem; }
.qa-ico {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--s1); border: 1px solid var(--line); font-size: 1.2rem;
}
.qa-add { background: var(--acc); color: #141413; border: 0; }
.home-card { background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 0.9rem 1rem; margin: 0.7rem 0; }
.home-card-head, .feed-row { display: flex; justify-content: space-between; gap: 0.5rem; }
.home-cats { display: grid; gap: 0.35rem; }
.home-cats span { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.home-spent { font-family: var(--display); font-size: 1.5rem; margin: 0.3rem 0; }
.home-left { margin: 0; color: var(--muted); text-align: right; }
.home-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); margin: 0.6rem 0; }
.home-bar span { display: block; height: 100%; border-radius: 99px; background: var(--acc); }
.feed-day { margin: 0.6rem 0 0.2rem; color: var(--muted); }
.feed-day.pos { color: var(--ok, #3dd68c); }
.feed-day.neg { color: #ff8e72; }
html.light .feed-day.neg { color: var(--danger); }
.feed-row { width: 100%; background: none; border: 0; color: inherit; min-height: 44px; padding: 0; }
.tabbar,
html[data-theme="glass"] nav.tabbar,
html[data-theme="clear"] nav.tabbar,
html[data-theme="aurora"] nav.tabbar,
html[data-theme="light"] nav.tabbar {
  position: fixed !important;
  left: 6px !important;
  right: 6px !important;
  bottom: var(--tabbar-gap) !important;
  z-index: 60;
  height: var(--tabbar-h) !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 28px;
  box-sizing: border-box;
}
html[data-theme="light"] .home-card,
html[data-theme="light"] .qa-panel,
html[data-theme="light"] nav.tabbar {
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 24px 60px -30px rgba(20, 30, 80, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
html[data-theme="aurora"] .qa-panel,
html[data-theme="light"] .qa-panel {
  background: var(--sheet);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  font-size: 10px;
  white-space: nowrap;
  padding-bottom: 0;
  height: 100%;
  overflow: hidden;
}
.tab { padding-left: 0; padding-right: 0; }
.tab span { max-width: 100%; overflow: hidden; white-space: nowrap; font-size: 10px; letter-spacing: -0.01em; }
@media (max-width: 379px) {
  .tab span { font-size: 10px; letter-spacing: -0.01em; }
}
.tab.is-active { color: var(--acc-ink); }
.tab-plus {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  min-height: 56px;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  position: relative;
  top: -18px;
  align-self: center;
  border-radius: 50%;
  background: var(--acc);
  color: #141413;
  font-size: 0; /* the + is drawn below, so it sits exactly in the middle */
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.55);
  overflow: visible;
}
.tab-plus::before,
.tab-plus::after {
  content: "";
  grid-area: 1 / 1;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: currentColor;
}
.tab-plus::after { transform: rotate(90deg); }
.progress-board[hidden] { display: none !important; }
.site { padding-bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 24px); }
.panel.is-active { animation: screen-in 200ms ease; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
button:active { transform: scale(0.96); }
body.is-assistant .chat {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--header-h, 4.5rem);
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 12px);
  z-index: 40;
  background: transparent;
  padding-top: 5.2rem;
}
#screen-assistant .page-head h1 { color: var(--ink); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
@media (prefers-reduced-motion: reduce) {
  .panel.is-active { animation: none; }
  button:active { transform: none; }
}

.qa-sheet[hidden] { display: none !important; }
.qa-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
}
.qa-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
}
.qa-panel {
  position: relative;
  width: min(520px, 100%);
  height: auto;
  max-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  color: var(--tx);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(8px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qa-scroll { flex: 0 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.qa-grab {
  width: 48px;
  height: 18px;
  margin: 0 auto;
  border: 0;
  background: transparent;
  position: relative;
}
.qa-grab::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
}
.qa-head, .qa-modes, .qa-wallets, .qa-cats, .qa-dates, .qa-meta { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.qa-cats, .qa-dates, .qa-wallets { overflow-x: auto; }
.qa-meta { min-width: 0; overflow: hidden; }
.qa-dates { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.qa-head { justify-content: space-between; }
.qa-x, .qa-key, .qa-chip, .qa-mode, .qa-delete, .hist-chip, .swipe-del {
  min-width: 44px;
  min-height: 44px;
}
.qa-x { border: 0; background: transparent; color: var(--tx); font-size: 1.4rem; }
.qa-mode, .qa-chip, .hist-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--tx);
  border-radius: 999px;
}
.qa-mode.is-on, .qa-chip.is-on, .hist-chip.is-on { background: var(--acc, var(--accent)); color: #1a1500; }
.qa-amount {
  font-family: var(--display);
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  text-align: center;
  line-height: 1.1;
}
.qa-dates label.qa-chip { position: relative; overflow: hidden; }
.qa-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex: 0 0 auto; }
.qa-key {
  border: 0;
  border-radius: 16px;
  background: var(--s2);
  color: var(--tx);
  font-size: 1.3rem;
  height: 48px;
  min-height: 48px;
}
.qa-delete {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}
.qa-save { flex: 0 0 auto; min-height: 48px; }
.qa-save:disabled { opacity: 0.4; }
.qa-note { flex: 0 1 120px; min-width: 88px; width: auto; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--tx); padding: 0 12px; }
.qa-pick, .hist-wallet-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.qa-dates input, .hist-month input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hist-tools { margin-bottom: 0.8rem; }
.hist-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.day-head { margin: 0.8rem 0 0.3rem; font-size: 0.92rem; color: var(--muted); }
.day-list { list-style: none; margin: 0; padding: 0; }
.tx-swipe { position: relative; overflow: hidden; }
.swipe-del {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  border: 0;
  background: #c43b3b;
  color: #fff;
  padding: 0 16px;
}
.undo-bar { bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 12px); }
.undo-bar[hidden] { display: none !important; }
.swipe-main { width: 100%; text-align: left; border: 0; background: var(--bg); color: inherit; display: flex; gap: 10px; align-items: center; position: relative; z-index: 1; }
.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--acc, var(--accent));
  color: #141413;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.settings-head { display: flex; align-items: center; gap: 8px; }
.settings-head h1 { margin: 0; min-width: 0; font-size: clamp(1.45rem, 6.5vw, 2rem); overflow-wrap: anywhere; }
.settings-group { margin: 16px 4px 6px; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.settings-profile, .settings-row {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  padding: 8px 12px;
  box-sizing: border-box;
}
.settings-profile { border-radius: 16px; background: color-mix(in srgb, var(--acc, var(--accent)) 18%, transparent); margin-bottom: 8px; }
.settings-profile small, .settings-row small { display: block; color: var(--muted); font-size: 0.8rem; }
.settings-row-text { flex: 1; min-width: 0; }
.settings-row-value { color: var(--muted); }
.settings-row.is-on strong { color: var(--acc-ink, var(--accent)); }
.settings-row.is-disabled { opacity: 0.55; }
.settings-switch { width: 44px; height: 44px; flex: 0 0 44px; }
.switch {
  width: 51px;
  height: 31px;
  border: 0;
  border-radius: 999px;
  background: #8e8e93;
  position: relative;
  flex: 0 0 51px;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
}
.switch.is-on { background: var(--acc, var(--accent)); }
.switch.is-on::after { transform: translateX(20px); }
.settings-search { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--tx); padding: 0 12px; margin-bottom: 8px; }
.settings-days { display: flex; flex-wrap: wrap; gap: 8px; }
.menu-row.is-danger, #backupWipeBtn { color: #e15b64; }
html.light .menu-row.is-danger, html.light #backupWipeBtn { color: var(--danger); }
#settingsStash { display: none !important; }
@media (min-width: 400px) {
  button.search-open, button.search-close { display: none; }
}
@media (max-width: 399px) {
  button.search-open { display: grid; }
  button.search-close { display: none; }
  .top-search { display: none; }
  .icon-reserve { width: 140px; flex-basis: 140px; }
  body.is-searching .header-float .brand,
  body.is-searching .header-float button.search-open,
  body.is-searching .header-float [data-go="stats"],
  body.is-searching .header-float [data-go="more"] { display: none; }
  body.is-searching button.search-close { display: grid; }
  body.is-searching .top-search { display: block; flex: 1; }
}
@media (max-height: 640px) {
  .qa-panel { gap: 4px; padding-top: 4px; }
  .qa-amount { font-size: 1.7rem; }
  .qa-head { min-height: 36px; }
}
.fx-head, .fx-meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; color: var(--mu); font-size: 0.78rem; }
.fx-head { margin: 2px 0 6px; }
.fx-head strong { color: var(--tx); font-size: 0.95rem; }
.fx-row { display: flex; align-items: center; gap: 8px; }
.fx-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; min-width: 0; flex: 1; }
.fx-card { display: grid; grid-template-columns: 32px max-content; align-items: center; gap: 8px; min-height: 52px; min-width: max-content; border: 0; border-radius: 16px; padding: 6px 10px; background: var(--s1); color: var(--tx); font: inherit; }
.fx-scroller .fx-card { flex: 0 0 auto; }
.fx-card-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: max-content; }
.fx-card-copy small { color: var(--mu); font-size: 0.72rem; }
.fx-card-copy b { font-size: 0.95rem; white-space: nowrap; }
.fx-add { display: flex; grid-template-columns: none; flex: 0 0 52px; width: 52px; min-width: 52px; justify-content: center; border: 1px dashed var(--line); background: transparent; font-size: 1.4rem; }
.fx-mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--tx); flex: 0 0 32px; font-size: 0.85rem; }
.fx-card-copy .fx-badge { margin-top: 2px; }
@media (max-width: 360px) {
  .fx-row, .fx-scroller { gap: 6px; }
  .fx-card { grid-template-columns: 28px max-content; gap: 6px; padding: 6px 8px; }
  .fx-card-copy b { font-size: 0.88rem; }
}
.fx-badge { border-radius: 999px; padding: 3px 7px; font-size: 0.72rem; white-space: nowrap; }
.fx-badge.up { color: var(--green-ink); background: color-mix(in srgb, var(--green-ink) 16%, transparent); }
.fx-badge.down { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.fx-badge.flat { color: var(--mu); background: color-mix(in srgb, var(--mu) 16%, transparent); }
.fx-note, .fx-source, .wallet-group-approx { margin: 0.15rem 0 0.4rem; color: var(--muted); font-size: 0.82rem; }
#homeFxNote, #financeFxNote { text-align: center; }
.fx-panel { max-height: min(92dvh, 900px); }
.fx-body { overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.fx-head-actions { display: flex; align-items: center; gap: 4px; }
.fx-edit-btn { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--tx); display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; }
.fx-conv { background: var(--s1); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.fx-kicker { margin: 0; color: var(--mu); font-size: 0.78rem; }
.fx-conv-row { display: flex; align-items: center; gap: 8px; }
.fx-amount { border: 0; background: transparent; color: inherit; text-align: left; min-height: 52px; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.fx-amount b { font-size: 1.8rem; line-height: 1; }
.fx-cur, .fx-swap, .fx-dir { min-width: 44px; min-height: 44px; border-radius: 12px; border: 0; background: var(--bg); color: var(--tx); font: inherit; }
.fx-swap { width: 44px; background: var(--acc); color: #1a1500; }
.fx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.fx-tile { min-height: 52px; border: 0; border-radius: 12px; background: var(--bg); color: inherit; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 8px; }
.fx-tile small { color: var(--mu); }
.fx-rate { display: grid; grid-template-columns: 32px minmax(0, 1fr) 56px auto 44px; gap: 8px; align-items: center; min-height: 52px; }
.fx-line-name { display: flex; flex-direction: column; min-width: 0; }
.fx-line-name small, .fx-line-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-line-name small { color: var(--mu); }
.fx-rate-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.fx-spark { width: 56px; height: 22px; color: var(--mu); }
.fx-spark.up { color: var(--green-ink); }
.fx-spark.down { color: var(--danger); }
.fx-bell { width: 44px; height: 44px; border: 0; background: transparent; color: var(--mu); display: grid; place-items: center; }
.fx-bell svg { fill: none; stroke: currentColor; stroke-width: 2; }
.fx-bell.is-on { color: var(--acc-ink); }
.fx-bell.is-on svg { fill: currentColor; stroke: none; }
.fx-add-line { min-height: 48px; width: 100%; border: 1px dashed var(--line); border-radius: 14px; background: transparent; color: var(--tx); font: inherit; }
.fx-edit-row { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.fx-edit-actions { display: flex; margin-left: auto; }
.fx-edit-row button { width: 44px; min-width: 44px; min-height: 44px; }
.fx-search { width: 100%; min-height: 44px; }
.fx-result { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.fx-dirs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fx-dir.is-on { background: var(--acc); color: #1a1500; }
.fx-alert-now { display: flex; gap: 10px; align-items: center; }
.fx-alert-now span { display: flex; flex-direction: column; }
.fx-alert-now small { color: var(--mu); }
.fx-hint { color: var(--mu); font-size: 0.82rem; margin: 0; }
.fx-toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--s1); color: var(--tx); border-radius: 999px; padding: 10px 16px; z-index: 80; }
.fx-banner { position: relative; z-index: 2; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; background: var(--s1); color: var(--tx); border-radius: 14px; padding: 10px 12px; }
.fx-banner button { width: 44px; height: 44px; border: 0; background: transparent; color: inherit; font-size: 1.3rem; }
.mkt-tabs, .mkt-filters { display: flex; gap: 8px; overflow-x: auto; }
.mkt-filters { flex: 1 0 100%; min-width: 0; }
.mkt-tabs { margin: 0 0 12px; padding: 4px; border-radius: 14px; background: var(--s1); }
.mkt-tabs button, .mkt-filters button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--mu); font: inherit; padding: 0 14px; }
.mkt-tabs button.is-on, .mkt-filters button.is-on { background: var(--acc); color: #1a1500; }
.mkt-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mkt-tools .fx-edit-btn { min-height: 44px; margin-left: auto; flex: 0 0 auto; }
.mkt-kicker { margin: 12px 0 6px; color: var(--mu); font-size: 0.78rem; }
.mkt-line { display: grid; grid-template-columns: minmax(0, 1fr) 168px; align-items: center; gap: 8px; min-height: 132px; }
.mkt-open { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.mkt-open span { display: flex; flex-direction: column; min-width: 0; }
.mkt-open small { color: var(--mu); }
.mkt-frame { border: 0; background: transparent; }
.mkt-frame-row { width: 100%; height: 188px; }
.mkt-frame-quote { width: 168px; height: 132px; }
.mkt-frame-chart { width: 100%; height: 420px; }
.mkt-offline { margin: 8px 0; padding: 16px; border-radius: 16px; background: var(--s1); color: var(--mu); }
.mkt-held { margin: 12px 0; padding: 12px; border-radius: 16px; background: var(--s1); }
.mkt-held p { margin: 4px 0 0; color: var(--mu); }
.market-detail { position: fixed; inset: 0; z-index: 70; overflow: auto; background: var(--bg); color: var(--tx); padding: 12px 16px 32px; }
.market-detail-bar, .market-detail-id { display: flex; align-items: center; gap: 8px; }
.market-detail-id { margin: 8px 0 12px; }
.market-detail-id span { display: flex; flex-direction: column; }
.market-detail-id small { color: var(--mu); }
.market-detail-bar .fx-edit-btn { margin-left: auto; min-height: 44px; }
#investPlus[hidden] { display: none; }

.mascot { display: block; object-fit: cover; border-radius: 28%; background: var(--s1); }
.mascot--card { width: 56px; height: 56px; }
.mascot--row { width: 36px; height: 36px; }
.mascot--hero { width: 112px; height: 112px; margin: 12px auto; }
.nudge-card, .nudge-tip, .nudge-banner, .nudge-soon {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start;
  margin: 0 16px 8px; padding: 10px 12px; border-radius: 18px; background: var(--s1); color: var(--tx);
}
.nudge-tip { grid-template-columns: 36px minmax(0, 1fr) 44px; }
.nudge-banner { grid-template-columns: minmax(0, 1fr) 44px; }
.nudge-soon { grid-template-columns: minmax(0, 1fr); margin: 16px 0; border: 1px dashed var(--acc-line); }
.nudge-copy { min-width: 0; }
.nudge-kicker { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.06em; color: var(--mu); }
.nudge-sum { margin: 0; font-size: 28px; line-height: 1.05; font-weight: 700; color: var(--acc-ink); }
.nudge-sub, .nudge-line, .nudge-copy p, .nudge-foot, .nudge-note { margin: 4px 0 0; color: var(--tx); }
.nudge-line { font-size: 14px; line-height: 1.25; }
.nudge-foot, .nudge-note, .nudge-sub { color: var(--mu); font-size: 13px; }
.nudge-actions { display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 8px; }
.nudge-actions .nudge-btn { flex: 1 1 auto; min-width: 0; padding: 0 8px; font-size: 13px; white-space: nowrap; }
.nudge-actions .nudge-btn.is-acc { flex: 0 0 auto; }
.nudge-solo { width: 100%; margin-top: 8px; }
@media (max-width: 340px) {
  .nudge-actions { flex-wrap: wrap; }
  .nudge-actions .nudge-btn, .nudge-actions .nudge-btn.is-acc { flex: 1 1 100%; }
}
.nudge-btn, .nudge-tone button, .nudge-time, .nudge-quiet {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--acc-line); background: transparent; color: var(--tx);
  padding: 0 12px; font: inherit;
}
.nudge-btn.is-acc, .nudge-tone button.is-on { background: var(--acc); color: #1a1500; border-color: transparent; }
.nudge-x { width: 44px; height: 44px; }
.nudge-sheet, .nudge-screen { position: fixed; inset: 0; z-index: 80; }
.nudge-screen { overflow: auto; background: var(--bg); color: var(--tx); padding: 12px 16px 32px; text-align: center; }
.nudge-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.45); }
.nudge-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  background: var(--sheet); color: var(--tx); border-radius: 20px 20px 0 0; padding: 16px 16px 28px;
}
.nudge-panel-head, .nudge-streak-head, .nudge-row, .nudge-left, .nudge-math {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.nudge-streak-head { display: grid; grid-template-columns: 44px 1fr 44px; text-align: left; }
.nudge-streak-head .icon-btn { color: var(--tx); }
.nudge-streak-head h2 { margin: 0; text-align: center; }
.nudge-streak-num { margin: 0; font-size: 64px; line-height: 1; font-weight: 700; color: var(--acc-ink); }
.nudge-week { display: flex; justify-content: space-between; gap: 4px; margin: 16px 0; }
.nudge-dot { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 4px; font-size: 11px; color: var(--mu); }
.nudge-dot i {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--acc-line); font-style: normal;
}
.nudge-dot.is-done i { background: var(--acc); color: #1a1500; border-color: transparent; }
.nudge-dot.is-frozen i { background: #2f6fed; color: #fff; border-color: transparent; }
.nudge-dot.is-before i { opacity: .4; border-style: dashed; }
.nudge-today { margin: 8px 0 0; color: var(--tx); font-size: 14px; }
.nudge-today span { flex: 1 1 auto; min-width: 0; }
.nudge-goals { list-style: none; padding: 0; margin: 8px 0 16px; text-align: left; }
.nudge-goals li { display: flex; gap: 8px; min-height: 44px; align-items: center; }
.nudge-goals .is-done { color: var(--acc-ink); }
.nudge-row, .nudge-left { min-height: 36px; }
.nudge-left strong { font-size: 18px; }
.nudge-row .neg { color: var(--mu); }
.nudge-row .pos { color: var(--acc-ink); }
.nudge-math { align-items: flex-start; margin-top: 12px; }
.nudge-tone { display: flex; gap: 8px; margin: 0 0 12px; }
.nudge-tone button { flex: 1 1 0; }
.nudge-sample { display: flex; gap: 10px; align-items: center; margin: 0 0 16px; }
.nudge-sample p { margin: 0; }
.nudge-row { flex-wrap: wrap; }
.nudge-quiet { display: flex; flex: 1 1 180px; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.nudge-time { width: 128px; flex: 0 0 128px; color: var(--tx); color-scheme: dark; }
[data-theme="light"] .nudge-time, [data-theme="white"] .nudge-time { color-scheme: light; }

/* ——— Invoices (task F1) ——— */
.pro-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--acc); color: #141413; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; }
.inv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
.inv-head h1 { flex: 1; min-width: 0; margin: 0; font-size: clamp(1.45rem, 6.5vw, 2rem); overflow-wrap: anywhere; }
.inv-head .icon-btn, .inv-head-gap { color: var(--ink); flex: 0 0 44px; font-size: 1.7rem; }
.inv-plus { border-radius: 50%; background: var(--acc) !important; color: #141413 !important; font-size: 1.6rem; line-height: 1; }
.inv-setup, .inv-sum, .inv-pay, .inv-total, .inv-hero, .inv-row, .inv-client {
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 22px;
}
.inv-setup { padding: 16px; margin-bottom: 12px; border-color: var(--acc-line, var(--line)); }
.inv-setup p { margin: 6px 0 12px; color: var(--muted); }
.inv-sum { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px; margin-bottom: 12px; }
.inv-sum div { min-width: 0; display: grid; gap: 2px; }
.inv-sum span, .inv-sum small { color: var(--muted); font-size: 0.82rem; }
.inv-sum strong { font-family: var(--display); font-size: 1.25rem; overflow-wrap: anywhere; }
.inv-sum div:last-child { text-align: right; }
.inv-sum .is-bad strong { color: var(--danger); }
.inv-filter { display: flex; gap: 8px; margin: 0 0 12px; overflow-x: auto; }
.inv-filter button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); white-space: nowrap; }
.inv-filter button[aria-selected="true"] { background: var(--acc); border-color: transparent; color: #141413; }
.inv-list { display: grid; gap: 8px; margin-bottom: 12px; }
.inv-row { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: inherit; text-align: left; }
.inv-row-main, .inv-row-side { display: grid; gap: 2px; min-width: 0; }
.inv-row-main small { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row-side { justify-items: end; text-align: right; flex: 0 0 auto; }
.inv-row-side b { white-space: nowrap; }
.inv-chip { font-style: normal; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--muted); }
.inv-chip.is-paid { background: var(--green-soft); color: var(--green-ink); }
.inv-chip.is-overdue { background: var(--orange-soft); color: var(--orange-ink); }
.inv-empty { color: var(--muted); padding: 8px 4px; }
.inv-links { margin-top: 8px; }
.inv-links .settings-row-text strong { white-space: nowrap; }
.inv-links .settings-row-value { min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-links .settings-row { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); border: 1px solid var(--line); border-radius: 16px; }
.inv-client { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 14px; }
.inv-client span { display: grid; min-width: 0; }
.inv-client small { color: var(--muted); font-size: 0.8rem; }
.inv-client .icon-btn { color: var(--muted); }
.inv-form { display: grid; gap: 10px; }
.inv-sec { margin: 10px 2px 0; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.inv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.inv-field { display: grid; gap: 4px; min-width: 0; }
.inv-field.is-wide, .inv-check.is-wide { grid-column: 1 / -1; }
.inv-field span { font-size: 0.8rem; color: var(--muted); }
.inv-field small { font-size: 0.75rem; color: var(--muted); }
.inv-field input, .inv-field select, .inv-field textarea {
  width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box;
  border-radius: 12px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--ink);
  padding: 0.6rem 0.75rem; font: inherit; font-size: 16px;
}
.inv-field textarea { resize: vertical; }
.inv-field input:focus, .inv-field select:focus, .inv-field textarea:focus { outline: none; border-color: var(--acc); }
.inv-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.inv-check input { width: 22px; height: 22px; accent-color: var(--acc); }
.inv-ares { min-height: 44px; border-radius: 12px; border: 1px solid var(--acc-line, var(--line)); background: transparent; color: var(--acc-ink); font-weight: 600; padding: 0 10px; }
.inv-ares:disabled { opacity: 0.6; }
.inv-items { display: grid; gap: 10px; }
.inv-item { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; }
.inv-item .inv-field.is-wide { grid-column: 1 / -1; padding-right: 36px; }
.inv-item .is-qty { grid-column: span 2; }
.inv-item .is-unit { grid-column: span 2; }
.inv-item .is-price { grid-column: span 2; }
.inv-item .is-vat { grid-column: span 2; }
.inv-item:has(.is-vat) { grid-auto-flow: row dense; }
.inv-item:has(.is-vat) .is-price { grid-column: 1 / -1; }
.inv-item-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); font-size: 1.1rem; }
.inv-add-item { min-height: 44px; border-radius: 14px; border: 1px dashed var(--acc-line, var(--line)); background: transparent; color: var(--acc-ink); font-weight: 600; }
.inv-total { display: grid; gap: 2px; padding: 14px 16px; margin-top: 4px; }
.inv-total span, .inv-total small { color: var(--muted); font-size: 0.82rem; }
.inv-total strong { font-family: var(--display); font-size: 1.5rem; overflow-wrap: anywhere; }
.inv-error { color: var(--danger); min-height: 1.2em; margin: 0; }
.inv-save { width: 100%; min-height: 52px; }
.inv-hero { display: grid; justify-items: center; gap: 4px; padding: 16px; margin-bottom: 12px; text-align: center; }
.inv-hero strong { font-family: var(--display); font-size: clamp(1.5rem, 8vw, 2.1rem); overflow-wrap: anywhere; }
.inv-hero span { color: var(--muted); }
.inv-flash { margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; background: var(--green-soft); color: var(--green-ink); }
.inv-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.inv-actions > * { grid-column: span 2; min-height: 44px; min-width: 0; padding-left: 6px; padding-right: 6px; }
.inv-actions > .is-main { grid-column: span 3; }
.inv-act { min-height: 44px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 0 10px; }
.inv-act.is-acc { border-color: var(--acc-line, var(--line)); color: var(--acc-ink); font-weight: 600; }
.inv-act.is-danger { color: var(--danger); }
.inv-pay { display: grid; gap: 10px; padding: 14px; margin-bottom: 12px; }
.inv-note { color: var(--muted); font-size: 0.85rem; margin: 0; }
.inv-preview { position: relative; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); margin-bottom: 16px; }
.inv-preview-scale { width: 740px; transform-origin: 0 0; }
@media (max-width: 359px) {
  .inv-grid { grid-template-columns: minmax(0, 1fr); }
  .inv-sum { grid-template-columns: minmax(0, 1fr); }
  .inv-sum div:last-child { text-align: left; }
}
.inv-check span small { display: block; color: var(--muted); font-size: 0.75rem; }
.inv-check input:disabled + span { opacity: 0.5; }

/* ——— Crypto in the portfolio (task C1) ——— */
.crypto-add { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 10px; border-radius: 16px; border: 1px dashed var(--acc-line, var(--line)); background: transparent; color: var(--acc-ink); font-weight: 600; }
.crypto-add span { font-size: 1.1rem; }
.crypto-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 0.8rem; }
.crypto-status.is-bad { color: var(--danger); }
.crypto-status .icon-btn { color: var(--ink); font-size: 1.2rem; }
.crypto-24h { display: block; font-size: 0.75rem; margin-top: 2px; }
.crypto-24h.pos, .crypto-price .pos { color: var(--green-ink); }
.crypto-24h.neg, .crypto-price .neg { color: var(--orange-ink); }
.crypto-panel { max-height: min(86dvh, 720px); display: flex; flex-direction: column; gap: 8px; }
.crypto-search { font-size: 16px; }
.crypto-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; gap: 4px; align-content: start; }
.crypto-coin { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 14px; background: transparent; color: inherit; text-align: left; }
.crypto-coin:hover, .crypto-coin:focus-visible { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.crypto-sym { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--acc-soft, rgba(242,210,75,.14)); color: var(--acc-ink); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; }
.crypto-name { flex: 1 1 auto; min-width: 0; display: grid; }
.crypto-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crypto-name small, .crypto-src, .crypto-empty { color: var(--muted); font-size: 0.78rem; }
.crypto-price { flex: 0 0 auto; display: grid; justify-items: end; text-align: right; }
.crypto-price b { white-space: nowrap; font-weight: 600; }
.crypto-price small { font-size: 0.75rem; }
.crypto-src { margin: 0; text-align: center; }

/* ——— Smart helper in the chat (task 14) ——— */
.chat-bubble.chat-ai { white-space: pre-wrap; }
.chat-bubble.chat-typing { opacity: 0.7; font-style: italic; }
.chat-bubble.chat-quota { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 4px !important; color: var(--muted); font-size: 0.78rem; }
.chat-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chat-idea { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--acc-line, var(--line)); background: transparent; color: var(--acc-ink); font: inherit; font-size: 0.85rem; text-align: left; }
.chat-ideas-note { flex-basis: 100%; margin: 4px 2px 0; color: var(--muted); font-size: 0.75rem; }
/* AI answers carry a visible label (EU AI Act, art. 50) */
.chat-bubble.chat-ai[data-ai-label]::before { content: "✦ " attr(data-ai-label); display: block; margin-bottom: 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--acc-ink); white-space: normal; }

/* ——— Demo mode (task S2) ——— */
.demo-bar {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 26px);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border: 1px solid var(--acc-line, var(--line));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 8px 24px -10px rgba(0,0,0,.5);
  font-size: 0.78rem; color: var(--muted);
}
.demo-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-bar b { color: var(--acc-ink); letter-spacing: 0.06em; margin-right: 4px; }
.demo-bar button { flex: 0 0 auto; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--acc); color: #141413; font: inherit; font-weight: 600; }
.onboard-demo { border-style: dashed !important; }
/* demo pill: room under the content, and only the badge + button on narrow phones */
html.is-demo.is-app .site { padding-bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 76px); }
@media (max-width: 419px) { .demo-bar span { display: none; } .demo-bar { padding-left: 6px; } .demo-bar::before { content: attr(data-badge); font-weight: 700; color: var(--acc-ink); letter-spacing: .06em; padding-left: 8px; } }
