/* ==========================================================================
   Nestomic product app — design system
   The logged-in surface. Shares the "Kitchen Table Ledger" palette and type
   with the marketing site (www.css) but trades editorial flourish for calm,
   utilitarian product chrome.
   Oat paper · spruce ink · clay accent · butter highlight.
   Fraunces (display) · Karla (body) · Spline Sans Mono (figures)
   ========================================================================== */

:root {
  --oat:        #f5efe2;
  --oat-deep:   #ece4d2;
  --cream:      #fffcf4;
  --spruce:     #17382b;
  --spruce-2:   #1f4736;
  --spruce-dim: #40584b;
  --clay:       #cd5a2b;
  --clay-deep:  #a84617;
  --butter:     #f3c84e;
  --butter-pale:#f9e3a4;
  --sage:       #a9bf9b;
  --rose:       #e8b9a4;
  --sky:        #b9cfd8;
  --danger:     #b23a2e;
  --line:       rgba(23, 56, 43, 0.16);
  --line-soft:  rgba(23, 56, 43, 0.09);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body:    "Karla", "Gill Sans", "Segoe UI", sans-serif;
  --font-mono:    "Spline Sans Mono", "SFMono-Regular", Menlo, monospace;

  --shadow-print: 5px 6px 0 rgba(23, 56, 43, 0.16);
  --shadow-card:  0 1px 2px rgba(23, 56, 43, 0.06), 0 10px 30px -18px rgba(23, 56, 43, 0.25);
  --shadow-pop:   0 12px 32px -8px rgba(23, 56, 43, 0.28), 0 2px 6px rgba(23, 56, 43, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 84rem;

  /* App chrome geometry: the money tab strip and sticky toolbars stack under the bar. */
  --bar-h: 3.5rem;
  --tabs-h: 2.9rem;
  --main-pad-x: 1.5rem;
  --main-pad-y: 1.75rem;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--clay) 28%, transparent);

  /* Semantic slots the dark theme re-points. Surfaces are --cream (raised) on --oat
     (page); ink is --spruce. Anything that must stay legible on a fixed colour
     (clay buttons, butter avatar) uses an --on-* token instead of --cream/--spruce. */
  --bar-bg: var(--spruce);
  --bar-ink: var(--cream);
  --bar-active-bg: var(--cream);
  --bar-active-ink: var(--spruce);
  --on-clay: #fffcf4;
  --on-butter: #17382b;
  --good: #2f7a4f;
  --good-dot: #4f9a6a;
  --chart-plan: #3b8a5c;
  --chart-actual: #cd5a2b;
  /* Income → expense flow (Sankey): one hue per node role. */
  --flow-income: #2f7a4f; --flow-hub: #40584b; --flow-group: #a84617; --flow-category: #cd5a2b;
  --flow-saved: #2f7fd0; --flow-loss: #b57d00; --flow-expected: #8fc4a6;
  color-scheme: light;
}

/* Dark: the same family of colours, inverted with care — deep spruce-black page,
   slightly lifted surfaces, cream ink, clay and butter kept as the accents. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --oat: #0f1a15; --oat-deep: #1f2e26; --cream: #172520;
    --spruce: #eef1e8; --spruce-2: #d9e1d6; --spruce-dim: #9fb2a6;
    --clay: #dd7040; --clay-deep: #f0925f;
    --butter: #f3c84e; --butter-pale: #3a2f12;
    --sage: #4c7a5e; --rose: #7a4a3a; --sky: #2b4a59; --danger: #ef7d6d;
    --line: rgba(238, 241, 232, 0.16); --line-soft: rgba(238, 241, 232, 0.09);
    --shadow-print: 5px 6px 0 rgba(0, 0, 0, 0.35);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -18px rgba(0, 0, 0, 0.7);
    --shadow-pop: 0 14px 34px -8px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.4);
    --bar-bg: #0a120e; --bar-ink: #eef1e8; --bar-active-bg: #2a3c33; --bar-active-ink: #ffffff;
    --good: #7cc79a; --good-dot: #6fbf8a; --chart-plan: #7cc79a; --chart-actual: #f0925f;
    --flow-income: #7cc79a; --flow-hub: #9fb2a6; --flow-group: #e07a4b; --flow-category: #f0a074;
    --flow-saved: #6fb1ee; --flow-loss: #e6b84a; --flow-expected: #4f8f68;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --oat: #0f1a15; --oat-deep: #1f2e26; --cream: #172520;
  --spruce: #eef1e8; --spruce-2: #d9e1d6; --spruce-dim: #9fb2a6;
  --clay: #dd7040; --clay-deep: #f0925f;
  --butter: #f3c84e; --butter-pale: #3a2f12;
  --sage: #4c7a5e; --rose: #7a4a3a; --sky: #2b4a59; --danger: #ef7d6d;
  --line: rgba(238, 241, 232, 0.16); --line-soft: rgba(238, 241, 232, 0.09);
  --shadow-print: 5px 6px 0 rgba(0, 0, 0, 0.35);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 14px 34px -8px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.4);
  --bar-bg: #0a120e; --bar-ink: #eef1e8; --bar-active-bg: #2a3c33; --bar-active-ink: #ffffff;
  --good: #7cc79a; --good-dot: #6fbf8a; --chart-plan: #7cc79a; --chart-actual: #f0925f;
  --flow-income: #7cc79a; --flow-hub: #9fb2a6; --flow-group: #e07a4b; --flow-category: #f0a074;
  --flow-saved: #6fb1ee; --flow-loss: #e6b84a; --flow-expected: #4f8f68;
  color-scheme: dark;
}

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Reset & base ------------------------------------------------ */

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

html { scroll-behavior: smooth; }
/* Big monitors: scale the whole rem-based system up instead of just stretching
   the layout, so 1440p and 4K screens get larger type and a wider column. */
@media (min-width: 1800px) { html { font-size: 112.5%; } }
@media (min-width: 2400px) { html { font-size: 125%; } }

body.app {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--oat);
  background-image: radial-gradient(ellipse 90% 60% at 50% -10%, var(--cream) 0%, transparent 60%);
  color: var(--spruce);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain, matching the marketing surface */
body.app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 480;
  line-height: 1.1;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

a { color: var(--clay-deep); text-underline-offset: 3px; }
a:hover { color: var(--clay); }

::selection { background: var(--butter); color: var(--spruce); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bar-bg);
  color: var(--bar-ink);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10000;
}
.skip-link:focus { left: 0; }

/* ---------- Brand mark -------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--spruce);
  text-decoration: none;
  font-family: var(--font-display);
}
.brand__mark { width: 34px; height: 34px; color: var(--spruce); }
.brand__word {
  font-size: 1.35rem;
  font-weight: 520;
  letter-spacing: -0.01em;
}

/* ---------- Buttons ----------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.85rem 1.4rem;
  border: 1.5px solid var(--spruce);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--spruce);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--oat-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn--solid {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--on-clay);
  box-shadow: 0 1px 0 rgba(23, 56, 43, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}
.btn--solid:hover { background: var(--clay-deep); border-color: var(--clay-deep); color: var(--on-clay); }
/* The marketing site keeps the offset "print" shadow; in-app it's reserved for auth. */
.auth .btn--solid { box-shadow: var(--shadow-print); }

.btn--block { width: 100%; }

/* ---------- Forms ------------------------------------------------------- */

.field { margin: 0 0 1.1rem; }
.field__label {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--spruce-2);
  margin: 0 0 0.35rem;
}
.field__input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--spruce);
  background: var(--cream);
  padding: 0.8rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field__input::placeholder { color: color-mix(in srgb, var(--spruce-dim) 70%, transparent); }
.field__input:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 22%, transparent);
}

/* ---------- Searchable selects (Tom Select) ----------------------------
   The wrapper inherits the <select>'s classes, so .field__input styling lands on the
   wrapper; move it onto .ts-control and let the wrapper be a plain box. */
.ts-wrapper.field__input { padding: 0; border: 0; background: none; box-shadow: none; }
.ts-wrapper .ts-control {
  font-family: var(--font-body); font-size: 1.0625rem; color: var(--spruce);
  background: var(--cream); padding: 0.8rem 2.2rem 0.8rem 0.95rem; min-height: 0;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); box-shadow: none;
}
.ts-wrapper.field__input--compact .ts-control { padding: 0.45rem 2rem 0.45rem 0.6rem; font-size: 0.98rem; }
/* Tom Select hardcodes #fff / #303030 for the typing, filled and multi states at higher
   specificity than the base rule above; restate them in theme tokens so dark mode holds. */
.ts-wrapper.single .ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.full .ts-control,
.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control { background: var(--cream); color: var(--spruce); }
.ts-wrapper .ts-control .item, .ts-wrapper.single.input-active .ts-control > input { color: var(--spruce); }
.ts-wrapper.multi .ts-control > div, .ts-wrapper.multi .ts-control > div.active { background: var(--oat-deep); color: var(--spruce); }
.ts-wrapper .dropdown-header { background: var(--oat); border-color: var(--line); color: var(--spruce); }
.ts-wrapper .dropdown-header-close { color: var(--spruce-dim); }
.ts-dropdown, .ts-dropdown .option, .ts-dropdown .active.create { color: var(--spruce); }
.ts-wrapper.focus .ts-control { border-color: var(--clay); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 22%, transparent); }
.ts-wrapper.single .ts-control::after { border-top-color: var(--spruce-dim); right: 0.9rem; }
.ts-wrapper.single.dropdown-active .ts-control::after { border-bottom-color: var(--spruce-dim); }
.ts-wrapper .ts-control > input { color: var(--spruce); font-family: inherit; font-size: inherit; }
.ts-wrapper .ts-control > input::placeholder, .ts-wrapper .ts-control .item.ts-placeholder { color: color-mix(in srgb, var(--spruce-dim) 70%, transparent); }
.ts-dropdown {
  font-family: var(--font-body); font-size: 1rem; color: var(--spruce); background: var(--cream);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); margin-top: 0.25rem;
  z-index: 1000;
}
.ts-dropdown .ts-dropdown-content { max-height: 18rem; }
.ts-dropdown .optgroup-header { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim); background: var(--oat); padding: 0.45rem 0.8rem; }
.ts-dropdown .option, .ts-dropdown .no-results { padding: 0.5rem 0.8rem; }
.ts-dropdown .active { background: var(--oat-deep); color: var(--spruce); }
.ts-dropdown .option.selected { font-weight: 700; }
.ts-dropdown .no-results { color: var(--spruce-dim); }
.ts-dropdown .highlight { background: color-mix(in srgb, var(--butter) 55%, transparent); border-radius: 2px; }
.ts-wrapper.single .ts-control, .ts-wrapper.single .ts-control input { cursor: pointer; }
/* .field__input--compact sets width:auto, which would collapse the widget. */
.ts-wrapper.field__input--compact { width: 15rem; max-width: 100%; }
.txn__note-input { width: 13rem; max-width: 100%; }
.txn__note { color: var(--spruce-dim); font-style: italic; }
.txn__note > i { font-size: 0.85em; }

/* ---------- Flash messages --------------------------------------------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: 0.98rem;
  margin: 0 0 1.1rem;
}
/* Below a page title the .stack gap already separates it; drop the extra bottom margin. */
.page-head + .flash { margin-bottom: 0; }
.flash--alert {
  background: color-mix(in srgb, var(--danger) 12%, var(--cream));
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
}
.flash--notice {
  background: color-mix(in srgb, var(--sage) 28%, var(--cream));
  border-color: color-mix(in srgb, var(--spruce) 28%, transparent);
  color: var(--spruce-2);
}

/* ---------- Impersonation banner (super admin signed in as someone) ---- */

.impersonation-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding: 0.5rem var(--main-pad-x);
  background: color-mix(in srgb, var(--danger) 14%, var(--cream));
  border-bottom: 1.5px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  font-size: 0.95rem;
}
.impersonation-banner__form { margin-left: auto; }

/* ---------- Auth screens ------------------------------------------------ */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.auth__card {
  width: 100%;
  max-width: 26rem;
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2.4rem 2.2rem 2.2rem;
}

.auth__brand {
  display: flex;
  justify-content: center;
  margin: 0 0 1.6rem;
}

.auth__title {
  font-size: 1.95rem;
  text-align: center;
  margin: 0 0 0.3rem;
}
.auth__lede {
  text-align: center;
  color: var(--spruce-dim);
  margin: 0 0 1.8rem;
}

.auth__submit { margin-top: 0.4rem; }

.auth__alt {
  margin: 1.4rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  font-size: 0.96rem;
  color: var(--spruce-dim);
}
.auth__alt a { font-weight: 600; }

/* ---------- App shell (for future product pages) ----------------------- */

/* A deep spruce band: the one dark surface in the app, so the chrome reads as chrome
   and the oat content area underneath is unmistakably "the page". */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--bar-h);
  padding: 0 var(--main-pad-x);
  background: var(--bar-bg);
  color: var(--bar-ink);
}
.app-bar .brand { color: var(--bar-ink); }
.app-bar .brand__mark { color: var(--bar-ink); width: 30px; height: 30px; }
.app-bar .brand__word { font-size: 1.25rem; }

.app-main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--main-pad-y) var(--main-pad-x) 4rem;
}
.app-main--wide { max-width: 100rem; }

/* ---------- App navigation --------------------------------------------- */

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
.app-nav__link {
  font-weight: 600;
  font-size: 0.95rem;
  color: color-mix(in srgb, var(--bar-ink) 72%, transparent);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 0;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.app-nav__link:hover { color: var(--bar-ink); background: color-mix(in srgb, var(--bar-ink) 10%, transparent); }
.app-nav__link.is-active { color: var(--bar-active-ink); background: var(--bar-active-bg); }
.app-nav__link--quiet { font-weight: 500; }
.app-nav__form { margin: 0; }
.app-nav__end { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.family-switcher { margin: 0; }
.family-switcher--sheet { display: none; padding: 0.3rem 0.75rem 0.5rem; border-bottom: 1px solid var(--line-soft); margin-bottom: 0.3rem; }
.family-switcher--sheet .family-switcher__select { width: 100%; max-width: none; color: var(--spruce); background: var(--oat); border-color: var(--line); border-radius: var(--radius-sm); }
.family-switcher__select {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--bar-ink);
  background: color-mix(in srgb, var(--bar-ink) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--bar-ink) 22%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  max-width: 11rem;
  text-overflow: ellipsis;
}
.family-switcher__select option { color: var(--spruce); background: var(--cream); }

/* User menu: avatar disc opening a small sheet (details/summary + menu controller). */
.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer;
  display: inline-grid; place-items: center;
  width: 2.1rem; height: 2.1rem; border-radius: 999px;
  background: var(--butter); color: var(--spruce);
  font-weight: 700; font-size: 0.98rem; font-family: var(--font-body);
  border: 2px solid transparent; user-select: none;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { border-color: var(--cream); }
.user-menu__sheet {
  position: absolute; right: 0; top: calc(100% + 0.6rem); z-index: 60;
  min-width: 15rem; padding: 0.4rem;
  background: var(--cream); color: var(--spruce);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.user-menu__who { padding: 0.6rem 0.75rem 0.7rem; border-bottom: 1px solid var(--line-soft); margin-bottom: 0.3rem; }
.user-menu__name { display: block; font-weight: 700; }
.user-menu__email { display: block; font-size: 0.9rem; color: var(--spruce-dim); overflow: hidden; text-overflow: ellipsis; }
.user-menu__item {
  display: block; width: 100%; text-align: left;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--spruce); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  background: none; border: 0; cursor: pointer; font-family: var(--font-body);
}
.user-menu__item:hover { background: var(--oat-deep); color: var(--spruce); }
.user-menu__item--quiet { color: var(--spruce-dim); }
.user-menu__form { margin: 0.3rem 0 0; padding-top: 0.3rem; border-top: 1px solid var(--line-soft); }

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

.stack > * + * { margin-top: 1.5rem; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-head__eyebrow {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--spruce-dim);
  margin: 0 0 0.15rem;
}
.page-head h1 { margin: 0; font-size: 2.15rem; letter-spacing: -0.01em; }
.page-head__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.page-head__actions .btn { padding: 0.55rem 1rem; font-size: 0.98rem; }

.panel {
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2.2rem 2rem;
}
.panel--narrow { max-width: 32rem; margin: 1rem auto; }
.panel__lede { color: var(--spruce-dim); margin: 0 0 1.4rem; }
.panel__alt {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-soft);
  color: var(--spruce-dim);
}
.join-code-form { display: flex; gap: 0.6rem; align-items: stretch; }
.join-code-form .field__input { flex: 1; }

.card {
  background: var(--cream);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-card);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.9rem;
}
.card__head h2 { margin: 0; font-size: 1.2rem; }
.card__actions { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

.btn--small { padding: 0.45rem 0.85rem; font-size: 0.96rem; }
.btn--quiet { background: transparent; border-color: var(--line); color: var(--spruce-dim); box-shadow: none; }
.btn--quiet:hover { color: var(--spruce); }

.table { width: 100%; border-collapse: collapse; }
.table td { padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table td:first-child { padding-left: 0; }
.table td:last-child { padding-right: 0; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--oat) 55%, transparent); }
.table__meta { text-align: right; white-space: nowrap; }
.table__actions { text-align: right; width: 6rem; }
.member-name { font-weight: 600; }
.link-quiet { color: var(--spruce-dim); font-size: 0.98rem; }
.link-quiet:hover { color: var(--spruce); }

.tag {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: var(--oat-deep);
  color: var(--spruce-dim);
  vertical-align: middle;
}
.tag--owner { background: color-mix(in srgb, var(--clay) 22%, var(--cream)); color: var(--clay-deep); }
.tag--admin { background: color-mix(in srgb, var(--sky) 40%, var(--cream)); color: var(--spruce-2); }
.tag--quiet { background: none; color: var(--spruce-dim); font-weight: 500; text-transform: none; letter-spacing: 0; }

.join-code {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--spruce);
  background: var(--oat);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  display: inline-block;
}

.tag--google { background: color-mix(in srgb, var(--rose) 40%, var(--cream)); color: var(--clay-deep); }
.tag--microsoft { background: color-mix(in srgb, var(--sky) 50%, var(--cream)); color: var(--spruce-2); }
.tag--member { background: var(--oat-deep); color: var(--spruce-dim); }
.tag--reauth { background: color-mix(in srgb, var(--danger) 16%, var(--cream)); color: var(--danger); }

.reconnect-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.1rem;
  margin: 0 0 1.4rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 12%, var(--cream));
  border: 1.5px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  font-weight: 600;
}
.meta-quiet { color: var(--spruce-dim); font-size: 0.9rem; font-weight: 400; }

.connect-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.provider-btn { gap: 0.6rem; }
.provider-btn__mark {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: var(--oat-deep);
  font-weight: 700;
  font-family: var(--font-mono);
}

.inline-form { display: inline-block; margin: 0; }
.field__input--inline { width: auto; display: inline-block; padding: 0.45rem 0.6rem; font-size: 0.98rem; }

/* ---------- Calendar (FullCalendar) ------------------------------------ */

.calendar-shell {
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.4rem;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  padding: 0.2rem 0.2rem 0.4rem;
}
.legend-item { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.98rem; font-weight: 600; }
.legend-swatch { width: 0.85rem; height: 0.85rem; border-radius: 4px; }
.legend-owner { color: var(--spruce-dim); font-weight: 400; font-size: 0.93rem; }

.calendar-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--spruce-dim);
}
.calendar-empty p { margin-bottom: 1rem; }
.calendar-hint { text-align: center; color: var(--spruce-dim); font-size: 0.98rem; margin: 0; }

.checkbox-row { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0 0 1.1rem; cursor: pointer; font-weight: 600; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }

.split-fields {
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 0 0 1.1rem;
  min-width: 0;
}
.split-fields legend { padding: 0 0.3rem; }
/* One split leg: type + amount on one row, the category (or income source) full
   width beneath, then the note and Remove. Inputs stretch to their cell so a long
   category name can't push the row out of the card. */
.split-line {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.6rem 0.8rem;
  align-items: end;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line-soft);
}
.split-line:first-child { border-top: none; padding-top: 0; }
.split-line .field { margin-bottom: 0; min-width: 0; }
.split-line .field__input--compact { width: 100%; }
.split-line [data-kind-fields-target="category"],
.split-line [data-kind-fields-target="income"] { grid-column: 1 / -1; }
.split-line [data-kind-fields-target="income"][hidden],
.split-line [data-kind-fields-target="category"][hidden] { display: none; }
.split-line__remove { grid-column: 1 / -1; justify-self: end; }
.split-line .field:has([name$="[memo]"]) { grid-column: 1 / -1; }
.panel--form { max-width: 40rem; }

/* Row action menu: a ⋯ trigger opening a pop-up of per-row actions. */
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.row-menu { position: relative; }
.row-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--spruce-dim);
  font-size: 1.15rem;
  line-height: 1;
  user-select: none;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover,
.row-menu[open] > summary { background: var(--oat-deep); color: var(--spruce); }

.row-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 20;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  text-align: left;
}
.row-menu__item {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--spruce);
  font-size: 0.98rem;
  background: none;
  border: 0;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.row-menu__item:hover { background: var(--oat-deep); }
.row-menu__item--danger { color: var(--danger); }

/* Per-row "Scan receipt": the file input is visually hidden; its label is the item. */
.scan-form { display: block; }
.scan-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; border: 0;
  clip: rect(0 0 0 0); overflow: hidden;
}
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--cream)); }

/* Theme FullCalendar to the Kitchen Table Ledger palette. */
.fc {
  --fc-border-color: var(--line-soft);
  --fc-today-bg-color: color-mix(in srgb, var(--butter) 16%, transparent);
  --fc-neutral-bg-color: var(--oat);
  --fc-page-bg-color: var(--cream);
  --fc-event-border-color: transparent;
  font-family: var(--font-body);
}
.fc .fc-toolbar-title { font-family: var(--font-display); font-weight: 480; font-size: 1.5rem; color: var(--spruce); }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number { color: var(--spruce-dim); text-decoration: none; }
.fc .fc-button {
  background: var(--cream);
  border: 1.5px solid var(--line);
  color: var(--spruce);
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: capitalize;
  box-shadow: none;
}
.fc .fc-button:hover { background: var(--oat-deep); color: var(--spruce); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--spruce);
  border-color: var(--spruce);
  color: var(--oat);
}
.fc .fc-button:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 22%, transparent); }
.fc .fc-event { padding: 1px 4px; font-size: 0.9rem; font-weight: 600; cursor: default; }

/* ---------- Share rows ------------------------------------------------- */

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.share-row:last-of-type { border-bottom: none; }
.share-row__toggle { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.share-row__name { font-weight: 600; }
.share-row__controls { display: inline-flex; align-items: center; gap: 0.7rem; }
.share-row__color {
  width: 2.4rem;
  height: 2rem;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}
.add-member-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.add-member-form .field__input:first-of-type { flex: 1; min-width: 14rem; }
.member-name + .tag { margin-left: 0.4rem; }

/* ---------- Budgeting & Money ------------------------------------------ */

/* Money sections: one cream strip pinned under the app bar, full-bleed across the
   main column. Active section is an underline, not a box, so it reads as a place
   you're in rather than a button. Sub-sections hang off it as small pills. */
.money-nav {
  position: sticky; top: var(--bar-h); z-index: 40;
  margin: calc(-1 * var(--main-pad-y)) calc(-1 * var(--main-pad-x)) 0;
  padding: 0 var(--main-pad-x);
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.money-tabs {
  display: flex; gap: 0.1rem; height: var(--tabs-h);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--main-pad-x)); padding: 0 var(--main-pad-x);
}
.money-tabs::-webkit-scrollbar { display: none; }
.money-tabs__link {
  position: relative; display: inline-flex; align-items: center; flex: 0 0 auto;
  font-weight: 600; font-size: 0.95rem; color: var(--spruce-dim); text-decoration: none;
  padding: 0 0.7rem; border-radius: 0; border: 0;
  transition: color 0.12s ease;
}
.money-tabs__link::after {
  content: ""; position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0;
  height: 2.5px; border-radius: 3px 3px 0 0; background: transparent;
}
.money-tabs__link:hover { color: var(--spruce); }
.money-tabs__link.is-active { color: var(--spruce); }
.money-tabs__link.is-active::after { background: var(--clay); }
.money-tabs--sub {
  height: auto; padding-top: 0.6rem; padding-bottom: 0.6rem; gap: 0.3rem;
}
.money-tabs--sub .money-tabs__link {
  font-size: 0.93rem; font-weight: 600; padding: 0.22rem 0.7rem; border-radius: 999px;
  border: 1px solid transparent;
}
.money-tabs--sub .money-tabs__link::after { display: none; }
.money-tabs--sub .money-tabs__link:hover { background: var(--oat-deep); }
.money-tabs--sub .money-tabs__link.is-active { background: var(--spruce); color: var(--oat); }
.stack > .money-nav + * { margin-top: 1.6rem; }

/* Transactions list: filters + inline categorization */
.list-toolbar__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem;
  padding-bottom: 0.8rem; border-bottom: 1px solid var(--line-soft);
}
.list-toolbar__title { display: flex; flex-direction: column; line-height: 1.2; margin-right: 0.4rem; }
.list-toolbar__name { font-weight: 700; font-size: 1.05rem; color: var(--spruce); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; flex: 1; }
.filter-chips { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 0.22rem 0.7rem;
  font-size: 0.93rem; font-weight: 600; color: var(--spruce-dim); background: var(--cream);
}
.chip input { accent-color: var(--spruce); }
.chip:has(input:checked) { background: var(--oat-deep); border-color: var(--spruce-dim); color: var(--spruce); }
.field__input--compact {
  width: auto; padding: 0.4rem 0.65rem; font-size: 0.98rem; line-height: 1.2;
}
.checkbox-row--inline {
  margin: 0; display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.98rem; color: var(--spruce-dim);
}
.categorize-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.categorize-row .btn { padding: 0.4rem 0.9rem; font-size: 0.98rem; }
.pair-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.98rem;
}
.pair-bar .btn { padding: 0.35rem 0.8rem; font-size: 0.96rem; }
.pair-bar__form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.pair-check { margin-right: 0.6rem; vertical-align: middle; accent-color: var(--spruce); }
.pair-bar__all { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.pair-bar__all .pair-check { margin-right: 0; }
/* Filters + transfer bar stay pinned under the app bar while the list scrolls.
   Negative margins stretch it to the card edges so rows slide underneath cleanly. */
.list-toolbar {
  position: sticky; top: calc(var(--bar-h) + var(--tabs-h)); z-index: 10;
  background: var(--cream);
  margin: -1.4rem -1.5rem 0.6rem; padding: 1rem 1.5rem 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.list-toolbar__head { padding-bottom: 0.7rem; }
.filter-bar__search { min-width: 15rem; flex: 1; max-width: 22rem; }

/* Spending overview charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.4rem; }
.chart-title { font-size: 1.1rem; margin-bottom: 0.9rem; }
.chart-holder { position: relative; height: 310px; }
.chart-table { margin-top: 1rem; }
.chart-table td { padding: 0.45rem 0; font-size: 0.98rem; }
.chart-table__pct { width: 3.5rem; color: var(--spruce-dim); }
.chart-table tr.is-clickable { cursor: pointer; }
.chart-table tr.is-clickable:hover td { background: color-mix(in srgb, var(--oat-deep) 55%, transparent); }
/* Drill-down chrome: title + back button on one line, crumbs beneath. */
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.chart-head .btn[hidden] { display: none; } /* .btn's display outranks the UA [hidden] rule */
.chart-head .chart-title { margin-bottom: 0.4rem; }
.chart-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; min-height: 1.6rem; margin-bottom: 0.6rem; font-size: 0.92rem; color: var(--spruce-dim); }
.chart-crumbs__item { font: inherit; font-weight: 600; color: var(--spruce-dim); background: none; border: 0; padding: 0.1rem 0.2rem; cursor: pointer; border-radius: 4px; }
.chart-crumbs__item:hover { color: var(--spruce); text-decoration: underline; }
.chart-crumbs__item.is-current { color: var(--spruce); cursor: default; }
.chart-crumbs__item.is-current:hover { text-decoration: none; }
.chart-crumbs__note { font-weight: 400; color: var(--spruce-dim); }
.chart-crumbs__sep { opacity: 0.6; }
.chart-hint { margin-top: 0.5rem; min-height: 1.2em; }
.chart-swatch {
  display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px;
  vertical-align: -0.08rem; margin-right: 0.35rem;
}
.table__actions--roomy { width: 10.5rem; white-space: nowrap; }
.table__actions--roomy .link-quiet { margin-left: 0.55rem; }
.tag--review { background: color-mix(in srgb, var(--clay) 22%, var(--cream)); color: var(--clay-deep); }
/* Machine-suggested category/income source awaiting the user's accept/correct. */
.tag--suggest { background: color-mix(in srgb, var(--sky) 32%, var(--cream)); color: var(--spruce-2); text-transform: none; letter-spacing: 0; }
.suggest-bar .tag--suggest { font-size: 0.9rem; }

.figure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1.2rem; }
/* Wider columns + more breathing room for cards with large currency values. */
.figure-grid--roomy { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1.5rem 2rem; }
.figure-grid--roomy .figure__value { font-size: 1.4rem; white-space: nowrap; }
.figure__label { font-size: 0.86rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--spruce-dim); margin: 0 0 0.25rem; }
.figure__value { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 600; color: var(--spruce); }
.figure__value.amount--neg { color: var(--danger); }
.figure__value.amount--pos { color: var(--spruce-2); }

.amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.amount--neg { color: var(--danger); }
.amount--pos { color: var(--spruce-2); }
.amount--zero { color: var(--spruce-dim); }

.rta-banner {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1rem 1.4rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--sage) 26%, var(--cream));
  border: 1.5px solid color-mix(in srgb, var(--spruce) 24%, transparent);
}
.rta-banner__main { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.rta-banner--over { background: color-mix(in srgb, var(--danger) 12%, var(--cream)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.rta-banner__label { font-weight: 600; }
.rta-banner__value { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; }
.rta-banner__breakdown {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem;
  font-family: var(--font-mono); font-size: 0.93rem; opacity: 0.75;
}

/* "What if I pay extra" — input on the left, result beside it on desktop. */
.whatif { display: grid; grid-template-columns: minmax(13rem, 17rem) 1fr; gap: 1.4rem; align-items: center; margin-top: 1.1rem; }
.whatif__result { align-self: center; }
@media (max-width: 720px) { .whatif { grid-template-columns: 1fr; } }

.budget-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem 7.5rem 7.5rem; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft);
}
/* Category tables carry an extra Type (essential/discretionary) column. */
.budget-row--typed { grid-template-columns: minmax(0, 1fr) 7rem 7.5rem 7.5rem 8rem; }
/* Figures stay on one line: a step smaller than body text, never wrapped. */
.budget-row__num { font-size: 0.95rem; white-space: nowrap; }
.budget-row .pill { white-space: nowrap; font-size: 0.85rem; }
.budget-row__type { display: flex; align-items: flex-start; }
.budget-row--head .budget-row__type { align-items: center; }
.budget-row:last-child { border-bottom: none; }
.budget-row--head {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim);
  font-weight: 700; border-bottom: 1.5px solid var(--line);
}
.budget-row--total {
  border-top: 1.5px solid var(--line); border-bottom: none;
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; color: var(--spruce-dim);
}
.budget-row--total .budget-row__num { color: var(--spruce-2); font-size: 0.98rem; }
.budget-row__name { font-weight: 600; }
.budget-row__num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.budget-assign { margin: 0; text-align: right; position: relative; }
/* "Just this month / all future months" popover on recurring category edits */
.recurring-prompt {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 30;
  display: flex; flex-direction: column; gap: 0.4rem; align-items: stretch;
  width: max-content; min-width: 11rem; text-align: left;
  padding: 0.6rem; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--cream); box-shadow: var(--shadow-print, 0 10px 26px rgba(0, 0, 0, 0.16));
}
/* The class selector's display:flex outranks the UA [hidden] rule, so restore it. */
.recurring-prompt[hidden] { display: none; }
.recurring-prompt__q { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); font-weight: 700; }
.budget-assign__input { width: 6.5rem; text-align: right; padding: 0.4rem 0.55rem; font-size: 0.98rem; font-family: var(--font-mono); }

.bar { height: 0.45rem; border-radius: 999px; background: var(--oat-deep); overflow: hidden; margin-top: 0.35rem; max-width: 16rem; }
.bar__fill { height: 100%; background: var(--clay); }
.bar__fill--over { background: var(--danger); }

.pill { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.98rem; font-weight: 600; }
.pill--pos { background: color-mix(in srgb, var(--sage) 34%, var(--cream)); color: var(--spruce-2); }
.pill--neg { background: color-mix(in srgb, var(--danger) 16%, var(--cream)); color: var(--danger); }
.pill--zero { background: var(--oat-deep); color: var(--spruce-dim); }

.empty-note { text-align: center; color: var(--spruce-dim); padding: 1.5rem 1rem; }
.section-gap > * + * { margin-top: 1.2rem; }

/* Recurring toggle on budget category rows */
.recur-name { display: flex; align-items: center; gap: 0.55rem; }
.recur-name__label { font-weight: 600; }
.recur-toggle__form { margin: 0; display: inline-flex; flex: 0 0 auto; }
.recur-toggle {
  flex: 0 0 auto;
  width: 1.7rem; height: 1.7rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--spruce-dim);
  font-size: 0.98rem; line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.recur-toggle:hover { border-color: var(--clay); color: var(--clay-deep); transform: translateY(-1px); }
.recur-toggle--on {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--on-clay);
}
.recur-toggle--on:hover { background: var(--clay-deep); color: var(--on-clay); }
.recur-toggle--locked { cursor: default; opacity: 0.55; font-size: 0.88rem; }
.recur-name__hint { display: block; font-size: 0.82rem; font-weight: 400; color: var(--spruce-dim); margin-top: 0.1rem; }

/* Essential / Discretionary switch on budget category rows */
.class-toggle__form { margin: 0.25rem 0 0; display: inline-flex; }
.class-toggle {
  padding: 0.12rem 0.55rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: transparent;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  cursor: pointer; line-height: 1.5;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.class-toggle--essential {
  background: color-mix(in srgb, var(--sage) 32%, var(--cream));
  border-color: color-mix(in srgb, var(--spruce) 24%, transparent);
  color: var(--spruce-2);
}
.class-toggle--discretionary {
  background: color-mix(in srgb, var(--clay) 18%, var(--cream));
  border-color: color-mix(in srgb, var(--clay) 40%, transparent);
  color: var(--clay-deep);
}
.class-toggle:hover { filter: brightness(0.97); }

.budget-row__available { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
/* Target + cover controls on a budget row */
.budget-row__available { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.target { display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%; }
.target__track { position: relative; width: 4.2rem; height: 0.35rem; border-radius: 999px; background: var(--oat-deep); overflow: hidden; }
.target__fill { display: block; height: 100%; border-radius: 999px; background: var(--butter); }
.target--funded .target__fill { background: var(--good); }
.target__note { font-size: 0.75rem; font-family: var(--font-mono); white-space: nowrap; }
.target__note--ok { color: var(--good); }
.target__note--short { color: var(--clay-deep); }
.target__fund {
  font: inherit; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--clay); background: none; color: var(--clay-deep); cursor: pointer;
}
.target__fund:hover { background: var(--clay); color: var(--on-clay); }
.target-edit, .move-edit { display: inline-flex; }
.target-edit__open, .move-edit__open {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  border: 1px dashed var(--line); background: none; color: var(--spruce-dim); font: inherit; font-size: 0.75rem; cursor: pointer;
}
.target-edit__open:hover, .move-edit__open:hover { border-color: var(--clay); color: var(--clay-deep); }
.move-edit__open { border-style: solid; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.move-edit__open:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.target-edit__remove { margin-top: 0.8rem; }
/* "What's this balance for" breakdown of a pot that pays subscriptions */
.pot__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.95rem; margin: 0 0 0.3rem; }
.pot__table td { vertical-align: top; }
.pot__num { text-align: right; white-space: nowrap; }
.pot__free { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); font-weight: 600; }
.pot__regular summary { cursor: pointer; }
.pot__list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.pot__list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; }
.stack--tight > * + * { margin-top: 0.7rem; }
/* Auto-assign menu on the Ready to Assign banner */
.rta-menu { margin-left: auto; }
.rta-menu > summary.rta-menu__summary { width: auto; height: auto; border-radius: 999px; background: var(--cream); color: var(--spruce); display: inline-flex; gap: 0.35rem; padding: 0.35rem 0.75rem; border: 1px solid var(--line); }
.rta-menu[open] > summary.rta-menu__summary { transform: none; border-color: var(--spruce-dim); }
.rta-menu__sheet { min-width: 16rem; }
.rta-menu .inline-form { display: block; }
.rta-menu .user-menu__item { white-space: nowrap; }
.rta-banner--over .rta-menu > summary, .rta-banner--ahead .rta-menu > summary { color: var(--spruce); }

/* Income accordion (collapsed by default so expenses lead) */
.income-accordion > .budget-row:first-of-type { margin-top: 0.4rem; }
.income-accordion__summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  cursor: pointer; list-style: none; padding: 0.2rem 0;
}
.income-accordion__summary::-webkit-details-marker { display: none; }
.income-accordion__title { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.income-accordion__title h2 { margin: 0; }
.income-accordion__title h2::before { content: "▸"; display: inline-block; margin-right: 0.5rem; color: var(--spruce-dim); font-size: 0.8em; transition: transform 0.15s ease; }
.income-accordion[open] .income-accordion__title h2::before { transform: rotate(90deg); }
.income-accordion__hint { font-size: 0.93rem; color: var(--spruce-dim); font-family: var(--font-mono); }

/* Essential vs discretionary: Budgeted | Spending, side by side */
.spend-split__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 2.4rem; }
@media (max-width: 620px) { .spend-split__cols { grid-template-columns: 1fr; } }
.spend-split__side { display: flex; flex-direction: column; }
.spend-split__side + .spend-split__side { border-left: 1px solid var(--line-soft); padding-left: 2.4rem; }
@media (max-width: 620px) { .spend-split__side + .spend-split__side { border-left: none; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 1.2rem; } }
.spend-split__side-title { margin: 0 0 0.7rem; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim); }
.spend-split__stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.spend-split__stat { display: flex; flex-direction: column; gap: 0.15rem; }
.spend-split__label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); font-weight: 700; display: inline-flex; align-items: center; gap: 0.35rem; }
.spend-split__label::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 999px; }
.spend-split__label--ess::before { background: color-mix(in srgb, var(--sage) 60%, var(--spruce)); }
.spend-split__label--dis::before { background: var(--clay); }
.spend-split__value { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 600; }
.spend-split__pct { font-size: 0.88rem; color: var(--spruce-dim); }
.spend-split__bar { position: relative; display: flex; height: 0.55rem; border-radius: 999px; margin-top: 0.9rem; background: var(--oat-deep); }
.spend-split__bar > div:first-child { border-radius: 999px 0 0 999px; }
.spend-split__bar-ess { background: color-mix(in srgb, var(--sage) 60%, var(--spruce)); }
.spend-split__bar-dis { background: var(--clay); }
/* Income line: where this month's income runs out on the budgeted bar */
.spend-split__marker { position: absolute; top: -0.2rem; bottom: -0.2rem; width: 2px; background: var(--spruce-2); border-radius: 2px; }
.spend-split__marker::after {
  content: "Income"; position: absolute; top: -1.15rem; left: 50%; transform: translateX(-50%);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); white-space: nowrap;
}
.spend-split__caption { margin: 0.55rem 0 0; font-size: 0.9rem; color: var(--spruce-dim); }
.spend-split__caption strong { color: var(--spruce-2); }

/* Drag-and-drop reordering on /money/categories */
.cat-groups { display: flex; flex-direction: column; gap: 1.5rem; }
.cat-group .card__head h2 { display: inline-flex; align-items: center; gap: 0.45rem; }
.cat-list { display: flex; flex-direction: column; min-height: 2rem; }
.cat-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--cream);
}
.cat-item:last-child { border-bottom: none; }
.cat-item__name { font-weight: 600; }
.cat-item__actions { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; }
.cat-list__empty { padding: 0.6rem 0.2rem; margin: 0; }
.drag-handle {
  border: none; background: none; cursor: grab;
  color: var(--spruce-dim); font-size: 1rem; line-height: 1;
  padding: 0 0.2rem; user-select: none; flex: 0 0 auto;
}
.drag-handle:hover { color: var(--clay-deep); }
.drag-handle:active { cursor: grabbing; }
.is-dragging { opacity: 0.5; }
.cat-item.is-dragging { background: var(--oat-deep); }
.cat-group.is-dragging { box-shadow: var(--shadow-card); }

/* 3-month budget view: three dense columns. Figures never wrap — the type is a
   step smaller than the single-month page and every number cell is nowrap. */
.q-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.q-col { padding: 1.2rem 1.25rem; font-size: 0.9rem; min-width: 0; }
.q-col .card__head h2 { font-size: 1.1rem; }
.q-col .rta-banner { padding: 0.7rem 0.9rem; }
.q-col .rta-banner__value { font-size: 1.2rem; }
.q-col .rta-banner__breakdown { font-size: 0.78rem; }
.q-group { font-size: 0.95rem; margin: 1.1rem 0 0.15rem; }
.q-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 5.4rem 5.6rem 6.2rem; align-items: center;
  gap: 0.5rem; padding: 0.38rem 0; border-bottom: 1px solid var(--line-soft);
}
.q-row:last-child { border-bottom: none; }
.q-row .budget-row__num { font-size: 0.88rem; white-space: nowrap; }
.q-row .pill { font-size: 0.82rem; padding: 0.15rem 0.45rem; white-space: nowrap; }
.q-row--head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); font-weight: 700; border-bottom: 1.5px solid var(--line); }
.q-row--total { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); font-weight: 700; border-top: 1.5px solid var(--line); border-bottom: none; }
.q-row--total .budget-row__num { font-size: 0.85rem; color: var(--spruce-2); }
.q-row__name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-row .budget-assign__input { width: 100%; max-width: 5.4rem; font-size: 0.85rem; padding: 0.32rem 0.45rem; }
@media (max-width: 1100px) { .q-grid { grid-template-columns: 1fr; } .q-col { font-size: 1rem; } }

/* Charts */
.chart-line { width: 100%; height: 160px; display: block; }
.bar-row { margin: 0 0 0.7rem; }
.bar-row__head { display: flex; justify-content: space-between; font-size: 0.98rem; margin-bottom: 0.2rem; }
.bar-row .bar { height: 0.6rem; max-width: none; }

/* ---------- Status dots ------------------------------------------------ */

.status { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.98rem; font-weight: 600; color: var(--spruce-2); }
.status::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 30%, transparent); }
.status--ok::before { background: var(--good-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good-dot) 22%, transparent); }
.status--warn::before { background: var(--butter); box-shadow: 0 0 0 3px color-mix(in srgb, var(--butter) 35%, transparent); }
.status--bad::before { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.status--off::before { background: var(--line); box-shadow: none; }

/* ---------- Money overview --------------------------------------------- */

/* Net worth leads: one Fraunces figure, the trend drawn quietly beneath it. */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: end;
  padding: 1.6rem 1.75rem 1.4rem;
}
.hero__label { margin: 0 0 0.2rem; font-size: 0.95rem; color: var(--spruce-dim); font-weight: 500; }
.hero__value {
  margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--spruce);
}
.hero__value.amount--neg { color: var(--danger); }
.hero__split { display: flex; gap: 1.6rem; margin: 0.9rem 0 0; padding: 0; list-style: none; flex-wrap: wrap; }
.hero__split li { display: flex; flex-direction: column; gap: 0.05rem; }
.hero__split b { font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem; }
.hero__split span { font-size: 0.9rem; color: var(--spruce-dim); }
.hero__chart { min-width: 0; }
.hero__chart .chart-line { height: 120px; }
.hero__chart-note { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--spruce-dim); text-align: right; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero__chart-note { text-align: left; } }

/* "What needs me" tiles: a row of small, tappable facts. The one that matters most
   (something to review, a bank that stopped) carries the only warm colour. */
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem; }
.tile {
  display: flex; flex-direction: column; gap: 0.15rem; min-height: 5.4rem;
  padding: 0.95rem 1.1rem; border-radius: var(--radius);
  background: var(--cream); border: 1px solid var(--line-soft); box-shadow: var(--shadow-card);
  color: var(--spruce); text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
a.tile:hover { border-color: var(--spruce-dim); color: var(--spruce); transform: translateY(-1px); }
.tile__value .status { font-family: var(--font-body); font-size: 1.05rem; }
.tile__value { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile__label { font-size: 0.98rem; color: var(--spruce-dim); }
.tile__hint { margin-top: auto; padding-top: 0.35rem; font-size: 0.9rem; font-weight: 600; color: var(--clay-deep); }
.tile--warm { background: color-mix(in srgb, var(--butter-pale) 55%, var(--cream)); border-color: color-mix(in srgb, var(--butter) 55%, transparent); }
.tile--bad { background: color-mix(in srgb, var(--danger) 9%, var(--cream)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.tile--bad .tile__hint { color: var(--danger); }
.tile--good .tile__value { color: var(--spruce-2); }

.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.4rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* Compact ledger rows used on the overview and elsewhere. */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger__row {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 0.8rem; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft);
}
.ledger__row:last-child { border-bottom: none; }
.ledger__date { font-size: 0.9rem; color: var(--spruce-dim); font-variant-numeric: tabular-nums; line-height: 1.2; }
.ledger__payee { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger__meta { display: block; font-size: 0.9rem; color: var(--spruce-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger__amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ledger__amount.amount--neg { color: var(--spruce); }

/* ---------- Transactions list ------------------------------------------ */

/* Date is its own column; the row tells you what, where, when, and how much in
   one scan. Rows waiting for a decision carry a butter rule on the left. */
.txn { transition: background 0.12s ease; scroll-margin-top: calc(var(--bar-h) + var(--tabs-h) + 7rem); }
.txn td { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.txn__date { width: 3.6rem; padding-right: 0.4rem; color: var(--spruce-dim); font-size: 0.93rem; line-height: 1.2; white-space: nowrap; vertical-align: top; padding-top: 0.95rem; font-variant-numeric: tabular-nums; }
.txn__date b { display: block; color: var(--spruce); font-weight: 600; font-size: 0.95rem; }
.txn__main { min-width: 0; }
.txn__payee { font-weight: 600; font-size: 1rem; }
.txn__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin-top: 0.15rem; font-size: 0.92rem; color: var(--spruce-dim); }
.txn__id { font-family: var(--font-mono); font-size: 0.85rem; color: var(--spruce-dim); opacity: 0.85; letter-spacing: 0.01em; }
.tag .txn__id { font-size: 0.8rem; }
.filter-show { display: inline-flex; align-items: center; gap: 0.45rem; }
.txn__meta .tag { font-size: 0.86rem; }
.txn__amount { width: 7rem; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1rem; white-space: nowrap; vertical-align: top; padding-top: 0.95rem; }
.txn__amount.amount--neg { color: var(--spruce); }
/* What the bank charged on a foreign-currency account, under its converted figure. */
.txn__native { display: block; font-size: 0.74rem; font-weight: 500; color: var(--spruce-dim); }
.txn__amount.amount--pos { color: var(--good); }
.txn__actions { width: 4.6rem; text-align: right; vertical-align: top; padding-top: 0.7rem; }
.table td.txn__date, .table td.txn__amount, .table td.txn__actions { vertical-align: top; }
.txn--review { box-shadow: inset 3px 0 0 var(--butter); }
.txn--review td:first-child { padding-left: 0.6rem; }
.txn--pending .txn__payee, .txn--pending .txn__amount { opacity: 0.6; }
.txn--transfer .txn__payee { font-weight: 500; color: var(--spruce-dim); }
.categorize-row { margin-top: 0.5rem; }
.categorize-row .field__input--compact { max-width: 15rem; }
.pair-check { width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; }

.pair-bar { border-bottom: none; padding: 0.55rem 0 0.2rem; }
.suggest-bar { padding-top: 0; }

/* ---------- Banks ------------------------------------------------------ */

.bank { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line-soft); }
.bank:last-child { border-bottom: none; }
.bank__glyph {
  flex: 0 0 auto; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px;
  background: var(--oat-deep); color: var(--spruce); font-family: var(--font-display); font-size: 1.2rem; font-weight: 600;
}
.bank__body { flex: 1; min-width: 0; }
.bank__name { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.bank__accounts { margin: 0.3rem 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.96rem; color: var(--spruce-dim); }
.bank__accounts b { color: var(--spruce); font-weight: 600; }
.bank__sync { margin: 0.45rem 0 0; font-size: 0.93rem; color: var(--spruce-dim); }
.bank__error { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--danger); font-family: var(--font-mono); }
.bank__actions { display: flex; align-items: center; gap: 0.4rem; flex: 0 0 auto; }
.sync-note { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--radius-sm); background: var(--oat); font-size: 0.98rem; color: var(--spruce-2); margin: 0 0 0.6rem; }

/* ---------- Empty states ----------------------------------------------- */

.empty-note { padding: 2rem 1rem; }
.empty-note a { font-weight: 600; }

/* ---------- Responsive chrome ------------------------------------------ */

@media (max-width: 760px) {
  :root { --main-pad-x: 1rem; --main-pad-y: 1.1rem; --bar-h: 3.2rem; }
  body.app { font-size: 1.05rem; }
  .app-bar { gap: 0.6rem; }
  .app-bar .brand__word { display: none; }
  .app-nav { overflow-x: auto; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav__link { padding: 0.35rem 0.6rem; font-size: 0.98rem; }
  .family-switcher__select { max-width: 7.5rem; font-size: 0.9rem; }
  .page-head h1 { font-size: 1.7rem; }
  .page-head__actions { width: 100%; }
  .card { padding: 1.1rem 1rem; border-radius: 12px; }
  .list-toolbar { margin: -1.1rem -1rem 0.6rem; padding: 0.8rem 1rem 0; }
  /* Phone: each row becomes a small grid — date | payee & meta | amount, with the
     tick box and menu tucked under the amount — so payees stop wrapping. */
  .txn { display: grid; grid-template-columns: 2.9rem minmax(0, 1fr) auto; grid-template-areas: "date main amount" "date main actions"; column-gap: 0.6rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
  .txn:last-child { border-bottom: none; }
  .table .txn td { display: block; border: 0; padding: 0; width: auto; background: none; }
  .txn__date { grid-area: date; padding-top: 0.15rem; }
  .txn__main { grid-area: main; }
  .txn__amount { grid-area: amount; font-size: 0.95rem; padding-top: 0.15rem; }
  .txn__actions { grid-area: actions; align-self: end; }
  .txn--review { box-shadow: none; border-left: 3px solid var(--butter); padding-left: 0.5rem; margin-left: -0.75rem; }
  .txn--review td:first-child { padding-left: 0; }
  .categorize-row .field__input--compact { max-width: 100%; }
  .family-switcher--bar { display: none; }
  .family-switcher--sheet { display: block; }
  .table__actions--roomy { width: auto; white-space: normal; }
  .budget-row--typed { grid-template-columns: 1fr 5.5rem 5.5rem; }
  .budget-row--typed .budget-row__type, .budget-row--typed .budget-row__num:nth-child(4) { display: none; }
  .hero { padding: 1.2rem 1.1rem; }
}

/* ---------- Quick approve ---------------------------------------------- */

/* Machine-suggested rows, one tap each. Sits above the full list so the easy
   decisions clear first; the row disappears as soon as it's approved. */
.quick { background: color-mix(in srgb, var(--butter-pale) 28%, var(--cream)); border-color: color-mix(in srgb, var(--butter) 45%, transparent); }
.quick .card__head { flex-wrap: wrap; }
.quick__count { font-size: 0.95rem; color: var(--spruce-dim); margin-right: auto; }
.quick__list { list-style: none; margin: 0; padding: 0; }
.quick__row {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1.4fr) minmax(0, 1fr) 7rem auto; gap: 0.8rem; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid color-mix(in srgb, var(--butter) 30%, transparent);
}
.quick__row:last-child { border-bottom: none; }
.quick__date { font-size: 0.9rem; color: var(--spruce-dim); font-variant-numeric: tabular-nums; }
.quick__payee { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick__meta { display: block; font-size: 0.9rem; color: var(--spruce-dim); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick__suggest { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.quick__cat { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick__why { font-size: 0.88rem; color: var(--spruce-dim); }
.quick__amount.amount--neg { color: var(--spruce); }
.quick__amount.amount--pos { color: var(--good); }
.quick__amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.quick__actions { display: flex; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.quick__actions form { margin: 0; }
.quick__list:not(:has(.quick__row)) + .quick__done { display: block; }
.quick__done { display: none; padding: 0.8rem 0 0.2rem; color: var(--spruce-2); font-weight: 600; }
@media (max-width: 760px) {
  .quick__row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "payee amount" "suggest actions"; row-gap: 0.4rem; }
  .quick__date { display: none; }
  .quick__payee { grid-area: payee; }
  .quick__amount { grid-area: amount; }
  .quick__suggest { grid-area: suggest; }
  .quick__actions { grid-area: actions; }
}

/* Home maintenance */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.maint th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); font-weight: 700; padding: 0 0.4rem 0.5rem; border-bottom: 1px solid var(--line-soft); }
.maint th:first-child { padding-left: 0; }
.maint__every, .maint__last, .maint__due { white-space: nowrap; width: 9.5rem; }
.maint__label { display: none; }
.maint__actions { text-align: right; white-space: nowrap; width: 9.5rem; }
.maint__done { display: inline; margin: 0 0.5rem 0 0; }
.maint__row--overdue td:first-child, .maint__row--never td:first-child { box-shadow: inset 3px 0 0 var(--danger); padding-left: 0.6rem; }
.maint__row--soon td:first-child { box-shadow: inset 3px 0 0 var(--butter); padding-left: 0.6rem; }
@media (max-width: 760px) {
  .maint thead { display: none; }
  .maint__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name due" "every actions" "last actions"; column-gap: 0.6rem; row-gap: 0.15rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
  .maint__row:last-child { border-bottom: none; }
  .table .maint__row td { display: block; border: 0; padding: 0; width: auto; background: none; box-shadow: none; }
  .maint__row--overdue, .maint__row--never { box-shadow: inset 3px 0 0 var(--danger); padding-left: 0.6rem; }
  .maint__row--soon { box-shadow: inset 3px 0 0 var(--butter); padding-left: 0.6rem; }
  .maint__name { grid-area: name; }
  .maint__due { grid-area: due; text-align: right; }
  .maint__every { grid-area: every; font-size: 0.9rem; color: var(--spruce-dim); }
  .maint__last { grid-area: last; font-size: 0.9rem; color: var(--spruce-dim); }
  .maint__label { display: inline; }
  .maint__actions { grid-area: actions; align-self: end; }
}
.maint__remove { background: none; border: 0; padding: 0 0.2rem; margin-left: 0.4rem; font-size: 1.25rem; line-height: 1; color: var(--spruce-dim); cursor: pointer; vertical-align: middle; }
.maint__remove:hover { color: var(--danger); }

/* ---------- Icons (Font Awesome 6 Pro subset) --------------------------- */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.btn > i { font-size: 0.92em; opacity: 0.9; }
.btn--small > i { font-size: 0.9em; }
.app-nav__link > i { margin-right: 0.3rem; font-size: 0.95em; opacity: 0.85; }
.app-nav__link.is-active > i { opacity: 1; }
.money-tabs__link > i { margin-right: 0.35rem; font-size: 0.95em; opacity: 0.75; }
.money-tabs__link.is-active > i { opacity: 1; color: var(--clay-deep); }
.money-tabs--sub .money-tabs__link > i { display: none; }
.h-icon { color: var(--clay-deep); font-size: 0.85em; margin-right: 0.15rem; }
.tag > i { font-size: 0.8em; margin-right: 0.15rem; }
.tile__icon { display: block; font-size: 1.05rem; color: var(--spruce-dim); margin-bottom: 0.35rem; }
.tile--warm .tile__icon, .tile--bad .tile__icon { color: var(--clay-deep); }
.search-box { position: relative; display: inline-flex; align-items: center; flex: 1; max-width: 22rem; }
.search-box > i { position: absolute; left: 0.7rem; color: var(--spruce-dim); font-size: 0.85rem; pointer-events: none; }
.search-box .filter-bar__search { padding-left: 2rem; width: 100%; max-width: none; }
.bank__glyph > i { font-size: 1.15rem; }
.sync-note > i { margin-top: 0.2rem; color: var(--spruce-dim); }

/* Menus: icon column, roomier rows, a soft caret and shadow. */
.row-menu > summary { display: inline-grid; place-items: center; width: 2rem; height: 2rem; padding: 0; font-size: 0.95rem; }
.row-menu__list { min-width: 13rem; padding: 0.4rem; border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.row-menu__item { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.7rem; font-size: 0.95rem; }
.row-menu__item > i { color: var(--spruce-dim); font-size: 0.95em; }
.row-menu__item--danger > i { color: var(--danger); }
.row-menu__item:hover > i { color: inherit; }
.user-menu__sheet { min-width: 17rem; padding: 0.45rem; }
.user-menu__who { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.75rem 0.85rem; }
.user-menu__avatar { flex: 0 0 auto; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; background: var(--butter); color: var(--on-butter); font-weight: 700; font-size: 1.1rem; }
.user-menu__id { min-width: 0; display: flex; flex-direction: column; gap: 0.05rem; }
.user-menu__family { font-size: 0.85rem; color: var(--spruce-dim); margin-top: 0.15rem; }
.user-menu__family > i { margin-right: 0.2rem; }
.user-menu__item { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; }
.user-menu__item > i { color: var(--spruce-dim); font-size: 0.95em; }
.user-menu__item:hover > i { color: var(--clay-deep); }
.user-menu > summary { transition: transform 0.12s ease, border-color 0.12s ease; }
.user-menu[open] > summary { transform: scale(0.94); }

/* Transactions: filters live in a slide-over drawer; the bulk bar appears only
   once rows are ticked. */
.filter-toggle { display: inline-flex; align-items: center; gap: 0.45rem; }
.filter-toggle__count {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  border-radius: 999px; background: var(--spruce); color: var(--cream); font-size: 0.8rem; font-weight: 700;
}
.filter-toggle__count[hidden] { display: none; }
.list-toolbar .pair-bar { display: none; }
.card:has(input[form="bulk-actions-form"]:checked) .list-toolbar .pair-bar { display: flex; }

.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; border: 0;
  width: min(23rem, 100vw); height: 100dvh; max-height: none; max-width: none;
  background: var(--cream); color: var(--spruce); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform 0.22s ease, overlay 0.22s allow-discrete, display 0.22s allow-discrete;
}
.drawer[open] { transform: none; }
@starting-style { .drawer[open] { transform: translateX(100%); } }
.drawer::backdrop { background: rgba(23, 56, 43, 0.22); backdrop-filter: blur(1.5px); }
.drawer__panel { display: flex; flex-direction: column; height: 100%; }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line-soft);
}
.drawer__head h2 { margin: 0; font-size: 1.25rem; }
.drawer__close {
  display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 999px;
  border: 0; background: none; color: var(--spruce-dim); font-size: 1.1rem; cursor: pointer;
}
.drawer__close:hover { background: var(--oat-deep); color: var(--spruce); }
.drawer__section { border: 0; margin: 0; padding: 1.1rem 1.3rem 0.4rem; overflow-y: auto; }
.drawer__label {
  padding: 0; margin-bottom: 0.5rem; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim);
}
.drawer__option {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; margin: 0 -0.7rem;
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
}
.drawer__option:hover { background: var(--oat); }
.drawer__option:has(input:checked) { background: var(--oat-deep); }
.drawer__option input { accent-color: var(--spruce); width: 1.05rem; height: 1.05rem; margin: 0; }
.drawer__foot {
  display: flex; justify-content: space-between; gap: 0.6rem; margin-top: auto;
  padding: 1rem 1.3rem; border-top: 1px solid var(--line-soft);
}
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* Centered modal (native <dialog>), sharing the drawer's head/close/foot pieces. */
.modal {
  margin: auto; padding: 0; border: 0; border-radius: var(--radius);
  width: min(28rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  background: var(--cream); color: var(--spruce); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(0.6rem) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease, overlay 0.18s allow-discrete, display 0.18s allow-discrete;
}
.modal--wide { width: min(44rem, calc(100vw - 2rem)); }
.modal[open] { opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: translateY(0.6rem) scale(0.98); } }
.modal::backdrop { background: rgba(23, 56, 43, 0.22); backdrop-filter: blur(1.5px); }
.modal__panel { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.modal__body { padding: 1rem 1.3rem 1.2rem; overflow-y: auto; }
.modal__lede { margin: 0 0 0.9rem; line-height: 1.4; }
.modal__lede .meta-quiet { display: block; margin-top: 0.15rem; }
@media (prefers-reduced-motion: reduce) { .modal { transition: none; } }

/* Click-to-rename transaction titles */
.txn__rename {
  display: inline-flex; align-items: baseline; gap: 0.4rem; max-width: 100%;
  padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: text;
}
.txn__rename-icon { font-size: 0.78rem; color: var(--spruce-dim); opacity: 0; transition: opacity 0.12s; }
.txn__rename:hover .txn__rename-icon, .txn__rename:focus-visible .txn__rename-icon { opacity: 1; }
.txn__rename:hover { text-decoration: underline dotted var(--line); text-underline-offset: 3px; }
.txn__rename-form { margin: 0; }
.txn__rename-form[hidden] { display: none; }
.txn__rename-input { width: min(100%, 24rem); font-weight: 600; padding: 0.25rem 0.5rem; }
@media (hover: none) { .txn__rename-icon { opacity: 0.55; } }

/* ---------- Category history --------------------------------------------- */

.cat-link { color: inherit; text-decoration: none; border-bottom: 1px dotted color-mix(in srgb, var(--spruce-dim) 55%, transparent); }
.cat-link:hover { color: var(--clay-deep); border-bottom-color: var(--clay); }
.budget-row--history { grid-template-columns: minmax(0, 1fr) 8rem 8rem 8rem; }
.budget-row--history.is-current { background: color-mix(in srgb, var(--butter-pale) 40%, transparent); margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-radius: var(--radius-sm); }
.budget-row--history .tag { margin-left: 0.4rem; }
.chart-holder--wide { height: 280px; }

/* ---------- Budget start month ------------------------------------------ */

.budget-note { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--sky) 30%, var(--cream)); font-size: 0.95rem; color: var(--spruce-2); margin: 0; }
.budget-note > i { margin-top: 0.2rem; }
.budget-row--pre { opacity: 0.75; }
.budget-row__num--blank { color: var(--spruce-dim); font-family: var(--font-body); }
/* History figures (last month / 3-mo avg / 12-mo avg) sit at the right of the name cell. */
.budget-row__name--hist { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-width: 0; }
.budget-row__name--hist > .recur-name, .budget-row__name--hist > span:first-child { min-width: 0; }
.budget-hist { display: flex; gap: 0.35rem; flex: none; margin-left: auto; padding-right: 0.4rem; }
.budget-hist__cell {
  width: 5.6rem; text-align: right; white-space: nowrap; font-family: var(--font-mono);
  font-variant-numeric: tabular-nums; font-size: 0.86rem; color: var(--spruce-dim); font-weight: 500;
}
.budget-row--head .budget-hist__cell { font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; }
.budget-row--total .budget-hist__cell { font-weight: 600; color: var(--spruce-2); }
@media (max-width: 1100px) { .budget-hist__cell:first-child { display: none; } }
@media (max-width: 960px) { .budget-hist { display: none; } }
.budget-row__sub { display: block; font-size: 0.78rem; font-family: var(--font-body); color: var(--spruce-dim); font-weight: 400; line-height: 1.2; margin-top: 0.1rem; }

/* Hover card on a budget category: the last three months at a glance. */
.recur-name { position: relative; }
.peek {
  position: absolute; left: 0; top: calc(100% + 0.4rem); z-index: 30;
  min-width: 15rem; padding: 0.7rem 0.85rem 0.6rem;
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); font-size: 0.88rem; line-height: 1.4;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
  pointer-events: none;
}
.recur-name:hover .peek, .recur-name:focus-within .peek {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0.25s, 0.25s, 0.25s;
}
.peek__title { font-weight: 700; margin-bottom: 0.35rem; color: var(--spruce); }
.peek__row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.12rem 0; color: var(--spruce-dim); font-variant-numeric: tabular-nums; }
.peek__row span:last-child { font-family: var(--font-mono); }
.peek__row--current { color: var(--spruce); font-weight: 600; }
.peek__row--avg { border-top: 1px solid var(--line-soft); margin-top: 0.25rem; padding-top: 0.35rem; color: var(--spruce); font-weight: 600; }
.peek__link { display: block; margin-top: 0.45rem; font-size: 0.85rem; font-weight: 600; color: var(--clay-deep); }

/* ---------- Income: scheduled vs arrived ---------------------------------- */

.budget-row--income { grid-template-columns: minmax(0, 1fr) 7.5rem 8rem 9rem; }
.budget-row--untagged { background: color-mix(in srgb, var(--butter-pale) 40%, transparent); margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; border-radius: var(--radius-sm); }
.income-wait { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--spruce-dim); }
.income-wait small { font-family: var(--font-body); font-size: 0.78rem; }
.income-add { margin-top: 1rem; }
.income-add > summary { cursor: pointer; list-style: none; }
.income-add > summary::-webkit-details-marker { display: none; }
.income-add__form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-top: 0.6rem; }
.income-add__form .field { margin: 0; flex: 1; min-width: 12rem; }
.income-add .meta-quiet { margin: 0.5rem 0 0; }
.income-note { margin-top: 0.8rem; }
.rta-banner--ahead { background: color-mix(in srgb, var(--sky) 34%, var(--cream)); border-color: color-mix(in srgb, var(--spruce) 22%, transparent); color: var(--spruce-2); }
.rta-banner__breakdown li > i { margin-right: 0.15rem; }

/* ---------- Appearance switch + quieter row controls ---------------------- */

.user-menu__theme { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.75rem; margin-top: 0.3rem; border-top: 1px solid var(--line-soft); }
.user-menu__theme-label { font-size: 0.9rem; color: var(--spruce-dim); }
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--oat-deep); }
.seg__opt { border: 0; background: none; padding: 0.3rem 0.6rem; border-radius: 999px; color: var(--spruce-dim); cursor: pointer; font-size: 0.9rem; line-height: 1; transition: background 0.12s ease, color 0.12s ease; }
.seg__opt:hover { color: var(--spruce); }
.seg__opt.is-on { background: var(--cream); color: var(--spruce); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }

/* Secondary controls on budget rows (type toggle, savings target) sit back until
   the row is hovered or focused; touch screens always show them. */
.budget-row .class-toggle, .budget-row .target-edit__open, .budget-row .recur-toggle:not(.recur-toggle--on) { opacity: 0.55; transition: opacity 0.12s ease; }
.budget-row:hover .class-toggle, .budget-row:hover .target-edit__open, .budget-row:hover .recur-toggle,
.budget-row:focus-within .class-toggle, .budget-row:focus-within .target-edit__open, .budget-row:focus-within .recur-toggle { opacity: 1; }
@media (hover: none) { .budget-row .class-toggle, .budget-row .target-edit__open, .budget-row .recur-toggle { opacity: 1; } }
.recur-toggle > i, .target-edit__open > i, .drag-handle > i { font-size: 0.85em; }
.recur-toggle--locked > i { font-size: 0.75rem; }

/* Dark-mode specifics that tokens alone can't express. */
:root[data-theme="dark"] body.app, :root:not([data-theme="light"]) body.app { background-image: radial-gradient(ellipse 90% 60% at 50% -10%, color-mix(in srgb, var(--cream) 70%, transparent) 0%, transparent 60%); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) body.app { background-image: radial-gradient(ellipse 90% 60% at 50% -10%, var(--cream) 0%, transparent 60%); } }
:root[data-theme="dark"] .seg__opt.is-on { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }

/* ---------- 3-month plan: one grid, everything aligned ----------------------- */

.qt-card { padding: 1.1rem 1.25rem 1.25rem; overflow-x: auto; }
.qt { display: grid; grid-template-columns: minmax(11rem, 1.4fr) repeat(9, minmax(5.2rem, auto)); column-gap: 0.45rem; font-size: 0.9rem; min-width: 64rem; }
.qt__row > *, .q-cell > * { padding: 0.36rem 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; min-width: 0; }
/* Rows and per-month cell groups are transparent to the grid (declared after the
   cell rule so the wrapper itself never becomes a flex box). */
.qt__row, .qt__row > .q-cell { display: contents; padding: 0; border: 0; }
.qt__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt__hint { font-weight: 400; color: var(--spruce-dim); font-size: 0.8rem; margin-left: 0.4rem; }
.qt__num { justify-content: flex-end; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.88rem; }
.qt__num--first { border-left: 1px solid var(--line-soft); padding-left: 0.6rem; margin-left: 0.2rem; }
.qt__num--blank { color: var(--spruce-dim); font-family: var(--font-body); }
.qt .pill { font-size: 0.8rem; padding: 0.12rem 0.45rem; }
.qt .budget-assign__input { width: 100%; max-width: 5.6rem; font-size: 0.85rem; padding: 0.3rem 0.45rem; }
.qt__row--months > * { border-bottom: none; padding-bottom: 0.2rem; }
.qt__month { grid-column: span 3; justify-content: center; gap: 0.5rem; font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; border-left: 1px solid var(--line-soft); }
.qt__month .tag { font-family: var(--font-body); }
.qt__month--pre { opacity: 0.7; }
.qt__row--section > * { border-bottom: 1.5px solid var(--line); padding-top: 1rem; padding-bottom: 0.25rem; }
.qt__row--section .qt__name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; }
.qt__row--head > * { font-family: var(--font-body); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim); font-weight: 700; border-bottom: 1.5px solid var(--line); padding-top: 0.6rem; }
.qt__row--plan .qt__name { font-weight: 500; }
.qt__row--plan-total > * { border-bottom: none; }
.qt__row--plan-total .qt__name { font-weight: 700; }
.qt__row--total > * { border-bottom: none; padding-top: 0.45rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--spruce-dim); font-family: var(--font-body); }
.qt__row--total .qt__num { font-family: var(--font-mono); font-size: 0.85rem; color: var(--spruce-2); text-transform: none; letter-spacing: 0; }
.qt__row:hover > .qt__name, .qt__row:hover > .q-cell > * { background: color-mix(in srgb, var(--oat) 55%, transparent); }

/* ---------- Reports: income → expense flow (Sankey) ----------------------- */
.flow-picks { flex-wrap: wrap; }
.flow-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.flow-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem; }
.flow-form .field { margin: 0; }
.flow-form .field__label { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--spruce-dim); margin-bottom: 0.25rem; }
.flow-form .field__input--compact { min-width: 9rem; }
.flow-form .btn { margin-bottom: 0.1rem; }
.flow-figures { flex: 1; min-width: 18rem; max-width: 30rem; }
.flow-chart { position: relative; width: 100%; }
.flow-chart__svg { display: block; width: 100%; height: auto; overflow: visible; }
.flow-ribbon { opacity: 0.32; transition: opacity 0.12s ease; }
.flow-ribbon:hover { opacity: 0.6; }
.flow-node { cursor: pointer; outline: none; }
.flow-node rect { transition: filter 0.12s ease; }
.flow-node:hover rect, .flow-node:focus-visible rect { filter: brightness(1.15); stroke: var(--spruce); stroke-width: 1.5; }
.flow-node.is-selected rect { stroke: var(--clay); stroke-width: 2.5; }
/* Expected income: scheduled, not landed — drawn hollow-ish so it reads as provisional. */
.flow-node--expected rect { stroke: var(--flow-income); stroke-width: 1.5; stroke-dasharray: 4 3; fill-opacity: 0.55; }
.flow-ribbon--expected { opacity: 0.18; }
.flow-ribbon--expected:hover { opacity: 0.4; }
.flow-expected-amount { color: var(--spruce-dim); }
.chart-swatch--dashed { outline: 1.5px dashed var(--flow-income); outline-offset: -1.5px; }
.flow-note { margin-top: 0.4rem; }
.flow-node:focus-visible { box-shadow: none; }
.flow-label { font-family: var(--font-body); font-size: 12.5px; font-weight: 600; pointer-events: none; }
.flow-amount { font-family: var(--font-mono); font-size: 11.5px; pointer-events: none; }
.flow-tip {
  position: absolute; top: 0; left: 0; z-index: 20; pointer-events: none;
  padding: 0.45rem 0.65rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--cream); color: var(--spruce); box-shadow: var(--shadow-pop);
  font-size: 0.9rem; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.flow-tip b { font-family: var(--font-body); }
.flow-tip__pct { color: var(--spruce-dim); font-family: var(--font-body); }
.flow-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.8rem; }
.flow-legend span { display: inline-flex; align-items: center; }
.flow-detail:empty { display: none; }
.flow-detail__hint { text-align: center; }
.flow-detail__total { font-size: 1.25rem; }
.flow-detail__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.flow-txns__date { white-space: nowrap; width: 8rem; }
@media (max-width: 900px) { .flow-detail__grid { grid-template-columns: 1fr; } }

/* Account settings → MCP access */
.mcp-form { margin-top: 1.2rem; }
.mcp-help { color: var(--spruce-dim); font-size: 0.92rem; margin: 0.25rem 0 0.8rem; }
.mcp-reveal {
  border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1.2rem;
  background: color-mix(in srgb, var(--oat) 60%, transparent);
}
.mcp-reveal p { margin: 0 0 0.6rem; }
.mcp-reveal__row { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.9rem; }
.mcp-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem;
  background: var(--cream); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 0.45rem 0.6rem; overflow-wrap: anywhere; flex: 1; min-width: 0;
}
.mcp-code--block { display: block; white-space: pre-wrap; margin: 0; }

/* Amazon orders: what a charge bought (transactions list + money/amazon) */
.txn__amazon { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; color: var(--spruce-dim); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn__amazon > i { flex: none; font-size: 0.85em; }
.txn__legs { list-style: none; margin: 0.35rem 0 0.2rem; padding: 0; display: grid; gap: 0.15rem; font-size: 0.92rem; }
.txn__legs li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.txn__leg-memo { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn__leg-amount { color: var(--spruce-dim); font-variant-numeric: tabular-nums; }
.amazon-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; font-size: 0.95rem; }
.amazon-items li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.amazon-table thead th { text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--spruce-dim); padding: 0 0.4rem 0.5rem; }
.amazon-table thead th:first-child { padding-left: 0; }
.steps { margin: 0 0 1rem 1.2rem; padding: 0; display: grid; gap: 0.4rem; }

/* ---------- Reports: shared filter bar, drawer, tables ----------------------- */

.report-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.7rem 1.5rem; padding: 0.9rem 1.25rem; }
.report-filters__presets { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.report-filters__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin: 0; }
.report-filters__form .field { margin: 0; }
.report-filters__form .field__label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--spruce-dim); margin-bottom: 0.2rem; }
.report-filters__form .field__input--compact { min-width: 8.5rem; }
.report-filters__form .chip { align-self: center; }
.drawer__option--group { font-weight: 700; margin-top: 0.4rem; }
.drawer__option--sub { padding-left: 2rem; font-weight: 500; }

/* Category colour dot; --cat is set inline per category. */
.cat-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 999px; background: var(--cat, var(--spruce-dim)); margin-right: 0.45rem; vertical-align: -0.02rem; flex: none; }
.cat-name { display: inline-flex; align-items: center; gap: 0.1rem; font-weight: 600; }

/* Wide drawer for the transactions behind a chart segment. */
.drawer--wide { width: min(38rem, 100vw); }
.drawer--wide .drawer__panel { position: relative; }
.drawer__close--float { position: absolute; top: 0.9rem; right: 0.9rem; z-index: 2; }
.drawer__body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.drawer__head--detail { align-items: flex-start; padding-right: 3.6rem; }
.drawer__head--detail h2 { font-size: 1.35rem; }
.drawer__section--detail { padding-bottom: 1.2rem; overflow: visible; }
.drawer__section--detail .bar-row .bar { max-width: none; }
.flow-txns__memo { display: block; font-size: 0.88rem; }

.figure__delta { font-size: 0.9rem; font-weight: 500; color: var(--spruce-dim); margin-left: 0.2rem; }
.delta { font-family: var(--font-mono); font-size: 0.9rem; color: var(--spruce-dim); white-space: nowrap; }
.delta--up { color: var(--danger); }
.delta--down { color: var(--good); }

.chart-grid--report { grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); }
.chart-head__tools { display: inline-flex; align-items: center; gap: 0.6rem; }
.chart-holder--tall { height: 340px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim); padding: 0 0.4rem 0.5rem; font-weight: 700; }
.report-table th:first-child { padding-left: 0; }
.report-table th.table__meta { text-align: right; }
.report-table tr.is-clickable { cursor: pointer; }
.report-table tr.is-clickable:hover td { background: color-mix(in srgb, var(--oat-deep) 55%, transparent); }
.report-table__sub { display: block; font-size: 0.85rem; }
.share { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 6rem; justify-content: flex-end; }
.share__bar { display: inline-block; height: 0.45rem; max-width: 4rem; border-radius: 999px; background: var(--clay); }
.share__pct { font-family: var(--font-mono); font-size: 0.9rem; color: var(--spruce-dim); min-width: 2.4rem; text-align: right; }

.legend-list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; }
.legend-list__item { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line-soft); border-radius: 999px; background: none; color: var(--spruce); padding: 0.28rem 0.7rem 0.28rem 0.55rem; font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.legend-list__item:hover { background: var(--oat-deep); }
.legend-list__item .amount { font-size: 0.85rem; }

/* Income v expense grid: each row is its own grid with the same fixed columns so
   rows inside <details> line up with the rows outside. */
.ie-card { padding-bottom: 1rem; }
.ie { min-width: max-content; font-size: 0.93rem; }
.ie-row { display: grid; grid-template-columns: minmax(13rem, 1fr) repeat(var(--ie-cols, 1), 7.2rem) 7.6rem 7.6rem; align-items: center; border-bottom: 1px solid var(--line-soft); }
.ie-row > * { padding: 0.42rem 0.45rem; min-width: 0; }
.ie-row > :first-child { position: sticky; left: 0; background: var(--cream); z-index: 1; padding-left: 0; }
.ie-row--head { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--spruce-dim); font-weight: 700; border-bottom: 1.5px solid var(--line); }
.ie-row--section { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; border-bottom: 1.5px solid var(--line); margin-top: 0.8rem; }
.ie-row--section .ie-cell { font-size: 0.95rem; }
.ie-row--income .ie-cell { color: var(--good); }
.ie-row--group { cursor: pointer; list-style: none; font-weight: 700; }
.ie-row--group::-webkit-details-marker { display: none; }
.ie-row--sub .ie-name { padding-left: 1.6rem; font-weight: 500; display: flex; align-items: center; }
.ie-row--net { font-weight: 700; border-top: 1.5px solid var(--line); border-bottom: none; margin-top: 0.3rem; }
.ie-row--net > :first-child { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.78rem; color: var(--spruce-dim); }
.ie-group__caret { display: inline-block; width: 0.9rem; color: var(--spruce-dim); transition: transform 0.12s ease; font-weight: 700; }
.ie-group[open] > summary .ie-group__caret { transform: rotate(90deg); }
.ie-num { text-align: right; }
.ie-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ie-cell { display: inline-block; padding: 0.15rem 0.4rem; border-radius: 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.9rem; border: 0; background: none; color: inherit; font-weight: inherit; }
button.ie-cell { cursor: pointer; }
button.ie-cell:hover { background: var(--oat-deep); }
.ie-cell__dash { color: var(--spruce-dim); opacity: 0.6; }
.ie-cell.is-over { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.ie-cell.is-under { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.ie-cell.is-short { background: color-mix(in srgb, var(--butter) 30%, transparent); color: var(--clay-deep); }
.ie-cell.is-met { color: var(--good); }
.ie-cell.is-group { font-weight: 700; }
.ie-cell.is-total { font-weight: 700; }
.ie-row:hover > * { background: color-mix(in srgb, var(--oat) 55%, transparent); }
.ie-row:hover > :first-child { background: color-mix(in srgb, var(--oat) 55%, var(--cream)); }

/* Sankey on the Cash flow page: figures + controls above, amounts hideable. */
.sankey__tools { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.8rem 1.5rem; margin-bottom: 1rem; }
.sankey__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.sankey .seg__opt { text-decoration: none; }
.sankey.is-masked .figure__value { filter: blur(7px); user-select: none; }
.sankey.is-masked .flow-amount { opacity: 0.6; }
.sankey [aria-pressed="true"] { background: var(--oat-deep); color: var(--spruce); }
.sankey__tools .flow-figures { max-width: none; }

/* Category colour picker on the category form. */
.swatch-picker { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.swatch { position: relative; width: 1.9rem; height: 1.9rem; border-radius: 999px; cursor: pointer; display: grid; place-items: center; }
.swatch input[type=radio] { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch__dot { width: 1.5rem; height: 1.5rem; border-radius: 999px; background: var(--cat); box-shadow: 0 0 0 2px var(--cream); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.swatch:has(input:checked) .swatch__dot, .swatch:has(input:focus-visible) .swatch__dot { transform: scale(1.12); box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--spruce); }
.swatch--custom input[type=color] { width: 1.9rem; height: 1.9rem; padding: 0; border: 2px dashed var(--line); border-radius: 999px; background: none; cursor: pointer; }
.swatch--custom:has(.swatch__hidden:checked) input[type=color] { border-style: solid; border-color: var(--spruce); }
.swatch__hidden { pointer-events: none; }

/* ---------- Insights (worth a look) ------------------------------------------ */

.insights { display: grid; gap: 0.6rem; }
.insight {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: start;
  padding: 0.8rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--oat) 45%, var(--cream));
}
.insight--warning { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--cream)); }
.insight--notice { border-color: color-mix(in srgb, var(--butter) 60%, transparent); background: color-mix(in srgb, var(--butter-pale) 45%, var(--cream)); }
.insight__icon { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 999px; background: var(--cream); color: var(--spruce-dim); font-size: 0.9rem; }
.insight--warning .insight__icon { color: var(--danger); }
.insight--notice .insight__icon { color: var(--clay-deep); }
.insight__body { min-width: 0; }
.insight__title { margin: 0 0 0.15rem; font-weight: 700; }
.insight__text { margin: 0; color: var(--spruce-2); font-size: 0.95rem; line-height: 1.4; }
.insight__rule { margin-top: 0.35rem; font-size: 0.85rem; color: var(--spruce-dim); }
.insight__rule summary { cursor: pointer; }
.insight__rule p { margin: 0.3rem 0 0; }
.insight__dismiss {
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 999px;
  border: 0; background: none; color: var(--spruce-dim); cursor: pointer; font-size: 0.95rem;
}
.insight__dismiss:hover { background: var(--oat-deep); color: var(--spruce); }
.chip--insight { font-size: 0.72rem; padding: 0.1rem 0.45rem; margin-left: 0.4rem; vertical-align: 0.1rem; gap: 0.25rem; }
.chip--warning { background: color-mix(in srgb, var(--danger) 14%, var(--cream)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.chip--notice { background: color-mix(in srgb, var(--butter) 32%, var(--cream)); border-color: color-mix(in srgb, var(--butter) 70%, transparent); color: var(--clay-deep); }
.chip--info { color: var(--spruce-dim); }

/* Pace bar under a budget category: spent vs assigned, with a "today" tick. */
.pace { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; max-width: 15rem; }
.pace__track { position: relative; flex: 1; height: 0.35rem; border-radius: 999px; background: var(--oat-deep); overflow: visible; }
.pace__fill { display: block; height: 100%; border-radius: 999px; background: var(--good); transition: width 0.2s ease; }
.pace--warn .pace__fill { background: var(--butter); }
.pace--over .pace__fill { background: var(--danger); }
.pace__today { position: absolute; top: -0.2rem; bottom: -0.2rem; width: 2px; margin-left: -1px; background: var(--spruce-dim); border-radius: 1px; opacity: 0.7; }
.pace__note { font-size: 0.75rem; font-family: var(--font-mono); white-space: nowrap; color: var(--spruce-dim); }
.pace__note--over { color: var(--danger); }
.pace__note--warn { color: var(--clay-deep); }
.budget-row--total .pace { max-width: 9rem; display: inline-flex; margin-left: 0.6rem; vertical-align: middle; width: 9rem; }

/* ---------- Treemap, net worth table, saved views ---------------------------- */

.treemap { position: relative; width: 100%; }
.treemap__svg { display: block; width: 100%; height: auto; }
.treemap__cell { cursor: pointer; outline: none; }
.treemap__cell rect { transition: filter 0.12s ease; }
.treemap__cell:hover rect, .treemap__cell:focus-visible rect { filter: brightness(1.12); }
.treemap__cell:focus-visible { box-shadow: none; }
.treemap__label { font-family: var(--font-body); font-size: 13px; font-weight: 700; pointer-events: none; }
.treemap__amount { font-family: var(--font-mono); font-size: 11.5px; pointer-events: none; }
.chart-head--sub { margin-bottom: 0.3rem; }
.report-table tr.is-selected td { background: color-mix(in srgb, var(--butter-pale) 45%, transparent); }

.saved-views { margin-left: 0.4rem; }
.saved-views > summary.saved-views__summary { width: auto; height: auto; border-radius: 999px; background: none; color: var(--spruce-dim); display: inline-flex; gap: 0.35rem; padding: 0.35rem 0.75rem; border: 1px solid var(--line); font-weight: 600; }
.saved-views[open] > summary.saved-views__summary { transform: none; border-color: var(--spruce-dim); color: var(--spruce); }
.saved-views__sheet { left: 0; right: auto; min-width: 17rem; }
.saved-views__row { display: flex; align-items: center; gap: 0.2rem; }
.saved-views__row .user-menu__item { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-views__remove { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 999px; border: 0; background: none; color: var(--spruce-dim); cursor: pointer; font-size: 0.8rem; }
.saved-views__remove:hover { background: var(--oat-deep); color: var(--danger); }
.saved-views__empty { padding: 0.4rem 0.75rem; margin: 0; }
.saved-views__save { border-top: 1px solid var(--line-soft); margin-top: 0.3rem; padding-top: 0.6rem; border-radius: 0; }
.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.saved-list__item { display: flex; align-items: center; gap: 0.4rem; }
.saved-list__link { flex: 1; display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.5rem; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.saved-list__link:hover { background: var(--oat-deep); }
.saved-list__name { font-weight: 600; }
/* Bills page: add-a-subscription disclosure */
.bill-add { margin-top: 1rem; }
.bill-add > summary { list-style: none; display: inline-flex; gap: 0.35rem; }
.bill-add > summary::-webkit-details-marker { display: none; }
.bill-add__body { margin-top: 0.8rem; max-width: 36rem; }
