/* ==========================================================================
   Cash Jar — local-first envelope budgeting
   ========================================================================== */

:root {
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f2f0ea;
  --border: #e6e2d9;
  --border-strong: #d6d0c4;
  --ink: #1b2522;
  --ink-soft: #3d4a45;
  --muted: #6d7772;
  --faint: #9aa39e;
  --accent: #0f6b5c;
  --accent-strong: #0a5347;
  --accent-soft: #e2f1ec;
  --accent-line: #bfded6;
  --positive: #157f4b;
  --positive-soft: #e7f4ec;
  --negative: #bb3a29;
  --negative-soft: #fcece9;
  --amber: #a3680d;
  --amber-soft: #fbf1dd;
  --sidebar: #0e2621;
  --sidebar-2: #143129;
  --sidebar-text: #e9f1ed;
  --sidebar-muted: #8da79d;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 28, 0.035);
  --shadow: 0 1px 2px rgba(22, 33, 28, 0.04), 0 10px 28px rgba(22, 33, 28, 0.055);
  --shadow-lg: 0 24px 70px rgba(12, 26, 21, 0.28);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, serif;
}

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

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--accent);
}

svg.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- boot ---------------------------------------------------------------- */

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.boot-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 15px;
  background: linear-gradient(145deg, #1e8f77, #0c5f50);
  color: #eafff8;
  font-family: var(--serif);
  font-size: 30px;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px rgba(15, 107, 92, 0.25);
}

.noscript {
  position: fixed;
  inset: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  z-index: 999;
}

/* ---- app layout ---------------------------------------------------------- */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 30px 34px 72px;
  flex: 1;
  animation: view-in 0.22s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- sidebar ------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: var(--sidebar-text);
  background:
    radial-gradient(90% 55% at 10% 0%, rgba(57, 143, 120, 0.24), transparent 65%),
    radial-gradient(70% 40% at 100% 100%, rgba(21, 91, 75, 0.25), transparent 70%),
    var(--sidebar);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 0;
  margin-bottom: 28px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #26967e, #0b5a4c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 18px rgba(0, 0, 0, 0.2);
  color: #eafff8;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.025em;
}

.brand-sub {
  margin-top: 4px;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar-label {
  padding: 0 12px;
  margin-bottom: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #c7d6d0;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.nav-link .icon {
  width: 17px;
  height: 17px;
  opacity: 0.88;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.105);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  border-radius: 0 3px 3px 0;
  background: #57c8a8;
}

.sidebar-divider {
  height: 1px;
  margin: 20px 10px;
  background: rgba(255, 255, 255, 0.08);
}

.accounts-block {
  margin-top: 4px;
}

.accounts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  margin-bottom: 8px;
}

.accounts-total {
  font-size: 11px;
  color: var(--sidebar-muted);
  font-variant-numeric: tabular-nums;
}

.accounts-total b {
  color: #cfe0d9;
  font-weight: 600;
}

.account-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 8px;
  color: #c2d3cc;
  text-decoration: none;
  font-size: 12.5px;
  transition: background 0.14s ease;
}

.account-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.account-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.account-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #57c8a8;
  box-shadow: 0 0 0 3px rgba(87, 200, 168, 0.12);
}

.account-dot.savings {
  background: #7fb4e8;
  box-shadow: 0 0 0 3px rgba(127, 180, 232, 0.12);
}

.account-dot.credit {
  background: #e8a37f;
  box-shadow: 0 0 0 3px rgba(232, 163, 127, 0.12);
}

.account-dot.cash {
  background: #d8c46c;
  box-shadow: 0 0 0 3px rgba(216, 196, 108, 0.12);
}

.account-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-balance {
  font-size: 11.5px;
  color: #9fb6ad;
  font-variant-numeric: tabular-nums;
}

.account-balance.negative {
  color: #e7a89b;
}

.sidebar-add {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin-top: 6px;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: 12px;
  text-align: left;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.sidebar-add:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #dcebe5;
}

.sidebar-add .icon {
  width: 14px;
  height: 14px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 6px 2px;
}

.local-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.local-card .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: #6fc6ae;
}

.local-card b {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cfe0d9;
}

.local-card span {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  line-height: 1.4;
  color: var(--sidebar-muted);
}

.sidebar-settings {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: 12px;
  text-decoration: none;
}

.sidebar-settings:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e3efe9;
}

.sidebar-settings .icon {
  width: 15px;
  height: 15px;
}

.sidebar-backdrop {
  display: none;
}

/* ---- topbar -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
  padding: 0 34px;
  background: rgba(244, 243, 238, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

.topbar-budget {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.local-badge .icon {
  width: 12px;
  height: 12px;
}

.mobile-menu-btn {
  display: none;
}

/* ---- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: #c4bdae;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px rgba(15, 107, 92, 0.2);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-3);
  border-color: transparent;
  color: var(--ink);
}

.btn-danger {
  border-color: #ecc7c0;
  background: #fff;
  color: var(--negative);
}

.btn-danger:hover {
  background: var(--negative-soft);
  border-color: #dfa79d;
}

.btn-sm {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn.danger:hover {
  background: var(--negative-soft);
  color: var(--negative);
}

.icon-btn .icon {
  width: 15px;
  height: 15px;
}

/* ---- page headers -------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.page-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- month navigation ---------------------------------------------------- */

.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.month-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.month-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.month-btn .icon {
  width: 15px;
  height: 15px;
}

.month-label {
  min-width: 122px;
  padding: 0 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.this-month {
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-left: 1px solid var(--border);
  margin-left: 2px;
  line-height: 30px;
}

.this-month:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- budget summary ------------------------------------------------------ */

.budget-hero {
  display: grid;
  grid-template-columns: 1.32fr 1fr 1fr 1fr;
  gap: 11px;
  margin-bottom: 20px;
}

.rta-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 128px;
  padding: 17px 19px 16px;
  border-radius: var(--radius-lg);
  color: #eafff8;
  background:
    radial-gradient(120% 150% at 100% 0%, rgba(255, 255, 255, 0.16), transparent 58%),
    linear-gradient(135deg, #126957 0%, #0b453b 100%);
  box-shadow: 0 10px 26px rgba(13, 80, 67, 0.2);
}

.rta-card.negative {
  background:
    radial-gradient(120% 150% at 100% 0%, rgba(255, 255, 255, 0.14), transparent 58%),
    linear-gradient(135deg, #8a3024 0%, #5e1d15 100%);
  box-shadow: 0 10px 26px rgba(112, 35, 25, 0.22);
}

.rta-card.zero {
  background:
    radial-gradient(120% 150% at 100% 0%, rgba(255, 255, 255, 0.14), transparent 58%),
    linear-gradient(135deg, #22554b 0%, #143a33 100%);
  box-shadow: 0 10px 26px rgba(20, 58, 51, 0.2);
}

.rta-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(234, 255, 248, 0.72);
}

.rta-edit {
  margin-left: auto;
  color: inherit;
  opacity: 0.7;
}

.rta-edit:hover {
  opacity: 1;
}

.rta-amount {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.rta-hint {
  font-size: 11.5px;
  line-height: 1.35;
  color: rgba(234, 255, 248, 0.68);
}

.rta-card .rta-hint strong {
  color: #fff;
  font-weight: 600;
}

.rta-actions {
  position: absolute;
  top: 14px;
  right: 14px;
}

.rta-actions .icon-btn {
  color: rgba(255, 255, 255, 0.65);
}

.rta-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 128px;
  padding: 17px 18px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat-value {
  margin: 6px 0 2px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.stat-value.positive {
  color: var(--positive);
}

.stat-value.negative {
  color: var(--negative);
}

.stat-note {
  font-size: 10.5px;
  color: var(--faint);
}

/* ---- budget toolbar & groups -------------------------------------------- */

.budget-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

.toolbar-note .icon {
  width: 13px;
  height: 13px;
  color: var(--faint);
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 70;
  width: 286px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(18, 35, 28, 0.18);
  display: none;
  transform-origin: top right;
}

.menu.open {
  display: block;
  animation: menu-pop 0.13s ease both;
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.menu button:hover {
  background: var(--surface-2);
}

.menu button b {
  font-size: 12.5px;
  font-weight: 600;
}

.menu button span {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--faint);
}

.menu hr {
  margin: 5px 8px;
  border: 0;
  border-top: 1px solid var(--border);
}

.group-card {
  margin-bottom: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px 13px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #fcfbf8);
}

.group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.group-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.group-meta b {
  color: var(--ink-soft);
  font-weight: 600;
}

.income-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 85, 75, 0.1);
  color: #22554b;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.income-card .group-head {
  cursor: default;
}

.income-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 140px;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.income-grid.head {
  min-height: 32px;
  border-bottom: 1px solid #f0ede6;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

.income-grid.head > div:nth-child(n + 2) {
  text-align: right;
}

.income-row {
  min-height: 46px;
  border-bottom: 1px solid #f3f0ea;
}

.income-row:last-child {
  border-bottom: 0;
}

.income-row:hover {
  background: #fbfaf7;
}

.category-chip.income .dot {
  background: #22554b;
}

.budget-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1.75fr) 100px 132px 112px 128px;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.budget-grid.head {
  min-height: 32px;
  border-bottom: 1px solid #f0ede6;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

.budget-grid.head > div:nth-child(n + 2) {
  text-align: right;
}

.budget-row {
  min-height: 57px;
  border-bottom: 1px solid #f3f0ea;
  transition: background 0.12s ease;
}

.budget-row:last-child {
  border-bottom: 0;
}

.budget-row:hover {
  background: #fbfaf7;
}

/* drag & drop reordering */
.category-chip.split .dot {
  background: var(--accent);
}

.budget-row.dragging,
.group-card.dragging,
.data-row.dragging {
  opacity: 0.45;
}

.budget-row.drag-over-top,
.data-row.drag-over-top {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.budget-row.drag-over-bottom,
.data-row.drag-over-bottom {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.group-card.drag-over-top > .group-head {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.group-card.drag-over-bottom {
  border-bottom: 2px solid var(--accent);
}

.data-row[draggable="true"] {
  cursor: grab;
}
.data-row[draggable="true"]:active {
  cursor: grabbing;
}

.group-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.group-head {
  cursor: grab;
}

.group-head:active {
  cursor: grabbing;
}

.budget-row[draggable="true"] .cat-name {
  cursor: grab;
}

.cat-cell {
  min-width: 0;
  padding: 9px 0;
}

.cat-name {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-name:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.goal-line {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  margin-top: 3px;
  font-size: 9.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.goal-line .goal-pct {
  margin-left: auto;
}

.goal-bar {
  width: 100%;
  max-width: 220px;
  height: 3px;
  margin-top: 4px;
  border-radius: 3px;
  background: #efebe2;
  overflow: hidden;
}

.goal-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.goal-bar i.met {
  background: var(--positive);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.goal-cell {
  font-size: 11.5px;
  color: var(--faint);
}

.assigned-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.assigned-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #faf9f6;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.assigned-cell:hover {
  border-color: var(--border-strong);
  background: #fff;
}

.assigned-cell:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.assigned-cell .cur {
  padding-left: 8px;
  font-size: 10.5px;
  color: var(--faint);
}

.assigned-input {
  width: 100%;
  padding: 7px 8px 7px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.assigned-input::-webkit-inner-spin-button,
.assigned-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.activity-cell {
  font-size: 12.5px;
  font-weight: 500;
}

.available-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 6px 11px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

.pill:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
  box-shadow: 0 4px 10px rgba(24, 40, 33, 0.08);
}

.pill.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.pill.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.pill.zero {
  background: #f1efe9;
  color: var(--muted);
}

.cell-label {
  display: none;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

.amount.positive {
  color: var(--positive);
}

.amount.negative {
  color: var(--negative);
}

.amount.muted {
  color: var(--faint);
}

/* ---- uncategorized & empty states --------------------------------------- */

.uncat-card {
  border-color: #eadcc3;
  background: linear-gradient(180deg, #fffdf8, #fff);
}

.uncat-card .group-head {
  background: transparent;
  border-bottom-color: #f1e6d3;
}

.uncat-card .group-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uncat-card .group-title .icon {
  width: 15px;
  height: 15px;
  color: var(--amber);
}

.uncat-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  flex-wrap: wrap;
}

.uncat-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  max-width: 620px;
}

.uncat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 54px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon .icon {
  width: 21px;
  height: 21px;
}

.empty-card h3 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 20px;
}

.empty-card p {
  margin: 0;
  max-width: 380px;
  color: var(--muted);
  font-size: 12.5px;
}

.empty-card .btn {
  margin-top: 6px;
}

/* ---- shared form controls ------------------------------------------------ */

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d7772' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 13px;
  cursor: pointer;
}

.input::placeholder,
.textarea::placeholder {
  color: #b1b8b4;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background-color: #fff;
}

.textarea {
  resize: vertical;
  min-height: 72px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field > label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.field .hint {
  margin-top: -1px;
  font-size: 10.5px;
  color: var(--faint);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 330px;
}

.search-wrap .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search-wrap .input {
  padding-left: 34px;
}

.filter-select {
  width: auto;
  min-width: 130px;
  font-size: 12.5px;
}

.filter-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}

/* ---- ledger tables ------------------------------------------------------- */

.table-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.ledger {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.ledger th {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  background: #fbfaf7;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ledger th.num {
  text-align: right;
}

.ledger .sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.ledger .sort-btn:hover {
  background: #f1eee7;
  color: var(--ink);
}

.ledger .sort-btn.active {
  color: var(--ink);
}

.ledger .sort-arrow {
  font-size: 8px;
  line-height: 1;
  opacity: 0.7;
}

.ledger td {
  padding: 10px 15px;
  border-bottom: 1px solid #f3f0ea;
  font-size: 12.5px;
  vertical-align: middle;
}

.ledger tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.ledger tbody tr:hover {
  background: #fbfaf7;
}

.ledger tbody tr:last-child td {
  border-bottom: 0;
}

.ledger td.num {
  text-align: right;
}

.ledger .balance-cell {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger .balance-cell .negative {
  color: var(--negative, #a5372a);
}

.ledger .actions-col {
  width: 76px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.13s ease;
}

.ledger tr:hover .row-actions,
.ledger tr:focus-within .row-actions {
  opacity: 1;
}

/* ---- ledger multi-select -------------------------------------------------- */

.ledger th.check-col {
  width: 34px;
  padding-left: 13px;
  padding-right: 0;
}

.ledger td.check-col {
  width: 34px;
  padding-left: 13px;
  padding-right: 0;
}

.ledger .check-col input[type="checkbox"] {
  display: block;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ledger .check-col input[type="checkbox"]:disabled {
  cursor: default;
}

.ledger tbody tr.selected td {
  background: var(--accent-soft);
}

.bulk-bar {
  position: fixed;
  left: calc(50% + 132px);
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 18px;
  background: var(--sidebar);
  background-image: radial-gradient(
      90% 55% at 10% 0%,
      rgba(57, 143, 120, 0.24),
      transparent 65%
    ),
    radial-gradient(70% 40% at 100% 100%, rgba(21, 91, 75, 0.25), transparent 70%);
  color: var(--sidebar-text);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  animation: bulk-in 0.18s ease both;
}

.bulk-bar.show {
  display: flex;
}

@keyframes bulk-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.bulk-count {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.bulk-divider {
  width: 1px;
  height: 18px;
  margin: 0 7px;
  background: rgba(255, 255, 255, 0.18);
}

.bulk-bar .bulk-btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: transparent;
  color: #fff;
}

.bulk-bar .bulk-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: transparent;
  color: #fff;
  transform: none;
}

.bulk-bar .bulk-btn.danger {
  background: rgba(187, 58, 41, 0.32);
  color: #ffc9c1;
}

.bulk-bar .bulk-btn.danger:hover {
  background: rgba(187, 58, 41, 0.5);
  color: #fff;
}

.bulk-bar .bulk-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.bulk-bar .bulk-clear {
  color: var(--sidebar-muted);
}

.bulk-bar .bulk-clear:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.date-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.clear-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d8d3c9;
  flex-shrink: 0;
}

.clear-dot.cleared {
  background: #6cb99b;
}

.clear-dot.reconciled {
  background: var(--accent);
}

.payee-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 140px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.avatar.transfer {
  background: #eef0f6;
  color: #5e6a92;
}

.avatar .icon {
  width: 13px;
  height: 13px;
}

.payee-name {
  color: var(--ink);
  font-weight: 500;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payee-sub {
  margin-top: 1px;
  color: var(--faint);
  font-size: 10px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.category-chip .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-line);
  flex-shrink: 0;
}

.category-chip.uncategorized {
  color: var(--amber);
}

.category-chip.uncategorized .dot {
  background: #deb56f;
}

.category-chip.transfer {
  color: #6b7395;
}

.category-chip.transfer .dot {
  background: #aab1cf;
}

.account-cell {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

.empty-row td {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.empty-row .empty-icon {
  margin: 0 auto 10px;
}

/* ---- account overview ---------------------------------------------------- */

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-bottom: 24px;
}

.summary-card {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.summary-value {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.summary-value.negative {
  color: var(--negative);
}

.summary-value.positive {
  color: var(--positive);
}

.account-section {
  margin-bottom: 25px;
}

.section-title {
  margin: 0 0 9px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 11px;
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.account-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.account-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.account-icon.savings {
  background: #e8f0fa;
  color: #3d6d9e;
}

.account-icon.credit {
  background: #fbeee7;
  color: #a95f38;
}

.account-icon.cash {
  background: #f8f2db;
  color: #8c741d;
}

.account-icon .icon {
  width: 17px;
  height: 17px;
}

.account-card h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.account-type {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  text-transform: capitalize;
}

.account-card .balance {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.account-card .balance.negative {
  color: var(--negative);
}

.account-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 10px;
}

.add-account-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 135px;
  padding: 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.32);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.add-account-card:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
}

.add-account-card .icon {
  width: 19px;
  height: 19px;
}

.closed-account {
  opacity: 0.72;
}

/* ---- reports ------------------------------------------------------------- */

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-bottom: 14px;
}

.report-card {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.report-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.report-value {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.report-value.positive {
  color: var(--positive);
}

.report-value.negative {
  color: var(--negative);
}

.report-note {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--faint);
}

.report-card.wide {
  grid-column: span 2;
}

.chart-card {
  padding: 17px 19px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-heading h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.card-heading p {
  margin: 3px 0 0;
  color: var(--faint);
  font-size: 10.5px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.legend i.spending {
  background: #cc6a55;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 188px;
  margin-top: 16px;
}

.chart-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  gap: 7px;
  min-width: 0;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.chart-bar {
  position: relative;
  flex: 1;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  transition: height 0.35s ease;
}

.chart-bar.income {
  background: linear-gradient(180deg, #35a58b, #0e6b5b);
}

.chart-bar.spending {
  background: linear-gradient(180deg, #e18f7d, #bd5b47);
}

.chart-bar:hover {
  filter: brightness(1.06);
}

.chart-label {
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.report-columns {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin-top: 12px;
}

.breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 13px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 84px 38px;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #f4f1eb;
}

.breakdown-row:last-child {
  border-bottom: 0;
}

.breakdown-link {
  width: 100%;
  margin: 0;
  padding: 7px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.breakdown-link:hover {
  background: var(--surface-2);
}

.breakdown-link:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
  background: var(--surface-2);
}

.breakdown-name {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-name i {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 2px;
  background: var(--accent);
}

.breakdown-name .swatch-1 { background: #0f6b5c; }
.breakdown-name .swatch-2 { background: #4a9d82; }
.breakdown-name .swatch-3 { background: #88b98f; }
.breakdown-name .swatch-4 { background: #d6b36a; }
.breakdown-name .swatch-5 { background: #cc806b; }
.breakdown-name .swatch-6 { background: #8293b8; }

.breakdown-amount {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.breakdown-share {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.breakdown-bar {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: -3px;
  border-radius: 2px;
  background: #f0ede6;
  overflow: hidden;
}

.breakdown-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.balance-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 12px;
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f4f1eb;
}

.balance-row:last-child {
  border-bottom: 0;
}

.balance-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.balance-name .account-dot {
  width: 6px;
  height: 6px;
}

.balance-amount {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.balance-amount.negative {
  color: var(--negative);
}

.net-worth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

/* ---- settings ------------------------------------------------------------ */

.settings-grid {
  display: grid;
  gap: 14px;
  max-width: 850px;
}

.settings-card {
  padding: 19px 21px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-card h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.settings-card .help {
  margin: 4px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.setting-group {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.setting-group:first-of-type {
  margin-top: 14px;
}

.setting-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.setting-group-head h3 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
}

.cat-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 6px 12px;
  border-bottom: 1px dotted #eeeae2;
}

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

.cat-settings-name {
  flex: 1;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-settings-goal {
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cat-settings-row .icon-btn {
  width: 26px;
  height: 26px;
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f0ea;
  flex-wrap: wrap;
}

.data-row:last-child {
  border-bottom: 0;
}

.data-row-info b {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.data-row-info span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.45;
  word-break: break-all;
}

.danger-text {
  color: var(--negative);
}

/* ---- login screen -------------------------------------------------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg, #f6f3ed);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.login-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
}
.login-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- bank sync ----------------------------------------------------------- */

.sync-status {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sync-status.on {
  background: var(--positive-soft);
  color: var(--positive);
}

.sync-status.off {
  background: #f3f0ea;
  color: var(--faint);
}

.simplefin-config-form {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.simplefin-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0 7px 12px;
  border-bottom: 1px dotted #eeeae2;
}

.simplefin-account-row:last-child {
  border-bottom: 0;
}

.simplefin-account-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 12px;
}

.simplefin-account-name small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simplefin-account-balance {
  flex: none;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.simplefin-account-balance.negative {
  color: var(--negative);
}

.simplefin-error {
  margin: 4px 0 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--negative-soft);
  color: var(--negative);
  font-size: 10.5px;
  line-height: 1.45;
}

.simplefin-note {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid #f3f0ea;
}

/* ---- modals -------------------------------------------------------------- */

dialog.modal {
  width: min(540px, calc(100vw - 26px));
  max-height: min(90vh, 840px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

dialog.modal.narrow {
  width: min(430px, calc(100vw - 26px));
}

dialog.modal::backdrop {
  background: rgba(9, 23, 18, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog.modal[open] {
  animation: modal-in 0.17s ease both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 0;
}

.modal-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.modal-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
}

.modal-close:hover {
  background: #eae7df;
  color: var(--ink);
}

.modal-close .icon {
  width: 14px;
  height: 14px;
}

.modal-body {
  padding: 18px 22px 0;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
  padding: 16px 22px 20px;
}

.modal-foot.between {
  justify-content: space-between;
}

.modal-foot .left-actions {
  display: flex;
  gap: 8px;
}

/* ---- transaction form ---------------------------------------------------- */

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-3);
  margin-bottom: 16px;
}

.segmented button {
  padding: 8px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition:
    background 0.13s ease,
    color 0.13s ease,
    box-shadow 0.13s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.55;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 34, 28, 0.1);
}

.amount-field {
  position: relative;
  margin-bottom: 16px;
}

.amount-field .currency {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: var(--faint);
  font-family: var(--serif);
  font-size: 24px;
}

.amount-field input {
  width: 100%;
  padding: 12px 15px 12px 36px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  outline: none;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.amount-field input::-webkit-inner-spin-button,
.amount-field input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-field input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  display: none;
  margin: 0 0 13px;
  padding: 9px 12px;
  border: 1px solid #f0cec8;
  border-radius: 8px;
  background: var(--negative-soft);
  color: var(--negative);
  font-size: 11.5px;
}

.form-error.show {
  display: block;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.confirm-body {
  padding: 6px 22px 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.confirm-body strong {
  color: var(--ink);
}

/* ---- toast --------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  border-radius: 10px;
  background: #12261f;
  color: #effaf5;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(10, 24, 19, 0.25);
  animation: toast-in 0.2s ease both;
  pointer-events: auto;
}

.toast.error {
  background: #6c261c;
}

.toast .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #68d0b2;
}

.toast.error .icon {
  color: #f2b6a8;
}

.toast.out {
  animation: toast-out 0.18s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(5px);
  }
}

/* ---- misc ---------------------------------------------------------------- */

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.pos {
  color: var(--positive);
}

.neg {
  color: var(--negative);
}

.text-right {
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 1120px) {
  .main {
    padding: 28px 26px 70px;
  }

  .topbar {
    padding: 0 26px;
  }

  .budget-grid {
    grid-template-columns: minmax(160px, 1.5fr) 90px 120px 100px 116px;
    gap: 10px;
    padding: 0 15px;
  }

  .group-head {
    padding-inline: 15px;
  }

  .report-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 95;
    top: 0;
    bottom: 0;
    left: 0;
    width: 278px;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.24s cubic-bezier(0.22, 0.7, 0.3, 1);
    box-shadow: 18px 0 50px rgba(8, 22, 17, 0.3);
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(8, 21, 16, 0.44);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: inline-grid;
  }

  .topbar {
    padding: 0 20px;
  }

  .main {
    padding: 26px 22px 70px;
  }

  .bulk-bar {
    left: 50%;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
    padding-left: 12px;
  }
}

@media (max-width: 820px) {
  .budget-hero {
    grid-template-columns: 1fr 1fr;
  }

  .rta-card {
    grid-column: 1 / -1;
    min-height: 118px;
  }

  .stat-card {
    min-height: 104px;
  }

  .budget-grid {
    grid-template-columns: minmax(145px, 1.6fr) 116px 96px 114px;
  }

  .budget-grid > .goal-cell,
  .budget-grid.head > div:nth-child(2) {
    display: none;
  }

  .group-meta {
    gap: 11px;
  }

  .group-meta span:nth-child(2) {
    display: none;
  }

  .report-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 20px 14px 64px;
  }

  .topbar {
    height: 56px;
    padding: 0 14px;
    gap: 8px;
  }

  .topbar-title {
    display: none;
  }

  .local-badge {
    display: none;
  }

  .undo-btn .btn-label {
    display: none;
  }

  .undo-btn {
    padding: 8px 10px;
  }

  .page-head {
    margin-bottom: 17px;
    align-items: flex-start;
  }

  .page-title {
    font-size: 28px;
  }

  .page-sub {
    font-size: 12px;
  }

  .page-actions {
    width: 100%;
    justify-content: space-between;
  }

  .month-nav {
    flex: 1;
  }

  .month-label {
    flex: 1;
    min-width: 0;
  }

  .budget-hero {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rta-card {
    grid-column: auto;
  }

  .stat-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 0;
    padding: 13px 15px;
  }

  .stat-label {
    margin-bottom: 2px;
  }

  .stat-value {
    margin: 0;
    font-size: 21px;
  }

  .stat-note {
    display: none;
  }

  .budget-grid {
    display: none;
  }

  .budget-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "cat available"
      "assigned activity";
    gap: 9px 14px;
    align-items: end;
    padding: 12px 15px;
  }

  .cat-cell {
    grid-area: cat;
    padding: 0;
  }

  .goal-cell {
    display: none;
  }

  .assigned-wrap {
    grid-area: assigned;
    max-width: 170px;
  }

  .assigned-cell {
    background: var(--surface-2);
  }

  .activity-cell {
    grid-area: activity;
    justify-self: end;
    font-size: 12px;
  }

  .available-cell {
    grid-area: available;
    align-items: flex-end;
  }

  .cell-label {
    display: block;
    margin-bottom: 3px;
    color: var(--faint);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .activity-cell .cell-label {
    display: inline;
    margin-right: 4px;
  }

  .available-cell .pill {
    min-width: 82px;
  }

  .group-head {
    padding: 12px 15px;
  }

  .group-meta {
    display: none;
  }

  .uncat-body {
    padding: 13px 15px;
  }

  .account-summary {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .account-summary .summary-card:first-child {
    grid-column: 1 / -1;
  }

  .summary-value {
    font-size: 21px;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

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

  .report-card.wide {
    grid-column: 1 / -1;
  }

  .chart {
    gap: 7px;
    height: 155px;
  }

  .chart-label {
    font-size: 8px;
  }

  .card-heading {
    flex-direction: column;
  }

  .filters {
    gap: 7px;
  }

  .search-wrap {
    max-width: none;
    flex-basis: 100%;
  }

  .filter-select {
    flex: 1;
    min-width: 0;
  }

  .filter-count {
    display: none;
  }

  .row-actions {
    opacity: 1;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  dialog.modal {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 22px);
    border-radius: 16px;
  }

  .modal-head {
    padding: 17px 17px 0;
  }

  .modal-body {
    padding: 15px 17px 0;
  }

  .modal-foot {
    padding: 14px 17px 17px;
  }

  .confirm-body {
    padding-inline: 17px;
  }

  .modal-title {
    font-size: 22px;
  }

  .toast-stack {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .toast {
    max-width: none;
  }

  .settings-card {
    padding: 16px;
  }

  .data-row {
    align-items: flex-start;
  }

  .ledger {
    min-width: 600px;
  }
}

@media (max-width: 430px) {
  .report-grid {
    grid-template-columns: 1fr;
  }

  .account-summary {
    grid-template-columns: 1fr;
  }

  .account-summary .summary-card:first-child {
    grid-column: auto;
  }
}

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


/* Newly imported transactions */
tr.newly-imported td,
tr.newly-imported .payee-name,
tr.newly-imported .amount {
  font-weight: 700;
}

.activity-link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  text-decoration: none;
}
.activity-link:hover,
.activity-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.assigned-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: right;
  cursor: pointer;
}
.assigned-add-btn:hover {
  background: var(--surface-2, #f5f4f0);
  border-color: var(--border, #e5e2d9);
}
.assigned-add-btn:focus-visible {
  outline: 2px solid var(--accent-line, #bfe3db);
  outline-offset: 1px;
}
.assigned-add-btn .cur {
  color: var(--muted, #777);
  font-weight: 500;
}

/* ---- budget view toggle / yearly ---------------------------------------- */
.view-toggle { display: inline-flex; gap: 4px; align-items: center; }
.view-toggle .btn.active { background: var(--accent, #1f6f5f); color: #fff; border-color: var(--accent, #1f6f5f); }
.budget-year-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.budget-year-table th, .budget-year-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, #e5e2d9); white-space: nowrap; font-size: 12px; }
.budget-year-table th { text-align: right; font-weight: 600; color: var(--muted, #666); position: sticky; top: 0; background: var(--surface, #fff); }
.budget-year-table th:first-child, .budget-year-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface, #fff); z-index: 1; }
.budget-year-group-head th { text-align: left; background: var(--surface-2, #f5f4f0); color: var(--ink, #222); font-size: 12px; }
.budget-year-cat { font-weight: 500; }

/* ---- calendar ----------------------------------------------------------- */
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 16px; color: var(--muted, #666); font-size: 12px; align-items: center; }
.cal-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; border: 1px solid transparent; }
.cal-swatch.cal-actual { background: var(--accent, #1f6f5f); }
.cal-swatch.cal-future { background: #d8a200; }
.cal-swatch.cal-projected { background: #7a6fd6; }
.calendar-grid { padding: 0 12px 12px; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekdays { margin-bottom: 6px; }
.cal-weekday { font-size: 11px; font-weight: 600; color: var(--muted, #666); text-transform: uppercase; padding: 4px 6px; }
.cal-cell { min-height: 110px; border: 1px solid var(--border, #e5e2d9); border-radius: 10px; padding: 6px; background: var(--surface, #fff); display: flex; flex-direction: column; gap: 4px; }
.cal-cell.cal-empty { background: transparent; border-color: transparent; }
.cal-cell.cal-today { border-color: var(--accent, #1f6f5f); box-shadow: inset 0 0 0 1px var(--accent, #1f6f5f); }
.cal-cell.cal-past { background: #fcfbf8; }
.cal-day { font-size: 12px; font-weight: 600; color: var(--ink, #222); }
.cal-items { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.cal-item { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 9px; line-height: 1.15; padding: 0; border: 0; border-radius: 0; background: transparent; }
.cal-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-amt { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 9px; }
.cal-actual { color: var(--accent, #1f6f5f); }
.cal-future { color: #d8a200; }
.cal-projected { color: #7a6fd6; }
.cal-tag { font-size: 8.5px; font-weight: 700; text-transform: uppercase; color: inherit; opacity: 0.75; }
.cal-more { font-size: 9px; color: var(--muted, #666); padding: 0; }
@media (max-width: 900px) { .cal-cell { min-height: 80px; } .cal-item-amt { display:none; } }

.assigned-static { display:inline-block; width:100%; padding:6px 8px; text-align:right; font-weight:600; font-variant-numeric: tabular-nums; }
.cat-name-static { display:inline-block; padding:0; color: var(--ink, #222); font: inherit; font-weight: 600; }

button.cal-item { width: 100%; text-align: left; cursor: pointer; font: inherit; background: transparent; border: 0; padding: 0; margin: 0; appearance: none; -webkit-appearance: none; }
button.cal-item:hover { text-decoration: underline; text-underline-offset: 2px; filter: none; }
button.cal-item:focus-visible { outline: 1px solid var(--accent, #1f6f5f); outline-offset: 1px; border-radius: 2px; }
.cal-day-btn { background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; }
.cal-day-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
button.cal-more { background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; padding: 0; }
button.cal-more:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- holdings table readability ---------------------------------------- */
.holdings-table tbody tr:nth-child(even) {
  background: var(--surface-2, #faf9f6);
}
.holdings-table tbody tr:hover {
  background: var(--accent-soft, #e2f1ec);
}
.gain-pos { color: var(--positive, #157f4b); }
.gain-neg { color: var(--negative, #bb3a29); }
